Weaver Xtreme Theme Support - Version 1.9.6

Version Description

  • More refinement
  • New: "Retain menu bar hover color" when sub menu open
  • Tweak: changed default of content bottom padding to 0.
Download this release

Release Info

Developer wpweaver
Plugin Icon 128x128 Weaver Xtreme Theme Support
Version 1.9.6
Comparing to
See all releases

Code changes from version 1.9.1 to 1.9.6

admin/add-weaverx-sapi-options.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* This loads the Admin stuff. It is invoked from functions.php.
3
+ *
4
+ * This ultimately will be used to load different admin interfaces -
5
+ * like the a default Customizer version for WP.org, or the traditional Theme Options version (which it does now)
6
+ */
7
+
8
+ if (current_user_can('edit_posts')) {
9
+
10
+
11
+ add_action('admin_head', 'weaverx_admin_ts_head');
12
+
13
+ function weaverx_admin_ts_head() { // action definition
14
+ require_once(dirname(__FILE__ ) . '/admin-lib-ts.php');
15
+ require_once(dirname(__FILE__ ) . '/admin-lib-ts-2.php');
16
+
17
+ add_action('weaverx_admin_subthemes', 'weaverx_ts_weaverx_admin_subthemes');
18
+ add_action('weaverx_admin_mainopts', 'weaverx_ts_weaverx_admin_mainopts');
19
+ add_action('weaverx_admin_advancedopts', 'weaverx_ts_weaverx_admin_advancedopts');
20
+
21
+
22
+ }
23
+ // admin actions function definitons
24
+
25
+ function weaverx_ts_weaverx_admin_subthemes() {
26
+ require_once( dirname(__FILE__ ) . '/admin-subthemes.php');
27
+
28
+ weaverx_admin_subthemes();
29
+ }
30
+
31
+ function weaverx_ts_weaverx_admin_mainopts() {
32
+
33
+ require_once( dirname(__FILE__ ) . '/admin-mainopts.php');
34
+
35
+ weaverx_admin_mainopts();
36
+ }
37
+
38
+ function weaverx_ts_weaverx_admin_advancedopts() {
39
+
40
+ require_once( dirname(__FILE__ ) . '/admin-advancedopts.php');
41
+
42
+ weaverx_admin_advancedopts();
43
+ }
44
+
45
+ } // END IF CAN EDIT POSTS ---------------------------------------------------------------------
46
+
47
+
48
+ ?>
admin/admin-help.php DELETED
@@ -1,105 +0,0 @@
1
- <?php
2
- if ( !defined('ABSPATH')) exit; // Exit if accessed directly
3
- /* Weaver Xtreme - admin Help
4
- *
5
- * __ added: 12/10/14
6
- *
7
- * This is the intro form. It won't have any options because it will be outside the main form
8
- */
9
-
10
- function weaverx_admin_help() {
11
- ?>
12
- <span style="font-size:larger;font-weight:bold;padding-right:70px;"><?php _e('Weaver Xtreme Help', 'weaver-xtreme' /*adm*/); ?></span>
13
-
14
- <small><strong><?php _e('Media Library Picker Tool:', 'weaver-xtreme' /*adm*/); ?></strong></small>&nbsp;
15
- <input name="media_url" type="text" style="width:400px;height:22px;" class="regular-text" name="media_url"
16
- id="media_url" value="<?php __('Paste media URL here that you can then Copy/Paste elsewhere.', 'weaver-xtreme' /*adm*/);?>" />
17
- <?php weaverx_media_lib_button('media_url'); ?>
18
- <p>
19
- <?php _e('This is the Weaver Xtreme Admin help button: ', 'weaver-xtreme' /*adm*/); ?>
20
- <?php weaverx_help_link('help.html#top', __('Weaver Xtreme Help', 'weaver-xtreme' /*adm*/)); ?>
21
- &nbsp;&nbsp;
22
- <?php _e('Clicking the ? will open the Weaver Xtreme Help document to the appropriate section.', 'weaver-xtreme' /*adm*/); ?>
23
- </p>
24
- <h2>
25
- <?php _e('Please see our active ', 'weaver-xtreme' /*adm*/); ?>
26
- <?php weaverx_site('','//forum.weavertheme.com/',__('Weaver Support Forum', 'weaver-xtreme' /*adm*/)); ?>
27
- <?php _e('Support Forum</a> for online help.', 'weaver-xtreme' /*adm*/); ?>
28
- </h2>
29
- <?php
30
- do_action('weaverxplus_admin','help');
31
- ?>
32
- <div style="float:left;width:50%;padding-right:2%">
33
- <div class="atw-help">
34
- <h2 style="text-decoration:underline;font-weight:bold;")>
35
- <?php weaverx_help_link('help.html', __('Weaver Xtreme Help', 'weaver-xtreme' /*adm*/), __('Weaver Xtreme Theme Documentation', 'weaver-xtreme' /*adm*/)) ?>
36
- </h2>
37
- <p>
38
- <?php _e('Complete documentation for using the Weaver Xtreme Theme.', 'weaver-xtreme' /*adm*/); ?>
39
- </p>
40
- <h2 style="text-decoration:underline;font-weight:bold;")>
41
- <?php weaverx_help_link('css-help.html', __('Weaver CSS Help', 'weaver-xtreme' /*adm*/), __('CSS HELP', 'weaver-xtreme' /*adm*/)) ?>
42
- </h2>
43
- <p>
44
- <?php _e('A short CSS Tutorial', 'weaver-xtreme' /*adm*/); ?>
45
- </p>
46
- <h2 style="text-decoration:underline;font-weight:bold;")>
47
- <?php weaverx_help_link('font-demo.html', __('Examples of supported fonts', 'weaver-xtreme' /*adm*/), __('Font Examples', 'weaver-xtreme' /*adm*/)) ?>
48
- </h2>
49
- <p>
50
- <?php _e('Example of Font Families supported by Weaver Xtreme and Weaver Xtreme Plus.', 'weaver-xtreme' /*adm*/); ?>
51
- </p>
52
-
53
- <h3 style="text-decoration:underline;font-weight:bold;")>
54
- <?php _e('Release Notes', 'weaver-xtreme' /*adm*/); ?>
55
- </h3>
56
- <p>
57
- <pre>
58
- = Version 1.3 =
59
- * New: Custom Menu Placeholder item hover cursor specification
60
- * New: New item on Customizer Menu: link to Weaver Xtreme Appearance &rarr; Theme Options
61
- * Fix: &lt;!--nextpage--&gt; support on pages
62
- * Fix: style for weaver slider FI's
63
- * Tweak: Recommended Plugins wording, TGMPA update
64
- * Tweak: moved loading of style sheets to weaverx_enqueue_scripts() action
65
- * Tweak: support for shortcodes in Smart Menus (Plus)
66
- * Tweak: Comment form translation fix
67
- * Tweak: Page with Posts: sticky + author filter
68
- </pre>
69
- </p>
70
- </div>
71
- </div>
72
- <div style="float:right;width:40%;padding-right:1%">
73
-
74
- <h2><b><?php _e('RECOMMENDED PLUGINS', 'weaver-xtreme' /*adm*/); ?></b></h2>
75
- <p><strong>
76
- <?php _e('Some recommended plugins to use with your Weaver Xtreme Theme', 'weaver-xtreme' /*adm*/); ?>
77
- </strong></p>
78
- <ul>
79
- <li style="font-size:120%;"><a href="//wordpress.org/plugins/weaverx-theme-support/" target="_blank"><?php _e('Weaver Xtreme Theme Support', 'weaver-xtreme' /*adm*/); ?></a>
80
- <?php _e('- provides <strong>essential</strong> Weaver Xtreme theme options and useful shortcodes', 'weaver-xtreme' /*adm*/); ?>
81
- </li>
82
- <li><a href="//wordpress.org/plugins/show-posts/" target="_blank"><?php _e('Weaver Show Posts', 'weaver-xtreme' /*adm*/); ?></a>
83
- <?php _e('- adds the [show_posts] shortcode to selectively display posts filtered by category, tag, order, id, etc.
84
- Also adds additional filtering options to the Weaver Xtreme Page with Posts page template.
85
- This formerly was integrated with Weaver, and was considered an important part of the theme.', 'weaver-xtreme' /*adm*/); ?>
86
- </li>
87
- <li><a href="//wordpress.org/plugins/show-sliders/" target="_blank"><?php _e('Weaver Show Sliders', 'weaver-xtreme' /*adm*/); ?></a>
88
- <?php _e('- good for any kind of slideshows - images, posts, [gallery] replacement', 'weaver-xtreme' /*adm*/);?>
89
- </li>
90
- <li><a href="https://wordpress.org/plugins/wp-retina-2x/" target="_blank"><?php _e('WP Retina 2x', 'weaver-xtreme' /*adm*/); ?></a>
91
- <?php _e('- Weaver Xtreme is Retina Ready - this plugin makes your Media Library Retina Ready, too. Only needed if you use HD images.', 'weaver-xtreme' /*adm*/); ?>
92
- </li>
93
- <li><a href="https://wordpress.org/plugins/wp-edit/" target="_blank">WP Edit</a> -
94
- <?php _e('WP Edit adds additional editing functionality to the default WordPress editor.
95
- Allows content formatting without the need for extra HTML or CSS.
96
- Also includes advanced features to manage your content such as post and page revision control.', 'weaver-xtreme' /*adm*/); ?>
97
- </li>
98
- </ul>
99
-
100
- </div><div style="clear:both;"></div>
101
-
102
- <?php
103
- }
104
-
105
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/{lib-admin.php → admin-lib-ts-2.php} RENAMED
@@ -1,597 +1,5 @@
1
  <?php
2
  if ( !defined('ABSPATH')) exit; // Exit if accessed directly
3
- /* Weaver Xtreme Theme
4
-
5
- This file contains all the functions needed to interact with the different
6
- options and settings.
7
-
8
- Options are saved in the WP DB in one option called 'weaverx_main_settings'.
9
- */
10
-
11
-
12
- // ========================== utils ==================================
13
-
14
- function weaverx_end_of_section($who = '') {
15
- echo '<hr />';
16
- $name = weaverx_getopt('themename');
17
- if ( ! $name )
18
- $name = __('Please set theme name on the Advanced Options &rarr; Admin Options tab.', 'weaver-xtreme' /*adm*/);
19
-
20
- printf(__("%s %s | Options Version: %s | Subtheme: %s\n", 'weaver-xtreme' /*adm*/),WEAVERX_THEMENAME, WEAVERX_VERSION, weaverx_getopt('style_version'), $name);
21
-
22
- $last = weaverx_getopt('last_option');
23
- if ($last != 'Weaver Xtreme') // check for case of limited PHP $_POST values
24
- {
25
- ?>
26
- <p style="color:red">
27
- <?php _e('Possible Non-Standard Web Host Configuration detected. If your options
28
- are not saving correctly, your host may have limited the default number of values that PHP can use for
29
- settings. Try saving your settings again, and if this message persists, please contact your host and ask them to "Increase the PHP <em>max_input_vars</em> value for $_POST to at least 800." If that does not fix the issue,
30
- please contact Weaver Xtreme support. Diagnostic info: last_option=', 'weaver-xtreme' /*adm*/); ?><?php echo $last;?>
31
- </p>
32
- <?php
33
- }
34
-
35
- if (false && !weaverx_getopt('_hide_subtheme_link')) {
36
- ?>
37
- <p style="max-width:90%;"><?php weaverx_site('/subthemes/'); ?><img style="max-width:95%;float:left;margin-right:10px;" src="<?php echo weaverx_relative_url('/assets/images/'); ?>theme-bar.jpg" alt="addons" />
38
- <?php _e('<strong>Discover more premium <br />Weaver Xtreme Subthemes</strong>', 'weaver-xtreme' /*adm*/); ?></a>
39
- </p>
40
- <?php
41
- }
42
- }
43
-
44
- function weaverx_donate_button() {
45
-
46
- if (!weaverx_getopt_checked('_hide_donate') && !function_exists('weaverxplus_plugin_installed')) { ?>
47
- <div style="float:right;padding-right:30px;"><small><strong><?php _e('Like Weaver X? Consider', 'weaver-xtreme' /*adm*/); ?></strong></small>
48
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
49
- <input type="hidden" name="cmd" value="_s-xclick">
50
- <input type="hidden" name="hosted_button_id" value="6Y68LG9G9M82W">
51
- <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
52
- <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
53
- </form>
54
- </div>
55
- <?php }
56
- }
57
-
58
-
59
- function weaverx_clear_messages() {
60
- ?>
61
- <form style="float:right;margin-right:15px;" name="clearweaverx_form" method="post">
62
- <?php
63
-
64
- if (!function_exists('wvrx_ts_installed')) {
65
- if (!is_multisite() || (is_multisite() && current_user_can('manage_network_themes')) ) {
66
- echo '<div style="display:inline-block;background-color:pink;border:1px solid black;padding:3px;margin-right:4px;font-style:italic;font-size:80%;line-height:1.2;">' .
67
- __('Please install and activate the<br />Weaver Xtreme Theme Support Plugin.', 'weaver-xtreme') . '</div>';
68
- }
69
- }
70
- if (!function_exists('weaverxplus_plugin_installed')) {
71
- echo '<strong style="border:1px solid blue;background:yellow;padding:4px;margin:5px;">';
72
- weaverx_site('','//plus.weavertheme.com/',__('Weaver Xtreme Plus', 'weaver-xtreme' /*adm*/));
73
- echo __('Get Weaver Xtreme Plus!','weaver-xtreme' /*adm*/) . '</a> </strong>';
74
- }
75
- do_action('weaverx_check_licenses');
76
-
77
- ?>
78
- <span class="submit"><input type="submit" name="weaverx_clear_messages" value="<?php _e('Clear Messages', 'weaver-xtreme' /*adm*/); ?>"/></span>
79
- <?php weaverx_nonce_field('weaverx_clear_messages'); ?>
80
- </form> <!-- resetweaverx_form -->
81
- <?php
82
- }
83
-
84
- function weaverx_abs_file_path($http_path) {
85
- return untrailingslashit(ABSPATH) . parse_url($http_path,PHP_URL_PATH);
86
- }
87
- /*
88
- ==================== SAVE / RESTORE THEMES AND BACKUPS ==========================
89
- */
90
- function weaverx_get_save_settings($is_theme) {
91
- // serialize current settings
92
- global $weaverx_opts_cache;
93
-
94
- weaverx_update_options('write_backup');
95
-
96
- if ($is_theme) {
97
- $header = 'WXT-V01.00'; /* Save theme settings: 10 byte header */
98
- $theme_opts = array();
99
- $theme_opts['weaverx_base'] = $weaverx_opts_cache;
100
- foreach ($weaverx_opts_cache as $opt => $val) {
101
- if ($opt[0] == '_')
102
- $theme_opts['weaverx_base'][$opt] = false;
103
- }
104
- return $header . serialize($theme_opts); /* serialize full set of options right now */
105
- } else {
106
- $header = 'WXB-V01.00'; /* Save all settings: 10 byte header */
107
- $theme_opts = array();
108
- $theme_opts['weaverx_base'] = $weaverx_opts_cache;
109
- return $header . serialize($theme_opts); /* serialize full set of options right now */
110
- }
111
- }
112
-
113
- function weaverx_clear_cache_settings() {
114
- /* clear all settings */
115
- global $weaverx_opts_cache;
116
- foreach ($weaverx_opts_cache as $key => $value) {
117
- $weaverx_opts_cache[$key] = false; // clear everything
118
- }
119
- }
120
-
121
- function weaverx_save_msg($msg) {
122
- echo '<div id="message" class="updated fade"><p><strong>' . $msg .
123
- '</strong></p></div>';
124
- }
125
- function weaverx_error_msg($msg) {
126
- echo '<div id="message" class="updated fade" style="background:#F88;"><p><strong>' . $msg .
127
- '</strong></p></div>';
128
- }
129
-
130
- //============================================ form builder ====================================
131
-
132
- function weaverx_form_show_options($weaverx_olist, $begin_table = true, $end_table = true) {
133
- /* output a list of options - this really does the layout for the options defined in an array */
134
- if ($begin_table) {
135
- ?>
136
- <div>
137
- <table class="optiontable" style="margin-top:6px;">
138
- <?php
139
- }
140
- foreach ($weaverx_olist as $value) {
141
- if (!isset($value['type'])) {
142
- if ( WEAVERX_DEV_MODE ) {
143
- echo '<h2>**** ERROR: '; print_r($value); echo '</h2>'; // @@@@@@@@@@@@@@@@
144
- xxxxxxxxx();
145
- }
146
- continue;
147
- }
148
- $value['type'] = weaverx_fix_type($value['type']);
149
- switch ($value['type']) {
150
- case 'align':
151
- weaverx_form_align($value);
152
- break;
153
- case 'checkbox':
154
- weaverx_form_checkbox($value);
155
- break;
156
- case 'ctext':
157
- weaverx_form_ctext($value);
158
- break;
159
- case 'color':
160
- weaverx_form_color($value);
161
- break;
162
- case 'custom_css':
163
- weaverx_custom_css($value);
164
- break;
165
- case 'endheader':
166
- echo '<!-- end header -->';
167
- break;
168
- case 'fi_align':
169
- weaverx_form_fi_align($value);
170
- break;
171
- case 'fi_location':
172
- weaverx_from_fi_location($value);
173
- break;
174
- case 'fi_location_post':
175
- weaverx_from_fi_location($value, true);
176
- break;
177
- case 'header':
178
- weaverx_form_header($value);
179
- break;
180
- case 'header_area':
181
- weaverx_form_header_area($value);
182
- break;
183
- case 'header0':
184
- weaverx_form_header($value,true);
185
- break;
186
- case 'inactive':
187
- weaverx_form_inactive($value);
188
- break;
189
- case 'link':
190
- weaverx_form_link($value);
191
- break;
192
- case 'menu_opts':
193
- weaverx_form_menu_opts($value, false);
194
- break;
195
- case 'menu_opts_submit':
196
- weaverx_form_menu_opts($value, true);
197
- break;
198
- case 'note':
199
- weaverx_form_note($value);
200
- break;
201
- case 'radio':
202
- weaverx_form_radio($value);
203
- break;
204
- case 'rounded':
205
- weaverx_form_rounded($value);
206
- break;
207
- case 'select_hide':
208
- weaverx_form_select_hide($value);
209
- break;
210
- case 'select_id':
211
- weaverx_form_select_id($value);
212
- break;
213
- case 'select_layout':
214
- weaverx_form_select_layout($value);
215
- break;
216
- case 'shadows':
217
- weaverx_form_shadows($value);
218
- break;
219
- case 'subheader':
220
- weaverx_form_subheader($value);
221
- break;
222
- case 'subheader_alt':
223
- weaverx_form_subheader_alt($value);
224
- break;
225
- case 'submit':
226
- weaverx_form_submit($value);
227
- break;
228
- case 'text':
229
- case 'widetext':
230
- weaverx_form_text($value);
231
- break;
232
- case 'text_xy':
233
- weaverx_form_text_xy($value);
234
- break;
235
- case 'text_xy_em':
236
- weaverx_form_text_xy($value,'X','Y','em');
237
- break;
238
- case 'text_xy_percent':
239
- weaverx_form_text_xy($value,'X','Y','%');
240
- break;
241
- case 'text_tb':
242
- weaverx_form_text_xy($value,'T','B');
243
- break;
244
- case 'text_lr':
245
- weaverx_form_text_xy($value,'L','R');
246
- break;
247
- case 'text_lr_em':
248
- weaverx_form_text_xy($value,'L','R','em');
249
- break;
250
- case 'text_lr_percent':
251
- weaverx_form_text_xy($value,'L','R','%');
252
- break;
253
- case 'textarea':
254
- weaverx_form_textarea($value);
255
- break;
256
- case 'titles':
257
- weaverx_form_text_props($value, 'titles');
258
- break;
259
- case 'titles_area':
260
- weaverx_form_text_props($value, 'area');
261
- break;
262
- case 'titles_content':
263
- weaverx_form_text_props($value, 'content');
264
- break;
265
- case 'titles_menu':
266
- weaverx_form_text_props($value, 'menu');
267
- break;
268
- case 'titles_text':
269
- weaverx_form_text_props($value, 'text');
270
- break;
271
- case 'val_num':
272
- weaverx_form_val($value,'');
273
- break;
274
- case 'val_percent':
275
- weaverx_form_val($value,'%');
276
- break;
277
- case 'val_px':
278
- weaverx_form_val($value,'px');
279
- break;
280
- case 'val_em':
281
- weaverx_form_val($value,'em');
282
- break;
283
- case 'widget_area':
284
- weaverx_form_widget_area($value, false);
285
- break;
286
- case 'widget_area_submit':
287
- weaverx_form_widget_area($value, true);
288
- break;
289
- default:
290
- weaverx_form_subheader_alt($value);
291
- break;
292
- }
293
-
294
- }
295
- if ($end_table) {
296
- ?>
297
- </table></div> <!-- close previous tab div -->
298
- <br />
299
- <?php
300
- }
301
- }
302
-
303
- function weaverx_fix_type($type) {
304
- return apply_filters('weaverx_xtra_type', $type );
305
- }
306
-
307
- function weaverx_form_inactive($value, $reason= '') {
308
- if ( $reason == '' )
309
- $reason = '<small>' . __('Weaver Xtreme Plus Options', 'weaver-xtreme' /*adm*/) . '&nbsp;</small>';
310
- if (!isset($value['name']) || !isset($value['id']) || !isset($value['info'])) { // probably an '=submit'
311
- return;
312
- }
313
- $title = $value['name'];
314
- if (strlen($title) < 1) $title = ' '; // make code work for invisibles
315
- if ($title[0] == '#')
316
- $title = substr($title,4); // strip color
317
- echo ' <tr>' . "\n";
318
- ?>
319
- <th scope="row" style="width:200px;"><?php /* NO SAPI SETTING */
320
- echo '<span style="color:#777;float:right;">'.$title.':&nbsp;</span>';
321
- if (!empty($value['help'])) {
322
- weaverx_help_link($value['help'], __('Help for ', 'weaver-xtreme' /*adm*/) . $title);
323
- }
324
- ?>
325
- </th>
326
- <td style="color:#777;"><?php echo $reason; ?>
327
- <input type="hidden" name="<?php weaverx_sapi_main_name($value['id']); ?>" id="<?php echo $value['id']; ?>" value="<?php if ( weaverx_getopt( $value['id'] ) != "") { weaverx_esc_textarea(weaverx_getopt( $value['id'] )); } else { echo ''; } ?>" />
328
- </td>
329
- <?php
330
- if ($value['info'] != '') {
331
- echo('<td style="padding-left:10px;color:#777;font-size:x-small;">'); echo $value['info'];
332
- echo("</td>\n");
333
- }
334
- ?>
335
- </tr>
336
- <?php
337
- }
338
-
339
-
340
- function weaverx_echo_name($value, $add_icon = '') {
341
- if (!$add_icon) {
342
- if (isset($value['icon'])) {
343
- $add_icon = $value['icon'];
344
- if ($add_icon[0] == '-') {
345
- $add_icon = "<span class='i-left dashicons dashicons{$add_icon}'></span>";
346
- }
347
- }
348
- }
349
-
350
- if (isset($value['name']))
351
- $l = $value['name'];
352
- else
353
- $l = '...';
354
- if (strlen($l) > 4 && $l[0] == '#') {
355
- $l = '<span style="color:' . substr($l,0,4) .
356
- ';">' . substr($l,4) . '</span>';
357
- }
358
-
359
- echo $add_icon . $value['name'];
360
- }
361
-
362
- function weaverx_form_ctext( $value, $val_only = false ) {
363
-
364
- $pclass = 'color {hash:true, adjust:false}'; // starting with V 1.3, allow text in color pickers
365
- $img_css = '<img src="'. esc_url(get_template_directory_uri() . '/assets/images/theme/css.png') . '" alt="css" />' ;
366
- $img_hide = esc_url(get_template_directory_uri() . '/assets/images/theme/hide.png') ;
367
- $img_show = esc_url(get_template_directory_uri() . '/assets/images/theme/show.png') ;
368
- $help_file = esc_url(get_template_directory_uri() . '/help/css-help.html');
369
- $css_id = $value['id'] . '_css';
370
- $css_id_text = weaverx_getopt($css_id);
371
- if ($css_id_text && !weaverx_getopt( '_hide_auto_css_rules' )) {
372
- $img_toggle = $img_hide;
373
- } else {
374
- $img_toggle = $img_show;
375
- }
376
- $add_icon = '<span class="i-left-bg dashicons dashicons-admin-appearance"></span>';
377
- if (strpos($value['name'], ' BG') === false)
378
- $add_icon = '<span class="i-left-fg dashicons dashicons-admin-appearance"></span>';
379
- if ( ! $val_only ) { ?>
380
- <tr>
381
- <th scope="row" align="right"><?php weaverx_echo_name($value, $add_icon ); ?>:&nbsp;</th>
382
- <td> <?php
383
- } else {
384
- echo '&nbsp;<small>' . $value['info'] . '</small>&nbsp;';
385
- } ?>
386
- <input class="<?php echo $pclass; ?>" name="<?php weaverx_sapi_main_name($value['id']); ?>" id="<?php echo $value['id']; ?>" type="text" style="width:90px" value="<?php if ( weaverx_getopt( $value['id'] ) != "") { weaverx_esc_textarea(weaverx_getopt( $value['id'] )); } else { echo ''; } ?>" />
387
- <?php
388
- echo $img_css; ?><a href="javascript:void(null);" onclick="weaverx_ToggleRowCSS(document.getElementById('<?php echo $css_id . '_js'; ?>'), this, '<?php echo $img_show; ?>', '<?php echo $img_hide; ?>')"><?php echo '<img src="' . esc_url($img_toggle) . '" alt="toggle css" />'; ?></a>
389
- <?php if ( ! $val_only ) { ?>
390
- </td>
391
- <?php weaverx_form_info($value);
392
- ?>
393
- </tr>
394
- <?php }
395
- $css_rows = weaverx_getopt('_css_rows');
396
- if ($css_rows < 1 || $css_rows > 25)
397
- $css_rows = 1;
398
- if ($css_id_text && !weaverx_getopt( '_hide_auto_css_rules' )) { ?>
399
- <tr id="<?php echo $css_id . '_js'; ?>">
400
- <th scope="row" align="right"><span style="color:#22a;"><small><?php _e('Custom CSS styling:', 'weaver-xtreme' /*adm*/); ?></small></span></th>
401
- <td align="right"><small>&nbsp;</small></td>
402
- <td>
403
- <small>
404
- <?php _e('You can enter CSS rules, enclosed in {}\'s, and separated by <strong>;</strong>. See ', 'weaver-xtreme' /*adm*/); ?>
405
- <a href="<?php echo $help_file; ?>" target="_blank"><?php _e('CSS Help', 'weaver-xtreme' /*adm*/); ?></a> <?php _e('for more details.', 'weaver-xtreme' /*adm*/); ?></small><br />
406
- <?php weaverx_textarea( $css_id_text, $css_id, $css_rows,'{ font-size:150%; font-weight:bold; } /* for example */' ); ?>
407
- </td>
408
- </tr>
409
- <?php
410
- } else {
411
- ?>
412
- <tr id="<?php echo $css_id . '_js'; ?>" style="display:none;">
413
- <th scope="row" align="right"><span style="color:green;"><small><?php _e('Custom CSS styling:', 'weaver-xtreme' /*adm*/); ?></small></span></th>
414
- <td align="right"><small>&nbsp;</small></td>
415
- <td>
416
- <small>
417
- <?php _e('You can enter CSS rules, enclosed in {}\'s, and separated by <strong>;</strong>. See', 'weaver-xtreme' /*adm*/); ?>
418
- <a href="<?php echo $help_file; ?>" target="_blank"><?php _e('CSS Help', 'weaver-xtreme' /*adm*/); ?></a> for more details.</small><br />
419
- <?php weaverx_textarea( $css_id_text, $css_id, $css_rows,'{ font-size:150%; font-weight:bold; } /* for example */' ); ?>
420
- </td>
421
- </tr>
422
- <?php
423
- }
424
- }
425
-
426
- function weaverx_textarea($text, $id, $rows = 0, $place = '', $style = 'width:85%;', $class='wvrx-edit', $filter = true) {
427
- $name = weaverx_sapi_main_name($id, false);
428
- /* if ($text) {
429
- $newrows = count((explode("\n",$text)))+1;
430
- if ($newrows > $rows)
431
- $rows = $newrows;
432
- } else { */
433
- if ( $rows < 2 ) {
434
- $rows = 1;
435
- }
436
- if ($rows > 25) $rows = 25;
437
- if ( $filter )
438
- $text = weaverx_esc_textarea($text, false); // don't echo
439
- echo "<textarea class='{$class}' placeholder='{$place}' name='{$name}' rows='$rows' style='{$style}'>{$text}</textarea>\n";
440
- }
441
-
442
-
443
- function weaverx_form_color($value, $val_only = false) {
444
-
445
- $pclass = 'color {hash:true, adjust:false}'; // starting with V 1.3, allow text in color pickers
446
- if ( ! $val_only ) {
447
- ?>
448
- <tr>
449
- <th scope="row" align="right"><?php weaverx_echo_name($value, '<span class="i-left-fg dashicons dashicons-admin-appearance"></span>'); ?>:&nbsp;</th>
450
- <td>
451
- <?php } else { echo '&nbsp;<small>' . $value['info'] . '</small>&nbsp;'; } ?>
452
- <input class="<?php echo $pclass; ?>" name="<?php weaverx_sapi_main_name($value['id']); ?>" id="<?php echo $value['id']; ?>" type="text" style="width:90px" value="<?php if ( weaverx_getopt( $value['id'] ) != "") { weaverx_esc_textarea(weaverx_getopt( $value['id'] )); } else { echo ' '; } ?>" />
453
- <?php if (! $val_only ) { ?>
454
- </td>
455
- <?php weaverx_form_info($value);
456
- ?>
457
- </tr>
458
- <?php
459
- }
460
- }
461
-
462
- function weaverx_form_header($value, $narrow=false) {
463
- ?>
464
- <tr class="atw-row-header">
465
- <th scope="row" align="left" style="width:200px;"><?php /* NO SAPI SETTING */
466
-
467
- if (isset($value['icon']))
468
- $icon = $value['icon'];
469
- if ( !isset($icon) || !$icon )
470
- $icon = '';
471
-
472
- $dash = '';
473
- if ( $icon ) { // add a leading icon
474
- $dash = '<span style="padding: .1em .5em 0 .2em" class="dashicons dashicons' . $icon . '"></span>';
475
- }
476
- echo weaverx_anchor($value['name']) . $dash . '<span style="font-weight:bold; font-size: larger;"><em>'. $value['name'] .'</em></span>';
477
- weaverx_form_help($value);
478
- ?>
479
- </th>
480
- <?php
481
- if ($narrow) echo ('<td style="width:80px;">&nbsp;</td>'. "\n");
482
- else echo ('<td style="width:170px;">&nbsp;</td>'. "\n");
483
-
484
- if ($value['info'] != '') {
485
- echo('<td style="padding-left: 10px"><u><em><strong>'); echo $value['info'];
486
- echo("</strong></em></u></td>\n");
487
- }
488
- ?>
489
- </tr>
490
- <?php
491
- }
492
-
493
- function weaverx_anchor( $title ) {
494
- if ( $title )
495
- return '<a class="anchorx" id="' . sanitize_title( $title ) . '"></a>';
496
- return '';
497
- }
498
-
499
- function weaverx_form_help($value) {
500
- if (!empty($value['help'])) {
501
- weaverx_help_link($value['help'], 'Help for ' . $value['name']);
502
- }
503
- }
504
-
505
- function weaverx_form_subheader($value) {
506
- ?>
507
- <tr class="atw-row-subheader">
508
- <th scope="row" align="left" style="width:200px;line-height:2em;"><?php /* NO SAPI SETTING */
509
-
510
- if (isset($value['icon']))
511
- $icon = $value['icon'];
512
- if ( !isset($icon) || !$icon )
513
- $icon = '';
514
-
515
- $dash = '';
516
- if ( $icon ) { // add a leading icon
517
- $dash = '<span style="padding:.2em;" class="dashicons dashicons' . $icon . '"></span>';
518
- }
519
-
520
- echo weaverx_anchor($value['name']) . $dash . '<span style="color:blue; font-weight:bold; "><em><u>'.$value['name'].'</u></em></span>';
521
- weaverx_form_help($value);
522
- ?>
523
- </th>
524
- <td style="width:170px;">&nbsp;</td>
525
- <?php
526
- if ($value['info'] != '') {
527
- echo('<td style="padding-left: 10px"><u><em>'); echo $value['info'];
528
- echo("</em></u></td>\n");
529
- }
530
- ?>
531
- </tr>
532
- <?php
533
- }
534
-
535
- function weaverx_form_subheader_alt($value) {
536
- ?>
537
- <tr><td>&nbsp;</td></tr>
538
- <tr class="atw-row-subheader-alt" >
539
- <th scope="row" align="left" style="width:200px;line-height:2em;"><?php /* NO SAPI SETTING */
540
-
541
- if (isset($value['icon']))
542
- $icon = $value['icon'];
543
- if ( !isset($icon) || !$icon )
544
- $icon = '';
545
-
546
- $dash = '';
547
- if ( $icon ) { // add a leading icon
548
- $dash = '<span style="padding:.2em;" class="dashicons dashicons' . $icon . '"></span>';
549
- }
550
- echo weaverx_anchor($value['name']) . $dash . '<span style="color:blue; font-weight:bold;padding-left:5px;"><em>'.$value['name'].'</em></span>';
551
- weaverx_form_help($value);
552
- ?>
553
- </th>
554
- <td style="width:170px;">&nbsp;</td>
555
- <?php
556
- if (isset($value['info']) && $value['info'] != '') {
557
- echo('<td style="padding-left: 10px;color:blue;">'); echo $value['info'];
558
- echo("</td>\n");
559
- }
560
- ?>
561
- </tr>
562
- <?php
563
- }
564
-
565
- function weaverx_form_header_area($value) {
566
- ?>
567
- <tr><td>&nbsp;</td></tr>
568
- <tr class="atw-row-subheader-area" >
569
- <th scope="row" align="left" style="width:200px;line-height:2em;"><?php /* NO SAPI SETTING */
570
-
571
- if (isset($value['icon']))
572
- $icon = $value['icon'];
573
- if ( !isset($icon) || !$icon )
574
- $icon = '';
575
-
576
- $dash = '';
577
- if ( $icon ) { // add a leading icon
578
- $dash = '<span style="padding:.2em;" class="dashicons dashicons' . $icon . '"></span>';
579
- }
580
-
581
- echo weaverx_anchor($value['name']) . $dash . '<span style="color:blue; font-weight:bold;padding-left:5px;font-size:small;"><em>'.$value['name'].'</em></span>';
582
- weaverx_form_help($value);
583
- ?>
584
- </th>
585
- <td style="width:170px;">&nbsp;</td>
586
- <?php
587
- if ($value['info'] != '') {
588
- echo('<td style="padding-left: 10px;color:blue;">'); echo $value['info'];
589
- echo("</td>\n");
590
- }
591
- ?>
592
- </tr>
593
- <?php
594
- }
595
 
596
 
597
  function weaverx_form_textarea($value,$media = false) {
@@ -607,7 +15,7 @@ function weaverx_form_textarea($value,$media = false) {
607
  <?php weaverx_textarea(weaverx_getopt($value['id']), $value['id'], $rows , $place, 'width:350px;', $class='wvrx-edit'); ?>
608
  <?php
609
  if ($media) {
610
- weaverx_media_lib_button($value['id']);
611
  }
612
  ?>
613
  &nbsp;<small><?php echo $value['info']; ?></small>
@@ -823,7 +231,7 @@ function weaverx_form_widget_area( $value, $submit = false ) {
823
  );
824
 
825
  $default_margins = array(
826
- 'infobar' => '5px', 'content' => 'T:0, B:10', 'footer' => 'T:0, B:0',
827
  'footer_sb' => 'T:0, B:10', 'primary' => 'T:0, B:10', 'widget' => '0, Auto - First: T:0, Last: B:0',
828
  'secondary' => 'T:0, B:10', 'extra' => 'T:0, B:10', 'top' => 'T:10, B:10', 'bottom' => 'T:10, B:10',
829
  'wrapper' => 'T:0, B:0'
@@ -847,8 +255,7 @@ function weaverx_form_widget_area( $value, $submit = false ) {
847
 
848
  $opts = array (
849
 
850
- array( 'name' => $name, 'icon' => '-welcome-widgets-menus',
851
- 'id' => "h-{$id}", 'type' => 'header_area',
852
  'info' => $value['info']),
853
 
854
  array( 'name' => $name, 'id' => $id, 'type' => 'titles_area',
@@ -935,8 +342,7 @@ function weaverx_form_widget_area( $value, $submit = false ) {
935
  if ( in_array( $id, array( 'container', 'header', 'footer') ) ) {
936
  $opts_max = array(
937
  array(
938
- 'name' => '<small>' . __('Max Width', 'weaver-xtreme' /*adm*/) . '</small>',
939
- 'icon' => '<span class="i-left" style="font-size:150%;">&harr;</span>',
940
  'id' => $id . '_max_width_int', 'type' => '+val_px',
941
  'info' => '<em>' . $name . '</em>' . __(': Set Max Width of Area for Desktop View. Advanced Option. (&starf;Plus)', 'weaver-xtreme' /*adm*/),
942
  'value' => array() ),
@@ -946,8 +352,7 @@ function weaverx_form_widget_area( $value, $submit = false ) {
946
  'value' => array() ),
947
 
948
  array(
949
- 'name' => '<small>' . __('Extend BG Attributes', 'weaver-xtreme' /*adm*/) . '</small>',
950
- 'icon' => '<span class="i-left" style="font-size:150%;">&harr;</span>',
951
  'id' => $id . '_extend_width', 'type' => 'checkbox',
952
  'info' => '<em>' . $name . '</em>' . __(': Extend all BG Attributes to full width. Overrides Full-width BG color.', 'weaver-xtreme' /*adm*/)),
953
 
@@ -960,17 +365,15 @@ function weaverx_form_widget_area( $value, $submit = false ) {
960
  if ( ! in_array( $id, $no_widgets) ) {
961
 
962
  $opts02 = array(
963
- array('name' => __('Columns', 'weaver-xtreme' /*adm*/),
964
- 'icon' => '<span class="i-left" style="font-size:120%;">&nbsp;&#9783;</span>' ,
965
  'id' => $id . '_cols_int', 'type' => 'val_num',
966
  'info' => '<em>' . $name . '</em>' . __(': Equal width columns of widgets (Default: 1; max: 8)', 'weaver-xtreme' /*adm*/) ),
967
 
968
- array('name' => '<small>' . __('No Smart Widget Margins', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-align-none',
969
  'id' => $id . '_no_widget_margins', 'type' => 'checkbox',
970
  'info' => '<em>' . $name . '</em>' . __(': Do not use "smart margins" between widgets on rows.', 'weaver-xtreme' /*adm*/) ),
971
 
972
- array('name' => '<small>' . __('Equal Height Widget Rows', 'weaver-xtreme' /*adm*/) . '</small>',
973
- 'icon' => '<span class="i-left" style="font-size:140%;">&nbsp;=</span>',
974
  'id' => $id . '_eq_widgets', 'type' => '+checkbox',
975
  'info' => '<em>' . $name . '</em>' . __(': Make widgets equal height rows if &gt; 1 column (&starf;Plus)', 'weaver-xtreme' /*adm*/) ),
976
 
@@ -988,17 +391,14 @@ function weaverx_form_widget_area( $value, $submit = false ) {
988
  </tr>
989
  <?php
990
  $opts2 = array(
991
- array('name' => '<small>' . __('Desktop', 'weaver-xtreme' /*adm*/) . '</small>',
992
- 'icon' => '<span class="i-left dashicons dashicons-desktop"></span>',
993
  'id' => '_' . $id . '_lw_cols_list', 'type' => '+textarea',
994
  'placeholder' => __('25,25,50; 60,40; - for example', 'weaver-xtreme' /*adm*/),
995
  'info' => __('List of widths separated by comma. Use semi-colon (;) for end of each row. (&starf;Plus) (&diams;)', 'weaver-xtreme' /*adm*/)),
996
- array('name' => '<small>' . __('Small Tablet', 'weaver-xtreme' /*adm*/) . '</small>',
997
- 'icon' => '<span class="i-left dashicons dashicons-tablet"></span>',
998
  'id' => '_' . $id . '_mw_cols_list', 'type' => '+textarea',
999
  'info' => __('List of widget widths. (&starf;Plus) (&diams;)', 'weaver-xtreme' /*adm*/)),
1000
- array('name' => '<small>' . __('Phone', 'weaver-xtreme' /*adm*/) . '</small>',
1001
- 'icon' => '<span class="i-left dashicons dashicons-smartphone"></span>',
1002
  'id' => '_' . $id . '_sw_cols_list', 'type' => '+textarea',
1003
  'info' => __('List of widget widths. (&starf;Plus) (&diams;)', 'weaver-xtreme' /*adm*/)),
1004
  );
@@ -1008,17 +408,11 @@ function weaverx_form_widget_area( $value, $submit = false ) {
1008
  }
1009
 
1010
  $opts3 = array (
1011
- array( 'name' => '<small>' . __('Add Border', 'weaver-xtreme' /*adm*/) . '</small>',
1012
- 'icon' => '<span class="i-left" style="font-size:200%;margin-left:4px;">&#x25a1;</span>',
1013
- 'id' => $id . '_border', 'type' => 'checkbox',
1014
  'info' => '<em>' . $name . '</em>' . __(': Add the "standard" border (as set on Custom tab)', 'weaver-xtreme' /*adm*/)),
1015
- array( 'name' => '<small>' . __('Shadow', 'weaver-xtreme' /*adm*/) . '</small>',
1016
- 'icon' => '<span class="i-left dashicons dashicons-admin-page"></span>',
1017
- 'id' => $id .'_shadow', 'type' => 'shadows',
1018
  'info' => '<em>' . $name . '</em>' . __(': Wrap Area with Shadow.', 'weaver-xtreme' /*adm*/)),
1019
- array( 'name' => '<small>' . __('Rounded Corners', 'weaver-xtreme' /*adm*/) . '</small>',
1020
- 'icon' => '<span class="i-left dashicons dashicons-marker"></span>',
1021
- 'id' => $id .'_rounded', 'type' => 'rounded',
1022
  'info' => '<em>' . $name . '</em>' . __(': Rounded corners. Needs bg color or borders to show. <em>You might need to set overlapping corners for parent/child areas also!</em>', 'weaver-xtreme' /*adm*/) )
1023
  );
1024
 
@@ -1028,7 +422,7 @@ function weaverx_form_widget_area( $value, $submit = false ) {
1028
 
1029
  if ( ! in_array( $id, $no_hide) ) {
1030
  weaverx_form_select_hide(array(
1031
- 'name' => '<small>' . __('Hide Area', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
1032
  'id' => $id .'_hide',
1033
  'info' => '<em>' . $name . '</em>' . __(': Hide area on different display devices', 'weaver-xtreme' /*adm*/),
1034
  'value' => '' ) );
@@ -1036,9 +430,7 @@ function weaverx_form_widget_area( $value, $submit = false ) {
1036
 
1037
  // class names
1038
  $opts4 = array (
1039
- array( 'name' => '<small>' . __('Add Classes', 'weaver-xtreme' /*adm*/) . '</small>',
1040
- 'icon' => '<span class="i-left">{ }</span> ',
1041
- 'id' => $id . '_add_class', 'type' => '+widetext',
1042
  'info' => '<em>' . $name . '</em>' . __(': Space separated class names to add to this area (<em>Advanced option</em>) (&starf;Plus)', 'weaver-xtreme' /*adm*/)
1043
  )
1044
  );
@@ -1064,9 +456,7 @@ function weaverx_form_menu_opts( $value, $submit = false ) {
1064
 
1065
  $opts = array(
1066
 
1067
- array( 'name' => $name, 'icon' => '-menu',
1068
- 'type' => 'header_area',
1069
- 'id' => "h-{$id}",
1070
  'info' => $value['info']),
1071
 
1072
  array( 'name' => __('Menu Bar', 'weaver-xtreme' /*adm*/),
@@ -1116,14 +506,12 @@ function weaverx_form_menu_opts( $value, $submit = false ) {
1116
  'info' => '<em>' . $name . '</em>' . __(': Extend BG color to full theme width on Desktop View (&starf;Plus)', 'weaver-xtreme' /*adm*/),
1117
  'value' => array() ),
1118
  array(
1119
- 'name' => '<small>' . __('Extend BG Attributes', 'weaver-xtreme' /*adm*/) . '</small>',
1120
- 'icon' => '<span class="i-left" style="font-size:150%;">&harr;</span>',
1121
  'id' => $id . '_extend_width', 'type' => 'checkbox',
1122
  'info' => '<em>' . $name . '</em>' . __(': Extend all BG Attributes to full width. Overrides Full-width BG color.', 'weaver-xtreme' /*adm*/)),
1123
 
1124
 
1125
- array ('name' => __('Align Menu', 'weaver-xtreme' /*adm*/),
1126
- 'icon' => '-editor-alignleft',
1127
  'id' => $id . '_align', 'type' => 'select_id',
1128
  'info' => __('Align this menu on desktop view. Mobile, accordion, and vertical menus always left aligned.', 'weaver-xtreme' /*adm*/),
1129
  'value' => array(
@@ -1132,27 +520,22 @@ function weaverx_form_menu_opts( $value, $submit = false ) {
1132
  array('val' => 'right', 'desc' => 'Right')
1133
  )),
1134
 
1135
- array( 'name' => '<small>' . __('Add Border', 'weaver-xtreme' /*adm*/) . '</small>',
1136
- 'icon' => '<span class="i-left" style="font-size:200%;margin-left:4px;">&#x25a1;</span>',
1137
  'id' => $id . '_border', 'type' => 'checkbox',
1138
  'info' => '<em>' . $name . '</em>' . ': Add the "standard" border (as set on Custom tab)' ),
1139
 
1140
- array( 'name' => '<small>' . __('Add Border to Submenus', 'weaver-xtreme' /*adm*/) . '</small>',
1141
- 'icon' => '<span class="i-left" style="font-size:200%;margin-left:4px;">&#x25a1;</span>',
1142
  'id' => $id . '_sub_border', 'type' => 'checkbox',
1143
  'info' => '<em>' . $name . '</em>' . ': Add the "standard" border to Submenus' ),
1144
 
1145
- array( 'name' => '<small>' . __('Rounded Submenu Corners', 'weaver-xtreme' /*adm*/) . '</small>',
1146
- 'icon' => '-marker',
1147
  'id' => $id . '_sub_rounded', 'type' => 'checkbox',
1148
  'info' => '<em>' . $name . '</em>' . ': Add rounded corners to Submenus' ),
1149
 
1150
- array( 'name' => '<small>' . __('Shadow', 'weaver-xtreme' /*adm*/) . '</small>',
1151
- 'icon' => '-admin-page',
1152
  'id' => $id .'_shadow', 'type' => 'shadows',
1153
  'info' => '<em>' . $name . '</em>' . __(': Wrap Menu Bar with Shadow.', 'weaver-xtreme' /*adm*/) ),
1154
- array( 'name' => '<small>' . __('Rounded Corners', 'weaver-xtreme' /*adm*/) . '</small>',
1155
- 'icon' => '-marker',
1156
  'id' => $id .'_rounded', 'type' => 'rounded',
1157
  'info' => '<em>' . $name . '</em>' . __(': Add rounded corners to menu. <em>You might need to set overlapping corners Header/Wrapper areas also!</em>', 'weaver-xtreme' /*adm*/) ),
1158
 
@@ -1176,44 +559,42 @@ function weaverx_form_menu_opts( $value, $submit = false ) {
1176
  }
1177
 
1178
  $opts2 = array(
1179
- array( 'name' => '<small>' . __('Hide Area', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
1180
  'id' => $id .'_hide', 'type' => 'select_hide',
1181
  'info' => '<em>' . $name . '</em>' . __(': Hide menu on different display devices', 'weaver-xtreme' /*adm*/) ),
1182
- array( 'name' => '<small>' . __('Hide Arrows', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
1183
  'id' => $id . '_hide_arrows', 'type' => 'checkbox',
1184
  'info' => '<em>' . $name . '</em>' . __(': Hide Arrows on Desktop Menu', 'weaver-xtreme' /*adm*/)),
1185
 
1186
- array( 'name' => '<small>' . __('Desktop Menu Vertical Padding', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-align-none', 'icon' => '-align-none',
1187
  'id' => $id .'_menu_pad_dec', 'type' => 'val_em',
1188
  'info' => '<em>' . $name . '</em>' . __(': Add vertical padding to Desktop menu bar and submenus (Default: 0.6em)', 'weaver-xtreme' /*adm*/) ),
1189
 
1190
- array( 'name' => '<small>' . __('Desktop Menu Spacing', 'weaver-xtreme' /*adm*/) . '</small>',
1191
- 'icon' => '<span class="i-left" style="font-size:150%;">&harr;</span>',
1192
  'id' => $id .'_right_padding_dec' , 'type' => 'val_em',
1193
  'info' => '<em>' . $name . '</em>' . __(': Add space between desktop menu bar items (Use value &gt; 1.0)', 'weaver-xtreme' /*adm*/) ),
1194
 
1195
- array( 'name' => '<small>' . __('Add Classes','weaver-xtreme' /*adm*/) . '</small>',
1196
- 'icon' => '<span class="i-left">{ }</span> ',
1197
  'id' => $id . '_add_class', 'type' => '+widetext',
1198
  'info' => '<em>' . $name . '</em>' . __(': Space separated class names to add to this area (<em>Advanced option</em>) (&starf;Plus)', 'weaver-xtreme' /*adm*/) ),
1199
- array('name' => '<small>' . __('Left HTML', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-editor-code',
1200
  'id' => $id . '_html_left', 'type' => '+textarea',
1201
  'placeholder' => __('Any HTML, including shortcodes.', 'weaver-xtreme' /*adm*/),
1202
  'info' => __('Add HTML Left (Works best with Centered Menu) (&diams;)(&starf;Plus)', 'weaver-xtreme' /*adm*/)),
1203
- array( 'name' => '<small>' . __('Hide Area', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
1204
  'id' => $id .'_hide_left', 'type' => '+select_hide',
1205
  'info' => '<em>' . $name . '</em>' . __(': Hide Left HTML', 'weaver-xtreme' /*adm*/) ),
1206
- array('name' => '<small>' . __('Right HTML', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-editor-code',
1207
  'id' => $id . '_html_right', 'type' => '+textarea',
1208
  'placeholder' => __('Any HTML, including shortcodes.', 'weaver-xtreme' /*adm*/),
1209
  'info' => __('Add HTML to Menu on Right (Works best with Centered Menu) (&diams;)(&starf;Plus)', 'weaver-xtreme' /*adm*/)),
1210
- array( 'name' => '<small>' . __('Hide Area', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
1211
  'id' => $id .'_hide_right', 'type' => '+select_hide',
1212
  'info' => '<em>' . $name . '</em>' . __(': Hide Right HTML', 'weaver-xtreme' /*adm*/) ),
1213
  array( 'name' => '<small>' . __('HTML: Text Color', 'weaver-xtreme' /*adm*/) . '</small>',
1214
  'id' => $id .'_html_color', 'type' => 'ctext',
1215
  'info' => '<em>' . $name . '</em>' . __(': Text Color for Left/Right Menu Bar HTML', 'weaver-xtreme' /*adm*/) ),
1216
- array( 'name' => '<small>' . __('HTML: Top Margin', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-align-none',
1217
  'id' => $id .'_html_margin_dec', 'type' => 'val_em',
1218
  'info' => '<em>' . $name . '</em>' . __(': Margin above Added Menu HTML (Used to adjust for Desktop menu. Negative values can help.)', 'weaver-xtreme' /*adm*/) ),
1219
 
@@ -1464,14 +845,14 @@ function weaverx_custom_css( $value='' ) {
1464
 
1465
  $css = weaverx_getopt('add_css');
1466
 
1467
- if (isset($value['icon']))
1468
- $icon = $value['icon'];
1469
  if ( !isset($icon) || !$icon )
1470
- $icon = '';
1471
 
1472
  $dash = '';
1473
- if ( $icon) { // add a leading icon
1474
- $dash = '<span style="padding:.2em;" class="dashicons dashicons' . $icon . '"></span>';
1475
  }
1476
  ?>
1477
  <tr class="atw-row-header"><td colspan="3">
@@ -1496,67 +877,5 @@ It is possible that other plugins might generate CSS that comes after these rule
1496
  <?php
1497
  }
1498
 
1499
- function weaverx_check_version() {
1500
-
1501
- $version = WEAVERX_VERSION;
1502
-
1503
- $check_site = 'https://weaverxtra.wordpress.com';
1504
- $home_site = '//weavertheme.com';
1505
- $msg = __(' - Available at:', 'weaver-xtreme' /*adm*/) . ' ' .
1506
- '<a href="//weavertheme.com/download/" target="_blank">WeaverTheme.com/download/</a>';
1507
-
1508
- $latest = weaverx_latest_version($check_site); // check if newer version is available
1509
- if ( $latest[0] != 'unavailable' && version_compare($version,$latest[0],'<') ) {
1510
- if ( ! empty($latest[1]) ) {
1511
- $msg = $msg . '<p>' . $latest[1] . '</p>'; }
1512
- $saveme = WEAVERX_THEMENAME . __(' Current version: ', 'weaver-xtreme' /*adm*/) . $version . __(' Newer version: ', 'weaver-xtreme' /*adm*/) . $latest[0] .
1513
- $msg;
1514
- weaverx_save_msg($saveme);
1515
- }
1516
- return '';
1517
- }
1518
-
1519
- function weaverx_latest_version($check_site) {
1520
- $rss = fetch_feed($check_site. '/feed/');
1521
- if (is_wp_error($rss) ) {
1522
- return array('unavailable', '');
1523
- }
1524
- $out = '';
1525
- $items = 1;
1526
- $num_items = $rss->get_item_quantity($items);
1527
- if ( $num_items < 1 ) {
1528
- $out .= 'unavailable';
1529
- $rss->__destruct();
1530
- unset($rss);
1531
- return array($out, '');
1532
- }
1533
- $rss_items = $rss->get_items(0, $items);
1534
- foreach ($rss_items as $item ) {
1535
- $title = esc_attr(strip_tags($item->get_title()));
1536
- if ( empty($title) )
1537
- $title = 'unavailable';
1538
- $content = esc_attr(strip_tags($item->get_content()));
1539
- }
1540
- if (stripos($title,'announcement') === false) {
1541
- $blank = strpos($title,' '); // find blank
1542
- if ($blank < 1) // problem
1543
- $title = 'unavailable';
1544
- else {
1545
- $title = substr($title,0,$blank);
1546
- }
1547
- }
1548
- $out .= $title;
1549
- $rss->__destruct();
1550
- unset($rss);
1551
- return array( $out, $content );
1552
- }
1553
-
1554
- function weaverx_elink( $href, $title, $label, $before='', $after='') {
1555
- echo $before . '<a href="' . esc_url($href) . '" title="' . $title . '">' . $label . '</a>' . $after;
1556
- }
1557
-
1558
- function weaverx_tab_title( $title, $help_link, $help_title ) {
1559
- echo '<h3>'. $title; weaverx_help_link( $help_link, $help_title ) ; echo '</h3>';
1560
- }
1561
 
1562
  ?>
1
  <?php
2
  if ( !defined('ABSPATH')) exit; // Exit if accessed directly
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
 
5
  function weaverx_form_textarea($value,$media = false) {
15
  <?php weaverx_textarea(weaverx_getopt($value['id']), $value['id'], $rows , $place, 'width:350px;', $class='wvrx-edit'); ?>
16
  <?php
17
  if ($media) {
18
+ weaverx_media_lib_button($value['id']);
19
  }
20
  ?>
21
  &nbsp;<small><?php echo $value['info']; ?></small>
231
  );
232
 
233
  $default_margins = array(
234
+ 'infobar' => '5px', 'content' => 'T:0, B:0', 'footer' => 'T:0, B:0',
235
  'footer_sb' => 'T:0, B:10', 'primary' => 'T:0, B:10', 'widget' => '0, Auto - First: T:0, Last: B:0',
236
  'secondary' => 'T:0, B:10', 'extra' => 'T:0, B:10', 'top' => 'T:10, B:10', 'bottom' => 'T:10, B:10',
237
  'wrapper' => 'T:0, B:0'
255
 
256
  $opts = array (
257
 
258
+ array( 'name' => $name, 'id' => '-welcome-widgets-menus', 'type' => 'header_area',
 
259
  'info' => $value['info']),
260
 
261
  array( 'name' => $name, 'id' => $id, 'type' => 'titles_area',
342
  if ( in_array( $id, array( 'container', 'header', 'footer') ) ) {
343
  $opts_max = array(
344
  array(
345
+ 'name' => '<span class="i-left" style="font-size:150%;">&harr;</span><small>' . __('Max Width', 'weaver-xtreme' /*adm*/) . '</small>',
 
346
  'id' => $id . '_max_width_int', 'type' => '+val_px',
347
  'info' => '<em>' . $name . '</em>' . __(': Set Max Width of Area for Desktop View. Advanced Option. (&starf;Plus)', 'weaver-xtreme' /*adm*/),
348
  'value' => array() ),
352
  'value' => array() ),
353
 
354
  array(
355
+ 'name' => '<span class="i-left" style="font-size:150%;">&harr;</span><small>' . __('Extend BG Attributes', 'weaver-xtreme' /*adm*/) . '</small>',
 
356
  'id' => $id . '_extend_width', 'type' => 'checkbox',
357
  'info' => '<em>' . $name . '</em>' . __(': Extend all BG Attributes to full width. Overrides Full-width BG color.', 'weaver-xtreme' /*adm*/)),
358
 
365
  if ( ! in_array( $id, $no_widgets) ) {
366
 
367
  $opts02 = array(
368
+ array('name' => '<span class="i-left" style="font-size:120%;">&nbsp;&#9783;</span>' . __('Columns', 'weaver-xtreme' /*adm*/),
 
369
  'id' => $id . '_cols_int', 'type' => 'val_num',
370
  'info' => '<em>' . $name . '</em>' . __(': Equal width columns of widgets (Default: 1; max: 8)', 'weaver-xtreme' /*adm*/) ),
371
 
372
+ array('name' => '<span class="i-left dashicons dashicons-align-none"></span><small>' . __('No Smart Widget Margins', 'weaver-xtreme' /*adm*/) . '</small>',
373
  'id' => $id . '_no_widget_margins', 'type' => 'checkbox',
374
  'info' => '<em>' . $name . '</em>' . __(': Do not use "smart margins" between widgets on rows.', 'weaver-xtreme' /*adm*/) ),
375
 
376
+ array('name' => '<span class="i-left" style="font-size:140%;">&nbsp;=</span><small>' . __('Equal Height Widget Rows', 'weaver-xtreme' /*adm*/) . '</small>',
 
377
  'id' => $id . '_eq_widgets', 'type' => '+checkbox',
378
  'info' => '<em>' . $name . '</em>' . __(': Make widgets equal height rows if &gt; 1 column (&starf;Plus)', 'weaver-xtreme' /*adm*/) ),
379
 
391
  </tr>
392
  <?php
393
  $opts2 = array(
394
+ array('name' => '<span class="i-left dashicons dashicons-desktop"></span><small>' . __('Desktop', 'weaver-xtreme' /*adm*/) . '</small>',
 
395
  'id' => '_' . $id . '_lw_cols_list', 'type' => '+textarea',
396
  'placeholder' => __('25,25,50; 60,40; - for example', 'weaver-xtreme' /*adm*/),
397
  'info' => __('List of widths separated by comma. Use semi-colon (;) for end of each row. (&starf;Plus) (&diams;)', 'weaver-xtreme' /*adm*/)),
398
+ array('name' => '<span class="i-left dashicons dashicons-tablet"></span><small>' . __('Small Tablet', 'weaver-xtreme' /*adm*/) . '</small>',
 
399
  'id' => '_' . $id . '_mw_cols_list', 'type' => '+textarea',
400
  'info' => __('List of widget widths. (&starf;Plus) (&diams;)', 'weaver-xtreme' /*adm*/)),
401
+ array('name' => '<span class="i-left dashicons dashicons-smartphone"></span><small>' . __('Phone', 'weaver-xtreme' /*adm*/) . '</small>',
 
402
  'id' => '_' . $id . '_sw_cols_list', 'type' => '+textarea',
403
  'info' => __('List of widget widths. (&starf;Plus) (&diams;)', 'weaver-xtreme' /*adm*/)),
404
  );
408
  }
409
 
410
  $opts3 = array (
411
+ array( 'name' => '<span class="i-left" style="font-size:200%;margin-left:4px;">&#x25a1;</span><small>' . __('Add Border', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => $id . '_border', 'type' => 'checkbox',
 
 
412
  'info' => '<em>' . $name . '</em>' . __(': Add the "standard" border (as set on Custom tab)', 'weaver-xtreme' /*adm*/)),
413
+ array( 'name' => '<span class="i-left dashicons dashicons-admin-page"></span><small>' . __('Shadow', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => $id .'_shadow', 'type' => 'shadows',
 
 
414
  'info' => '<em>' . $name . '</em>' . __(': Wrap Area with Shadow.', 'weaver-xtreme' /*adm*/)),
415
+ array( 'name' => '<span class="i-left dashicons dashicons-marker"></span><small>' . __('Rounded Corners', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => $id .'_rounded', 'type' => 'rounded',
 
 
416
  'info' => '<em>' . $name . '</em>' . __(': Rounded corners. Needs bg color or borders to show. <em>You might need to set overlapping corners for parent/child areas also!</em>', 'weaver-xtreme' /*adm*/) )
417
  );
418
 
422
 
423
  if ( ! in_array( $id, $no_hide) ) {
424
  weaverx_form_select_hide(array(
425
+ 'name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Area', 'weaver-xtreme' /*adm*/) . '</small>',
426
  'id' => $id .'_hide',
427
  'info' => '<em>' . $name . '</em>' . __(': Hide area on different display devices', 'weaver-xtreme' /*adm*/),
428
  'value' => '' ) );
430
 
431
  // class names
432
  $opts4 = array (
433
+ array( 'name' => '<span class="i-left">{ }</span> <small>' . __('Add Classes', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => $id . '_add_class', 'type' => '+widetext',
 
 
434
  'info' => '<em>' . $name . '</em>' . __(': Space separated class names to add to this area (<em>Advanced option</em>) (&starf;Plus)', 'weaver-xtreme' /*adm*/)
435
  )
436
  );
456
 
457
  $opts = array(
458
 
459
+ array( 'name' => $name, 'id' => '-menu', 'type' => 'header_area',
 
 
460
  'info' => $value['info']),
461
 
462
  array( 'name' => __('Menu Bar', 'weaver-xtreme' /*adm*/),
506
  'info' => '<em>' . $name . '</em>' . __(': Extend BG color to full theme width on Desktop View (&starf;Plus)', 'weaver-xtreme' /*adm*/),
507
  'value' => array() ),
508
  array(
509
+ 'name' => '<span class="i-left" style="font-size:150%;">&harr;</span><small>' . __('Extend BG Attributes', 'weaver-xtreme' /*adm*/) . '</small>',
 
510
  'id' => $id . '_extend_width', 'type' => 'checkbox',
511
  'info' => '<em>' . $name . '</em>' . __(': Extend all BG Attributes to full width. Overrides Full-width BG color.', 'weaver-xtreme' /*adm*/)),
512
 
513
 
514
+ array ('name' => '<span class="i-left dashicons dashicons-editor-alignleft"></span>' . __('Align Menu', 'weaver-xtreme' /*adm*/),
 
515
  'id' => $id . '_align', 'type' => 'select_id',
516
  'info' => __('Align this menu on desktop view. Mobile, accordion, and vertical menus always left aligned.', 'weaver-xtreme' /*adm*/),
517
  'value' => array(
520
  array('val' => 'right', 'desc' => 'Right')
521
  )),
522
 
523
+ array( 'name' => '<span class="i-left" style="font-size:200%;margin-left:4px;">&#x25a1;</span><small>' . __('Add Border', 'weaver-xtreme' /*adm*/) . '</small>',
 
524
  'id' => $id . '_border', 'type' => 'checkbox',
525
  'info' => '<em>' . $name . '</em>' . ': Add the "standard" border (as set on Custom tab)' ),
526
 
527
+ array( 'name' => '<span class="i-left" style="font-size:200%;margin-left:4px;">&#x25a1;</span><small>' . __('Add Border to Submenus', 'weaver-xtreme' /*adm*/) . '</small>',
 
528
  'id' => $id . '_sub_border', 'type' => 'checkbox',
529
  'info' => '<em>' . $name . '</em>' . ': Add the "standard" border to Submenus' ),
530
 
531
+ array( 'name' => '<span class="i-left dashicons dashicons-marker"></span><small>' . __('Rounded Submenu Corners', 'weaver-xtreme' /*adm*/) . '</small>',
 
532
  'id' => $id . '_sub_rounded', 'type' => 'checkbox',
533
  'info' => '<em>' . $name . '</em>' . ': Add rounded corners to Submenus' ),
534
 
535
+ array( 'name' => '<span class="i-left dashicons dashicons-admin-page"></span><small>' . __('Shadow', 'weaver-xtreme' /*adm*/) . '</small>',
 
536
  'id' => $id .'_shadow', 'type' => 'shadows',
537
  'info' => '<em>' . $name . '</em>' . __(': Wrap Menu Bar with Shadow.', 'weaver-xtreme' /*adm*/) ),
538
+ array( 'name' => '<span class="i-left dashicons dashicons-marker"></span><small>' . __('Rounded Corners', 'weaver-xtreme' /*adm*/) . '</small>',
 
539
  'id' => $id .'_rounded', 'type' => 'rounded',
540
  'info' => '<em>' . $name . '</em>' . __(': Add rounded corners to menu. <em>You might need to set overlapping corners Header/Wrapper areas also!</em>', 'weaver-xtreme' /*adm*/) ),
541
 
559
  }
560
 
561
  $opts2 = array(
562
+ array( 'name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Area', 'weaver-xtreme' /*adm*/) . '</small>',
563
  'id' => $id .'_hide', 'type' => 'select_hide',
564
  'info' => '<em>' . $name . '</em>' . __(': Hide menu on different display devices', 'weaver-xtreme' /*adm*/) ),
565
+ array( 'name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Arrows', 'weaver-xtreme' /*adm*/) . '</small>',
566
  'id' => $id . '_hide_arrows', 'type' => 'checkbox',
567
  'info' => '<em>' . $name . '</em>' . __(': Hide Arrows on Desktop Menu', 'weaver-xtreme' /*adm*/)),
568
 
569
+ array( 'name' => '<span class="i-left dashicons dashicons-align-none"></span><small>' . __('Desktop Menu Vertical Padding', 'weaver-xtreme' /*adm*/) . '</small>',
570
  'id' => $id .'_menu_pad_dec', 'type' => 'val_em',
571
  'info' => '<em>' . $name . '</em>' . __(': Add vertical padding to Desktop menu bar and submenus (Default: 0.6em)', 'weaver-xtreme' /*adm*/) ),
572
 
573
+ array( 'name' => '<span class="i-left" style="font-size:150%;">&harr;</span><small>' . __('Desktop Menu Spacing. (not on Smart Menus)', 'weaver-xtreme' /*adm*/) . '</small>',
 
574
  'id' => $id .'_right_padding_dec' , 'type' => 'val_em',
575
  'info' => '<em>' . $name . '</em>' . __(': Add space between desktop menu bar items (Use value &gt; 1.0)', 'weaver-xtreme' /*adm*/) ),
576
 
577
+ array( 'name' => '<span class="i-left">{ }</span> <small>' . __('Add Classes','weaver-xtreme' /*adm*/) . '</small>',
 
578
  'id' => $id . '_add_class', 'type' => '+widetext',
579
  'info' => '<em>' . $name . '</em>' . __(': Space separated class names to add to this area (<em>Advanced option</em>) (&starf;Plus)', 'weaver-xtreme' /*adm*/) ),
580
+ array('name' => '<span class="i-left dashicons dashicons-editor-code"></span><small>' . __('Left HTML', 'weaver-xtreme' /*adm*/) . '</small>',
581
  'id' => $id . '_html_left', 'type' => '+textarea',
582
  'placeholder' => __('Any HTML, including shortcodes.', 'weaver-xtreme' /*adm*/),
583
  'info' => __('Add HTML Left (Works best with Centered Menu) (&diams;)(&starf;Plus)', 'weaver-xtreme' /*adm*/)),
584
+ array( 'name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Area', 'weaver-xtreme' /*adm*/) . '</small>',
585
  'id' => $id .'_hide_left', 'type' => '+select_hide',
586
  'info' => '<em>' . $name . '</em>' . __(': Hide Left HTML', 'weaver-xtreme' /*adm*/) ),
587
+ array('name' => '<span class="i-left dashicons dashicons-editor-code"></span><small>' . __('Right HTML', 'weaver-xtreme' /*adm*/) . '</small>',
588
  'id' => $id . '_html_right', 'type' => '+textarea',
589
  'placeholder' => __('Any HTML, including shortcodes.', 'weaver-xtreme' /*adm*/),
590
  'info' => __('Add HTML to Menu on Right (Works best with Centered Menu) (&diams;)(&starf;Plus)', 'weaver-xtreme' /*adm*/)),
591
+ array( 'name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Area', 'weaver-xtreme' /*adm*/) . '</small>',
592
  'id' => $id .'_hide_right', 'type' => '+select_hide',
593
  'info' => '<em>' . $name . '</em>' . __(': Hide Right HTML', 'weaver-xtreme' /*adm*/) ),
594
  array( 'name' => '<small>' . __('HTML: Text Color', 'weaver-xtreme' /*adm*/) . '</small>',
595
  'id' => $id .'_html_color', 'type' => 'ctext',
596
  'info' => '<em>' . $name . '</em>' . __(': Text Color for Left/Right Menu Bar HTML', 'weaver-xtreme' /*adm*/) ),
597
+ array( 'name' => '<span class="i-left dashicons dashicons-align-none"></span><small>' . __('HTML: Top Margin', 'weaver-xtreme' /*adm*/) . '</small>',
598
  'id' => $id .'_html_margin_dec', 'type' => 'val_em',
599
  'info' => '<em>' . $name . '</em>' . __(': Margin above Added Menu HTML (Used to adjust for Desktop menu. Negative values can help.)', 'weaver-xtreme' /*adm*/) ),
600
 
845
 
846
  $css = weaverx_getopt('add_css');
847
 
848
+ if (isset($value['id']))
849
+ $icon = $value['id'];
850
  if ( !isset($icon) || !$icon )
851
+ $icon = ' ';
852
 
853
  $dash = '';
854
+ if ( $icon[0] == '-' ) { // add a leading icon
855
+ $dash = '<span style="padding:.2em;" class="dashicons dashicons-' . substr( $icon, 1) . '"></span>';
856
  }
857
  ?>
858
  <tr class="atw-row-header"><td colspan="3">
877
  <?php
878
  }
879
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
880
 
881
  ?>
admin/admin-lib-ts.php ADDED
@@ -0,0 +1,576 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // files needed to be loaded before any ts lib sapi interface actions
3
+ //
4
+ function weaverx_process_options_themes() {
5
+
6
+ if (weaverx_submitted('set_subtheme')) { // invoked from Weaver Xtreme Subthemes tab (this file)
7
+ if (isset($_POST['theme_picked'])) {
8
+ $theme = weaverx_filter_textarea($_POST['theme_picked']);
9
+
10
+ if (weaverx_activate_subtheme($theme))
11
+ weaverx_save_msg(__("Subtheme Selected: ", 'weaver-xtreme' /*adm*/) . $theme );
12
+ else
13
+ weaverx_save_msg(__("Invalid Subtheme file detected. Your installation of Weaver Xtreme may be broken.", 'weaver-xtreme' /*adm*/));
14
+ } else {
15
+ weaverx_save_msg(__("Please select a subtheme.", 'weaver-xtreme' /*adm*/));
16
+ }
17
+ return true;
18
+ }
19
+
20
+ if (weaverx_submitted('save_mytheme')) { // invoked from Save/Restore tab
21
+ weaverx_save_msg(__("Current settings saved in WordPress database.", 'weaver-xtreme' /*adm*/));
22
+ global $weaverx_opts_cache;
23
+ if (!$weaverx_opts_cache)
24
+ $weaverx_opts_cache = get_option( apply_filters('weaverx_options','weaverx_settings') ,array());
25
+ if (current_user_can( 'manage_options' )) {
26
+ $compressed = array_filter( $weaverx_opts_cache, 'strlen'); // filter out all null options (strlen == 0)
27
+ update_option(apply_filters('weaverx_options','weaverx_settings_backup'),$compressed);
28
+ if ( apply_filters('weaverx_xtra_type', '+backup' ) != 'inactive')
29
+ delete_option('weaverx_plus_backup');
30
+ }
31
+ return true;
32
+ }
33
+
34
+ if (weaverx_submitted('restore_mytheme')) { // invoked from Save/Restore tab
35
+ global $weaverx_opts_cache;
36
+ $saved = get_option( apply_filters('weaverx_options','weaverx_settings_backup') ,array());
37
+ if (!empty($saved)) {
38
+ $weaverx_opts_cache = $saved;
39
+ weaverx_wpupdate_option('weaverx_settings',$weaverx_opts_cache);
40
+ }
41
+ weaverx_save_msg(__("Current settings restored from WordPress database.", 'weaver-xtreme' /*adm*/));
42
+ return true;
43
+ }
44
+
45
+ if (weaverx_submitted('hide_thumbs')) {
46
+ $hide = weaverx_getopt('_hide_theme_thumbs');
47
+ weaverx_setopt('_hide_theme_thumbs', !$hide);
48
+ return true;
49
+ }
50
+ return false;
51
+ }
52
+
53
+ function weaverx_activate_subtheme($theme) {
54
+ /* load settings for specified theme */
55
+ global $weaverx_opts_cache;
56
+
57
+ /* build the filename - theme files stored in /wp-content/themes/weaver-xtreme/subthemes/
58
+
59
+ Important: the following code assumes that any of the pre-defined theme files won't have
60
+ and end-of-line character in them, which should be true. A user could muck about with the
61
+ files, and possibly break this assumption. This assumption is necessary because the WP
62
+ theme rules allow 'file', but not 'file get contents'. Other than that, the following code
63
+ is really the same as the 'theme' section of weaverx_upload_theme() in the pro library
64
+ */
65
+
66
+ $ext = '.wxt';
67
+
68
+ $filename = get_template_directory() . '/subthemes/' . $theme . $ext;
69
+
70
+ if ( ! weaverx_f_exists( $filename ) ) {
71
+ $filename = str_replace('.wxt', '.wxb', $filename);
72
+ if ( ! weaverx_f_exists( $filename ) )
73
+ return false;
74
+ else
75
+ $ext = '.wxb';
76
+ }
77
+
78
+ $contents = weaverx_f_get_contents($filename); // use either real (pro) or file (standard) version of function
79
+
80
+ if (empty($contents)) return false;
81
+
82
+ if ( substr($contents,0,10) != 'WXT-V01.00' ) {
83
+ if ($ext == '.wxb' && substr($contents,0,10) != 'WXB-V01.00' )
84
+ return false;
85
+ }
86
+
87
+ $restore = array();
88
+ $restore = unserialize(substr($contents,10));
89
+
90
+ if (!$restore) return false;
91
+ $version = weaverx_getopt('weaverx_version_id'); // get something to force load
92
+
93
+ // need to clear some settings
94
+ // first, pickup the per-site settings that aren't theme related...
95
+ $new_cache = array();
96
+ if ( $ext == '.wxt' ) {
97
+ foreach ($weaverx_opts_cache as $key => $val) {
98
+ if ($key[0] == '_') { // these are non-theme specific settings
99
+ $new_cache[$key] = $weaverx_opts_cache[$key]; // clear
100
+ }
101
+ }
102
+ }
103
+
104
+ $opts = $restore['weaverx_base']; // fetch base opts
105
+ weaverx_delete_all_options();
106
+
107
+ foreach ($new_cache as $key => $val) { // set the values we need to keep
108
+ weaverx_setopt($key,$new_cache[$key],false);
109
+ }
110
+ foreach ($opts as $key => $val) {
111
+ if ($key[0] == '_' && $ext != '.wxb' )
112
+ continue; // should be here
113
+ weaverx_setopt($key, $val, false); // overwrite with saved theme values
114
+ }
115
+
116
+ weaverx_setopt('theme_filename',$theme);
117
+ weaverx_setopt('last_option','Weaver Xtreme');
118
+
119
+ weaverx_save_opts('set subtheme'); // OK, now we've saved the options, update them in the DB
120
+ return true;
121
+ }
122
+
123
+ //================= moved from old lib-admin ================
124
+ //============================================ form builder ====================================
125
+
126
+ function weaverx_form_show_options($weaverx_olist, $begin_table = true, $end_table = true) {
127
+ /* output a list of options - this really does the layout for the options defined in an array */
128
+ if ($begin_table) {
129
+ ?>
130
+ <div>
131
+ <table class="optiontable" style="margin-top:6px;">
132
+ <?php
133
+ }
134
+ foreach ($weaverx_olist as $value) {
135
+ $value['type'] = weaverx_fix_type($value['type']);
136
+ switch ($value['type']) {
137
+ case 'align':
138
+ weaverx_form_align($value);
139
+ break;
140
+ case 'checkbox':
141
+ weaverx_form_checkbox($value);
142
+ break;
143
+ case 'ctext':
144
+ weaverx_form_ctext($value);
145
+ break;
146
+ case 'color':
147
+ weaverx_form_color($value);
148
+ break;
149
+ case 'custom_css':
150
+ weaverx_custom_css($value);
151
+ break;
152
+ case 'endheader':
153
+ echo '<!-- end header -->';
154
+ break;
155
+ case 'fi_align':
156
+ weaverx_form_fi_align($value);
157
+ break;
158
+ case 'fi_location':
159
+ weaverx_from_fi_location($value);
160
+ break;
161
+ case 'fi_location_post':
162
+ weaverx_from_fi_location($value, true);
163
+ break;
164
+ case 'header':
165
+ weaverx_form_header($value);
166
+ break;
167
+ case 'header_area':
168
+ weaverx_form_header_area($value);
169
+ break;
170
+ case 'header0':
171
+ weaverx_form_header($value,true);
172
+ break;
173
+ case 'inactive':
174
+ weaverx_form_inactive($value);
175
+ break;
176
+ case 'link':
177
+ weaverx_form_link($value);
178
+ break;
179
+ case 'menu_opts':
180
+ weaverx_form_menu_opts($value, false);
181
+ break;
182
+ case 'menu_opts_submit':
183
+ weaverx_form_menu_opts($value, true);
184
+ break;
185
+ case 'note':
186
+ weaverx_form_note($value);
187
+ break;
188
+ case 'radio':
189
+ weaverx_form_radio($value);
190
+ break;
191
+ case 'rounded':
192
+ weaverx_form_rounded($value);
193
+ break;
194
+ case 'select_hide':
195
+ weaverx_form_select_hide($value);
196
+ break;
197
+ case 'select_id':
198
+ weaverx_form_select_id($value);
199
+ break;
200
+ case 'select_layout':
201
+ weaverx_form_select_layout($value);
202
+ break;
203
+ case 'shadows':
204
+ weaverx_form_shadows($value);
205
+ break;
206
+ case 'subheader':
207
+ weaverx_form_subheader($value);
208
+ break;
209
+ case 'subheader_alt':
210
+ weaverx_form_subheader_alt($value);
211
+ break;
212
+ case 'submit':
213
+ weaverx_form_submit($value);
214
+ break;
215
+ case 'text':
216
+ case 'widetext':
217
+ weaverx_form_text($value);
218
+ break;
219
+ case 'text_xy':
220
+ weaverx_form_text_xy($value);
221
+ break;
222
+ case 'text_xy_em':
223
+ weaverx_form_text_xy($value,'X','Y','em');
224
+ break;
225
+ case 'text_xy_percent':
226
+ weaverx_form_text_xy($value,'X','Y','%');
227
+ break;
228
+ case 'text_tb':
229
+ weaverx_form_text_xy($value,'T','B');
230
+ break;
231
+ case 'text_lr':
232
+ weaverx_form_text_xy($value,'L','R');
233
+ break;
234
+ case 'text_lr_em':
235
+ weaverx_form_text_xy($value,'L','R','em');
236
+ break;
237
+ case 'text_lr_percent':
238
+ weaverx_form_text_xy($value,'L','R','%');
239
+ break;
240
+ case 'textarea':
241
+ weaverx_form_textarea($value);
242
+ break;
243
+ case 'titles':
244
+ weaverx_form_text_props($value, 'titles');
245
+ break;
246
+ case 'titles_area':
247
+ weaverx_form_text_props($value, 'area');
248
+ break;
249
+ case 'titles_content':
250
+ weaverx_form_text_props($value, 'content');
251
+ break;
252
+ case 'titles_menu':
253
+ weaverx_form_text_props($value, 'menu');
254
+ break;
255
+ case 'titles_text':
256
+ weaverx_form_text_props($value, 'text');
257
+ break;
258
+ case 'val_num':
259
+ weaverx_form_val($value,'');
260
+ break;
261
+ case 'val_percent':
262
+ weaverx_form_val($value,'%');
263
+ break;
264
+ case 'val_px':
265
+ weaverx_form_val($value,'px');
266
+ break;
267
+ case 'val_em':
268
+ weaverx_form_val($value,'em');
269
+ break;
270
+ case 'widget_area':
271
+ weaverx_form_widget_area($value, false);
272
+ break;
273
+ case 'widget_area_submit':
274
+ weaverx_form_widget_area($value, true);
275
+ break;
276
+ default:
277
+ weaverx_form_subheader_alt($value);
278
+ break;
279
+ }
280
+
281
+ }
282
+ if ($end_table) {
283
+ ?>
284
+ </table></div> <!-- close previous tab div -->
285
+ <br />
286
+ <?php
287
+ }
288
+ }
289
+
290
+ function weaverx_fix_type($type) {
291
+ return apply_filters('weaverx_xtra_type', $type );
292
+ }
293
+
294
+ function weaverx_form_inactive($value, $reason= '') {
295
+ if ( $reason == '' )
296
+ $reason = '<small>' . __('Weaver Xtreme Plus Options', 'weaver-xtreme' /*adm*/) . '&nbsp;</small>';
297
+ if (!isset($value['name']) || !isset($value['id']) || !isset($value['info'])) { // probably an '=submit'
298
+ return;
299
+ }
300
+ $title = $value['name'];
301
+ if (strlen($title) < 1) $title = ' '; // make code work for invisibles
302
+ if ($title[0] == '#')
303
+ $title = substr($title,4); // strip color
304
+ echo ' <tr>' . "\n";
305
+ ?>
306
+ <th scope="row" style="width:200px;"><?php /* NO SAPI SETTING */
307
+ echo '<span style="color:#777;float:right;">'.$title.':&nbsp;</span>';
308
+ if (!empty($value['help'])) {
309
+ weaverx_help_link($value['help'], __('Help for ', 'weaver-xtreme' /*adm*/) . $title);
310
+ }
311
+ ?>
312
+ </th>
313
+ <td style="color:#777;"><?php echo $reason; ?>
314
+ <input type="hidden" name="<?php weaverx_sapi_main_name($value['id']); ?>" id="<?php echo $value['id']; ?>" value="<?php if ( weaverx_getopt( $value['id'] ) != "") { weaverx_esc_textarea(weaverx_getopt( $value['id'] )); } else { echo ''; } ?>" />
315
+ </td>
316
+ <?php
317
+ if ($value['info'] != '') {
318
+ echo('<td style="padding-left:10px;color:#777;font-size:x-small;">'); echo $value['info'];
319
+ echo("</td>\n");
320
+ }
321
+ ?>
322
+ </tr>
323
+ <?php
324
+ }
325
+
326
+
327
+ function weaverx_echo_name($value, $add_icon = '') {
328
+ $l = $add_icon . $value['name'];
329
+ if (isset($value['id']))
330
+ $icon = $value['id'];
331
+ if ( !isset($icon) || !$icon )
332
+ $icon = ' ';
333
+ if (strlen($l) > 4 && $l[0] == '#') {
334
+ echo '<span style="color:' . substr($l,0,4) .
335
+ ';">' . substr($l,4) . '</span>';
336
+ } else if ( $icon[0] == '-' ) { // add a leading icon
337
+ echo '<span class="dashicons dashicons-' . substr( $icon, 1) . '">' . $l . '</span>';
338
+ } else {
339
+ echo $l;
340
+ }
341
+ }
342
+
343
+ function weaverx_form_ctext( $value, $val_only = false ) {
344
+
345
+ $pclass = 'color {hash:true, adjust:false}'; // starting with V 1.3, allow text in color pickers
346
+ $img_css = '<img src="'. esc_url(get_template_directory_uri() . '/assets/images/theme/css.png') . '" alt="css" />' ;
347
+ $img_hide = esc_url(get_template_directory_uri() . '/assets/images/theme/hide.png') ;
348
+ $img_show = esc_url(get_template_directory_uri() . '/assets/images/theme/show.png') ;
349
+ $help_file = esc_url(get_template_directory_uri() . '/help/css-help.html');
350
+ $css_id = $value['id'] . '_css';
351
+ $css_id_text = weaverx_getopt($css_id);
352
+ if ($css_id_text && !weaverx_getopt( '_hide_auto_css_rules' )) {
353
+ $img_toggle = $img_hide;
354
+ } else {
355
+ $img_toggle = $img_show;
356
+ }
357
+ $add_icon = '<span class="i-left-bg dashicons dashicons-admin-appearance"></span>';
358
+ if (strpos($value['name'], ' BG') === false)
359
+ $add_icon = '<span class="i-left-fg dashicons dashicons-admin-appearance"></span>';
360
+ if ( ! $val_only ) { ?>
361
+ <tr>
362
+ <th scope="row" align="right"><?php weaverx_echo_name($value, $add_icon ); ?>:&nbsp;</th>
363
+ <td> <?php
364
+ } else {
365
+ echo '&nbsp;<small>' . $value['info'] . '</small>&nbsp;';
366
+ } ?>
367
+ <input class="<?php echo $pclass; ?>" name="<?php weaverx_sapi_main_name($value['id']); ?>" id="<?php echo $value['id']; ?>" type="text" style="width:90px" value="<?php if ( weaverx_getopt( $value['id'] ) != "") { weaverx_esc_textarea(weaverx_getopt( $value['id'] )); } else { echo ''; } ?>" />
368
+ <?php
369
+ echo $img_css; ?><a href="javascript:void(null);" onclick="weaverx_ToggleRowCSS(document.getElementById('<?php echo $css_id . '_js'; ?>'), this, '<?php echo $img_show; ?>', '<?php echo $img_hide; ?>')"><?php echo '<img src="' . esc_url($img_toggle) . '" alt="toggle css" />'; ?></a>
370
+ <?php if ( ! $val_only ) { ?>
371
+ </td>
372
+ <?php weaverx_form_info($value);
373
+ ?>
374
+ </tr>
375
+ <?php }
376
+ $css_rows = weaverx_getopt('_css_rows');
377
+ if ($css_rows < 1 || $css_rows > 25)
378
+ $css_rows = 1;
379
+ if ($css_id_text && !weaverx_getopt( '_hide_auto_css_rules' )) { ?>
380
+ <tr id="<?php echo $css_id . '_js'; ?>">
381
+ <th scope="row" align="right"><span style="color:#22a;"><small><?php _e('Custom CSS styling:', 'weaver-xtreme' /*adm*/); ?></small></span></th>
382
+ <td align="right"><small>&nbsp;</small></td>
383
+ <td>
384
+ <small>
385
+ <?php _e('You can enter CSS rules, enclosed in {}\'s, and separated by <strong>;</strong>. See ', 'weaver-xtreme' /*adm*/); ?>
386
+ <a href="<?php echo $help_file; ?>" target="_blank"><?php _e('CSS Help', 'weaver-xtreme' /*adm*/); ?></a> <?php _e('for more details.', 'weaver-xtreme' /*adm*/); ?></small><br />
387
+ <?php weaverx_textarea( $css_id_text, $css_id, $css_rows,'{ font-size:150%; font-weight:bold; } /* for example */' ); ?>
388
+ </td>
389
+ </tr>
390
+ <?php
391
+ } else {
392
+ ?>
393
+ <tr id="<?php echo $css_id . '_js'; ?>" style="display:none;">
394
+ <th scope="row" align="right"><span style="color:green;"><small><?php _e('Custom CSS styling:', 'weaver-xtreme' /*adm*/); ?></small></span></th>
395
+ <td align="right"><small>&nbsp;</small></td>
396
+ <td>
397
+ <small>
398
+ <?php _e('You can enter CSS rules, enclosed in {}\'s, and separated by <strong>;</strong>. See', 'weaver-xtreme' /*adm*/); ?>
399
+ <a href="<?php echo $help_file; ?>" target="_blank"><?php _e('CSS Help', 'weaver-xtreme' /*adm*/); ?></a> for more details.</small><br />
400
+ <?php weaverx_textarea( $css_id_text, $css_id, $css_rows,'{ font-size:150%; font-weight:bold; } /* for example */' ); ?>
401
+ </td>
402
+ </tr>
403
+ <?php
404
+ }
405
+ }
406
+
407
+ function weaverx_textarea($text, $id, $rows = 0, $place = '', $style = 'width:85%;', $class='wvrx-edit', $filter = true) {
408
+ $name = weaverx_sapi_main_name($id, false);
409
+ /* if ($text) {
410
+ $newrows = count((explode("\n",$text)))+1;
411
+ if ($newrows > $rows)
412
+ $rows = $newrows;
413
+ } else { */
414
+ if ( $rows < 2 ) {
415
+ $rows = 1;
416
+ }
417
+ if ($rows > 25) $rows = 25;
418
+ if ( $filter )
419
+ $text = weaverx_esc_textarea($text, false); // don't echo
420
+ echo "<textarea class='{$class}' placeholder='{$place}' name='{$name}' rows='$rows' style='{$style}'>{$text}</textarea>\n";
421
+ }
422
+
423
+
424
+ function weaverx_form_color($value, $val_only = false) {
425
+
426
+ $pclass = 'color {hash:true, adjust:false}'; // starting with V 1.3, allow text in color pickers
427
+ if ( ! $val_only ) {
428
+ ?>
429
+ <tr>
430
+ <th scope="row" align="right"><?php weaverx_echo_name($value, '<span class="i-left-fg dashicons dashicons-admin-appearance"></span>'); ?>:&nbsp;</th>
431
+ <td>
432
+ <?php } else { echo '&nbsp;<small>' . $value['info'] . '</small>&nbsp;'; } ?>
433
+ <input class="<?php echo $pclass; ?>" name="<?php weaverx_sapi_main_name($value['id']); ?>" id="<?php echo $value['id']; ?>" type="text" style="width:90px" value="<?php if ( weaverx_getopt( $value['id'] ) != "") { weaverx_esc_textarea(weaverx_getopt( $value['id'] )); } else { echo ' '; } ?>" />
434
+ <?php if (! $val_only ) { ?>
435
+ </td>
436
+ <?php weaverx_form_info($value);
437
+ ?>
438
+ </tr>
439
+ <?php
440
+ }
441
+ }
442
+ function weaverx_form_header($value, $narrow=false) {
443
+ ?>
444
+ <tr class="atw-row-header">
445
+ <th scope="row" align="left" style="width:200px;"><?php /* NO SAPI SETTING */
446
+
447
+ if (isset($value['id']))
448
+ $icon = $value['id'];
449
+ if ( !isset($icon) || !$icon )
450
+ $icon = ' ';
451
+
452
+ $dash = '';
453
+ if ( $icon[0] == '-' ) { // add a leading icon
454
+ $dash = '<span style="padding: .1em .5em 0 .2em" class="dashicons dashicons-' . substr( $icon, 1) . '"></span>';
455
+ }
456
+ echo weaverx_anchor($value['name']) . $dash . '<span style="font-weight:bold; font-size: larger;"><em>'. $value['name'] .'</em></span>';
457
+ weaverx_form_help($value);
458
+ ?>
459
+ </th>
460
+ <?php
461
+ if ($narrow) echo ('<td style="width:80px;">&nbsp;</td>'. "\n");
462
+ else echo ('<td style="width:170px;">&nbsp;</td>'. "\n");
463
+
464
+ if ($value['info'] != '') {
465
+ echo('<td style="padding-left: 10px"><u><em><strong>'); echo $value['info'];
466
+ echo("</strong></em></u></td>\n");
467
+ }
468
+ ?>
469
+ </tr>
470
+ <?php
471
+ }
472
+
473
+ function weaverx_anchor( $title ) {
474
+ if ( $title )
475
+ return '<a class="anchorx" id="' . sanitize_title( $title ) . '"></a>';
476
+ return '';
477
+ }
478
+
479
+ function weaverx_form_help($value) {
480
+ if (!empty($value['help'])) {
481
+ weaverx_help_link($value['help'], 'Help for ' . $value['name']);
482
+ }
483
+ }
484
+
485
+ function weaverx_form_subheader($value) {
486
+ ?>
487
+ <tr class="atw-row-subheader">
488
+ <th scope="row" align="left" style="width:200px;line-height:2em;"><?php /* NO SAPI SETTING */
489
+
490
+ if (isset($value['id']))
491
+ $icon = $value['id'];
492
+ if ( !isset($icon) || !$icon )
493
+ $icon = ' ';
494
+
495
+ $dash = '';
496
+ if ( $icon[0] == '-' ) { // add a leading icon
497
+ $dash = '<span style="padding:.2em;" class="dashicons dashicons-' . substr( $icon, 1) . '"></span>';
498
+ }
499
+
500
+ echo weaverx_anchor($value['name']) . $dash . '<span style="color:blue; font-weight:bold; "><em><u>'.$value['name'].'</u></em></span>';
501
+ weaverx_form_help($value);
502
+ ?>
503
+ </th>
504
+ <td style="width:170px;">&nbsp;</td>
505
+ <?php
506
+ if ($value['info'] != '') {
507
+ echo('<td style="padding-left: 10px"><u><em>'); echo $value['info'];
508
+ echo("</em></u></td>\n");
509
+ }
510
+ ?>
511
+ </tr>
512
+ <?php
513
+ }
514
+
515
+ function weaverx_form_subheader_alt($value) {
516
+ ?>
517
+ <tr><td>&nbsp;</td></tr>
518
+ <tr class="atw-row-subheader-alt" >
519
+ <th scope="row" align="left" style="width:200px;line-height:2em;"><?php /* NO SAPI SETTING */
520
+
521
+ if (isset($value['id']))
522
+ $icon = $value['id'];
523
+ if ( !isset($icon) || !$icon )
524
+ $icon = ' ';
525
+
526
+ $dash = '';
527
+ if ( $icon[0] == '-' ) { // add a leading icon
528
+ $dash = '<span style="padding:.2em;" class="dashicons dashicons-' . substr( $icon, 1) . '"></span>';
529
+ }
530
+ echo weaverx_anchor($value['name']) . $dash . '<span style="color:blue; font-weight:bold;padding-left:5px;"><em>'.$value['name'].'</em></span>';
531
+ weaverx_form_help($value);
532
+ ?>
533
+ </th>
534
+ <td style="width:170px;">&nbsp;</td>
535
+ <?php
536
+ if (isset($value['info']) && $value['info'] != '') {
537
+ echo('<td style="padding-left: 10px;color:blue;">'); echo $value['info'];
538
+ echo("</td>\n");
539
+ }
540
+ ?>
541
+ </tr>
542
+ <?php
543
+ }
544
+
545
+ function weaverx_form_header_area($value) {
546
+ ?>
547
+ <tr><td>&nbsp;</td></tr>
548
+ <tr class="atw-row-subheader-area" >
549
+ <th scope="row" align="left" style="width:200px;line-height:2em;"><?php /* NO SAPI SETTING */
550
+
551
+ if (isset($value['id']))
552
+ $icon = $value['id'];
553
+ if ( !isset($icon) || !$icon )
554
+ $icon = ' ';
555
+
556
+ $dash = '';
557
+ if ( $icon[0] == '-' ) { // add a leading icon
558
+ $dash = '<span style="padding:.2em;" class="dashicons dashicons-' . substr( $icon, 1) . '"></span>';
559
+ }
560
+
561
+ echo weaverx_anchor($value['name']) . $dash . '<span style="color:blue; font-weight:bold;padding-left:5px;font-size:small;"><em>'.$value['name'].'</em></span>';
562
+ weaverx_form_help($value);
563
+ ?>
564
+ </th>
565
+ <td style="width:170px;">&nbsp;</td>
566
+ <?php
567
+ if ($value['info'] != '') {
568
+ echo('<td style="padding-left: 10px;color:blue;">'); echo $value['info'];
569
+ echo("</td>\n");
570
+ }
571
+ ?>
572
+ </tr>
573
+ <?php
574
+ }
575
+
576
+ ?>
admin/admin-mainopts.php CHANGED
@@ -84,8 +84,7 @@ function weaverx_mainopts_general() {
84
 
85
  $opts = array(
86
  array( 'type' => 'submit'),
87
- array('name' => __('Wrapping Areas', 'weaver-xtreme' /*adm*/), 'icon' => '-admin-generic',
88
- 'id' => 'h-wrap-areas', 'type' => 'header',
89
  'info' => __('Settings for wrapping areas','weaver-xtreme' /*adm*/),
90
  'help' => 'help.html#GenApp'),
91
  array('name' => __('GLOBAL SETTINGS', 'weaver-xtreme' /*adm*/), 'type' => 'note',
@@ -140,17 +139,14 @@ With <em>Weaver Xtreme Plus</em>, you can also specify background images for var
140
  function weaverx_mainopts_custom() {
141
  $opts = array(
142
  array( 'type' => 'submit'),
143
- array('name' => __('Custom Options', 'weaver-xtreme' /*adm*/), 'icon' => '-admin-generic',
144
- 'id' => 'h-custom-opts', 'type' => 'header',
145
  'info' => __('Set various global custom values.', 'weaver-xtreme' /*adm*/),
146
  'help' => 'help.html#Custom'),
147
 
148
- array('name' => __('Various Custom Values', 'weaver-xtreme' /*adm*/), 'icon' => '-admin-settings',
149
- 'id' => 'h-var-cust-vals', 'type' => 'subheader',
150
  'info' => __('Adjust various global settings', 'weaver-xtreme' /*adm*/)),
151
 
152
- array('name' => __('Smart Margin Width', 'weaver-xtreme' /*adm*/),
153
- 'icon' => '-align-none',
154
  'id' => 'smart_margin_int', 'type' => '+val_percent',
155
  'info' => __('Width used for smart column margins for Sidebars and Content Area. (Default: 1%) (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
156
 
@@ -158,8 +154,7 @@ function weaverx_mainopts_custom() {
158
  'info' => __('Global color of borders. (Default: #222)', 'weaver-xtreme' /*adm*/)),
159
  array('name' => '<small>' . __('Border Width', 'weaver-xtreme' /*adm*/) . '</small>' , 'id' => 'border_width_int', 'type' => 'val_px',
160
  'info' => __('Global Width of borders. (Default: 1px)', 'weaver-xtreme' /*adm*/)),
161
- array('name' => '<small>' . __('Border Style', 'weaver-xtreme' /*adm*/) . '</small>',
162
- 'icon' => '<span class="i-left" style="font-size:200%;margin-left:4px;">&#x25a1;</span>' ,
163
  'id' => 'border_style', 'type' => '+select_id',
164
  'info' => __('Style of borders - width needs to be > 1 for some styles to work correctly (&starf;Plus)', 'weaver-xtreme' /*adm*/),
165
  'value' => array(
@@ -191,8 +186,7 @@ function weaverx_mainopts_custom() {
191
  array( 'type' => 'submit'),
192
 
193
 
194
- array('name' => __('Fonts', 'weaver-xtreme' /*adm*/), 'icon' => '-editor-textcolor',
195
- 'id' => 'h-fonts', 'type' => 'header',
196
  'info' => __('Font Base Sizes', 'weaver-xtreme' /*adm*/),
197
  'help' => 'font-demo.html'
198
  ),
@@ -237,8 +231,7 @@ function weaverx_mainopts_custom() {
237
  function weaverx_mainopts_header() {
238
  $opts = array(
239
  array( 'type' => 'submit'),
240
- array('name' => __('Header Options', 'weaver-xtreme' /*adm*/), 'icon' => '-admin-generic',
241
- 'id' => 'h-header-opts', 'type' => 'header',
242
  'info' => __('Options affecting site Header', 'weaver-xtreme' /*adm*/),
243
  'help' => 'help.html#HeaderOpt'),
244
 
@@ -246,8 +239,7 @@ function weaverx_mainopts_header() {
246
  array('name' => __('Header Area', 'weaver-xtreme' /*adm*/), 'id' => 'header', 'type' => 'widget_area',
247
  'info' => __('Wraps the Header Area: menu bars, standard header image, title, tagline, header widget area', 'weaver-xtreme' /*adm*/)),
248
 
249
- array('name' => __('Hide Search on Header', 'weaver-xtreme' /*adm*/),
250
- 'icon' => '-visibility',
251
  'id' => 'header_search_hide', 'type' => 'select_hide',
252
  'info' => __('Selectively hide the Search Box Button on top right of header', 'weaver-xtreme' /*adm*/)),
253
  array('name' => '<small>' . __('Search Area Options:', 'weaver-xtreme' /*adm*/) . '</small>', 'type' => 'note',
@@ -255,12 +247,10 @@ function weaverx_mainopts_header() {
255
 
256
  array( 'type' => 'submit'),
257
 
258
- array('name' => __('Header Image', 'weaver-xtreme' /*adm*/), 'icon' => '-format-image',
259
- 'id' => 'h-hdr-img', 'type' =>'subheader',
260
  'info' => __('Settings related to standard header image (Set on Appearance&rarr;Header)', 'weaver-xtreme' /*adm*/)),
261
 
262
- array('name' => __('Hide Header Image', 'weaver-xtreme' /*adm*/),
263
- 'icon' => '-visibility',
264
  'id' => 'hide_header_image', 'type' => 'select_hide',
265
  'info' => __('Check to selectively hide standard header image', 'weaver-xtreme' /*adm*/)),
266
 
@@ -274,13 +264,13 @@ function weaverx_mainopts_header() {
274
 
275
  array('name' => '<small>' . __('Use Actual Image Size', 'weaver-xtreme' /*adm*/) . '</small>',
276
  'id' => 'header_actual_size', 'type' => '+checkbox',
277
- 'info' => __('Check to use actual header image size, centered in header. (Default: theme width) (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
278
 
279
- array('name' => __('Align Header Image', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-alignleft',
280
  'id' => 'header_image_align', 'type' => '+align',
281
  'info' => __('How to align header image - meaningful only when Max Width or Actual Size set. (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
282
 
283
- array('name' => __('Hide Header Image Front Page', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
284
  'id' => 'hide_header_image_front', 'type' => 'checkbox',
285
  'info' => __('Check to hide display of standard header image on front page only.', 'weaver-xtreme' /*adm*/)),
286
 
@@ -298,8 +288,7 @@ function weaverx_mainopts_header() {
298
  array( 'type' => 'submit'),
299
 
300
 
301
- array('name' => __('Site Title/Tagline', 'weaver-xtreme' /*adm*/), 'icon' => '-text',
302
- 'id' => 'h-title-tag', 'type' =>'subheader',
303
  'info' => __('Settings related to the Site Title and Tagline (Tagline sometimes called Site Description)', 'weaver-xtreme' /*adm*/)),
304
 
305
 
@@ -313,7 +302,7 @@ function weaverx_mainopts_header() {
313
  array('name' => '<span class="i-left" style="font-size:150%;">&harr;</span><small>' . __('Title Max Width', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => 'site_title_max_w', 'type' => 'val_percent',
314
  'info' => __("Maximum width of title in header area (Default: 90%)", 'weaver-xtreme' /*adm*/)),
315
 
316
- array('name' => __('Hide Site Title', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
317
  'id' => 'hide_site_title', 'type' => 'select_hide',
318
  'info' => __('Hide Site Title (Uses "display:none;" : SEO friendly.)', 'weaver-xtreme' /*adm*/)),
319
 
@@ -328,17 +317,17 @@ function weaverx_mainopts_header() {
328
  'id' => 'tagline_max_w', 'type' => 'val_percent',
329
  'info' => __("Maximum width of Tagline in header area (Default: 90%)", 'weaver-xtreme' /*adm*/)),
330
 
331
- array('name' => '<small>'. __('Hide Site Tagline', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
332
  'id' => 'hide_site_tagline', 'type' => 'select_hide',
333
  'info' => __('Hide Site Tagline (Uses "display:none;" : SEO friendly.)', 'weaver-xtreme' /*adm*/)),
334
 
335
  array('name' => __('Title/Tagline Area BG', 'weaver-xtreme' /*adm*/), 'id' => 'title_tagline_bgcolor', 'type' => 'ctext',
336
  'info' => __('BG Color for the Title, Tagline, Search, Logo/HTML and Mini-Menu area.', 'weaver-xtreme' /*adm*/)),
337
 
338
- array('name' => '<small>' . __('Site Logo/HTML', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-editor-code',
339
  'id' => '_site_logo', 'type' => '+textarea',
340
  'info' => __('HTML for Site Title area. (example: &lt;img src="url" style="position:absolute;top:20px;left:20px;"&nbsp;/&gt; + Custom CSS: #site-logo{min-height:123px;} (&starf;Plus) (&diams;)', 'weaver-xtreme' /*adm*/)),
341
- array('name' => '<small>'. __('Hide Site Logo/HTML', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
342
  'id' => '_hide_site_logo', 'type' => '+select_hide',
343
  'info' => __('Hide Site Logo/HTML by device (&starf;Plus) (&diams;)', 'weaver-xtreme' /*adm*/)),
344
 
@@ -355,8 +344,7 @@ function weaverx_mainopts_header() {
355
  array( 'type' => 'submit'),
356
 
357
 
358
- array('name' => __('The Header Mini-Menu', 'weaver-xtreme' /*adm*/), 'icon' => '-menu',
359
- 'id' => 'h-hdr-mini-menu', 'type' =>'subheader',
360
  'info' => __('Horizontal "Mini-Menu" displayed right-aligned of Site Tagline', 'weaver-xtreme' /*adm*/)),
361
  array('name' => __('Note:', 'weaver-xtreme' /*adm*/), 'type' => 'note',
362
  'info' => __('The Header Mini-Menu options are on the Menu Tab.', 'weaver-xtreme' /*adm*/)),
@@ -376,7 +364,7 @@ function weaverx_mainopts_header() {
376
 
377
  array( 'type' => 'submit'),
378
 
379
- array('name' => __('Header HTML', 'weaver-xtreme' /*adm*/), 'id' => 'header_html', 'type' => 'widget_area',
380
  'info' => __('Add arbitrary HTML to Header Area (in &lt;div id="header-html"&gt;)', 'weaver-xtreme' /*adm*/)),
381
 
382
 
@@ -412,8 +400,7 @@ function weaverx_mainopts_header() {
412
  function weaverx_mainopts_menus() {
413
  $opts = array(
414
  array( 'type' => 'submit'),
415
- array('name' => __('Menu &amp; Info Bars', 'weaver-xtreme' /*adm*/), 'icon' => '-menu',
416
- 'id' => 'h-info-bars', 'type' => 'header',
417
  'info' => __('Options affecting site Menus and the Info Bar', 'weaver-xtreme' /*adm*/),
418
  'help' => 'help.html#MenuBar'),
419
 
@@ -457,8 +444,7 @@ function weaverx_mainopts_menus() {
457
  array( 'type' => 'submit'),
458
 
459
 
460
- array('name' => __('Options: All Menus', 'weaver-xtreme' /*adm*/), 'icon' => '-forms',
461
- 'id' => 'h-all-menu-opts', 'type' => 'subheader_alt',
462
  'info' => __('Menu Bar enhancements and features', 'weaver-xtreme' /*adm*/)),
463
 
464
 
@@ -475,6 +461,12 @@ function weaverx_mainopts_menus() {
475
  array('name' => '<small>' . __('Do Not Highlight Ancestors', 'weaver-xtreme' /*adm*/) . '</small>',
476
  'id' => 'menubar_curpage_noancestors', 'type' => 'checkbox',
477
  'info' => __('Highlight Current Page only - do not also highlight ancestor items', 'weaver-xtreme' /*adm*/)),
 
 
 
 
 
 
478
  array( 'name' => '<small>' . __('Placeholder Hover Cursor', 'weaver-xtreme' /*adm*/) . '</small>',
479
  'id' => 'placeholder_cursor', 'type' => 'widetext',
480
  'info' => __('CSS cursor :hover attribute for placeholder menus (e.g., Custom Menus with URL==#).
@@ -483,8 +475,7 @@ function weaverx_mainopts_menus() {
483
 
484
  array( 'type' => 'submit'),
485
 
486
- array('name' => __('Header Mini-Menu', 'weaver-xtreme' /*adm*/), 'icon' => '-menu',
487
- 'id' => 'h-hdr-mmenu', 'type' =>'subheader_alt',
488
  'info' => __('Horizontal "Mini-Menu" displayed right-aligned of Site Tagline', 'weaver-xtreme' /*adm*/)),
489
 
490
 
@@ -494,11 +485,11 @@ function weaverx_mainopts_menus() {
494
  array('name' => '<small>' . __('Mini-Menu Hover', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => 'm_header_mini_hover_color', 'type' => 'ctext',
495
  'info' => __('Hover Color for Mini-Menu Links', 'weaver-xtreme' /*adm*/)),
496
 
497
- array('name' => '<small>' . __('Mini Menu Top Margin', 'weaver-xtreme' /*adm*/) . '</small>',
498
  'id' => 'm_header_mini_top_margin_dec', 'type' => 'val_em',
499
  'info' => __('Top margin for Mini-Menu. Negative value moves it up. (Default: -1.0em)', 'weaver-xtreme' /*adm*/)),
500
 
501
- array('name' => '<small>' . __('Hide Mini Menu', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
502
  'id' => 'm_header_mini_hide', 'type' => 'select_hide',
503
  'info' => __('Hide Mini Menu', 'weaver-xtreme' /*adm*/)),
504
 
@@ -553,8 +544,7 @@ function weaverx_mainopts_menus() {
553
  function weaverx_mainopts_content() {
554
  $opts = array(
555
  array( 'type' => 'submit'),
556
- array('name' => __('Content Areas', 'weaver-xtreme' /*adm*/), 'icon' => '-admin-page',
557
- 'id' => 'h-content-areas', 'type' => 'header',
558
  'info' => __('Settings for the content areas (posts and pages)', 'weaver-xtreme' /*adm*/),
559
  'toggle' => 'content-areas',
560
  'help' => 'help.html#ContentAreas'),
@@ -569,7 +559,7 @@ function weaverx_mainopts_content() {
569
  array('name' => '<small>' . __('Space Between Title and Content', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => 'space_after_title_dec', 'type' => 'val_em',
570
  'info' => __('Space between Page or Post title and beginning of content (Default: 1.0em)', 'weaver-xtreme' /*adm*/)),
571
 
572
- array('name' => __('Archive Pages Title', 'weaver-xtreme' /*adm*/), 'id' => 'archive_title', 'type' => 'titles',
573
  'info' => __('Archive-like page titles: archives, categories, tags, searches.', 'weaver-xtreme' /*adm*/)),
574
 
575
  array('name' => __('Content Links', 'weaver-xtreme' /*adm*/), 'id' => 'contentlink', 'type' => 'link',
@@ -580,8 +570,7 @@ function weaverx_mainopts_content() {
580
 
581
  array( 'type' => 'submit'),
582
 
583
- array('name' => __('Text', 'weaver-xtreme' /*adm*/), 'icon' => '-text',
584
- 'id' => 'h-text-related', 'type'=>'subheader_alt',
585
  'info' => __('Text related options', 'weaver-xtreme' /*adm*/)),
586
 
587
  array('name' => '<small>' . __('Space after paragraphs and lists', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => 'content_p_list_dec', 'type' => 'val_em',
@@ -608,8 +597,7 @@ function weaverx_mainopts_content() {
608
  ),
609
 
610
 
611
- array('name' => __('Search Boxes', 'weaver-xtreme' /*adm*/), 'icon' => '-search',
612
- 'id' => 'h-search-boxes', 'type'=>'subheader_alt',
613
  'info' => __('Search box related options', 'weaver-xtreme' /*adm*/)),
614
 
615
  array('name' => '<small>' . __('Search Input BG', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => 'search_bgcolor', 'type' => 'ctext',
@@ -636,8 +624,7 @@ function weaverx_mainopts_content() {
636
 
637
 
638
  array( 'type' => 'submit'),
639
- array('name' => __('Images', 'weaver-xtreme' /*adm*/), 'icon' => '-format-image',
640
- 'id' => 'h-img-opts', 'type'=>'subheader_alt',
641
  'info' => __('Image related options', 'weaver-xtreme' /*adm*/)),
642
  array('name' => '<small>' . __('Image Border Color', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => 'media_lib_border_color', 'type' => 'ctext',
643
  'info' => __('Border color for images in Container and Footer.', 'weaver-xtreme' /*adm*/)),
@@ -655,8 +642,7 @@ function weaverx_mainopts_content() {
655
  array('name' => '<small>' . __('Caption text color', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => 'caption_color', 'type' => 'ctext',
656
  'info' => __('Color of captions - e.g., below media images.', 'weaver-xtreme' /*adm*/)),
657
 
658
- array('name' => __('Featured Image - Pages', 'weaver-xtreme' /*adm*/), 'icon' => '-id',
659
- 'id' => 'h-fi-pages', 'type'=>'subheader_alt',
660
  'info' => __('Display of Page Featured Images', 'weaver-xtreme' /*adm*/)),
661
  array('name' => '<span class="i-left" style=font-size:120%;">&nbsp;&#10538;</span>' . __('Featured Image Location', 'weaver-xtreme' /*adm*/),
662
  'id' => 'page_fi_location', 'type' => 'fi_location',
@@ -664,8 +650,7 @@ function weaverx_mainopts_content() {
664
  array('name' => '<span class="i-left dashicons dashicons-editor-alignleft"></span><small>' . __('Featured Image Alignment<small>', 'weaver-xtreme' /*adm*/), 'id' => 'page_fi_align', 'type' => 'fi_align',
665
  'info' => __('How to align the Featured Image', 'weaver-xtreme' /*adm*/)),
666
 
667
- array('name' => '<small>' . __('Hide Featured Image on Pages', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
668
- 'id' => 'page_fi_hide', 'type' => 'select_hide',
669
  'info' => __('Where to hide Featured Images on Pages (Posts have their own setting.)', 'weaver-xtreme' /*adm*/)),
670
 
671
  array ('name' => '<small>' . __('Page Featured Image Size', 'weaver-xtreme' /*adm*/) . '</small>',
@@ -681,8 +666,7 @@ function weaverx_mainopts_content() {
681
  'id' => 'page_fi_width', 'type' => '+val_percent',
682
  'info' => __('Width of Featured Image on Pages. Max Width in %, overrides FI Size selection. (&starf;Plus)', 'weaver-xtreme' /*adm*/) ),
683
 
684
- array('name' => __('Lists - &lt;HR&gt; - Tables', 'weaver-xtreme' /*adm*/), 'icon' => '-list-view',
685
- 'id' => 'h-list-tables', 'type'=>'subheader_alt',
686
  'info' => __('Other options related to content', 'weaver-xtreme' /*adm*/)),
687
  array ('name' => __('Content List Bullet', 'weaver-xtreme' /*adm*/),
688
  'id' => 'contentlist_bullet', 'type' => 'select_id',
@@ -708,8 +692,7 @@ function weaverx_mainopts_content() {
708
  array('val' => 'plain', 'desc' => __('Minimal', 'weaver-xtreme' /*adm*/)))
709
  ),
710
 
711
- array('name' => __('Comments', 'weaver-xtreme' /*adm*/), 'icon' => '-admin-comments',
712
- 'id' => 'h-comments', 'type' => 'subheader',
713
  'info' => __('Settings for displaying comments', 'weaver-xtreme' /*adm*/)),
714
  array('name' => __('Comment Headings', 'weaver-xtreme' /*adm*/), 'id' => 'comment_headings_color', 'type' => 'ctext',
715
  'info' => __('Color for various headings in comment form', 'weaver-xtreme' /*adm*/)),
@@ -721,7 +704,7 @@ function weaverx_mainopts_content() {
721
  'id' => 'show_comment_borders', 'type' => 'checkbox',
722
  'info' => __('Show Borders around comment sections - improves visual look of comments.', 'weaver-xtreme' /*adm*/)),
723
 
724
- array('name' => '<small>' . __('Hide Old Comments When Closed', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
725
  'id' => 'hide_old_comments', 'type' => '+checkbox',
726
  'info' => __('Hide previous comments after closing comments for page or post. (Default: show old comments after closing.) (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
727
  array('name' => '<span class="i-left dashicons dashicons-visibility"></span>'. '<small>' . __('Show Allowed HTML', 'weaver-xtreme' /*adm*/) . '</small>',
@@ -731,7 +714,7 @@ function weaverx_mainopts_content() {
731
  '<small>' . __('Hide Comment Title Icon', 'weaver-xtreme' /*adm*/) . '</small>',
732
  'id' => 'hide_comment_bubble', 'type' => '+checkbox',
733
  'info' => __('Hide the comment icon before the Comments title (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
734
- array('name' => '<small>' . __('Hide Separator Above Comments', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
735
  'id' => 'hide_comment_hr', 'type' => '+checkbox',
736
  'info' => __('Hide the (&lt;hr&gt;) separator line above the Comments area (&starf;Plus)', 'weaver-xtreme' /*adm*/))
737
  );
@@ -770,8 +753,7 @@ Please click the ? just above to see the help file entry!', 'weaver-xtreme' /*ad
770
  function weaverx_mainopts_posts() {
771
  $opts = array(
772
  array( 'type' => 'submit'),
773
- array('name' => __('Post Specifics', 'weaver-xtreme' /*adm*/), 'icon' => '-admin-post',
774
- 'id' => 'h-post-specifics', 'type' => 'header',
775
  'info' => __('Settings affecting Posts', 'weaver-xtreme' /*adm*/),
776
  'help' => 'help.html#PPSpecifics'),
777
 
@@ -788,8 +770,7 @@ function weaverx_mainopts_posts() {
788
  array( 'type' => 'submit'),
789
 
790
 
791
- array('name' => __('Post Title', 'weaver-xtreme' /*adm*/), 'icon' => '-text',
792
- 'id' => 'h-post-title', 'type' => 'subheader_alt',
793
  'info' => __('Options for the Post Title', 'weaver-xtreme' /*adm*/)),
794
 
795
  array('name' => __('Post Title', 'weaver-xtreme' /*adm*/), 'id' => 'post_title', 'type' => 'titles',
@@ -809,15 +790,14 @@ function weaverx_mainopts_posts() {
809
  'id' => 'show_post_bubble', 'type' => 'checkbox',
810
  'info' => __("Show comment bubble with link to comments on the post info line", 'weaver-xtreme' /*adm*/)),
811
 
812
- array('name' => '<small>' . __('Hide <em>Post Format</em> Icons', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
813
  'id' => 'hide_post_format_icon', 'type' => '+checkbox',
814
  'info' => __('Hide the icons for posts with Post Format specified. (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
815
 
816
 
817
 
818
 
819
- array('name' => __('Post Layout', 'weaver-xtreme' /*adm*/), 'icon' => '-schedule',
820
- 'id' => 'h-post-layout', 'type' => 'subheader_alt',
821
  'info' => __('Layout of Posts', 'weaver-xtreme' /*adm*/)),
822
 
823
  array('name' => '<span class="i-left" style=font-size:120%;">&nbsp;&#9783;</span>' . __('Columns of Posts', 'weaver-xtreme' /*adm*/), 'id' => 'blog_cols', 'type' => 'select_id', //code
@@ -857,8 +837,7 @@ array('name' => __('Post Layout', 'weaver-xtreme' /*adm*/), 'icon' => '-schedule
857
 
858
  array( 'type' => 'submit'),
859
 
860
- array('name' => __('Excerpts / Full Posts', 'weaver-xtreme' /*adm*/), 'icon' => '-exerpt-view',
861
- 'id' => 'h-excerpts-full', 'type' => 'subheader_alt',
862
  'info' => __('How to display posts in Blog / Archive Views', 'weaver-xtreme' /*adm*/)),
863
  array('name' => __('Show Full Blog Posts', 'weaver-xtreme' /*adm*/), 'id' => 'fullpost_blog', 'type' => 'checkbox',
864
  'info' => __('Will display full blog post instead of excerpts on <em>blog pages</em>.', 'weaver-xtreme' /*adm*/)),
@@ -878,8 +857,7 @@ array('name' => __('Post Layout', 'weaver-xtreme' /*adm*/), 'icon' => '-schedule
878
 
879
 
880
 
881
- array('name' => __('Post Navigation', 'weaver-xtreme' /*adm*/), 'icon' => '-leftright',
882
- 'id' => 'h-post-nav', 'type' => 'subheader_alt',
883
  'info' => __('Navigation for moving between posts', 'weaver-xtreme' /*adm*/)),
884
  array('name' => __('Blog Navigation Style', 'weaver-xtreme' /*adm*/), 'id' => 'nav_style', 'type' => 'select_id',
885
  'info' => __('Style of navigation links on blog pages: "Older/Newer posts", "Previous/Next Post", or by page numbers', 'weaver-xtreme' /*adm*/),
@@ -889,13 +867,13 @@ array('name' => __('Post Layout', 'weaver-xtreme' /*adm*/), 'icon' => '-schedule
889
  array('val' => 'paged_left', 'desc' => __('Paged - Left', 'weaver-xtreme' /*adm*/)),
890
  array('val' => 'paged_right', 'desc' => __('Paged - Right', 'weaver-xtreme' /*adm*/)))
891
  ),
892
- array('name' => '<small>' . __('Hide Top Links', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
893
  'id' => 'nav_hide_above', 'type' => '+checkbox',
894
  'info' => __('Hide the blog navigation links at the top (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
895
- array('name' => '<small>' . __('Hide Bottom Links', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
896
  'id' => 'nav_hide_below', 'type' => '+checkbox',
897
  'info' => __('Hide the blog navigation links at the bottom (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
898
- array('name' => '<small>' . __('Show Top on First Page', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
899
  'id' => 'nav_show_first', 'type' => '+checkbox',
900
  'info' => __('Show navigation at top even on the first page (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
901
 
@@ -908,30 +886,29 @@ array('name' => __('Post Layout', 'weaver-xtreme' /*adm*/), 'icon' => '-schedule
908
  ),
909
  array('name' => '<small>' . __('Link to Same Categories', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => 'single_nav_link_cats', 'type' => '+checkbox',
910
  'info' => __('Single Page navigation links point to posts with same categories. (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
911
- array('name' => '<small>' . __('Hide Top Links', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
912
  'id' => 'single_nav_hide_above', 'type' => '+checkbox',
913
  'info' => __('Hide the single page navigation links at the top (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
914
- array('name' => '<small>' . __('Hide Bottom Links', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
915
  'id' => 'single_nav_hide_below', 'type' => '+checkbox',
916
  'info' => __('Hide the single page navigation links at the bottom (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
917
 
918
  array( 'type' => 'submit'),
919
- array('name' => __('Post Meta Info Areas', 'weaver-xtreme' /*adm*/), 'icon' => '-info',
920
- 'id' => 'h-post-meta', 'type' => 'subheader_alt',
921
  'info' => __('Top and Bottom Post Meta Information areas', 'weaver-xtreme' /*adm*/)),
922
 
923
  array('name' => __('Top Post Info', 'weaver-xtreme' /*adm*/), 'id' => 'post_info_top', 'type' => 'titles_text',
924
  'info' => __("Top Post info line", 'weaver-xtreme' /*adm*/)),
925
 
926
 
927
- array('name' => '<small>' . __('Hide top post info', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
928
  'id' => 'post_info_hide_top', 'type' => 'checkbox', //code
929
  'info' => __('Hide entire top info line (posted on, by) of post.','weaver-xtreme' /*adm*/)),
930
 
931
  array('name' => __('Bottom Post Info', 'weaver-xtreme' /*adm*/), 'id' => 'post_info_bottom', 'type' => 'titles_text',
932
  'info' => __('The bottom post info line', 'weaver-xtreme' /*adm*/)),
933
 
934
- array('name' => '<small>' . __('Hide bottom post info', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
935
  'id' => 'post_info_hide_bottom', 'type' => 'checkbox', //code
936
  'info' => __('Hide entire bottom info line (posted in, comments) of post.', 'weaver-xtreme' /*adm*/)),
937
 
@@ -960,24 +937,24 @@ array('name' => __('Post Layout', 'weaver-xtreme' /*adm*/), 'icon' => '-schedule
960
 
961
  array('name' => '<span style="color:red">' . __('Note:', 'weaver-xtreme' /*adm*/) . '</span>',
962
  'type' => 'note', 'info' => __('Hiding any meta info item automatically uses Icons instead of text descriptions.', 'weaver-xtreme' /*adm*/)),
963
- array('name' => '<small>' . __('Hide Post Date', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
964
  'id' => 'post_hide_date', 'type' => 'checkbox',
965
  'info' => __('Hide the post date everywhere it is normally displayed.', 'weaver-xtreme' /*adm*/)),
966
- array('name' => '<small>' . __('Hide Post Author', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
967
  'id' => 'post_hide_author', 'type' => 'checkbox',
968
  'info' => __('Hide the post author everywhere it is normally displayed.', 'weaver-xtreme' /*adm*/)),
969
- array('name' => '<small>' . __('Hide Post Categories', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
970
  'id' => 'post_hide_categories', 'type' => 'checkbox',
971
  'info' => __('Hide the post categories wherever they are normally displayed.', 'weaver-xtreme' /*adm*/)),
972
- array('name' => '<small>' . __('Hide Post Tags', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => 'post_hide_tags', 'type' => 'checkbox',
973
  'info' => __('Hide the post tags wherever they are normally displayed.','weaver-xtreme' /*adm*/)),
974
- array('name' => '<small>' . __('Hide Permalink', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
975
  'id' => 'hide_permalink', 'type' => 'checkbox',
976
  'info' => __('Hide the permalink.', 'weaver-xtreme' /*adm*/)),
977
- array('name' => '<small>' . __('Hide Category if Only One', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
978
  'id' => 'hide_singleton_category', 'type' => 'checkbox',
979
  'info' => __('If there is only one overall category defined (Uncategorized), don\'t show Category of post.', 'weaver-xtreme' /*adm*/)),
980
- array('name' => '<small>' . __('Hide Author for Single Author Site', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
981
  'id' => 'post_hide_single_author', 'type' => 'checkbox',
982
  'info' => __('Hide author information if site has only a single author.', 'weaver-xtreme' /*adm*/)),
983
 
@@ -987,8 +964,7 @@ array('name' => __('Post Layout', 'weaver-xtreme' /*adm*/), 'icon' => '-schedule
987
  array( 'type' => 'submit'),
988
 
989
 
990
- array('name' => __('Featured Image - Posts', 'weaver-xtreme' /*adm*/), 'icon' => '-id',
991
- 'id' => 'h-fi-posts', 'type' => 'subheader_alt',
992
  'info' => __('Display of Post Featured Images', 'weaver-xtreme' /*adm*/)),
993
 
994
  array('name' => '<span class="i-left" style=font-size:120%;">&nbsp;&#10538;</span>' . __('FI Location - Full Post', 'weaver-xtreme' /*adm*/),
@@ -999,7 +975,7 @@ array('name' => __('Post Layout', 'weaver-xtreme' /*adm*/), 'icon' => '-schedule
999
  'info' => __('Featured Image alignment','weaver-xtreme' /*adm*/)),
1000
 
1001
 
1002
- array('name' => '<small>' . __('Hide FI - Full Posts', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
1003
  'id' => 'post_full_fi_hide', 'type' => 'select_hide',
1004
  'info' => __('Hide Featured Images on full blog posts.', 'weaver-xtreme' /*adm*/)),
1005
  array ('name' => '<small>' . __('FI Size - Full Posts', 'weaver-xtreme' /*adm*/) . '</small>',
@@ -1024,7 +1000,7 @@ array('name' => __('Post Layout', 'weaver-xtreme' /*adm*/), 'icon' => '-schedule
1024
  'id' => 'post_excerpt_fi_align', 'type' => 'fi_align',
1025
  'info' => __('How to align the Featured Image', 'weaver-xtreme' /*adm*/)),
1026
 
1027
- array('name' => '<small>' . __('Hide FI - Excerpts', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
1028
  'id' => 'post_excerpt_fi_hide', 'type' => 'select_hide',
1029
  'info' => __('Where to hide Featured Images on full blog posts.', 'weaver-xtreme' /*adm*/)),
1030
  array ('name' => '<small>FI Size - Excerpts</small>',
@@ -1048,7 +1024,7 @@ array('name' => __('Post Layout', 'weaver-xtreme' /*adm*/), 'icon' => '-schedule
1048
  'id' => 'post_fi_align', 'type' => 'fi_align',
1049
  'info' => __('How to align the Featured Image on Single Page View.', 'weaver-xtreme' /*adm*/)),
1050
 
1051
- array('name' => '<small>' . __('Hide FI - Single Page', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
1052
  'id' => 'post_fi_hide', 'type' => 'select_hide',
1053
  'info' => __('Where to hide Featured Images on single page view.', 'weaver-xtreme' /*adm*/)),
1054
  array ('name' => '<small>' . __('FI Size - Single Posts', 'weaver-xtreme' /*adm*/) . '</small>',
@@ -1069,15 +1045,14 @@ array('name' => __('Post Layout', 'weaver-xtreme' /*adm*/), 'icon' => '-schedule
1069
  array( 'type' => 'submit'),
1070
 
1071
 
1072
- array('name' => __('More Post Related Options', 'weaver-xtreme' /*adm*/), 'icon' => '-forms',
1073
- 'id' => 'h-post-rel', 'type' => 'subheader_alt',
1074
  'info' => __('Other options related to post display, including single pages.', 'weaver-xtreme' /*adm*/)),
1075
- array('name' => '<small>' . __('Show <em>Comments are closed.</em>', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
1076
  'id' => 'show_comments_closed', 'type' => 'checkbox',
1077
  'info' => __('If comments are off, and no comments have been made, show the <em>Comments are closed.</em> message.', 'weaver-xtreme' /*adm*/) ),
1078
  array('name' => __('Author Info BG', 'weaver-xtreme' /*adm*/), 'id' => 'post_author_bgcolor', 'type' => 'ctext',
1079
  'info' => __('Background color used for Author Bio.', 'weaver-xtreme' /*adm*/)),
1080
- array('name' => '<small>' . __('Hide Author Bio', 'weaver-xtreme' /*adm*/) . '</small>', 'icon' => '-visibility',
1081
  'id' => 'hide_author_bio', 'type' => 'checkbox',
1082
  'info' => __('Hide display of author bio box on Author Archive and Single Post page views.', 'weaver-xtreme' /*adm*/)),
1083
  array('name' => '<small>' . __('Allow comments for attachments', 'weaver-xtreme' /*adm*/) . '</small>',
@@ -1127,8 +1102,7 @@ function weaverx_mainopts_footer() {
1127
  $opts = array(
1128
  array( 'type' => 'submit'),
1129
 
1130
- array('name' => __('Footer Options', 'weaver-xtreme' /*adm*/), 'icon' => '-admin-generic',
1131
- 'id' => 'h-footer-opts', 'type' => 'header',
1132
  'info' => __('Settings for the footer', 'weaver-xtreme' /*adm*/),
1133
  'help' => 'help.html#FooterOpt'),
1134
 
@@ -1196,8 +1170,7 @@ Use <span class="style4">&amp;nbsp;</span> to hide the copyright notice. &diams;
1196
  function weaverx_mainopts_widgets() {
1197
  $opts = array(
1198
  array( 'type' => 'submit'),
1199
- array('name' => __('Sidebar Options', 'weaver-xtreme' /*adm*/), 'icon' => '-screenoptions',
1200
- 'id' => 'h-sidebar-opts', 'type' => 'header',
1201
  'info' => __('Settings affecting main Sidebars and individual widgets', 'weaver-xtreme' /*adm*/),
1202
  'help' => 'help.html#WidgetAreas'),
1203
 
@@ -1265,8 +1238,7 @@ They can be included on individual pages by adding the name you define here to t
1265
  // ======================== Main Options > Layout ========================
1266
  function weaverx_mainopts_layout() {
1267
  $opts = array( array( 'type' => 'submit'),
1268
- array('name' => __('Sidebar Layout', 'weaver-xtreme' /*adm*/), 'icon' => '-welcome-widgets-menus',
1269
- 'id' => 'h-sb-layout', 'type' => 'header',
1270
  'info' => __('Sidebar Layout for each type of page ("stack top" used for mobile view)', 'weaver-xtreme' /*adm*/),
1271
  'help' => 'help.html#layout'),
1272
 
84
 
85
  $opts = array(
86
  array( 'type' => 'submit'),
87
+ array('name' => __('Wrapping Areas', 'weaver-xtreme' /*adm*/), 'id' => '-admin-generic', 'type' => 'header',
 
88
  'info' => __('Settings for wrapping areas','weaver-xtreme' /*adm*/),
89
  'help' => 'help.html#GenApp'),
90
  array('name' => __('GLOBAL SETTINGS', 'weaver-xtreme' /*adm*/), 'type' => 'note',
139
  function weaverx_mainopts_custom() {
140
  $opts = array(
141
  array( 'type' => 'submit'),
142
+ array('name' => __('Custom Options', 'weaver-xtreme' /*adm*/), 'id' => '-admin-generic', 'type' => 'header',
 
143
  'info' => __('Set various global custom values.', 'weaver-xtreme' /*adm*/),
144
  'help' => 'help.html#Custom'),
145
 
146
+ array('name' => __('Various Custom Values', 'weaver-xtreme' /*adm*/), 'id' => '-admin-settings', 'type' => 'subheader',
 
147
  'info' => __('Adjust various global settings', 'weaver-xtreme' /*adm*/)),
148
 
149
+ array('name' => '<span class="i-left dashicons dashicons-align-none"></span>' . __('Smart Margin Width', 'weaver-xtreme' /*adm*/),
 
150
  'id' => 'smart_margin_int', 'type' => '+val_percent',
151
  'info' => __('Width used for smart column margins for Sidebars and Content Area. (Default: 1%) (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
152
 
154
  'info' => __('Global color of borders. (Default: #222)', 'weaver-xtreme' /*adm*/)),
155
  array('name' => '<small>' . __('Border Width', 'weaver-xtreme' /*adm*/) . '</small>' , 'id' => 'border_width_int', 'type' => 'val_px',
156
  'info' => __('Global Width of borders. (Default: 1px)', 'weaver-xtreme' /*adm*/)),
157
+ array('name' => '<span class="i-left" style="font-size:200%;margin-left:4px;">&#x25a1;</span><small>' . __('Border Style', 'weaver-xtreme' /*adm*/) . '</small>',
 
158
  'id' => 'border_style', 'type' => '+select_id',
159
  'info' => __('Style of borders - width needs to be > 1 for some styles to work correctly (&starf;Plus)', 'weaver-xtreme' /*adm*/),
160
  'value' => array(
186
  array( 'type' => 'submit'),
187
 
188
 
189
+ array('name' => __('Fonts', 'weaver-xtreme' /*adm*/), 'id' => '-editor-textcolor', 'type' => 'header',
 
190
  'info' => __('Font Base Sizes', 'weaver-xtreme' /*adm*/),
191
  'help' => 'font-demo.html'
192
  ),
231
  function weaverx_mainopts_header() {
232
  $opts = array(
233
  array( 'type' => 'submit'),
234
+ array('name' => __('Header Options', 'weaver-xtreme' /*adm*/), 'id' => '-admin-generic', 'type' => 'header',
 
235
  'info' => __('Options affecting site Header', 'weaver-xtreme' /*adm*/),
236
  'help' => 'help.html#HeaderOpt'),
237
 
239
  array('name' => __('Header Area', 'weaver-xtreme' /*adm*/), 'id' => 'header', 'type' => 'widget_area',
240
  'info' => __('Wraps the Header Area: menu bars, standard header image, title, tagline, header widget area', 'weaver-xtreme' /*adm*/)),
241
 
242
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span>' . __('Hide Search on Header', 'weaver-xtreme' /*adm*/),
 
243
  'id' => 'header_search_hide', 'type' => 'select_hide',
244
  'info' => __('Selectively hide the Search Box Button on top right of header', 'weaver-xtreme' /*adm*/)),
245
  array('name' => '<small>' . __('Search Area Options:', 'weaver-xtreme' /*adm*/) . '</small>', 'type' => 'note',
247
 
248
  array( 'type' => 'submit'),
249
 
250
+ array('name' => __('Header Image', 'weaver-xtreme' /*adm*/), 'id' => '-format-image', 'type' =>'subheader',
 
251
  'info' => __('Settings related to standard header image (Set on Appearance&rarr;Header)', 'weaver-xtreme' /*adm*/)),
252
 
253
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span>' . __('Hide Header Image', 'weaver-xtreme' /*adm*/),
 
254
  'id' => 'hide_header_image', 'type' => 'select_hide',
255
  'info' => __('Check to selectively hide standard header image', 'weaver-xtreme' /*adm*/)),
256
 
264
 
265
  array('name' => '<small>' . __('Use Actual Image Size', 'weaver-xtreme' /*adm*/) . '</small>',
266
  'id' => 'header_actual_size', 'type' => '+checkbox',
267
+ 'info' => __('Check to use actual header image size. (Default: theme width) (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
268
 
269
+ array('name' => '<span class="i-left dashicons dashicons-editor-alignleft"></span><small>' . __('Align Header Image', 'weaver-xtreme' /*adm*/) . '</small>',
270
  'id' => 'header_image_align', 'type' => '+align',
271
  'info' => __('How to align header image - meaningful only when Max Width or Actual Size set. (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
272
 
273
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Header Image Front Page', 'weaver-xtreme' /*adm*/) . '</small>',
274
  'id' => 'hide_header_image_front', 'type' => 'checkbox',
275
  'info' => __('Check to hide display of standard header image on front page only.', 'weaver-xtreme' /*adm*/)),
276
 
288
  array( 'type' => 'submit'),
289
 
290
 
291
+ array('name' => __('Site Title/Tagline', 'weaver-xtreme' /*adm*/), 'id' => '-text', 'type' =>'subheader',
 
292
  'info' => __('Settings related to the Site Title and Tagline (Tagline sometimes called Site Description)', 'weaver-xtreme' /*adm*/)),
293
 
294
 
302
  array('name' => '<span class="i-left" style="font-size:150%;">&harr;</span><small>' . __('Title Max Width', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => 'site_title_max_w', 'type' => 'val_percent',
303
  'info' => __("Maximum width of title in header area (Default: 90%)", 'weaver-xtreme' /*adm*/)),
304
 
305
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Site Title', 'weaver-xtreme' /*adm*/) . '</small>',
306
  'id' => 'hide_site_title', 'type' => 'select_hide',
307
  'info' => __('Hide Site Title (Uses "display:none;" : SEO friendly.)', 'weaver-xtreme' /*adm*/)),
308
 
317
  'id' => 'tagline_max_w', 'type' => 'val_percent',
318
  'info' => __("Maximum width of Tagline in header area (Default: 90%)", 'weaver-xtreme' /*adm*/)),
319
 
320
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Site Tagline', 'weaver-xtreme' /*adm*/) . '</small>',
321
  'id' => 'hide_site_tagline', 'type' => 'select_hide',
322
  'info' => __('Hide Site Tagline (Uses "display:none;" : SEO friendly.)', 'weaver-xtreme' /*adm*/)),
323
 
324
  array('name' => __('Title/Tagline Area BG', 'weaver-xtreme' /*adm*/), 'id' => 'title_tagline_bgcolor', 'type' => 'ctext',
325
  'info' => __('BG Color for the Title, Tagline, Search, Logo/HTML and Mini-Menu area.', 'weaver-xtreme' /*adm*/)),
326
 
327
+ array('name' => '<span class="i-left dashicons dashicons-editor-code"></span><small>' . __('Site Logo/HTML', 'weaver-xtreme' /*adm*/) . '</small>',
328
  'id' => '_site_logo', 'type' => '+textarea',
329
  'info' => __('HTML for Site Title area. (example: &lt;img src="url" style="position:absolute;top:20px;left:20px;"&nbsp;/&gt; + Custom CSS: #site-logo{min-height:123px;} (&starf;Plus) (&diams;)', 'weaver-xtreme' /*adm*/)),
330
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Site Logo/HTML', 'weaver-xtreme' /*adm*/) . '</small>',
331
  'id' => '_hide_site_logo', 'type' => '+select_hide',
332
  'info' => __('Hide Site Logo/HTML by device (&starf;Plus) (&diams;)', 'weaver-xtreme' /*adm*/)),
333
 
344
  array( 'type' => 'submit'),
345
 
346
 
347
+ array('name' => __('The Header Mini-Menu', 'weaver-xtreme' /*adm*/), 'id' => '-menu', 'type' =>'subheader',
 
348
  'info' => __('Horizontal "Mini-Menu" displayed right-aligned of Site Tagline', 'weaver-xtreme' /*adm*/)),
349
  array('name' => __('Note:', 'weaver-xtreme' /*adm*/), 'type' => 'note',
350
  'info' => __('The Header Mini-Menu options are on the Menu Tab.', 'weaver-xtreme' /*adm*/)),
364
 
365
  array( 'type' => 'submit'),
366
 
367
+ array('name' => __('Header HTML', 'weaver-xtreme' /*adm*/), 'id' => 'header_html', 'type' => 'widget_area', __('Header Widget Area', 'weaver-xtreme' /*adm*/),
368
  'info' => __('Add arbitrary HTML to Header Area (in &lt;div id="header-html"&gt;)', 'weaver-xtreme' /*adm*/)),
369
 
370
 
400
  function weaverx_mainopts_menus() {
401
  $opts = array(
402
  array( 'type' => 'submit'),
403
+ array('name' => __('Menu &amp; Info Bars', 'weaver-xtreme' /*adm*/), 'id' => '-menu', 'type' => 'header',
 
404
  'info' => __('Options affecting site Menus and the Info Bar', 'weaver-xtreme' /*adm*/),
405
  'help' => 'help.html#MenuBar'),
406
 
444
  array( 'type' => 'submit'),
445
 
446
 
447
+ array('name' => __('Options: All Menus', 'weaver-xtreme' /*adm*/), 'id' => '-forms', 'type' => 'subheader_alt',
 
448
  'info' => __('Menu Bar enhancements and features', 'weaver-xtreme' /*adm*/)),
449
 
450
 
461
  array('name' => '<small>' . __('Do Not Highlight Ancestors', 'weaver-xtreme' /*adm*/) . '</small>',
462
  'id' => 'menubar_curpage_noancestors', 'type' => 'checkbox',
463
  'info' => __('Highlight Current Page only - do not also highlight ancestor items', 'weaver-xtreme' /*adm*/)),
464
+ array('name' => '<small>' . __('Retain Menu Bar Hover BG', 'weaver-xtreme' /*adm*/) . '</small>',
465
+ 'id' => 'm_retain_hover', 'type' => 'checkbox',
466
+ 'info' => __('Retain the menu bar hover BG color when sub-menus are opened.', 'weaver-xtreme' /*adm*/)),
467
+
468
+
469
+
470
  array( 'name' => '<small>' . __('Placeholder Hover Cursor', 'weaver-xtreme' /*adm*/) . '</small>',
471
  'id' => 'placeholder_cursor', 'type' => 'widetext',
472
  'info' => __('CSS cursor :hover attribute for placeholder menus (e.g., Custom Menus with URL==#).
475
 
476
  array( 'type' => 'submit'),
477
 
478
+ array('name' => __('Header Mini-Menu', 'weaver-xtreme' /*adm*/), 'id' => '-menu', 'type' =>'subheader_alt',
 
479
  'info' => __('Horizontal "Mini-Menu" displayed right-aligned of Site Tagline', 'weaver-xtreme' /*adm*/)),
480
 
481
 
485
  array('name' => '<small>' . __('Mini-Menu Hover', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => 'm_header_mini_hover_color', 'type' => 'ctext',
486
  'info' => __('Hover Color for Mini-Menu Links', 'weaver-xtreme' /*adm*/)),
487
 
488
+ array('name' => '<span class="i-left dashicons dashicons-align-none"></span><small>' . __('Mini Menu Top Margin', 'weaver-xtreme' /*adm*/) . '</small>',
489
  'id' => 'm_header_mini_top_margin_dec', 'type' => 'val_em',
490
  'info' => __('Top margin for Mini-Menu. Negative value moves it up. (Default: -1.0em)', 'weaver-xtreme' /*adm*/)),
491
 
492
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Mini Menu', 'weaver-xtreme' /*adm*/) . '</small>',
493
  'id' => 'm_header_mini_hide', 'type' => 'select_hide',
494
  'info' => __('Hide Mini Menu', 'weaver-xtreme' /*adm*/)),
495
 
544
  function weaverx_mainopts_content() {
545
  $opts = array(
546
  array( 'type' => 'submit'),
547
+ array('name' => __('Content Areas', 'weaver-xtreme' /*adm*/), 'id' => '-admin-page', 'type' => 'header',
 
548
  'info' => __('Settings for the content areas (posts and pages)', 'weaver-xtreme' /*adm*/),
549
  'toggle' => 'content-areas',
550
  'help' => 'help.html#ContentAreas'),
559
  array('name' => '<small>' . __('Space Between Title and Content', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => 'space_after_title_dec', 'type' => 'val_em',
560
  'info' => __('Space between Page or Post title and beginning of content (Default: 1.0em)', 'weaver-xtreme' /*adm*/)),
561
 
562
+ array('name' => __('Archive Pages Title Text', 'weaver-xtreme' /*adm*/), 'id' => 'archive_title', 'type' => 'titles',
563
  'info' => __('Archive-like page titles: archives, categories, tags, searches.', 'weaver-xtreme' /*adm*/)),
564
 
565
  array('name' => __('Content Links', 'weaver-xtreme' /*adm*/), 'id' => 'contentlink', 'type' => 'link',
570
 
571
  array( 'type' => 'submit'),
572
 
573
+ array('name' => __('Text', 'weaver-xtreme' /*adm*/), 'id' => '-text', 'type'=>'subheader_alt',
 
574
  'info' => __('Text related options', 'weaver-xtreme' /*adm*/)),
575
 
576
  array('name' => '<small>' . __('Space after paragraphs and lists', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => 'content_p_list_dec', 'type' => 'val_em',
597
  ),
598
 
599
 
600
+ array('name' => __('Search Boxes', 'weaver-xtreme' /*adm*/), 'id' => '-search', 'type'=>'subheader_alt',
 
601
  'info' => __('Search box related options', 'weaver-xtreme' /*adm*/)),
602
 
603
  array('name' => '<small>' . __('Search Input BG', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => 'search_bgcolor', 'type' => 'ctext',
624
 
625
 
626
  array( 'type' => 'submit'),
627
+ array('name' => __('Images', 'weaver-xtreme' /*adm*/), 'id' => '-format-image', 'type'=>'subheader_alt',
 
628
  'info' => __('Image related options', 'weaver-xtreme' /*adm*/)),
629
  array('name' => '<small>' . __('Image Border Color', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => 'media_lib_border_color', 'type' => 'ctext',
630
  'info' => __('Border color for images in Container and Footer.', 'weaver-xtreme' /*adm*/)),
642
  array('name' => '<small>' . __('Caption text color', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => 'caption_color', 'type' => 'ctext',
643
  'info' => __('Color of captions - e.g., below media images.', 'weaver-xtreme' /*adm*/)),
644
 
645
+ array('name' => __('Featured Image - Pages', 'weaver-xtreme' /*adm*/), 'id' => '-id', 'type'=>'subheader_alt',
 
646
  'info' => __('Display of Page Featured Images', 'weaver-xtreme' /*adm*/)),
647
  array('name' => '<span class="i-left" style=font-size:120%;">&nbsp;&#10538;</span>' . __('Featured Image Location', 'weaver-xtreme' /*adm*/),
648
  'id' => 'page_fi_location', 'type' => 'fi_location',
650
  array('name' => '<span class="i-left dashicons dashicons-editor-alignleft"></span><small>' . __('Featured Image Alignment<small>', 'weaver-xtreme' /*adm*/), 'id' => 'page_fi_align', 'type' => 'fi_align',
651
  'info' => __('How to align the Featured Image', 'weaver-xtreme' /*adm*/)),
652
 
653
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Featured Image on Pages', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => 'page_fi_hide', 'type' => 'select_hide',
 
654
  'info' => __('Where to hide Featured Images on Pages (Posts have their own setting.)', 'weaver-xtreme' /*adm*/)),
655
 
656
  array ('name' => '<small>' . __('Page Featured Image Size', 'weaver-xtreme' /*adm*/) . '</small>',
666
  'id' => 'page_fi_width', 'type' => '+val_percent',
667
  'info' => __('Width of Featured Image on Pages. Max Width in %, overrides FI Size selection. (&starf;Plus)', 'weaver-xtreme' /*adm*/) ),
668
 
669
+ array('name' => __('Lists - &lt;HR&gt; - Tables', 'weaver-xtreme' /*adm*/), 'id' => '-list-view', 'type'=>'subheader_alt',
 
670
  'info' => __('Other options related to content', 'weaver-xtreme' /*adm*/)),
671
  array ('name' => __('Content List Bullet', 'weaver-xtreme' /*adm*/),
672
  'id' => 'contentlist_bullet', 'type' => 'select_id',
692
  array('val' => 'plain', 'desc' => __('Minimal', 'weaver-xtreme' /*adm*/)))
693
  ),
694
 
695
+ array('name' => __('Comments', 'weaver-xtreme' /*adm*/), 'id' => '-admin-comments', 'type' => 'subheader',
 
696
  'info' => __('Settings for displaying comments', 'weaver-xtreme' /*adm*/)),
697
  array('name' => __('Comment Headings', 'weaver-xtreme' /*adm*/), 'id' => 'comment_headings_color', 'type' => 'ctext',
698
  'info' => __('Color for various headings in comment form', 'weaver-xtreme' /*adm*/)),
704
  'id' => 'show_comment_borders', 'type' => 'checkbox',
705
  'info' => __('Show Borders around comment sections - improves visual look of comments.', 'weaver-xtreme' /*adm*/)),
706
 
707
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Old Comments When Closed', 'weaver-xtreme' /*adm*/) . '</small>',
708
  'id' => 'hide_old_comments', 'type' => '+checkbox',
709
  'info' => __('Hide previous comments after closing comments for page or post. (Default: show old comments after closing.) (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
710
  array('name' => '<span class="i-left dashicons dashicons-visibility"></span>'. '<small>' . __('Show Allowed HTML', 'weaver-xtreme' /*adm*/) . '</small>',
714
  '<small>' . __('Hide Comment Title Icon', 'weaver-xtreme' /*adm*/) . '</small>',
715
  'id' => 'hide_comment_bubble', 'type' => '+checkbox',
716
  'info' => __('Hide the comment icon before the Comments title (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
717
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Separator Above Comments', 'weaver-xtreme' /*adm*/) . '</small>',
718
  'id' => 'hide_comment_hr', 'type' => '+checkbox',
719
  'info' => __('Hide the (&lt;hr&gt;) separator line above the Comments area (&starf;Plus)', 'weaver-xtreme' /*adm*/))
720
  );
753
  function weaverx_mainopts_posts() {
754
  $opts = array(
755
  array( 'type' => 'submit'),
756
+ array('name' => __('Post Specifics', 'weaver-xtreme' /*adm*/), 'id' => '-admin-post', 'type' => 'header',
 
757
  'info' => __('Settings affecting Posts', 'weaver-xtreme' /*adm*/),
758
  'help' => 'help.html#PPSpecifics'),
759
 
770
  array( 'type' => 'submit'),
771
 
772
 
773
+ array('name' => __('Post Title', 'weaver-xtreme' /*adm*/), 'id' => '-text', 'type' => 'subheader_alt',
 
774
  'info' => __('Options for the Post Title', 'weaver-xtreme' /*adm*/)),
775
 
776
  array('name' => __('Post Title', 'weaver-xtreme' /*adm*/), 'id' => 'post_title', 'type' => 'titles',
790
  'id' => 'show_post_bubble', 'type' => 'checkbox',
791
  'info' => __("Show comment bubble with link to comments on the post info line", 'weaver-xtreme' /*adm*/)),
792
 
793
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide <em>Post Format</em> Icons', 'weaver-xtreme' /*adm*/) . '</small>',
794
  'id' => 'hide_post_format_icon', 'type' => '+checkbox',
795
  'info' => __('Hide the icons for posts with Post Format specified. (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
796
 
797
 
798
 
799
 
800
+ array('name' => __('Post Layout', 'weaver-xtreme' /*adm*/), 'id' => '-schedule', 'type' => 'subheader_alt',
 
801
  'info' => __('Layout of Posts', 'weaver-xtreme' /*adm*/)),
802
 
803
  array('name' => '<span class="i-left" style=font-size:120%;">&nbsp;&#9783;</span>' . __('Columns of Posts', 'weaver-xtreme' /*adm*/), 'id' => 'blog_cols', 'type' => 'select_id', //code
837
 
838
  array( 'type' => 'submit'),
839
 
840
+ array('name' => __('Excerpts / Full Posts', 'weaver-xtreme' /*adm*/), 'id' => '-exerpt-view', 'type' => 'subheader_alt',
 
841
  'info' => __('How to display posts in Blog / Archive Views', 'weaver-xtreme' /*adm*/)),
842
  array('name' => __('Show Full Blog Posts', 'weaver-xtreme' /*adm*/), 'id' => 'fullpost_blog', 'type' => 'checkbox',
843
  'info' => __('Will display full blog post instead of excerpts on <em>blog pages</em>.', 'weaver-xtreme' /*adm*/)),
857
 
858
 
859
 
860
+ array('name' => __('Post Navigation', 'weaver-xtreme' /*adm*/), 'id' => '-leftright', 'type' => 'subheader_alt',
 
861
  'info' => __('Navigation for moving between posts', 'weaver-xtreme' /*adm*/)),
862
  array('name' => __('Blog Navigation Style', 'weaver-xtreme' /*adm*/), 'id' => 'nav_style', 'type' => 'select_id',
863
  'info' => __('Style of navigation links on blog pages: "Older/Newer posts", "Previous/Next Post", or by page numbers', 'weaver-xtreme' /*adm*/),
867
  array('val' => 'paged_left', 'desc' => __('Paged - Left', 'weaver-xtreme' /*adm*/)),
868
  array('val' => 'paged_right', 'desc' => __('Paged - Right', 'weaver-xtreme' /*adm*/)))
869
  ),
870
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Top Links', 'weaver-xtreme' /*adm*/) . '</small>',
871
  'id' => 'nav_hide_above', 'type' => '+checkbox',
872
  'info' => __('Hide the blog navigation links at the top (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
873
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Bottom Links', 'weaver-xtreme' /*adm*/) . '</small>',
874
  'id' => 'nav_hide_below', 'type' => '+checkbox',
875
  'info' => __('Hide the blog navigation links at the bottom (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
876
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Show Top on First Page', 'weaver-xtreme' /*adm*/) . '</small>',
877
  'id' => 'nav_show_first', 'type' => '+checkbox',
878
  'info' => __('Show navigation at top even on the first page (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
879
 
886
  ),
887
  array('name' => '<small>' . __('Link to Same Categories', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => 'single_nav_link_cats', 'type' => '+checkbox',
888
  'info' => __('Single Page navigation links point to posts with same categories. (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
889
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Top Links', 'weaver-xtreme' /*adm*/) . '</small>',
890
  'id' => 'single_nav_hide_above', 'type' => '+checkbox',
891
  'info' => __('Hide the single page navigation links at the top (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
892
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Bottom Links', 'weaver-xtreme' /*adm*/) . '</small>',
893
  'id' => 'single_nav_hide_below', 'type' => '+checkbox',
894
  'info' => __('Hide the single page navigation links at the bottom (&starf;Plus)', 'weaver-xtreme' /*adm*/)),
895
 
896
  array( 'type' => 'submit'),
897
+ array('name' => __('Post Meta Info Areas', 'weaver-xtreme' /*adm*/), 'id' => '-info', 'type' => 'subheader_alt',
 
898
  'info' => __('Top and Bottom Post Meta Information areas', 'weaver-xtreme' /*adm*/)),
899
 
900
  array('name' => __('Top Post Info', 'weaver-xtreme' /*adm*/), 'id' => 'post_info_top', 'type' => 'titles_text',
901
  'info' => __("Top Post info line", 'weaver-xtreme' /*adm*/)),
902
 
903
 
904
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide top post info', 'weaver-xtreme' /*adm*/) . '</small>',
905
  'id' => 'post_info_hide_top', 'type' => 'checkbox', //code
906
  'info' => __('Hide entire top info line (posted on, by) of post.','weaver-xtreme' /*adm*/)),
907
 
908
  array('name' => __('Bottom Post Info', 'weaver-xtreme' /*adm*/), 'id' => 'post_info_bottom', 'type' => 'titles_text',
909
  'info' => __('The bottom post info line', 'weaver-xtreme' /*adm*/)),
910
 
911
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide bottom post info', 'weaver-xtreme' /*adm*/) . '</small>',
912
  'id' => 'post_info_hide_bottom', 'type' => 'checkbox', //code
913
  'info' => __('Hide entire bottom info line (posted in, comments) of post.', 'weaver-xtreme' /*adm*/)),
914
 
937
 
938
  array('name' => '<span style="color:red">' . __('Note:', 'weaver-xtreme' /*adm*/) . '</span>',
939
  'type' => 'note', 'info' => __('Hiding any meta info item automatically uses Icons instead of text descriptions.', 'weaver-xtreme' /*adm*/)),
940
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Post Date', 'weaver-xtreme' /*adm*/) . '</small>',
941
  'id' => 'post_hide_date', 'type' => 'checkbox',
942
  'info' => __('Hide the post date everywhere it is normally displayed.', 'weaver-xtreme' /*adm*/)),
943
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Post Author', 'weaver-xtreme' /*adm*/) . '</small>',
944
  'id' => 'post_hide_author', 'type' => 'checkbox',
945
  'info' => __('Hide the post author everywhere it is normally displayed.', 'weaver-xtreme' /*adm*/)),
946
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Post Categories', 'weaver-xtreme' /*adm*/) . '</small>',
947
  'id' => 'post_hide_categories', 'type' => 'checkbox',
948
  'info' => __('Hide the post categories wherever they are normally displayed.', 'weaver-xtreme' /*adm*/)),
949
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Post Tags', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => 'post_hide_tags', 'type' => 'checkbox',
950
  'info' => __('Hide the post tags wherever they are normally displayed.','weaver-xtreme' /*adm*/)),
951
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Permalink', 'weaver-xtreme' /*adm*/) . '</small>',
952
  'id' => 'hide_permalink', 'type' => 'checkbox',
953
  'info' => __('Hide the permalink.', 'weaver-xtreme' /*adm*/)),
954
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Category if Only One', 'weaver-xtreme' /*adm*/) . '</small>',
955
  'id' => 'hide_singleton_category', 'type' => 'checkbox',
956
  'info' => __('If there is only one overall category defined (Uncategorized), don\'t show Category of post.', 'weaver-xtreme' /*adm*/)),
957
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Author for Single Author Site', 'weaver-xtreme' /*adm*/) . '</small>',
958
  'id' => 'post_hide_single_author', 'type' => 'checkbox',
959
  'info' => __('Hide author information if site has only a single author.', 'weaver-xtreme' /*adm*/)),
960
 
964
  array( 'type' => 'submit'),
965
 
966
 
967
+ array('name' => __('Featured Image - Posts', 'weaver-xtreme' /*adm*/), 'id' => '-id', 'type' => 'subheader_alt',
 
968
  'info' => __('Display of Post Featured Images', 'weaver-xtreme' /*adm*/)),
969
 
970
  array('name' => '<span class="i-left" style=font-size:120%;">&nbsp;&#10538;</span>' . __('FI Location - Full Post', 'weaver-xtreme' /*adm*/),
975
  'info' => __('Featured Image alignment','weaver-xtreme' /*adm*/)),
976
 
977
 
978
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide FI - Full Posts', 'weaver-xtreme' /*adm*/) . '</small>',
979
  'id' => 'post_full_fi_hide', 'type' => 'select_hide',
980
  'info' => __('Hide Featured Images on full blog posts.', 'weaver-xtreme' /*adm*/)),
981
  array ('name' => '<small>' . __('FI Size - Full Posts', 'weaver-xtreme' /*adm*/) . '</small>',
1000
  'id' => 'post_excerpt_fi_align', 'type' => 'fi_align',
1001
  'info' => __('How to align the Featured Image', 'weaver-xtreme' /*adm*/)),
1002
 
1003
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide FI - Excerpts', 'weaver-xtreme' /*adm*/) . '</small>',
1004
  'id' => 'post_excerpt_fi_hide', 'type' => 'select_hide',
1005
  'info' => __('Where to hide Featured Images on full blog posts.', 'weaver-xtreme' /*adm*/)),
1006
  array ('name' => '<small>FI Size - Excerpts</small>',
1024
  'id' => 'post_fi_align', 'type' => 'fi_align',
1025
  'info' => __('How to align the Featured Image on Single Page View.', 'weaver-xtreme' /*adm*/)),
1026
 
1027
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide FI - Single Page', 'weaver-xtreme' /*adm*/) . '</small>',
1028
  'id' => 'post_fi_hide', 'type' => 'select_hide',
1029
  'info' => __('Where to hide Featured Images on single page view.', 'weaver-xtreme' /*adm*/)),
1030
  array ('name' => '<small>' . __('FI Size - Single Posts', 'weaver-xtreme' /*adm*/) . '</small>',
1045
  array( 'type' => 'submit'),
1046
 
1047
 
1048
+ array('name' => __('More Post Related Options', 'weaver-xtreme' /*adm*/), 'id' => '-forms', 'type' => 'subheader_alt',
 
1049
  'info' => __('Other options related to post display, including single pages.', 'weaver-xtreme' /*adm*/)),
1050
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Show <em>Comments are closed.</em>', 'weaver-xtreme' /*adm*/) . '</small>',
1051
  'id' => 'show_comments_closed', 'type' => 'checkbox',
1052
  'info' => __('If comments are off, and no comments have been made, show the <em>Comments are closed.</em> message.', 'weaver-xtreme' /*adm*/) ),
1053
  array('name' => __('Author Info BG', 'weaver-xtreme' /*adm*/), 'id' => 'post_author_bgcolor', 'type' => 'ctext',
1054
  'info' => __('Background color used for Author Bio.', 'weaver-xtreme' /*adm*/)),
1055
+ array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Author Bio', 'weaver-xtreme' /*adm*/) . '</small>',
1056
  'id' => 'hide_author_bio', 'type' => 'checkbox',
1057
  'info' => __('Hide display of author bio box on Author Archive and Single Post page views.', 'weaver-xtreme' /*adm*/)),
1058
  array('name' => '<small>' . __('Allow comments for attachments', 'weaver-xtreme' /*adm*/) . '</small>',
1102
  $opts = array(
1103
  array( 'type' => 'submit'),
1104
 
1105
+ array('name' => __('Footer Options', 'weaver-xtreme' /*adm*/), 'id' => '-admin-generic', 'type' => 'header',
 
1106
  'info' => __('Settings for the footer', 'weaver-xtreme' /*adm*/),
1107
  'help' => 'help.html#FooterOpt'),
1108
 
1170
  function weaverx_mainopts_widgets() {
1171
  $opts = array(
1172
  array( 'type' => 'submit'),
1173
+ array('name' => __('Sidebar Options', 'weaver-xtreme' /*adm*/), 'id' => '-screenoptions', 'type' => 'header',
 
1174
  'info' => __('Settings affecting main Sidebars and individual widgets', 'weaver-xtreme' /*adm*/),
1175
  'help' => 'help.html#WidgetAreas'),
1176
 
1238
  // ======================== Main Options > Layout ========================
1239
  function weaverx_mainopts_layout() {
1240
  $opts = array( array( 'type' => 'submit'),
1241
+ array('name' => __('Sidebar Layout', 'weaver-xtreme' /*adm*/), 'id' => '-welcome-widgets-menus', 'type' => 'header',
 
1242
  'info' => __('Sidebar Layout for each type of page ("stack top" used for mobile view)', 'weaver-xtreme' /*adm*/),
1243
  'help' => 'help.html#layout'),
1244
 
admin/admin-page-posts.php DELETED
@@ -1,34 +0,0 @@
1
- <?php
2
- /* Display per page and per post options.
3
- *
4
- * __ added - 12/10/14
5
- */
6
-
7
- if ( !defined('ABSPATH')) exit; // Exit if accessed directly
8
- // Admin panel that gets added to the page edit page for per page options
9
-
10
- if ( ! ( function_exists( 'wvrx_ts_installed' ) ||
11
- function_exists( 'weaverxplus_plugin_installed' ) ) ) {
12
-
13
- add_action('admin_menu', 'weaverx_add_page_fields');
14
-
15
- function weaverx_add_page_fields() {
16
- add_meta_box('page-box', __('Weaver Xtreme Options For This Page (Per Page Options)', 'weaver-xtreme' /*adm*/),
17
- 'weaverx_page_extras', 'page', 'normal', 'high');
18
- add_meta_box('post-box', __('Weaver Xtreme Options For This Post (Per Post Options)', 'weaver-xtreme' /*adm*/),
19
- 'weaverx_page_extras', 'post', 'normal', 'high');
20
- }
21
-
22
- function weaverx_page_extras() {
23
- echo '<p>';
24
- _e('<em>Weaver Xtreme</em> supports a complete set of Per Page and Per Post options if you install either
25
- the <a href="https://wordpress.org/plugins/weaverx-theme-support/" target="_blank" alt="Weaver X Theme Support">
26
- Weaver X Theme Support</a> free plugin, or the <a href="//plus.weavertheme.com/" target="_blank" alt="Weaver Xtreme">
27
- Weaver Xtreme Plus</a> premium plugin.', 'weaver-xtreme' /*adm*/);
28
- echo '</p><p>';
29
- _e('These options include, among others, the ability to hide header images, titles, footers, as well as per page
30
- and per post widget area options. These options allow you to give special pages or posts highly customized layouts.', 'weaver-xtreme' /*adm*/);
31
- echo '</p>';
32
- }
33
- }
34
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/admin-plus.php DELETED
@@ -1,247 +0,0 @@
1
- <?php
2
- if ( !defined('ABSPATH')) exit; // Exit if accessed directly
3
- /* Weaver Xtreme - admin
4
- * __ added - 12/10/14
5
- */
6
-
7
- function weaverx_admin_pro() {
8
-
9
- weaverx_tab_title(__('Theme Add-ons','weaver-xtreme'), 'help.html#WeaverXPlus', __('Help for theme Add-ons', 'weaver-xtreme' /*adm*/));
10
-
11
- do_action('weaverx_show_licenses');
12
-
13
- if ( !function_exists('weaverxplus_plugin_installed') ) {
14
- ?>
15
- <h2 style="font-weight:bold;">
16
- <em><?php weaverx_site('','//plus.weavertheme.com/',__('Weaver Xtreme Plus', 'weaver-xtreme' /*adm*/)); ?>
17
- <?php _e('Weaver Xtreme Plus', 'weaver-xtreme' /*adm*/); ?></a></em>
18
- <?php _e('gives you more premium Weaver Xtreme features', 'weaver-xtreme' /*adm*/); ?>
19
- </h2>
20
- <div class="a-plus">
21
- <p>
22
- <?php _e('You can extend Weaver Xtreme\'s features by getting the premium <em>Weaver Xtreme Plus Plugin</em>.
23
- Weaver Xtreme Plus adds useful new options to the Weaver Xtreme admin tabs
24
- - many you\'ve probably already noticed mentioned on the existing option tabs.', 'weaver-xtreme' /*adm*/); ?>
25
- <p>
26
- <strong><em><?php _e('Premium features included with Weaver Xtreme Plus:', 'weaver-xtreme' /*adm*/); ?></em></strong>
27
- <ul>
28
- <li><?php _e('<strong>More Wrapping Areas Options</strong> - Specify background images for specific areas', 'weaver-xtreme' /*adm*/); ?></li>
29
- <li><?php _e('<strong>More Widget Options</strong> - Define custom multi-column widgets. Equalize multi-column widget height', 'weaver-xtreme' /*adm*/); ?></li>
30
- <li><?php _e('<strong>More Font Options</strong> - Easily add font families from hundreds of Google Fonts', 'weaver-xtreme' /*adm*/); ?></li>
31
- <li><?php _e('<strong>Add Extra Menus</strong> - Add extra menus to your site using the Weaver Xtreme Plus Extra Menu
32
- Widget, or the [extra_menu] shortcode', 'weaver-xtreme' /*adm*/);?></li>
33
- <li><?php _e('<strong>Additional Post Specifics Options</strong> - Define totally custom post top and bottom info lines', 'weaver-xtreme' /*adm*/); ?></li>
34
- <li><strong><?php _e('More &lt;HEAD&gt; Section Options</strong> - define custom PHP actions and filters for WordPress', 'weaver-xtreme' /*adm*/); ?></li>
35
- <li><strong><?php _e('Additional HTML Insertion Areas</strong> - Many HTML insertion area', 'weaver-xtreme' /*adm*/); ?></li>
36
- <li><strong><?php _e('More Per Page HTML Insertion Options</strong> - Define HTML insertions on per page basis', 'weaver-xtreme' /*adm*/); ?></li>
37
- </ul>
38
- </p>
39
- <p style="font-size:large;line-height:1.4em;">
40
- <strong><span style="color:blue; font-weight:bold;"><?php _e('Get Weaver Xtreme Plus Now!', 'weaver-xtreme' /*adm*/); ?></span></strong>
41
- <br />
42
- <span style="margin-left:20px;"></span><?php _e('Visit', 'weaver-xtreme' /*adm*/); ?> <?php weaverx_site('','//plus.weavertheme.com/','Weaver Xtreme Plus'); ?><?php _e('Plus.WeaverTheme.com<', 'weaver-xtreme' /*adm*/); ?>/a>
43
- <?php _e('now to get your copy of <em>Weaver Xtreme Plus</em>.', 'weaver-xtreme' /*adm*/); ?>
44
- </p>
45
- </div>
46
-
47
- <?php
48
- } else {
49
- // to here, have Plus features
50
-
51
- echo '<h2 style="font-weight:bold;">' . __('Weaver Xtreme Plus Features - <span style="font-size:small;">You are using Weaver Xtreme Plus. Thank you.</span>', 'weaver-xtreme' /*adm*/) . '</h2>' . "\n";
52
-
53
- do_action('weaverxplus_admin','weaverxplus_admin');
54
- }
55
- ?>
56
- <hr />
57
- <?php
58
-
59
- if (!function_exists('wvrx_ts_installed')) {
60
- ?>
61
- <h2 style="font-weight:bold;"><?php _e('Get the <em>free</em> Weaver Xtreme Theme Support Plugin!', 'weaver-xtreme' /*adm*/); ?></h2>
62
- <div class="a-plus">
63
- <p>
64
- <?php _e('The <em>Weaver Xtreme Theme Support</em> plugin provides a collection of useful shortcodes and widgets
65
- to make it even easier to customize your site.', 'weaver-xtreme' /*adm*/); ?>
66
- </p>
67
- <p><strong><?php _e('See ', 'weaver-xtreme' /*adm*/); ?><em>
68
- <?php weaverx_site('/plugins/weaverx-theme-plugins','','Weaver Xtreme Plugins'); ?><?php _e('Weaver Xtreme Plugins', 'weaver-xtreme' /*adm*/); ?></a></em> <?php _e('for complete details.', 'weaver-xtreme' /*adm*/); ?></strong></p>
69
- <p>
70
- <?php _e('Shortcodes and Widgets included:', 'weaver-xtreme' /*adm*/); ?>
71
- <ul>
72
- <li><strong><?php _e('[show|hide_if]</strong> - Show or hide content based on device, page/post ID, user role, or logged in status', 'weaver-xtreme' /*adm*/); ?></li>
73
- <li><strong><?php _e('[tab_group]</strong> - Add content to a tabbed box', 'weaver-xtreme' /*adm*/); ?></li>
74
- <li><?php _e('<strong>[youtube]</strong> - Show your YouTube videos responsively, and with the capability
75
- to use any of the YouTube custom display options', 'weaver-xtreme' /*adm*/); ?></li>
76
- <li><strong><?php _e('[vimeo]</strong> - Show your Vimeo videos responsively, and with the capability
77
- to use any of the Vimeo custom display options', 'weaver-xtreme' /*adm*/); ?></li>
78
- <li><?php _e('<strong>[iframe]</strong> - Quick and easy display of content in an iframe', 'weaver-xtreme' /*adm*/); ?></li>
79
- <li><?php _e('Plus more shortcodes', 'weaver-xtreme' /*adm*/); ?></li>
80
- <li><?php _e('Adds shortcode support to the standard Text Widget', 'weaver-xtreme' /*adm*/); ?></li>
81
- <li><?php _e('<strong>Weaver Xtreme 2 Column Text Widget</strong> - Add text into two columns in a widget', 'weaver-xtreme' /*adm*/); ?></li>
82
- <li><strong><?php _e('Weaver Xtreme Per Page Text Widget</strong> - Add a text widget on a per page basis', 'weaver-xtreme' /*adm*/); ?></li>
83
- </ul>
84
- </p>
85
- </div>
86
-
87
- <?php
88
- } else {
89
- do_action('weaverx_theme_support_addon');
90
- }
91
- }
92
-
93
- if (!function_exists('weaverxplus_plugin_installed')) {
94
- add_action('weaverxplus_admin','weaverxplus_admin_actions_free');
95
-
96
- function weaverxplus_admin_actions_free( $action ) {
97
-
98
- switch ($action) { // search code for list of actions supported by Weaver Xtreme Theme
99
-
100
- case 'fonts':
101
- weaverxplus_fonts();
102
- break;
103
-
104
- case 'footer_opts':
105
- weaverxplus_footeropts();
106
- break;
107
-
108
- case 'general_appearance':
109
- weaverxplus_genappearance();
110
- break;
111
-
112
- case 'header_opts':
113
- weaverxplus_mainopts_header();
114
- break;
115
-
116
- case 'head_section':
117
- weaverxplus_adv_head();
118
- break;
119
-
120
- case 'html_insertion':
121
- weaverxplus_html_insertion();
122
- break;
123
-
124
- case 'post_specifics':
125
- weaverxplus_post_spec();
126
- break;
127
-
128
- // cases with no Plus extensions
129
-
130
- case 'admin_options':
131
- case 'content_areas':
132
- case 'help':
133
- case 'layout':
134
- case 'links':
135
- case 'menu_bar':
136
- case 'mobile_opts':
137
- case 'process_options': // ignore submitted options
138
- case 'save_restore':
139
- case 'show_subthemes':
140
- case 'site_opts':
141
- case 'widget_areas':
142
- break;
143
-
144
-
145
- default:
146
- // echo '<h3 style="background-color:#afa;border:2px solid green;"><strong>Weaver Xtreme Plus Extra Admin: ' . $action . '</strong></h3>';
147
- break;
148
- }
149
-
150
- }
151
-
152
- function weaverxplus_intro($title) {
153
- echo '<h4 class="atw-option-subheader"><span style="color:black; padding:.2em;" class="dashicons dashicons-plus-alt"></span>' . $title .
154
- ' <span style="float:right;margin-right:4em;font-size:small;font-style:italic;"><a href="//plus.weavertheme.com/" target="_blank";>' . __('Get Weaver Xtreme Plus', 'weaver-xtreme' /*adm*/) . '</a></span></h4>'. "\n";
155
- }
156
-
157
- function weaverxplus_fonts() {
158
- weaverxplus_intro(__('Weaver Xtreme Plus Font Options', 'weaver-xtreme' /*adm*/));
159
- ?>
160
- <div class="a-plus">
161
- <p>
162
- <?php _e('<strong>Weaver Xtreme Plus</strong> makes adding new font easy.
163
- The Plus Font Control panel allows you to easily add fonts from Google Web Fonts, Font Squirrel,
164
- or virtually any other free or commercial font source directly to the <em>Font Family</em> text options.', 'weaver-xtreme' /*adm*/); ?>
165
- </p>
166
- </div> <br />
167
- <?php
168
- }
169
-
170
-
171
- function weaverxplus_footeropts() {
172
- }
173
-
174
- function weaverxplus_genappearance() {
175
- weaverxplus_intro('Weaver Xtreme Plus Wrapping Areas Options');
176
- ?>
177
- <a id="background-images"></a></a><div class="a-plus">
178
- <p>
179
- <?php _e('<strong>Weaver Xtreme Plus</strong> allows you to specify a background image for specific areas
180
- on your site, including a full screen site bg image, background images for the wrapper,
181
- header, container, content, sidebars and more. You easily pick any image from your
182
- Media Library to use as the background image.', 'weaver-xtreme' /*adm*/); ?>
183
- </p>
184
- </div>
185
-
186
- <?php
187
- }
188
-
189
- function weaverxplus_mainopts_header() {
190
-
191
- }
192
-
193
- function weaverxplus_adv_head() {
194
- weaverxplus_intro(__('Weaver Xtreme Plus &lt;HEAD&gt; Section Options', 'weaver-xtreme' /*adm*/));
195
- ?>
196
- <div class="a-plus">
197
- <p>
198
- <?php _e('For advanced users, <strong>Weaver Xtreme Plus</strong> allows you to write complete PHP functions
199
- that can define WordPress actions and filters used to format and control much of the content
200
- output of your theme. Much of what previously required defining a child theme can be
201
- done with the Actions and Filters feature of <strong>Weaver Xtreme Plus</strong>.', 'weaver-xtreme' /*adm*/); ?>
202
- </p>
203
- </div>
204
- <?php
205
- }
206
-
207
- function weaverxplus_html_insertion() {
208
- weaverxplus_intro('Weaver Xtreme Plus Additional HTML Insertion Areas');
209
- ?>
210
- <div class='a-plus'>
211
- <p>
212
- <?php _e('<strong>Weaver Xtreme Plus</strong> includes these additional HTML Insertions areas:', 'weaver-xtreme' /*adm*/); ?>
213
- <ul style="padding-left:4em;">
214
- <li><?php _e('Header Top Code', 'weaver-xtreme' /*adm*/); ?></li>
215
- <li><?php _e('Container Top', 'weaver-xtreme' /*adm*/); ?></li>
216
- <li><?php _e('Content Top', 'weaver-xtreme' /*adm*/); ?></li>
217
- <li><?php _e('Page Content Bottom', 'weaver-xtreme' /*adm*/); ?></li>
218
- <li><?php _e('Post-Post Content Code', 'weaver-xtreme' /*adm*/); ?></li>
219
- <li><?php _e('Pre-Comments Code', 'weaver-xtreme' /*adm*/); ?></li>
220
- <li><?php _e('Post-Comments Code', 'weaver-xtreme' /*adm*/); ?></li>
221
- <li><?php _e('Pre-Footer Code', 'weaver-xtreme' /*adm*/); ?></li>
222
- <li><?php _e('Pre-Sidebar', 'weaver-xtreme' /*adm*/); ?></li>
223
- <li><?php _e('Fixed Browser Top Area', 'weaver-xtreme' /*adm*/); ?></li>
224
- <li><?php _e('Fixed Browser Bottom Area', 'weaver-xtreme' /*adm*/); ?></li>
225
- </ul>
226
- </p>
227
- </div>
228
- <?php
229
- }
230
-
231
- //Header TopContainer TopContent TopPage Content BottomPost-Post ContentPre-CommentsPost-CommentsPre-FooterPre-Sidebar
232
- function weaverxplus_post_spec() {
233
- weaverxplus_intro( __('Weaver Xtreme Plus Additional Post Specifics Options', 'weaver-xtreme' /*adm*/));
234
- ?>
235
- <div class="a-plus">
236
- <p>
237
- <?php _e('<strong>Weaver Xtreme Plus</strong> includes the ability to define custom top and bottom post meta info lines.
238
- You can define any combination of labels, icons, and elements like categories, author, dates, and custom text
239
- to replace the default meta info lines.', 'weaver-xtreme' /*adm*/); ?>
240
- </p>
241
- </div>
242
- <br />
243
- <?php
244
- }
245
-
246
- } // end of Weaver Xtreme Free's Weaver Xtreme Plus plugs
247
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/admin-sapi-lib.php DELETED
@@ -1,351 +0,0 @@
1
- <?php
2
- /*
3
- This file includes the interface to the WP Settings API.
4
-
5
- Because the SAPI is quite limiting on the format of the output fields
6
- supported by add_settings_field, we will not use that part.
7
-
8
- Settings that need validation and nonce handling, we use our function weaverx_sapi_main_name() that
9
- generates the <input name="weaverx_main_settings[option_name]" ...> format required for
10
- processing by the sapi handlers. They create an array called $_POST['weaverx_main_settings']. Each
11
- setting in that array corresponds to a Weaver Xtreme option value, and will be passed to the
12
- validation function.
13
-
14
- We will wrap the main form (Main Options) with our functions
15
- weaverx_sapi_form_top() and weaverx_sapi_form_bottom() that generates required calls to sapi.
16
-
17
- All other forms will use submit buttons that include their own nonce definition. Other forms generally
18
- do not change individual settings, but take actions such as save/restore or setting a subtheme.
19
- */
20
-
21
- /*
22
- ================= nonce helpers =====================
23
- */
24
- function weaverx_submitted($submit_name) {
25
- // do a nonce check for each form submit button
26
- // pairs 1:1 with weaverx_nonce_field
27
- $nonce_act = $submit_name.'_act';
28
- $nonce_name = $submit_name.'_nonce';
29
-
30
- if (isset($_POST[$submit_name])) {
31
- if (isset($_POST[$nonce_name]) && wp_verify_nonce($_POST[$nonce_name],$nonce_act)) {
32
- return true;
33
- } else {
34
- die(__('WARNING: invalid form submit detected. Probably caused by session time-out, or, rarely, a failed security check. Please contact WeaverTheme.com if you continue to receive this message.', 'weaver-xtreme' /*adm*/) . '(' . $submit_name . ')');
35
- }
36
- } else {
37
- return false;
38
- }
39
- }
40
-
41
- function weaverx_nonce_field($submit_name,$echo = true) {
42
- // pairs 1:1 with sumbitted
43
- // will be one for each form submit button
44
-
45
- return wp_nonce_field($submit_name.'_act',$submit_name.'_nonce',$echo);
46
- }
47
-
48
-
49
- // # RUNTIME SAPI HELPER FUNCTIONS ============================================
50
-
51
- function weaverx_sapi_options_init() {
52
- /* this will initialize the SAPI stuff, must be called from the admin_init cb function .
53
- In reality, we really only need to register one setting - 'weaverx_main_settings_group',
54
- and the settings will be saved in the WP DB as 'weaverx_main_settings'. The SAPI uses
55
- the name param of any <input> fields to figure out where to store the input value.
56
-
57
- The validation will have to scan the ENTIRE list of options and lookup the kind of
58
- validation each parameter needs.
59
- */
60
-
61
- register_setting('weaverx_settings_group', /* the group name of our settings */
62
- apply_filters('weaverx_options','weaverx_settings'), /* the get_option name */
63
- 'weaverx_validate_cb'); /* a validation call back */
64
- }
65
-
66
- function weaverx_validate_cb($in) {
67
-
68
- return weaverx_validate_all_options($in);
69
- }
70
-
71
- /*
72
- ================= Main SAPI helper functions =================
73
- */
74
-
75
- function weaverx_sapi_form_top($group, $form_name='') {
76
- /* beginning of a form */
77
- $name = '';
78
- if ($form_name != '') $name = 'name="' . $form_name . '"';
79
-
80
- echo("<form action=\"options.php\" $name method=\"post\">\n"); /* <form action="options.php" method="post"> */
81
- settings_fields($group); // use our one set of settings
82
- }
83
-
84
- function weaverx_sapi_form_bottom($form_name='end of form') {
85
-
86
- $non_sapi = array( // non-sapi elements in the db
87
- 'weaverx_version_id', 'style_version',
88
- 'theme_filename', 'addon_name', '_hide_theme_thumbs', 'last_option'
89
- );
90
-
91
- /* The following code allows the SAPI to save the non-sapi values. If you don't do this here,
92
- then the values will be set to false, and be lost! SAPI is not tolerant of submitting a form
93
- that doesn't include EVERY setting for the form group. */
94
-
95
- foreach ($non_sapi as $name) {
96
- ?>
97
- <input name="<?php weaverx_sapi_main_name($name); ?>" id="<?php echo $name;?>" type="hidden" value="<?php echo weaverx_getopt($name); ?>" />
98
- <?php
99
- }
100
- weaverx_setopt('last_option','Weaver Xtreme'); // Safety check for limited PHP $_POST variables
101
- echo ("</form> <!-- $form_name -->\n");
102
- }
103
-
104
- function weaverx_sapi_submit( $before='', $after='', $show_more_opts = false ) {
105
- // generate a submit button for the form
106
- $submit_label = __('Save Settings', 'weaver-xtreme' /*adm*/);
107
- echo $before;
108
- ?>
109
- <span style="display:inline;"><input name="save_options" type="submit" style="margin-top:10px;" class="button-primary" value="<?php echo($submit_label); ?>" />
110
- <?php
111
- echo "</span>\n" . $after ;
112
-
113
- }
114
-
115
- function weaverx_form_submit($value) {
116
- weaverx_sapi_submit('</table>','<table style="margin-top:10px;">');
117
- }
118
-
119
- function weaverx_sapi_main_name($id, $echo=true) {
120
- /* generate the SAPI name for 'weaverx_settings' */
121
- $name = apply_filters('weaverx_options','weaverx_settings');
122
- if ($echo) echo $name. '[' . $id . ']';
123
- return $name . '[' . $id . ']';
124
- }
125
-
126
- /*
127
- ============== Validation =====================
128
- */
129
- function weaverx_validate_all_options($in) {
130
- /* validation for all options */
131
- $err_msg = ''; // no error message yet
132
-
133
- if (empty($in)) {
134
- wp_die( __( 'You attempted to save options, but something has gone wrong. Please be sure you are logged in and your host is correctly configured. See the "Weaver Doesn\'t Save Settings" FAQ on weavertheme.com.' ,'weaver-xtreme') );
135
- }
136
-
137
- if (!current_user_can('edit_theme_options')) {
138
- wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ,'weaver-xtreme') );
139
- }
140
-
141
- $wvr_last = '';
142
-
143
-
144
- foreach ($in as $key => $value) {
145
- switch ($key) {
146
-
147
- /* -------- integer -------- */
148
- case 'excerpt_length':
149
-
150
- if (!empty($value) && (!is_numeric($value) || !is_int((int)$value))) {
151
- $opt_id = str_replace('', '', $key);
152
- $opt_id = str_replace('_', ' ', $opt_id);
153
- $err_msg .= __('Option must be an integer value: ', 'weaver-xtreme' /*adm*/) . '"'. $opt_id . '" = "' . $value . '".'
154
- . __(' Value has been cleared to blank value', 'weaver-xtreme' /*adm*/) . '<br />';
155
- $in[$key] = '';
156
- }
157
- break;
158
-
159
- /* ---------- text ----------- */
160
- case 'excerpt_more_msg':
161
- case 'header_maxwidth':
162
-
163
- if (!empty($value))
164
- $in[$key] = weaverx_filter_textarea($value);
165
- break;
166
-
167
- case 'themename': // can't be empty!
168
- if (empty($value))
169
- $in[$key] = 'please-give-this-a-name';
170
- else
171
- $in[$key] = weaverx_filter_textarea($value);
172
- break;
173
-
174
-
175
- /* code */
176
- case 'copyright': // Alternate copyright
177
- case '_css_rows':
178
- if (!empty($value)) {
179
- $in[$key] = weaverx_filter_code($value);
180
- }
181
- break;
182
-
183
-
184
- case '_perpagewidgets': // Add widget areas for per page - names must be lower case
185
- if (!empty($value)) {
186
- $in[$key] = strtolower(str_ireplace(' ','',weaverx_filter_code($value)));
187
- }
188
- break;
189
-
190
- case '_althead_opts':
191
- case 'head_opts':
192
- if ( !empty( $value ) ) {
193
- $in[$key] = weaverx_filter_head( $value );
194
- }
195
- break;
196
-
197
- case 'wvrx_css_saved':
198
- if ( !empty( $value ) ) {
199
- $in[$key] = weaverx_filter_code( $value );
200
- //$in[$key] = wp_filter_post_kses( trim(stripslashes($value)) );
201
- }
202
- break;
203
-
204
-
205
- /* must not have <style .... </style> */
206
- case 'add_css': // Add CSS Rules to Weaver Xtreme's style rules
207
-
208
- if (!empty($value)) {
209
- $val = weaverx_filter_code($value);
210
- $in[$key] = $val;
211
- if (stripos($val,'<style') !== false || stripos($val, '</style') !== false ||
212
- stripos($val,'<script') !== false || stripos($val, '</script') !== false) {
213
- $err_msg .= __('&lt;style&gt; or &lt;script&gt; tags have been automatically stripped from your "Add CSS Rules"!', 'weaver-xtreme' /*adm*/)
214
- . ' ' . __('Please correct your entry.', 'weaver-xtreme' /*adm*/) . '<br />';
215
- $in[$key] = wp_filter_post_kses( trim(stripslashes($val)) );
216
- }
217
- }
218
- break;
219
-
220
- case '_fonts_google':
221
- $in[$key] = $value;
222
- break;
223
-
224
- case 'last_option': // check for last_option...
225
- if (!empty($value))
226
- $wvr_last = $value;
227
- break;
228
-
229
- default: /* to here, then colors, _css, or checkbox/selectors */
230
- $keylen = strlen($key);
231
-
232
- if (strrpos($key,'_css') == $keylen-4) { // all _css settings
233
- if (!empty($value)) {
234
- $val = weaverx_filter_code($value);
235
- if (stripos($val,'<style') !== false || stripos($val, '</style') !== false ||
236
- stripos($val,'<script') !== false || stripos($val, '</script') !== false) {
237
- $err_msg .= __('&lt;style&gt; or &lt;script&gt; tags have been automatically stripped from your CSS+ rules,', 'weaver-xtreme' /*adm*/)
238
- . ' ' . __('Please correct your entry.', 'weaver-xtreme' /*adm*/) . '<br />';
239
- $val = wp_filter_post_kses( trim($val) );
240
- }
241
-
242
- $in[$key] = $val;
243
-
244
- if (strpos($val, '{') === false || strpos($val, '}') === false) {
245
- $opt_id = str_replace('_css', '', $key); // kill _css
246
- $opt_id = str_replace('', '', $opt_id);
247
- $opt_id = str_replace('_', ' ', $opt_id);
248
- $err_msg .= __('CSS options must be enclosed in {}\'s: ', 'weaver-xtreme' /*adm*/) . '"'. $opt_id . '" = "' . $value . '". '
249
- . __('Please correct your entry.', 'weaver-xtreme' /*adm*/) . '<br />';
250
- }
251
- }
252
- break;
253
- } // _css
254
-
255
- if (strrpos($key,'_insert') == $keylen-7) { // all _insert settings
256
- if (!empty($value)) {
257
- $val = weaverx_filter_code($value);
258
- $in[$key] = $val;
259
- }
260
- break;
261
- } // _insert
262
-
263
- if (strrpos($key,'_url') == $keylen-4) { // all _url settings
264
- if (!empty($value)) {
265
- $val = weaverx_filter_code($value); // can't use esc_url because that forces a leading html{background-image: url(%template_directory%assets/images/addon_themes.png);}
266
- $in[$key] = $val;
267
- }
268
- break;
269
- } // _insert
270
-
271
- if (strrpos($key,'_dec') == $keylen-4) {
272
- if (!empty($value) && !is_numeric($value)) {
273
- $opt_id = str_replace('', '', $key);
274
- $opt_id = str_replace('_dec', '', $opt_id);
275
- $opt_id = str_replace('_', ' ', $opt_id);
276
- $err_msg .= __('Option must be a numeric value: ', 'weaver-xtreme' /*adm*/) . '"'. $opt_id . '" = "' . $value . '". '
277
- . __('Value has been cleared to blank value.', 'weaver-xtreme' /*adm*/) . '<br />';
278
- $in[$key] = '';
279
- }
280
- break;
281
- }
282
-
283
- if (strrpos($key,'_int') == $keylen-4 || // _int settings
284
- strrpos($key,'_X') == $keylen-2 ||
285
- strrpos($key,'_Y') == $keylen-2 ||
286
- strrpos($key,'_L') == $keylen-2 ||
287
- strrpos($key,'_R') == $keylen-2 ||
288
- strrpos($key,'_T') == $keylen-2 ||
289
- strrpos($key,'_B') == $keylen-2 ) {
290
- if (!empty($value) && (!is_numeric($value) || !is_int((int)$value))) {
291
- $opt_id = str_replace('', '', $key);
292
- $opt_id = str_replace('_int', '', $opt_id);
293
- $opt_id = str_replace('_', ' ', $opt_id);
294
- $err_msg .= __('Option must be a numeric value: ', 'weaver-xtreme' /*adm*/) . '"'. $opt_id . '" = "' . $value . '". '
295
- . __('Value has been cleared to blank value.', 'weaver-xtreme' /*adm*/) . '<br />';
296
- $in[$key] = '';
297
- }
298
- break;
299
- }
300
-
301
- if (strrpos($key,'color') == $keylen-5) { // _bgcolor and _color (order here important - after _css, etc.)
302
- if (!empty($value)) {
303
-
304
- $val = trim(weaverx_filter_code($value));
305
- if (preg_match('/^#?+[0-9a-f]{3}(?:[0-9a-f]{3})?$/i', $val)) { // hex value
306
- $val = strtoupper($val); // force hex values to upper case, just to be tidy
307
- if ($val[0] != '#') $val = '#' . $val;
308
- $in[$key] = $val;
309
- } else if (preg_match("/^([a-zA-Z])+$/i", $val)) { // name - all letters
310
- $in[$key] = $val;
311
- } else { // only legal things left are rgb and rgba
312
- $isrgb = strpos( $val, 'rgb' );
313
- $ishsa = strpos( $val, 'hsl' );
314
- if ($isrgb === false && $ishsa === false) {
315
- if ( $value == ' ') {
316
- $in[$key] = '';
317
- } else {
318
- $err_msg .= __('Color must be a valid # hex value, rgb value, or color name (a-z): ', 'weaver-xtreme' /*adm*/) .
319
- '"'. $key . '" = "' . bin2hex($value) . '". ' .
320
- __('Value has been cleared to blank value.', 'weaver-xtreme' /*adm*/) . '<br />';
321
- }
322
- $in[$key] = '';
323
- } else {
324
- $in[$key] = $val;
325
- }
326
- }
327
- }
328
- break;
329
- }
330
-
331
- if (!empty($value) && is_string($value) && !is_numeric($value)) { $in[$key] = weaverx_filter_textarea($value); }
332
-
333
- break;
334
- }
335
- }
336
-
337
- if (false && $wvr_last != 'Weaver Xtreme') {
338
- $err_msg .= __('Warning - your host may be configured to limit how many input var options you are allowed to pass via PHP.
339
- Unfortunately, this means your settings may not be saved correctly. See the "Weaver II Doesn\'t Save Settings" FAQ on weavertheme.com.<br />', 'weaver-xtreme' /*adm*/);
340
- }
341
-
342
-
343
- if (!empty($err_msg)) {
344
- add_settings_error('weaverx_settings', 'settings_error', $err_msg, 'error');
345
- } else {
346
- add_settings_error('weaverx_settings', 'settings_updated', __('Weaver Xtreme Settings Saved.', 'weaver-xtreme' /*adm*/), 'updated');
347
- }
348
-
349
- return $in;
350
- }
351
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/admin-saverestore.php DELETED
@@ -1,274 +0,0 @@
1
- <?php
2
- if ( !defined('ABSPATH')) exit; // Exit if accessed directly
3
- /* Weaver Xtreme - admin Save/Restore
4
- * __ added - 12/10/14
5
- * This will come after the Options form has been closed, and is used for non-SAPI options
6
- *
7
- */
8
-
9
- function weaverx_admin_saverestore() {
10
- $saved = get_option( apply_filters('weaverx_options','weaverx_settings_backup') ,array());
11
- $style_date = '';
12
- if (!empty($saved))
13
- $style_date = $saved['style_date'];
14
-
15
- if (! $style_date ) $style_date = __('No saved settings', 'weaver-xtreme' /*adm*/);
16
- ?>
17
-
18
- <div class="atw-option-header" style="clear:both;"><?php _e('Save/Restore Theme Settings', 'weaver-xtreme' /*adm*/);weaverx_help_link('help.html#SaveRestore',_e('Help on Save/Restore Themes', 'weaver-xtreme' /*adm*/));?></div>
19
- <p>
20
- <?php _e('Note: if you have Weaver Xtreme Plus installed, then options marked with &starf;Plus will be included in saves and restores.', 'weaver-xtreme' /*adm*/); ?>
21
- </p>
22
- <div class="atw-option-subheader"><?php _e('Save/Restore Current Theme Settings using WordPress Database', 'weaver-xtreme' /*adm*/);?></div>
23
- <?php _e('<p>This option allows you to save and restore all current theme settings using your host\'s WordPress database. Your options will be preserved across Weaver Xtreme theme upgrades, as well when you change to different themes. There is only one saved backup available. You can also download your setting to your computer with the options below.</p>
24
- <p>Note: This save option saves <strong>all</strong> settings, including those marked with &diams;.</p>', 'weaver-xtreme' /*adm*/);?>
25
- <form name="save_mysave_form" method="post">
26
- <span class="submit"><input type="submit" name="save_mytheme" value="<?php _e('Save Current Theme Settings', 'weaver-xtreme' /*adm*/);?>"/></span>
27
- <strong><?php _e('Backup all current theme settings using the WordPress database.', 'weaver-xtreme' /*adm*/);?></strong>
28
- <?php weaverx_nonce_field('save_mytheme'); ?>
29
- <br /><br />
30
- <span class="submit"><input type="submit" name="restore_mytheme" value="<?php _e('Restore Settings', 'weaver-xtreme' /*adm*/);?>"/></span>
31
- <strong><?php _e('Restore from saved settings.', 'weaver-xtreme' /*adm*/);?></strong> <em><?php _e('Last save date:', 'weaver-xtreme' /*adm*/);?> <?php echo $style_date; ?></em>
32
- <?php
33
- weaverx_nonce_field('restore_mytheme');
34
- do_action('weaverxplus_admin','save_restore');
35
- ?>
36
- </form>
37
-
38
- <?php
39
-
40
- weaverx_saverestore(); // download/upload to computer
41
-
42
- do_action('weaverx_child_saverestore'); // allow additional save/restore in child
43
-
44
- do_action('weaverx_child_update');
45
- ?>
46
- <div class="atw-option-subheader"><?php _e('Reset Current Settings to Default', 'weaver-xtreme' /*adm*/); ?></div><br />
47
- <form name="resetweaverx_form" method="post" onSubmit="return confirm('<?php _e('Are you sure you want to reset all Weaver Xtreme settings? This will include the [Saved Current Settings using WordPress Database].', 'weaver-xtreme' /*adm*/); ?>');">
48
- <strong><?php _e('Click the Clear button to reset all Weaver Xtreme settings, including &diams;, &starf;Plus, and Weaver Xtreme Plus shortcode settings, to the default values.', 'weaver-xtreme' /*adm*/); ?></strong><br >
49
- <em style="color:red;"><?php _e('Warning: You will lose all current settings, including settings from "Save Settings using the WordPress Database".', 'weaver-xtreme' /*adm*/); ?></em><br />
50
- <?php _e('You should use the "Download Current Settings To Your Computer" option above to save a copy of your current settings before clearing!
51
- If you have Weaver Xtreme Plus installed, you should also save shortcode settings from the Xtreme Plus Save/Restore tab.', 'weaver-xtreme' /*adm*/); ?>
52
- <br />
53
- <span class="submit"><input type="submit" name="reset_weaverx" value="<?php _e('Clear All Weaver Xtreme Settings', 'weaver-xtreme' /*adm*/); ?>"/></span>
54
- <?php weaverx_nonce_field('reset_weaverx'); ?>
55
- </form> <!-- resetweaverx_form -->
56
- <br /><hr />
57
-
58
- <?php
59
-
60
- }
61
-
62
- function weaverx_process_options_admin_standard( $processed ) {
63
- if ( weaverx_submitted( 'weaverx_clear_messages' )) {
64
- return true;
65
- }
66
- if (weaverx_submitted('reset_weaverx')) {
67
- if (! current_user_can('manage_options'))
68
- wp_die(__('You do not have the capability to do that.', 'weaver-xtreme' /*adm*/));
69
- // delete everything!
70
- weaverx_save_msg(__('All Weaver Xtreme settings have been reset to the defaults.','weaver-xtreme'));
71
- delete_option( apply_filters('weaverx_options','weaverx_settings') );
72
- global $weaverx_opts_cache;
73
- $weaverx_opts_cache = false; // clear the cache
74
- weaverx_init_opts('reset_weaverx');
75
- delete_option( apply_filters('weaverx_options','weaverx_settings_backup') );
76
-
77
- do_action('weaverxplus_admin','reset_weaverxplus');
78
-
79
- update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice', 0 ); // reset the dismiss on the plugin loader
80
- return true;
81
- }
82
-
83
- if (weaverx_submitted('uploadtheme') && function_exists('weaverx_loadtheme')) {
84
- weaverx_loadtheme();
85
- return true;
86
- }
87
-
88
- return $processed;
89
- }
90
-
91
- function weaverx_saverestore(){
92
- /* admin tab for saving and restoring theme */
93
- $weaverx_theme_dir = esc_url(weaverx_f_uploads_base_dir() .'weaverx-theme/');
94
- $download_path = esc_url(weaverx_relative_url('includes/download.php'));
95
- $download_img_path = esc_url(weaverx_relative_url('assets/images/download.png'));
96
- $nonce = wp_create_nonce('weaverx_download');
97
- $a_pro = (function_exists('weaverxplus_plugin_installed')) ? '-plus' : '';
98
-
99
- ?>
100
- <h3 class="atw-option-subheader" style="color:blue;">
101
- <?php _e('Save/Restore Current Theme Settings using Your Computer', 'weaver-xtreme' /*adm*/); ?>
102
- </h3>
103
- <p>
104
- <?php _e('This option allows you to save and restore all current theme settings by uploading and downloading to your own computer.', 'weaver-xtreme' /*adm*/); ?>
105
- </p>
106
-
107
- <h3><?php _e('Download Current Settings To Your Computer', 'weaver-xtreme' /*adm*/); ?></h3>
108
-
109
- <a href="<?php echo $download_path . '?_wpnonce=' . $nonce; ?>"><img src="<?php echo esc_url($download_img_path); ?>" />
110
- &nbsp; <strong><?php _e('Download', 'weaver-xtreme' /*adm*/); ?></strong>&nbsp;</a> -
111
- <?php _e('<strong>Save all</strong> current settings to file on your computer.
112
- (Full settings backup, including those marked with &diams;.) <em>File:</em>', 'weaver-xtreme' /*adm*/); ?>
113
- <strong>weaverx-backup-settings<?php echo $a_pro;?>.wxb</strong>
114
- <br />
115
- <br />
116
- <a href="<?php echo $download_path . '?_wpnoncet=' . $nonce;?>"><img src="<?php echo esc_url($download_img_path); ?>" />
117
- &nbsp;<strong><?php _e('Download', 'weaver-xtreme' /*adm*/); ?></strong></a>&nbsp; -
118
- <?php _e('<strong><em>Save only theme related</em></strong> current settings to file on your computer. <em>File:</em>
119
- <strong>weaverx-theme-settings<?php echo $a_pro;?>.wxt</strong>', 'weaver-xtreme' /*adm*/); ?>
120
- <?php
121
- if (function_exists('weaverxplus_plugin_installed'))
122
- echo '<p>' .
123
- __('Note: Downloaded settings include <em>Weaver Xtreme Plus</em> settings.
124
- Setting files from Weaver Xtreme Plus can be uploaded to the Free Weaver Xtreme version, but will not be used or saved by the free version.', 'weaver-xtreme' /*adm*/)
125
- . '</p>';
126
- ?>
127
-
128
- <form enctype="multipart/form-data" action="<?php echo $_SERVER["REQUEST_URI"]; ?>" method="POST">
129
- <table>
130
- <tr><td><h3><?php _e('Upload settings from file saved on your computer', 'weaver-xtreme' /*adm*/); ?></h3></td></tr>
131
-
132
- <tr valign="top">
133
- <td><?php _e('Select theme/backup file to upload:', 'weaver-xtreme' /*adm*/); ?>
134
- <span style="border:1px solid black;padding:2px;"><input name="uploaded" type="file" /></span>
135
- <input type="hidden" name="uploadit" value="yes" />&nbsp;<?php _e('(Restores settings in file to current settings.)', 'weaver-xtreme' /*adm*/); ?>
136
- </td>
137
- </tr>
138
-
139
- <tr><td><span class='submit'>
140
- <input name="uploadtheme" type="submit" value="<?php _e('Upload theme/backup', 'weaver-xtreme' /*adm*/); ?>" /></span>
141
- &nbsp;<small><?php _e('<strong>Upload and Restore</strong> a theme/backup from file on your computer. Will become current settings.', 'weaver-xtreme' /*adm*/); ?>
142
- </small></td></tr>
143
-
144
- <tr><td>
145
- <?php if (!function_exists('weaverxplus_plugin_installed'))
146
- echo '<small>' .
147
- __('Note: Any Weaver Xtreme Plus settings will <em>not</em> be restored for Weaver Xtreme Free version.', 'weaver-xtreme' /*adm*/) . '</small>';
148
- ?>&nbsp;</td></tr>
149
-
150
- </table>
151
- <?php weaverx_nonce_field('uploadtheme'); ?>
152
- </form>
153
- <?php
154
- }
155
-
156
- function weaverx_loadtheme() {
157
- if (!(isset($_POST['uploadit']) && $_POST['uploadit'] == 'yes')) return;
158
-
159
- // upload theme from users computer
160
- // they've supplied and uploaded a file
161
-
162
- $ok = true; // no errors so far
163
-
164
- if (isset($_FILES['uploaded']['name']))
165
- $filename = $_FILES['uploaded']['name'];
166
- else
167
- $filename = "";
168
-
169
- if (isset($_FILES['uploaded']['tmp_name'])) {
170
- $openname = $_FILES['uploaded']['tmp_name'];
171
- } else {
172
- $openname = "";
173
- }
174
-
175
- //Check the file extension
176
- $check_file = strtolower($filename);
177
- $pat = '.'; // PHP version strict checking bug...
178
- $end = explode($pat, $check_file);
179
- $ext_check = end($end);
180
-
181
-
182
- if ($filename == "") {
183
- $errors[] = __('You didn\'t select a file to upload.', 'weaver-xtreme' /*adm*/) . "<br />";
184
- $ok = false;
185
- }
186
-
187
- if ($ok && $ext_check != 'wxt' && $ext_check != 'wxb'){
188
- $errors[] = __('Theme files must have <em>.wxt</em> or <em>.wxb</em> extension.', 'weaver-xtreme' /*adm*/) . '<br />';
189
- $ok = false;
190
- }
191
-
192
- if ($ok) {
193
- if (!weaverx_f_exists($openname)) {
194
- $errors[] = '<strong><em style="color:red;">' .
195
- __('Sorry, there was a problem uploading your file.
196
- You may need to check your folder permissions or other server settings.', 'weaver-xtreme' /*adm*/) .
197
- '</em></strong><br />(' . __('Trying to use file', 'weaver-xtreme' /*adm*/) . ' <em>' . $openname . '</em>)';
198
- $ok = false;
199
- }
200
- }
201
- if (!$ok) {
202
- echo '<div id="message" class="updated fade"><p><strong><em style="color:red;">' .
203
- __('ERROR', 'weaver-xtreme' /*adm*/) . '</em></strong></p><p>';
204
- foreach($errors as $error){
205
- echo $error.'<br />';
206
- }
207
- echo '</p></div>';
208
- } else { // OK - read file and save to My Saved Theme
209
- // $handle has file handle to temp file.
210
- $contents = weaverx_f_get_contents($openname);
211
-
212
- if ( ! weaverx_ex_set_current_to_serialized_values($contents,'weaverx_uploadit:'.$openname ) ) {
213
- echo '<div id="message" class="updated fade"><p><strong><em style="color:red;">' .
214
- __('Sorry, there was a problem uploading your file.
215
- The file you picked was not a valid Weaver Xtreme theme file.', 'weaver-xtreme' /*adm*/) .
216
- '</em></strong></p></div>';
217
- } else {
218
- weaverx_save_msg( __('Weaver Xtreme theme options reset to uploaded theme.', 'weaver-xtreme' /*adm*/) );
219
- }
220
- }
221
- }
222
-
223
- function weaverx_ex_set_current_to_serialized_values($contents) {
224
- global $weaverx_opts_cache; // need to mess with the cache
225
-
226
- if (substr($contents,0,10) == 'WXT-V01.00')
227
- $type = 'theme';
228
- else if (substr($contents,0,10) == 'WXB-V01.00')
229
- $type = 'backup';
230
- else {
231
- $val = substr($contents,0,10);
232
- return weaverx_f_fail(__("Wrong theme file format version", 'weaver-xtreme' /*adm*/) . ':' . $val); /* simple check for one of ours */
233
- }
234
- $restore = array();
235
- $restore = unserialize(substr($contents,10));
236
-
237
- if (!$restore) return weaverx_f_fail(__("Unserialize failed", 'weaver-xtreme' /*adm*/));
238
-
239
- $version = weaverx_getopt('weaverx_version_id'); // get something to force load
240
-
241
- if ($type == 'theme') {
242
- // need to clear some settings
243
- // first, pickup the per-site settings that aren't theme related...
244
- $new_cache = array();
245
- foreach ($weaverx_opts_cache as $key => $val) {
246
- if (isset($key[0]) && $key[0] == '_') // these are non-theme specific settings
247
- $new_cache[$key] = $val; // keep
248
- }
249
- $opts = $restore['weaverx_base']; // fetch base opts
250
- weaverx_delete_all_options();
251
-
252
- foreach ($opts as $key => $val) {
253
- if (isset($key[0]) && $key[0] != '_')
254
- weaverx_setopt($key, $val, false); // overwrite with saved theme values
255
- }
256
-
257
- foreach ($new_cache as $key => $val) { // set the values we need to keep
258
- weaverx_setopt($key,$val,false);
259
- }
260
- } else if ($type == 'backup') {
261
- weaverx_delete_all_options();
262
-
263
- $opts = $restore['weaverx_base']; // fetch base opts
264
- foreach ($opts as $key => $val) {
265
- weaverx_setopt($key, $val, false); // overwrite with saved values
266
- }
267
- }
268
- weaverx_setopt('weaverx_version_id',$version); // keep version, force save of db
269
- weaverx_setopt('wvrx_css_saved','');
270
- weaverx_setopt('last_option','Weaver Xtreme');
271
- weaverx_save_opts('loading theme'); // OK, now we've saved the options, update them in the DB
272
- return true;
273
- }
274
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/admin-subthemes.php CHANGED
@@ -119,122 +119,4 @@ function weaverx_st_pick_theme($list_in) {
119
  do_action('weaverxplus_admin','show_subthemes');
120
  }
121
 
122
- function weaverx_process_options_themes() {
123
-
124
- if (weaverx_submitted('set_subtheme')) { // invoked from Weaver Xtreme Subthemes tab (this file)
125
- if (isset($_POST['theme_picked'])) {
126
- $theme = weaverx_filter_textarea($_POST['theme_picked']);
127
-
128
- if (weaverx_activate_subtheme($theme))
129
- weaverx_save_msg(__("Subtheme Selected: ", 'weaver-xtreme' /*adm*/) . $theme );
130
- else
131
- weaverx_save_msg(__("Invalid Subtheme file detected. Your installation of Weaver Xtreme may be broken.", 'weaver-xtreme' /*adm*/));
132
- } else {
133
- weaverx_save_msg(__("Please select a subtheme.", 'weaver-xtreme' /*adm*/));
134
- }
135
- return true;
136
- }
137
-
138
- if (weaverx_submitted('save_mytheme')) { // invoked from Save/Restore tab
139
- weaverx_save_msg(__("Current settings saved in WordPress database.", 'weaver-xtreme' /*adm*/));
140
- global $weaverx_opts_cache;
141
- if (!$weaverx_opts_cache)
142
- $weaverx_opts_cache = get_option( apply_filters('weaverx_options','weaverx_settings') ,array());
143
- if (current_user_can( 'manage_options' )) {
144
- $compressed = array_filter( $weaverx_opts_cache, 'strlen'); // filter out all null options (strlen == 0)
145
- update_option(apply_filters('weaverx_options','weaverx_settings_backup'),$compressed);
146
- if ( apply_filters('weaverx_xtra_type', '+backup' ) != 'inactive')
147
- delete_option('weaverx_plus_backup');
148
- }
149
- return true;
150
- }
151
-
152
- if (weaverx_submitted('restore_mytheme')) { // invoked from Save/Restore tab
153
- global $weaverx_opts_cache;
154
- $saved = get_option( apply_filters('weaverx_options','weaverx_settings_backup') ,array());
155
- if (!empty($saved)) {
156
- $weaverx_opts_cache = $saved;
157
- weaverx_wpupdate_option('weaverx_settings',$weaverx_opts_cache);
158
- }
159
- weaverx_save_msg(__("Current settings restored from WordPress database.", 'weaver-xtreme' /*adm*/));
160
- return true;
161
- }
162
-
163
- if (weaverx_submitted('hide_thumbs')) {
164
- $hide = weaverx_getopt('_hide_theme_thumbs');
165
- weaverx_setopt('_hide_theme_thumbs', !$hide);
166
- return true;
167
- }
168
- return false;
169
- }
170
-
171
- function weaverx_activate_subtheme($theme) {
172
- /* load settings for specified theme */
173
- global $weaverx_opts_cache;
174
-
175
- /* build the filename - theme files stored in /wp-content/themes/weaver-xtreme/subthemes/
176
-
177
- Important: the following code assumes that any of the pre-defined theme files won't have
178
- and end-of-line character in them, which should be true. A user could muck about with the
179
- files, and possibly break this assumption. This assumption is necessary because the WP
180
- theme rules allow 'file', but not 'file get contents'. Other than that, the following code
181
- is really the same as the 'theme' section of weaverx_upload_theme() in the pro library
182
- */
183
-
184
- $ext = '.wxt';
185
-
186
- $filename = get_template_directory() . '/subthemes/' . $theme . $ext;
187
-
188
- if ( ! weaverx_f_exists( $filename ) ) {
189
- $filename = str_replace('.wxt', '.wxb', $filename);
190
- if ( ! weaverx_f_exists( $filename ) )
191
- return false;
192
- else
193
- $ext = '.wxb';
194
- }
195
-
196
- $contents = weaverx_f_get_contents($filename); // use either real (pro) or file (standard) version of function
197
-
198
- if (empty($contents)) return false;
199
-
200
- if ( substr($contents,0,10) != 'WXT-V01.00' ) {
201
- if ($ext == '.wxb' && substr($contents,0,10) != 'WXB-V01.00' )
202
- return false;
203
- }
204
-
205
- $restore = array();
206
- $restore = unserialize(substr($contents,10));
207
-
208
- if (!$restore) return false;
209
- $version = weaverx_getopt('weaverx_version_id'); // get something to force load
210
-
211
- // need to clear some settings
212
- // first, pickup the per-site settings that aren't theme related...
213
- $new_cache = array();
214
- if ( $ext == '.wxt' ) {
215
- foreach ($weaverx_opts_cache as $key => $val) {
216
- if ($key[0] == '_') { // these are non-theme specific settings
217
- $new_cache[$key] = $weaverx_opts_cache[$key]; // clear
218
- }
219
- }
220
- }
221
-
222
- $opts = $restore['weaverx_base']; // fetch base opts
223
- weaverx_delete_all_options();
224
-
225
- foreach ($new_cache as $key => $val) { // set the values we need to keep
226
- weaverx_setopt($key,$new_cache[$key],false);
227
- }
228
- foreach ($opts as $key => $val) {
229
- if ($key[0] == '_' && $ext != '.wxb' )
230
- continue; // should be here
231
- weaverx_setopt($key, $val, false); // overwrite with saved theme values
232
- }
233
-
234
- weaverx_setopt('theme_filename',$theme);
235
- weaverx_setopt('last_option','Weaver Xtreme');
236
-
237
- weaverx_save_opts('set subtheme'); // OK, now we've saved the options, update them in the DB
238
- return true;
239
- }
240
  ?>
119
  do_action('weaverxplus_admin','show_subthemes');
120
  }
121
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  ?>
admin/admin-top.php DELETED
@@ -1,227 +0,0 @@
1
- <?php
2
- if ( !defined('ABSPATH')) exit; // Exit if accessed directly
3
- /*
4
- Weaver Xtreme Admin - Uses yetii JavaScript to build tabs.
5
- Tabs include:
6
- Weaver Xtreme Themes (in atw-subthemes.php)
7
- Main Options (in this file)
8
- Advanced Options (in wvr_advancedopts.php)
9
- Save/Restore Themes (in atw-subthemes.php)
10
- Snippets (in atw-help.php)
11
- CSS Help ditto
12
- Help ditto
13
-
14
- * __ added - 12/10/14
15
- /*
16
- ========================= Weaver Xtreme Admin Tab - Main Options ==============
17
- */
18
- function weaverx_do_admin() {
19
- /* theme admin page */
20
-
21
- /* This generates the startup script calls, etc, for the admin page */
22
- global $weaverx_opts_cache, $weaverx_main_options, $weaverx_main_opts_list;
23
-
24
- if (!current_user_can('edit_theme_options'))
25
- wp_die(__('No permission to access that page.', 'weaver-xtreme' /*adm*/));
26
-
27
- weaverx_admin_page_process_options(); // Process non-sapi options
28
-
29
- echo('<div class="wrap">');
30
- ?>
31
- <div style="float:left;"><h2><?php echo WEAVERX_THEMEVERSION; ?> Options
32
- <?php if (function_exists('weaverxplus_plugin_installed')) {
33
- echo '<span style="font-size:smaller;"> - ' . __('Plus', 'weaver-xtreme' /*adm*/) .
34
- '</span><span style="font-size:small;"> ('; echo WEAVER_XPLUS_VERSION; echo ')</span>';
35
- }?>
36
-
37
- <?php if (is_child_theme()) echo " &mdash; " . wp_get_theme(); ?>
38
-
39
-
40
- </h2>
41
- <a name="top_main" id="top_main"></a></div>
42
- <?php weaverx_donate_button();
43
- //weaverx_check_theme();
44
- weaverx_clear_messages();
45
-
46
- weaverx_check_version(); // check version RSS
47
-
48
- weaverx_clear_both();
49
- ?>
50
-
51
- <div id="tabwrap">
52
- <div id="taba-admin" class='yetii'>
53
- <ul id="taba-admin-nav" class='yetii'>
54
- <?php
55
- weaverx_elink( '#tab_themes', __('Select from pre-defined subthemes', 'weaver-xtreme' /*adm*/), __('Weaver Xtreme Subthemes', 'weaver-xtreme' /*adm*/), $before='<li>', $after='</li>');
56
- weaverx_elink( '#tab_main', __('Main options for most theme elements: site appearance, layout, header, menus, content, footer, fonts, more', 'weaver-xtreme' /*adm*/), __('Main Options', 'weaver-xtreme' /*adm*/), $before='<li>', $after='</li>');
57
- weaverx_elink( '#tab_advanced', __('Advanced options: HTML, code, CSS insertion; page templates, background images, SEO, site options', 'weaver-xtreme' /*adm*/), __('Advanced Options', 'weaver-xtreme' /*adm*/), $before='<li>', $after='</li>');
58
- weaverx_elink( '#tab_pro', __('Weaver Xtreme Theme Add-ons', 'weaver-xtreme' /*adm*/), __('Add-ons', 'weaver-xtreme' /*adm*/), $before='<li>', $after='</li>');
59
- weaverx_elink( '#tab_saverestore', __('Save and Restore theme settings', 'weaver-xtreme' /*adm*/), __('Save/Restore', 'weaver-xtreme' /*adm*/), $before='<li>', $after='</li>');
60
- weaverx_elink( '#tab_help', __('Table of Content links to Weaver Xtreme Help files', 'weaver-xtreme' /*adm*/), __('Help', 'weaver-xtreme' /*adm*/), $before='<li>', $after='</li>');
61
- ?>
62
- </ul>
63
-
64
- <?php // list is order specific - above and below must match ?>
65
-
66
- <div id="tab_themes" class="tab" >
67
- <?php weaverx_admin_subthemes(); ?>
68
- </div>
69
- <?php
70
- // ====================== Begin the big form here =====================
71
- weaverx_sapi_form_top('weaverx_settings_group','weaverx_options_form');
72
- ?>
73
- <div id="tab_main" class="tab" >
74
- <?php weaverx_admin_mainopts(); ?>
75
- </div>
76
-
77
- <div id="tab_advanced" class="tab" >
78
- <?php weaverx_admin_advancedopts(); ?>
79
- </div>
80
-
81
-
82
- <?php
83
- weaverx_sapi_form_bottom(); // end of SAPI opts here. Can't cross <div>s! Non-sapi forms follow
84
- // ===================== end of big form =====================
85
- ?>
86
-
87
- <div id="tab_pro" class="tab" >
88
- <?php weaverx_admin_pro(); ?>
89
- </div>
90
-
91
-
92
- <div id="tab_saverestore" class="tab" >
93
- <?php weaverx_admin_saverestore(); ?>
94
- </div>
95
- <div id="tab_help" class="tab" >
96
- <?php weaverx_admin_help(); ?>
97
- </div>
98
- </div> <!-- #tab-saverestore -->
99
- </div> <!-- #tabwrap -->
100
-
101
- <?php weaverx_end_of_section('Options'); ?>
102
-
103
- <script type="text/javascript">
104
- var tabberAdmin = new Yetii({
105
- id: 'taba-admin',
106
- tabclass: 'tab',
107
- persist: true
108
- });
109
- </script>
110
-
111
- <?php
112
- } /* end weaverx_do_admin */
113
-
114
- /*
115
- ================= process settings when enter admin pages ================
116
- */
117
- function weaverx_admin_page_process_options() {
118
- /* Process all options - called upon entry to options forms */
119
-
120
- // Most options are handled by the SAPI filter.
121
-
122
- settings_errors('weaverx_settings'); // display results from SAPI save settings
123
-
124
- $processed = weaverx_process_options_themes(); // >>>> Weaver Xtreme Themes Tab
125
-
126
- do_action('weaverx_child_process_options'); // let the child theme do something
127
- do_action('weaverxplus_admin','process_options');
128
- do_action('weaverx_process_license_options');
129
-
130
- $processed = weaverx_process_options_admin_standard( $processed ); // setting from admin page
131
-
132
- /* this tab has the most individual forms and submit commands */
133
-
134
- /* ====================================================== */
135
-
136
- if ( !$processed && isset($_GET['settings-updated']) && $_GET['settings-updated'] == 'true' ) {
137
- add_settings_error('weaverx_settings', 'settings_updated', __('Saved', 'weaver-xtreme' /*adm*/), 'updated');
138
- $vers = weaverx_getopt('style_version');
139
- weaverx_setopt('style_version', $vers + 1 );
140
- }
141
-
142
- weaverx_save_opts('Weaver Xtreme Admin'); /* FINALLY - SAVE ALL OPTIONS AND UPDATE CURRENT CSS FILE */
143
-
144
- }
145
-
146
- function weaverx_admin_admin() {
147
- ?>
148
- <div class="atw-option-header"><span style="color:black; padding:.2em;" class="dashicons dashicons-admin-generic"></span>
149
- <?php _e('Basic Administrative Options', 'weaver-xtreme' /*adm*/); ?>
150
- <?php weaverx_help_link('help.html#AdminOptions','Help for Admin Options'); ?></div>
151
-
152
- <p>
153
- <?php _e('These options control some administrative options and appearance features.', 'weaver-xtreme' /*adm*/); ?>
154
- </p>
155
-
156
- <br />
157
-
158
- <label><input type="checkbox" name="<?php weaverx_sapi_main_name('_hide_donate'); ?>" id="hide_donate" <?php checked(weaverx_getopt_checked( '_hide_donate' )); ?> />
159
- <?php _e('I\'ve Donated - <small>Thank you for donating to the Weaver Xtreme theme.
160
- This will hide the Donate button. Purchasing Weaver Xtreme Plus also hides the Donate button.</small> &diams;', 'weaver-xtreme' /*adm*/); ?>
161
- </label><br /><br />
162
-
163
- <label><input type="checkbox" name="<?php weaverx_sapi_main_name('_hide_editor_style'); ?>" id="_hide_editor_style" <?php checked(weaverx_getopt_checked( '_hide_editor_style' )); ?> />
164
- <?php _e('Disable Page/Post Editor Styling - <small>Checking this box will disable the Weaver Xtreme subtheme based styling in the Page/Post editor.
165
- If you have a theme using transparent backgrounds, this option will likely improve the Post/Page editor visibility. &diams;</small>', 'weaver-xtreme' /*adm*/); ?></label><br />
166
-
167
- <label><input type="checkbox" name="<?php weaverx_sapi_main_name('_hide_auto_css_rules'); ?>" id="hide_auto_css_rules" <?php checked(weaverx_getopt_checked( '_hide_auto_css_rules' )); ?> />
168
- <?php _e('Don\'t auto-display CSS rules - <small>Checking this box will disable the auto-display of Main Option elements that have CSS settings.</small> &diams;', 'weaver-xtreme' /*adm*/); ?></label><br />
169
-
170
- <input name="<?php weaverx_sapi_main_name('_css_rows'); ?>" id="css_rows" type="text" style="width:30px;height:20px;" class="regular-text" value="<?php weaverx_esc_textarea(weaverx_getopt('_css_rows')); ?>" />
171
- <?php _e('lines - Set CSS+ text box height - <small>You can increase the default height of the CSS+ input area (1 to 25 lines).</small> &diams;', 'weaver-xtreme' /*adm*/); ?>
172
- <br />
173
- <br />
174
- <h3 class="atw-option-subheader"><?php _e('Per Page and Per Post Option Panels by Roles<', 'weaver-xtreme' /*adm*/); ?>/h3>
175
- <p>
176
- <?php _e('Single site Administrator and Multi-Site Super Administrator will always have the Per Page and Per Post options panel displayed.
177
- You may selectively disable these options for other User Roles using the check boxes below.', 'weaver-xtreme' /*adm*/); ?>
178
- </p>
179
-
180
-
181
- <label><input type="checkbox" name="<?php weaverx_sapi_main_name('_hide_mu_admin_per'); ?>" id="_hide_mu_admin_per" <?php checked(weaverx_getopt_checked( '_hide_mu_admin_per' )); ?> />
182
- <?php _e('Hide Per Page/Post Options for MultiSite Admins', 'weaver-xtreme' /*adm*/); ?></label> &diams;<br />
183
- <label><input type="checkbox" name="<?php weaverx_sapi_main_name('_hide_editor_per'); ?>" id="_hide_editor_per" <?php checked(weaverx_getopt_checked( '_hide_editor_per' )); ?> />
184
- <?php _e('Hide Per Page/Post Options for Editors', 'weaver-xtreme' /*adm*/); ?></label> &diams;<br />
185
- <label><input type="checkbox" name="<?php weaverx_sapi_main_name('_hide_author_per'); ?>" id="_hide_author_per" <?php checked(weaverx_getopt_checked( '_hide_author_per' )); ?> />
186
- <?php _e('Hide Per Page/Post Options for Authors and Contributors', 'weaver-xtreme' /*adm*/); ?></label> &diams;<br />
187
- <br />
188
- <label><input type="checkbox" name="<?php weaverx_sapi_main_name('_show_per_post_all'); ?>" id="_hide_author_per" <?php checked(weaverx_getopt_checked( '_show_per_post_all' )); ?> />
189
- <?php _e('Show Per Post Options for Custom Post Types &diams; - <small>Shows the Per Post options box on "Custom Post Type Editor" admin pages', 'weaver-xtreme' /*adm*/); ?></small>
190
- </label>
191
- <br />
192
- <br /><br />
193
- <div class="atw-option-subheader"><?php _e('Theme Name and Description', 'weaver-xtreme' /*adm*/); ?></div>
194
- <p>
195
- <?php _e('You can change the name and description of your current settings if you would like to create a new theme
196
- theme file for sharing with others, or for you own identification.', 'weaver-xtreme' /*adm*/); ?>
197
- </p>
198
- <?php _e('Theme Name:', 'weaver-xtreme' /*adm*/); ?> <input name="<?php weaverx_sapi_main_name('themename'); ?>" id="themename" value="<?php echo weaverx_getopt('themename'); ?>" />
199
- <br />
200
- <?php _e('Description:', 'weaver-xtreme' /*adm*/); ?>&nbsp;&nbsp;&nbsp;
201
- <?php weaverx_textarea(weaverx_getopt('theme_description'), 'theme_description', 2, __('Describe the theme','weaver-xtreme' /*adm*/),'width:65%;'); ?>
202
- <br />
203
- <br />
204
- <h3 class="atw-option-subheader"><?php _e('Subtheme Notes', 'weaver-xtreme' /*adm*/); ?></h3>
205
- <p>
206
- <?php _e('This box may be used to keep notes and instructions about settings made for a custom subtheme.
207
- It will be saved in the both \'.wxt\' and \'.wxb\' settings files.', 'weaver-xtreme' /*adm*/); ?>
208
- </p>
209
- <?php
210
- weaverx_textarea(weaverx_getopt('subtheme_notes'), 'subtheme_notes', 2, __('Notes about theme','weaver-xtreme' /*adm*/), 'width:75%;');
211
-
212
- do_action('weaverxplus_admin','admin_options');
213
-
214
- }
215
- /* ^^^^^ end weaverx_admin_page_process_options ^^^^^^ */
216
-
217
- // ===================================== include other stuff ==========================
218
-
219
- require_once( dirname( __FILE__ ) . '/lib-admin.php' );
220
-
221
- require_once( dirname( __FILE__ ) . '/admin-subthemes.php' );
222
- require_once( dirname( __FILE__ ) . '/admin-mainopts.php' );
223
- require_once( dirname( __FILE__ ) . '/admin-advancedopts.php' );
224
- require_once( dirname( __FILE__ ) . '/admin-plus.php' );
225
- require_once( dirname( __FILE__ ) . '/admin-saverestore.php' );
226
- require_once( dirname( __FILE__ ) . '/admin-help.php' );
227
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/class-tgm-plugin-activation.php DELETED
@@ -1,3625 +0,0 @@
1
- <?php
2
- /**
3
- * Plugin installation and activation for WordPress themes.
4
- *
5
- * Please note that this is a drop-in library for a theme or plugin.
6
- * The authors of this library (Thomas, Gary and Juliette) are NOT responsible
7
- * for the support of your plugin or theme. Please contact the plugin
8
- * or theme author for support.
9
- *
10
- *'tgmpa' -> 'weaver-xtreme'
11
- *
12
- * @package TGM-Plugin-Activation
13
- * @version 2.5.2.1
14
- * @link http://tgmpluginactivation.com/
15
- * @author Thomas Griffin, Gary Jones, Juliette Reinders Folmer
16
- * @copyright Copyright (c) 2011, Thomas Griffin
17
- * @license GPL-2.0+
18
- *
19
- * @wordpress-plugin
20
- * Plugin Name: TGM Plugin Activation
21
- * Plugin URI:
22
- * Description: Plugin installation and activation for WordPress themes.
23
- * Version: 2.5.2
24
- * Author: Thomas Griffin, Gary Jones, Juliette Reinders Folmer
25
- * Author URI: http://tgmpluginactivation.com/
26
- * Text Domain: tgmpa
27
- * Domain Path: /languages/
28
- * Copyright: 2011, Thomas Griffin
29
- */
30
-
31
- /*
32
- Copyright 2011 Thomas Griffin (thomasgriffinmedia.com)
33
-
34
- This program is free software; you can redistribute it and/or modify
35
- it under the terms of the GNU General Public License, version 2, as
36
- published by the Free Software Foundation.
37
-
38
- This program is distributed in the hope that it will be useful,
39
- but WITHOUT ANY WARRANTY; without even the implied warranty of
40
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41
- GNU General Public License for more details.
42
-
43
- You should have received a copy of the GNU General Public License
44
- along with this program; if not, write to the Free Software
45
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
46
- */
47
-
48
- if ( ! class_exists( 'TGM_Plugin_Activation' ) ) {
49
-
50
- /**
51
- * Automatic plugin installation and activation library.
52
- *
53
- * Creates a way to automatically install and activate plugins from within themes.
54
- * The plugins can be either bundled, downloaded from the WordPress
55
- * Plugin Repository or downloaded from another external source.
56
- *
57
- * @since 1.0.0
58
- *
59
- * @package TGM-Plugin-Activation
60
- * @author Thomas Griffin
61
- * @author Gary Jones
62
- */
63
- class TGM_Plugin_Activation {
64
- /**
65
- * TGMPA version number.
66
- *
67
- * @since 2.5.0
68
- *
69
- * @const string Version number.
70
- */
71
- const TGMPA_VERSION = '2.5.2';
72
-
73
- /**
74
- * Regular expression to test if a URL is a WP plugin repo URL.
75
- *
76
- * @const string Regex.
77
- *
78
- * @since 2.5.0
79
- */
80
- const WP_REPO_REGEX = '|^http[s]?://wordpress\.org/(?:extend/)?plugins/|';
81
-
82
- /**
83
- * Arbitrary regular expression to test if a string starts with a URL.
84
- *
85
- * @const string Regex.
86
- *
87
- * @since 2.5.0
88
- */
89
- const IS_URL_REGEX = '|^http[s]?://|';
90
-
91
- /**
92
- * Holds a copy of itself, so it can be referenced by the class name.
93
- *
94
- * @since 1.0.0
95
- *
96
- * @var TGM_Plugin_Activation
97
- */
98
- public static $instance;
99
-
100
- /**
101
- * Holds arrays of plugin details.
102
- *
103
- * @since 1.0.0
104
- *
105
- * @since 2.5.0 the array has the plugin slug as an associative key.
106
- *
107
- * @var array
108
- */
109
- public $plugins = array();
110
-
111
- /**
112
- * Holds arrays of plugin names to use to sort the plugins array.
113
- *
114
- * @since 2.5.0
115
- *
116
- * @var array
117
- */
118
- protected $sort_order = array();
119
-
120
- /**
121
- * Whether any plugins have the 'force_activation' setting set to true.
122
- *
123
- * @since 2.5.0
124
- *
125
- * @var bool
126
- */
127
- protected $has_forced_activation = false;
128
-
129
- /**
130
- * Whether any plugins have the 'force_deactivation' setting set to true.
131
- *
132
- * @since 2.5.0
133
- *
134
- * @var bool
135
- */
136
- protected $has_forced_deactivation = false;
137
-
138
- /**
139
- * Name of the unique ID to hash notices.
140
- *
141
- * @since 2.4.0
142
- *
143
- * @var string
144
- */
145
- public $id = 'tgmpa';
146
-
147
- /**
148
- * Name of the query-string argument for the admin page.
149
- *
150
- * @since 1.0.0
151
- *
152
- * @var string
153
- */
154
- protected $menu = 'tgmpa-install-plugins';
155
-
156
- /**
157
- * Parent menu file slug.
158
- *
159
- * @since 2.5.0
160
- *
161
- * @var string
162
- */
163
- public $parent_slug = 'themes.php';
164
-
165
- /**
166
- * Capability needed to view the plugin installation menu item.
167
- *
168
- * @since 2.5.0
169
- *
170
- * @var string
171
- */
172
- public $capability = 'edit_theme_options';
173
-
174
- /**
175
- * Default absolute path to folder containing bundled plugin zip files.
176
- *
177
- * @since 2.0.0
178
- *
179
- * @var string Absolute path prefix to zip file location for bundled plugins. Default is empty string.
180
- */
181
- public $default_path = '';
182
-
183
- /**
184
- * Flag to show admin notices or not.
185
- *
186
- * @since 2.1.0
187
- *
188
- * @var boolean
189
- */
190
- public $has_notices = true;
191
-
192
- /**
193
- * Flag to determine if the user can dismiss the notice nag.
194
- *
195
- * @since 2.4.0
196
- *
197
- * @var boolean
198
- */
199
- public $dismissable = true;
200
-
201
- /**
202
- * Message to be output above nag notice if dismissable is false.
203
- *
204
- * @since 2.4.0
205
- *
206
- * @var string
207
- */
208
- public $dismiss_msg = '';
209
-
210
- /**
211
- * Flag to set automatic activation of plugins. Off by default.
212
- *
213
- * @since 2.2.0
214
- *
215
- * @var boolean
216
- */
217
- public $is_automatic = false;
218
-
219
- /**
220
- * Optional message to display before the plugins table.
221
- *
222
- * @since 2.2.0
223
- *
224
- * @var string Message filtered by wp_kses_post(). Default is empty string.
225
- */
226
- public $message = '';
227
-
228
- /**
229
- * Holds configurable array of strings.
230
- *
231
- * Default values are added in the constructor.
232
- *
233
- * @since 2.0.0
234
- *
235
- * @var array
236
- */
237
- public $strings = array();
238
-
239
- /**
240
- * Holds the version of WordPress.
241
- *
242
- * @since 2.4.0
243
- *
244
- * @var int
245
- */
246
- public $wp_version;
247
-
248
- /**
249
- * Holds the hook name for the admin page.
250
- *
251
- * @since 2.5.0
252
- *
253
- * @var string
254
- */
255
- public $page_hook;
256
-
257
- /**
258
- * Adds a reference of this object to $instance, populates default strings,
259
- * does the tgmpa_init action hook, and hooks in the interactions to init.
260
- *
261
- * @internal This method should be `protected`, but as too many TGMPA implementations
262
- * haven't upgraded beyond v2.3.6 yet, this gives backward compatibility issues.
263
- * Reverted back to public for the time being.
264
- *
265
- * @since 1.0.0
266
- *
267
- * @see TGM_Plugin_Activation::init()
268
- */
269
- public function __construct() {
270
- // Set the current WordPress version.
271
- $this->wp_version = $GLOBALS['wp_version'];
272
-
273
- // Announce that the class is ready, and pass the object (for advanced use).
274
- do_action_ref_array( 'tgmpa_init', array( $this ) );
275
-
276
- // When the rest of WP has loaded, kick-start the rest of the class.
277
- add_action( 'init', array( $this, 'init' ) );
278
- }
279
-
280
- /**
281
- * Magic method to (not) set protected properties from outside of this class.
282
- *
283
- * @internal hackedihack... There is a serious bug in v2.3.2 - 2.3.6 where the `menu` property
284
- * is being assigned rather than tested in a conditional, effectively rendering it useless.
285
- * This 'hack' prevents this from happening.
286
- *
287
- * @see https://github.com/TGMPA/TGM-Plugin-Activation/blob/2.3.6/tgm-plugin-activation/class-tgm-plugin-activation.php#L1593
288
- *
289
- * @param string $name Name of an inaccessible property.
290
- * @param mixed $value Value to assign to the property.
291
- * @return void Silently fail to set the property when this is tried from outside of this class context.
292
- * (Inside this class context, the __set() method if not used as there is direct access.)
293
- */
294
- public function __set( $name, $value ) {
295
- return;
296
- }
297
-
298
- /**
299
- * Magic method to get the value of a protected property outside of this class context.
300
- *
301
- * @param string $name Name of an inaccessible property.
302
- * @return mixed The property value.
303
- */
304
- public function __get( $name ) {
305
- return $this->{$name};
306
- }
307
-
308
- /**
309
- * Initialise the interactions between this class and WordPress.
310
- *
311
- * Hooks in three new methods for the class: admin_menu, notices and styles.
312
- *
313
- * @since 2.0.0
314
- *
315
- * @see TGM_Plugin_Activation::admin_menu()
316
- * @see TGM_Plugin_Activation::notices()
317
- * @see TGM_Plugin_Activation::styles()
318
- */
319
- public function init() {
320
- /**
321
- * By default TGMPA only loads on the WP back-end and not in an Ajax call. Using this filter
322
- * you can overrule that behaviour.
323
- *
324
- * @since 2.5.0
325
- *
326
- * @param bool $load Whether or not TGMPA should load.
327
- * Defaults to the return of `is_admin() && ! defined( 'DOING_AJAX' )`.
328
- */
329
- if ( true !== apply_filters( 'tgmpa_load', ( is_admin() && ! defined( 'DOING_AJAX' ) ) ) ) {
330
- return;
331
- }
332
-
333
- // Load class strings.
334
- $this->strings = array(
335
- 'page_title' => __( 'Install Required Plugins', 'weaver-xtreme' ),
336
- 'menu_title' => __( 'Install Plugins', 'weaver-xtreme' ),
337
- 'installing' => __( 'Installing Plugin: %s', 'weaver-xtreme' ),
338
- 'oops' => __( 'Something went wrong with the plugin API.', 'weaver-xtreme' ),
339
- 'notice_can_install_required' => _n_noop(
340
- 'This theme requires the following plugin: %1$s.',
341
- 'This theme requires the following plugins: %1$s.',
342
- 'weaver-xtreme'
343
- ),
344
- 'notice_can_install_recommended' => _n_noop(
345
- 'This theme recommends the following plugin: %1$s.',
346
- 'This theme recommends the following plugins: %1$s.',
347
- 'weaver-xtreme'
348
- ),
349
- 'notice_cannot_install' => _n_noop(
350
- 'Sorry, but you do not have the correct permissions to install the %1$s plugin.',
351
- 'Sorry, but you do not have the correct permissions to install the %1$s plugins.',
352
- 'weaver-xtreme'
353
- ),
354
- 'notice_ask_to_update' => _n_noop(
355
- 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.',
356
- 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.',
357
- 'weaver-xtreme'
358
- ),
359
- 'notice_ask_to_update_maybe' => _n_noop(
360
- 'There is an update available for: %1$s.',
361
- 'There are updates available for the following plugins: %1$s.',
362
- 'weaver-xtreme'
363
- ),
364
- 'notice_cannot_update' => _n_noop(
365
- 'Sorry, but you do not have the correct permissions to update the %1$s plugin.',
366
- 'Sorry, but you do not have the correct permissions to update the %1$s plugins.',
367
- 'weaver-xtreme'
368
- ),
369
- 'notice_can_activate_required' => _n_noop(
370
- 'The following required plugin is currently inactive: %1$s.',
371
- 'The following required plugins are currently inactive: %1$s.',
372
- 'weaver-xtreme'
373
- ),
374
- 'notice_can_activate_recommended' => _n_noop(
375
- 'The following recommended plugin is currently inactive: %1$s.',
376
- 'The following recommended plugins are currently inactive: %1$s.',
377
- 'weaver-xtreme'
378
- ),
379
- 'notice_cannot_activate' => _n_noop(
380
- 'Sorry, but you do not have the correct permissions to activate the %1$s plugin.',
381
- 'Sorry, but you do not have the correct permissions to activate the %1$s plugins.',
382
- 'weaver-xtreme'
383
- ),
384
- 'install_link' => _n_noop(
385
- 'Begin installing plugin',
386
- 'Begin installing plugins',
387
- 'weaver-xtreme'
388
- ),
389
- 'update_link' => _n_noop(
390
- 'Begin updating plugin',
391
- 'Begin updating plugins',
392
- 'weaver-xtreme'
393
- ),
394
- 'activate_link' => _n_noop(
395
- 'Begin activating plugin',
396
- 'Begin activating plugins',
397
- 'weaver-xtreme'
398
- ),
399
- 'return' => __( 'Return to Required Plugins Installer', 'weaver-xtreme' ),
400
- 'dashboard' => __( 'Return to the dashboard', 'weaver-xtreme' ),
401
- 'plugin_activated' => __( 'Plugin activated successfully.', 'weaver-xtreme' ),
402
- 'activated_successfully' => __( 'The following plugin was activated successfully:', 'weaver-xtreme' ),
403
- 'plugin_already_active' => __( 'No action taken. Plugin %1$s was already active.', 'weaver-xtreme' ),
404
- 'plugin_needs_higher_version' => __( 'Plugin not activated. A higher version of %s is needed for this theme. Please update the plugin.', 'weaver-xtreme' ),
405
- 'complete' => __( 'All plugins installed and activated successfully. %1$s', 'weaver-xtreme' ),
406
- 'dismiss' => __( 'Dismiss this notice', 'weaver-xtreme' ),
407
- 'contact_admin' => __( 'Please contact the administrator of this site for help.', 'weaver-xtreme' ),
408
- );
409
-
410
- do_action( 'tgmpa_register' );
411
-
412
- /* After this point, the plugins should be registered and the configuration set. */
413
-
414
- // Proceed only if we have plugins to handle.
415
- if ( empty( $this->plugins ) || ! is_array( $this->plugins ) ) {
416
- return;
417
- }
418
-
419
- // Set up the menu and notices if we still have outstanding actions.
420
- if ( true !== $this->is_tgmpa_complete() ) {
421
- // Sort the plugins.
422
- array_multisort( $this->sort_order, SORT_ASC, $this->plugins );
423
-
424
- add_action( 'admin_menu', array( $this, 'admin_menu' ) );
425
- add_action( 'admin_head', array( $this, 'dismiss' ) );
426
-
427
- // Prevent the normal links from showing underneath a single install/update page.
428
- add_filter( 'install_plugin_complete_actions', array( $this, 'actions' ) );
429
- add_filter( 'update_plugin_complete_actions', array( $this, 'actions' ) );
430
-
431
- if ( $this->has_notices ) {
432
- add_action( 'admin_notices', array( $this, 'notices' ) );
433
- add_action( 'admin_init', array( $this, 'admin_init' ), 1 );
434
- add_action( 'admin_enqueue_scripts', array( $this, 'thickbox' ) );
435
- }
436
- }
437
-
438
- // If needed, filter plugin action links.
439
- add_action( 'load-plugins.php', array( $this, 'add_plugin_action_link_filters' ), 1 );
440
-
441
- // Make sure things get reset on switch theme.
442
- add_action( 'switch_theme', array( $this, 'flush_plugins_cache' ) );
443
-
444
- if ( $this->has_notices ) {
445
- add_action( 'switch_theme', array( $this, 'update_dismiss' ) );
446
- }
447
-
448
- // Setup the force activation hook.
449
- if ( true === $this->has_forced_activation ) {
450
- add_action( 'admin_init', array( $this, 'force_activation' ) );
451
- }
452
-
453
- // Setup the force deactivation hook.
454
- if ( true === $this->has_forced_deactivation ) {
455
- add_action( 'switch_theme', array( $this, 'force_deactivation' ) );
456
- }
457
- }
458
-
459
- /**
460
- * Hook in plugin action link filters for the WP native plugins page.
461
- *
462
- * - Prevent activation of plugins which don't meet the minimum version requirements.
463
- * - Prevent deactivation of force-activated plugins.
464
- * - Add update notice if update available.
465
- *
466
- * @since 2.5.0
467
- */
468
- public function add_plugin_action_link_filters() {
469
- foreach ( $this->plugins as $slug => $plugin ) {
470
- if ( false === $this->can_plugin_activate( $slug ) ) {
471
- add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_activate' ), 20 );
472
- }
473
-
474
- if ( true === $plugin['force_activation'] ) {
475
- add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_deactivate' ), 20 );
476
- }
477
-
478
- if ( false !== $this->does_plugin_require_update( $slug ) ) {
479
- add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_update' ), 20 );
480
- }
481
- }
482
- }
483
-
484
- /**
485
- * Remove the 'Activate' link on the WP native plugins page if the plugin does not meet the
486
- * minimum version requirements.
487
- *
488
- * @since 2.5.0
489
- *
490
- * @param array $actions Action links.
491
- * @return array
492
- */
493
- public function filter_plugin_action_links_activate( $actions ) {
494
- unset( $actions['activate'] );
495
-
496
- return $actions;
497
- }
498
-
499
- /**
500
- * Remove the 'Deactivate' link on the WP native plugins page if the plugin has been set to force activate.
501
- *
502
- * @since 2.5.0
503
- *
504
- * @param array $actions Action links.
505
- * @return array
506
- */
507
- public function filter_plugin_action_links_deactivate( $actions ) {
508
- unset( $actions['deactivate'] );
509
-
510
- return $actions;
511
- }
512
-
513
- /**
514
- * Add a 'Requires update' link on the WP native plugins page if the plugin does not meet the
515
- * minimum version requirements.
516
- *
517
- * @since 2.5.0
518
- *
519
- * @param array $actions Action links.
520
- * @return array
521
- */
522
- public function filter_plugin_action_links_update( $actions ) {
523
- $actions['update'] = sprintf(
524
- '<a href="%1$s" title="%2$s" class="edit">%3$s</a>',
525
- esc_url( $this->get_tgmpa_status_url( 'update' ) ),
526
- esc_attr__( 'This plugin needs to be updated to be compatible with your theme.', 'weaver-xtreme' ),
527
- esc_html__( 'Update Required', 'weaver-xtreme' )
528
- );
529
-
530
- return $actions;
531
- }
532
-
533
- /**
534
- * Handles calls to show plugin information via links in the notices.
535
- *
536
- * We get the links in the admin notices to point to the TGMPA page, rather
537
- * than the typical plugin-install.php file, so we can prepare everything
538
- * beforehand.
539
- *
540
- * WP does not make it easy to show the plugin information in the thickbox -
541
- * here we have to require a file that includes a function that does the
542
- * main work of displaying it, enqueue some styles, set up some globals and
543
- * finally call that function before exiting.
544
- *
545
- * Down right easy once you know how...
546
- *
547
- * Returns early if not the TGMPA page.
548
- *
549
- * @since 2.1.0
550
- *
551
- * @global string $tab Used as iframe div class names, helps with styling
552
- * @global string $body_id Used as the iframe body ID, helps with styling
553
- *
554
- * @return null Returns early if not the TGMPA page.
555
- */
556
- public function admin_init() {
557
- if ( ! $this->is_tgmpa_page() ) {
558
- return;
559
- }
560
-
561
- if ( isset( $_REQUEST['tab'] ) && 'plugin-information' === $_REQUEST['tab'] ) {
562
- // Needed for install_plugin_information().
563
- require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
564
-
565
- wp_enqueue_style( 'plugin-install' );
566
-
567
- global $tab, $body_id;
568
- $body_id = 'plugin-information';
569
- // @codingStandardsIgnoreStart
570
- $tab = 'plugin-information';
571
- // @codingStandardsIgnoreEnd
572
-
573
- install_plugin_information();
574
-
575
- exit;
576
- }
577
- }
578
-
579
- /**
580
- * Enqueue thickbox scripts/styles for plugin info.
581
- *
582
- * Thickbox is not automatically included on all admin pages, so we must
583
- * manually enqueue it for those pages.
584
- *
585
- * Thickbox is only loaded if the user has not dismissed the admin
586
- * notice or if there are any plugins left to install and activate.
587
- *
588
- * @since 2.1.0
589
- */
590
- public function thickbox() {
591
- if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) ) {
592
- add_thickbox();
593
- }
594
- }
595
-
596
- /**
597
- * Adds submenu page if there are plugin actions to take.
598
- *
599
- * This method adds the submenu page letting users know that a required
600
- * plugin needs to be installed.
601
- *
602
- * This page disappears once the plugin has been installed and activated.
603
- *
604
- * @since 1.0.0
605
- *
606
- * @see TGM_Plugin_Activation::init()
607
- * @see TGM_Plugin_Activation::install_plugins_page()
608
- *
609
- * @return null Return early if user lacks capability to install a plugin.
610
- */
611
- public function admin_menu() {
612
- // Make sure privileges are correct to see the page.
613
- if ( ! current_user_can( 'install_plugins' ) ) {
614
- return;
615
- }
616
-
617
- $args = apply_filters(
618
- 'tgmpa_admin_menu_args',
619
- array(
620
- 'parent_slug' => $this->parent_slug, // Parent Menu slug.
621
- 'page_title' => $this->strings['page_title'], // Page title.
622
- 'menu_title' => $this->strings['menu_title'], // Menu title.
623
- 'capability' => $this->capability, // Capability.
624
- 'menu_slug' => $this->menu, // Menu slug.
625
- 'function' => array( $this, 'install_plugins_page' ), // Callback.
626
- )
627
- );
628
-
629
- $this->add_admin_menu( $args );
630
- }
631
-
632
- /**
633
- * Add the menu item.
634
- *
635
- * @since 2.5.0
636
- *
637
- * @param array $args Menu item configuration.
638
- */
639
- protected function add_admin_menu( array $args ) {
640
- if ( has_filter( 'tgmpa_admin_menu_use_add_theme_page' ) ) {
641
- _deprecated_function( 'The "tgmpa_admin_menu_use_add_theme_page" filter', '2.5.0', esc_html__( 'Set the parent_slug config variable instead.', 'weaver-xtreme' ) );
642
- }
643
-
644
- if ( 'themes.php' === $this->parent_slug ) {
645
- $this->page_hook = call_user_func( 'add_theme_page', $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] );
646
- } else {
647
- $type = 'submenu';
648
- $this->page_hook = call_user_func( "add_{$type}_page", $args['parent_slug'], $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] );
649
- }
650
- }
651
-
652
- /**
653
- * Echoes plugin installation form.
654
- *
655
- * This method is the callback for the admin_menu method function.
656
- * This displays the admin page and form area where the user can select to install and activate the plugin.
657
- * Aborts early if we're processing a plugin installation action.
658
- *
659
- * @since 1.0.0
660
- *
661
- * @return null Aborts early if we're processing a plugin installation action.
662
- */
663
- public function install_plugins_page() {
664
- // Store new instance of plugin table in object.
665
- $plugin_table = new TGMPA_List_Table;
666
-
667
- // Return early if processing a plugin installation action.
668
- if ( ( ( 'tgmpa-bulk-install' === $plugin_table->current_action() || 'tgmpa-bulk-update' === $plugin_table->current_action() ) && $plugin_table->process_bulk_actions() ) || $this->do_plugin_install() ) {
669
- return;
670
- }
671
-
672
- // Force refresh of available plugin information so we'll know about manual updates/deletes.
673
- wp_clean_plugins_cache( false );
674
-
675
- ?>
676
- <div class="tgmpa wrap">
677
- <h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
678
- <?php $plugin_table->prepare_items(); ?>
679
-
680
- <?php
681
- if ( ! empty( $this->message ) && is_string( $this->message ) ) {
682
- echo wp_kses_post( $this->message );
683
- }
684
- ?>
685
- <?php $plugin_table->views(); ?>
686
-
687
- <form id="tgmpa-plugins" action="" method="post">
688
- <input type="hidden" name="tgmpa-page" value="<?php echo esc_attr( $this->menu ); ?>" />
689
- <input type="hidden" name="plugin_status" value="<?php echo esc_attr( $plugin_table->view_context ); ?>" />
690
- <?php $plugin_table->display(); ?>
691
- </form>
692
- </div>
693
- <?php
694
- }
695
-
696
- /**
697
- * Installs, updates or activates a plugin depending on the action link clicked by the user.
698
- *
699
- * Checks the $_GET variable to see which actions have been
700
- * passed and responds with the appropriate method.
701
- *
702
- * Uses WP_Filesystem to process and handle the plugin installation
703
- * method.
704
- *
705
- * @since 1.0.0
706
- *
707
- * @uses WP_Filesystem
708
- * @uses WP_Error
709
- * @uses WP_Upgrader
710
- * @uses Plugin_Upgrader
711
- * @uses Plugin_Installer_Skin
712
- * @uses Plugin_Upgrader_Skin
713
- *
714
- * @return boolean True on success, false on failure.
715
- */
716
- protected function do_plugin_install() {
717
- if ( empty( $_GET['plugin'] ) ) {
718
- return false;
719
- }
720
-
721
- // All plugin information will be stored in an array for processing.
722
- $slug = $this->sanitize_key( urldecode( $_GET['plugin'] ) );
723
-
724
- if ( ! isset( $this->plugins[ $slug ] ) ) {
725
- return false;
726
- }
727
-
728
- // Was an install or upgrade action link clicked?
729
- if ( ( isset( $_GET['tgmpa-install'] ) && 'install-plugin' === $_GET['tgmpa-install'] ) || ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) ) {
730
-
731
- $install_type = 'install';
732
- if ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) {
733
- $install_type = 'update';
734
- }
735
-
736
- check_admin_referer( 'tgmpa-' . $install_type, 'tgmpa-nonce' );
737
-
738
- // Pass necessary information via URL if WP_Filesystem is needed.
739
- $url = wp_nonce_url(
740
- add_query_arg(
741
- array(
742
- 'plugin' => urlencode( $slug ),
743
- 'tgmpa-' . $install_type => $install_type . '-plugin',
744
- ),
745
- $this->get_tgmpa_url()
746
- ),
747
- 'tgmpa-' . $install_type,
748
- 'tgmpa-nonce'
749
- );
750
-
751
- $method = ''; // Leave blank so WP_Filesystem can populate it as necessary.
752
-
753
- if ( false === ( $creds = request_filesystem_credentials( esc_url_raw( $url ), $method, false, false, array() ) ) ) {
754
- return true;
755
- }
756
-
757
- if ( ! WP_Filesystem( $creds ) ) {
758
- request_filesystem_credentials( esc_url_raw( $url ), $method, true, false, array() ); // Setup WP_Filesystem.
759
- return true;
760
- }
761
-
762
- /* If we arrive here, we have the filesystem. */
763
-
764
- // Prep variables for Plugin_Installer_Skin class.
765
- $extra = array();
766
- $extra['slug'] = $slug; // Needed for potentially renaming of directory name.
767
- $source = $this->get_download_url( $slug );
768
- $api = ( 'repo' === $this->plugins[ $slug ]['source_type'] ) ? $this->get_plugins_api( $slug ) : null;
769
- $api = ( false !== $api ) ? $api : null;
770
-
771
- $url = add_query_arg(
772
- array(
773
- 'action' => $install_type . '-plugin',
774
- 'plugin' => urlencode( $slug ),
775
- ),
776
- 'update.php'
777
- );
778
-
779
- if ( ! class_exists( 'Plugin_Upgrader', false ) ) {
780
- require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
781
- }
782
-
783
- $skin_args = array(
784
- 'type' => ( 'bundled' !== $this->plugins[ $slug ]['source_type'] ) ? 'web' : 'upload',
785
- 'title' => sprintf( $this->strings['installing'], $this->plugins[ $slug ]['name'] ),
786
- 'url' => esc_url_raw( $url ),
787
- 'nonce' => $install_type . '-plugin_' . $slug,
788
- 'plugin' => '',
789
- 'api' => $api,
790
- 'extra' => $extra,
791
- );
792
-
793
- if ( 'update' === $install_type ) {
794
- $skin_args['plugin'] = $this->plugins[ $slug ]['file_path'];
795
- $skin = new Plugin_Upgrader_Skin( $skin_args );
796
- } else {
797
- $skin = new Plugin_Installer_Skin( $skin_args );
798
- }
799
-
800
- // Create a new instance of Plugin_Upgrader.
801
- $upgrader = new Plugin_Upgrader( $skin );
802
-
803
- // Perform the action and install the plugin from the $source urldecode().
804
- add_filter( 'upgrader_source_selection', array( $this, 'maybe_adjust_source_dir' ), 1, 3 );
805
-
806
- if ( 'update' === $install_type ) {
807
- // Inject our info into the update transient.
808
- $to_inject = array( $slug => $this->plugins[ $slug ] );
809
- $to_inject[ $slug ]['source'] = $source;
810
- $this->inject_update_info( $to_inject );
811
-
812
- $upgrader->upgrade( $this->plugins[ $slug ]['file_path'] );
813
- } else {
814
- $upgrader->install( $source );
815
- }
816
-
817
- remove_filter( 'upgrader_source_selection', array( $this, 'maybe_adjust_source_dir' ), 1, 3 );
818
-
819
- // Make sure we have the correct file path now the plugin is installed/updated.
820
- $this->populate_file_path( $slug );
821
-
822
- // Only activate plugins if the config option is set to true and the plugin isn't
823
- // already active (upgrade).
824
- if ( $this->is_automatic && ! $this->is_plugin_active( $slug ) ) {
825
- $plugin_activate = $upgrader->plugin_info(); // Grab the plugin info from the Plugin_Upgrader method.
826
- if ( false === $this->activate_single_plugin( $plugin_activate, $slug, true ) ) {
827
- return true; // Finish execution of the function early as we encountered an error.
828
- }
829
- }
830
-
831
- $this->show_tgmpa_version();
832
-
833
- // Display message based on if all plugins are now active or not.
834
- if ( $this->is_tgmpa_complete() ) {
835
- echo '<p>', sprintf( esc_html( $this->strings['complete'] ), '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'weaver-xtreme' ) . '</a>' ), '</p>';
836
- echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>';
837
- } else {
838
- echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>';
839
- }
840
-
841
- return true;
842
- } elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) {
843
- // Activate action link was clicked.
844
- check_admin_referer( 'tgmpa-activate', 'tgmpa-nonce' );
845
-
846
- if ( false === $this->activate_single_plugin( $this->plugins[ $slug ]['file_path'], $slug ) ) {
847
- return true; // Finish execution of the function early as we encountered an error.
848
- }
849
- }
850
-
851
- return false;
852
- }
853
-
854
- /**
855
- * Inject information into the 'update_plugins' site transient as WP checks that before running an update.
856
- *
857
- * @since 2.5.0
858
- *
859
- * @param array $plugins The plugin information for the plugins which are to be updated.
860
- */
861
- public function inject_update_info( $plugins ) {
862
- $repo_updates = get_site_transient( 'update_plugins' );
863
-
864
- if ( ! is_object( $repo_updates ) ) {
865
- $repo_updates = new stdClass;
866
- }
867
-
868
- foreach ( $plugins as $slug => $plugin ) {
869
- $file_path = $plugin['file_path'];
870
-
871
- if ( empty( $repo_updates->response[ $file_path ] ) ) {
872
- $repo_updates->response[ $file_path ] = new stdClass;
873
- }
874
-
875
- // We only really need to set package, but let's do all we can in case WP changes something.
876
- $repo_updates->response[ $file_path ]->slug = $slug;
877
- $repo_updates->response[ $file_path ]->plugin = $file_path;
878
- $repo_updates->response[ $file_path ]->new_version = $plugin['version'];
879
- $repo_updates->response[ $file_path ]->package = $plugin['source'];
880
- if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin['external_url'] ) ) {
881
- $repo_updates->response[ $file_path ]->url = $plugin['external_url'];
882
- }
883
- }
884
-
885
- set_site_transient( 'update_plugins', $repo_updates );
886
- }
887
-
888
- /**
889
- * Adjust the plugin directory name if necessary.
890
- *
891
- * The final destination directory of a plugin is based on the subdirectory name found in the
892
- * (un)zipped source. In some cases - most notably GitHub repository plugin downloads -, this
893
- * subdirectory name is not the same as the expected slug and the plugin will not be recognized
894
- * as installed. This is fixed by adjusting the temporary unzipped source subdirectory name to
895
- * the expected plugin slug.
896
- *
897
- * @since 2.5.0
898
- *
899
- * @param string $source Path to upgrade/zip-file-name.tmp/subdirectory/.
900
- * @param string $remote_source Path to upgrade/zip-file-name.tmp.
901
- * @param \WP_Upgrader $upgrader Instance of the upgrader which installs the plugin.
902
- * @return string $source
903
- */
904
- public function maybe_adjust_source_dir( $source, $remote_source, $upgrader ) {
905
- if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS['wp_filesystem'] ) ) {
906
- return $source;
907
- }
908
-
909
- // Check for single file plugins.
910
- $source_files = array_keys( $GLOBALS['wp_filesystem']->dirlist( $remote_source ) );
911
- if ( 1 === count( $source_files ) && false === $GLOBALS['wp_filesystem']->is_dir( $source ) ) {
912
- return $source;
913
- }
914
-
915
- // Multi-file plugin, let's see if the directory is correctly named.
916
- $desired_slug = '';
917
-
918
- // Figure out what the slug is supposed to be.
919
- if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options['extra']['slug'] ) ) {
920
- $desired_slug = $upgrader->skin->options['extra']['slug'];
921
- } else {
922
- // Bulk installer contains less info, so fall back on the info registered here.
923
- foreach ( $this->plugins as $slug => $plugin ) {
924
- if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) {
925
- $desired_slug = $slug;
926
- break;
927
- }
928
- }
929
- unset( $slug, $plugin );
930
- }
931
-
932
- if ( ! empty( $desired_slug ) ) {
933
- $subdir_name = untrailingslashit( str_replace( trailingslashit( $remote_source ), '', $source ) );
934
-
935
- if ( ! empty( $subdir_name ) && $subdir_name !== $desired_slug ) {
936
- $from = untrailingslashit( $source );
937
- $to = trailingslashit( $remote_source ) . $desired_slug;
938
-
939
- if ( true === $GLOBALS['wp_filesystem']->move( $from, $to ) ) {
940
- return trailingslashit( $to );
941
- } else {
942
- return new WP_Error( 'rename_failed', esc_html__( 'The remote plugin package does not contain a folder with the desired slug and renaming did not work.', 'weaver-xtreme' ) . ' ' . esc_html__( 'Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'weaver-xtreme' ), array( 'found' => $subdir_name, 'expected' => $desired_slug ) );
943
- }
944
- } elseif ( empty( $subdir_name ) ) {
945
- return new WP_Error( 'packaged_wrong', esc_html__( 'The remote plugin package consists of more than one file, but the files are not packaged in a folder.', 'weaver-xtreme' ) . ' ' . esc_html__( 'Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'weaver-xtreme' ), array( 'found' => $subdir_name, 'expected' => $desired_slug ) );
946
- }
947
- }
948
-
949
- return $source;
950
- }
951
-
952
- /**
953
- * Activate a single plugin and send feedback about the result to the screen.
954
- *
955
- * @since 2.5.0
956
- *
957
- * @param string $file_path Path within wp-plugins/ to main plugin file.
958
- * @param string $slug Plugin slug.
959
- * @param bool $automatic Whether this is an automatic activation after an install. Defaults to false.
960
- * This determines the styling of the output messages.
961
- * @return bool False if an error was encountered, true otherwise.
962
- */
963
- protected function activate_single_plugin( $file_path, $slug, $automatic = false ) {
964
- if ( $this->can_plugin_activate( $slug ) ) {
965
- $activate = activate_plugin( $file_path );
966
-
967
- if ( is_wp_error( $activate ) ) {
968
- echo '<div id="message" class="error"><p>', wp_kses_post( $activate->get_error_message() ), '</p></div>',
969
- '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>';
970
-
971
- return false; // End it here if there is an error with activation.
972
- } else {
973
- if ( ! $automatic ) {
974
- // Make sure message doesn't display again if bulk activation is performed
975
- // immediately after a single activation.
976
- if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK.
977
- echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>';
978
- }
979
- } else {
980
- // Simpler message layout for use on the plugin install page.
981
- echo '<p>', esc_html( $this->strings['plugin_activated'] ), '</p>';
982
- }
983
- }
984
- } elseif ( $this->is_plugin_active( $slug ) ) {
985
- // No simpler message format provided as this message should never be encountered
986
- // on the plugin install page.
987
- echo '<div id="message" class="error"><p>',
988
- sprintf(
989
- esc_html( $this->strings['plugin_already_active'] ),
990
- '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>'
991
- ),
992
- '</p></div>';
993
- } elseif ( $this->does_plugin_require_update( $slug ) ) {
994
- if ( ! $automatic ) {
995
- // Make sure message doesn't display again if bulk activation is performed
996
- // immediately after a single activation.
997
- if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK.
998
- echo '<div id="message" class="error"><p>',
999
- sprintf(
1000
- esc_html( $this->strings['plugin_needs_higher_version'] ),
1001
- '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>'
1002
- ),
1003
- '</p></div>';
1004
- }
1005
- } else {
1006
- // Simpler message layout for use on the plugin install page.
1007
- echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[ $slug ]['name'] ) ), '</p>';
1008
- }
1009
- }
1010
-
1011
- return true;
1012
- }
1013
-
1014
- /**
1015
- * Echoes required plugin notice.
1016
- *
1017
- * Outputs a message telling users that a specific plugin is required for
1018
- * their theme. If appropriate, it includes a link to the form page where
1019
- * users can install and activate the plugin.
1020
- *
1021
- * Returns early if we're on the Install page.
1022
- *
1023
- * @since 1.0.0
1024
- *
1025
- * @global object $current_screen
1026
- *
1027
- * @return null Returns early if we're on the Install page.
1028
- */
1029
- public function notices() {
1030
- // Remove nag on the install page / Return early if the nag message has been dismissed.
1031
- if ( $this->is_tgmpa_page() || get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) ) {
1032
- return;
1033
- }
1034
-
1035
- // Store for the plugin slugs by message type.
1036
- $message = array();
1037
-
1038
- // Initialize counters used to determine plurality of action link texts.
1039
- $install_link_count = 0;
1040
- $update_link_count = 0;
1041
- $activate_link_count = 0;
1042
-
1043
- foreach ( $this->plugins as $slug => $plugin ) {
1044
- if ( $this->is_plugin_active( $slug ) && false === $this->does_plugin_have_update( $slug ) ) {
1045
- continue;
1046
- }
1047
-
1048
- if ( ! $this->is_plugin_installed( $slug ) ) {
1049
- if ( current_user_can( 'install_plugins' ) ) {
1050
- $install_link_count++;
1051
-
1052
- if ( true === $plugin['required'] ) {
1053
- $message['notice_can_install_required'][] = $slug;
1054
- } else {
1055
- $message['notice_can_install_recommended'][] = $slug;
1056
- }
1057
- } else {
1058
- // Need higher privileges to install the plugin.
1059
- $message['notice_cannot_install'][] = $slug;
1060
- }
1061
- } else {
1062
- if ( ! $this->is_plugin_active( $slug ) && $this->can_plugin_activate( $slug ) ) {
1063
- if ( current_user_can( 'activate_plugins' ) ) {
1064
- $activate_link_count++;
1065
-
1066
- if ( true === $plugin['required'] ) {
1067
- $message['notice_can_activate_required'][] = $slug;
1068
- } else {
1069
- $message['notice_can_activate_recommended'][] = $slug;
1070
- }
1071
- } else {
1072
- // Need higher privileges to activate the plugin.
1073
- $message['notice_cannot_activate'][] = $slug;
1074
- }
1075
- }
1076
-
1077
- if ( $this->does_plugin_require_update( $slug ) || false !== $this->does_plugin_have_update( $slug ) ) {
1078
-
1079
- if ( current_user_can( 'install_plugins' ) ) {
1080
- $update_link_count++;
1081
-
1082
- if ( $this->does_plugin_require_update( $slug ) ) {
1083
- $message['notice_ask_to_update'][] = $slug;
1084
- } elseif ( false !== $this->does_plugin_have_update( $slug ) ) {
1085
- $message['notice_ask_to_update_maybe'][] = $slug;
1086
- }
1087
- } else {
1088
- // Need higher privileges to update the plugin.
1089
- $message['notice_cannot_update'][] = $slug;
1090
- }
1091
- }
1092
- }
1093
- }
1094
- unset( $slug, $plugin );
1095
-
1096
- // If we have notices to display, we move forward.
1097
- if ( ! empty( $message ) ) {
1098
- krsort( $message ); // Sort messages.
1099
- $rendered = '';
1100
-
1101
- // As add_settings_error() wraps the final message in a <p> and as the final message can't be
1102
- // filtered, using <p>'s in our html would render invalid html output.
1103
- $line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>' . "\n";
1104
-
1105
- // If dismissable is false and a message is set, output it now.
1106
- if ( ! $this->dismissable && ! empty( $this->dismiss_msg ) ) {
1107
- $rendered .= sprintf( $line_template, wp_kses_post( $this->dismiss_msg ) );
1108
- }
1109
-
1110
- // Render the individual message lines for the notice.
1111
- foreach ( $message as $type => $plugin_group ) {
1112
- $linked_plugins = array();
1113
-
1114
- // Get the external info link for a plugin if one is available.
1115
- foreach ( $plugin_group as $plugin_slug ) {
1116
- $linked_plugins[] = $this->get_info_link( $plugin_slug );
1117
- }
1118
- unset( $plugin_slug );
1119
-
1120
- $count = count( $plugin_group );
1121
- $linked_plugins = array_map( array( 'TGMPA_Utils', 'wrap_in_em' ), $linked_plugins );
1122
- $last_plugin = array_pop( $linked_plugins ); // Pop off last name to prep for readability.
1123
- $imploded = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'weaver-xtreme' ) . ' ' . $last_plugin );
1124
-
1125
- $rendered .= sprintf(
1126
- $line_template,
1127
- sprintf(
1128
- translate_nooped_plural( $this->strings[ $type ], $count, 'weaver-xtreme' ),
1129
- $imploded,
1130
- $count
1131
- )
1132
- );
1133
-
1134
- if ( 0 === strpos( $type, 'notice_cannot' ) ) {
1135
- $rendered .= $this->strings['contact_admin'];
1136
- }
1137
- }
1138
- unset( $type, $plugin_group, $linked_plugins, $count, $last_plugin, $imploded );
1139
-
1140
- // Setup action links.
1141
- $action_links = array(
1142
- 'install' => '',
1143
- 'update' => '',
1144
- 'activate' => '',
1145
- 'dismiss' => $this->dismissable ? '<a href="' . esc_url( add_query_arg( 'tgmpa-dismiss', 'dismiss_admin_notices' ) ) . '" class="dismiss-notice" target="_parent">' . esc_html( $this->strings['dismiss'] ) . '</a>' : '',
1146
- );
1147
-
1148
- $link_template = '<a href="%2$s">%1$s</a>';
1149
-
1150
- if ( current_user_can( 'install_plugins' ) ) {
1151
- if ( $install_link_count > 0 ) {
1152
- $action_links['install'] = sprintf(
1153
- $link_template,
1154
- translate_nooped_plural( $this->strings['install_link'], $install_link_count, 'weaver-xtreme' ),
1155
- esc_url( $this->get_tgmpa_status_url( 'install' ) )
1156
- );
1157
- }
1158
- if ( $update_link_count > 0 ) {
1159
- $action_links['update'] = sprintf(
1160
- $link_template,
1161
- translate_nooped_plural( $this->strings['update_link'], $update_link_count, 'weaver-xtreme' ),
1162
- esc_url( $this->get_tgmpa_status_url( 'update' ) )
1163
- );
1164
- }
1165
- }
1166
-
1167
- if ( current_user_can( 'activate_plugins' ) && $activate_link_count > 0 ) {
1168
- $action_links['activate'] = sprintf(
1169
- $link_template,
1170
- translate_nooped_plural( $this->strings['activate_link'], $activate_link_count, 'weaver-xtreme' ),
1171
- esc_url( $this->get_tgmpa_status_url( 'activate' ) )
1172
- );
1173
- }
1174
-
1175
- $action_links = apply_filters( 'tgmpa_notice_action_links', $action_links );
1176
-
1177
- $action_links = array_filter( (array) $action_links ); // Remove any empty array items.
1178
-
1179
- if ( ! empty( $action_links ) && is_array( $action_links ) ) {
1180
- $action_links = sprintf( $line_template, implode( ' | ', $action_links ) );
1181
- $rendered .= apply_filters( 'tgmpa_notice_rendered_action_links', $action_links );
1182
- }
1183
-
1184
- // Register the nag messages and prepare them to be processed.
1185
- if ( ! empty( $this->strings['nag_type'] ) ) {
1186
- add_settings_error( 'tgmpa','tgmpa', $rendered, sanitize_html_class( strtolower( $this->strings['nag_type'] ) ) );
1187
- } else {
1188
- $nag_class = version_compare( $this->wp_version, '3.8', '<' ) ? 'updated' : 'update-nag';
1189
- add_settings_error( 'tgmpa','tgmpa', $rendered, $nag_class );
1190
- }
1191
- }
1192
-
1193
- // Admin options pages already output settings_errors, so this is to avoid duplication.
1194
- if ( 'options-general' !== $GLOBALS['current_screen']->parent_base ) {
1195
- $this->display_settings_errors();
1196
- }
1197
- }
1198
-
1199
- /**
1200
- * Display settings errors and remove those which have been displayed to avoid duplicate messages showing
1201
- *
1202
- * @since 2.5.0
1203
- */
1204
- protected function display_settings_errors() {
1205
- global $wp_settings_errors;
1206
-
1207
- settings_errors( 'tgmpa' );
1208
-
1209
- foreach ( (array) $wp_settings_errors as $key => $details ) {
1210
- if ( 'tgmpa' === $details['setting'] ) {
1211
- unset( $wp_settings_errors[ $key ] );
1212
- break;
1213
- }
1214
- }
1215
- }
1216
-
1217
- /**
1218
- * Add dismissable admin notices.
1219
- *
1220
- * Appends a link to the admin nag messages. If clicked, the admin notice disappears and no longer is visible to users.
1221
- *
1222
- * @since 2.1.0
1223
- */
1224
- public function dismiss() {
1225
- if ( isset( $_GET['tgmpa-dismiss'] ) ) {
1226
- update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, 1 );
1227
- }
1228
- }
1229
-
1230
- /**
1231
- * Add individual plugin to our collection of plugins.
1232
- *
1233
- * If the required keys are not set or the plugin has already
1234
- * been registered, the plugin is not added.
1235
- *
1236
- * @since 2.0.0
1237
- *
1238
- * @param array|null $plugin Array of plugin arguments or null if invalid argument.
1239
- * @return null Return early if incorrect argument.
1240
- */
1241
- public function register( $plugin ) {
1242
- if ( empty( $plugin['slug'] ) || empty( $plugin['name'] ) ) {
1243
- return;
1244
- }
1245
-
1246
- if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[ $plugin['slug'] ] ) ) {
1247
- return;
1248
- }
1249
-
1250
- $defaults = array(
1251
- 'name' => '', // String
1252
- 'slug' => '', // String
1253
- 'source' => 'repo', // String
1254
- 'required' => false, // Boolean
1255
- 'version' => '', // String
1256
- 'force_activation' => false, // Boolean
1257
- 'force_deactivation' => false, // Boolean
1258
- 'external_url' => '', // String
1259
- 'is_callable' => '', // String|Array.
1260
- );
1261
-
1262
- // Prepare the received data.
1263
- $plugin = wp_parse_args( $plugin, $defaults );
1264
-
1265
- // Standardize the received slug.
1266
- $plugin['slug'] = $this->sanitize_key( $plugin['slug'] );
1267
-
1268
- // Forgive users for using string versions of booleans or floats for version number.
1269
- $plugin['version'] = (string) $plugin['version'];
1270
- $plugin['source'] = empty( $plugin['source'] ) ? 'repo' : $plugin['source'];
1271
- $plugin['required'] = TGMPA_Utils::validate_bool( $plugin['required'] );
1272
- $plugin['force_activation'] = TGMPA_Utils::validate_bool( $plugin['force_activation'] );
1273
- $plugin['force_deactivation'] = TGMPA_Utils::validate_bool( $plugin['force_deactivation'] );
1274
-
1275
- // Enrich the received data.
1276
- $plugin['file_path'] = $this->_get_plugin_basename_from_slug( $plugin['slug'] );
1277
- $plugin['source_type'] = $this->get_plugin_source_type( $plugin['source'] );
1278
-
1279
- // Set the class properties.
1280
- $this->plugins[ $plugin['slug'] ] = $plugin;
1281
- $this->sort_order[ $plugin['slug'] ] = $plugin['name'];
1282
-
1283
- // Should we add the force activation hook ?
1284
- if ( true === $plugin['force_activation'] ) {
1285
- $this->has_forced_activation = true;
1286
- }
1287
-
1288
- // Should we add the force deactivation hook ?
1289
- if ( true === $plugin['force_deactivation'] ) {
1290
- $this->has_forced_deactivation = true;
1291
- }
1292
- }
1293
-
1294
- /**
1295
- * Determine what type of source the plugin comes from.
1296
- *
1297
- * @since 2.5.0
1298
- *
1299
- * @param string $source The source of the plugin as provided, either empty (= WP repo), a file path
1300
- * (= bundled) or an external URL.
1301
- * @return string 'repo', 'external', or 'bundled'
1302
- */
1303
- protected function get_plugin_source_type( $source ) {
1304
- if ( 'repo' === $source || preg_match( self::WP_REPO_REGEX, $source ) ) {
1305
- return 'repo';
1306
- } elseif ( preg_match( self::IS_URL_REGEX, $source ) ) {
1307
- return 'external';
1308
- } else {
1309
- return 'bundled';
1310
- }
1311
- }
1312
-
1313
- /**
1314
- * Sanitizes a string key.
1315
- *
1316
- * Near duplicate of WP Core `sanitize_key()`. The difference is that uppercase characters *are*
1317
- * allowed, so as not to break upgrade paths from non-standard bundled plugins using uppercase
1318
- * characters in the plugin directory path/slug. Silly them.
1319
- *
1320
- * @see https://developer.wordpress.org/reference/hooks/sanitize_key/
1321
- *
1322
- * @since 2.5.0
1323
- *
1324
- * @param string $key String key.
1325
- * @return string Sanitized key
1326
- */
1327
- public function sanitize_key( $key ) {
1328
- $raw_key = $key;
1329
- $key = preg_replace( '`[^A-Za-z0-9_-]`', '', $key );
1330
-
1331
- /**
1332
- * Filter a sanitized key string.
1333
- *
1334
- * @since 3.0.0
1335
- *
1336
- * @param string $key Sanitized key.
1337
- * @param string $raw_key The key prior to sanitization.
1338
- */
1339
- return apply_filters( 'tgmpa_sanitize_key', $key, $raw_key );
1340
- }
1341
-
1342
- /**
1343
- * Amend default configuration settings.
1344
- *
1345
- * @since 2.0.0
1346
- *
1347
- * @param array $config Array of config options to pass as class properties.
1348
- */
1349
- public function config( $config ) {
1350
- $keys = array(
1351
- 'id',
1352
- 'default_path',
1353
- 'has_notices',
1354
- 'dismissable',
1355
- 'dismiss_msg',
1356
- 'menu',
1357
- 'parent_slug',
1358
- 'capability',
1359
- 'is_automatic',
1360
- 'message',
1361
- 'strings',
1362
- );
1363
-
1364
- foreach ( $keys as $key ) {
1365
- if ( isset( $config[ $key ] ) ) {
1366
- if ( is_array( $config[ $key ] ) ) {
1367
- $this->$key = array_merge( $this->$key, $config[ $key ] );
1368
- } else {
1369
- $this->$key = $config[ $key ];
1370
- }
1371
- }
1372
- }
1373
- }
1374
-
1375
- /**
1376
- * Amend action link after plugin installation.
1377
- *
1378
- * @since 2.0.0
1379
- *
1380
- * @param array $install_actions Existing array of actions.
1381
- * @return array Amended array of actions.
1382
- */
1383
- public function actions( $install_actions ) {
1384
- // Remove action links on the TGMPA install page.
1385
- if ( $this->is_tgmpa_page() ) {
1386
- return false;
1387
- }
1388
-
1389
- return $install_actions;
1390
- }
1391
-
1392
- /**
1393
- * Flushes the plugins cache on theme switch to prevent stale entries
1394
- * from remaining in the plugin table.
1395
- *
1396
- * @since 2.4.0
1397
- *
1398
- * @param bool $clear_update_cache Optional. Whether to clear the Plugin updates cache.
1399
- * Parameter added in v2.5.0.
1400
- */
1401
- public function flush_plugins_cache( $clear_update_cache = true ) {
1402
- wp_clean_plugins_cache( $clear_update_cache );
1403
- }
1404
-
1405
- /**
1406
- * Set file_path key for each installed plugin.
1407
- *
1408
- * @since 2.1.0
1409
- *
1410
- * @param string $plugin_slug Optional. If set, only (re-)populates the file path for that specific plugin.
1411
- * Parameter added in v2.5.0.
1412
- */
1413
- public function populate_file_path( $plugin_slug = '' ) {
1414
- if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) {
1415
- $this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug );
1416
- } else {
1417
- // Add file_path key for all plugins.
1418
- foreach ( $this->plugins as $slug => $values ) {
1419
- $this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug );
1420
- }
1421
- }
1422
- }
1423
-
1424
- /**
1425
- * Helper function to extract the file path of the plugin file from the
1426
- * plugin slug, if the plugin is installed.
1427
- *
1428
- * @since 2.0.0
1429
- *
1430
- * @param string $slug Plugin slug (typically folder name) as provided by the developer.
1431
- * @return string Either file path for plugin if installed, or just the plugin slug.
1432
- */
1433
- protected function _get_plugin_basename_from_slug( $slug ) {
1434
- $keys = array_keys( $this->get_plugins() );
1435
-
1436
- foreach ( $keys as $key ) {
1437
- if ( preg_match( '|^' . $slug . '/|', $key ) ) {
1438
- return $key;
1439
- }
1440
- }
1441
-
1442
- return $slug;
1443
- }
1444
-
1445
- /**
1446
- * Retrieve plugin data, given the plugin name.
1447
- *
1448
- * Loops through the registered plugins looking for $name. If it finds it,
1449
- * it returns the $data from that plugin. Otherwise, returns false.
1450
- *
1451
- * @since 2.1.0
1452
- *
1453
- * @param string $name Name of the plugin, as it was registered.
1454
- * @param string $data Optional. Array key of plugin data to return. Default is slug.
1455
- * @return string|boolean Plugin slug if found, false otherwise.
1456
- */
1457
- public function _get_plugin_data_from_name( $name, $data = 'slug' ) {
1458
- foreach ( $this->plugins as $values ) {
1459
- if ( $name === $values['name'] && isset( $values[ $data ] ) ) {
1460
- return $values[ $data ];
1461
- }
1462
- }
1463
-
1464
- return false;
1465
- }
1466
-
1467
- /**
1468
- * Retrieve the download URL for a package.
1469
- *
1470
- * @since 2.5.0
1471
- *
1472
- * @param string $slug Plugin slug.
1473
- * @return string Plugin download URL or path to local file or empty string if undetermined.
1474
- */
1475
- public function get_download_url( $slug ) {
1476
- $dl_source = '';
1477
-
1478
- switch ( $this->plugins[ $slug ]['source_type'] ) {
1479
- case 'repo':
1480
- return $this->get_wp_repo_download_url( $slug );
1481
- case 'external':
1482
- return $this->plugins[ $slug ]['source'];
1483
- case 'bundled':
1484
- return $this->default_path . $this->plugins[ $slug ]['source'];
1485
- }
1486
-
1487
- return $dl_source; // Should never happen.
1488
- }
1489
-
1490
- /**
1491
- * Retrieve the download URL for a WP repo package.
1492
- *
1493
- * @since 2.5.0
1494
- *
1495
- * @param string $slug Plugin slug.
1496
- * @return string Plugin download URL.
1497
- */
1498
- protected function get_wp_repo_download_url( $slug ) {
1499
- $source = '';
1500
- $api = $this->get_plugins_api( $slug );
1501
-
1502
- if ( false !== $api && isset( $api->download_link ) ) {
1503
- $source = $api->download_link;
1504
- }
1505
-
1506
- return $source;
1507
- }
1508
-
1509
- /**
1510
- * Try to grab information from WordPress API.
1511
- *
1512
- * @since 2.5.0
1513
- *
1514
- * @param string $slug Plugin slug.
1515
- * @return object Plugins_api response object on success, WP_Error on failure.
1516
- */
1517
- protected function get_plugins_api( $slug ) {
1518
- static $api = array(); // Cache received responses.
1519
-
1520
- if ( ! isset( $api[ $slug ] ) ) {
1521
- if ( ! function_exists( 'plugins_api' ) ) {
1522
- require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
1523
- }
1524
-
1525
- $response = plugins_api( 'plugin_information', array( 'slug' => $slug, 'fields' => array( 'sections' => false ) ) );
1526
-
1527
- $api[ $slug ] = false;
1528
-
1529
- if ( is_wp_error( $response ) ) {
1530
- wp_die( esc_html( $this->strings['oops'] ) );
1531
- } else {
1532
- $api[ $slug ] = $response;
1533
- }
1534
- }
1535
-
1536
- return $api[ $slug ];
1537
- }
1538
-
1539
- /**
1540
- * Retrieve a link to a plugin information page.
1541
- *
1542
- * @since 2.5.0
1543
- *
1544
- * @param string $slug Plugin slug.
1545
- * @return string Fully formed html link to a plugin information page if available
1546
- * or the plugin name if not.
1547
- */
1548
- public function get_info_link( $slug ) {
1549
- if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) {
1550
- $link = sprintf(
1551
- '<a href="%1$s" target="_blank">%2$s</a>',
1552
- esc_url( $this->plugins[ $slug ]['external_url'] ),
1553
- esc_html( $this->plugins[ $slug ]['name'] )
1554
- );
1555
- } elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) {
1556
- $url = add_query_arg(
1557
- array(
1558
- 'tab' => 'plugin-information',
1559
- 'plugin' => urlencode( $slug ),
1560
- 'TB_iframe' => 'true',
1561
- 'width' => '640',
1562
- 'height' => '500',
1563
- ),
1564
- self_admin_url( 'plugin-install.php' )
1565
- );
1566
-
1567
- $link = sprintf(
1568
- '<a href="%1$s" class="thickbox">%2$s</a>',
1569
- esc_url( $url ),
1570
- esc_html( $this->plugins[ $slug ]['name'] )
1571
- );
1572
- } else {
1573
- $link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink.
1574
- }
1575
-
1576
- return $link;
1577
- }
1578
-
1579
- /**
1580
- * Determine if we're on the TGMPA Install page.
1581
- *
1582
- * @since 2.1.0
1583
- *
1584
- * @return boolean True when on the TGMPA page, false otherwise.
1585
- */
1586
- protected function is_tgmpa_page() {
1587
- return isset( $_GET['page'] ) && $this->menu === $_GET['page'];
1588
- }
1589
-
1590
- /**
1591
- * Retrieve the URL to the TGMPA Install page.
1592
- *
1593
- * I.e. depending on the config settings passed something along the lines of:
1594
- * http://example.com/wp-admin/themes.php?page=tgmpa-install-plugins
1595
- *
1596
- * @since 2.5.0
1597
- *
1598
- * @return string Properly encoded URL (not escaped).
1599
- */
1600
- public function get_tgmpa_url() {
1601
- static $url;
1602
-
1603
- if ( ! isset( $url ) ) {
1604
- $parent = $this->parent_slug;
1605
- if ( false === strpos( $parent, '.php' ) ) {
1606
- $parent = 'admin.php';
1607
- }
1608
- $url = add_query_arg(
1609
- array(
1610
- 'page' => urlencode( $this->menu ),
1611
- ),
1612
- self_admin_url( $parent )
1613
- );
1614
- }
1615
-
1616
- return $url;
1617
- }
1618
-
1619
- /**
1620
- * Retrieve the URL to the TGMPA Install page for a specific plugin status (view).
1621
- *
1622
- * I.e. depending on the config settings passed something along the lines of:
1623
- * http://example.com/wp-admin/themes.php?page=tgmpa-install-plugins&plugin_status=install
1624
- *
1625
- * @since 2.5.0
1626
- *
1627
- * @param string $status Plugin status - either 'install', 'update' or 'activate'.
1628
- * @return string Properly encoded URL (not escaped).
1629
- */
1630
- public function get_tgmpa_status_url( $status ) {
1631
- return add_query_arg(
1632
- array(
1633
- 'plugin_status' => urlencode( $status ),
1634
- ),
1635
- $this->get_tgmpa_url()
1636
- );
1637
- }
1638
-
1639
- /**
1640
- * Determine whether there are open actions for plugins registered with TGMPA.
1641
- *
1642
- * @since 2.5.0
1643
- *
1644
- * @return bool True if complete, i.e. no outstanding actions. False otherwise.
1645
- */
1646
- public function is_tgmpa_complete() {
1647
- $complete = true;
1648
- foreach ( $this->plugins as $slug => $plugin ) {
1649
- if ( ! $this->is_plugin_active( $slug ) || false !== $this->does_plugin_have_update( $slug ) ) {
1650
- $complete = false;
1651
- break;
1652
- }
1653
- }
1654
-
1655
- return $complete;
1656
- }
1657
-
1658
- /**
1659
- * Check if a plugin is installed. Does not take must-use plugins into account.
1660
- *
1661
- * @since 2.5.0
1662
- *
1663
- * @param string $slug Plugin slug.
1664
- * @return bool True if installed, false otherwise.
1665
- */
1666
- public function is_plugin_installed( $slug ) {
1667
- $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached).
1668
-
1669
- return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) );
1670
- }
1671
-
1672
- /**
1673
- * Check if a plugin is active.
1674
- *
1675
- * @since 2.5.0
1676
- *
1677
- * @param string $slug Plugin slug.
1678
- * @return bool True if active, false otherwise.
1679
- */
1680
- public function is_plugin_active( $slug ) {
1681
- return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) );
1682
- }
1683
-
1684
- /**
1685
- * Check if a plugin can be updated, i.e. if we have information on the minimum WP version required
1686
- * available, check whether the current install meets them.
1687
- *
1688
- * @since 2.5.0
1689
- *
1690
- * @param string $slug Plugin slug.
1691
- * @return bool True if OK to update, false otherwise.
1692
- */
1693
- public function can_plugin_update( $slug ) {
1694
- // We currently can't get reliable info on non-WP-repo plugins - issue #380.
1695
- if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
1696
- return true;
1697
- }
1698
-
1699
- $api = $this->get_plugins_api( $slug );
1700
-
1701
- if ( false !== $api && isset( $api->requires ) ) {
1702
- return version_compare( $GLOBALS['wp_version'], $api->requires, '>=' );
1703
- }
1704
-
1705
- // No usable info received from the plugins API, presume we can update.
1706
- return true;
1707
- }
1708
-
1709
- /**
1710
- * Check if a plugin can be activated, i.e. is not currently active and meets the minimum
1711
- * plugin version requirements set in TGMPA (if any).
1712
- *
1713
- * @since 2.5.0
1714
- *
1715
- * @param string $slug Plugin slug.
1716
- * @return bool True if OK to activate, false otherwise.
1717
- */
1718
- public function can_plugin_activate( $slug ) {
1719
- return ( ! $this->is_plugin_active( $slug ) && ! $this->does_plugin_require_update( $slug ) );
1720
- }
1721
-
1722
- /**
1723
- * Retrieve the version number of an installed plugin.
1724
- *
1725
- * @since 2.5.0
1726
- *
1727
- * @param string $slug Plugin slug.
1728
- * @return string Version number as string or an empty string if the plugin is not installed
1729
- * or version unknown (plugins which don't comply with the plugin header standard).
1730
- */
1731
- public function get_installed_version( $slug ) {
1732
- $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached).
1733
-
1734
- if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) {
1735
- return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'];
1736
- }
1737
-
1738
- return '';
1739
- }
1740
-
1741
- /**
1742
- * Check whether a plugin complies with the minimum version requirements.
1743
- *
1744
- * @since 2.5.0
1745
- *
1746
- * @param string $slug Plugin slug.
1747
- * @return bool True when a plugin needs to be updated, otherwise false.
1748
- */
1749
- public function does_plugin_require_update( $slug ) {
1750
- $installed_version = $this->get_installed_version( $slug );
1751
- $minimum_version = $this->plugins[ $slug ]['version'];
1752
-
1753
- return version_compare( $minimum_version, $installed_version, '>' );
1754
- }
1755
-
1756
- /**
1757
- * Check whether there is an update available for a plugin.
1758
- *
1759
- * @since 2.5.0
1760
- *
1761
- * @param string $slug Plugin slug.
1762
- * @return false|string Version number string of the available update or false if no update available.
1763
- */
1764
- public function does_plugin_have_update( $slug ) {
1765
- // Presume bundled and external plugins will point to a package which meets the minimum required version.
1766
- if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
1767
- if ( $this->does_plugin_require_update( $slug ) ) {
1768
- return $this->plugins[ $slug ]['version'];
1769
- }
1770
-
1771
- return false;
1772
- }
1773
-
1774
- $repo_updates = get_site_transient( 'update_plugins' );
1775
-
1776
- if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) {
1777
- return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version;
1778
- }
1779
-
1780
- return false;
1781
- }
1782
-
1783
- /**
1784
- * Retrieve potential upgrade notice for a plugin.
1785
- *
1786
- * @since 2.5.0
1787
- *
1788
- * @param string $slug Plugin slug.
1789
- * @return string The upgrade notice or an empty string if no message was available or provided.
1790
- */
1791
- public function get_upgrade_notice( $slug ) {
1792
- // We currently can't get reliable info on non-WP-repo plugins - issue #380.
1793
- if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
1794
- return '';
1795
- }
1796
-
1797
- $repo_updates = get_site_transient( 'update_plugins' );
1798
-
1799
- if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) {
1800
- return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice;
1801
- }
1802
-
1803
- return '';
1804
- }
1805
-
1806
- /**
1807
- * Wrapper around the core WP get_plugins function, making sure it's actually available.
1808
- *
1809
- * @since 2.5.0
1810
- *
1811
- * @param string $plugin_folder Optional. Relative path to single plugin folder.
1812
- * @return array Array of installed plugins with plugin information.
1813
- */
1814
- public function get_plugins( $plugin_folder = '' ) {
1815
- if ( ! function_exists( 'get_plugins' ) ) {
1816
- require_once ABSPATH . 'wp-admin/includes/plugin.php';
1817
- }
1818
-
1819
- return get_plugins( $plugin_folder );
1820
- }
1821
-
1822
- /**
1823
- * Delete dismissable nag option when theme is switched.
1824
- *
1825
- * This ensures that the user(s) is/are again reminded via nag of required
1826
- * and/or recommended plugins if they re-activate the theme.
1827
- *
1828
- * @since 2.1.1
1829
- */
1830
- public function update_dismiss() {
1831
- delete_metadata( 'user', null, 'tgmpa_dismissed_notice_' . $this->id, null, true );
1832
- }
1833
-
1834
- /**
1835
- * Forces plugin activation if the parameter 'force_activation' is
1836
- * set to true.
1837
- *
1838
- * This allows theme authors to specify certain plugins that must be
1839
- * active at all times while using the current theme.
1840
- *
1841
- * Please take special care when using this parameter as it has the
1842
- * potential to be harmful if not used correctly. Setting this parameter
1843
- * to true will not allow the specified plugin to be deactivated unless
1844
- * the user switches themes.
1845
- *
1846
- * @since 2.2.0
1847
- */
1848
- public function force_activation() {
1849
- foreach ( $this->plugins as $slug => $plugin ) {
1850
- if ( true === $plugin['force_activation'] ) {
1851
- if ( ! $this->is_plugin_installed( $slug ) ) {
1852
- // Oops, plugin isn't there so iterate to next condition.
1853
- continue;
1854
- } elseif ( $this->can_plugin_activate( $slug ) ) {
1855
- // There we go, activate the plugin.
1856
- activate_plugin( $plugin['file_path'] );
1857
- }
1858
- }
1859
- }
1860
- }
1861
-
1862
- /**
1863
- * Forces plugin deactivation if the parameter 'force_deactivation'
1864
- * is set to true.
1865
- *
1866
- * This allows theme authors to specify certain plugins that must be
1867
- * deactivated upon switching from the current theme to another.
1868
- *
1869
- * Please take special care when using this parameter as it has the
1870
- * potential to be harmful if not used correctly.
1871
- *
1872
- * @since 2.2.0
1873
- */
1874
- public function force_deactivation() {
1875
- foreach ( $this->plugins as $slug => $plugin ) {
1876
- // Only proceed forward if the parameter is set to true and plugin is active.
1877
- if ( true === $plugin['force_deactivation'] && $this->is_plugin_active( $slug ) ) {
1878
- deactivate_plugins( $plugin['file_path'] );
1879
- }
1880
- }
1881
- }
1882
-
1883
- /**
1884
- * Echo the current TGMPA version number to the page.
1885
- */
1886
- public function show_tgmpa_version() {
1887
- echo '<p style="float: right; padding: 0em 1.5em 0.5em 0;"><strong><small>',
1888
- esc_html( sprintf( _x( 'TGMPA v%s', '%s = version number', 'weaver-xtreme' ), self::TGMPA_VERSION ) ),
1889
- '</small></strong></p>';
1890
- }
1891
-
1892
- /**
1893
- * Returns the singleton instance of the class.
1894
- *
1895
- * @since 2.4.0
1896
- *
1897
- * @return object The TGM_Plugin_Activation object.
1898
- */
1899
- public static function get_instance() {
1900
- if ( ! isset( self::$instance ) && ! ( self::$instance instanceof self ) ) {
1901
- self::$instance = new self();
1902
- }
1903
-
1904
- return self::$instance;
1905
- }
1906
- }
1907
-
1908
- if ( ! function_exists( 'load_tgm_plugin_activation' ) ) {
1909
- /**
1910
- * Ensure only one instance of the class is ever invoked.
1911
- */
1912
- function load_tgm_plugin_activation() {
1913
- $GLOBALS['tgmpa'] = TGM_Plugin_Activation::get_instance();
1914
- }
1915
- }
1916
-
1917
- if ( did_action( 'plugins_loaded' ) ) {
1918
- load_tgm_plugin_activation();
1919
- } else {
1920
- add_action( 'plugins_loaded', 'load_tgm_plugin_activation' );
1921
- }
1922
- }
1923
-
1924
- if ( ! function_exists( 'tgmpa' ) ) {
1925
- /**
1926
- * Helper function to register a collection of required plugins.
1927
- *
1928
- * @since 2.0.0
1929
- * @api
1930
- *
1931
- * @param array $plugins An array of plugin arrays.
1932
- * @param array $config Optional. An array of configuration values.
1933
- */
1934
- function tgmpa( $plugins, $config = array() ) {
1935
- $instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) );
1936
-
1937
- foreach ( $plugins as $plugin ) {
1938
- call_user_func( array( $instance, 'register' ), $plugin );
1939
- }
1940
-
1941
- if ( ! empty( $config ) && is_array( $config ) ) {
1942
- // Send out notices for deprecated arguments passed.
1943
- if ( isset( $config['notices'] ) ) {
1944
- _deprecated_argument( __FUNCTION__, '2.2.0', 'The `notices` config parameter was renamed to `has_notices` in TGMPA 2.2.0. Please adjust your configuration.' );
1945
- if ( ! isset( $config['has_notices'] ) ) {
1946
- $config['has_notices'] = $config['notices'];
1947
- }
1948
- }
1949
-
1950
- if ( isset( $config['parent_menu_slug'] ) ) {
1951
- _deprecated_argument( __FUNCTION__, '2.4.0', 'The `parent_menu_slug` config parameter was removed in TGMPA 2.4.0. In TGMPA 2.5.0 an alternative was (re-)introduced. Please adjust your configuration. For more information visit the website: http://tgmpluginactivation.com/configuration/#h-configuration-options.' );
1952
- }
1953
- if ( isset( $config['parent_url_slug'] ) ) {
1954
- _deprecated_argument( __FUNCTION__, '2.4.0', 'The `parent_url_slug` config parameter was removed in TGMPA 2.4.0. In TGMPA 2.5.0 an alternative was (re-)introduced. Please adjust your configuration. For more information visit the website: http://tgmpluginactivation.com/configuration/#h-configuration-options.' );
1955
- }
1956
-
1957
- call_user_func( array( $instance, 'config' ), $config );
1958
- }
1959
- }
1960
- }
1961
-
1962
- /**
1963
- * WP_List_Table isn't always available. If it isn't available,
1964
- * we load it here.
1965
- *
1966
- * @since 2.2.0
1967
- */
1968
- if ( ! class_exists( 'WP_List_Table' ) ) {
1969
- require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
1970
- }
1971
-
1972
- if ( ! class_exists( 'TGMPA_List_Table' ) ) {
1973
-
1974
- /**
1975
- * List table class for handling plugins.
1976
- *
1977
- * Extends the WP_List_Table class to provide a future-compatible
1978
- * way of listing out all required/recommended plugins.
1979
- *
1980
- * Gives users an interface similar to the Plugin Administration
1981
- * area with similar (albeit stripped down) capabilities.
1982
- *
1983
- * This class also allows for the bulk install of plugins.
1984
- *
1985
- * @since 2.2.0
1986
- *
1987
- * @package TGM-Plugin-Activation
1988
- * @author Thomas Griffin
1989
- * @author Gary Jones
1990
- */
1991
- class TGMPA_List_Table extends WP_List_Table {
1992
- /**
1993
- * TGMPA instance.
1994
- *
1995
- * @since 2.5.0
1996
- *
1997
- * @var object
1998
- */
1999
- protected $tgmpa;
2000
-
2001
- /**
2002
- * The currently chosen view.
2003
- *
2004
- * @since 2.5.0
2005
- *
2006
- * @var string One of: 'all', 'install', 'update', 'activate'
2007
- */
2008
- public $view_context = 'all';
2009
-
2010
- /**
2011
- * The plugin counts for the various views.
2012
- *
2013
- * @since 2.5.0
2014
- *
2015
- * @var array
2016
- */
2017
- protected $view_totals = array(
2018
- 'all' => 0,
2019
- 'install' => 0,
2020
- 'update' => 0,
2021
- 'activate' => 0,
2022
- );
2023
-
2024
- /**
2025
- * References parent constructor and sets defaults for class.
2026
- *
2027
- * @since 2.2.0
2028
- */
2029
- public function __construct() {
2030
- $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) );
2031
-
2032
- parent::__construct(
2033
- array(
2034
- 'singular' => 'plugin',
2035
- 'plural' => 'plugins',
2036
- 'ajax' => false,
2037
- )
2038
- );
2039
-
2040
- if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'install', 'update', 'activate' ), true ) ) {
2041
- $this->view_context = sanitize_key( $_REQUEST['plugin_status'] );
2042
- }
2043
-
2044
- add_filter( 'tgmpa_table_data_items', array( $this, 'sort_table_items' ) );
2045
- }
2046
-
2047
- /**
2048
- * Get a list of CSS classes for the <table> tag.
2049
- *
2050
- * Overruled to prevent the 'plural' argument from being added.
2051
- *
2052
- * @since 2.5.0
2053
- *
2054
- * @return array CSS classnames.
2055
- */
2056
- public function get_table_classes() {
2057
- return array( 'widefat', 'fixed' );
2058
- }
2059
-
2060
- /**
2061
- * Gathers and renames all of our plugin information to be used by WP_List_Table to create our table.
2062
- *
2063
- * @since 2.2.0
2064
- *
2065
- * @return array $table_data Information for use in table.
2066
- */
2067
- protected function _gather_plugin_data() {
2068
- // Load thickbox for plugin links.
2069
- $this->tgmpa->admin_init();
2070
- $this->tgmpa->thickbox();
2071
-
2072
- // Categorize the plugins which have open actions.
2073
- $plugins = $this->categorize_plugins_to_views();
2074
-
2075
- // Set the counts for the view links.
2076
- $this->set_view_totals( $plugins );
2077
-
2078
- // Prep variables for use and grab list of all installed plugins.
2079
- $table_data = array();
2080
- $i = 0;
2081
-
2082
- // Redirect to the 'all' view if no plugins were found for the selected view context.
2083
- if ( empty( $plugins[ $this->view_context ] ) ) {
2084
- $this->view_context = 'all';
2085
- }
2086
-
2087
- foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) {
2088
- $table_data[ $i ]['sanitized_plugin'] = $plugin['name'];
2089
- $table_data[ $i ]['slug'] = $slug;
2090
- $table_data[ $i ]['plugin'] = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>';
2091
- $table_data[ $i ]['source'] = $this->get_plugin_source_type_text( $plugin['source_type'] );
2092
- $table_data[ $i ]['type'] = $this->get_plugin_advise_type_text( $plugin['required'] );
2093
- $table_data[ $i ]['status'] = $this->get_plugin_status_text( $slug );
2094
- $table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug );
2095
- $table_data[ $i ]['minimum_version'] = $plugin['version'];
2096
- $table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug );
2097
-
2098
- // Prep the upgrade notice info.
2099
- $upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug );
2100
- if ( ! empty( $upgrade_notice ) ) {
2101
- $table_data[ $i ]['upgrade_notice'] = $upgrade_notice;
2102
-
2103
- add_action( "tgmpa_after_plugin_row_$slug", array( $this, 'wp_plugin_update_row' ), 10, 2 );
2104
- }
2105
-
2106
- $table_data[ $i ] = apply_filters( 'tgmpa_table_data_item', $table_data[ $i ], $plugin );
2107
-
2108
- $i++;
2109
- }
2110
-
2111
- return $table_data;
2112
- }
2113
-
2114
- /**
2115
- * Categorize the plugins which have open actions into views for the TGMPA page.
2116
- *
2117
- * @since 2.5.0
2118
- */
2119
- protected function categorize_plugins_to_views() {
2120
- $plugins = array(
2121
- 'all' => array(), // Meaning: all plugins which still have open actions.
2122
- 'install' => array(),
2123
- 'update' => array(),
2124
- 'activate' => array(),
2125
- );
2126
-
2127
- foreach ( $this->tgmpa->plugins as $slug => $plugin ) {
2128
- if ( $this->tgmpa->is_plugin_active( $slug ) && false === $this->tgmpa->does_plugin_have_update( $slug ) ) {
2129
- // No need to display plugins if they are installed, up-to-date and active.
2130
- continue;
2131
- } else {
2132
- $plugins['all'][ $slug ] = $plugin;
2133
-
2134
- if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) {
2135
- $plugins['install'][ $slug ] = $plugin;
2136
- } else {
2137
- if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) {
2138
- $plugins['update'][ $slug ] = $plugin;
2139
- }
2140
-
2141
- if ( $this->tgmpa->can_plugin_activate( $slug ) ) {
2142
- $plugins['activate'][ $slug ] = $plugin;
2143
- }
2144
- }
2145
- }
2146
- }
2147
-
2148
- return $plugins;
2149
- }
2150
-
2151
- /**
2152
- * Set the counts for the view links.
2153
- *
2154
- * @since 2.5.0
2155
- *
2156
- * @param array $plugins Plugins order by view.
2157
- */
2158
- protected function set_view_totals( $plugins ) {
2159
- foreach ( $plugins as $type => $list ) {
2160
- $this->view_totals[ $type ] = count( $list );
2161
- }
2162
- }
2163
-
2164
- /**
2165
- * Get the plugin required/recommended text string.
2166
- *
2167
- * @since 2.5.0
2168
- *
2169
- * @param string $required Plugin required setting.
2170
- * @return string
2171
- */
2172
- protected function get_plugin_advise_type_text( $required ) {
2173
- if ( true === $required ) {
2174
- return __( 'Required', 'weaver-xtreme' );
2175
- }
2176
-
2177
- return __( 'Recommended', 'weaver-xtreme' );
2178
- }
2179
-
2180
- /**
2181
- * Get the plugin source type text string.
2182
- *
2183
- * @since 2.5.0
2184
- *
2185
- * @param string $type Plugin type.
2186
- * @return string
2187
- */
2188
- protected function get_plugin_source_type_text( $type ) {
2189
- $string = '';
2190
-
2191
- switch ( $type ) {
2192
- case 'repo':
2193
- $string = __( 'WordPress Repository', 'weaver-xtreme' );
2194
- break;
2195
- case 'external':
2196
- $string = __( 'External Source', 'weaver-xtreme' );
2197
- break;
2198
- case 'bundled':
2199
- $string = __( 'Pre-Packaged', 'weaver-xtreme' );
2200
- break;
2201
- }
2202
-
2203
- return $string;
2204
- }
2205
-
2206
- /**
2207
- * Determine the plugin status message.
2208
- *
2209
- * @since 2.5.0
2210
- *
2211
- * @param string $slug Plugin slug.
2212
- * @return string
2213
- */
2214
- protected function get_plugin_status_text( $slug ) {
2215
- if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) {
2216
- return __( 'Not Installed', 'weaver-xtreme' );
2217
- }
2218
-
2219
- if ( ! $this->tgmpa->is_plugin_active( $slug ) ) {
2220
- $install_status = __( 'Installed But Not Activated', 'weaver-xtreme' );
2221
- } else {
2222
- $install_status = __( 'Active', 'weaver-xtreme' );
2223
- }
2224
-
2225
- $update_status = '';
2226
-
2227
- if ( $this->tgmpa->does_plugin_require_update( $slug ) && false === $this->tgmpa->does_plugin_have_update( $slug ) ) {
2228
- $update_status = __( 'Required Update not Available', 'weaver-xtreme' );
2229
-
2230
- } elseif ( $this->tgmpa->does_plugin_require_update( $slug ) ) {
2231
- $update_status = __( 'Requires Update', 'weaver-xtreme' );
2232
-
2233
- } elseif ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) {
2234
- $update_status = __( 'Update recommended', 'weaver-xtreme' );
2235
- }
2236
-
2237
- if ( '' === $update_status ) {
2238
- return $install_status;
2239
- }
2240
-
2241
- return sprintf(
2242
- _x( '%1$s, %2$s', '%1$s = install status, %2$s = update status', 'weaver-xtreme' ),
2243
- $install_status,
2244
- $update_status
2245
- );
2246
- }
2247
-
2248
- /**
2249
- * Sort plugins by Required/Recommended type and by alphabetical plugin name within each type.
2250
- *
2251
- * @since 2.5.0
2252
- *
2253
- * @param array $items Prepared table items.
2254
- * @return array Sorted table items.
2255
- */
2256
- public function sort_table_items( $items ) {
2257
- $type = array();
2258
- $name = array();
2259
-
2260
- foreach ( $items as $i => $plugin ) {
2261
- $type[ $i ] = $plugin['type']; // Required / recommended.
2262
- $name[ $i ] = $plugin['sanitized_plugin'];
2263
- }
2264
-
2265
- array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items );
2266
-
2267
- return $items;
2268
- }
2269
-
2270
- /**
2271
- * Get an associative array ( id => link ) of the views available on this table.
2272
- *
2273
- * @since 2.5.0
2274
- *
2275
- * @return array
2276
- */
2277
- public function get_views() {
2278
- $status_links = array();
2279
-
2280
- foreach ( $this->view_totals as $type => $count ) {
2281
- if ( $count < 1 ) {
2282
- continue;
2283
- }
2284
-
2285
- switch ( $type ) {
2286
- case 'all':
2287
- $text = _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'plugins', 'weaver-xtreme' );
2288
- break;
2289
- case 'install':
2290
- $text = _n( 'To Install <span class="count">(%s)</span>', 'To Install <span class="count">(%s)</span>', $count, 'weaver-xtreme' );
2291
- break;
2292
- case 'update':
2293
- $text = _n( 'Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', $count, 'weaver-xtreme' );
2294
- break;
2295
- case 'activate':
2296
- $text = _n( 'To Activate <span class="count">(%s)</span>', 'To Activate <span class="count">(%s)</span>', $count, 'weaver-xtreme' );
2297
- break;
2298
- default:
2299
- $text = '';
2300
- break;
2301
- }
2302
-
2303
- if ( ! empty( $text ) ) {
2304
-
2305
- $status_links[ $type ] = sprintf(
2306
- '<a href="%s"%s>%s</a>',
2307
- esc_url( $this->tgmpa->get_tgmpa_status_url( $type ) ),
2308
- ( $type === $this->view_context ) ? ' class="current"' : '',
2309
- sprintf( $text, number_format_i18n( $count ) )
2310
- );
2311
- }
2312
- }
2313
-
2314
- return $status_links;
2315
- }
2316
-
2317
- /**
2318
- * Create default columns to display important plugin information
2319
- * like type, action and status.
2320
- *
2321
- * @since 2.2.0
2322
- *
2323
- * @param array $item Array of item data.
2324
- * @param string $column_name The name of the column.
2325
- * @return string
2326
- */
2327
- public function column_default( $item, $column_name ) {
2328
- return $item[ $column_name ];
2329
- }
2330
-
2331
- /**
2332
- * Required for bulk installing.
2333
- *
2334
- * Adds a checkbox for each plugin.
2335
- *
2336
- * @since 2.2.0
2337
- *
2338
- * @param array $item Array of item data.
2339
- * @return string The input checkbox with all necessary info.
2340
- */
2341
- public function column_cb( $item ) {
2342
- return sprintf(
2343
- '<input type="checkbox" name="%1$s[]" value="%2$s" id="%3$s" />',
2344
- esc_attr( $this->_args['singular'] ),
2345
- esc_attr( $item['slug'] ),
2346
- esc_attr( $item['sanitized_plugin'] )
2347
- );
2348
- }
2349
-
2350
- /**
2351
- * Create default title column along with the action links.
2352
- *
2353
- * @since 2.2.0
2354
- *
2355
- * @param array $item Array of item data.
2356
- * @return string The plugin name and action links.
2357
- */
2358
- public function column_plugin( $item ) {
2359
- return sprintf(
2360
- '%1$s %2$s',
2361
- $item['plugin'],
2362
- $this->row_actions( $this->get_row_actions( $item ), true )
2363
- );
2364
- }
2365
-
2366
- /**
2367
- * Create version information column.
2368
- *
2369
- * @since 2.5.0
2370
- *
2371
- * @param array $item Array of item data.
2372
- * @return string HTML-formatted version information.
2373
- */
2374
- public function column_version( $item ) {
2375
- $output = array();
2376
-
2377
- if ( $this->tgmpa->is_plugin_installed( $item['slug'] ) ) {
2378
- $installed = ! empty( $item['installed_version'] ) ? $item['installed_version'] : _x( 'unknown', 'as in: "version nr unknown"', 'weaver-xtreme' );
2379
-
2380
- $color = '';
2381
- if ( ! empty( $item['minimum_version'] ) && $this->tgmpa->does_plugin_require_update( $item['slug'] ) ) {
2382
- $color = ' color: #ff0000; font-weight: bold;';
2383
- }
2384
-
2385
- $output[] = sprintf(
2386
- '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Installed version:', 'weaver-xtreme' ) . '</p>',
2387
- $color,
2388
- $installed
2389
- );
2390
- }
2391
-
2392
- if ( ! empty( $item['minimum_version'] ) ) {
2393
- $output[] = sprintf(
2394
- '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>' . __( 'Minimum required version:', 'weaver-xtreme' ) . '</p>',
2395
- $item['minimum_version']
2396
- );
2397
- }
2398
-
2399
- if ( ! empty( $item['available_version'] ) ) {
2400
- $color = '';
2401
- if ( ! empty( $item['minimum_version'] ) && version_compare( $item['available_version'], $item['minimum_version'], '>=' ) ) {
2402
- $color = ' color: #71C671; font-weight: bold;';
2403
- }
2404
-
2405
- $output[] = sprintf(
2406
- '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Available version:', 'weaver-xtreme' ) . '</p>',
2407
- $color,
2408
- $item['available_version']
2409
- );
2410
- }
2411
-
2412
- if ( empty( $output ) ) {
2413
- return '&nbsp;'; // Let's not break the table layout.
2414
- } else {
2415
- return implode( "\n", $output );
2416
- }
2417
- }
2418
-
2419
- /**
2420
- * Sets default message within the plugins table if no plugins
2421
- * are left for interaction.
2422
- *
2423
- * Hides the menu item to prevent the user from clicking and
2424
- * getting a permissions error.
2425
- *
2426
- * @since 2.2.0
2427
- */
2428
- public function no_items() {
2429
- printf( wp_kses_post( __( 'No plugins to install, update or activate. <a href="%1$s">Return to the Dashboard</a>', 'weaver-xtreme' ) ), esc_url( self_admin_url() ) );
2430
- echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>';
2431
- }
2432
-
2433
- /**
2434
- * Output all the column information within the table.
2435
- *
2436
- * @since 2.2.0
2437
- *
2438
- * @return array $columns The column names.
2439
- */
2440
- public function get_columns() {
2441
- $columns = array(
2442
- 'cb' => '<input type="checkbox" />',
2443
- 'plugin' => __( 'Plugin', 'weaver-xtreme' ),
2444
- 'source' => __( 'Source', 'weaver-xtreme' ),
2445
- 'type' => __( 'Type', 'weaver-xtreme' ),
2446
- );
2447
-
2448
- if ( 'all' === $this->view_context || 'update' === $this->view_context ) {
2449
- $columns['version'] = __( 'Version', 'weaver-xtreme' );
2450
- $columns['status'] = __( 'Status', 'weaver-xtreme' );
2451
- }
2452
-
2453
- return apply_filters( 'tgmpa_table_columns', $columns );
2454
- }
2455
-
2456
- /**
2457
- * Get name of default primary column
2458
- *
2459
- * @since 2.5.0 / WP 4.3+ compatibility
2460
- * @access protected
2461
- *
2462
- * @return string
2463
- */
2464
- protected function get_default_primary_column_name() {
2465
- return 'plugin';
2466
- }
2467
-
2468
- /**
2469
- * Get the name of the primary column.
2470
- *
2471
- * @since 2.5.0 / WP 4.3+ compatibility
2472
- * @access protected
2473
- *
2474
- * @return string The name of the primary column.
2475
- */
2476
- protected function get_primary_column_name() {
2477
- if ( method_exists( 'WP_List_Table', 'get_primary_column_name' ) ) {
2478
- return parent::get_primary_column_name();
2479
- } else {
2480
- return $this->get_default_primary_column_name();
2481
- }
2482
- }
2483
-
2484
- /**
2485
- * Get the actions which are relevant for a specific plugin row.
2486
- *
2487
- * @since 2.5.0
2488
- *
2489
- * @param array $item Array of item data.
2490
- * @return array Array with relevant action links.
2491
- */
2492
- protected function get_row_actions( $item ) {
2493
- $actions = array();
2494
- $action_links = array();
2495
-
2496
- // Display the 'Install' action link if the plugin is not yet available.
2497
- if ( ! $this->tgmpa->is_plugin_installed( $item['slug'] ) ) {
2498
- $actions['install'] = _x( 'Install %2$s', '%2$s = plugin name in screen reader markup', 'weaver-xtreme' );
2499
- } else {
2500
- // Display the 'Update' action link if an update is available and WP complies with plugin minimum.
2501
- if ( false !== $this->tgmpa->does_plugin_have_update( $item['slug'] ) && $this->tgmpa->can_plugin_update( $item['slug'] ) ) {
2502
- $actions['update'] = _x( 'Update %2$s', '%2$s = plugin name in screen reader markup', 'weaver-xtreme' );
2503
- }
2504
-
2505
- // Display the 'Activate' action link, but only if the plugin meets the minimum version.
2506
- if ( $this->tgmpa->can_plugin_activate( $item['slug'] ) ) {
2507
- $actions['activate'] = _x( 'Activate %2$s', '%2$s = plugin name in screen reader markup', 'weaver-xtreme' );
2508
- }
2509
- }
2510
-
2511
- // Create the actual links.
2512
- foreach ( $actions as $action => $text ) {
2513
- $nonce_url = wp_nonce_url(
2514
- add_query_arg(
2515
- array(
2516
- 'plugin' => urlencode( $item['slug'] ),
2517
- 'tgmpa-' . $action => $action . '-plugin',
2518
- ),
2519
- $this->tgmpa->get_tgmpa_url()
2520
- ),
2521
- 'tgmpa-' . $action,
2522
- 'tgmpa-nonce'
2523
- );
2524
-
2525
- $action_links[ $action ] = sprintf(
2526
- '<a href="%1$s">' . esc_html( $text ) . '</a>',
2527
- esc_url( $nonce_url ),
2528
- '<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>'
2529
- );
2530
- }
2531
-
2532
- $prefix = ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) ? 'network_admin_' : '';
2533
- return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item['slug'], $item, $this->view_context );
2534
- }
2535
-
2536
- /**
2537
- * Generates content for a single row of the table.
2538
- *
2539
- * @since 2.5.0
2540
- *
2541
- * @param object $item The current item.
2542
- */
2543
- public function single_row( $item ) {
2544
- parent::single_row( $item );
2545
-
2546
- /**
2547
- * Fires after each specific row in the TGMPA Plugins list table.
2548
- *
2549
- * The dynamic portion of the hook name, `$item['slug']`, refers to the slug
2550
- * for the plugin.
2551
- *
2552
- * @since 2.5.0
2553
- */
2554
- do_action( "tgmpa_after_plugin_row_{$item['slug']}", $item['slug'], $item, $this->view_context );
2555
- }
2556
-
2557
- /**
2558
- * Show the upgrade notice below a plugin row if there is one.
2559
- *
2560
- * @since 2.5.0
2561
- *
2562
- * @see /wp-admin/includes/update.php
2563
- *
2564
- * @param string $slug Plugin slug.
2565
- * @param array $item The information available in this table row.
2566
- * @return null Return early if upgrade notice is empty.
2567
- */
2568
- public function wp_plugin_update_row( $slug, $item ) {
2569
- if ( empty( $item['upgrade_notice'] ) ) {
2570
- return;
2571
- }
2572
-
2573
- echo '
2574
- <tr class="plugin-update-tr">
2575
- <td colspan="', absint( $this->get_column_count() ), '" class="plugin-update colspanchange">
2576
- <div class="update-message">',
2577
- esc_html__( 'Upgrade message from the plugin author:', 'weaver-xtreme' ),
2578
- ' <strong>', wp_kses_data( $item['upgrade_notice'] ), '</strong>
2579
- </div>
2580
- </td>
2581
- </tr>';
2582
- }
2583
-
2584
- /**
2585
- * Extra controls to be displayed between bulk actions and pagination.
2586
- *
2587
- * @since 2.5.0
2588
- *
2589
- * @param string $which 'top' or 'bottom' table navigation.
2590
- */
2591
- public function extra_tablenav( $which ) {
2592
- if ( 'bottom' === $which ) {
2593
- $this->tgmpa->show_tgmpa_version();
2594
- }
2595
- }
2596
-
2597
- /**
2598
- * Defines the bulk actions for handling registered plugins.
2599
- *
2600
- * @since 2.2.0
2601
- *
2602
- * @return array $actions The bulk actions for the plugin install table.
2603
- */
2604
- public function get_bulk_actions() {
2605
-
2606
- $actions = array();
2607
-
2608
- if ( 'update' !== $this->view_context && 'activate' !== $this->view_context ) {
2609
- if ( current_user_can( 'install_plugins' ) ) {
2610
- $actions['tgmpa-bulk-install'] = __( 'Install', 'weaver-xtreme' );
2611
- }
2612
- }
2613
-
2614
- if ( 'install' !== $this->view_context ) {
2615
- if ( current_user_can( 'update_plugins' ) ) {
2616
- $actions['tgmpa-bulk-update'] = __( 'Update', 'weaver-xtreme' );
2617
- }
2618
- if ( current_user_can( 'activate_plugins' ) ) {
2619
- $actions['tgmpa-bulk-activate'] = __( 'Activate', 'weaver-xtreme' );
2620
- }
2621
- }
2622
-
2623
- return $actions;
2624
- }
2625
-
2626
- /**
2627
- * Processes bulk installation and activation actions.
2628
- *
2629
- * The bulk installation process looks for the $_POST information and passes that
2630
- * through if a user has to use WP_Filesystem to enter their credentials.
2631
- *
2632
- * @since 2.2.0
2633
- */
2634
- public function process_bulk_actions() {
2635
- // Bulk installation process.
2636
- if ( 'tgmpa-bulk-install' === $this->current_action() || 'tgmpa-bulk-update' === $this->current_action() ) {
2637
-
2638
- check_admin_referer( 'bulk-' . $this->_args['plural'] );
2639
-
2640
- $install_type = 'install';
2641
- if ( 'tgmpa-bulk-update' === $this->current_action() ) {
2642
- $install_type = 'update';
2643
- }
2644
-
2645
- $plugins_to_install = array();
2646
-
2647
- // Did user actually select any plugins to install/update ?
2648
- if ( empty( $_POST['plugin'] ) ) {
2649
- if ( 'install' === $install_type ) {
2650
- $message = __( 'No plugins were selected to be installed. No action taken.', 'weaver-xtreme' );
2651
- } else {
2652
- $message = __( 'No plugins were selected to be updated. No action taken.', 'weaver-xtreme' );
2653
- }
2654
-
2655
- echo '<div id="message" class="error"><p>', esc_html( $message ), '</p></div>';
2656
-
2657
- return false;
2658
- }
2659
-
2660
- if ( is_array( $_POST['plugin'] ) ) {
2661
- $plugins_to_install = (array) $_POST['plugin'];
2662
- } elseif ( is_string( $_POST['plugin'] ) ) {
2663
- // Received via Filesystem page - un-flatten array (WP bug #19643).
2664
- $plugins_to_install = explode( ',', $_POST['plugin'] );
2665
- }
2666
-
2667
- // Sanitize the received input.
2668
- $plugins_to_install = array_map( 'urldecode', $plugins_to_install );
2669
- $plugins_to_install = array_map( array( $this->tgmpa, 'sanitize_key' ), $plugins_to_install );
2670
-
2671
- // Validate the received input.
2672
- foreach ( $plugins_to_install as $key => $slug ) {
2673
- // Check if the plugin was registered with TGMPA and remove if not.
2674
- if ( ! isset( $this->tgmpa->plugins[ $slug ] ) ) {
2675
- unset( $plugins_to_install[ $key ] );
2676
- continue;
2677
- }
2678
-
2679
- // For updates: make sure this is a plugin we *can* update (update available and WP version ok).
2680
- if ( 'update' === $install_type && ( $this->tgmpa->is_plugin_installed( $slug ) && ( false === $this->tgmpa->does_plugin_have_update( $slug ) || ! $this->tgmpa->can_plugin_update( $slug ) ) ) ) {
2681
- unset( $plugins_to_install[ $key ] );
2682
- }
2683
- }
2684
-
2685
- // No need to proceed further if we have no plugins to handle.
2686
- if ( empty( $plugins_to_install ) ) {
2687
- if ( 'install' === $install_type ) {
2688
- $message = __( 'No plugins are available to be installed at this time.', 'weaver-xtreme' );
2689
- } else {
2690
- $message = __( 'No plugins are available to be updated at this time.', 'weaver-xtreme' );
2691
- }
2692
-
2693
- echo '<div id="message" class="error"><p>', esc_html( $message ), '</p></div>';
2694
-
2695
- return false;
2696
- }
2697
-
2698
- // Pass all necessary information if WP_Filesystem is needed.
2699
- $url = wp_nonce_url(
2700
- $this->tgmpa->get_tgmpa_url(),
2701
- 'bulk-' . $this->_args['plural']
2702
- );
2703
-
2704
- // Give validated data back to $_POST which is the only place the filesystem looks for extra fields.
2705
- $_POST['plugin'] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643.
2706
-
2707
- $method = ''; // Leave blank so WP_Filesystem can populate it as necessary.
2708
- $fields = array_keys( $_POST ); // Extra fields to pass to WP_Filesystem.
2709
-
2710
- if ( false === ( $creds = request_filesystem_credentials( esc_url_raw( $url ), $method, false, false, $fields ) ) ) {
2711
- return true; // Stop the normal page form from displaying, credential request form will be shown.
2712
- }
2713
-
2714
- // Now we have some credentials, setup WP_Filesystem.
2715
- if ( ! WP_Filesystem( $creds ) ) {
2716
- // Our credentials were no good, ask the user for them again.
2717
- request_filesystem_credentials( esc_url_raw( $url ), $method, true, false, $fields );
2718
-
2719
- return true;
2720
- }
2721
-
2722
- /* If we arrive here, we have the filesystem */
2723
-
2724
- // Store all information in arrays since we are processing a bulk installation.
2725
- $names = array();
2726
- $sources = array(); // Needed for installs.
2727
- $file_paths = array(); // Needed for upgrades.
2728
- $to_inject = array(); // Information to inject into the update_plugins transient.
2729
-
2730
- // Prepare the data for validated plugins for the install/upgrade.
2731
- foreach ( $plugins_to_install as $slug ) {
2732
- $name = $this->tgmpa->plugins[ $slug ]['name'];
2733
- $source = $this->tgmpa->get_download_url( $slug );
2734
-
2735
- if ( ! empty( $name ) && ! empty( $source ) ) {
2736
- $names[] = $name;
2737
-
2738
- switch ( $install_type ) {
2739
-
2740
- case 'install':
2741
- $sources[] = $source;
2742
- break;
2743
-
2744
- case 'update':
2745
- $file_paths[] = $this->tgmpa->plugins[ $slug ]['file_path'];
2746
- $to_inject[ $slug ] = $this->tgmpa->plugins[ $slug ];
2747
- $to_inject[ $slug ]['source'] = $source;
2748
- break;
2749
- }
2750
- }
2751
- }
2752
- unset( $slug, $name, $source );
2753
-
2754
- // Create a new instance of TGMPA_Bulk_Installer.
2755
- $installer = new TGMPA_Bulk_Installer(
2756
- new TGMPA_Bulk_Installer_Skin(
2757
- array(
2758
- 'url' => esc_url_raw( $this->tgmpa->get_tgmpa_url() ),
2759
- 'nonce' => 'bulk-' . $this->_args['plural'],
2760
- 'names' => $names,
2761
- 'install_type' => $install_type,
2762
- )
2763
- )
2764
- );
2765
-
2766
- // Wrap the install process with the appropriate HTML.
2767
- echo '<div class="tgmpa wrap">',
2768
- '<h2>', esc_html( get_admin_page_title() ), '</h2>';
2769
-
2770
- // Process the bulk installation submissions.
2771
- add_filter( 'upgrader_source_selection', array( $this->tgmpa, 'maybe_adjust_source_dir' ), 1, 3 );
2772
-
2773
- if ( 'tgmpa-bulk-update' === $this->current_action() ) {
2774
- // Inject our info into the update transient.
2775
- $this->tgmpa->inject_update_info( $to_inject );
2776
-
2777
- $installer->bulk_upgrade( $file_paths );
2778
- } else {
2779
- $installer->bulk_install( $sources );
2780
- }
2781
-
2782
- remove_filter( 'upgrader_source_selection', array( $this->tgmpa, 'maybe_adjust_source_dir' ), 1, 3 );
2783
-
2784
- echo '</div>';
2785
-
2786
- return true;
2787
- }
2788
-
2789
- // Bulk activation process.
2790
- if ( 'tgmpa-bulk-activate' === $this->current_action() ) {
2791
- check_admin_referer( 'bulk-' . $this->_args['plural'] );
2792
-
2793
- // Did user actually select any plugins to activate ?
2794
- if ( empty( $_POST['plugin'] ) ) {
2795
- echo '<div id="message" class="error"><p>', esc_html__( 'No plugins were selected to be activated. No action taken.', 'weaver-xtreme' ), '</p></div>';
2796
-
2797
- return false;
2798
- }
2799
-
2800
- // Grab plugin data from $_POST.
2801
- $plugins = array();
2802
- if ( isset( $_POST['plugin'] ) ) {
2803
- $plugins = array_map( 'urldecode', (array) $_POST['plugin'] );
2804
- $plugins = array_map( array( $this->tgmpa, 'sanitize_key' ), $plugins );
2805
- }
2806
-
2807
- $plugins_to_activate = array();
2808
- $plugin_names = array();
2809
-
2810
- // Grab the file paths for the selected & inactive plugins from the registration array.
2811
- foreach ( $plugins as $slug ) {
2812
- if ( $this->tgmpa->can_plugin_activate( $slug ) ) {
2813
- $plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path'];
2814
- $plugin_names[] = $this->tgmpa->plugins[ $slug ]['name'];
2815
- }
2816
- }
2817
- unset( $slug );
2818
-
2819
- // Return early if there are no plugins to activate.
2820
- if ( empty( $plugins_to_activate ) ) {
2821
- echo '<div id="message" class="error"><p>', esc_html__( 'No plugins are available to be activated at this time.', 'weaver-xtreme' ), '</p></div>';
2822
-
2823
- return false;
2824
- }
2825
-
2826
- // Now we are good to go - let's start activating plugins.
2827
- $activate = activate_plugins( $plugins_to_activate );
2828
-
2829
- if ( is_wp_error( $activate ) ) {
2830
- echo '<div id="message" class="error"><p>', wp_kses_post( $activate->get_error_message() ), '</p></div>';
2831
- } else {
2832
- $count = count( $plugin_names ); // Count so we can use _n function.
2833
- $plugin_names = array_map( array( 'TGMPA_Utils', 'wrap_in_strong' ), $plugin_names );
2834
- $last_plugin = array_pop( $plugin_names ); // Pop off last name to prep for readability.
2835
- $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'weaver-xtreme' ) . ' ' . $last_plugin );
2836
-
2837
- printf( // WPCS: xss ok.
2838
- '<div id="message" class="updated"><p>%1$s %2$s.</p></div>',
2839
- esc_html( _n( 'The following plugin was activated successfully:', 'The following plugins were activated successfully:', $count, 'weaver-xtreme' ) ),
2840
- $imploded
2841
- );
2842
-
2843
- // Update recently activated plugins option.
2844
- $recent = (array) get_option( 'recently_activated' );
2845
- foreach ( $plugins_to_activate as $plugin => $time ) {
2846
- if ( isset( $recent[ $plugin ] ) ) {
2847
- unset( $recent[ $plugin ] );
2848
- }
2849
- }
2850
- update_option( 'recently_activated', $recent );
2851
- }
2852
-
2853
- unset( $_POST ); // Reset the $_POST variable in case user wants to perform one action after another.
2854
-
2855
- return true;
2856
- }
2857
-
2858
- return false;
2859
- }
2860
-
2861
- /**
2862
- * Prepares all of our information to be outputted into a usable table.
2863
- *
2864
- * @since 2.2.0
2865
- */
2866
- public function prepare_items() {
2867
- $columns = $this->get_columns(); // Get all necessary column information.
2868
- $hidden = array(); // No columns to hide, but we must set as an array.
2869
- $sortable = array(); // No reason to make sortable columns.
2870
- $primary = $this->get_primary_column_name(); // Column which has the row actions.
2871
- $this->_column_headers = array( $columns, $hidden, $sortable, $primary ); // Get all necessary column headers.
2872
-
2873
- // Process our bulk activations here.
2874
- if ( 'tgmpa-bulk-activate' === $this->current_action() ) {
2875
- $this->process_bulk_actions();
2876
- }
2877
-
2878
- // Store all of our plugin data into $items array so WP_List_Table can use it.
2879
- $this->items = apply_filters( 'tgmpa_table_data_items', $this->_gather_plugin_data() );
2880
- }
2881
-
2882
- /* *********** DEPRECATED METHODS *********** */
2883
-
2884
- /**
2885
- * Retrieve plugin data, given the plugin name.
2886
- *
2887
- * @since 2.2.0
2888
- * @deprecated 2.5.0 use {@see TGM_Plugin_Activation::_get_plugin_data_from_name()} instead.
2889
- * @see TGM_Plugin_Activation::_get_plugin_data_from_name()
2890
- *
2891
- * @param string $name Name of the plugin, as it was registered.
2892
- * @param string $data Optional. Array key of plugin data to return. Default is slug.
2893
- * @return string|boolean Plugin slug if found, false otherwise.
2894
- */
2895
- protected function _get_plugin_data_from_name( $name, $data = 'slug' ) {
2896
- _deprecated_function( __FUNCTION__, 'TGMPA 2.5.0', 'TGM_Plugin_Activation::_get_plugin_data_from_name()' );
2897
-
2898
- return $this->tgmpa->_get_plugin_data_from_name( $name, $data );
2899
- }
2900
- }
2901
- }
2902
-
2903
-
2904
- if ( ! class_exists( 'TGM_Bulk_Installer' ) ) {
2905
-
2906
- /**
2907
- * Hack: Prevent TGMPA v2.4.1- bulk installer class from being loaded if 2.4.1- is loaded after 2.5+.
2908
- */
2909
- class TGM_Bulk_Installer {
2910
- }
2911
- }
2912
- if ( ! class_exists( 'TGM_Bulk_Installer_Skin' ) ) {
2913
-
2914
- /**
2915
- * Hack: Prevent TGMPA v2.4.1- bulk installer skin class from being loaded if 2.4.1- is loaded after 2.5+.
2916
- */
2917
- class TGM_Bulk_Installer_Skin {
2918
- }
2919
- }
2920
-
2921
- /**
2922
- * The WP_Upgrader file isn't always available. If it isn't available,
2923
- * we load it here.
2924
- *
2925
- * We check to make sure no action or activation keys are set so that WordPress
2926
- * does not try to re-include the class when processing upgrades or installs outside
2927
- * of the class.
2928
- *
2929
- * @since 2.2.0
2930
- */
2931
- add_action( 'admin_init', 'tgmpa_load_bulk_installer' );
2932
- if ( ! function_exists( 'tgmpa_load_bulk_installer' ) ) {
2933
- /**
2934
- * Load bulk installer
2935
- */
2936
- function tgmpa_load_bulk_installer() {
2937
- // Silently fail if 2.5+ is loaded *after* an older version.
2938
- if ( ! isset( $GLOBALS['tgmpa'] ) ) {
2939
- return;
2940
- }
2941
-
2942
- // Get TGMPA class instance.
2943
- $tgmpa_instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) );
2944
-
2945
- if ( isset( $_GET['page'] ) && $tgmpa_instance->menu === $_GET['page'] ) {
2946
- if ( ! class_exists( 'Plugin_Upgrader', false ) ) {
2947
- require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
2948
- }
2949
-
2950
- if ( ! class_exists( 'TGMPA_Bulk_Installer' ) ) {
2951
-
2952
- /**
2953
- * Installer class to handle bulk plugin installations.
2954
- *
2955
- * Extends WP_Upgrader and customizes to suit the installation of multiple
2956
- * plugins.
2957
- *
2958
- * @since 2.2.0
2959
- *
2960
- * @internal Since 2.5.0 the class is an extension of Plugin_Upgrader rather than WP_Upgrader
2961
- * @internal Since 2.5.2 the class has been renamed from TGM_Bulk_Installer to TGMPA_Bulk_Installer.
2962
- * This was done to prevent backward compatibility issues with v2.3.6.
2963
- *
2964
- * @package TGM-Plugin-Activation
2965
- * @author Thomas Griffin
2966
- * @author Gary Jones
2967
- */
2968
- class TGMPA_Bulk_Installer extends Plugin_Upgrader {
2969
- /**
2970
- * Holds result of bulk plugin installation.
2971
- *
2972
- * @since 2.2.0
2973
- *
2974
- * @var string
2975
- */
2976
- public $result;
2977
-
2978
- /**
2979
- * Flag to check if bulk installation is occurring or not.
2980
- *
2981
- * @since 2.2.0
2982
- *
2983
- * @var boolean
2984
- */
2985
- public $bulk = false;
2986
-
2987
- /**
2988
- * TGMPA instance
2989
- *
2990
- * @since 2.5.0
2991
- *
2992
- * @var object
2993
- */
2994
- protected $tgmpa;
2995
-
2996
- /**
2997
- * Whether or not the destination directory needs to be cleared ( = on update).
2998
- *
2999
- * @since 2.5.0
3000
- *
3001
- * @var bool
3002
- */
3003
- protected $clear_destination = false;
3004
-
3005
- /**
3006
- * References parent constructor and sets defaults for class.
3007
- *
3008
- * @since 2.2.0
3009
- *
3010
- * @param \Bulk_Upgrader_Skin|null $skin Installer skin.
3011
- */
3012
- public function __construct( $skin = null ) {
3013
- // Get TGMPA class instance.
3014
- $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) );
3015
-
3016
- parent::__construct( $skin );
3017
-
3018
- if ( isset( $this->skin->options['install_type'] ) && 'update' === $this->skin->options['install_type'] ) {
3019
- $this->clear_destination = true;
3020
- }
3021
-
3022
- if ( $this->tgmpa->is_automatic ) {
3023
- $this->activate_strings();
3024
- }
3025
-
3026
- add_action( 'upgrader_process_complete', array( $this->tgmpa, 'populate_file_path' ) );
3027
- }
3028
-
3029
- /**
3030
- * Sets the correct activation strings for the installer skin to use.
3031
- *
3032
- * @since 2.2.0
3033
- */
3034
- public function activate_strings() {
3035
- $this->strings['activation_failed'] = __( 'Plugin activation failed.', 'weaver-xtreme' );
3036
- $this->strings['activation_success'] = __( 'Plugin activated successfully.', 'weaver-xtreme' );
3037
- }
3038
-
3039
- /**
3040
- * Performs the actual installation of each plugin.
3041
- *
3042
- * @since 2.2.0
3043
- *
3044
- * @see WP_Upgrader::run()
3045
- *
3046
- * @param array $options The installation config options.
3047
- * @return null|array Return early if error, array of installation data on success.
3048
- */
3049
- public function run( $options ) {
3050
- $result = parent::run( $options );
3051
-
3052
- // Reset the strings in case we changed one during automatic activation.
3053
- if ( $this->tgmpa->is_automatic ) {
3054
- if ( 'update' === $this->skin->options['install_type'] ) {
3055
- $this->upgrade_strings();
3056
- } else {
3057
- $this->install_strings();
3058
- }
3059
- }
3060
-
3061
- return $result;
3062
- }
3063
-
3064
- /**
3065
- * Processes the bulk installation of plugins.
3066
- *
3067
- * @since 2.2.0
3068
- *
3069
- * @internal This is basically a near identical copy of the WP Core Plugin_Upgrader::bulk_upgrade()
3070
- * method, with minor adjustments to deal with new installs instead of upgrades.
3071
- * For ease of future synchronizations, the adjustments are clearly commented, but no other
3072
- * comments are added. Code style has been made to comply.
3073
- *
3074
- * @see Plugin_Upgrader::bulk_upgrade()
3075
- * @see https://core.trac.wordpress.org/browser/tags/4.2.1/src/wp-admin/includes/class-wp-upgrader.php#L838
3076
- *
3077
- * @param array $plugins The plugin sources needed for installation.
3078
- * @param array $args Arbitrary passed extra arguments.
3079
- * @return string|bool Install confirmation messages on success, false on failure.
3080
- */
3081
- public function bulk_install( $plugins, $args = array() ) {
3082
- // [TGMPA + ] Hook auto-activation in.
3083
- add_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 );
3084
-
3085
- $defaults = array(
3086
- 'clear_update_cache' => true,
3087
- );
3088
- $parsed_args = wp_parse_args( $args, $defaults );
3089
-
3090
- $this->init();
3091
- $this->bulk = true;
3092
-
3093
- $this->install_strings(); // [TGMPA + ] adjusted.
3094
-
3095
- /* [TGMPA - ] $current = get_site_transient( 'update_plugins' ); */
3096
-
3097
- /* [TGMPA - ] add_filter('upgrader_clear_destination', array($this, 'delete_old_plugin'), 10, 4); */
3098
-
3099
- $this->skin->header();
3100
-
3101
- // Connect to the Filesystem first.
3102
- $res = $this->fs_connect( array( WP_CONTENT_DIR, WP_PLUGIN_DIR ) );
3103
- if ( ! $res ) {
3104
- $this->skin->footer();
3105
-
3106
- return false;
3107
- }
3108
-
3109
- $this->skin->bulk_header();
3110
-
3111
- // Only start maintenance mode if:
3112
- // - running Multisite and there are one or more plugins specified, OR
3113
- // - a plugin with an update available is currently active.
3114
- // @TODO: For multisite, maintenance mode should only kick in for individual sites if at all possible.
3115
- $maintenance = ( is_multisite() && ! empty( $plugins ) );
3116
-
3117
- /*
3118
- [TGMPA - ]
3119
- foreach ( $plugins as $plugin )
3120
- $maintenance = $maintenance || ( is_plugin_active( $plugin ) && isset( $current->response[ $plugin] ) );
3121
- */
3122
- if ( $maintenance ) {
3123
- $this->maintenance_mode( true );
3124
- }
3125
-
3126
- $results = array();
3127
-
3128
- $this->update_count = count( $plugins );
3129
- $this->update_current = 0;
3130
- foreach ( $plugins as $plugin ) {
3131
- $this->update_current++;
3132
-
3133
- /*
3134
- [TGMPA - ]
3135
- $this->skin->plugin_info = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin, false, true);
3136
-
3137
- if ( !isset( $current->response[ $plugin ] ) ) {
3138
- $this->skin->set_result('up_to_date');
3139
- $this->skin->before();
3140
- $this->skin->feedback('up_to_date');
3141
- $this->skin->after();
3142
- $results[$plugin] = true;
3143
- continue;
3144
- }
3145
-
3146
- // Get the URL to the zip file
3147
- $r = $current->response[ $plugin ];
3148
-
3149
- $this->skin->plugin_active = is_plugin_active($plugin);
3150
- */
3151
-
3152
- $result = $this->run( array(
3153
- 'package' => $plugin, // [TGMPA + ] adjusted.
3154
- 'destination' => WP_PLUGIN_DIR,
3155
- 'clear_destination' => false, // [TGMPA + ] adjusted.
3156
- 'clear_working' => true,
3157
- 'is_multi' => true,
3158
- 'hook_extra' => array(
3159
- 'plugin' => $plugin,
3160
- ),
3161
- ) );
3162
-
3163
- $results[ $plugin ] = $this->result;
3164
-
3165
- // Prevent credentials auth screen from displaying multiple times.
3166
- if ( false === $result ) {
3167
- break;
3168
- }
3169
- } //end foreach $plugins
3170
-
3171
- $this->maintenance_mode( false );
3172
-
3173
- /**
3174
- * Fires when the bulk upgrader process is complete.
3175
- *
3176
- * @since WP 3.6.0 / TGMPA 2.5.0
3177
- *
3178
- * @param Plugin_Upgrader $this Plugin_Upgrader instance. In other contexts, $this, might
3179
- * be a Theme_Upgrader or Core_Upgrade instance.
3180
- * @param array $data {
3181
- * Array of bulk item update data.
3182
- *
3183
- * @type string $action Type of action. Default 'update'.
3184
- * @type string $type Type of update process. Accepts 'plugin', 'theme', or 'core'.
3185
- * @type bool $bulk Whether the update process is a bulk update. Default true.
3186
- * @type array $packages Array of plugin, theme, or core packages to update.
3187
- * }
3188
- */
3189
- do_action( 'upgrader_process_complete', $this, array(
3190
- 'action' => 'install', // [TGMPA + ] adjusted.
3191
- 'type' => 'plugin',
3192
- 'bulk' => true,
3193
- 'plugins' => $plugins,
3194
- ) );
3195
-
3196
- $this->skin->bulk_footer();
3197
-
3198
- $this->skin->footer();
3199
-
3200
- // Cleanup our hooks, in case something else does a upgrade on this connection.
3201
- /* [TGMPA - ] remove_filter('upgrader_clear_destination', array($this, 'delete_old_plugin')); */
3202
-
3203
- // [TGMPA + ] Remove our auto-activation hook.
3204
- remove_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 );
3205
-
3206
- // Force refresh of plugin update information.
3207
- wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
3208
-
3209
- return $results;
3210
- }
3211
-
3212
- /**
3213
- * Handle a bulk upgrade request.
3214
- *
3215
- * @since 2.5.0
3216
- *
3217
- * @see Plugin_Upgrader::bulk_upgrade()
3218
- *
3219
- * @param array $plugins The local WP file_path's of the plugins which should be upgraded.
3220
- * @param array $args Arbitrary passed extra arguments.
3221
- * @return string|bool Install confirmation messages on success, false on failure.
3222
- */
3223
- public function bulk_upgrade( $plugins, $args = array() ) {
3224
-
3225
- add_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 );
3226
-
3227
- $result = parent::bulk_upgrade( $plugins, $args );
3228
-
3229
- remove_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 );
3230
-
3231
- return $result;
3232
- }
3233
-
3234
- /**
3235
- * Abuse a filter to auto-activate plugins after installation.
3236
- *
3237
- * Hooked into the 'upgrader_post_install' filter hook.
3238
- *
3239
- * @since 2.5.0
3240
- *
3241
- * @param bool $bool The value we need to give back (true).
3242
- * @return bool
3243
- */
3244
- public function auto_activate( $bool ) {
3245
- // Only process the activation of installed plugins if the automatic flag is set to true.
3246
- if ( $this->tgmpa->is_automatic ) {
3247
- // Flush plugins cache so the headers of the newly installed plugins will be read correctly.
3248
- wp_clean_plugins_cache();
3249
-
3250
- // Get the installed plugin file.
3251
- $plugin_info = $this->plugin_info();
3252
-
3253
- // Don't try to activate on upgrade of active plugin as WP will do this already.
3254
- if ( ! is_plugin_active( $plugin_info ) ) {
3255
- $activate = activate_plugin( $plugin_info );
3256
-
3257
- // Adjust the success string based on the activation result.
3258
- $this->strings['process_success'] = $this->strings['process_success'] . "<br />\n";
3259
-
3260
- if ( is_wp_error( $activate ) ) {
3261
- $this->skin->error( $activate );
3262
- $this->strings['process_success'] .= $this->strings['activation_failed'];
3263
- } else {
3264
- $this->strings['process_success'] .= $this->strings['activation_success'];
3265
- }
3266
- }
3267
- }
3268
-
3269
- return $bool;
3270
- }
3271
- }
3272
- }
3273
-
3274
- if ( ! class_exists( 'TGMPA_Bulk_Installer_Skin' ) ) {
3275
-
3276
- /**
3277
- * Installer skin to set strings for the bulk plugin installations..
3278
- *
3279
- * Extends Bulk_Upgrader_Skin and customizes to suit the installation of multiple
3280
- * plugins.
3281
- *
3282
- * @since 2.2.0
3283
- *
3284
- * @internal Since 2.5.2 the class has been renamed from TGM_Bulk_Installer_Skin to
3285
- * TGMPA_Bulk_Installer_Skin.
3286
- * This was done to prevent backward compatibility issues with v2.3.6.
3287
- *
3288
- * @see https://core.trac.wordpress.org/browser/trunk/src/wp-admin/includes/class-wp-upgrader-skins.php
3289
- *
3290
- * @package TGM-Plugin-Activation
3291
- * @author Thomas Griffin
3292
- * @author Gary Jones
3293
- */
3294
- class TGMPA_Bulk_Installer_Skin extends Bulk_Upgrader_Skin {
3295
- /**
3296
- * Holds plugin info for each individual plugin installation.
3297
- *
3298
- * @since 2.2.0
3299
- *
3300
- * @var array
3301
- */
3302
- public $plugin_info = array();
3303
-
3304
- /**
3305
- * Holds names of plugins that are undergoing bulk installations.
3306
- *
3307
- * @since 2.2.0
3308
- *
3309
- * @var array
3310
- */
3311
- public $plugin_names = array();
3312
-
3313
- /**
3314
- * Integer to use for iteration through each plugin installation.
3315
- *
3316
- * @since 2.2.0
3317
- *
3318
- * @var integer
3319
- */
3320
- public $i = 0;
3321
-
3322
- /**
3323
- * TGMPA instance
3324
- *
3325
- * @since 2.5.0
3326
- *
3327
- * @var object
3328
- */
3329
- protected $tgmpa;
3330
-
3331
- /**
3332
- * Constructor. Parses default args with new ones and extracts them for use.
3333
- *
3334
- * @since 2.2.0
3335
- *
3336
- * @param array $args Arguments to pass for use within the class.
3337
- */
3338
- public function __construct( $args = array() ) {
3339
- // Get TGMPA class instance.
3340
- $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) );
3341
-
3342
- // Parse default and new args.
3343
- $defaults = array(
3344
- 'url' => '',
3345
- 'nonce' => '',
3346
- 'names' => array(),
3347
- 'install_type' => 'install',
3348
- );
3349
- $args = wp_parse_args( $args, $defaults );
3350
-
3351
- // Set plugin names to $this->plugin_names property.
3352
- $this->plugin_names = $args['names'];
3353
-
3354
- // Extract the new args.
3355
- parent::__construct( $args );
3356
- }
3357
-
3358
- /**
3359
- * Sets install skin strings for each individual plugin.
3360
- *
3361
- * Checks to see if the automatic activation flag is set and uses the
3362
- * the proper strings accordingly.
3363
- *
3364
- * @since 2.2.0
3365
- */
3366
- public function add_strings() {
3367
- if ( 'update' === $this->options['install_type'] ) {
3368
- parent::add_strings();
3369
- $this->upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'weaver-xtreme' );
3370
- } else {
3371
- $this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'weaver-xtreme' );
3372
- $this->upgrader->strings['skin_update_failed'] = __( 'The installation of %1$s failed.', 'weaver-xtreme' );
3373
-
3374
- if ( $this->tgmpa->is_automatic ) {
3375
- // Automatic activation strings.
3376
- $this->upgrader->strings['skin_upgrade_start'] = __( 'The installation and activation process is starting. This process may take a while on some hosts, so please be patient.', 'weaver-xtreme' );
3377
- $this->upgrader->strings['skin_update_successful'] = __( '%1$s installed and activated successfully.', 'weaver-xtreme' ) . ' <a href="#" class="hide-if-no-js" onclick="%2$s"><span>' . esc_html__( 'Show Details', 'weaver-xtreme' ) . '</span><span class="hidden">' . esc_html__( 'Hide Details', 'weaver-xtreme' ) . '</span>.</a>';
3378
- $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations and activations have been completed.', 'weaver-xtreme' );
3379
- $this->upgrader->strings['skin_before_update_header'] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'weaver-xtreme' );
3380
- } else {
3381
- // Default installation strings.
3382
- $this->upgrader->strings['skin_upgrade_start'] = __( 'The installation process is starting. This process may take a while on some hosts, so please be patient.', 'weaver-xtreme' );
3383
- $this->upgrader->strings['skin_update_successful'] = esc_html__( '%1$s installed successfully.', 'weaver-xtreme' ) . ' <a href="#" class="hide-if-no-js" onclick="%2$s"><span>' . esc_html__( 'Show Details', 'weaver-xtreme' ) . '</span><span class="hidden">' . esc_html__( 'Hide Details', 'weaver-xtreme' ) . '</span>.</a>';
3384
- $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations have been completed.', 'weaver-xtreme' );
3385
- $this->upgrader->strings['skin_before_update_header'] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'weaver-xtreme' );
3386
- }
3387
- }
3388
- }
3389
-
3390
- /**
3391
- * Outputs the header strings and necessary JS before each plugin installation.
3392
- *
3393
- * @since 2.2.0
3394
- *
3395
- * @param string $title Unused in this implementation.
3396
- */
3397
- public function before( $title = '' ) {
3398
- if ( empty( $title ) ) {
3399
- $title = esc_html( $this->plugin_names[ $this->i ] );
3400
- }
3401
- parent::before( $title );
3402
- }
3403
-
3404
- /**
3405
- * Outputs the footer strings and necessary JS after each plugin installation.
3406
- *
3407
- * Checks for any errors and outputs them if they exist, else output
3408
- * success strings.
3409
- *
3410
- * @since 2.2.0
3411
- *
3412
- * @param string $title Unused in this implementation.
3413
- */
3414
- public function after( $title = '' ) {
3415
- if ( empty( $title ) ) {
3416
- $title = esc_html( $this->plugin_names[ $this->i ] );
3417
- }
3418
- parent::after( $title );
3419
-
3420
- $this->i++;
3421
- }
3422
-
3423
- /**
3424
- * Outputs links after bulk plugin installation is complete.
3425
- *
3426
- * @since 2.2.0
3427
- */
3428
- public function bulk_footer() {
3429
- // Serve up the string to say installations (and possibly activations) are complete.
3430
- parent::bulk_footer();
3431
-
3432
- // Flush plugins cache so we can make sure that the installed plugins list is always up to date.
3433
- wp_clean_plugins_cache();
3434
-
3435
- $this->tgmpa->show_tgmpa_version();
3436
-
3437
- // Display message based on if all plugins are now active or not.
3438
- $update_actions = array();
3439
-
3440
- if ( $this->tgmpa->is_tgmpa_complete() ) {
3441
- // All plugins are active, so we display the complete string and hide the menu to protect users.
3442
- echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>';
3443
- $update_actions['dashboard'] = sprintf(
3444
- esc_html( $this->tgmpa->strings['complete'] ),
3445
- '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'weaver-xtreme' ) . '</a>'
3446
- );
3447
- } else {
3448
- $update_actions['tgmpa_page'] = '<a href="' . esc_url( $this->tgmpa->get_tgmpa_url() ) . '" target="_parent">' . esc_html( $this->tgmpa->strings['return'] ) . '</a>';
3449
- }
3450
-
3451
- /**
3452
- * Filter the list of action links available following bulk plugin installs/updates.
3453
- *
3454
- * @since 2.5.0
3455
- *
3456
- * @param array $update_actions Array of plugin action links.
3457
- * @param array $plugin_info Array of information for the last-handled plugin.
3458
- */
3459
- $update_actions = apply_filters( 'tgmpa_update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info );
3460
-
3461
- if ( ! empty( $update_actions ) ) {
3462
- $this->feedback( implode( ' | ', (array) $update_actions ) );
3463
- }
3464
- }
3465
-
3466
- /* *********** DEPRECATED METHODS *********** */
3467
-
3468
- /**
3469
- * Flush header output buffer.
3470
- *
3471
- * @since 2.2.0
3472
- * @deprecated 2.5.0 use {@see Bulk_Upgrader_Skin::flush_output()} instead
3473
- * @see Bulk_Upgrader_Skin::flush_output()
3474
- */
3475
- public function before_flush_output() {
3476
- _deprecated_function( __FUNCTION__, 'TGMPA 2.5.0', 'Bulk_Upgrader_Skin::flush_output()' );
3477
- $this->flush_output();
3478
- }
3479
-
3480
- /**
3481
- * Flush footer output buffer and iterate $this->i to make sure the
3482
- * installation strings reference the correct plugin.
3483
- *
3484
- * @since 2.2.0
3485
- * @deprecated 2.5.0 use {@see Bulk_Upgrader_Skin::flush_output()} instead
3486
- * @see Bulk_Upgrader_Skin::flush_output()
3487
- */
3488
- public function after_flush_output() {
3489
- _deprecated_function( __FUNCTION__, 'TGMPA 2.5.0', 'Bulk_Upgrader_Skin::flush_output()' );
3490
- $this->flush_output();
3491
- $this->i++;
3492
- }
3493
- }
3494
- }
3495
- }
3496
- }
3497
- }
3498
-
3499
- if ( ! class_exists( 'TGMPA_Utils' ) ) {
3500
-
3501
- /**
3502
- * Generic utilities for TGMPA.
3503
- *
3504
- * All methods are static, poor-dev name-spacing class wrapper.
3505
- *
3506
- * Class was called TGM_Utils in 2.5.0 but renamed TGMPA_Utils in 2.5.1 as this was conflicting with Soliloquy.
3507
- *
3508
- * @since 2.5.0
3509
- *
3510
- * @package TGM-Plugin-Activation
3511
- * @author Juliette Reinders Folmer
3512
- */
3513
- class TGMPA_Utils {
3514
- /**
3515
- * Whether the PHP filter extension is enabled.
3516
- *
3517
- * @see http://php.net/book.filter
3518
- *
3519
- * @since 2.5.0
3520
- *
3521
- * @static
3522
- *
3523
- * @var bool $has_filters True is the extension is enabled.
3524
- */
3525
- public static $has_filters;
3526
-
3527
- /**
3528
- * Wrap an arbitrary string in <em> tags. Meant to be used in combination with array_map().
3529
- *
3530
- * @since 2.5.0
3531
- *
3532
- * @static
3533
- *
3534
- * @param string $string Text to be wrapped.
3535
- * @return string
3536
- */
3537
- public static function wrap_in_em( $string ) {
3538
- return '<em>' . wp_kses_post( $string ) . '</em>';
3539
- }
3540
-
3541
- /**
3542
- * Wrap an arbitrary string in <strong> tags. Meant to be used in combination with array_map().
3543
- *
3544
- * @since 2.5.0
3545
- *
3546
- * @static
3547
- *
3548
- * @param string $string Text to be wrapped.
3549
- * @return string
3550
- */
3551
- public static function wrap_in_strong( $string ) {
3552
- return '<strong>' . wp_kses_post( $string ) . '</strong>';
3553
- }
3554
-
3555
- /**
3556
- * Helper function: Validate a value as boolean
3557
- *
3558
- * @since 2.5.0
3559
- *
3560
- * @static
3561
- *
3562
- * @param mixed $value Arbitrary value.
3563
- * @return bool
3564
- */
3565
- public static function validate_bool( $value ) {
3566
- if ( ! isset( self::$has_filters ) ) {
3567
- self::$has_filters = extension_loaded( 'filter' );
3568
- }
3569
-
3570
- if ( self::$has_filters ) {
3571
- return filter_var( $value, FILTER_VALIDATE_BOOLEAN );
3572
- } else {
3573
- return self::emulate_filter_bool( $value );
3574
- }
3575
- }
3576
-
3577
- /**
3578
- * Helper function: Cast a value to bool
3579
- *
3580
- * @since 2.5.0
3581
- *
3582
- * @static
3583
- *
3584
- * @param mixed $value Value to cast.
3585
- * @return bool
3586
- */
3587
- protected static function emulate_filter_bool( $value ) {
3588
- // @codingStandardsIgnoreStart
3589
- static $true = array(
3590
- '1',
3591
- 'true', 'True', 'TRUE',
3592
- 'y', 'Y',
3593
- 'yes', 'Yes', 'YES',
3594
- 'on', 'On', 'ON',
3595
- );
3596
- static $false = array(
3597
- '0',
3598
- 'false', 'False', 'FALSE',
3599
- 'n', 'N',
3600
- 'no', 'No', 'NO',
3601
- 'off', 'Off', 'OFF',
3602
- );
3603
- // @codingStandardsIgnoreEnd
3604
-
3605
- if ( is_bool( $value ) ) {
3606
- return $value;
3607
- } else if ( is_int( $value ) && ( 0 === $value || 1 === $value ) ) {
3608
- return (bool) $value;
3609
- } else if ( ( is_float( $value ) && ! is_nan( $value ) ) && ( (float) 0 === $value || (float) 1 === $value ) ) {
3610
- return (bool) $value;
3611
- } else if ( is_string( $value ) ) {
3612
- $value = trim( $value );
3613
- if ( in_array( $value, $true, true ) ) {
3614
- return true;
3615
- } else if ( in_array( $value, $false, true ) ) {
3616
- return false;
3617
- } else {
3618
- return false;
3619
- }
3620
- }
3621
-
3622
- return false;
3623
- }
3624
- } // End of class TGMPA_Utils
3625
- } // End of class_exists wrapper
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/customizer.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
- function weaverx_customize_preview_js() {
3
- $option_menu = site_url('/wp-admin/themes.php?page=WeaverX', 'relative');
4
-
5
- $content = "<script>jQuery('#customize-info').append('<div class=\"use-theme-options\"><a href=\"{$option_menu}\" target=\"_blank\">Weaver Xtreme Options on Appearance Menu</a></div>')</script>";
6
- echo $content;
7
- }
8
- add_action('customize_controls_print_footer_scripts', 'weaverx_customize_preview_js');
9
-
10
- /*
11
- * Customizer scripts
12
- */
13
- function weaverx_enqueue_customizer_scripts(){
14
-
15
- // stylesheet for customizer
16
- wp_enqueue_style('weaverx-customizer-styles', get_template_directory_uri() . '/admin/assets/css/customizer'.WEAVERX_MINIFY.'.css');
17
-
18
- }
19
- add_action('customize_controls_enqueue_scripts','weaverx_enqueue_customizer_scripts');
20
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/lib-admin-part2.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
- if ( !defined('ABSPATH')) exit; // Exit if accessed directly
3
-
4
-
5
-
6
- ?>
 
 
 
 
 
 
admin/load-weaverx-admin.php DELETED
@@ -1,100 +0,0 @@
1
- <?php
2
- /* This loads the Admin stuff. It is invoked from functions.php.
3
- *
4
- * This ultimately will be used to load different admin interfaces -
5
- * like the a default Customizer version for WP.org, or the traditional Theme Options version (which it does now)
6
- */
7
-
8
- if (current_user_can('edit_posts')) {
9
-
10
- add_action('admin_menu', 'weaverx_add_admin',5);
11
- weaverx_load_admin_aux();
12
-
13
- do_action('weaverx_check_updates');
14
-
15
-
16
- function weaverx_add_admin() { // action definition
17
-
18
-
19
- /* adds our admin panel (add_action: admin_menu) */
20
- // 'edit_theme_options' works for both single and multisite
21
- $page = add_theme_page('WeaverX', __('Weaver Xtreme <small>Admin</small>', 'weaver-xtreme' /*adm*/), 'edit_theme_options', 'WeaverX', 'weaverx_admin_theme_page');
22
- /* using registered $page handle to hook stylesheet loading for this admin page */
23
- add_action('admin_print_styles-'.$page, 'weaverx_admin_scripts');
24
- }
25
-
26
- // callback for add_theme_page
27
- function weaverx_admin_theme_page() {
28
- $wp_vers = $GLOBALS['wp_version'];
29
- $cur_vers = $wp_vers;
30
- $beta = strpos($cur_vers, '-');
31
- if ( $beta > 0 ) {
32
- $cur_vers = substr($cur_vers,0,$beta); // strip the beta part if there
33
- }
34
- if (version_compare($cur_vers, WEAVERX_MIN_WPVERSION, '<')) {
35
- echo '<br><br><h2 style="padding:4px;background:pink;">' . __('ERROR: You are using WordPress Version ', 'weaver-xtreme' /*adm*/) . $GLOBALS['wp_version'] .
36
- __(' Weaver Xtreme requires <em>WordPress Version ', 'weaver-xtreme' /*adm*/) . WEAVERX_MIN_WPVERSION .
37
- __('</em> or above. You should always upgrade to the latest version of WordPress for maximum site performance and security.', 'weaver-xtreme' /*adm*/) .
38
- '</h2>'; // admin message
39
- return;
40
- }
41
-
42
-
43
- require_once(dirname( __FILE__ ) . '/admin-top.php'); // NOW - load the admin stuff
44
- do_action('weaverxplus_add_admin');
45
- weaverx_do_admin();
46
- }
47
-
48
- // callback for admin_print_styles in add_admin above
49
- function weaverx_admin_scripts() {
50
- /* called only on the admin page, enqueue our special style sheet here (for tabbed pages) */
51
- wp_enqueue_style('wvrxaStylesheet', get_template_directory_uri().WEAVERX_ADMIN_DIR.'/assets/css/admin-style.css');
52
- if ( is_rtl() )
53
- wp_enqueue_style('wvrxartlStylesheet', get_template_directory_uri().WEAVERX_ADMIN_DIR.'/assets/css/admin-style-rtl.css');
54
-
55
- wp_enqueue_style ("thickbox");
56
- wp_enqueue_script ("thickbox");
57
-
58
- // @@@@@@@@@@@@@@@@ jscolor needs fixing - won't find it with WEAVERX_ADMIN_DIR
59
-
60
- wp_enqueue_script('wvrxJscolor', get_template_directory_uri().'/assets/js/jscolor/jscolor.js',WEAVERX_VERSION); // .min fails
61
- wp_enqueue_script('wvrxYetii', get_template_directory_uri().WEAVERX_ADMIN_DIR.'/assets/js/yetii/yetii'.WEAVERX_MINIFY.'.js',WEAVERX_VERSION);
62
- wp_enqueue_script('wvrxHide', get_template_directory_uri().WEAVERX_ADMIN_DIR.'/assets/js/theme/hide-css'.WEAVERX_MINIFY.'.js',WEAVERX_VERSION);
63
- wp_enqueue_script('wvrxMediaLib', get_template_directory_uri().WEAVERX_ADMIN_DIR.'/assets/js/theme/media-lib'.WEAVERX_MINIFY.'.js',WEAVERX_VERSION);
64
- }
65
- //--
66
-
67
- // We have to add the SAPI stuff at admin_init time so that the $_POST handling will get handled by SAPI. This means this
68
- // gets loaded for the entire Dashboard, not just when there was a submission from the Weaver options panels. Otherwise, the
69
- // SAPI code won't be able to process the options.
70
-
71
- add_action('admin_init', 'weaverx_admin_init_cb');
72
-
73
- function weaverx_admin_init_cb() { // action definition
74
-
75
- require_once( dirname( __FILE__ ) . '/admin-sapi-lib.php' );
76
-
77
- weaverx_sapi_options_init(); // This must come first as it hooks update_option used elsewhere
78
- return;
79
- } //ttt
80
- //--
81
-
82
-
83
- add_action('admin_head', 'weaverx_admin_head');
84
-
85
- function weaverx_admin_head() { // action definition
86
- }
87
-
88
- } // END IF CAN EDIT POSTS ---------------------------------------------------------------------
89
-
90
- function weaverx_load_admin_aux() {
91
-
92
- if (current_user_can('edit_posts')) { // allows only admin to see, also avoids loading at runtime
93
- require_once(get_template_directory() . WEAVERX_ADMIN_DIR . '/admin-page-posts.php'); // per page-posts admin
94
- }
95
-
96
- if (current_user_can('activate_plugins')) { // allows only admin to see, also avoids loading at runtime
97
- require_once(get_template_directory() . WEAVERX_ADMIN_DIR . '/addon-plugins.php'); // the tgm plugin checker
98
- }
99
- }
100
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/wvrx-ts-runtime-lib.php CHANGED
@@ -68,7 +68,7 @@ Click the<span style="color:red; vertical-align: middle; margin-left:.25em;" cla
68
  </li>
69
  <li><?php wvrx_ts_fix_short($prefix, __('<span class="wvr-blue">iFrame - [iframe]</span> - Display external content in an iframe','weaverx-theme-support' /*adm*/)); ?>
70
  <?php wvrx_ts_help_link('help.html#sciframe',__('Help for iframe','weaverx-theme-support' /*adm*/));?><br />
71
- <code><?php wvrx_ts_fix_short($prefix, __("[iframe src='http://example.com' height=600 percent=100 style='style']",'weaverx-theme-support' /*adm*/)); ?></code>
72
  </li>
73
  <li><?php wvrx_ts_fix_short($prefix, __('<span class="wvr-blue">Login - [login]</span> - Show simple Login/Logout link','weaverx-theme-support' /*adm*/)); ?>
74
  <?php wvrx_ts_help_link('help.html#sclogin',__('Help for login','weaverx-theme-support' /*adm*/));?><br />
68
  </li>
69
  <li><?php wvrx_ts_fix_short($prefix, __('<span class="wvr-blue">iFrame - [iframe]</span> - Display external content in an iframe','weaverx-theme-support' /*adm*/)); ?>
70
  <?php wvrx_ts_help_link('help.html#sciframe',__('Help for iframe','weaverx-theme-support' /*adm*/));?><br />
71
+ <code><?php wvrx_ts_fix_short($prefix, __("[iframe src='//example.com' height=600 percent=100 style='style']",'weaverx-theme-support' /*adm*/)); ?></code>
72
  </li>
73
  <li><?php wvrx_ts_fix_short($prefix, __('<span class="wvr-blue">Login - [login]</span> - Show simple Login/Logout link','weaverx-theme-support' /*adm*/)); ?>
74
  <?php wvrx_ts_help_link('help.html#sclogin',__('Help for login','weaverx-theme-support' /*adm*/));?><br />
readme.txt CHANGED
@@ -75,6 +75,15 @@ Support for this plugin can best be found at our forum - http://forum.weaverthem
75
  This is the initial release of this plugin.
76
 
77
  == ChangeLog ==
 
 
 
 
 
 
 
 
 
78
  = 1.9.1 =
79
  * Weaver Xtreme 1.x users should continue to use this plugin, even with support for new version.
80
  * Add new options for Weaver Xtreme 2.0
75
  This is the initial release of this plugin.
76
 
77
  == ChangeLog ==
78
+ = 1.9.6 =
79
+ * More refinement
80
+ * New: "Retain menu bar hover color" when sub menu open
81
+ * Tweak: changed default of content bottom padding to 0.
82
+
83
+ = 1.9.2 =
84
+ * Continued refinement of interaction with Weaver 2.0. Weaver 2.0 will now retain some of the theme
85
+ admin options (such as Save/Restore) which are not suitable for Theme Customizer.
86
+
87
  = 1.9.1 =
88
  * Weaver Xtreme 1.x users should continue to use this plugin, even with support for new version.
89
  * Add new options for Weaver Xtreme 2.0
weaverx-ts.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://weavertheme.com/plugins
5
  Description: Weaver X Theme Support - a package of useful shortcodes and widgets that integrates closely with the Weaver X theme. This plugin Will also allow you to switch from Weaver X to any other theme and still be able to use the shortcodes and widgets from Weaver X with minimal effort.
6
  Author: wpweaver
7
  Author URI: http://weavertheme.com/about/
8
- Version: 1.9.1
9
  License: GPL V3
10
 
11
  Weaver Xtreme Theme Support
@@ -33,7 +33,7 @@ $theme = get_template_directory();
33
 
34
  if ( strpos( $theme, '/weaver-xtreme') !== false ) { // only load if Weaver Xtreme is the theme
35
 
36
- define ('WVRX_TS_VERSION','1.9.1');
37
  define ('WVRX_TS_MINIFY','.min'); // '' for dev, '.min' for production
38
  define ('WVRX_TS_APPEARANCE_PAGE', false );
39
 
@@ -72,7 +72,7 @@ require_once(dirname( __FILE__ ) . '/includes/wvrx-ts-shortcodes.php'); // load
72
  // load traditional Weaver Xtreme Options
73
 
74
  function weaver_xtreme_load_admin_action() {
75
- require_once(dirname( __FILE__ ) . '/admin/load-weaverx-admin.php'); // NOW - load the traditional opions admin
76
  }
77
 
78
  add_action('weaver_xtreme_load_admin','weaver_xtreme_load_admin_action');
@@ -171,7 +171,7 @@ function wvrx_ts_child_show_extrathemes_action() {
171
  echo '<h3 class="atw-option-subheader">Upload an Add-on Subtheme From Your Computer</h3>';
172
  ?>
173
  <p><?php _e('You can find additional free and premium Add-on Subthemes for <em>Weaver Xtreme</em>','weaverx-theme-support' /*adm*/); ?>
174
- <a href="http://xtreme.weavertheme.com/add-on-subthemes/" title="<?php _e('Weaver Xtreme Add-on Subthemes','weaverx-theme-support' /*adm*/); ?>"><strong><?php _e('HERE','weaverx-theme-support' /*adm*/); ?></strong></a>.</p>
175
  <form name='form_added_theme' enctype="multipart/form-data" action="<?php echo $_SERVER["REQUEST_URI"]; ?>" method="POST">
176
  <table>
177
  <tr valign="top">
5
  Description: Weaver X Theme Support - a package of useful shortcodes and widgets that integrates closely with the Weaver X theme. This plugin Will also allow you to switch from Weaver X to any other theme and still be able to use the shortcodes and widgets from Weaver X with minimal effort.
6
  Author: wpweaver
7
  Author URI: http://weavertheme.com/about/
8
+ Version: 1.9.6
9
  License: GPL V3
10
 
11
  Weaver Xtreme Theme Support
33
 
34
  if ( strpos( $theme, '/weaver-xtreme') !== false ) { // only load if Weaver Xtreme is the theme
35
 
36
+ define ('WVRX_TS_VERSION','1.9.6');
37
  define ('WVRX_TS_MINIFY','.min'); // '' for dev, '.min' for production
38
  define ('WVRX_TS_APPEARANCE_PAGE', false );
39
 
72
  // load traditional Weaver Xtreme Options
73
 
74
  function weaver_xtreme_load_admin_action() {
75
+ require_once(dirname( __FILE__ ) . '/admin/add-weaverx-sapi-options.php'); // NOW - load the traditional opions admin
76
  }
77
 
78
  add_action('weaver_xtreme_load_admin','weaver_xtreme_load_admin_action');
171
  echo '<h3 class="atw-option-subheader">Upload an Add-on Subtheme From Your Computer</h3>';
172
  ?>
173
  <p><?php _e('You can find additional free and premium Add-on Subthemes for <em>Weaver Xtreme</em>','weaverx-theme-support' /*adm*/); ?>
174
+ <a href="//xtreme.weavertheme.com/add-on-subthemes/" title="<?php _e('Weaver Xtreme Add-on Subthemes','weaverx-theme-support' /*adm*/); ?>"><strong><?php _e('HERE','weaverx-theme-support' /*adm*/); ?></strong></a>.</p>
175
  <form name='form_added_theme' enctype="multipart/form-data" action="<?php echo $_SERVER["REQUEST_URI"]; ?>" method="POST">
176
  <table>
177
  <tr valign="top">