Version Description
= 5.0 = Major update, you might need to setup the plugin settings again.
Download this release
Release Info
Developer | daniyalahmedk |
Plugin | Fuse Social Floating Sidebar |
Version | 5.4 |
Comparing to | |
See all releases |
Code changes from version 5.3.10 to 5.4
- framework/settings/fuse-config.php +295 -38
- fuse_social_sidebar.php +4 -3
- inc/css/admin.css +87 -0
- inc/extensions/extensions/icon_select/extension_icon_select.php +86 -0
- inc/extensions/extensions/icon_select/icon_select/field_icon_select.css +1 -0
- inc/extensions/extensions/icon_select/icon_select/field_icon_select.js +46 -0
- inc/extensions/extensions/icon_select/icon_select/field_icon_select.min.js +1 -0
- inc/extensions/extensions/icon_select/icon_select/field_icon_select.php +230 -0
- inc/extensions/extensions/icon_select/icon_select/field_icon_select.scss +52 -0
- inc/extensions/extensions/metaboxes/extension_metaboxes.css +3 -0
- inc/extensions/extensions/metaboxes/extension_metaboxes.js +79 -0
- inc/extensions/extensions/metaboxes/extension_metaboxes.less +315 -0
- inc/extensions/extensions/metaboxes/extension_metaboxes.min.js +1 -0
- inc/extensions/extensions/metaboxes/extension_metaboxes.php +1399 -0
- inc/extensions/extensions/repeater/extension_repeater.php +267 -0
- inc/extensions/extensions/repeater/repeater/field_repeater.css +1 -0
- inc/extensions/extensions/repeater/repeater/field_repeater.js +344 -0
- inc/extensions/extensions/repeater/repeater/field_repeater.min.js +1 -0
- inc/extensions/extensions/repeater/repeater/field_repeater.php +451 -0
- inc/extensions/extensions/repeater/repeater/field_repeater.scss +97 -0
- inc/extensions/extensions/widget_areas/assets/css/sidebars.css +50 -0
- inc/extensions/extensions/widget_areas/assets/css/widget_areas.css +62 -0
- inc/extensions/extensions/widget_areas/assets/img/trash.png +0 -0
- inc/extensions/extensions/widget_areas/assets/js/widget_areas.js +83 -0
- inc/extensions/extensions/widget_areas/class.redux_widget_areas.php +303 -0
- inc/extensions/extensions/widget_areas/extension_widget_areas.php +57 -0
- inc/fuse_social_sidebar_func.php +2 -9
- inc/fuse_social_sidebar_scripts.php +1 -1
- inc/js/admin-fuse.js +9 -0
- readme.txt +25 -12
framework/settings/fuse-config.php
CHANGED
@@ -161,7 +161,20 @@ $args['admin_bar_links'][] = array(
|
|
161 |
//$reqbody = wp_remote_get('https://www.fusefloat.com/wp-admin/admin-ajax.php?action=fuse_load_demo_ajax_request&url='.base64_encode(fs_fs()->get_upgrade_url()), array( '' ) );
|
162 |
|
163 |
// Add content after the form.
|
164 |
-
$args['footer_text'] = __('
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
|
166 |
|
167 |
// SOCIAL ICONS -> Setup custom links in the footer for quick links in your panel footer icons.
|
@@ -253,16 +266,108 @@ Redux::setSection( $opt_name, array(
|
|
253 |
),
|
254 |
) ),
|
255 |
) );
|
256 |
-
Redux::setSection( $opt_name, array(
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
// -> START Basic Fields
|
267 |
Redux::setSection( $opt_name, array(
|
268 |
'title' => __( 'Design', 'fuse-social-floating' ),
|
@@ -272,21 +377,92 @@ Redux::setSection( $opt_name, array(
|
|
272 |
) );
|
273 |
|
274 |
|
275 |
-
Redux::setSection( $opt_name, array(
|
276 |
-
'title' => __( 'Color Settings', 'fuse-social-floating' ),
|
277 |
-
'id' => 'color_settings',
|
278 |
-
'subsection' => true,
|
279 |
-
'fields' => array(
|
280 |
-
|
281 |
-
array(
|
282 |
-
'id' => 'up_txt_ls',
|
283 |
-
'type' => 'raw',
|
284 |
-
'content' => '<a href="'.fs_fs()->get_upgrade_url().'"><img src="'.ReduxFramework::$_url.'../presets/applies.png" /></a><div class="upgrade_now_cn"><a href="'.fs_fs()->get_upgrade_url().'"><strong>Upgrade now!</strong> to unlock this feature.</a></div>'
|
285 |
-
)
|
286 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
287 |
|
288 |
-
)
|
289 |
-
) );
|
290 |
|
291 |
Redux::setSection( $opt_name, array(
|
292 |
'title' => __( 'Icon Designs', 'fuse-social-floating' ),
|
@@ -398,20 +574,40 @@ Redux::setSection( $opt_name, array(
|
|
398 |
)
|
399 |
),
|
400 |
) );
|
401 |
-
Redux::setSection( $opt_name, array(
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
415 |
|
416 |
// -> START Basic Fields
|
417 |
Redux::setSection( $opt_name, array(
|
@@ -435,6 +631,67 @@ Redux::setSection( $opt_name, array(
|
|
435 |
)
|
436 |
);
|
437 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
438 |
// -> START Basic Fields
|
439 |
Redux::setSection( $opt_name, array(
|
440 |
'title' => __( 'Analytics', 'fuse-social-floating' ),
|
161 |
//$reqbody = wp_remote_get('https://www.fusefloat.com/wp-admin/admin-ajax.php?action=fuse_load_demo_ajax_request&url='.base64_encode(fs_fs()->get_upgrade_url()), array( '' ) );
|
162 |
|
163 |
// Add content after the form.
|
164 |
+
$args['footer_text'] = __('
|
165 |
+
<div class="upgrade_take_screen">
|
166 |
+
<div class="upgrade_take_inner">
|
167 |
+
<a href="#" class="close-time">×</a>
|
168 |
+
<div class="upgrade_popup_now">
|
169 |
+
<h3>Upgrade Plugin To Pro Version</h3>
|
170 |
+
<p class="para_txt">To unlock this feature you need to upgrade this plugin to pro version, it\'s a one time fee and allow you to use the plugin on any number of the sites.</p>
|
171 |
+
<h4>Trusted by More than 29,000 Blogs, Online Shops & Websites!</h4>
|
172 |
+
<a href="'.fs_fs()->get_upgrade_url().'">Upgrade Now!</a>
|
173 |
+
</div>
|
174 |
+
</div>
|
175 |
+
</div>
|
176 |
+
|
177 |
+
<div class="flash_sale_sm"><span class="flashit">Sale</span> Get 20% OFF Right Now! Use coupon code <strong class="sale_off">SALE20OFF</strong> <a href="'.fs_fs()->get_upgrade_url().'">Upgrade Now!</a> </div>', 'redux-framework-demo' );
|
178 |
|
179 |
|
180 |
// SOCIAL ICONS -> Setup custom links in the footer for quick links in your panel footer icons.
|
266 |
),
|
267 |
) ),
|
268 |
) );
|
269 |
+
Redux::setSection( $opt_name, array(
|
270 |
+
'title' => __( 'Custom Icons', 'fuse-social-floating' ),
|
271 |
+
'id' => 'customicons-Sortable',
|
272 |
+
'subsection' => true,
|
273 |
+
'fields' => array(
|
274 |
+
array(
|
275 |
+
'id' => 'fuse-custom-icons',
|
276 |
+
'type' => 'repeater',
|
277 |
+
'group_values' => true,
|
278 |
+
'title' => __( 'Custom Icon', 'fuse-social-floating' ),
|
279 |
+
'subtitle' => __( '', 'fuse-social-floating' ),
|
280 |
+
'desc' => __( '', 'fuse-social-floating' ),
|
281 |
+
//'group_values' => true, // Group all fields below within the repeater ID
|
282 |
+
//'item_name' => '', // Add a repeater block name to the Add and Delete buttons
|
283 |
+
//'bind_title' => '', // Bind the repeater block title to this field ID
|
284 |
+
//'static' => 2, // Set the number of repeater blocks to be output
|
285 |
+
//'limit' => 2, // Limit the number of repeater blocks a user can create
|
286 |
+
//'sortable' => false, // Allow the users to sort the repeater blocks or not
|
287 |
+
'fields' => array(
|
288 |
+
array(
|
289 |
+
'id' => 'title_field',
|
290 |
+
'type' => 'text',
|
291 |
+
'placeholder' => __( 'Title', 'fuse-social-floating' ),
|
292 |
+
),
|
293 |
+
|
294 |
+
array(
|
295 |
+
'id' => 'select_font_icon',
|
296 |
+
'type' => 'icon_select',
|
297 |
+
'title' => __('Select Icon', 'fuse-social-floating'),
|
298 |
+
// Must provide key => value pairs for select options
|
299 |
+
'default' => '',
|
300 |
+
|
301 |
+
'enqueue' => false, // Disable auto-enqueue of stylesheet if present in the panel
|
302 |
+
'enqueue_frontend' => false, // Disable auto-enqueue of stylesheet on the front-end
|
303 |
+
'stylesheet' => 'http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css', // full path OR url to stylesheet
|
304 |
+
'prefix' => 'fa', // If needed to initialize the icon
|
305 |
+
'selector' => 'fa-', // How each icons begins for this given font
|
306 |
+
'height' => 300 // Change the height of the container. defaults to 300px;
|
307 |
+
),
|
308 |
+
array(
|
309 |
+
'id' => 'icon_url',
|
310 |
+
'type' => 'media',
|
311 |
+
'title' => __('Upload Icon', 'fuse-social-floating'),
|
312 |
+
),
|
313 |
+
array(
|
314 |
+
'id' => 'icon-size',
|
315 |
+
'type' => 'slider',
|
316 |
+
'title' => __('Image Icon size', 'redux-framework-demo'),
|
317 |
+
"default" => 75,
|
318 |
+
"min" => 0,
|
319 |
+
"step" => 1,
|
320 |
+
"max" => 200,
|
321 |
+
'display_value' => 'text'
|
322 |
+
),
|
323 |
+
array(
|
324 |
+
'id' => 'social_icon_url',
|
325 |
+
'type' => 'text',
|
326 |
+
'title' => __('Social Icon URL', 'fuse-social-floating'),
|
327 |
+
),
|
328 |
+
array(
|
329 |
+
'id' => 'bg_color',
|
330 |
+
'type' => 'color',
|
331 |
+
'title' => __("Icon background color", 'fuse-social-floating'),
|
332 |
+
'transparent' => false
|
333 |
+
),
|
334 |
+
array(
|
335 |
+
'id' => 'icon_m_color',
|
336 |
+
'type' => 'color',
|
337 |
+
'title' => __("Icon color", 'fuse-social-floating'),
|
338 |
+
'transparent' => false
|
339 |
+
),
|
340 |
+
array(
|
341 |
+
'id' => 'icon__hv_m_color',
|
342 |
+
'type' => 'color',
|
343 |
+
'title' => __("Icon hover color", 'fuse-social-floating'),
|
344 |
+
'transparent' => false
|
345 |
+
),
|
346 |
+
array(
|
347 |
+
'id' => 'icon__hbg_m_color',
|
348 |
+
'type' => 'color',
|
349 |
+
'title' => __("Icon hover background color", 'fuse-social-floating'),
|
350 |
+
'transparent' => false
|
351 |
+
),
|
352 |
+
|
353 |
+
|
354 |
+
|
355 |
+
)
|
356 |
+
),
|
357 |
+
array(
|
358 |
+
'id' => 'custom_icon_on_top',
|
359 |
+
'type' => 'checkbox',
|
360 |
+
'title' => __("Display custom icons on top", 'fuse-social-floating'),
|
361 |
+
'desc' => __('This option will move the custom icons to top.', 'fuse-social-floating'),
|
362 |
+
),
|
363 |
+
array(
|
364 |
+
'id' => 'overlay_for_custom_icon',
|
365 |
+
'type' => 'raw',
|
366 |
+
'title' => __( "<div class='overlay_pro_upgrade'></div>", 'fuse-social-floating' ),
|
367 |
+
),
|
368 |
+
|
369 |
+
)
|
370 |
+
) );
|
371 |
// -> START Basic Fields
|
372 |
Redux::setSection( $opt_name, array(
|
373 |
'title' => __( 'Design', 'fuse-social-floating' ),
|
377 |
) );
|
378 |
|
379 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
380 |
|
381 |
+
Redux::setSection( $opt_name, array(
|
382 |
+
'title' => __( 'Color Settings', 'fuse-social-floating' ),
|
383 |
+
'id' => 'color_settings',
|
384 |
+
'subsection' => true,
|
385 |
+
'fields' => array(
|
386 |
+
|
387 |
+
array(
|
388 |
+
'id' => 'color_main',
|
389 |
+
'type' => 'repeater',
|
390 |
+
'group_values' => true,
|
391 |
+
'title' => __( 'Apply Color', 'fuse-social-floating' ),
|
392 |
+
'subtitle' => __( '', 'fuse-social-floating' ),
|
393 |
+
'desc' => __( '', 'fuse-social-floating' ),
|
394 |
+
//'group_values' => true, // Group all fields below within the repeater ID
|
395 |
+
//'item_name' => '', // Add a repeater block name to the Add and Delete buttons
|
396 |
+
//'bind_title' => '', // Bind the repeater block title to this field ID
|
397 |
+
//'static' => 2, // Set the number of repeater blocks to be output
|
398 |
+
//'limit' => 2, // Limit the number of repeater blocks a user can create
|
399 |
+
//'sortable' => false, // Allow the users to sort the repeater blocks or not
|
400 |
+
'fields' => array(
|
401 |
+
array(
|
402 |
+
'id' => 'social_select',
|
403 |
+
'type' => 'select',
|
404 |
+
'title' => __('Select Social Icon', 'redux-framework-demo'),
|
405 |
+
// Must provide key => value pairs for select options
|
406 |
+
'options' => array(
|
407 |
+
'Facebook' => 'Facebook',
|
408 |
+
'Twitter' => 'Twitter',
|
409 |
+
'RSS' => 'RSS',
|
410 |
+
'Linkedin' => 'Linkedin',
|
411 |
+
'Youtube' => 'Youtube',
|
412 |
+
'Flickr' => 'Flickr',
|
413 |
+
'Stumbleupon' => 'Stumbleupon',
|
414 |
+
'Instagram' => 'Instagram Profile',
|
415 |
+
'Tumblr' => 'Tumblr',
|
416 |
+
'Vine' => 'Vine',
|
417 |
+
'VK' => 'VK',
|
418 |
+
'SoundCloud' => 'Sound Cloud',
|
419 |
+
'Pinterest' => 'Pinterest',
|
420 |
+
'Reddit' => 'Reddit',
|
421 |
+
'StackOverFlow' => 'Stack OverFlow',
|
422 |
+
'Behance' => 'Behance',
|
423 |
+
'Github' => 'Github',
|
424 |
+
'Email' => 'Email',
|
425 |
+
),
|
426 |
+
'default' => '2',
|
427 |
+
),
|
428 |
+
array(
|
429 |
+
'id' => 'bg_color',
|
430 |
+
'type' => 'color',
|
431 |
+
'title' => __("Icon background color", 'fuse-social-floating'),
|
432 |
+
'transparent' => false
|
433 |
+
),
|
434 |
+
array(
|
435 |
+
'id' => 'icon_m_color',
|
436 |
+
'type' => 'color',
|
437 |
+
'title' => __("Icon color", 'fuse-social-floating'),
|
438 |
+
'transparent' => false
|
439 |
+
),
|
440 |
+
array(
|
441 |
+
'id' => 'hover_bg_color',
|
442 |
+
'type' => 'color',
|
443 |
+
'title' => __("Hover Icon background color", 'fuse-social-floating'),
|
444 |
+
'transparent' => false
|
445 |
+
),
|
446 |
+
array(
|
447 |
+
'id' => 'hover_icon_m_color',
|
448 |
+
'type' => 'color',
|
449 |
+
'title' => __("Hover Icon color", 'fuse-social-floating'),
|
450 |
+
'transparent' => false
|
451 |
+
),
|
452 |
+
|
453 |
+
|
454 |
+
)
|
455 |
+
),
|
456 |
+
array(
|
457 |
+
'id' => 'overlay_for_design_icon',
|
458 |
+
'type' => 'raw',
|
459 |
+
'title' => __( "<div class='overlay_pro_upgrade'></div>", 'fuse-social-floating' ),
|
460 |
+
),
|
461 |
+
|
462 |
+
|
463 |
+
)
|
464 |
+
) );
|
465 |
|
|
|
|
|
466 |
|
467 |
Redux::setSection( $opt_name, array(
|
468 |
'title' => __( 'Icon Designs', 'fuse-social-floating' ),
|
574 |
)
|
575 |
),
|
576 |
) );
|
577 |
+
Redux::setSection( $opt_name, array(
|
578 |
+
'title' => __( 'Conditional Settings', 'fuse-social-floating' ),
|
579 |
+
'id' => 'conditional_st-Sortable',
|
580 |
+
'subsection' => true,
|
581 |
+
'fields' => array(
|
582 |
+
array(
|
583 |
+
'id' => 'not_display_on',
|
584 |
+
'type' => 'select',
|
585 |
+
'multi' => true,
|
586 |
+
'data' => 'posts',
|
587 |
+
'args' => array( 'post_type' => array( 'page' ), 'numberposts' => -1 ),
|
588 |
+
'title' => __( 'Select pages to hide from', 'fuse-social-floating' ),
|
589 |
+
'subtitle' => __( 'If you select this option FUSE will NOT display on these selected pages.', 'fuse-social-floating' ),
|
590 |
+
//'desc' => __( 'Page will be marked as front for this post type', TD ),
|
591 |
+
),
|
592 |
+
array(
|
593 |
+
'id' => 'mobile',
|
594 |
+
'type' => 'switch',
|
595 |
+
'title' => __("Disable for mobile", 'fuse-social-floating'),
|
596 |
+
),
|
597 |
+
|
598 |
+
array(
|
599 |
+
'id' => 'hide_blog_posts',
|
600 |
+
'type' => 'checkbox',
|
601 |
+
'title' => __("Hide from blog posts", 'fuse-social-floating'),
|
602 |
+
),
|
603 |
+
array(
|
604 |
+
'id' => 'overlay_for_conditonal_icon',
|
605 |
+
'type' => 'raw',
|
606 |
+
'title' => __( "<div class='overlay_pro_upgrade'></div>", 'fuse-social-floating' ),
|
607 |
+
),
|
608 |
+
|
609 |
+
)
|
610 |
+
) );
|
611 |
|
612 |
// -> START Basic Fields
|
613 |
Redux::setSection( $opt_name, array(
|
631 |
)
|
632 |
);
|
633 |
|
634 |
+
|
635 |
+
// -> START Basic Fields
|
636 |
+
Redux::setSection( $opt_name, array(
|
637 |
+
'title' => __( 'Action Button', 'fuse-social-floating' ),
|
638 |
+
'id' => 'action_st',
|
639 |
+
'customizer_width' => '400px',
|
640 |
+
'icon' => 'el el-plus-sign',
|
641 |
+
) );
|
642 |
+
Redux::setSection( $opt_name, array(
|
643 |
+
'title' => __( 'Action Button Settings', 'fuse-social-floating' ),
|
644 |
+
'id' => 'action-Sortable',
|
645 |
+
'subsection' => true,
|
646 |
+
'fields' =>
|
647 |
+
array(
|
648 |
+
array(
|
649 |
+
'id' => 'action_button',
|
650 |
+
'type' => 'switch',
|
651 |
+
'title' => __( "Enable Action Button", 'fuse-social-floating' ),
|
652 |
+
),
|
653 |
+
|
654 |
+
|
655 |
+
array(
|
656 |
+
'id' => 'select_icon',
|
657 |
+
'type' => 'text',
|
658 |
+
'title' => __( "Select button icon", 'fuse-social-floating' ),
|
659 |
+
),
|
660 |
+
|
661 |
+
|
662 |
+
array(
|
663 |
+
'id' => 'button_background_color',
|
664 |
+
'type' => 'color_gradient',
|
665 |
+
'title' => __( "Button Background Color", 'fuse-social-floating' ),
|
666 |
+
),
|
667 |
+
array(
|
668 |
+
'id' => 'button_border_color',
|
669 |
+
'type' => 'color',
|
670 |
+
'title' => __( "Button Border Color", 'fuse-social-floating' ),
|
671 |
+
),
|
672 |
+
array(
|
673 |
+
'id' => 'active_social_border_color',
|
674 |
+
'type' => 'color',
|
675 |
+
'title' => __( "Active Social Icon Border Color", 'fuse-social-floating' ),
|
676 |
+
),
|
677 |
+
array(
|
678 |
+
'id' => 'active_animate_hover',
|
679 |
+
'type' => 'switch',
|
680 |
+
'title' => __( "Active Animate on hover", 'fuse-social-floating' ),
|
681 |
+
),
|
682 |
+
array(
|
683 |
+
'id' => 'overlay_for_pro_upgrade',
|
684 |
+
'type' => 'raw',
|
685 |
+
'title' => __( "<div class='overlay_pro_upgrade'></div>", 'fuse-social-floating' ),
|
686 |
+
),
|
687 |
+
|
688 |
+
|
689 |
+
),
|
690 |
+
|
691 |
+
)
|
692 |
+
);
|
693 |
+
|
694 |
+
|
695 |
// -> START Basic Fields
|
696 |
Redux::setSection( $opt_name, array(
|
697 |
'title' => __( 'Analytics', 'fuse-social-floating' ),
|
fuse_social_sidebar.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Fuse Social Floating Sidebar
|
4 |
Plugin URI: http://photontechs.com/fuse-social-sidebar
|
5 |
Description: This Fuse Social Floating Sidebar plugin allow you to put social icons which can be link with your social media profiles.
|
6 |
-
Version: 5.
|
7 |
Author: Daniyal Ahmed
|
8 |
Author URI: http://www.photontechs.com
|
9 |
License: GNU General Public License v3.0
|
@@ -63,7 +63,7 @@ require_once 'inc/fuse_social_sidebar_scripts.php';
|
|
63 |
// Add settings link on plugin page
|
64 |
function fuse_social_dashboard_icons()
|
65 |
{
|
66 |
-
wp_register_style( 'fuse-social-dash', plugin_dir_url( __FILE__ ) . '
|
67 |
wp_enqueue_style( 'fuse-social-dash' );
|
68 |
}
|
69 |
|
@@ -74,7 +74,8 @@ function fuse_social_admin_styles()
|
|
74 |
{
|
75 |
if ( !empty($_GET['page']) ) {
|
76 |
if ( $_GET['page'] == "FUSESoicalFloatingSidebar" ) {
|
77 |
-
wp_enqueue_style( 'fuse-styles', plugin_dir_url( __FILE__ ) . '
|
|
|
78 |
}
|
79 |
}
|
80 |
}
|
3 |
Plugin Name: Fuse Social Floating Sidebar
|
4 |
Plugin URI: http://photontechs.com/fuse-social-sidebar
|
5 |
Description: This Fuse Social Floating Sidebar plugin allow you to put social icons which can be link with your social media profiles.
|
6 |
+
Version: 5.4
|
7 |
Author: Daniyal Ahmed
|
8 |
Author URI: http://www.photontechs.com
|
9 |
License: GNU General Public License v3.0
|
63 |
// Add settings link on plugin page
|
64 |
function fuse_social_dashboard_icons()
|
65 |
{
|
66 |
+
wp_register_style( 'fuse-social-dash', plugin_dir_url( __FILE__ ) . 'inc/css/dashicon.css' );
|
67 |
wp_enqueue_style( 'fuse-social-dash' );
|
68 |
}
|
69 |
|
74 |
{
|
75 |
if ( !empty($_GET['page']) ) {
|
76 |
if ( $_GET['page'] == "FUSESoicalFloatingSidebar" ) {
|
77 |
+
wp_enqueue_style( 'fuse-styles', plugin_dir_url( __FILE__ ) . 'inc/css/admin.css', array(), rand() );
|
78 |
+
wp_enqueue_script( 'fuse-admin-script', plugin_dir_url( __FILE__ ) . 'inc/js/admin-fuse.js', array(), rand() );
|
79 |
}
|
80 |
}
|
81 |
}
|
inc/css/admin.css
CHANGED
@@ -472,6 +472,93 @@ fieldset#fuse-up_txt_ls img {
|
|
472 |
.updated.success.fs-notice.fs-sticky.fs-has-title.fs-slug-fuse-social-floating-sidebar.fs-type-plugin {
|
473 |
margin-top: 51px;
|
474 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
475 |
fieldset#fuse-custom_icon_upgrade .upgrade_now_cn a {
|
476 |
max-width: 100% !important;
|
477 |
}
|
472 |
.updated.success.fs-notice.fs-sticky.fs-has-title.fs-slug-fuse-social-floating-sidebar.fs-type-plugin {
|
473 |
margin-top: 51px;
|
474 |
}
|
475 |
+
.overlay_pro_upgrade {
|
476 |
+
position: absolute;
|
477 |
+
width: 100%;
|
478 |
+
top: 0;
|
479 |
+
left: 0;
|
480 |
+
height: 100%;
|
481 |
+
z-index: 9999;
|
482 |
+
}
|
483 |
+
.upgrade_take_screen {
|
484 |
+
position: fixed;
|
485 |
+
left: 0;
|
486 |
+
width: 100%;
|
487 |
+
height: 100%;
|
488 |
+
background: rgb(0 0 0 / 61%);
|
489 |
+
z-index: 99999999;
|
490 |
+
top: 0;
|
491 |
+
}
|
492 |
+
|
493 |
+
.upgrade_take_inner {
|
494 |
+
max-width: 600px;
|
495 |
+
margin: 0 auto;
|
496 |
+
position: relative;
|
497 |
+
top: 50%;
|
498 |
+
transform: translateY(-50%);
|
499 |
+
background: #fff;
|
500 |
+
padding: 15px;
|
501 |
+
}
|
502 |
+
|
503 |
+
.upgrade_popup_now h3 {
|
504 |
+
margin: 0;
|
505 |
+
text-align: center;
|
506 |
+
font-size: 23px;
|
507 |
+
text-transform: uppercase;
|
508 |
+
padding: 10px 10px 21px 10px;
|
509 |
+
border-bottom: 1px solid #eee;
|
510 |
+
}
|
511 |
+
|
512 |
+
.upgrade_popup_now p {
|
513 |
+
font-size: 17px;
|
514 |
+
text-align: center;
|
515 |
+
}
|
516 |
+
|
517 |
+
.upgrade_popup_now h4 {
|
518 |
+
font-size: 20px;
|
519 |
+
text-align: center;
|
520 |
+
}
|
521 |
+
|
522 |
+
.upgrade_popup_now a {
|
523 |
+
background-image: linear-gradient( 219.3deg, #9500c7 4.7%, rgba(130,0,226,1) 22.9%, rgba(95,0,199,1) 43.2%, rgba(70,0,199,1) 63.9%, rgba(5,0,199,1) 85.1%, #005fc7 106.8% ) !important;
|
524 |
+
color: #fff;
|
525 |
+
width: 100%;
|
526 |
+
display: block;
|
527 |
+
text-align: center;
|
528 |
+
padding: 21px;
|
529 |
+
font-size: 20px;
|
530 |
+
text-decoration: none;
|
531 |
+
max-width: 200px;
|
532 |
+
margin: 45px auto;
|
533 |
+
margin-bottom: 0;
|
534 |
+
border-radius: 4px;
|
535 |
+
}
|
536 |
+
.upgrade_take_screen {
|
537 |
+
display: none;
|
538 |
+
}
|
539 |
+
a.close-time {
|
540 |
+
position: absolute;
|
541 |
+
right: 0;
|
542 |
+
top: 0;
|
543 |
+
background: #000;
|
544 |
+
color: #fff;
|
545 |
+
padding: 7px 13px;
|
546 |
+
text-decoration: none;
|
547 |
+
border-radius: 0 10px 0 0;
|
548 |
+
}
|
549 |
+
|
550 |
+
|
551 |
+
.upgrade_popup_now {
|
552 |
+
font-family: 'Source Sans Pro', sans-serif;
|
553 |
+
}
|
554 |
+
|
555 |
+
.upgrade_take_inner * {
|
556 |
+
box-sizing: border-box;
|
557 |
+
}
|
558 |
+
|
559 |
+
.upgrade_take_inner {
|
560 |
+
border-radius: 10px;
|
561 |
+
}
|
562 |
fieldset#fuse-custom_icon_upgrade .upgrade_now_cn a {
|
563 |
max-width: 100% !important;
|
564 |
}
|
inc/extensions/extensions/icon_select/extension_icon_select.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Redux Framework is free software: you can redistribute it and/or modify
|
5 |
+
* it under the terms of the GNU General Public License as published by
|
6 |
+
* the Free Software Foundation, either version 2 of the License, or
|
7 |
+
* any later version.
|
8 |
+
*
|
9 |
+
* Redux Framework is distributed in the hope that it will be useful,
|
10 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
+
* GNU General Public License for more details.
|
13 |
+
*
|
14 |
+
* You should have received a copy of the GNU General Public License
|
15 |
+
* along with Redux Framework. If not, see <http://www.gnu.org/licenses/>.
|
16 |
+
*
|
17 |
+
* @package ReduxFramework
|
18 |
+
* @author Dovy Paukstys (dovy)
|
19 |
+
* @author Kevin Provance (kprovance) - tinkered with it.
|
20 |
+
* @version 1.0.6
|
21 |
+
*/
|
22 |
+
|
23 |
+
// Exit if accessed directly
|
24 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
25 |
+
exit;
|
26 |
+
}
|
27 |
+
|
28 |
+
// Don't duplicate me!
|
29 |
+
if ( ! class_exists( 'ReduxFramework_extension_icon_select' ) ) {
|
30 |
+
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Main ReduxFramework icon_select extension class
|
34 |
+
*
|
35 |
+
* @since 3.1.6
|
36 |
+
*/
|
37 |
+
class ReduxFramework_extension_icon_select {
|
38 |
+
|
39 |
+
static $version = "1.0.6";
|
40 |
+
|
41 |
+
// Protected vars
|
42 |
+
protected $parent;
|
43 |
+
public $extension_url;
|
44 |
+
public $extension_dir;
|
45 |
+
public static $theInstance;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Class Constructor. Defines the args for the extions class
|
49 |
+
*
|
50 |
+
* @since 1.0.0
|
51 |
+
* @access public
|
52 |
+
*
|
53 |
+
* @param array $sections Panel sections.
|
54 |
+
* @param array $args Class constructor arguments.
|
55 |
+
* @param array $extra_tabs Extra panel tabs.
|
56 |
+
*
|
57 |
+
* @return void
|
58 |
+
*/
|
59 |
+
public function __construct( $parent ) {
|
60 |
+
$this->parent = $parent;
|
61 |
+
|
62 |
+
$this->field_name = 'icon_select';
|
63 |
+
|
64 |
+
if ( empty( self::$_extension_dir ) ) {
|
65 |
+
$this->_extension_dir = trailingslashit( str_replace( '\\', '/', dirname( __FILE__ ) ) );
|
66 |
+
$this->_extension_url = site_url( str_replace( trailingslashit( str_replace( '\\', '/', ABSPATH ) ), '', $this->_extension_dir ) );
|
67 |
+
}
|
68 |
+
|
69 |
+
self::$theInstance = $this;
|
70 |
+
|
71 |
+
add_filter( 'redux/' . $this->parent->args['opt_name'] . '/field/class/' . $this->field_name, array(
|
72 |
+
&$this,
|
73 |
+
'overload_field_path'
|
74 |
+
) ); // Adds the local field
|
75 |
+
}
|
76 |
+
|
77 |
+
public function getInstance() {
|
78 |
+
return self::$theInstance;
|
79 |
+
}
|
80 |
+
|
81 |
+
// Forces the use of the embeded field path vs what the core typically would use
|
82 |
+
public function overload_field_path( $field ) {
|
83 |
+
return dirname( __FILE__ ) . '/' . $this->field_name . '/field_' . $this->field_name . '.php';
|
84 |
+
}
|
85 |
+
} // class
|
86 |
+
} // if
|
inc/extensions/extensions/icon_select/icon_select/field_icon_select.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.redux-container-icon_select .redux-icon-container{position:relative;overflow-y:auto;border:2px solid #eee;padding:5px;text-align:center}.redux-container-icon_select .redux-icon-select{margin:0 !important}.redux-container-icon_select .redux-icon-select input[type='radio']{display:none}.redux-container-icon_select .redux-icon-select i{border-color:transparent;color:#555}.redux-container-icon_select .redux-icon-select i:hover{border-color:#ddd;color:#111}.redux-container-icon_select ul.redux-icon-select li{margin:10px;display:block;float:left;padding:5px}.redux-container-icon_select .redux-icon-select i,.redux-container-icon_select .redux-icon-select-selected i{border-width:4px;border-style:solid;font-size:30px;padding:5px}.redux-container-icon_select .redux-icon-select-selected i,.redux-container-icon_select .redux-icon-select-selected i:hover{border-color:#7a7a7a;color:#269ad6}
|
inc/extensions/extensions/icon_select/icon_select/field_icon_select.js
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* global confirm, redux, redux_change */
|
2 |
+
|
3 |
+
(function ($) {
|
4 |
+
"use strict";
|
5 |
+
|
6 |
+
redux.field_objects = redux.field_objects || {};
|
7 |
+
redux.field_objects.icon_select = redux.field_objects.icon_select || {};
|
8 |
+
|
9 |
+
redux.field_objects.icon_select.init = function (selector) {
|
10 |
+
if (!selector) {
|
11 |
+
selector = $(document).find(".redux-group-tab:visible").find('.redux-container-icon_select:visible');
|
12 |
+
}
|
13 |
+
|
14 |
+
$(selector).each(
|
15 |
+
function () {
|
16 |
+
var el = $(this);
|
17 |
+
var parent = el;
|
18 |
+
|
19 |
+
if (!el.hasClass('redux-field-container')) {
|
20 |
+
parent = el.parents('.redux-field-container:first');
|
21 |
+
}
|
22 |
+
|
23 |
+
if (parent.is(":hidden")) { // Skip hidden fields
|
24 |
+
return;
|
25 |
+
}
|
26 |
+
|
27 |
+
if (parent.hasClass('redux-field-init')) {
|
28 |
+
parent.removeClass('redux-field-init');
|
29 |
+
} else {
|
30 |
+
return;
|
31 |
+
}
|
32 |
+
|
33 |
+
// On label click, change the input and class
|
34 |
+
el.find('.redux-icon-select label i, .redux-icon-select label .tiles').click(function (e) {
|
35 |
+
var id = $(this).closest('label').attr('for');
|
36 |
+
$(this).parents("fieldset:first").find('.redux-icon-select-selected').removeClass('redux-icon-select-selected');
|
37 |
+
$(this).closest('label').find('input[type="radio"]').prop('checked');
|
38 |
+
|
39 |
+
redux_change($(this).closest('label').find('input[type="radio"]'));
|
40 |
+
|
41 |
+
el.find('label[for="' + id + '"]').addClass('redux-icon-select-selected').find("input[type='radio']").attr("checked", true);
|
42 |
+
});
|
43 |
+
}
|
44 |
+
);
|
45 |
+
};
|
46 |
+
})(jQuery);
|
inc/extensions/extensions/icon_select/icon_select/field_icon_select.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
(function(a){redux.field_objects=redux.field_objects||{};redux.field_objects.icon_select=redux.field_objects.icon_select||{};redux.field_objects.icon_select.init=function(b){if(!b){b=a(document).find(".redux-group-tab:visible").find(".redux-container-icon_select:visible")}a(b).each(function(){var d=a(this);var c=d;if(!d.hasClass("redux-field-container")){c=d.parents(".redux-field-container:first")}if(c.is(":hidden")){return}if(c.hasClass("redux-field-init")){c.removeClass("redux-field-init")}else{return}d.find(".redux-icon-select label i, .redux-icon-select label .tiles").click(function(f){var g=a(this).closest("label").attr("for");a(this).parents("fieldset:first").find(".redux-icon-select-selected").removeClass("redux-icon-select-selected");a(this).closest("label").find('input[type="radio"]').prop("checked");redux_change(a(this).closest("label").find('input[type="radio"]'));d.find('label[for="'+g+'"]').addClass("redux-icon-select-selected").find("input[type='radio']").attr("checked",true)})})}})(jQuery);
|
inc/extensions/extensions/icon_select/icon_select/field_icon_select.php
ADDED
@@ -0,0 +1,230 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Redux Framework is free software: you can redistribute it and/or modify
|
4 |
+
* it under the terms of the GNU General Public License as published by
|
5 |
+
* the Free Software Foundation, either version 2 of the License, or
|
6 |
+
* any later version.
|
7 |
+
*
|
8 |
+
* Redux Framework is distributed in the hope that it will be useful,
|
9 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11 |
+
* GNU General Public License for more details.
|
12 |
+
*
|
13 |
+
* You should have received a copy of the GNU General Public License
|
14 |
+
* along with Redux Framework. If not, see <http://www.gnu.org/licenses/>.
|
15 |
+
*
|
16 |
+
* @package ReduxFramework
|
17 |
+
* @author Dovy Paukstys
|
18 |
+
* @version 1.0.6
|
19 |
+
*/
|
20 |
+
|
21 |
+
// Exit if accessed directly
|
22 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
23 |
+
exit;
|
24 |
+
}
|
25 |
+
|
26 |
+
// Don't duplicate me!
|
27 |
+
if ( ! class_exists( 'ReduxFramework_icon_select' ) ) {
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Main ReduxFramework_icon_select class
|
31 |
+
*
|
32 |
+
* @since 1.0.0
|
33 |
+
*/
|
34 |
+
class ReduxFramework_icon_select extends ReduxFramework_extension_icon_select {
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Field Constructor.
|
38 |
+
*
|
39 |
+
* Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function
|
40 |
+
*
|
41 |
+
* @since 1.0.0
|
42 |
+
* @access public
|
43 |
+
* @return void
|
44 |
+
*/
|
45 |
+
function __construct( $field = array(), $value = '', $parent ) {
|
46 |
+
|
47 |
+
$this->parent = $parent;
|
48 |
+
$this->field = $field;
|
49 |
+
$this->value = $value;
|
50 |
+
|
51 |
+
if ( empty( $this->extension_dir ) ) {
|
52 |
+
$this->extension_dir = trailingslashit( str_replace( '\\', '/', dirname( __FILE__ ) ) );
|
53 |
+
$this->extension_url = site_url( str_replace( trailingslashit( str_replace( '\\', '/', ABSPATH ) ), '', $this->extension_dir ) );
|
54 |
+
}
|
55 |
+
|
56 |
+
$defaults = array(
|
57 |
+
'options' => array(),
|
58 |
+
'stylesheet' => '',
|
59 |
+
'output' => true,
|
60 |
+
'prefix' => '',
|
61 |
+
'selector' => '',
|
62 |
+
'height' => '250px',
|
63 |
+
'enqueue' => true,
|
64 |
+
'enqueue_frontend' => true
|
65 |
+
);
|
66 |
+
|
67 |
+
$this->field = wp_parse_args( $this->field, $defaults );
|
68 |
+
|
69 |
+
if ( empty( $this->field['options'] ) && $this->field['stylesheet'] != '' ) {
|
70 |
+
|
71 |
+
global $wp_filesystem;
|
72 |
+
|
73 |
+
$this->field['stylesheet'] = ReduxFramework::$_dir . 'assets/css/vendor/font-awesome/font-awesome.min.css';
|
74 |
+
$this->field['enqueue'] = false;
|
75 |
+
$this->field['enqueue_frontend'] = true;
|
76 |
+
$this->field['selector'] = "fa-";
|
77 |
+
$this->field['prefix'] = "fa";
|
78 |
+
}
|
79 |
+
|
80 |
+
if ( empty( $this->field['options'] ) && ! empty( $this->field['stylesheet'] ) && ! empty( $this->field['selector'] ) ) {
|
81 |
+
if ( stripos( $this->field['stylesheet'], "//" ) === false ) {
|
82 |
+
// Initialize the Wordpress filesystem, no more using file_put_contents function
|
83 |
+
if ( empty( $wp_filesystem ) ) {
|
84 |
+
require_once( ABSPATH . '/wp-admin/includes/file.php' );
|
85 |
+
WP_Filesystem();
|
86 |
+
}
|
87 |
+
|
88 |
+
$toParse = $wp_filesystem->get_contents( $this->field['stylesheet'] );
|
89 |
+
$this->stylesheet_url = site_url( str_replace( trailingslashit( str_replace( '\\', '/', ABSPATH ) ), '', $this->field['stylesheet'] ) );
|
90 |
+
} else {
|
91 |
+
$this->stylesheet_url = $this->field['stylesheet'];
|
92 |
+
$toParse = wp_remote_get( $this->field['stylesheet'] );
|
93 |
+
$toParse = $toParse['body'];
|
94 |
+
}
|
95 |
+
|
96 |
+
preg_match_all( "/(" . $this->field['selector'] . ".*?):before/", $toParse, $output_array );
|
97 |
+
|
98 |
+
foreach ( $output_array[1] as $class ) {
|
99 |
+
$this->field['options'][ $class ] = $class;
|
100 |
+
}
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Field Render Function.
|
106 |
+
*
|
107 |
+
* Takes the vars and outputs the HTML for the field in the settings
|
108 |
+
*
|
109 |
+
* @since 1.0.0
|
110 |
+
* @access public
|
111 |
+
* @return void
|
112 |
+
*/
|
113 |
+
public function render() {
|
114 |
+
if ( ! empty( $this->field['options'] ) ) {
|
115 |
+
$style = '';
|
116 |
+
|
117 |
+
if ( ! empty( $this->field['height'] ) ) {
|
118 |
+
$style .= 'height: ' . $this->field['height'];
|
119 |
+
|
120 |
+
if ( is_numeric( $this->field['height'] ) ) {
|
121 |
+
$style .= 'px';
|
122 |
+
}
|
123 |
+
|
124 |
+
$style .= ';';
|
125 |
+
}
|
126 |
+
|
127 |
+
echo '<div class="redux-icon-container" style="' . $style . '">';
|
128 |
+
echo '<ul class="redux-icon-select">';
|
129 |
+
|
130 |
+
$x = 1;
|
131 |
+
foreach ( $this->field['options'] as $k => $v ) {
|
132 |
+
if ( ! empty( $this->field['prefix'] ) ) {
|
133 |
+
$k = $this->field['prefix'] . ' ' . $k;
|
134 |
+
}
|
135 |
+
|
136 |
+
$selected = ( checked( $this->value, $k, false ) != '' ) ? ' redux-icon-select-selected' : '';
|
137 |
+
|
138 |
+
echo '<li class="redux-icon-select">';
|
139 |
+
echo '<label class="' . $selected . ' redux-icon-select' . $this->field['id'] . '_' . $x . '" for="' . $this->field['id'] . '_' . $k . '">';
|
140 |
+
|
141 |
+
echo '<input type="radio" class="' . $this->field['class'] . '" id="' . $this->field['id'] . '_' . $k . '" name="' . $this->field['name'] . $this->field['name_suffix'] . '['.$x.']" value="' . $k . '" ' . checked( $this->value, $k, false ) . '/>';
|
142 |
+
|
143 |
+
echo '<i title="' . $v . '" class="' . $k . '" /></i>';
|
144 |
+
|
145 |
+
echo '</label>';
|
146 |
+
echo '</li>';
|
147 |
+
$x ++;
|
148 |
+
}
|
149 |
+
|
150 |
+
echo '</ul>';
|
151 |
+
echo '</div>';
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Enqueue Function.
|
157 |
+
*
|
158 |
+
* If this field requires any scripts, or css define this function and register/enqueue the scripts/css
|
159 |
+
*
|
160 |
+
* @since 1.0.0
|
161 |
+
* @access public
|
162 |
+
* @return void
|
163 |
+
*/
|
164 |
+
public function enqueue() {
|
165 |
+
$extension = ReduxFramework_extension_icon_select::getInstance();
|
166 |
+
|
167 |
+
$min = Redux_Functions::isMin();
|
168 |
+
|
169 |
+
wp_enqueue_script(
|
170 |
+
'redux-field-icon-select-js',
|
171 |
+
$this->extension_url . 'field_icon_select' . $min . '.js',
|
172 |
+
array( 'jquery' ),
|
173 |
+
time(),
|
174 |
+
true
|
175 |
+
);
|
176 |
+
|
177 |
+
if ( function_exists( 'redux_enqueue_style' ) ) {
|
178 |
+
redux_enqueue_style(
|
179 |
+
$this->parent,
|
180 |
+
'redux-field-icon-select-css',
|
181 |
+
$this->extension_url . 'field_icon_select.css',
|
182 |
+
$this->extension_dir,
|
183 |
+
array(),
|
184 |
+
time()
|
185 |
+
);
|
186 |
+
} else {
|
187 |
+
wp_enqueue_style(
|
188 |
+
'redux-field-icon-select-css',
|
189 |
+
$this->extension_url . 'field_icon_select.css',
|
190 |
+
time(),
|
191 |
+
true
|
192 |
+
);
|
193 |
+
}
|
194 |
+
|
195 |
+
if ( isset( $this->stylesheet_url ) && $this->field['enqueue'] ) {
|
196 |
+
wp_register_style(
|
197 |
+
$this->field['id'] . '-webfont',
|
198 |
+
$this->stylesheet_url,
|
199 |
+
array(),
|
200 |
+
time(),
|
201 |
+
'all'
|
202 |
+
);
|
203 |
+
|
204 |
+
wp_enqueue_style( $this->field['id'] . '-webfont' );
|
205 |
+
}
|
206 |
+
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Output Function.
|
211 |
+
*
|
212 |
+
* Used to enqueue to Webfont to the front-end
|
213 |
+
*
|
214 |
+
* @since 1.0.0
|
215 |
+
* @access public
|
216 |
+
* @return void
|
217 |
+
*/
|
218 |
+
public function output() {
|
219 |
+
if ( isset( $this->stylesheet_url ) && $this->field['enqueue_frontend'] ) {
|
220 |
+
wp_enqueue_style(
|
221 |
+
'redux-' . $this->field['selector'] . '-webfont',
|
222 |
+
$this->stylesheet_url,
|
223 |
+
array(),
|
224 |
+
time(),
|
225 |
+
'all'
|
226 |
+
);
|
227 |
+
}
|
228 |
+
}
|
229 |
+
}
|
230 |
+
}
|
inc/extensions/extensions/icon_select/icon_select/field_icon_select.scss
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.redux-container-icon_select {
|
2 |
+
.redux-icon-container {
|
3 |
+
position: relative;
|
4 |
+
overflow-y: auto;
|
5 |
+
border: 2px solid #eee;
|
6 |
+
padding: 5px;
|
7 |
+
text-align: center;
|
8 |
+
}
|
9 |
+
|
10 |
+
.redux-icon-select {
|
11 |
+
margin: 0 !important;
|
12 |
+
|
13 |
+
input[type='radio'] {
|
14 |
+
display: none;
|
15 |
+
}
|
16 |
+
|
17 |
+
i {
|
18 |
+
border-color: transparent;
|
19 |
+
color: #555;
|
20 |
+
|
21 |
+
&:hover {
|
22 |
+
border-color: #ddd;
|
23 |
+
color: #111;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
ul {
|
29 |
+
&.redux-icon-select li {
|
30 |
+
margin: 10px;
|
31 |
+
display: block;
|
32 |
+
float: left;
|
33 |
+
padding: 5px;
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
.redux-icon-select i,
|
38 |
+
.redux-icon-select-selected i {
|
39 |
+
border-width: 4px;
|
40 |
+
border-style: solid;
|
41 |
+
font-size: 30px;
|
42 |
+
padding: 5px;
|
43 |
+
}
|
44 |
+
|
45 |
+
.redux-icon-select-selected {
|
46 |
+
i,
|
47 |
+
i:hover {
|
48 |
+
border-color: #7a7a7a;
|
49 |
+
color: #269ad6;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
}
|
inc/extensions/extensions/metaboxes/extension_metaboxes.css
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
/* Metaboxes CSS overrides */
|
2 |
+
.wpseotab tr{display:table-row!important}.redux_field_th{padding-bottom:0!important}.postbox .redux-container{filter:none;border:0;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none}.redux-group-tab{margin-bottom:0!important}.postbox .redux-container .redux-group-menu .active a{background:#FFF}.postbox .redux-container .redux-section-title{padding-left:0!important;margin-bottom:15px!important}.postbox .redux-container .redux-section-desc{margin-bottom:20px}.postbox .redux-container .redux_main{border-left:1px solid #D8D8D8;moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none}.postbox .redux-container .redux_main input[type=text]{width:95%}.postbox .redux-container.redux-no-sections{margin:0;background:0}.postbox .redux-container.redux-no-sections .redux-main{background:0;margin-left:inherit;padding:inherit;border-left:0!important;min-height:0!important}.postbox .redux-container.redux-no-sections .redux-main tr td{padding-top:20px!important;width:100%}.postbox .redux-container.redux-no-sections .redux-main tr:last-child{border-bottom:0}.postbox .redux-container.redux-no-sections .redux-main tr:last-child th,.postbox .redux-container.redux-no-sections .redux-main tr:last-child td{padding-bottom:0}.postbox .redux-container.redux-no-sections .redux-main .form-table:first-child tr:first-child td{padding-top:0!important}.postbox .redux-container.redux-no-sections .redux-main .redux-field{margin-bottom:10px!important}.postbox .redux-container.redux-no-sections .redux-main .redux-field:last-child{margin-bottom:0!important}.postbox .redux-container.redux-has-sections .redux-main{background:#fff}.redux-box-side .redux-main .redux-field-container{padding:0;padding-top:5px}.redux-box-side .redux-main .redux-field-container .select2-container,.redux-box-side .redux-main .redux-field-container select{width:100%!important}.redux-box-side .form-table tr td{padding:15px 0!important}.redux-box-side .form-table tr:last-child td{padding-bottom:0!important}.redux-box-side .form-table tr:first-child td{padding-top:5px!important}.redux-box-side .form-table tr:first-child td{padding-top:5px!important}.postbox .redux-main h3{cursor:text!important;-webkit-user-select:inherit!important;-moz-user-select:inherit!important;user-select:inherit!important;padding-left:0!important}#poststuff h3.redux-hndle,.metabox-holder h3.redux-hndle{cursor:pointer;border-bottom:0}.display-group{display:inherit!important}.postbox .redux-container.redux-no-sections .redux-main tr td{padding-top:10px!important}@media (min-width: 1125px) and (max-width: 1405px){.postbox table.form-table,.postbox .form-table>thead,.postbox .form-table>tbody,.postbox .form-table>tbody>tr>th,.postbox .form-table>tbody>tr>td,.postbox .form-table>tbody>tr{ display:block!important;width:100%!important;padding:0!important}.postbox table.form-table.hide,.postbox .form-table>thead.hide,.postbox .form-table>tbody.hide,.postbox .form-table>tbody>tr>th.hide,.postbox .form-table>tbody>tr>td.hide,.postbox .form-table>tbody>tr.hide{display:none!important}.postbox .form-table>tbody>tr>th,.postbox .form-table>tbody>tr>td{padding:10px!important}.postbox .form-table>tbody>tr>th,.postbox .form-table>tbody>tr>td{padding:10px!important}.postbox .form-table>tbody>tr>th{width:35%}}.redux-box-side .redux-main .redux-field-container .select2-container,.redux-box-side .redux-main .redux-field-container select{width:96%!important}@media (max-width: 1405px){.redux-box-side .redux-main .redux-field-container .select2-container,.redux-box-side .redux-main .redux-field-container select{ width:92%!important}}@media (max-width: 1125px){.redux-box-side .redux-main .redux-field-container .select2-container,.redux-box-side .redux-main .redux-field-container select{ width:100%!important}}@media (max-width: 1405px){.redux-main .form-table>tbody>tr>td{ padding-top:0!important;padding-bottom:0!important}.redux-main .redux-field-container{padding:0 0 20px 0!important}.postbox .form-table>tbody>tr>th{padding-bottom:0!important}.redux_field_th{padding-top:0!important;padding-bottom:10px!important}.redux-main .redux-field-container{padding-bottom:10px!important}}.redux-no-sections .redux-group-tab{display:block!important}.admin-color-fresh #poststuff h3.redux-hndle,.admin-color-fresh .metabox-holder h3.redux-hndle{background:#222;color:#fff}.admin-color-light #poststuff h3.redux-hndle,.admin-color-light .metabox-holder h3.redux-hndle{background:#888;color:#fff}.admin-color-blue #poststuff h3.redux-hndle,.admin-color-blue .metabox-holder h3.redux-hndle{background:#096484;color:#fff}.admin-color-coffee #poststuff h3.redux-hndle,.admin-color-coffee .metabox-holder h3.redux-hndle{background:#46403c;color:#fff}.admin-color-ectoplasm #poststuff h3.redux-hndle,.admin-color-ectoplasm .metabox-holder h3.redux-hndle{background:#413256;color:#fff}.admin-color-midnight #poststuff h3.redux-hndle,.admin-color-midnight .metabox-holder h3.redux-hndle{background:#363b3f;color:#fff}.admin-color-ocean #poststuff h3.redux-hndle,.admin-color-ocean .metabox-holder h3.redux-hndle{background:#627c83;color:#fff}.admin-color-sunrise #poststuff h3.redux-hndle,.admin-color-sunrise .metabox-holder h3.redux-hndle{background:#b43c38;color:#fff}.redux-notices{margin-bottom:0;border:0}.redux-metabox .redux-container{margin-top:0}.redux-metabox .inside{margin:0!important;padding:0!important}.redux-metabox .redux-no-sections .redux-main{padding:6px 15px 15px 15px!important}.redux-metabox .redux-no-sections .redux-main .default_br{display:none}.redux-metabox .redux-no-sections .redux-main .redux-field-container{padding:10px 0 20px!important}.redux-metabox .redux-no-sections .redux-main .redux_field_th{padding-top:5px!important}.redux-metabox .redux-no-sections.redux-box-side .redux-main{padding:6px 8px 8px 8px!important}.redux-metabox .redux-no-sections.redux-box-side .redux-main input[type=text]{width:100%!important}.wp-color-result{margin:0 6px 0 0!important}.redux-container .ui-button-text-only .ui-button-text{padding:0}
|
3 |
+
/* This beautiful CSS-File has been crafted with LESS (lesscss.org) and compiled by simpLESS (wearekiss.com/simpless) */
|
inc/extensions/extensions/metaboxes/extension_metaboxes.js
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Redux Metaboxes
|
5 |
+
* Dependencies : jquery
|
6 |
+
* Created by : Dovy Paukstys
|
7 |
+
* Date : 19 Feb. 2014
|
8 |
+
*/
|
9 |
+
|
10 |
+
/* global reduxMetaboxes, redux */
|
11 |
+
|
12 |
+
jQuery(function($){
|
13 |
+
|
14 |
+
"use strict";
|
15 |
+
|
16 |
+
$.reduxMetaBoxes = $.reduxMetaBoxes || {};
|
17 |
+
|
18 |
+
$(document).ready(function () {
|
19 |
+
$.reduxMetaBoxes.init();
|
20 |
+
});
|
21 |
+
|
22 |
+
$.reduxMetaBoxes.init = function(){
|
23 |
+
$.reduxMetaBoxes.notLoaded = true;
|
24 |
+
$.reduxMetaBoxes.checkBoxVisibility();
|
25 |
+
$('.redux-container').each(function() {
|
26 |
+
$(this).parents('.postbox:first').find('h3.hndle').addClass('redux-hndle');
|
27 |
+
$(this).parents('.postbox:first').addClass('redux-metabox');
|
28 |
+
$(this).parents('.postbox:first').addClass( 'redux-' + redux.args.opt_name );
|
29 |
+
if ( redux.args.container_class !== "" ) {
|
30 |
+
$(this).parents('.postbox:first').addClass( redux.args.class );
|
31 |
+
}
|
32 |
+
});
|
33 |
+
$('#page_template').change(function() {
|
34 |
+
$.reduxMetaBoxes.checkBoxVisibility('page_template');
|
35 |
+
});
|
36 |
+
$('input[name="post_format"]:radio').change(function() {
|
37 |
+
$.reduxMetaBoxes.checkBoxVisibility('post_format');
|
38 |
+
});
|
39 |
+
|
40 |
+
$.redux.initFields();
|
41 |
+
};
|
42 |
+
|
43 |
+
$('#publishing-action .button, #save-action .button').click(function() {
|
44 |
+
window.onbeforeunload = null;
|
45 |
+
});
|
46 |
+
var testValue;
|
47 |
+
$.reduxMetaBoxes.checkBoxVisibility = function(fieldID){
|
48 |
+
if (reduxMetaboxes.length !== 0) {
|
49 |
+
$.each(reduxMetaboxes, function(box, values) {
|
50 |
+
$.each(values, function(field, v) {
|
51 |
+
if (field === fieldID || !fieldID) {
|
52 |
+
if (field === "post_format") {
|
53 |
+
testValue = $("input:radio[name='post_format']:checked").val();
|
54 |
+
} else {
|
55 |
+
testValue = $('#'+field).val();
|
56 |
+
}
|
57 |
+
if (testValue) {
|
58 |
+
var visible = false;
|
59 |
+
$.each(v, function(key, val) {
|
60 |
+
if (val === testValue) {
|
61 |
+
visible = true;
|
62 |
+
}
|
63 |
+
});
|
64 |
+
if (!visible && !$.reduxMetaBoxes.notLoaded) {
|
65 |
+
$('#'+box).hide();
|
66 |
+
}
|
67 |
+
else if (!visible) {
|
68 |
+
$('#'+box).fadeOut('50');
|
69 |
+
} else {
|
70 |
+
$('#'+box).fadeIn('300');
|
71 |
+
$.redux.initFields();
|
72 |
+
}
|
73 |
+
}
|
74 |
+
}
|
75 |
+
});
|
76 |
+
});
|
77 |
+
}
|
78 |
+
};
|
79 |
+
});
|
inc/extensions/extensions/metaboxes/extension_metaboxes.less
ADDED
@@ -0,0 +1,315 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.wpseotab tr {
|
2 |
+
display: table-row !important
|
3 |
+
}
|
4 |
+
|
5 |
+
|
6 |
+
.redux_field_th {
|
7 |
+
padding-bottom: 0px !important;
|
8 |
+
}
|
9 |
+
|
10 |
+
.postbox .redux-container {
|
11 |
+
filter: none;
|
12 |
+
border: none;
|
13 |
+
-moz-border-radius: 0;
|
14 |
+
/* Firefox */
|
15 |
+
|
16 |
+
-webkit-border-radius: 0;
|
17 |
+
/* Safari, Chrome */
|
18 |
+
|
19 |
+
border-radius: 0;
|
20 |
+
-moz-box-shadow: none;
|
21 |
+
-webkit-box-shadow: none;
|
22 |
+
box-shadow: none;
|
23 |
+
|
24 |
+
}
|
25 |
+
|
26 |
+
.redux-group-tab {
|
27 |
+
margin-bottom: 0 !important;
|
28 |
+
}
|
29 |
+
|
30 |
+
.postbox .redux-container .redux-group-menu .active a {
|
31 |
+
background: #FFF;
|
32 |
+
}
|
33 |
+
|
34 |
+
.postbox .redux-container .redux-section-title {
|
35 |
+
padding-left: 0 !important;
|
36 |
+
margin-bottom: 15px !important;
|
37 |
+
}
|
38 |
+
|
39 |
+
.postbox .redux-container .redux-section-desc {
|
40 |
+
margin-bottom: 20px;
|
41 |
+
}
|
42 |
+
|
43 |
+
.postbox .redux-container .redux_main {
|
44 |
+
border-left: 1px solid #D8D8D8;
|
45 |
+
moz-box-shadow: none;
|
46 |
+
-webkit-box-shadow: none;
|
47 |
+
box-shadow: none;
|
48 |
+
}
|
49 |
+
|
50 |
+
.postbox .redux-container .redux_main input[type=text] {
|
51 |
+
width: 95%;
|
52 |
+
}
|
53 |
+
|
54 |
+
.postbox .redux-container.redux-no-sections {
|
55 |
+
margin: 0;
|
56 |
+
background: none;
|
57 |
+
}
|
58 |
+
|
59 |
+
.postbox .redux-container.redux-no-sections .redux-main {
|
60 |
+
background: none;
|
61 |
+
margin-left: inherit;
|
62 |
+
padding: inherit;
|
63 |
+
border-left: none !important;
|
64 |
+
min-height: 0 !important;
|
65 |
+
}
|
66 |
+
|
67 |
+
.postbox .redux-container.redux-no-sections .redux-main tr td {
|
68 |
+
padding-top: 20px !important;
|
69 |
+
width: 100%;
|
70 |
+
}
|
71 |
+
|
72 |
+
.postbox .redux-container.redux-no-sections .redux-main tr:last-child {
|
73 |
+
border-bottom: none;
|
74 |
+
}
|
75 |
+
|
76 |
+
.postbox .redux-container.redux-no-sections .redux-main tr:last-child th,
|
77 |
+
.postbox .redux-container.redux-no-sections .redux-main tr:last-child td {
|
78 |
+
padding-bottom: 0;
|
79 |
+
}
|
80 |
+
|
81 |
+
.redux-main .redux-field-container {
|
82 |
+
//padding: 10px inherit !important;
|
83 |
+
}
|
84 |
+
|
85 |
+
.postbox .redux-container.redux-no-sections .redux-main .form-table:first-child tr:first-child td {
|
86 |
+
padding-top: 0 !important;
|
87 |
+
}
|
88 |
+
|
89 |
+
.postbox .redux-container.redux-no-sections .redux-main .redux-field {
|
90 |
+
margin-bottom: 10px !important;
|
91 |
+
}
|
92 |
+
|
93 |
+
.postbox .redux-container.redux-no-sections .redux-main .redux-field:last-child {
|
94 |
+
margin-bottom: 0 !important;
|
95 |
+
}
|
96 |
+
|
97 |
+
.postbox .redux-container.redux-has-sections .redux-main {
|
98 |
+
background: #fff;
|
99 |
+
}
|
100 |
+
|
101 |
+
.redux-box-side .redux-main .redux-field-container {
|
102 |
+
padding: 0;
|
103 |
+
padding-top: 5px;
|
104 |
+
}
|
105 |
+
|
106 |
+
.redux-box-side .redux-main .redux-field-container .select2-container,
|
107 |
+
.redux-box-side .redux-main .redux-field-container select {
|
108 |
+
width: 100% !important;
|
109 |
+
}
|
110 |
+
|
111 |
+
.redux-box-side .form-table tr td {
|
112 |
+
padding: 15px 0 !important;
|
113 |
+
}
|
114 |
+
|
115 |
+
.redux-box-side .form-table tr:last-child td {
|
116 |
+
padding-bottom: 0 !important;
|
117 |
+
}
|
118 |
+
|
119 |
+
.redux-box-side .form-table tr:first-child td {
|
120 |
+
padding-top: 5px !important;
|
121 |
+
}
|
122 |
+
|
123 |
+
.redux-box-side .form-table tr:first-child td {
|
124 |
+
padding-top: 5px !important;
|
125 |
+
}
|
126 |
+
|
127 |
+
.postbox .redux-main h3 {
|
128 |
+
cursor: text !important;
|
129 |
+
-webkit-user-select: inherit !important;
|
130 |
+
-moz-user-select: inherit !important;
|
131 |
+
user-select: inherit !important;
|
132 |
+
padding-left: 0 !important;
|
133 |
+
}
|
134 |
+
|
135 |
+
#poststuff h3.redux-hndle, .metabox-holder h3.redux-hndle {
|
136 |
+
cursor: pointer;
|
137 |
+
border-bottom: 0;
|
138 |
+
}
|
139 |
+
|
140 |
+
.display-group {
|
141 |
+
display: inherit !important;
|
142 |
+
}
|
143 |
+
|
144 |
+
.postbox .redux-container.redux-no-sections .redux-main tr td {
|
145 |
+
padding-top: 10px !important;
|
146 |
+
}
|
147 |
+
|
148 |
+
/* Metaboxes CSS overrides */
|
149 |
+
@media (min-width: 1125px) and (max-width: 1405px) {
|
150 |
+
.postbox table.form-table,
|
151 |
+
.postbox .form-table > thead,
|
152 |
+
.postbox .form-table > tbody,
|
153 |
+
.postbox .form-table > tbody > tr > th,
|
154 |
+
.postbox .form-table > tbody > tr > td,
|
155 |
+
.postbox .form-table > tbody > tr {
|
156 |
+
display: block !important;
|
157 |
+
width: 100% !important;
|
158 |
+
padding: 0px !important;
|
159 |
+
&.hide {
|
160 |
+
display: none !important;
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
.postbox .form-table > tbody > tr > th,
|
165 |
+
.postbox .form-table > tbody > tr > td {
|
166 |
+
padding: 10px !important;
|
167 |
+
}
|
168 |
+
|
169 |
+
.postbox .form-table > tbody > tr > th,
|
170 |
+
.postbox .form-table > tbody > tr > td {
|
171 |
+
padding: 10px !important;
|
172 |
+
}
|
173 |
+
|
174 |
+
.postbox .form-table > tbody > tr > th {
|
175 |
+
width: 35%;
|
176 |
+
}
|
177 |
+
|
178 |
+
}
|
179 |
+
|
180 |
+
.redux-box-side .redux-main .redux-field-container .select2-container, .redux-box-side .redux-main .redux-field-container select {
|
181 |
+
width: 96% !important;
|
182 |
+
}
|
183 |
+
|
184 |
+
@media (max-width: 1405px) {
|
185 |
+
.redux-box-side .redux-main .redux-field-container .select2-container, .redux-box-side .redux-main .redux-field-container select {
|
186 |
+
width: 92% !important;
|
187 |
+
}
|
188 |
+
}
|
189 |
+
|
190 |
+
@media (max-width: 1125px) {
|
191 |
+
.redux-box-side .redux-main .redux-field-container .select2-container, .redux-box-side .redux-main .redux-field-container select {
|
192 |
+
width: 100% !important;
|
193 |
+
}
|
194 |
+
}
|
195 |
+
|
196 |
+
@media (max-width: 1405px) {
|
197 |
+
.redux-main .form-table > tbody > tr > td {
|
198 |
+
padding-top: 0 !important;
|
199 |
+
padding-bottom: 0 !important;
|
200 |
+
}
|
201 |
+
|
202 |
+
.redux-main .redux-field-container {
|
203 |
+
padding: 0 0 20px 0 !important;
|
204 |
+
}
|
205 |
+
|
206 |
+
.postbox .form-table > tbody > tr > th {
|
207 |
+
padding-bottom: 0 !important;
|
208 |
+
}
|
209 |
+
|
210 |
+
.redux_field_th {
|
211 |
+
padding-top: 0 !important;
|
212 |
+
padding-bottom: 10px !important;
|
213 |
+
}
|
214 |
+
|
215 |
+
.redux-main .redux-field-container {
|
216 |
+
padding-bottom: 10px !important;
|
217 |
+
}
|
218 |
+
|
219 |
+
}
|
220 |
+
|
221 |
+
.redux-no-sections .redux-group-tab {
|
222 |
+
display: block !important;
|
223 |
+
}
|
224 |
+
|
225 |
+
.metaboxesAdminThemeColorOverrides (@darkColor, @textColor) {
|
226 |
+
#poststuff h3.redux-hndle, .metabox-holder h3.redux-hndle {
|
227 |
+
background: @darkColor;
|
228 |
+
color: @textColor;
|
229 |
+
}
|
230 |
+
}
|
231 |
+
|
232 |
+
/* Light fresh theme */
|
233 |
+
.admin-color-fresh {
|
234 |
+
.metaboxesAdminThemeColorOverrides(#222222, #fff);
|
235 |
+
}
|
236 |
+
|
237 |
+
/* Light admin theme */
|
238 |
+
.admin-color-light {
|
239 |
+
.metaboxesAdminThemeColorOverrides(#888888, #fff);
|
240 |
+
}
|
241 |
+
|
242 |
+
/* Blue admin theme */
|
243 |
+
.admin-color-blue {
|
244 |
+
.metaboxesAdminThemeColorOverrides(#096484, #fff);
|
245 |
+
}
|
246 |
+
|
247 |
+
/* Coffee admin theme */
|
248 |
+
.admin-color-coffee {
|
249 |
+
.metaboxesAdminThemeColorOverrides(#46403c, #fff);
|
250 |
+
}
|
251 |
+
|
252 |
+
/* Ectoplasm admin theme */
|
253 |
+
.admin-color-ectoplasm {
|
254 |
+
.metaboxesAdminThemeColorOverrides(#413256, #fff);
|
255 |
+
}
|
256 |
+
|
257 |
+
/* Midnight admin theme */
|
258 |
+
.admin-color-midnight {
|
259 |
+
.metaboxesAdminThemeColorOverrides(#363b3f, #fff);
|
260 |
+
}
|
261 |
+
|
262 |
+
/* Ocean admin theme */
|
263 |
+
.admin-color-ocean {
|
264 |
+
.metaboxesAdminThemeColorOverrides(#627c83, #fff);
|
265 |
+
}
|
266 |
+
|
267 |
+
/* Sunrise admin theme */
|
268 |
+
.admin-color-sunrise {
|
269 |
+
.metaboxesAdminThemeColorOverrides(#b43c38, #fff);
|
270 |
+
}
|
271 |
+
|
272 |
+
.redux-notices {
|
273 |
+
margin-bottom: 0;
|
274 |
+
border: 0;
|
275 |
+
}
|
276 |
+
|
277 |
+
.redux-metabox {
|
278 |
+
.redux-container {
|
279 |
+
margin-top: 0;
|
280 |
+
}
|
281 |
+
.inside {
|
282 |
+
margin: 0 !important;
|
283 |
+
padding: 0 !important;
|
284 |
+
}
|
285 |
+
|
286 |
+
.redux-no-sections {
|
287 |
+
.redux-main {
|
288 |
+
padding: 6px 15px 15px 15px !important;
|
289 |
+
.default_br {
|
290 |
+
display: none;
|
291 |
+
}
|
292 |
+
.redux-field-container {
|
293 |
+
padding: 10px 0 20px !important;
|
294 |
+
}
|
295 |
+
.redux_field_th {
|
296 |
+
padding-top: 5px !important;
|
297 |
+
}
|
298 |
+
}
|
299 |
+
&.redux-box-side {
|
300 |
+
.redux-main {
|
301 |
+
padding: 6px 8px 8px 8px !important;
|
302 |
+
input[type=text] {
|
303 |
+
width: 100% !important;
|
304 |
+
}
|
305 |
+
}
|
306 |
+
}
|
307 |
+
}
|
308 |
+
}
|
309 |
+
|
310 |
+
.wp-color-result {
|
311 |
+
margin: 0 6px 0 0px !important;
|
312 |
+
}
|
313 |
+
.redux-container .ui-button-text-only .ui-button-text {
|
314 |
+
padding: 0;
|
315 |
+
}
|
inc/extensions/extensions/metaboxes/extension_metaboxes.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
jQuery(function(e){"use strict";e.reduxMetaBoxes=e.reduxMetaBoxes||{};e(document).ready(function(){e.reduxMetaBoxes.init()});e.reduxMetaBoxes.init=function(){e.reduxMetaBoxes.notLoaded=true;e.reduxMetaBoxes.checkBoxVisibility();e(".redux-container").each(function(){e(this).parents(".postbox:first").find("h3.hndle").addClass("redux-hndle");e(this).parents(".postbox:first").addClass("redux-metabox");e(this).parents(".postbox:first").addClass("redux-"+redux.args.opt_name);if(redux.args.container_class!==""){e(this).parents(".postbox:first").addClass(redux.args.class)}});e("#page_template").change(function(){e.reduxMetaBoxes.checkBoxVisibility("page_template")});e('input[name="post_format"]:radio').change(function(){e.reduxMetaBoxes.checkBoxVisibility("post_format")});e.redux.initFields()};var t=e(".postbox");t.click(function(){if(!t.hasClass("closed")){e.redux.initFields()}});e("#publishing-action .button, #save-action .button").click(function(){window.onbeforeunload=null});var n;e.reduxMetaBoxes.checkBoxVisibility=function(t){if(reduxMetaboxes.length!==0){e.each(reduxMetaboxes,function(r,i){e.each(i,function(i,s){if(i===t||!t){if(i==="post_format"){n=e("input:radio[name='post_format']:checked").val()}else{n=e("#"+i).val()}if(n){var o=false;e.each(s,function(e,t){if(t===n){o=true}});if(!o&&!e.reduxMetaBoxes.notLoaded){e("#"+r).hide()}else if(!o){e("#"+r).fadeOut("50");e.redux.initFields()}else{e("#"+r).fadeIn("300");e.redux.initFields()}}}})})}}})
|
inc/extensions/extensions/metaboxes/extension_metaboxes.php
ADDED
@@ -0,0 +1,1399 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Redux Framework is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 2 of the License, or
|
8 |
+
* any later version.
|
9 |
+
* Redux Framework is distributed in the hope that it will be useful,
|
10 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
+
* GNU General Public License for more details.
|
13 |
+
* You should have received a copy of the GNU General Public License
|
14 |
+
* along with Redux Framework. If not, see <http://www.gnu.org/licenses/>.
|
15 |
+
*
|
16 |
+
* @package ReduxFramework
|
17 |
+
* @author Dovy Paukstys (dovy)
|
18 |
+
* @author Kevin Provance (kprovance)
|
19 |
+
* @version 1.2.9
|
20 |
+
*/
|
21 |
+
|
22 |
+
// Exit if accessed directly
|
23 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
24 |
+
exit;
|
25 |
+
}
|
26 |
+
|
27 |
+
// Don't duplicate me!
|
28 |
+
if ( ! class_exists( 'ReduxFramework_extension_metaboxes' ) ) {
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Main ReduxFramework customizer extension class
|
32 |
+
*
|
33 |
+
* @since 1.0.0
|
34 |
+
*/
|
35 |
+
class ReduxFramework_extension_metaboxes {
|
36 |
+
|
37 |
+
static $version = "1.2.9";
|
38 |
+
|
39 |
+
public $boxes = array();
|
40 |
+
public $post_types = array();
|
41 |
+
public $post_type;
|
42 |
+
public $sections = array();
|
43 |
+
public $output = array();
|
44 |
+
private $parent;
|
45 |
+
public $options = array();
|
46 |
+
public $parent_options = array();
|
47 |
+
public $parent_defaults = array();
|
48 |
+
public $wp_links = array();
|
49 |
+
public $options_defaults = array();
|
50 |
+
public $localize_data = array();
|
51 |
+
public $toReplace = array();
|
52 |
+
public $_extension_url;
|
53 |
+
public $_extension_dir;
|
54 |
+
public $meta = array();
|
55 |
+
public $post_id = 0;
|
56 |
+
public $base_url;
|
57 |
+
|
58 |
+
public function __construct( $parent ) {
|
59 |
+
|
60 |
+
$this->parent = $parent;
|
61 |
+
|
62 |
+
|
63 |
+
$this->parent->extensions['metaboxes'] = $this;
|
64 |
+
|
65 |
+
if ( empty( self::$_extension_dir ) ) {
|
66 |
+
$this->_extension_dir = trailingslashit( str_replace( '\\', '/', dirname( __FILE__ ) ) );
|
67 |
+
$this->_extension_url = site_url( str_replace( trailingslashit( str_replace( '\\', '/', ABSPATH ) ), '', $this->_extension_dir ) );
|
68 |
+
}
|
69 |
+
|
70 |
+
// Only run metaboxes on the pages/posts, not the front-end
|
71 |
+
global $pagenow;
|
72 |
+
if ( $pagenow !== "post-new.php" && $pagenow !== "post.php" ) {
|
73 |
+
if ( is_admin() ) {
|
74 |
+
return;
|
75 |
+
}
|
76 |
+
|
77 |
+
}
|
78 |
+
// Must not update the DB when just updating metaboxes. Sheesh.
|
79 |
+
if ( is_admin() && ( $pagenow == "post-new.php" || $pagenow == "post.php" ) ) {
|
80 |
+
$this->parent->never_save_to_db = true;
|
81 |
+
}
|
82 |
+
|
83 |
+
//add_filter( 'admin_footer_text', array( &$this, 'admin_footer_text' ) );
|
84 |
+
|
85 |
+
|
86 |
+
add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
|
87 |
+
add_action( 'save_post', array( $this, 'meta_boxes_save' ), 1, 2 );
|
88 |
+
add_action( 'pre_post_update', array( $this, 'pre_post_update' ) );
|
89 |
+
add_action( 'admin_notices', array( $this, 'meta_boxes_show_errors' ), 0 );
|
90 |
+
|
91 |
+
add_action( 'admin_enqueue_scripts', array( $this, '_enqueue' ), 20 );
|
92 |
+
|
93 |
+
// Fix for wp-seo embedding an old version (RC3) of qtip. Bah.
|
94 |
+
add_action( 'wp_print_scripts', array( $this, 'FIX_wp_seo' ), 100 );
|
95 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'FIX_wp_seo' ), 100 );
|
96 |
+
|
97 |
+
// Global variable overrides for within loops
|
98 |
+
add_action( 'the_post', array( $this, '_loop_start' ), 0 );
|
99 |
+
add_action( 'loop_end', array( $this, '_loop_end' ), 0 );
|
100 |
+
|
101 |
+
|
102 |
+
//add_action( 'load_textdomain', array( $this, 'init' ), 0 );
|
103 |
+
|
104 |
+
$this->init();
|
105 |
+
|
106 |
+
} // __construct()
|
107 |
+
|
108 |
+
public function init() {
|
109 |
+
global $pagenow;
|
110 |
+
|
111 |
+
$this->boxes = apply_filters( 'redux/metaboxes/' . $this->parent->args['opt_name'] . '/boxes', $this->boxes );
|
112 |
+
|
113 |
+
if ( empty( $this->boxes ) ) {
|
114 |
+
return; // Don't do it! There's nothing here.
|
115 |
+
}
|
116 |
+
|
117 |
+
$this->base_url = 'http://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
|
118 |
+
$this->post_id = $this->url_to_postid( 'http://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] );
|
119 |
+
if ( is_admin() && isset( $_GET['post_type'] ) && ! empty( $_GET['post_type'] ) ) {
|
120 |
+
$this->post_type = $_GET['post_type'];
|
121 |
+
} else {
|
122 |
+
$this->post_type = get_post_type( $this->post_id );
|
123 |
+
}
|
124 |
+
|
125 |
+
|
126 |
+
foreach ( $this->boxes as $bk => $box ) {
|
127 |
+
// If the post ids for this box are set, we're limiting to the current post id
|
128 |
+
if ( isset( $box['post_ids'] ) && ! empty( $box['post_ids'] ) ) {
|
129 |
+
if ( ! is_array( $box['post_ids'] ) ) {
|
130 |
+
$box['post_ids'] = array( $box['post_ids'] );
|
131 |
+
}
|
132 |
+
if ( ! in_array( $this->post_id, $box['post_ids'] ) ) {
|
133 |
+
continue;
|
134 |
+
}
|
135 |
+
|
136 |
+
}
|
137 |
+
if ( ! empty( $box['sections'] ) ) {
|
138 |
+
$this->sections = $box['sections'];
|
139 |
+
array_merge( $this->parent->sections, $box['sections'] );
|
140 |
+
|
141 |
+
$this->post_types = wp_parse_args( $this->post_types, $box['post_types'] );
|
142 |
+
|
143 |
+
if ( is_admin() && ( $pagenow == "post-new.php" || $pagenow == "post.php" ) ) {
|
144 |
+
// NEST IN THE BOX ID
|
145 |
+
|
146 |
+
}
|
147 |
+
|
148 |
+
// Checking to overide the parent variables
|
149 |
+
$addField = false;
|
150 |
+
|
151 |
+
foreach ( $box['post_types'] as $type ) {
|
152 |
+
if ( $this->post_type == $type ) {
|
153 |
+
$addField = true;
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
// Replacing all the fields
|
158 |
+
if ( $addField
|
159 |
+
|| (
|
160 |
+
( is_admin() && ( $pagenow == "post-new.php" || $pagenow == "post.php" ) )
|
161 |
+
||
|
162 |
+
( ! is_admin() )
|
163 |
+
)
|
164 |
+
) {
|
165 |
+
$runHooks = true;
|
166 |
+
|
167 |
+
$boxID = 'redux-' . $this->parent->args['opt_name'] . '-metabox-' . $box['id'];
|
168 |
+
|
169 |
+
if ( isset( $box['page_template'] ) && $this->post_type == "page" ) {
|
170 |
+
if ( ! is_array( $box['page_template'] ) ) {
|
171 |
+
$box['page_template'] = array( $box['page_template'] );
|
172 |
+
}
|
173 |
+
$this->wp_links[ $boxID ]['page_template'] = isset( $this->wp_links[ $boxID ]['page_template'] ) ? wp_parse_args( $this->wp_links['page_template'], $box['page_template'] ) : $box['page_template'];
|
174 |
+
}
|
175 |
+
if ( isset( $box['post_format'] ) && ( in_array( $this->post_type, $this->post_types ) || $this->post_type == "" ) ) {
|
176 |
+
if ( ! is_array( $box['post_format'] ) ) {
|
177 |
+
$box['post_format'] = array( $box['post_format'] );
|
178 |
+
}
|
179 |
+
$this->wp_links[ $boxID ]['post_format'] = isset( $this->wp_links[ $boxID ]['post_format'] ) ? wp_parse_args( $this->wp_links['post_format'], $box['post_format'] ) : $box['post_format'];
|
180 |
+
}
|
181 |
+
|
182 |
+
$this->meta[ $this->post_id ] = $this->get_meta( $this->post_id );
|
183 |
+
|
184 |
+
//$this->parent->options = wp_parse_args($this->meta[$this->post_id], $this->parent->options);
|
185 |
+
foreach ( $box['sections'] as $sk => $section ) {
|
186 |
+
if ( isset( $section['fields'] ) && ! empty( $section['fields'] ) ) {
|
187 |
+
foreach ( $section['fields'] as $fk => $field ) {
|
188 |
+
if ( ! isset( $field['class'] ) ) {
|
189 |
+
$field['class'] = "";
|
190 |
+
$this->boxes[ $bk ]['sections'][ $sk ]['fields'][ $fk ] = $field;
|
191 |
+
}
|
192 |
+
if ( stripos( $field['class'], 'redux-field-init' ) === 0 ) {
|
193 |
+
//$field['class'] = trim( $field['class'] . ' redux-field-init' );
|
194 |
+
}
|
195 |
+
if ( $addField
|
196 |
+
|| (
|
197 |
+
( is_admin() && ( $pagenow == "post-new.php" || $pagenow == "post.php" ) )
|
198 |
+
||
|
199 |
+
( ! is_admin() )
|
200 |
+
)
|
201 |
+
) {
|
202 |
+
|
203 |
+
|
204 |
+
if ( empty( $field['id'] ) ) {
|
205 |
+
continue;
|
206 |
+
}
|
207 |
+
|
208 |
+
if ( isset( $field['default'] ) ) {
|
209 |
+
$this->options_defaults[ $field['id'] ] = $field['default'];
|
210 |
+
} else {
|
211 |
+
$this->options_defaults[ $field['id'] ] = $this->_field_default( $field );
|
212 |
+
}
|
213 |
+
|
214 |
+
foreach ( $box['post_types'] as $type ) {
|
215 |
+
$this->post_type_fields[ $type ][ $field['id'] ] = 1;
|
216 |
+
}
|
217 |
+
|
218 |
+
if ( isset( $field['output'] ) && ! empty( $field['output'] ) ) {
|
219 |
+
$this->output[ $field['id'] ] = isset( $this->output[ $field['id'] ] ) ? array_merge( $field['output'], $this->output[ $field['id'] ] ) : $field['output'];
|
220 |
+
}
|
221 |
+
|
222 |
+
// Detect what field types are being used
|
223 |
+
if ( ! isset( $this->parent->fields[ $field['type'] ][ $field['id'] ] ) ) {
|
224 |
+
$this->parent->fields[ $field['type'] ][ $field['id'] ] = 1;
|
225 |
+
} else {
|
226 |
+
$this->parent->fields[ $field['type'] ] = array( $field['id'] => 1 );
|
227 |
+
}
|
228 |
+
|
229 |
+
if ( ! isset( $this->options_defaults[ $field['id'] ] ) ) {
|
230 |
+
$this->toReplace[ $field['id'] ] = $field;
|
231 |
+
}
|
232 |
+
//
|
233 |
+
//if( isset( $field['default'] ) ) {
|
234 |
+
// $this->options_defaults[$field['id']] = $field['default'];
|
235 |
+
//} else {
|
236 |
+
// $field['default'] = $this->options_defaults[$field['id']];
|
237 |
+
}
|
238 |
+
|
239 |
+
//} elseif (isset($field['options'])) {
|
240 |
+
//$this->options_defaults[$field['id']] = $field['options'];
|
241 |
+
//}
|
242 |
+
|
243 |
+
if ( ! isset( $this->parent->options[ $field['id'] ] ) ) {
|
244 |
+
$this->parent->sections[ ( count( $this->parent->sections ) - 1 ) ]['fields'][] = $field;
|
245 |
+
}
|
246 |
+
|
247 |
+
//echo 'post meta';
|
248 |
+
//print_r($this->meta[$this->post_id]);
|
249 |
+
//print_r($this->options[$field['id']]);
|
250 |
+
if ( ! isset( $this->meta[ $this->post_id ][ $field['id'] ] ) ) {
|
251 |
+
$this->meta[ $this->post_id ][ $field['id'] ] = $this->options_defaults[ $field['id'] ];
|
252 |
+
}
|
253 |
+
|
254 |
+
//if (!isset($this->meta[$this->post_id][$field['id']]) && isset($this->options_defaults[$field['id']])) {
|
255 |
+
//$this->meta[$this->post_id][$field['id']] = $this->options_defaults[$field['id']];
|
256 |
+
//}
|
257 |
+
|
258 |
+
//$setDefaults = false;
|
259 |
+
//if (!isset($this->parent->options[$field['id']]) || $this->parent->options[$field['id']] == $this->parent->options_defaults[$field['id']]) {
|
260 |
+
// $setDefaults = true;
|
261 |
+
//}
|
262 |
+
|
263 |
+
//if (!isset($this->meta[$this->post_id][$field['id']])) {
|
264 |
+
// $this->meta[$this->post_id][$field['id']][$field['id']] = $this->parent->options_defaults[$field['id']];
|
265 |
+
// $this->parent->options[$field['id']] = $this->parent->options_defaults[$field['id']];
|
266 |
+
//}
|
267 |
+
|
268 |
+
//if ( !empty($this->meta[$this->post_id]) && isset( $this->meta[$this->post_id][$field['id']] ) ) {
|
269 |
+
//$this->parent->options[$field['id']] = $this->meta[$this->post_id][$field['id']];
|
270 |
+
//}
|
271 |
+
/*
|
272 |
+
if( isset( $field['default'] ) ) {
|
273 |
+
$this->parent->options_defaults[$field['id']] = $field['default'];
|
274 |
+
} elseif (isset($field['options'])) {
|
275 |
+
$this->parent->options_defaults[$field['id']] = $field['options'];
|
276 |
+
}
|
277 |
+
if (isset($setDefaults) && isset($field['default'])) {
|
278 |
+
$this->parent->options[$field['id']] = $this->parent->options_defaults[$field['id']];
|
279 |
+
}
|
280 |
+
*/
|
281 |
+
|
282 |
+
|
283 |
+
// Only override if it exists and it's not the default
|
284 |
+
if ( isset( $this->meta[ $this->post_id ][ $field['id'] ] ) && isset( $field['default'] ) && $this->meta[ $this->post_id ][ $field['id'] ] == $field['default'] ) {
|
285 |
+
//unset($this->meta[$this->post_id][$field['id']]);
|
286 |
+
}
|
287 |
+
|
288 |
+
|
289 |
+
}
|
290 |
+
}
|
291 |
+
}
|
292 |
+
|
293 |
+
}
|
294 |
+
}
|
295 |
+
|
296 |
+
}
|
297 |
+
|
298 |
+
if ( isset( $runHooks ) && $runHooks == true ) {
|
299 |
+
|
300 |
+
//$this->parent->get_options();
|
301 |
+
$this->parent_options = ''; //$this->parent->options;
|
302 |
+
|
303 |
+
if ( ! empty( $this->toReplace ) ) {
|
304 |
+
foreach ( $this->toReplace as $id => $field ) {
|
305 |
+
add_filter( "redux/options/{$this->parent->args['opt_name']}/field/{$id}/register", array(
|
306 |
+
$this,
|
307 |
+
'replace_field'
|
308 |
+
) );
|
309 |
+
}
|
310 |
+
}
|
311 |
+
|
312 |
+
//$this->parent->options_defaults = wp_parse_args($this->options_defaults, $this->parent->options_defaults);
|
313 |
+
|
314 |
+
// Override the defaults, the but options have already been grabbed
|
315 |
+
//add_filter( "redux/options/{$this->parent->args['opt_name']}/defaults", array( $this, '_override_defaults' ) );
|
316 |
+
|
317 |
+
//add_filter( "redux/options/{$this->args['opt_name']}/defaults", '' );
|
318 |
+
add_filter( "redux/options/{$this->parent->args['opt_name']}/options", array(
|
319 |
+
$this,
|
320 |
+
'_override_options'
|
321 |
+
) );
|
322 |
+
|
323 |
+
add_filter( "redux/field/{$this->parent->args['opt_name']}/_can_output_css", array(
|
324 |
+
$this,
|
325 |
+
'_override_can_output_css'
|
326 |
+
) );
|
327 |
+
|
328 |
+
add_filter( "redux/field/{$this->parent->args['opt_name']}/output_css", array(
|
329 |
+
$this,
|
330 |
+
'_output_css'
|
331 |
+
) );
|
332 |
+
|
333 |
+
//add_filter( "redux/options/{$this->parent->args['opt_name']}/global_variable", array( $this, '_override_values' ) );
|
334 |
+
|
335 |
+
}
|
336 |
+
|
337 |
+
}
|
338 |
+
|
339 |
+
function replace_field( $field ) {
|
340 |
+
if ( isset( $this->toReplace[ $field['id'] ] ) ) {
|
341 |
+
$field = $this->toReplace[ $field['id'] ];
|
342 |
+
}
|
343 |
+
|
344 |
+
return $field;
|
345 |
+
}
|
346 |
+
|
347 |
+
function _override_can_output_css( $field ) {
|
348 |
+
|
349 |
+
if ( isset( $this->output[ $field['id'] ] ) ) {
|
350 |
+
$field['force_output'] = true;
|
351 |
+
}
|
352 |
+
|
353 |
+
return $field;
|
354 |
+
}
|
355 |
+
|
356 |
+
function _output_css( $field ) {
|
357 |
+
|
358 |
+
if ( isset( $this->output[ $field['id'] ] ) ) {
|
359 |
+
$field['output'] = $this->output[ $field['id'] ];
|
360 |
+
}
|
361 |
+
|
362 |
+
return $field;
|
363 |
+
}
|
364 |
+
|
365 |
+
// Fix for wp-seo embedding an old version (RC3) of qtip. Bah.
|
366 |
+
public function FIX_wp_seo() {
|
367 |
+
wp_dequeue_script( 'jquery-qtip' );
|
368 |
+
wp_deregister_script( 'jquery-qtip' );
|
369 |
+
}
|
370 |
+
|
371 |
+
// DEPRECATED, just for storage
|
372 |
+
public function _override_defaults( $defaults ) {
|
373 |
+
$defaults = wp_parse_args( $this->options_defaults, $defaults );
|
374 |
+
foreach ( $this->options_defaults as $field => $value ) {
|
375 |
+
if ( ! isset( $this->parent->options[ $field ] ) || ( ! isset( $defaults[ $field ] ) || ! isset( $this->parent->options[ $field ] ) || $defaults[ $field ] == $this->parent->options[ $field ] ) ) {
|
376 |
+
$this->parent->options[ $field ] = $value;
|
377 |
+
$this->meta[ $field ] = $value;
|
378 |
+
}
|
379 |
+
}
|
380 |
+
|
381 |
+
return wp_parse_args( $this->options_defaults, $defaults );
|
382 |
+
}
|
383 |
+
|
384 |
+
// Make sure the defaults are the defaults
|
385 |
+
public function _override_options( $options ) {
|
386 |
+
|
387 |
+
$this->parent->_default_values();
|
388 |
+
$this->parent_defaults = $this->parent->options_defaults;
|
389 |
+
|
390 |
+
$meta = $this->get_meta( $this->post_id );
|
391 |
+
//print_r($meta);
|
392 |
+
$data = wp_parse_args( $meta, $this->options_defaults );
|
393 |
+
foreach ( $data as $key => $value ) {
|
394 |
+
if ( isset( $meta[ $key ] ) ) {
|
395 |
+
$data[ $key ] = $meta[ $key ];
|
396 |
+
continue;
|
397 |
+
}
|
398 |
+
|
399 |
+
if ( isset( $options[ $key ] ) ) {
|
400 |
+
//if ( isset($options[$key]) && isset($this->parent->options_defaults[$key]) && $options[$key] != $this->parent->options_defaults[$key]) {
|
401 |
+
if ( isset( $options[ $key ] ) ) {
|
402 |
+
$data[ $key ] = $options[ $key ];
|
403 |
+
}
|
404 |
+
}
|
405 |
+
}
|
406 |
+
$this->parent->options_defaults = wp_parse_args( $this->options_defaults, $this->parent->options_defaults );
|
407 |
+
|
408 |
+
$options = wp_parse_args( $data, $options );
|
409 |
+
|
410 |
+
return $options;
|
411 |
+
}
|
412 |
+
|
413 |
+
public function _loop_start( $the_post = array() ) {
|
414 |
+
|
415 |
+
if ( is_admin() ) {
|
416 |
+
return $the_post;
|
417 |
+
}
|
418 |
+
|
419 |
+
if ( isset( $the_post ) && is_array( $the_post ) ) {
|
420 |
+
global $post;
|
421 |
+
$the_post = $post;
|
422 |
+
}
|
423 |
+
|
424 |
+
//echo "POST ID: ".$the_post->ID;
|
425 |
+
|
426 |
+
if ( isset( $GLOBALS[ $this->parent->args['global_variable'] . '-loop' ] ) ) {
|
427 |
+
$GLOBALS[ $this->parent->args['global_variable'] ] = $GLOBALS[ $this->parent->args['global_variable'] . '-loop' ];
|
428 |
+
unset( $GLOBALS[ $this->parent->args['global_variable'] . '-loop' ] );
|
429 |
+
}
|
430 |
+
|
431 |
+
// Override these values if they differ from the admin panel defaults. ;)
|
432 |
+
if ( in_array( $the_post->post_type, $this->post_types ) ) {
|
433 |
+
$meta = $this->get_meta( $the_post->ID );
|
434 |
+
if ( empty( $meta ) ) {
|
435 |
+
return;
|
436 |
+
}
|
437 |
+
// Backup the args
|
438 |
+
$GLOBALS[ $this->parent->args['global_variable'] . '-loop' ] = $GLOBALS[ $this->parent->args['global_variable'] ];
|
439 |
+
$GLOBALS[ $this->parent->args['global_variable'] ] = wp_parse_args( $meta, $GLOBALS[ $this->parent->args['global_variable'] . '-loop' ] );
|
440 |
+
}
|
441 |
+
}
|
442 |
+
|
443 |
+
public function _loop_end() {
|
444 |
+
if ( isset( $GLOBALS[ $this->parent->args['global_variable'] . '-loop' ] ) ) {
|
445 |
+
$GLOBALS[ $this->parent->args['global_variable'] ] = $GLOBALS[ $this->parent->args['global_variable'] . '-loop' ];
|
446 |
+
unset( $GLOBALS[ $this->parent->args['global_variable'] . '-loop' ] );
|
447 |
+
}
|
448 |
+
}
|
449 |
+
|
450 |
+
public function _enqueue() {
|
451 |
+
//$screen = get_current_screen();
|
452 |
+
//print_r($screen->post_type);
|
453 |
+
global $pagenow;
|
454 |
+
|
455 |
+
$types = array();
|
456 |
+
// Enqueue css
|
457 |
+
foreach ( $this->boxes as $key => $box ) {
|
458 |
+
if ( empty( $box['sections'] ) ) {
|
459 |
+
continue;
|
460 |
+
}
|
461 |
+
if ( isset( $box['post_types'] ) ) {
|
462 |
+
$types = array_merge( $box['post_types'], $types );
|
463 |
+
}
|
464 |
+
if ( isset( $box['post_types'] ) && ! empty( $box['post_types'] ) ) {
|
465 |
+
if ( ! is_array( $box['post_types'] ) ) {
|
466 |
+
$box['post_types'] = array( $box['post_types'] );
|
467 |
+
$this->boxes[ $key ]['post_types'] = $box['post_types'];
|
468 |
+
}
|
469 |
+
}
|
470 |
+
}
|
471 |
+
|
472 |
+
|
473 |
+
if ( $pagenow == "post-new.php" || $pagenow == "post.php" ) {
|
474 |
+
global $post;
|
475 |
+
|
476 |
+
if ( in_array( $post->post_type, $types ) ) {
|
477 |
+
$this->parent->transients = $this->parent->transients_check = get_transient( $this->parent->args['opt_name'] . '-transients-metaboxes' );
|
478 |
+
|
479 |
+
if ( isset( $this->parent->transients['notices'] ) ) {
|
480 |
+
$this->notices = $this->parent->transients['notices'];
|
481 |
+
$this->parent->transients['last_save_mode'] = "metaboxes";
|
482 |
+
}
|
483 |
+
|
484 |
+
|
485 |
+
delete_transient( $this->parent->args['opt_name'] . '-transients-metaboxes' );
|
486 |
+
$this->parent->_enqueue();
|
487 |
+
|
488 |
+
do_action( "redux/metaboxes/{$this->parent->args['opt_name']}/enqueue" );
|
489 |
+
|
490 |
+
/**
|
491 |
+
* Redux metaboxes CSS
|
492 |
+
* filter 'redux/page/{opt_name}/enqueue/redux-extension-metaboxes-css'
|
493 |
+
*
|
494 |
+
* @param string bundled stylesheet src
|
495 |
+
*/
|
496 |
+
|
497 |
+
|
498 |
+
wp_enqueue_style(
|
499 |
+
'redux-extension-metaboxes-css',
|
500 |
+
apply_filters( "redux/metaboxes/{$this->parent->args['opt_name']}/enqueue/redux-extension-metaboxes-css", $this->_extension_url . 'extension_metaboxes.css' ),
|
501 |
+
'',
|
502 |
+
filemtime( $this->_extension_dir . 'extension_metaboxes.css' ), // todo - version should be based on above post-filter src
|
503 |
+
'all'
|
504 |
+
);
|
505 |
+
|
506 |
+
/**
|
507 |
+
* Redux metaboxes JS
|
508 |
+
* filter 'redux/page/{opt_name}/enqueue/redux-extension-metaboxes-js
|
509 |
+
*
|
510 |
+
* @param string bundled javscript
|
511 |
+
*/
|
512 |
+
|
513 |
+
wp_enqueue_script(
|
514 |
+
'redux-extension-metaboxes-js',
|
515 |
+
apply_filters( "redux/metaboxes/{$this->parent->args['opt_name']}/enqueue/redux-extension-metaboxes-js", $this->_extension_url . 'extension_metaboxes' . Redux_Functions::isMin() . '.js' ),
|
516 |
+
array( 'jquery', 'redux-js' ),
|
517 |
+
self::$version,
|
518 |
+
'all'
|
519 |
+
);
|
520 |
+
// Values used by the javascript
|
521 |
+
wp_localize_script(
|
522 |
+
'redux-extension-metaboxes-js',
|
523 |
+
'reduxMetaboxes',
|
524 |
+
$this->wp_links
|
525 |
+
);
|
526 |
+
}
|
527 |
+
|
528 |
+
}
|
529 |
+
|
530 |
+
} // _enqueue()
|
531 |
+
|
532 |
+
/* Post URLs to IDs function, supports custom post types - borrowed and modified from url_to_postid() in wp-includes/rewrite.php */
|
533 |
+
// Taken from http://betterwp.net/wordpress-tips/url_to_postid-for-custom-post-types/
|
534 |
+
// Customized to work with non-rewrite URLs
|
535 |
+
// Copyright Dovy Paukstys (@dovy) of Redux Framework
|
536 |
+
function url_to_postid( $url ) {
|
537 |
+
global $wp_rewrite;
|
538 |
+
|
539 |
+
if ( ! empty( $this->post_id ) ) {
|
540 |
+
return $this->post_id;
|
541 |
+
}
|
542 |
+
|
543 |
+
if ( isset( $_GET['post'] ) && ! empty( $_GET['post'] ) && is_numeric( $_GET['post'] ) ) {
|
544 |
+
return $_GET['post'];
|
545 |
+
}
|
546 |
+
|
547 |
+
// First, check to see if there is a 'p=N' or 'page_id=N' to match against
|
548 |
+
if ( preg_match( '#[?&](p|page_id|attachment_id)=(\d+)#', $url, $values ) ) {
|
549 |
+
$id = absint( $values[2] );
|
550 |
+
if ( $id ) {
|
551 |
+
return $id;
|
552 |
+
}
|
553 |
+
}
|
554 |
+
|
555 |
+
// Check to see if we are using rewrite rules
|
556 |
+
if ( isset( $wp_rewrite ) ) {
|
557 |
+
$rewrite = $wp_rewrite->wp_rewrite_rules();
|
558 |
+
}
|
559 |
+
|
560 |
+
|
561 |
+
// Not using rewrite rules, and 'p=N' and 'page_id=N' methods failed, so we're out of options
|
562 |
+
if ( empty( $rewrite ) ) {
|
563 |
+
if ( isset( $_GET ) && ! empty( $_GET ) ) {
|
564 |
+
|
565 |
+
/************************************************************************
|
566 |
+
* ADDED: Trys checks URL for ?posttype=postname
|
567 |
+
*************************************************************************/
|
568 |
+
|
569 |
+
// Assign $url to $tempURL just incase. :)
|
570 |
+
$tempUrl = $url;
|
571 |
+
|
572 |
+
// Get rid of the #anchor
|
573 |
+
$url_split = explode( '#', $tempUrl );
|
574 |
+
$tempUrl = $url_split[0];
|
575 |
+
|
576 |
+
// Get rid of URL ?query=string
|
577 |
+
$url_query = explode( '&', $tempUrl );
|
578 |
+
$tempUrl = $url_query[0];
|
579 |
+
|
580 |
+
// Get rid of ? mark
|
581 |
+
$url_query = explode( '?', $tempUrl);
|
582 |
+
|
583 |
+
|
584 |
+
if(isset($url_query[1]) && !empty($url_query[1]) && strpos( $url_query[1], '=' )){
|
585 |
+
$url_query = explode( '=', $url_query[1] );
|
586 |
+
|
587 |
+
if(isset($url_query[0]) && isset($url_query[1])){
|
588 |
+
$args = array(
|
589 |
+
'name' => $url_query[1],
|
590 |
+
'post_type' => $url_query[0],
|
591 |
+
'showposts' => 1,
|
592 |
+
);
|
593 |
+
|
594 |
+
if ( $post = get_posts( $args ) ) {
|
595 |
+
return $post[0]->ID;
|
596 |
+
}
|
597 |
+
}
|
598 |
+
}
|
599 |
+
//END ADDITION
|
600 |
+
|
601 |
+
//print_r($GLOBALS['wp_post_types']);
|
602 |
+
//if (isset($GLOBALS['wp_post_types']['acme_product']))
|
603 |
+
// Add custom rules for non-rewrite URLs
|
604 |
+
foreach ( $GLOBALS['wp_post_types'] as $key => $value ) {
|
605 |
+
if ( isset( $_GET[ $key ] ) && ! empty( $_GET[ $key ] ) ) {
|
606 |
+
$args = array(
|
607 |
+
'name' => $_GET[ $key ],
|
608 |
+
'post_type' => $key,
|
609 |
+
'showposts' => 1,
|
610 |
+
);
|
611 |
+
if ( $post = get_posts( $args ) ) {
|
612 |
+
return $post[0]->ID;
|
613 |
+
}
|
614 |
+
}
|
615 |
+
}
|
616 |
+
}
|
617 |
+
}
|
618 |
+
|
619 |
+
// Get rid of the #anchor
|
620 |
+
$url_split = explode( '#', $url );
|
621 |
+
$url = $url_split[0];
|
622 |
+
|
623 |
+
// Get rid of URL ?query=string
|
624 |
+
$url_query = explode( '?', $url );
|
625 |
+
$url = $url_query[0];
|
626 |
+
|
627 |
+
|
628 |
+
// Add 'www.' if it is absent and should be there
|
629 |
+
if ( false !== strpos( home_url(), '://www.' ) && false === strpos( $url, '://www.' ) ) {
|
630 |
+
$url = str_replace( '://', '://www.', $url );
|
631 |
+
}
|
632 |
+
|
633 |
+
// Strip 'www.' if it is present and shouldn't be
|
634 |
+
if ( false === strpos( home_url(), '://www.' ) ) {
|
635 |
+
$url = str_replace( '://www.', '://', $url );
|
636 |
+
}
|
637 |
+
|
638 |
+
// Strip 'index.php/' if we're not using path info permalinks
|
639 |
+
if ( isset( $wp_rewrite ) && ! $wp_rewrite->using_index_permalinks() ) {
|
640 |
+
$url = str_replace( 'index.php/', '', $url );
|
641 |
+
}
|
642 |
+
|
643 |
+
if ( false !== strpos( $url, home_url() ) ) {
|
644 |
+
// Chop off http://domain.com
|
645 |
+
$url = str_replace( home_url(), '', $url );
|
646 |
+
} else {
|
647 |
+
// Chop off /path/to/blog
|
648 |
+
$home_path = parse_url( home_url() );
|
649 |
+
$home_path = isset( $home_path['path'] ) ? $home_path['path'] : '';
|
650 |
+
$url = str_replace( $home_path, '', $url );
|
651 |
+
}
|
652 |
+
|
653 |
+
// Trim leading and lagging slashes
|
654 |
+
$url = trim( $url, '/' );
|
655 |
+
|
656 |
+
$request = $url;
|
657 |
+
if ( empty( $request ) && ( ! isset( $_GET ) || empty( $_GET ) ) ) {
|
658 |
+
return get_option( 'page_on_front' );
|
659 |
+
}
|
660 |
+
|
661 |
+
// Look for matches.
|
662 |
+
$request_match = $request;
|
663 |
+
|
664 |
+
|
665 |
+
foreach ( (array) $rewrite as $match => $query ) {
|
666 |
+
|
667 |
+
// If the requesting file is the anchor of the match, prepend it
|
668 |
+
// to the path info.
|
669 |
+
if ( ! empty( $url ) && ( $url != $request ) && ( strpos( $match, $url ) === 0 ) ) {
|
670 |
+
$request_match = $url . '/' . $request;
|
671 |
+
}
|
672 |
+
|
673 |
+
if ( preg_match( "!^$match!", $request_match, $matches ) ) {
|
674 |
+
|
675 |
+
// Got a match.
|
676 |
+
// Trim the query of everything up to the '?'.
|
677 |
+
$query = preg_replace( "!^.+\?!", '', $query );
|
678 |
+
|
679 |
+
// Substitute the substring matches into the query.
|
680 |
+
$query = addslashes( WP_MatchesMapRegex::apply( $query, $matches ) );
|
681 |
+
|
682 |
+
// Filter out non-public query vars
|
683 |
+
global $wp;
|
684 |
+
parse_str( $query, $query_vars );
|
685 |
+
$query = array();
|
686 |
+
foreach ( (array) $query_vars as $key => $value ) {
|
687 |
+
if ( in_array( $key, $wp->public_query_vars ) ) {
|
688 |
+
$query[ $key ] = $value;
|
689 |
+
}
|
690 |
+
}
|
691 |
+
|
692 |
+
/************************************************************************
|
693 |
+
* ADDED: $GLOBALS['wp_post_types'] doesn't seem to have custom postypes
|
694 |
+
* Trying below to find posttypes in $rewrite rules
|
695 |
+
*************************************************************************/
|
696 |
+
|
697 |
+
// PostType Array
|
698 |
+
$custom_post_type = false;
|
699 |
+
$post_types = array();
|
700 |
+
foreach ($rewrite as $key => $value) {
|
701 |
+
if(preg_match('/post_type=([^&]+)/i', $value, $matched)){
|
702 |
+
if(isset($matched[1]) && !in_array($matched[1], $post_types)){
|
703 |
+
$post_types[] = $matched[1];
|
704 |
+
}
|
705 |
+
}
|
706 |
+
}
|
707 |
+
|
708 |
+
foreach ((array) $query_vars as $key => $value) {
|
709 |
+
if(in_array($key, $post_types)){
|
710 |
+
$custom_post_type = true;
|
711 |
+
|
712 |
+
$query['post_type'] = $key;
|
713 |
+
$query['postname'] = $value;
|
714 |
+
}
|
715 |
+
}
|
716 |
+
|
717 |
+
// print_r($post_types);
|
718 |
+
|
719 |
+
/************************************************************************
|
720 |
+
* END ADD
|
721 |
+
*************************************************************************/
|
722 |
+
|
723 |
+
// Taken from class-wp.php
|
724 |
+
foreach ( $GLOBALS['wp_post_types'] as $post_type => $t ) {
|
725 |
+
if ( $t->query_var ) {
|
726 |
+
$post_type_query_vars[ $t->query_var ] = $post_type;
|
727 |
+
}
|
728 |
+
}
|
729 |
+
|
730 |
+
foreach ( $wp->public_query_vars as $wpvar ) {
|
731 |
+
if ( isset( $wp->extra_query_vars[ $wpvar ] ) ) {
|
732 |
+
$query[ $wpvar ] = $wp->extra_query_vars[ $wpvar ];
|
733 |
+
} elseif ( isset( $_POST[ $wpvar ] ) ) {
|
734 |
+
$query[ $wpvar ] = $_POST[ $wpvar ];
|
735 |
+
} elseif ( isset( $_GET[ $wpvar ] ) ) {
|
736 |
+
$query[ $wpvar ] = $_GET[ $wpvar ];
|
737 |
+
} elseif ( isset( $query_vars[ $wpvar ] ) ) {
|
738 |
+
$query[ $wpvar ] = $query_vars[ $wpvar ];
|
739 |
+
}
|
740 |
+
|
741 |
+
|
742 |
+
if ( ! empty( $query[ $wpvar ] ) ) {
|
743 |
+
if ( ! is_array( $query[ $wpvar ] ) ) {
|
744 |
+
$query[ $wpvar ] = (string) $query[ $wpvar ];
|
745 |
+
} else {
|
746 |
+
foreach ( $query[ $wpvar ] as $vkey => $v ) {
|
747 |
+
if ( ! is_object( $v ) ) {
|
748 |
+
$query[ $wpvar ][ $vkey ] = (string) $v;
|
749 |
+
}
|
750 |
+
}
|
751 |
+
}
|
752 |
+
|
753 |
+
if ( isset( $post_type_query_vars[ $wpvar ] ) ) {
|
754 |
+
$query['post_type'] = $post_type_query_vars[ $wpvar ];
|
755 |
+
$query['name'] = $query[ $wpvar ];
|
756 |
+
}
|
757 |
+
}
|
758 |
+
}
|
759 |
+
// Do the query
|
760 |
+
if ( isset( $query['pagename'] ) && ! empty( $query['pagename'] ) ) {
|
761 |
+
$args = array(
|
762 |
+
'name' => $query['pagename'],
|
763 |
+
'post_type' => 'page',
|
764 |
+
'showposts' => 1,
|
765 |
+
);
|
766 |
+
if ( $post = get_posts( $args ) ) {
|
767 |
+
return $post[0]->ID;
|
768 |
+
}
|
769 |
+
}
|
770 |
+
$query = new WP_Query( $query );
|
771 |
+
|
772 |
+
if ( ! empty( $query->posts ) && $query->is_singular ) {
|
773 |
+
return $query->post->ID;
|
774 |
+
} else {
|
775 |
+
return 0;
|
776 |
+
}
|
777 |
+
|
778 |
+
}
|
779 |
+
}
|
780 |
+
|
781 |
+
return 0;
|
782 |
+
}
|
783 |
+
|
784 |
+
// DEPRECATED
|
785 |
+
public function _override_values( $options ) {
|
786 |
+
// Override the global defaults
|
787 |
+
$options = wp_parse_args( $this->meta[ $this->post_id ], $options );
|
788 |
+
|
789 |
+
$this->parent->options = wp_parse_args( $options, $this->parent->options );
|
790 |
+
|
791 |
+
return $options;
|
792 |
+
|
793 |
+
} // _override_values()
|
794 |
+
|
795 |
+
// DEPRECATED
|
796 |
+
public function _default_values() {
|
797 |
+
if ( ! empty( $this->boxes ) && empty( $this->options_defaults ) ) {
|
798 |
+
foreach ( $this->boxes as $key => $box ) {
|
799 |
+
if ( empty( $box['sections'] ) ) {
|
800 |
+
continue;
|
801 |
+
}
|
802 |
+
// fill the cache
|
803 |
+
foreach ( $box['sections'] as $sk => $section ) {
|
804 |
+
if ( ! isset( $section['id'] ) ) {
|
805 |
+
if ( ! is_numeric( $sk ) || ! isset( $section['title'] ) ) {
|
806 |
+
$section['id'] = $sk;
|
807 |
+
} else {
|
808 |
+
$section['id'] = sanitize_title( $section['title'], $sk );
|
809 |
+
}
|
810 |
+
$this->boxes[ $key ]['sections'][ $sk ] = $section;
|
811 |
+
}
|
812 |
+
if ( isset( $section['fields'] ) ) {
|
813 |
+
foreach ( $section['fields'] as $k => $field ) {
|
814 |
+
if ( empty( $field['id'] ) ) {
|
815 |
+
continue;
|
816 |
+
}
|
817 |
+
//$this->parent->used_fields[$field['type']] = isset($this->parent->used_fields[$field['type']]) ? $this->parent->used_fields[$field['type']]++ : 1;
|
818 |
+
|
819 |
+
if ( $field['type'] == "section" && $field['indent'] == "true" ) {
|
820 |
+
$field['class'] = isset( $field['class'] ) ? $field['class'] : '';
|
821 |
+
$field['class'] .= "redux-section-indent-start";
|
822 |
+
$this->boxes[ $key ]['sections'][ $sk ]['fields'][ $k ] = $field;
|
823 |
+
}
|
824 |
+
// Detect what field types are being used
|
825 |
+
if ( ! isset( $this->fields[ $field['type'] ][ $field['id'] ] ) ) {
|
826 |
+
$this->parent->fields[ $field['type'] ][ $field['id'] ] = 1;
|
827 |
+
} else {
|
828 |
+
$this->parent->fields[ $field['type'] ] = array( $field['id'] => 1 );
|
829 |
+
}
|
830 |
+
if ( isset( $field['default'] ) ) {
|
831 |
+
$this->options_defaults[ $field['id'] ] = $field['default'];
|
832 |
+
} elseif ( isset( $field['options'] ) ) {
|
833 |
+
//$this->options_defaults[$field['id']] = $field['options'];
|
834 |
+
}
|
835 |
+
|
836 |
+
}
|
837 |
+
}
|
838 |
+
}
|
839 |
+
}
|
840 |
+
}
|
841 |
+
|
842 |
+
|
843 |
+
//$this->options_defaults = apply_filters( 'redux/metabox/'.$this->parent->args['opt_name'].'/defaults', $this->options_defaults );
|
844 |
+
|
845 |
+
if ( empty( $this->meta[ $this->post_id ] ) ) {
|
846 |
+
$this->meta[ $this->post_id ] = $this->get_meta( $this->post_id );
|
847 |
+
}
|
848 |
+
|
849 |
+
// Add the defaults to the current meta
|
850 |
+
//$this->meta[$this->post_id] = wp_parse_args( $this->meta[$this->post_id], $this->parent->options_defaults );
|
851 |
+
|
852 |
+
} // _default_values()
|
853 |
+
|
854 |
+
|
855 |
+
public function add_meta_boxes() {
|
856 |
+
//echo "add_meta_boxes()";
|
857 |
+
//$this->parent->get_options();
|
858 |
+
//print_r($this->parent->options);
|
859 |
+
|
860 |
+
if ( empty( $this->boxes ) || ! is_array( $this->boxes ) ) {
|
861 |
+
return;
|
862 |
+
}
|
863 |
+
|
864 |
+
foreach ( $this->boxes as $key => $box ) {
|
865 |
+
if ( empty( $box['sections'] ) ) {
|
866 |
+
continue;
|
867 |
+
}
|
868 |
+
|
869 |
+
// Save users from themselves
|
870 |
+
if ( isset( $box['position'] ) && ! in_array( strtolower( $box['position'] ), array(
|
871 |
+
'normal',
|
872 |
+
'advanced',
|
873 |
+
'side'
|
874 |
+
) )
|
875 |
+
) {
|
876 |
+
unset( $box['position'] );
|
877 |
+
}
|
878 |
+
|
879 |
+
if ( isset( $box['priority'] ) && ! in_array( strtolower( $box['priority'] ), array(
|
880 |
+
'high',
|
881 |
+
'core',
|
882 |
+
'default',
|
883 |
+
'low'
|
884 |
+
) )
|
885 |
+
) {
|
886 |
+
unset( $box['priority'] );
|
887 |
+
}
|
888 |
+
|
889 |
+
$defaults = array(
|
890 |
+
'id' => $key . '-' . $this->parent->args['opt_name'],
|
891 |
+
'post_types' => array( 'page', 'post' ),
|
892 |
+
'position' => 'normal',
|
893 |
+
'priority' => 'high',
|
894 |
+
);
|
895 |
+
|
896 |
+
$box = wp_parse_args( $box, $defaults );
|
897 |
+
if ( isset( $box['post_types'] ) && ! empty( $box['post_types'] ) ) {
|
898 |
+
foreach ( $box['post_types'] as $posttype ) {
|
899 |
+
if ( isset( $box['title'] ) ) {
|
900 |
+
$title = $box['title'];
|
901 |
+
} else {
|
902 |
+
if ( isset( $box['sections'] ) && count( $box['sections'] ) == 1 && isset( $box['sections'][0]['fields'] ) && count( $box['sections'][0]['fields'] ) == 1 && isset( $box['sections'][0]['fields'][0]['title'] ) ) {
|
903 |
+
// If only one field in this box
|
904 |
+
$title = $box['sections'][0]['fields'][0]['title'];
|
905 |
+
} else {
|
906 |
+
$title = ucfirst( $posttype ) . " " . __( 'Options', 'redux-framework' );
|
907 |
+
}
|
908 |
+
|
909 |
+
}
|
910 |
+
$args = array(
|
911 |
+
'position' => $box['position'],
|
912 |
+
'sections' => $box['sections']
|
913 |
+
);
|
914 |
+
// Override the parent args on a metabox level
|
915 |
+
if ( ! isset( $this->orig_args ) || empty( $this->orig_args ) ) {
|
916 |
+
$this->orig_args = $this->parent->args;
|
917 |
+
}
|
918 |
+
if ( isset( $box['args'] ) ) {
|
919 |
+
$this->parent->args = wp_parse_args( $box['args'], $this->orig_args );
|
920 |
+
} else if ( $this->parent->args != $this->orig_args ) {
|
921 |
+
$this->parent->args = $this->orig_args;
|
922 |
+
}
|
923 |
+
|
924 |
+
add_meta_box( 'redux-' . $this->parent->args['opt_name'] . '-metabox-' . $box['id'], $title, array(
|
925 |
+
$this,
|
926 |
+
'generate_boxes'
|
927 |
+
), $posttype, $box['position'], $box['priority'], $args );
|
928 |
+
}
|
929 |
+
}
|
930 |
+
}
|
931 |
+
} // add_meta_boxes()
|
932 |
+
|
933 |
+
function _field_default( $field_id ) {
|
934 |
+
|
935 |
+
if ( ! isset( $this->parent->options_defaults ) ) {
|
936 |
+
$this->parent->options_defaults = $this->parent->_default_values();
|
937 |
+
}
|
938 |
+
|
939 |
+
if ( ! isset( $this->parent->options ) || empty( $this->parent->options ) ) {
|
940 |
+
$this->parent->get_options();
|
941 |
+
}
|
942 |
+
|
943 |
+
$this->options = $this->parent->options;
|
944 |
+
|
945 |
+
if ( isset( $this->parent->options[ $field_id['id'] ] ) && isset( $this->parent->options_defaults[ $field_id['id'] ] ) && $this->parent->options[ $field_id['id'] ] != $this->parent->options_defaults[ $field_id['id'] ] ) {
|
946 |
+
//print_r($this->parent->options[$field_id['id']]);
|
947 |
+
return $this->parent->options[ $field_id['id'] ];
|
948 |
+
} else {
|
949 |
+
if ( empty( $this->options_defaults ) ) {
|
950 |
+
$this->_default_values(); // fill cache
|
951 |
+
}
|
952 |
+
|
953 |
+
$data = '';
|
954 |
+
if ( ! empty( $this->options_defaults ) ) {
|
955 |
+
$data = isset( $this->options_defaults[ $field_id['id'] ] ) ? $this->options_defaults[ $field_id['id'] ] : '';
|
956 |
+
}
|
957 |
+
|
958 |
+
if ( empty( $data ) && isset( $this->parent->options_defaults[ $field_id['id'] ] ) ) {
|
959 |
+
//$data = $this->parent->options_defaults[$field_id['id']];
|
960 |
+
$data = isset( $this->parent->options_defaults[ $field_id['id'] ] ) ? $this->parent->options_defaults[ $field_id['id'] ] : '';
|
961 |
+
}
|
962 |
+
|
963 |
+
return $data;
|
964 |
+
}
|
965 |
+
|
966 |
+
} // _field_default()
|
967 |
+
|
968 |
+
// Function to get and cache the post meta.
|
969 |
+
function get_meta( $id ) {
|
970 |
+
|
971 |
+
if ( ! isset( $this->meta[ $id ] ) ) {
|
972 |
+
$this->meta[ $id ] = array();
|
973 |
+
$oData = get_post_meta( $id );
|
974 |
+
|
975 |
+
if ( ! empty( $oData ) ) {
|
976 |
+
foreach ( $oData as $key => $value ) {
|
977 |
+
if ( count( $value ) == 1 ) {
|
978 |
+
$this->meta[ $id ][ $key ] = maybe_unserialize( $value[0] );
|
979 |
+
} else {
|
980 |
+
$new_value = array_map( 'maybe_unserialize', $value );
|
981 |
+
|
982 |
+
if (is_array($new_value)) {
|
983 |
+
$this->meta[ $id ][ $key ] = $new_value[0];
|
984 |
+
} else {
|
985 |
+
$this->meta[ $id ][ $key ] = $new_value;
|
986 |
+
}
|
987 |
+
}
|
988 |
+
}
|
989 |
+
}
|
990 |
+
|
991 |
+
if ( isset( $this->meta[ $id ][ $this->parent->args['opt_name'] ] ) ) {
|
992 |
+
$data = maybe_unserialize( $this->meta[ $id ][ $this->parent->args['opt_name'] ] );
|
993 |
+
foreach ( $data as $key => $value ) {
|
994 |
+
$this->meta[ $id ][ $key ] = $value;
|
995 |
+
update_post_meta( $id, $key, $value );
|
996 |
+
}
|
997 |
+
unset( $this->meta[ $id ][ $this->parent->args['opt_name'] ] );
|
998 |
+
delete_post_meta( $id, $this->parent->args['opt_name'] );
|
999 |
+
}
|
1000 |
+
}
|
1001 |
+
|
1002 |
+
return $this->meta[ $id ];
|
1003 |
+
}
|
1004 |
+
|
1005 |
+
function get_values( $thePost, $meta_key = "" ) {
|
1006 |
+
// Override these values if they differ from the admin panel defaults. ;)
|
1007 |
+
if ( in_array( $thePost->post_type, $this->post_types ) ) {
|
1008 |
+
if ( isset( $this->post_type_values[ $thePost->post_type ] ) ) {
|
1009 |
+
$meta = $this->post_type_fields[ $thePost->post_type ];
|
1010 |
+
} else {
|
1011 |
+
$defaults = array();
|
1012 |
+
foreach ( $this->post_type_fields[ $thePost->post_type ] as $key => $null ) {
|
1013 |
+
if ( isset( $this->options_defaults[ $key ] ) ) {
|
1014 |
+
$defaults[ $key ] = $this->options_defaults[ $key ];
|
1015 |
+
}
|
1016 |
+
}
|
1017 |
+
$meta = wp_parse_args( $this->get_meta( $thePost->ID ), $defaults );
|
1018 |
+
$this->post_type_fields[ $thePost->post_type ] = $meta;
|
1019 |
+
}
|
1020 |
+
|
1021 |
+
|
1022 |
+
if ( ! empty( $meta_key ) ) {
|
1023 |
+
return $meta[ $meta_key ];
|
1024 |
+
} else {
|
1025 |
+
return $meta;
|
1026 |
+
}
|
1027 |
+
}
|
1028 |
+
|
1029 |
+
return;
|
1030 |
+
}
|
1031 |
+
|
1032 |
+
function generate_boxes( $post, $metabox ) {
|
1033 |
+
global $wpdb;
|
1034 |
+
|
1035 |
+
$sections = $metabox['args']['sections'];
|
1036 |
+
|
1037 |
+
wp_nonce_field( 'redux_metaboxes_meta_nonce', 'redux_metaboxes_meta_nonce' );
|
1038 |
+
|
1039 |
+
wp_dequeue_script( 'json-view-js' );
|
1040 |
+
|
1041 |
+
$sidebar = true;
|
1042 |
+
if ( $metabox['args']['position'] == "side" || count( $sections ) == 1 || ( isset( $metabox['args']['sidebar'] ) && $metabox['args']['sidebar'] === false ) ) {
|
1043 |
+
$sidebar = false; // Show the section dividers or not
|
1044 |
+
}
|
1045 |
+
//$this->parent->options = wp_parse_args(get_post_meta( $post->ID, $this->parent->args['opt_name'], true ), $this->parent->options);
|
1046 |
+
//$data = $this->get_meta( $post->ID );
|
1047 |
+
|
1048 |
+
//print_r($data);
|
1049 |
+
?>
|
1050 |
+
|
1051 |
+
<div
|
1052 |
+
class="redux-container<?php echo ( $sidebar ) ? ' redux-has-sections' : ' redux-no-sections'; ?> redux-box-<?php echo $metabox['args']['position']; ?>">
|
1053 |
+
<div class="redux-notices">
|
1054 |
+
<?php if ( $sidebar ) : ?>
|
1055 |
+
<div class="saved_notice admin-notice notice-blue" style="display:none;">
|
1056 |
+
<strong><?php echo apply_filters( "redux-imported-text-{$this->parent->args['opt_name']}", __( 'Settings Imported!', 'redux-framework' ) ) ?></strong>
|
1057 |
+
</div>
|
1058 |
+
<div class="redux-save-warn notice-yellow">
|
1059 |
+
<strong><?php echo apply_filters( "redux-changed-text-{$this->parent->args['opt_name']}", __( 'Settings have changed, you should save them!', 'redux-framework' ) ) ?></strong>
|
1060 |
+
</div>
|
1061 |
+
<?php endif; ?>
|
1062 |
+
<div class="redux-field-errors notice-red">
|
1063 |
+
<strong><span></span> <?php echo __( 'error(s) were found!', 'redux-framework' ) ?></strong>
|
1064 |
+
</div>
|
1065 |
+
<div class="redux-field-warnings notice-yellow">
|
1066 |
+
<strong><span></span> <?php echo __( 'warning(s) were found!', 'redux-framework' ) ?>
|
1067 |
+
</strong></div>
|
1068 |
+
</div>
|
1069 |
+
<?php
|
1070 |
+
echo '<a href="javascript:void(0);" class="expand_options hide" style="display:none;">' . __( 'Expand', 'redux-framework' ) . '</a>';
|
1071 |
+
if ( $sidebar ) {
|
1072 |
+
?>
|
1073 |
+
<div class="redux-sidebar">
|
1074 |
+
<ul class="redux-group-menu">
|
1075 |
+
<?php
|
1076 |
+
foreach ( $sections as $sKey => $section ) {
|
1077 |
+
echo $this->parent->section_menu( $sKey, $section, '_box_' . $metabox['id'], $sections );
|
1078 |
+
}
|
1079 |
+
?>
|
1080 |
+
</ul>
|
1081 |
+
</div>
|
1082 |
+
<?php } ?>
|
1083 |
+
|
1084 |
+
<div class="redux-main">
|
1085 |
+
|
1086 |
+
<?php
|
1087 |
+
|
1088 |
+
$updateLocalize = false;
|
1089 |
+
|
1090 |
+
foreach ( $sections as $sKey => $section ) :
|
1091 |
+
|
1092 |
+
if ( isset( $section['fields'] ) && ! empty( $section['fields'] ) ) {
|
1093 |
+
|
1094 |
+
if ( isset( $section['args'] ) ) {
|
1095 |
+
$this->parent->args = wp_parse_args( $section['args'], $this->orig_args );
|
1096 |
+
} else if ( $this->parent->args != $this->orig_args ) {
|
1097 |
+
$this->parent->args = $this->orig_args;
|
1098 |
+
}
|
1099 |
+
|
1100 |
+
$hide = $sidebar ? "" : ' display-group';
|
1101 |
+
$section['class'] = isset( $section['class'] ) ? ' ' . $section['class'] : '';
|
1102 |
+
echo '<div id="' . $sKey . '_box_' . $metabox['id'] . '_section_group' . '" class="redux-group-tab' . $section['class'] . ' redux_metabox_panel' . $hide . '">';
|
1103 |
+
//}
|
1104 |
+
if ( isset( $section['title'] ) && ! empty( $section['title'] ) ) {
|
1105 |
+
//if ( count( $sections ) == 1 && isset( $section[0]['fields'] ) && count( $section[0]['fields'] ) == 1 && isset( $section[0]['fields'][0]['title'] ) ) {
|
1106 |
+
echo '<h3 class="redux-section-title">' . $section['title'] . '</h3>';
|
1107 |
+
//}
|
1108 |
+
}
|
1109 |
+
|
1110 |
+
if ( isset( $section['desc'] ) && ! empty( $section['desc'] ) ) {
|
1111 |
+
echo '<div class="redux-section-desc">' . $section['desc'] . '</div>';
|
1112 |
+
}
|
1113 |
+
echo '<table class="form-table"><tbody>';
|
1114 |
+
foreach ( $section['fields'] as $fKey => $field ) {
|
1115 |
+
$field['name'] = $this->parent->args['opt_name'] . '[' . $field['id'] . ']';
|
1116 |
+
echo '<tr valign="top">';
|
1117 |
+
|
1118 |
+
|
1119 |
+
$th = $this->parent->get_header_html( $field );
|
1120 |
+
|
1121 |
+
if ( $sidebar ) {
|
1122 |
+
if ( ! ( isset( $metabox['args']['sections'] ) && count( $metabox['args']['sections'] ) == 1 && isset( $metabox['args']['sections'][0]['fields'] ) && count( $metabox['args']['sections'][0]['fields'] ) == 1 ) && isset( $field['title'] ) ) {
|
1123 |
+
echo '<th scope="row">';
|
1124 |
+
if ( ! empty( $th ) ) {
|
1125 |
+
echo $th;
|
1126 |
+
}
|
1127 |
+
echo '</th>';
|
1128 |
+
echo '<td>';
|
1129 |
+
}
|
1130 |
+
} else {
|
1131 |
+
//<i style="float:right; " class="elusive el-icon-address-book"></i> //hints for right metaboxes
|
1132 |
+
echo '<td>' . $th . '';
|
1133 |
+
}
|
1134 |
+
|
1135 |
+
if ( $field['type'] == "section" && $field['indent'] == "true" ) {
|
1136 |
+
$field['class'] = isset( $field['class'] ) ? $field['class'] : '';
|
1137 |
+
$field['class'] .= "redux-section-indent-start";
|
1138 |
+
//$this->sections[$sk]['fields'][$k] = $field;
|
1139 |
+
}
|
1140 |
+
|
1141 |
+
//if (!isset($this->parent->options[$field['id']])) {
|
1142 |
+
// $this->parent->options[$field['id']] = "";
|
1143 |
+
//}
|
1144 |
+
if ( ! isset( $this->meta[ $this->post_id ][ $field['id'] ] ) ) {
|
1145 |
+
$this->meta[ $this->post_id ][ $field['id'] ] = "";
|
1146 |
+
}
|
1147 |
+
|
1148 |
+
//print_r($this->options_defaults[$field['id']]);s
|
1149 |
+
//print_r($this->options[$field['id']]);
|
1150 |
+
//print_r($this->meta[$this->post_id][$field['id']]);
|
1151 |
+
|
1152 |
+
$this->parent->_field_input( $field, $this->meta[ $this->post_id ][ $field['id'] ] );
|
1153 |
+
echo '</td></tr>';
|
1154 |
+
}
|
1155 |
+
echo '</tbody></table>';
|
1156 |
+
}
|
1157 |
+
//if ( $sidebar ) {
|
1158 |
+
echo '</div>';
|
1159 |
+
//}
|
1160 |
+
endforeach; ?>
|
1161 |
+
</div>
|
1162 |
+
<div class="clear"></div>
|
1163 |
+
</div>
|
1164 |
+
<?php
|
1165 |
+
|
1166 |
+
} // generate_boxes()
|
1167 |
+
|
1168 |
+
/**
|
1169 |
+
* Save meta boxes
|
1170 |
+
* Runs when a post is saved and does an action which the write panel save scripts can hook into.
|
1171 |
+
*
|
1172 |
+
* @access public
|
1173 |
+
*
|
1174 |
+
* @param mixed $post_id
|
1175 |
+
* @param mixed $post
|
1176 |
+
*
|
1177 |
+
* @return void
|
1178 |
+
*/
|
1179 |
+
function meta_boxes_save( $post_id, $post ) {
|
1180 |
+
|
1181 |
+
// Check if our nonce is set.
|
1182 |
+
if ( ! isset( $_POST['redux_metaboxes_meta_nonce'] ) ) {
|
1183 |
+
return $post_id;
|
1184 |
+
}
|
1185 |
+
|
1186 |
+
$meta = $this->get_meta($post_id);
|
1187 |
+
|
1188 |
+
$nonce = $_POST['redux_metaboxes_meta_nonce'];
|
1189 |
+
// Verify that the nonce is valid.
|
1190 |
+
// Validate fields (if needed)
|
1191 |
+
//$plugin_options = $this->_validate_values( $plugin_options, $this->options );
|
1192 |
+
|
1193 |
+
if ( ! wp_verify_nonce( $nonce, 'redux_metaboxes_meta_nonce' ) ) {
|
1194 |
+
return $post_id;
|
1195 |
+
}
|
1196 |
+
|
1197 |
+
// If this is an autosave, our form has not been submitted, so we don't want to do anything.
|
1198 |
+
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
1199 |
+
return $post_id;
|
1200 |
+
}
|
1201 |
+
|
1202 |
+
// Check the user's permissions, even allowing custom capabilities
|
1203 |
+
$obj = get_post_type_object( $post->post_type );
|
1204 |
+
if ( ! current_user_can( $obj->cap->edit_post, $post_id ) ) {
|
1205 |
+
return $post_id;
|
1206 |
+
}
|
1207 |
+
|
1208 |
+
// Import
|
1209 |
+
if ( isset( $_POST[ $this->parent->args['opt_name'] ]['import_code'] ) && ! empty( $_POST[ $this->parent->args['opt_name'] ]['import_code'] ) ) {
|
1210 |
+
$import = json_decode( stripslashes( $_POST[ $this->parent->args['opt_name'] ]['import_code'] ), true );
|
1211 |
+
unset( $_POST[ $this->parent->args['opt_name'] ]['import_code'] );
|
1212 |
+
foreach ( $_POST[ $this->parent->args['opt_name'] ] as $key => $value ) {
|
1213 |
+
if ( ! isset( $import[ $key ] ) ) {
|
1214 |
+
$import[ $key ] = $value;
|
1215 |
+
}
|
1216 |
+
}
|
1217 |
+
$_POST[ $this->parent->args['opt_name'] ] = $import;
|
1218 |
+
}
|
1219 |
+
|
1220 |
+
$toSave = array();
|
1221 |
+
$toCompare = array();
|
1222 |
+
$toDelete = array();
|
1223 |
+
|
1224 |
+
|
1225 |
+
foreach ( $_POST[ $this->parent->args['opt_name'] ] as $key => $value ) {
|
1226 |
+
// Have to remove the escaping for array comparison
|
1227 |
+
if ( is_array( $value ) ) {
|
1228 |
+
foreach ( $value as $k => $v ) {
|
1229 |
+
if ( ! is_array( $v ) ) {
|
1230 |
+
$value[ $k ] = stripslashes( $v );
|
1231 |
+
}
|
1232 |
+
}
|
1233 |
+
}
|
1234 |
+
|
1235 |
+
$save = true;
|
1236 |
+
|
1237 |
+
//parent_options
|
1238 |
+
if ( isset( $this->options_defaults[ $key ] ) && $value == $this->options_defaults[ $key ] ) {
|
1239 |
+
$save = false;
|
1240 |
+
}
|
1241 |
+
|
1242 |
+
if ( $save && isset( $this->parent_options[ $key ] ) && $this->parent_options[ $key ] != $value ) {
|
1243 |
+
$save = false;
|
1244 |
+
}
|
1245 |
+
|
1246 |
+
if ( $save && ! isset( $this->parent_options[ $key ] ) && isset( $this->parent_defaults[ $key ] ) && $this->parent_defaults[ $key ] == $value ) {
|
1247 |
+
//$save = false;
|
1248 |
+
}
|
1249 |
+
|
1250 |
+
if ( $save ) {
|
1251 |
+
$toSave[ $key ] = $value;
|
1252 |
+
$toCompare[ $key ] = isset( $this->parent->options[ $key ] ) ? $this->parent->options[ $key ] : "";
|
1253 |
+
} else {
|
1254 |
+
$toDelete[ $key ] = $value;
|
1255 |
+
}
|
1256 |
+
|
1257 |
+
}
|
1258 |
+
|
1259 |
+
|
1260 |
+
$validate = $this->parent->_validate_values( $toSave, $toCompare, $this->sections );
|
1261 |
+
|
1262 |
+
// Validate fields (if needed)
|
1263 |
+
foreach ( $toSave as $key => $value ) {
|
1264 |
+
if ( isset( $validate[ $key ] ) && $validate[ $key ] != $toSave[ $key ] ) {
|
1265 |
+
if ( isset( $this->parent->options[ $key ] ) && $validate[ $key ] == $this->parent->options[ $key ] ) {
|
1266 |
+
unset( $toSave[ $key ] );
|
1267 |
+
} else {
|
1268 |
+
$toSave[ $key ] = $validate[ $key ];
|
1269 |
+
}
|
1270 |
+
}
|
1271 |
+
}
|
1272 |
+
|
1273 |
+
|
1274 |
+
if ( ! empty( $this->parent->errors ) || ! empty( $this->parent->warnings ) ) {
|
1275 |
+
$this->parent->transients['notices'] = ( isset( $this->parent->transients['notices'] ) && is_array( $this->parent->transients['notices'] ) ) ? $this->parent->transients['notices'] : array();
|
1276 |
+
if ( ! isset( $this->parent->transients['notices']['errors'] ) || $this->parent->transients['notices']['errors'] != $this->parent->errors ) {
|
1277 |
+
$this->parent->transients['notices']['errors'] = $this->parent->errors;
|
1278 |
+
$updateTransients = true;
|
1279 |
+
}
|
1280 |
+
if ( ! isset( $this->parent->transients['notices']['warnings'] ) || $this->parent->transients['notices']['warnings'] != $this->parent->warnings ) {
|
1281 |
+
$this->parent->transients['notices']['warnings'] = $this->parent->warnings;
|
1282 |
+
$updateTransients = true;
|
1283 |
+
}
|
1284 |
+
if ( isset( $updateTransients ) ) {
|
1285 |
+
$this->parent->transients['notices']['override'] = 1;
|
1286 |
+
set_transient( $this->parent->args['opt_name'] . '-transients-metaboxes', $this->parent->transients );
|
1287 |
+
}
|
1288 |
+
}
|
1289 |
+
//exit();
|
1290 |
+
$check = $this->post_type_fields[ $_POST['post_type'] ];
|
1291 |
+
|
1292 |
+
foreach ( $toSave as $key => $value ) {
|
1293 |
+
$prev_value = isset( $this->meta[ $post_id ][ $key ] ) ? $this->meta[ $post_id ][ $key ] : '';
|
1294 |
+
if ( isset( $check[ $key ] ) ) {
|
1295 |
+
unset( $check[ $key ] );
|
1296 |
+
}
|
1297 |
+
update_post_meta( $post_id, $key, $value, $prev_value );
|
1298 |
+
}
|
1299 |
+
|
1300 |
+
foreach ( $toDelete as $key => $value ) {
|
1301 |
+
if ( isset( $check[ $key ] ) ) {
|
1302 |
+
unset( $check[ $key ] );
|
1303 |
+
}
|
1304 |
+
$prev_value = isset( $this->meta[ $post_id ][ $key ] ) ? $this->meta[ $post_id ][ $key ] : '';
|
1305 |
+
delete_post_meta( $post_id, $key, $prev_value );
|
1306 |
+
}
|
1307 |
+
|
1308 |
+
foreach ( $check as $key => $value ) {
|
1309 |
+
delete_post_meta( $post_id, $key );
|
1310 |
+
}
|
1311 |
+
|
1312 |
+
//update_post_meta( $post_id, $this->parent->args['opt_name'], $toSave );
|
1313 |
+
//print_r($toSave);
|
1314 |
+
//exit();
|
1315 |
+
} // meta_boxes_save()
|
1316 |
+
|
1317 |
+
|
1318 |
+
/**
|
1319 |
+
* Some functions, like the term recount, require the visibility to be set prior. Lets save that here.
|
1320 |
+
*
|
1321 |
+
* @access public
|
1322 |
+
*
|
1323 |
+
* @param mixed $post_id
|
1324 |
+
*
|
1325 |
+
* @return void
|
1326 |
+
*/
|
1327 |
+
function pre_post_update( $post_id ) {
|
1328 |
+
if ( isset( $_POST['_visibility'] ) ) {
|
1329 |
+
update_post_meta( $post_id, '_visibility', stripslashes( $_POST['_visibility'] ) );
|
1330 |
+
}
|
1331 |
+
if ( isset( $_POST['_stock_status'] ) ) {
|
1332 |
+
update_post_meta( $post_id, '_stock_status', stripslashes( $_POST['_stock_status'] ) );
|
1333 |
+
}
|
1334 |
+
} // pre_post_update()
|
1335 |
+
|
1336 |
+
/**
|
1337 |
+
* Show any stored error messages.
|
1338 |
+
*
|
1339 |
+
* @access public
|
1340 |
+
* @return void
|
1341 |
+
*/
|
1342 |
+
function meta_boxes_show_errors() {
|
1343 |
+
if ( isset( $this->notices['errors'] ) && ! empty( $this->notices['errors'] ) ) {
|
1344 |
+
echo '<div id="redux_metaboxes_errors" class="error fade">';
|
1345 |
+
echo '<p><strong><span></span> ' . count( $this->notices['errors'] ) . ' ' . __( 'error(s) were found!', 'redux-framework' ) . '</strong></p>';
|
1346 |
+
echo '</div>';
|
1347 |
+
}
|
1348 |
+
if ( isset( $this->notices['warnings'] ) && ! empty( $this->notices['warnings'] ) ) {
|
1349 |
+
echo '<div id="redux_metaboxes_warnings" class="error fade" style="border-left-color: #E8E20C;">';
|
1350 |
+
echo '<p><strong><span></span> ' . count( $this->notices['warnings'] ) . ' ' . __( 'warnings(s) were found!', 'redux-framework' ) . '</strong></p>';
|
1351 |
+
echo '</div>';
|
1352 |
+
}
|
1353 |
+
} // meta_boxes_show_errors()
|
1354 |
+
|
1355 |
+
} // class ReduxFramework_extension_metaboxes
|
1356 |
+
|
1357 |
+
} // if ( !class_exists( 'ReduxFramework_extension_metaboxes' ) )
|
1358 |
+
|
1359 |
+
|
1360 |
+
if ( ! function_exists( 'redux_metaboxes_loop_start' ) ) {
|
1361 |
+
function redux_metaboxes_loop_start( $opt_name, $the_post = array() ) {
|
1362 |
+
$redux = ReduxFrameworkInstances::get_instance( $opt_name );
|
1363 |
+
$metaboxes = $redux->extensions['metaboxes'];
|
1364 |
+
$metaboxes->_loop_start( $the_post );
|
1365 |
+
}
|
1366 |
+
}
|
1367 |
+
|
1368 |
+
if ( ! function_exists( 'redux_metaboxes_loop_end' ) ) {
|
1369 |
+
function redux_metaboxes_loop_end( $opt_name, $the_post = array() ) {
|
1370 |
+
$redux = ReduxFrameworkInstances::get_instance( $opt_name );
|
1371 |
+
$metaboxes = $redux->extensions['metaboxes'];
|
1372 |
+
|
1373 |
+
$metaboxes->_loop_end();
|
1374 |
+
}
|
1375 |
+
}
|
1376 |
+
|
1377 |
+
|
1378 |
+
if ( ! function_exists( 'redux_post_meta' ) ) {
|
1379 |
+
function redux_post_meta( $opt_name = "", $thePost = array(), $meta_key = "" ) {
|
1380 |
+
if ( empty( $opt_name ) ) {
|
1381 |
+
return;
|
1382 |
+
}
|
1383 |
+
global $post;
|
1384 |
+
$redux = ReduxFrameworkInstances::get_instance( $opt_name );
|
1385 |
+
$metaboxes = $redux->extensions['metaboxes'];
|
1386 |
+
if ( isset( $thePost ) && is_array( $thePost ) ) {
|
1387 |
+
$thePost = $post;
|
1388 |
+
} else if ( is_integer( $thePost ) ) {
|
1389 |
+
$thePost = get_post( $thePost );
|
1390 |
+
} else if ( ! is_object( $thePost ) ) {
|
1391 |
+
$thePost = $post;
|
1392 |
+
}
|
1393 |
+
|
1394 |
+
return $metaboxes->get_values( $thePost, $meta_key );
|
1395 |
+
|
1396 |
+
|
1397 |
+
}
|
1398 |
+
|
1399 |
+
}
|
inc/extensions/extensions/repeater/extension_repeater.php
ADDED
@@ -0,0 +1,267 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Redux Framework is free software: you can redistribute it and/or modify
|
5 |
+
* it under the terms of the GNU General Public License as published by
|
6 |
+
* the Free Software Foundation, either version 2 of the License, or
|
7 |
+
* any later version.
|
8 |
+
* Redux Framework is distributed in the hope that it will be useful,
|
9 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11 |
+
* GNU General Public License for more details.
|
12 |
+
* You should have received a copy of the GNU General Public License
|
13 |
+
* along with Redux Framework. If not, see <http://www.gnu.org/licenses/>.
|
14 |
+
*
|
15 |
+
* @package Redux Framework
|
16 |
+
* @subpackage Repeater
|
17 |
+
* @subpackage Wordpress
|
18 |
+
* @author Dovy Paukstys (dovy)
|
19 |
+
* @author Kevin Provance (kprovance)
|
20 |
+
* @version 1.0.6
|
21 |
+
*/
|
22 |
+
|
23 |
+
// Exit if accessed directly
|
24 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
25 |
+
exit;
|
26 |
+
}
|
27 |
+
|
28 |
+
// Don't duplicate me!
|
29 |
+
if ( ! class_exists( 'ReduxFramework_extension_repeater' ) ) {
|
30 |
+
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Main ReduxFramework css_layout extension class
|
34 |
+
*
|
35 |
+
* @since 1.0.0
|
36 |
+
*/
|
37 |
+
class ReduxFramework_extension_repeater {
|
38 |
+
|
39 |
+
public static $version = '1.0.6';
|
40 |
+
|
41 |
+
// Protected vars
|
42 |
+
/**
|
43 |
+
* @var ReduxFramework
|
44 |
+
*/
|
45 |
+
protected $parent;
|
46 |
+
public $extension_url;
|
47 |
+
public $extension_dir;
|
48 |
+
public static $theInstance;
|
49 |
+
public $field_id = '';
|
50 |
+
private $class_css = '';
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Class Constructor. Defines the args for the extions class
|
54 |
+
*
|
55 |
+
* @since 1.0.0
|
56 |
+
* @access public
|
57 |
+
*
|
58 |
+
* @param ReduxFramework $parent Parent settings.
|
59 |
+
*
|
60 |
+
* @return void
|
61 |
+
*/
|
62 |
+
public function __construct( $parent ) {
|
63 |
+
|
64 |
+
$redux_ver = ReduxFramework::$_version;
|
65 |
+
|
66 |
+
// Set parent object
|
67 |
+
$this->parent = $parent;
|
68 |
+
|
69 |
+
// Set extension dir
|
70 |
+
if ( empty( $this->extension_dir ) ) {
|
71 |
+
$this->extension_dir = trailingslashit( str_replace( '\\', '/', dirname( __FILE__ ) ) );
|
72 |
+
}
|
73 |
+
|
74 |
+
// Set field name
|
75 |
+
$this->field_name = 'repeater';
|
76 |
+
|
77 |
+
// Set instance
|
78 |
+
self::$theInstance = $this;
|
79 |
+
|
80 |
+
// Adds the local field
|
81 |
+
add_filter( 'redux/' . $this->parent->args['opt_name'] . '/field/class/' . $this->field_name, array(
|
82 |
+
&$this,
|
83 |
+
'overload_field_path'
|
84 |
+
) );
|
85 |
+
}
|
86 |
+
|
87 |
+
static public function getInstance() {
|
88 |
+
return self::$theInstance;
|
89 |
+
}
|
90 |
+
|
91 |
+
public function TODO_validate_values( $plugin_options, $options, $sections ) {
|
92 |
+
foreach ( $options['fields'] as $fkey => $field ) {
|
93 |
+
|
94 |
+
if ( isset ( $field['type'] ) && ( $field['type'] == 'checkbox' || $field['type'] == 'checkbox_hide_below' || $field['type'] == 'checkbox_hide_all' ) ) {
|
95 |
+
if ( ! isset ( $plugin_options[ $field['id'] ] ) ) {
|
96 |
+
$plugin_options[ $field['id'] ] = 0;
|
97 |
+
}
|
98 |
+
}
|
99 |
+
|
100 |
+
|
101 |
+
if ( isset( $this->parent->extensions[ $field['type'] ] ) && method_exists( $this->parent->extensions[ $field['type'] ], '_validate_values' ) ) {
|
102 |
+
$plugin_options = $this->parent->extensions[ $field['type'] ]->_validate_values( $plugin_options, $field, $sections );
|
103 |
+
|
104 |
+
}
|
105 |
+
|
106 |
+
// Default 'not_empty 'flag to false.
|
107 |
+
$isNotEmpty = false;
|
108 |
+
|
109 |
+
// Make sure 'validate' field is set.
|
110 |
+
if ( isset ( $field['validate'] ) ) {
|
111 |
+
|
112 |
+
// Make sure 'validate field' is set to 'not_empty' or 'email_not_empty'
|
113 |
+
//if ( $field['validate'] == 'not_empty' || $field['validate'] == 'email_not_empty' || $field['validate'] == 'numeric_not_empty' ) {
|
114 |
+
if ( strtolower( substr( $field['validate'], - 9 ) ) == 'not_empty' ) {
|
115 |
+
|
116 |
+
// Set the flag.
|
117 |
+
$isNotEmpty = true;
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
// Check for empty id value
|
122 |
+
|
123 |
+
if ( ! isset ( $field['id'] ) || ! isset ( $plugin_options[ $field['id'] ] ) || ( isset ( $plugin_options[ $field['id'] ] ) && $plugin_options[ $field['id'] ] == '' ) ) {
|
124 |
+
|
125 |
+
// If we are looking for an empty value, in the case of 'not_empty'
|
126 |
+
// then we need to keep processing.
|
127 |
+
if ( ! $isNotEmpty ) {
|
128 |
+
|
129 |
+
// Empty id and not checking for 'not_empty. Bail out...
|
130 |
+
if ( ! isset( $field['validate_callback'] ) ) {
|
131 |
+
continue;
|
132 |
+
}
|
133 |
+
//continue;
|
134 |
+
}
|
135 |
+
}
|
136 |
+
|
137 |
+
// Force validate of custom field types
|
138 |
+
if ( isset ( $field['type'] ) && ! isset ( $field['validate'] ) && ! isset( $field['validate_callback'] ) ) {
|
139 |
+
if ( $field['type'] == 'color' || $field['type'] == 'color_gradient' ) {
|
140 |
+
$field['validate'] = 'color';
|
141 |
+
} elseif ( $field['type'] == 'date' ) {
|
142 |
+
$field['validate'] = 'date';
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
if ( isset ( $field['validate'] ) ) {
|
147 |
+
$validate = 'Redux_Validation_' . $field['validate'];
|
148 |
+
|
149 |
+
if ( ! class_exists( $validate ) ) {
|
150 |
+
/**
|
151 |
+
* filter 'redux-validateclass-load'
|
152 |
+
*
|
153 |
+
* @deprecated
|
154 |
+
*
|
155 |
+
* @param string validation class file path
|
156 |
+
* @param string $validate validation class name
|
157 |
+
*/
|
158 |
+
$class_file = apply_filters( "redux-validateclass-load", self::$_dir . "inc/validation/{$field['validate']}/validation_{$field['validate']}.php", $validate ); // REMOVE LATER
|
159 |
+
|
160 |
+
/**
|
161 |
+
* filter 'redux/validate/{opt_name}/class/{field.validate}'
|
162 |
+
*
|
163 |
+
* @param string validation class file path
|
164 |
+
* @param string $class_file validation class file path
|
165 |
+
*/
|
166 |
+
$class_file = apply_filters( "redux/validate/{$this->parent->args['opt_name']}/class/{$field['validate']}", self::$_dir . "inc/validation/{$field['validate']}/validation_{$field['validate']}.php", $class_file );
|
167 |
+
|
168 |
+
if ( $class_file ) {
|
169 |
+
if ( file_exists( $class_file ) ) {
|
170 |
+
require_once $class_file;
|
171 |
+
}
|
172 |
+
}
|
173 |
+
}
|
174 |
+
|
175 |
+
if ( class_exists( $validate ) ) {
|
176 |
+
|
177 |
+
//!DOVY - DB saving stuff. Is this right?
|
178 |
+
if ( empty ( $options[ $field['id'] ] ) ) {
|
179 |
+
$options[ $field['id'] ] = '';
|
180 |
+
}
|
181 |
+
|
182 |
+
if ( isset ( $plugin_options[ $field['id'] ] ) && is_array( $plugin_options[ $field['id'] ] ) && ! empty ( $plugin_options[ $field['id'] ] ) ) {
|
183 |
+
foreach ( $plugin_options[ $field['id'] ] as $key => $value ) {
|
184 |
+
$before = $after = null;
|
185 |
+
if ( isset ( $plugin_options[ $field['id'] ][ $key ] ) && ( ! empty ( $plugin_options[ $field['id'] ][ $key ] ) || $plugin_options[ $field['id'] ][ $key ] == '0' ) ) {
|
186 |
+
if ( is_array( $plugin_options[ $field['id'] ][ $key ] ) ) {
|
187 |
+
$before = $plugin_options[ $field['id'] ][ $key ];
|
188 |
+
} else {
|
189 |
+
$before = trim( $plugin_options[ $field['id'] ][ $key ] );
|
190 |
+
}
|
191 |
+
}
|
192 |
+
|
193 |
+
if ( isset ( $options[ $field['id'] ][ $key ] ) && ( ! empty ( $plugin_options[ $field['id'] ][ $key ] ) || $plugin_options[ $field['id'] ][ $key ] == '0' ) ) {
|
194 |
+
$after = $options[ $field['id'] ][ $key ];
|
195 |
+
}
|
196 |
+
|
197 |
+
$validation = new $validate ( $this, $field, $before, $after );
|
198 |
+
if ( ! empty ( $validation->value ) || $validation->value == '0' ) {
|
199 |
+
$plugin_options[ $field['id'] ][ $key ] = $validation->value;
|
200 |
+
} else {
|
201 |
+
unset ( $plugin_options[ $field['id'] ][ $key ] );
|
202 |
+
}
|
203 |
+
|
204 |
+
if ( isset ( $validation->error ) ) {
|
205 |
+
$this->parent->errors[] = $validation->error;
|
206 |
+
}
|
207 |
+
|
208 |
+
if ( isset ( $validation->warning ) ) {
|
209 |
+
$this->parent->warnings[] = $validation->warning;
|
210 |
+
}
|
211 |
+
}
|
212 |
+
} else {
|
213 |
+
if ( isset( $plugin_options[ $field['id'] ] ) ) {
|
214 |
+
if ( is_array( $plugin_options[ $field['id'] ] ) ) {
|
215 |
+
$pofi = $plugin_options[ $field['id'] ];
|
216 |
+
} else {
|
217 |
+
$pofi = trim( $plugin_options[ $field['id'] ] );
|
218 |
+
}
|
219 |
+
} else {
|
220 |
+
$pofi = null;
|
221 |
+
}
|
222 |
+
|
223 |
+
$validation = new $validate ( $this, $field, $pofi, $options[ $field['id'] ] );
|
224 |
+
$plugin_options[ $field['id'] ] = $validation->value;
|
225 |
+
|
226 |
+
if ( isset ( $validation->error ) ) {
|
227 |
+
$this->parent->errors[] = $validation->error;
|
228 |
+
}
|
229 |
+
|
230 |
+
if ( isset ( $validation->warning ) ) {
|
231 |
+
$this->parent->warnings[] = $validation->warning;
|
232 |
+
}
|
233 |
+
}
|
234 |
+
|
235 |
+
continue;
|
236 |
+
}
|
237 |
+
}
|
238 |
+
if ( isset ( $field['validate_callback'] ) && ( is_callable( $field['validate_callback'] ) || ( is_string( $field['validate_callback'] ) && function_exists( $field['validate_callback'] ) ) ) ) {
|
239 |
+
$callback = $field['validate_callback'];
|
240 |
+
unset ( $field['validate_callback'] );
|
241 |
+
|
242 |
+
$plugin_option = isset( $plugin_options[ $options['id'] ] ) ? $plugin_options[ $options['id'] ] : null;
|
243 |
+
$option = isset( $options[ $options['id'] ] ) ? $options[ $options['id'] ] : null;
|
244 |
+
$callbackvalues = call_user_func( $callback, $field, $plugin_option, $option );
|
245 |
+
$plugin_options[ $field['id'] ] = $callbackvalues['value'];
|
246 |
+
|
247 |
+
if ( isset ( $callbackvalues['error'] ) ) {
|
248 |
+
$this->parent->errors[] = $callbackvalues['error'];
|
249 |
+
}
|
250 |
+
// TODO - This warning message is failing. Hmm.
|
251 |
+
// No it isn't. Problem was in the sample-config - kp
|
252 |
+
if ( isset ( $callbackvalues['warning'] ) ) {
|
253 |
+
$this->parent->warnings[] = $callbackvalues['warning'];
|
254 |
+
}
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
return $plugin_options;
|
259 |
+
}
|
260 |
+
|
261 |
+
// Forces the use of the embeded field path vs what the core typically would use
|
262 |
+
public function overload_field_path( $field ) {
|
263 |
+
return dirname( __FILE__ ) . '/' . $this->field_name . '/field_' . $this->field_name . '.php';
|
264 |
+
}
|
265 |
+
|
266 |
+
} // class
|
267 |
+
} // if
|
inc/extensions/extensions/repeater/repeater/field_repeater.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.redux-container-repeater{padding:15px 20px;margin-bottom:7px;padding-top:0}.redux-container-repeater h4{margin:5px 0px 0px 0px}.redux-container-repeater h4:first-child{margin-top:0px}.redux-container-repeater .description{margin:5px 0 5px 0px}.redux-container-repeater .redux-repeater-accordion{width:100%}.redux-container-repeater .redux-repeater-accordion .ui-state-focus{outline:none}.redux-container-repeater .redux-repeater-accordion-repeater{margin-bottom:10px}.redux-container-repeater .redux-repeater-accordion-repeater>div{border:1px solid #dfdfdf !important;border-radius:0 !important;margin-top:0px !important;padding:10px}.redux-container-repeater .redux-repeater-accordion-repeater h3.ui-accordion-header{border:1px solid #dfdfdf;cursor:move;font-weight:bold;padding:0 10px;height:40px;line-height:40px;background-color:#f1f1f1;background-image:-ms-linear-gradient(top, #f9f9f9, #ececec);background-image:-moz-linear-gradient(top, #f9f9f9, #ececec);background-image:-o-linear-gradient(top, #f9f9f9, #ececec);background-image:-webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#ececec));background-image:-webkit-linear-gradient(top, #f9f9f9, #ececec);background-image:linear-gradient(top, #f9f9f9, #ececec);overflow:hidden;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-moz-box-shadow:inset 0 1px 0 #fff;-webkit-box-shadow:inset 0 1px 0 #fff;box-shadow:inset 0 1px 0 #fff;text-align:center;margin-bottom:0}.redux-container-repeater .redux-repeaters-add{float:right}.redux-container-repeater .redux-repeaters-add:after{clear:both}.redux-container-repeater .redux-repeaters-remove{color:#ef521d !important;float:right}.redux-container-repeater .redux-repeaters-remove:after{clear:both}.redux-container-repeater .redux-repeater-header{font-weight:bold}.redux-container-repeater .redux_repeaters_add_remove{margin-bottom:10px}.redux-container-repeater .redux-field-container{padding:0 0 10px 0}.redux-container-repeater .redux-field-container:last-child{padding-bottom:0}.redux-container-repeater .ui-accordion .ui-accordion-content{padding:1em}.redux-container-repeater .redux-container-sorter{margin-right:0 !important}#poststuff .redux-container-repeater h3{padding:0;cursor:move !important;line-height:40px}
|
inc/extensions/extensions/repeater/repeater/field_repeater.js
ADDED
@@ -0,0 +1,344 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*global redux_change, redux*/
|
2 |
+
|
3 |
+
(function ($) {
|
4 |
+
"use strict";
|
5 |
+
|
6 |
+
redux.field_objects = redux.field_objects || {};
|
7 |
+
redux.field_objects.repeater = redux.field_objects.repeater || {};
|
8 |
+
|
9 |
+
var reduxObject;
|
10 |
+
|
11 |
+
redux.field_objects.repeater.sort_repeaters = function (selector) {
|
12 |
+
if (!selector.hasClass('redux-container-repeater')) {
|
13 |
+
selector = selector.parents('.redux-container-repeater:first');
|
14 |
+
}
|
15 |
+
|
16 |
+
selector.find('.redux-repeater-accordion-repeater').each(
|
17 |
+
function (idx) {
|
18 |
+
|
19 |
+
var id = $(this).attr('data-sortid');
|
20 |
+
|
21 |
+
var input = $(this).find(".redux-field .repeater[name*='[" + id + "]']");
|
22 |
+
input.each(
|
23 |
+
function () {
|
24 |
+
$(this).attr('name', $(this).attr('name').replace('[' + id + ']', '[' + idx + ']'));
|
25 |
+
}
|
26 |
+
);
|
27 |
+
|
28 |
+
//var input = $( this ).find( "input[name*='[" + id + "]']" );
|
29 |
+
//input.each(
|
30 |
+
// function() {
|
31 |
+
// $( this ).attr( 'name', $( this ).attr( 'name' ).replace( '[' + id + ']', '[' + idx + ']' ) );
|
32 |
+
// }
|
33 |
+
//);
|
34 |
+
|
35 |
+
//var select = $( this ).find( "select[name*='[" + id + "]']" );
|
36 |
+
//select.each(
|
37 |
+
// function() {
|
38 |
+
// $( this ).attr( 'name', $( this ).attr( 'name' ).replace( '[' + id + ']', '[' + idx + ']' ) );
|
39 |
+
// }
|
40 |
+
//);
|
41 |
+
//$( this ).attr( 'data-sortid', idx );
|
42 |
+
|
43 |
+
// Fix the accordian header
|
44 |
+
var header = $(this).find('.ui-accordion-header');
|
45 |
+
var split = header.attr('id').split('-header-');
|
46 |
+
header.attr('id', split[0] + '-header-' + idx);
|
47 |
+
split = header.attr('aria-controls').split('-panel-');
|
48 |
+
header.attr('aria-controls', split[0] + '-panel-' + idx);
|
49 |
+
|
50 |
+
// Fix the accordian content
|
51 |
+
var content = $(this).find('.ui-accordion-content');
|
52 |
+
var split = content.attr('id').split('-panel-');
|
53 |
+
content.attr('id', split[0] + '-panel-' + idx);
|
54 |
+
split = content.attr('aria-labelledby').split('-header-');
|
55 |
+
content.attr('aria-labelledby', split[0] + '-header-' + idx);
|
56 |
+
|
57 |
+
}
|
58 |
+
);
|
59 |
+
};
|
60 |
+
|
61 |
+
|
62 |
+
redux.field_objects.repeater.init = function (selector) {
|
63 |
+
|
64 |
+
if (!selector) {
|
65 |
+
selector = $(document).find(".redux-group-tab:visible").find('.redux-container-repeater:visible');
|
66 |
+
}
|
67 |
+
|
68 |
+
$(selector).each(
|
69 |
+
function (idx) {
|
70 |
+
|
71 |
+
var el = $(this);
|
72 |
+
|
73 |
+
var parent = el;
|
74 |
+
if (!el.hasClass('redux-field-container')) {
|
75 |
+
parent = el.parents('.redux-field-container:first');
|
76 |
+
}
|
77 |
+
if (parent.is(":hidden")) { // Skip hidden fields
|
78 |
+
return;
|
79 |
+
}
|
80 |
+
if (parent.hasClass('redux-field-init')) {
|
81 |
+
parent.removeClass('redux-field-init');
|
82 |
+
} else {
|
83 |
+
return;
|
84 |
+
}
|
85 |
+
|
86 |
+
var parent = el;
|
87 |
+
|
88 |
+
if (!el.hasClass('redux-field-container')) {
|
89 |
+
parent = el.parents('.redux-field-container:first');
|
90 |
+
}
|
91 |
+
|
92 |
+
var optName = el.parents('.redux-container').data('opt-name');
|
93 |
+
|
94 |
+
if (optName === undefined) {
|
95 |
+
reduxObject = redux
|
96 |
+
} else {
|
97 |
+
reduxObject = redux.optName;
|
98 |
+
}
|
99 |
+
|
100 |
+
var gid = parent.attr('data-id');
|
101 |
+
var blank = el.find('.redux-repeater-accordion-repeater:first-child');
|
102 |
+
|
103 |
+
reduxObject.repeater[gid].blank = blank.clone().wrap('<p>').parent().html();
|
104 |
+
|
105 |
+
if (parent.hasClass('redux-container-repeater')) {
|
106 |
+
parent.addClass('redux-field-init');
|
107 |
+
}
|
108 |
+
|
109 |
+
if (parent.hasClass('redux-field-init')) {
|
110 |
+
parent.removeClass('redux-field-init');
|
111 |
+
} else {
|
112 |
+
return;
|
113 |
+
}
|
114 |
+
|
115 |
+
//if ( el.find( '.slide-title' ).length < 2 ) {
|
116 |
+
// active = 0;
|
117 |
+
//}
|
118 |
+
|
119 |
+
var base = el.find('.redux-repeater-accordion');
|
120 |
+
var panelsClosed = Boolean(base.data('panels-closed'));
|
121 |
+
var active;
|
122 |
+
|
123 |
+
if (panelsClosed === true) {
|
124 |
+
active = Boolean(false);
|
125 |
+
} else {
|
126 |
+
active = parseInt(0);
|
127 |
+
}
|
128 |
+
|
129 |
+
var accordian = el.find(".redux-repeater-accordion").accordion(
|
130 |
+
{
|
131 |
+
header: "> div > fieldset > h3",
|
132 |
+
collapsible: true,
|
133 |
+
active: active,
|
134 |
+
|
135 |
+
beforeActivate: function (event, ui) {
|
136 |
+
if (typeof reduxRepeaterAccordionBeforeActivate == 'function') {
|
137 |
+
reduxRepeaterAccordionBeforeActivate($(this), el, event, ui);
|
138 |
+
}
|
139 |
+
},
|
140 |
+
activate: function (event, ui) {
|
141 |
+
$.redux.initFields();
|
142 |
+
|
143 |
+
if (typeof reduxRepeaterAccordionActivate == 'function') {
|
144 |
+
reduxRepeaterAccordionActivate($(this), el, event, ui);
|
145 |
+
}
|
146 |
+
},
|
147 |
+
heightStyle: "content",
|
148 |
+
icons: {
|
149 |
+
"header": "ui-icon-plus",
|
150 |
+
"activeHeader": "ui-icon-minus"
|
151 |
+
}
|
152 |
+
}
|
153 |
+
);
|
154 |
+
if (reduxObject.repeater[gid].sortable == 1) {
|
155 |
+
accordian.sortable(
|
156 |
+
{
|
157 |
+
axis: "y",
|
158 |
+
handle: "h3",
|
159 |
+
connectWith: ".redux-repeater-accordion",
|
160 |
+
placeholder: "ui-state-highlight",
|
161 |
+
start: function (e, ui) {
|
162 |
+
ui.placeholder.height(ui.item.height());
|
163 |
+
ui.placeholder.width(ui.item.width());
|
164 |
+
},
|
165 |
+
stop: function (event, ui) {
|
166 |
+
// IE doesn't register the blur when sorting
|
167 |
+
// so trigger focusout handlers to remove .ui-state-focus
|
168 |
+
ui.item.children("h3").triggerHandler("focusout");
|
169 |
+
|
170 |
+
redux.field_objects.repeater.sort_repeaters($(this));
|
171 |
+
|
172 |
+
}
|
173 |
+
}
|
174 |
+
);
|
175 |
+
} else {
|
176 |
+
accordian.find('h3.ui-accordion-header').css('cursor', 'pointer');
|
177 |
+
}
|
178 |
+
|
179 |
+
el.find('.redux-repeater-accordion-repeater .bind_title').on(
|
180 |
+
'change keyup', function (event) {
|
181 |
+
var value;
|
182 |
+
|
183 |
+
if ($(event.target).find(':selected').text().length > 0) {
|
184 |
+
value = $(event.target).find(':selected').text();
|
185 |
+
} else {
|
186 |
+
value = $(event.target).val();
|
187 |
+
}
|
188 |
+
$(this).closest('.redux-repeater-accordion-repeater').find('.redux-repeater-header').text(value);
|
189 |
+
}
|
190 |
+
);
|
191 |
+
|
192 |
+
// Handler to remove the given repeater
|
193 |
+
el.find('.redux-repeaters-remove').on(
|
194 |
+
'click', function () {
|
195 |
+
redux_change($(this));
|
196 |
+
var parent = $(this).parents('.redux-container-repeater:first');
|
197 |
+
var gid = parent.attr('data-id');
|
198 |
+
reduxObject.repeater[gid].blank = $(this).parents('.redux-repeater-accordion-repeater:first').clone(
|
199 |
+
true, true
|
200 |
+
);
|
201 |
+
$(this).parents('.redux-repeater-accordion-repeater:first').slideUp(
|
202 |
+
'medium', function () {
|
203 |
+
$(this).remove();
|
204 |
+
redux.field_objects.repeater.sort_repeaters(el);
|
205 |
+
if (reduxObject.repeater[gid].limit != '') {
|
206 |
+
var count = parent.find('.redux-repeater-accordion-repeater').length;
|
207 |
+
if (count < reduxObject.repeater[gid].limit) {
|
208 |
+
parent.find('.redux-repeaters-add').removeClass('button-disabled');
|
209 |
+
}
|
210 |
+
}
|
211 |
+
parent.find('.redux-repeater-accordion-repeater:last .ui-accordion-header').click();
|
212 |
+
}
|
213 |
+
);
|
214 |
+
|
215 |
+
}
|
216 |
+
);
|
217 |
+
|
218 |
+
var x = el.find('.redux-repeater-accordion-repeater');
|
219 |
+
if (x.hasClass('close-me')) {
|
220 |
+
el.find('.redux-repeaters-remove').click();
|
221 |
+
}
|
222 |
+
|
223 |
+
String.prototype.reduxReplaceAll = function (s1, s2) {
|
224 |
+
return this.replace(
|
225 |
+
new RegExp(s1.replace(/[.^$*+?()[{\|]/g, '\\$&'), 'g'),
|
226 |
+
s2
|
227 |
+
);
|
228 |
+
};
|
229 |
+
|
230 |
+
|
231 |
+
el.find('.redux-repeaters-add').click(
|
232 |
+
function () {
|
233 |
+
|
234 |
+
if ($(this).hasClass('button-disabled')) {
|
235 |
+
return;
|
236 |
+
}
|
237 |
+
|
238 |
+
var parent = $(this).parent().find('.redux-repeater-accordion:first');
|
239 |
+
var count = parent.find('.redux-repeater-accordion-repeater').length;
|
240 |
+
|
241 |
+
var gid = parent.attr('data-id'); // Group id
|
242 |
+
if (reduxObject.repeater[gid].limit != '') {
|
243 |
+
if (count >= reduxObject.repeater[gid].limit) {
|
244 |
+
$(this).addClass('button-disabled');
|
245 |
+
return;
|
246 |
+
}
|
247 |
+
}
|
248 |
+
count++;
|
249 |
+
|
250 |
+
var id = parent.find('.redux-repeater-accordion-repeater').size(); // Index number
|
251 |
+
|
252 |
+
if (parent.find('.redux-repeater-accordion-repeater:last').find('.ui-accordion-header').hasClass('ui-state-active')) {
|
253 |
+
parent.find('.redux-repeater-accordion-repeater:last').find('.ui-accordion-header').click();
|
254 |
+
}
|
255 |
+
|
256 |
+
var newSlide = parent.find('.redux-repeater-accordion-repeater:first').clone(true, true);
|
257 |
+
|
258 |
+
var last_id = id - 1;
|
259 |
+
|
260 |
+
if (newSlide.length == 0) {
|
261 |
+
newSlide = reduxObject.repeater[gid].blank;
|
262 |
+
}
|
263 |
+
if (newSlide.attr('data-sortid').length) {
|
264 |
+
newSlide.attr('data-sortid', id);
|
265 |
+
}
|
266 |
+
var title = newSlide.find('input.slide-title');
|
267 |
+
title.attr('name', title.attr('name').replace('[0]', '[' + id + ']'));
|
268 |
+
title.attr('data-key', id);
|
269 |
+
title.val('');
|
270 |
+
|
271 |
+
|
272 |
+
if (reduxObject.repeater[gid]) {
|
273 |
+
reduxObject.repeater[gid].count = el.find('.redux-repeater-header').length;
|
274 |
+
var html = reduxObject.repeater[gid].html.reduxReplaceAll('99999', id);
|
275 |
+
$(newSlide).find('.redux-repeater-header').text('');
|
276 |
+
}
|
277 |
+
|
278 |
+
newSlide.find('.ui-accordion-content').html(html);
|
279 |
+
|
280 |
+
|
281 |
+
//var items = {};
|
282 |
+
//if ( newSlide.find( '.redux-container-editor' ) ) {
|
283 |
+
// var first_editor_id = $( '.redux-repeater-accordion-repeater:first' ).find( '.redux-container-editor' ).attr( 'data-id' );
|
284 |
+
// var editor_settings = window.tinyMCEPreInit.mceInit[first_editor_id];
|
285 |
+
// $.each(
|
286 |
+
// newSlide.find( '.redux-container-editor' ), function( key, value ) {
|
287 |
+
// // Grab an editor id
|
288 |
+
// items.push( $( this ).attr( 'data-id' ) );
|
289 |
+
// // Grab an editor settings from wp_editor
|
290 |
+
//
|
291 |
+
// // Grab a quicktags settings
|
292 |
+
// var quicktags_setting = QTags.getInstance( 'content' ).settings;
|
293 |
+
// var quicktags_id = items[items.length - 1];
|
294 |
+
// quicktags_setting.id = quicktags_id;
|
295 |
+
// }
|
296 |
+
// );
|
297 |
+
//}
|
298 |
+
|
299 |
+
// Append to the accordian
|
300 |
+
$(parent).append(newSlide);
|
301 |
+
|
302 |
+
// Render tinymce !
|
303 |
+
//if ( newSlide.find( '.redux-container-editor' ) ) {
|
304 |
+
// jQuery.each(
|
305 |
+
// items, function( i, new_editor_id ) {
|
306 |
+
// tinymce.createEditor( new_editor_id, editor_settings ).render();
|
307 |
+
// quicktags( new_editor_id );
|
308 |
+
// QTags._buttonsInit();
|
309 |
+
// }
|
310 |
+
// );
|
311 |
+
//}
|
312 |
+
|
313 |
+
// Reorder
|
314 |
+
redux.field_objects.repeater.sort_repeaters(newSlide);
|
315 |
+
// Refresh the JS object
|
316 |
+
var newSlide = $(this).parent().find('.redux-repeater-accordion:first');
|
317 |
+
newSlide.find('.redux-repeater-accordion-repeater:last .ui-accordion-header').click();
|
318 |
+
newSlide.find('.redux-repeater-accordion-repeater:last .bind_title').on(
|
319 |
+
'change keyup', function (event) {
|
320 |
+
var value;
|
321 |
+
|
322 |
+
if ($(event.target).find(':selected').text().length > 0) {
|
323 |
+
value = $(event.target).find(':selected').text();
|
324 |
+
} else {
|
325 |
+
value = $(event.target).val()
|
326 |
+
}
|
327 |
+
$(this).closest('.redux-repeater-accordion-repeater').find('.redux-repeater-header').text(value);
|
328 |
+
}
|
329 |
+
);
|
330 |
+
if (reduxObject.repeater[gid].limit > 0 && count >= reduxObject.repeater[gid].limit) {
|
331 |
+
$(this).addClass('button-disabled');
|
332 |
+
}
|
333 |
+
|
334 |
+
if (panelsClosed === true) {
|
335 |
+
if (count >= 2) {
|
336 |
+
el.find(".redux-repeater-accordion").accordion('option', {active: false})
|
337 |
+
}
|
338 |
+
}
|
339 |
+
}
|
340 |
+
);
|
341 |
+
}
|
342 |
+
);
|
343 |
+
};
|
344 |
+
})(jQuery);
|
inc/extensions/extensions/repeater/repeater/field_repeater.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(e){"use strict";var r;redux.field_objects=redux.field_objects||{},redux.field_objects.repeater=redux.field_objects.repeater||{},redux.field_objects.repeater.sort_repeaters=function(r){r.hasClass("redux-container-repeater")||(r=r.parents(".redux-container-repeater:first")),r.find(".redux-repeater-accordion-repeater").each(function(r){var t=e(this).attr("data-sortid");e(this).find(".redux-field .repeater[name*='["+t+"]']").each(function(){e(this).attr("name",e(this).attr("name").replace("["+t+"]","["+r+"]"))});var a=e(this).find(".ui-accordion-header"),i=a.attr("id").split("-header-");a.attr("id",i[0]+"-header-"+r),i=a.attr("aria-controls").split("-panel-"),a.attr("aria-controls",i[0]+"-panel-"+r);var d=e(this).find(".ui-accordion-content");i=d.attr("id").split("-panel-");d.attr("id",i[0]+"-panel-"+r),i=d.attr("aria-labelledby").split("-header-"),d.attr("aria-labelledby",i[0]+"-header-"+r)})},redux.field_objects.repeater.init=function(t){t||(t=e(document).find(".redux-group-tab:visible").find(".redux-container-repeater:visible")),e(t).each(function(t){var a=e(this),i=a;if(a.hasClass("redux-field-container")||(i=a.parents(".redux-field-container:first")),!i.is(":hidden")&&i.hasClass("redux-field-init")){i.removeClass("redux-field-init");i=a;a.hasClass("redux-field-container")||(i=a.parents(".redux-field-container:first"));var d=a.parents(".redux-container").data("opt-name");r=void 0===d?redux:redux.optName;var n=i.attr("data-id"),c=a.find(".redux-repeater-accordion-repeater:first-child");if(r.repeater[n].blank=c.clone().wrap("<p>").parent().html(),i.hasClass("redux-container-repeater")&&i.addClass("redux-field-init"),i.hasClass("redux-field-init")){i.removeClass("redux-field-init");var o,s=a.find(".redux-repeater-accordion"),l=Boolean(s.data("panels-closed"));o=!0===l?Boolean(!1):parseInt(0);var p=a.find(".redux-repeater-accordion").accordion({header:"> div > fieldset > h3",collapsible:!0,active:o,beforeActivate:function(r,t){"function"==typeof reduxRepeaterAccordionBeforeActivate&&reduxRepeaterAccordionBeforeActivate(e(this),a,r,t)},activate:function(r,t){e.redux.initFields(),"function"==typeof reduxRepeaterAccordionActivate&&reduxRepeaterAccordionActivate(e(this),a,r,t)},heightStyle:"content",icons:{header:"ui-icon-plus",activeHeader:"ui-icon-minus"}});1==r.repeater[n].sortable?p.sortable({axis:"y",handle:"h3",connectWith:".redux-repeater-accordion",placeholder:"ui-state-highlight",start:function(e,r){r.placeholder.height(r.item.height()),r.placeholder.width(r.item.width())},stop:function(r,t){t.item.children("h3").triggerHandler("focusout"),redux.field_objects.repeater.sort_repeaters(e(this))}}):p.find("h3.ui-accordion-header").css("cursor","pointer"),a.find(".redux-repeater-accordion-repeater .bind_title").on("change keyup",function(r){var t;t=e(r.target).find(":selected").text().length>0?e(r.target).find(":selected").text():e(r.target).val(),e(this).closest(".redux-repeater-accordion-repeater").find(".redux-repeater-header").text(t)}),a.find(".redux-repeaters-remove").on("click",function(){redux_change(e(this));var t=e(this).parents(".redux-container-repeater:first"),i=t.attr("data-id");r.repeater[i].blank=e(this).parents(".redux-repeater-accordion-repeater:first").clone(!0,!0),e(this).parents(".redux-repeater-accordion-repeater:first").slideUp("medium",function(){(e(this).remove(),redux.field_objects.repeater.sort_repeaters(a),""!=r.repeater[i].limit)&&(t.find(".redux-repeater-accordion-repeater").length<r.repeater[i].limit&&t.find(".redux-repeaters-add").removeClass("button-disabled"));t.find(".redux-repeater-accordion-repeater:last .ui-accordion-header").click()})}),a.find(".redux-repeater-accordion-repeater").hasClass("close-me")&&a.find(".redux-repeaters-remove").click(),String.prototype.reduxReplaceAll=function(e,r){return this.replace(new RegExp(e.replace(/[.^$*+?()[{\|]/g,"\\$&"),"g"),r)},a.find(".redux-repeaters-add").click(function(){if(!e(this).hasClass("button-disabled")){var t=e(this).parent().find(".redux-repeater-accordion:first"),i=t.find(".redux-repeater-accordion-repeater").length,d=t.attr("data-id");if(""!=r.repeater[d].limit&&i>=r.repeater[d].limit)e(this).addClass("button-disabled");else{i++;var n=t.find(".redux-repeater-accordion-repeater").size();t.find(".redux-repeater-accordion-repeater:last").find(".ui-accordion-header").hasClass("ui-state-active")&&t.find(".redux-repeater-accordion-repeater:last").find(".ui-accordion-header").click();0==(c=t.find(".redux-repeater-accordion-repeater:first").clone(!0,!0)).length&&(c=r.repeater[d].blank),c.attr("data-sortid").length&&c.attr("data-sortid",n);var c,o=c.find("input.slide-title");if(o.attr("name",o.attr("name").replace("[0]","["+n+"]")),o.attr("data-key",n),o.val(""),r.repeater[d]){r.repeater[d].count=a.find(".redux-repeater-header").length;var s=r.repeater[d].html.reduxReplaceAll("99999",n);e(c).find(".redux-repeater-header").text("")}c.find(".ui-accordion-content").html(s),e(t).append(c),redux.field_objects.repeater.sort_repeaters(c),(c=e(this).parent().find(".redux-repeater-accordion:first")).find(".redux-repeater-accordion-repeater:last .ui-accordion-header").click(),c.find(".redux-repeater-accordion-repeater:last .bind_title").on("change keyup",function(r){var t;t=e(r.target).find(":selected").text().length>0?e(r.target).find(":selected").text():e(r.target).val(),e(this).closest(".redux-repeater-accordion-repeater").find(".redux-repeater-header").text(t)}),r.repeater[d].limit>0&&i>=r.repeater[d].limit&&e(this).addClass("button-disabled"),!0===l&&i>=2&&a.find(".redux-repeater-accordion").accordion("option",{active:!1})}}})}}})}}(jQuery);
|
inc/extensions/extensions/repeater/repeater/field_repeater.php
ADDED
@@ -0,0 +1,451 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Redux Framework is free software: you can redistribute it and/or modify
|
4 |
+
* it under the terms of the GNU General Public License as published by
|
5 |
+
* the Free Software Foundation, either version 2 of the License, or
|
6 |
+
* any later version.
|
7 |
+
* Redux Framework is distributed in the hope that it will be useful,
|
8 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10 |
+
* GNU General Public License for more details.
|
11 |
+
* You should have received a copy of the GNU General Public License
|
12 |
+
* along with Redux Framework. If not, see <http://www.gnu.org/licenses/>.
|
13 |
+
*
|
14 |
+
* @package Redux Framework
|
15 |
+
* @subpackage Repeater
|
16 |
+
* @author Dovy Paukstys (dovy)
|
17 |
+
* @author Kevin Provance (kprovance)
|
18 |
+
*/
|
19 |
+
|
20 |
+
// Exit if accessed directly
|
21 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
22 |
+
exit;
|
23 |
+
}
|
24 |
+
|
25 |
+
// Don't duplicate me!
|
26 |
+
if ( ! class_exists( 'ReduxFramework_repeater' ) ) {
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Main ReduxFramework_css_layout class
|
30 |
+
*
|
31 |
+
* @since 1.0.0
|
32 |
+
*/
|
33 |
+
class ReduxFramework_repeater {
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Class Constructor. Defines the args for the extions class
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
* @access public
|
40 |
+
*
|
41 |
+
* @param array $field Field sections.
|
42 |
+
* @param array $value Values.
|
43 |
+
* @param array $parent Parent object.
|
44 |
+
*
|
45 |
+
* @return void
|
46 |
+
*/
|
47 |
+
public function __construct( $field = array(), $value = '', $parent ) {
|
48 |
+
|
49 |
+
// Set required variables
|
50 |
+
$this->parent = $parent;
|
51 |
+
$this->field = $field;
|
52 |
+
$this->value = $value;
|
53 |
+
$this->repeater_values = "";
|
54 |
+
$this->args = $parent->args;
|
55 |
+
|
56 |
+
if ( ! isset( $this->field['bind_title'] ) && ! empty( $this->field['fields'] ) ) {
|
57 |
+
$this->field['bind_title'] = $this->field['fields'][0]['id'];
|
58 |
+
}
|
59 |
+
|
60 |
+
// Set extension dir & url
|
61 |
+
if ( empty( $this->extension_dir ) ) {
|
62 |
+
$this->extension_dir = trailingslashit( str_replace( '\\', '/', dirname( __FILE__ ) ) );
|
63 |
+
$this->extension_url = site_url( str_replace( trailingslashit( str_replace( '\\', '/', ABSPATH ) ), '', $this->extension_dir ) );
|
64 |
+
}
|
65 |
+
|
66 |
+
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Field Render Function.
|
71 |
+
* Takes the vars and outputs the HTML for the field in the settings
|
72 |
+
*
|
73 |
+
* @since 1.0.0
|
74 |
+
* @access public
|
75 |
+
* @return void
|
76 |
+
*/
|
77 |
+
public function render() {
|
78 |
+
|
79 |
+
if ( ! isset( $this->field['item_name'] ) ) {
|
80 |
+
$this->field['item_name'] = "";
|
81 |
+
}
|
82 |
+
|
83 |
+
if ( ! isset( $this->field['limit'] ) ) {
|
84 |
+
$this->field['limit'] = 10;
|
85 |
+
}
|
86 |
+
|
87 |
+
if ( isset( $this->field['group_values'] ) && $this->field['group_values'] ) {
|
88 |
+
$this->repeater_values = '[' . $this->field['id'] . ']';
|
89 |
+
}
|
90 |
+
|
91 |
+
$this->field['init_empty'] = isset( $this->field['init_empty'] ) ? $this->field['init_empty'] : false;
|
92 |
+
$this->field['panels_closed'] = isset( $this->field['panels_closed'] ) ? $this->field['panels_closed'] : false;
|
93 |
+
|
94 |
+
if ( $this->field['init_empty'] == false ) {
|
95 |
+
$title = '';
|
96 |
+
if ( empty( $this->value ) || ! is_array( $this->value ) ) {
|
97 |
+
$this->value = array(
|
98 |
+
'redux_repeater_data' => array(
|
99 |
+
array(
|
100 |
+
'title' => $title
|
101 |
+
)
|
102 |
+
)
|
103 |
+
);
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
if ( isset( $this->field['subfields'] ) && empty( $this->field['fields'] ) ) {
|
108 |
+
$this->field['fields'] = $this->field['subfields'];
|
109 |
+
unset( $this->field['subfields'] );
|
110 |
+
}
|
111 |
+
|
112 |
+
echo '<div class="redux-repeater-accordion" data-id="' . $this->field['id'] . '" data-panels-closed="' . $this->field['panels_closed'] . '">';
|
113 |
+
|
114 |
+
$x = 0;
|
115 |
+
|
116 |
+
|
117 |
+
if ( isset ( $this->value['redux_repeater_data'] ) && is_array( $this->value['redux_repeater_data'] ) && ! empty ( $this->value['redux_repeater_data'] ) ) {
|
118 |
+
|
119 |
+
$repeaters = $this->value['redux_repeater_data'];
|
120 |
+
if ( $this->field['bind_title'] == "" ) {
|
121 |
+
$keys = array_keys( min( $repeaters ) );
|
122 |
+
$this->field['bind_title'] = $keys[0];
|
123 |
+
}
|
124 |
+
foreach ( $repeaters as $repeater ) {
|
125 |
+
if ( empty ( $repeater ) ) {
|
126 |
+
continue;
|
127 |
+
}
|
128 |
+
|
129 |
+
echo '<div class="redux-repeater-accordion-repeater" data-sortid="' . $x . '">';
|
130 |
+
echo '<table style="margin-top: 0;" class="redux-repeater-accordion redux-repeater form-table no-border">';
|
131 |
+
echo '<fieldset class="redux-field " data-id="' . $this->field['id'] . '">';
|
132 |
+
|
133 |
+
if ( isset( $this->field['bind_title'] ) ) {
|
134 |
+
|
135 |
+
foreach ( $this->field['fields'] as $field ) {
|
136 |
+
if ( $field['id'] == $this->field['bind_title'] ) {
|
137 |
+
$default = '';
|
138 |
+
if ( isset( $field['default'] ) ) {
|
139 |
+
$default = $field['default'];
|
140 |
+
} elseif ( isset( $field['options'] ) && ( $field['type'] != "ace_editor" ) ) {
|
141 |
+
// Sorter data filter
|
142 |
+
if ( $field['type'] == "sorter" && isset( $field['data'] ) && ! empty( $field['data'] ) && is_array( $field['data'] ) ) {
|
143 |
+
if ( ! isset( $field['args'] ) ) {
|
144 |
+
$field['args'] = array();
|
145 |
+
}
|
146 |
+
foreach ( $field['data'] as $key => $data ) {
|
147 |
+
if ( ! isset( $field['args'][ $key ] ) ) {
|
148 |
+
$field['args'][ $key ] = array();
|
149 |
+
}
|
150 |
+
$field['options'][ $key ] = $this->get_wordpress_data( $data, $field['args'][ $key ] );
|
151 |
+
}
|
152 |
+
}
|
153 |
+
$default = $field['options'];
|
154 |
+
}
|
155 |
+
|
156 |
+
if ( ! empty( $this->repeater_values ) ) {
|
157 |
+
$repeater['title'] = ! isset( $this->parent->options[ $this->field['id'] ][ $field['id'] ][ $x ] ) ? $default : $this->parent->options[ $this->field['id'] ][ $field['id'] ][ $x ];
|
158 |
+
} else {
|
159 |
+
$repeater['title'] = ! isset( $this->parent->options[ $field['id'] ][ $x ] ) ? $default : $this->parent->options[ $field['id'] ][ $x ];
|
160 |
+
}
|
161 |
+
if ( isset( $field['options'] ) && is_array( $field['options'] ) && ! empty( $field['options'] ) ) {
|
162 |
+
if ( isset( $field['options'][ $repeater['title'] ] ) ) {
|
163 |
+
$repeater['title'] = $field['options'][ $repeater['title'] ];
|
164 |
+
}
|
165 |
+
}
|
166 |
+
}
|
167 |
+
}
|
168 |
+
}
|
169 |
+
|
170 |
+
if ( is_array( $repeater['title'] ) ) {
|
171 |
+
$repeater['title'] = "Title";
|
172 |
+
}
|
173 |
+
echo '<input type="hidden" name="' . $this->parent->args['opt_name'] . '[' . $this->field['id'] . '][redux_repeater_data][' . $x . '][title]" value="' . esc_attr( $repeater['title'] ) . '" class="regular-text slide-title" data-key="' . $x . '" />';
|
174 |
+
|
175 |
+
|
176 |
+
echo '<h3><span class="redux-repeater-header">' . $repeater['title'] . ' </span></h3>';
|
177 |
+
|
178 |
+
echo '<div>';
|
179 |
+
|
180 |
+
foreach ( $this->field['fields'] as $field ) {
|
181 |
+
if ( ! isset( $field['class'] ) ) {
|
182 |
+
$field['class'] = "";
|
183 |
+
}
|
184 |
+
if ( isset( $this->field['bind_title'] ) && $field['id'] == $this->field['bind_title'] ) {
|
185 |
+
if ( ! isset( $field['class'] ) || ( isset( $field['title'] ) && empty( $field['title'] ) ) ) {
|
186 |
+
$field['class'] .= " bind_title";
|
187 |
+
} else {
|
188 |
+
$field['class'] .= " bind_title";
|
189 |
+
}
|
190 |
+
}
|
191 |
+
$this->output_field( $field, $x );
|
192 |
+
}
|
193 |
+
if ( ! isset( $this->field['static'] ) && empty( $this->field['static'] ) ) {
|
194 |
+
echo '<a href="javascript:void(0);" class="button deletion redux-repeaters-remove">' . __( 'Delete', 'req-core' ) . ' ' . $this->field['item_name'] . '</a>';
|
195 |
+
}
|
196 |
+
|
197 |
+
echo '</div>';
|
198 |
+
echo '</fieldset>';
|
199 |
+
echo '</table>';
|
200 |
+
echo '</div>';
|
201 |
+
|
202 |
+
$x ++;
|
203 |
+
}
|
204 |
+
}
|
205 |
+
|
206 |
+
if ( $x == 0 || ( isset( $this->field['static'] ) && ( $x - 1 ) < $this->field['static'] ) ) {
|
207 |
+
|
208 |
+
if ( isset( $this->field['static'] ) && $x < $this->field['static'] ) {
|
209 |
+
$loop = $this->field['static'] - $x;
|
210 |
+
} else {
|
211 |
+
$loop = 1;
|
212 |
+
}
|
213 |
+
|
214 |
+
$class = '';
|
215 |
+
if ( $x == 0 && $this->field['init_empty'] == true ) {
|
216 |
+
$class = 'close-me';
|
217 |
+
}
|
218 |
+
|
219 |
+
while ( $loop > 0 ) {
|
220 |
+
echo '<div class="redux-repeater-accordion-repeater ' . $class . '">';
|
221 |
+
echo '<table style="margin-top: 0;" class="redux-repeater-accordion redux-repeater form-table no-border">';
|
222 |
+
echo '<fieldset class="redux-field" data-id="' . $this->field['id'] . '">';
|
223 |
+
if ( ! isset( $this->value['redux_repeater_data'][ $x ]['title'] ) ) {
|
224 |
+
$this->value['redux_repeater_data'][ $x ]['title'] = "";
|
225 |
+
}
|
226 |
+
echo '<input type="hidden" name="' . $this->parent->args['opt_name'] . '[' . $this->field['id'] . '][redux_repeater_data][' . $x . '][title]" value="" class="regular-text slide-title" />';
|
227 |
+
|
228 |
+
echo '<h3><span class="redux-repeater-header"> </span></h3>';
|
229 |
+
echo '<div>';
|
230 |
+
|
231 |
+
foreach ( $this->field['fields'] as $field ) {
|
232 |
+
if ( isset( $this->field['bind_title'] ) && $field['id'] == $this->field['bind_title'] ) {
|
233 |
+
if ( ! isset( $field['class'] ) || ( isset( $field['title'] ) && empty( $field['title'] ) ) ) {
|
234 |
+
$field['class'] = "bind_title";
|
235 |
+
} else {
|
236 |
+
$field['class'] .= " bind_title";
|
237 |
+
}
|
238 |
+
}
|
239 |
+
$this->output_field( $field, $x );
|
240 |
+
}
|
241 |
+
if ( ! isset( $this->field['static'] ) && empty( $this->field['static'] ) ) {
|
242 |
+
echo '<a href="javascript:void(0);" class="button deletion redux-repeaters-remove">' . __( 'Delete', 'req-core' ) . ' ' . $this->field['item_name'] . '</a>';
|
243 |
+
}
|
244 |
+
echo '</div>';
|
245 |
+
echo '</fieldset>';
|
246 |
+
echo '</table>';
|
247 |
+
echo '</div>';
|
248 |
+
|
249 |
+
$x ++;
|
250 |
+
$loop --;
|
251 |
+
}
|
252 |
+
//}
|
253 |
+
}
|
254 |
+
|
255 |
+
echo '</div>';
|
256 |
+
if ( ! isset( $this->field['static'] ) && empty( $this->field['static'] ) ) {
|
257 |
+
$disabled = "";
|
258 |
+
if ( isset( $this->field['limit'] ) && is_integer( $this->field['limit'] ) ) {
|
259 |
+
if ( $x >= $this->field['limit'] ) {
|
260 |
+
$disabled = ' button-disabled';
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
echo '<a href="javascript:void(0);" class="button redux-repeaters-add button-primary' . $disabled . '" rel-id="' . $this->field['id'] . '-ul" rel-name="' . $this->parent->args['opt_name'] . $this->repeater_values . '[title][]">' . __( 'Add', 'req-core' ) . ' ' . $this->field['item_name'] . '</a><br/>';
|
265 |
+
}
|
266 |
+
|
267 |
+
}
|
268 |
+
|
269 |
+
/**
|
270 |
+
* Enqueue Function.
|
271 |
+
* If this field requires any scripts, or css define this function and register/enqueue the scripts/css
|
272 |
+
*
|
273 |
+
* @since 1.0.0
|
274 |
+
* @access public
|
275 |
+
* @return void
|
276 |
+
*/
|
277 |
+
public function enqueue() {
|
278 |
+
|
279 |
+
$extension = ReduxFramework_extension_repeater::getInstance();
|
280 |
+
|
281 |
+
// Set up min files for dev_mode = false.
|
282 |
+
$min = Redux_Functions::isMin();
|
283 |
+
|
284 |
+
wp_enqueue_script(
|
285 |
+
'redux-field-repeater-js',
|
286 |
+
apply_filters( "redux/repeater/{$this->parent->args['opt_name']}/enqueue/redux-field-repeater-js", $this->extension_url . 'field_repeater' . $min . '.js' ),
|
287 |
+
array(
|
288 |
+
'jquery',
|
289 |
+
'jquery-ui-core',
|
290 |
+
'jquery-ui-accordion',
|
291 |
+
'jquery-ui-sortable',
|
292 |
+
'wp-color-picker',
|
293 |
+
'redux-js'
|
294 |
+
),
|
295 |
+
time(),
|
296 |
+
true
|
297 |
+
);
|
298 |
+
|
299 |
+
|
300 |
+
wp_enqueue_style(
|
301 |
+
'redux-field-repeater-css',
|
302 |
+
apply_filters( "redux/repeater/{$this->parent->args['opt_name']}/enqueue/redux-field-repeater-css", $this->extension_url . 'field_repeater.css' ),
|
303 |
+
array(),
|
304 |
+
time(),
|
305 |
+
'all'
|
306 |
+
);
|
307 |
+
}
|
308 |
+
|
309 |
+
public function output_field( $field, $x ) {
|
310 |
+
|
311 |
+
//$this->parent->check_dependencies($field);
|
312 |
+
//we will enqueue all CSS/JS for sub fields if it wasn't enqueued
|
313 |
+
$this->enqueue_dependencies( $field['type'] );
|
314 |
+
|
315 |
+
//echo '<tr><td>';
|
316 |
+
|
317 |
+
if ( isset( $field['class'] ) ) {
|
318 |
+
$field['class'] .= " repeater";
|
319 |
+
} else {
|
320 |
+
$field['class'] = " repeater";
|
321 |
+
}
|
322 |
+
|
323 |
+
if ( ! empty( $field['title'] ) ) {
|
324 |
+
echo '<h4>' . $field['title'] . '</h4>';
|
325 |
+
}
|
326 |
+
|
327 |
+
if ( ! empty( $field['subtitle'] ) ) {
|
328 |
+
echo '<span class="description">' . $field['subtitle'] . '</span>';
|
329 |
+
}
|
330 |
+
|
331 |
+
$origFieldID = $field['id'];
|
332 |
+
|
333 |
+
$field['id'] = $field['id'] . '-' . $x;
|
334 |
+
$field["name"] = $this->parent->args['opt_name'] . $this->repeater_values . '[' . $origFieldID . ']';
|
335 |
+
$field['name_suffix'] = "[" . $x . "]";
|
336 |
+
|
337 |
+
if ( isset( $field['default'] ) ) {
|
338 |
+
$default = $field['default'];
|
339 |
+
} elseif ( isset( $field['options'] ) && ( $field['type'] != "ace_editor" ) ) {
|
340 |
+
// Sorter data filter
|
341 |
+
if ( $field['type'] == "sorter" && isset( $field['data'] ) && ! empty( $field['data'] ) && is_array( $field['data'] ) ) {
|
342 |
+
if ( ! isset( $field['args'] ) ) {
|
343 |
+
$field['args'] = array();
|
344 |
+
}
|
345 |
+
foreach ( $field['data'] as $key => $data ) {
|
346 |
+
if ( ! isset( $field['args'][ $key ] ) ) {
|
347 |
+
$field['args'][ $key ] = array();
|
348 |
+
}
|
349 |
+
$field['options'][ $key ] = $this->get_wordpress_data( $data, $field['args'][ $key ] );
|
350 |
+
}
|
351 |
+
}
|
352 |
+
$default = $field['options'];
|
353 |
+
}
|
354 |
+
|
355 |
+
$default = isset( $field['default'] ) ? $field['default'] : '';
|
356 |
+
|
357 |
+
if ( ! empty( $this->repeater_values ) ) {
|
358 |
+
$value = ! isset( $this->parent->options[ $this->field['id'] ][ $origFieldID ][ $x ] ) ? $default : $this->parent->options[ $this->field['id'] ][ $origFieldID ][ $x ];
|
359 |
+
} else {
|
360 |
+
$value = ! isset( $this->parent->options[ $origFieldID ][ $x ] ) ? $default : $this->parent->options[ $origFieldID ][ $x ];
|
361 |
+
}
|
362 |
+
|
363 |
+
ob_start();
|
364 |
+
$this->parent->_field_input( $field, $value );
|
365 |
+
|
366 |
+
$content = ob_get_contents();
|
367 |
+
//
|
368 |
+
//if ( ( $field['type'] === "text" ) && ( $field_is_title ) ) {
|
369 |
+
// $content = str_replace( '>', 'data-title="true" />', $content );
|
370 |
+
// $field_is_title = false;
|
371 |
+
//}
|
372 |
+
|
373 |
+
$_field = apply_filters( 'redux-support-repeater', $content, $field, 0 );
|
374 |
+
ob_end_clean();
|
375 |
+
echo $_field;
|
376 |
+
|
377 |
+
}
|
378 |
+
|
379 |
+
/**
|
380 |
+
* Functions to pass data from the PHP to the JS at render time.
|
381 |
+
*
|
382 |
+
* @return array Params to be saved as a javascript object accessable to the UI.
|
383 |
+
* @since Redux_Framework 3.1.5
|
384 |
+
*/
|
385 |
+
function localize( $field, $value = "" ) {
|
386 |
+
|
387 |
+
|
388 |
+
if ( isset( $field['subfields'] ) && empty( $field['fields'] ) ) {
|
389 |
+
$field['fields'] = $field['subfields'];
|
390 |
+
unset( $field['subfields'] );
|
391 |
+
}
|
392 |
+
|
393 |
+
if ( isset( $field['group_values'] ) && $field['group_values'] ) {
|
394 |
+
$this->repeater_values = '[' . $field['id'] . ']';
|
395 |
+
}
|
396 |
+
|
397 |
+
$var = "";
|
398 |
+
if ( isset( $field['fields'] ) && ! empty( $field['fields'] ) ) {
|
399 |
+
ob_start();
|
400 |
+
foreach ( $field['fields'] as $f ) {
|
401 |
+
if ( isset( $this->field['bind_title'] ) && $f['id'] == $this->field['bind_title'] ) {
|
402 |
+
if ( ! isset( $f['class'] ) || ( isset( $f['title'] ) && empty( $f['title'] ) ) ) {
|
403 |
+
$f['class'] = "bind_title";
|
404 |
+
} else {
|
405 |
+
$f['class'] .= " bind_title";
|
406 |
+
}
|
407 |
+
}
|
408 |
+
$this->output_field( $f, 99999 );
|
409 |
+
}
|
410 |
+
$var = ob_get_contents();
|
411 |
+
|
412 |
+
$var = array(
|
413 |
+
'html' => $var . '<a href="javascript:void(0);" class="button deletion redux-repeaters-remove">Delete </a>',
|
414 |
+
'count' => count( $value ),
|
415 |
+
'sortable' => true,
|
416 |
+
'limit' => '',
|
417 |
+
'name' => $this->parent->args['opt_name'] . '[' . $field['id'] . '][0]',
|
418 |
+
);
|
419 |
+
|
420 |
+
if ( isset( $field['sortable'] ) && is_bool( $this->field['sortable'] ) ) {
|
421 |
+
$var['sortable'] = $field['sortable'];
|
422 |
+
}
|
423 |
+
if ( isset( $field['limit'] ) && is_integer( $field['limit'] ) ) {
|
424 |
+
$var['limit'] = $field['limit'];
|
425 |
+
}
|
426 |
+
|
427 |
+
ob_end_clean();
|
428 |
+
}
|
429 |
+
|
430 |
+
return $var;
|
431 |
+
}
|
432 |
+
|
433 |
+
private function enqueue_dependencies( $field_type ) {
|
434 |
+
$field_class = 'ReduxFramework_' . $field_type;
|
435 |
+
|
436 |
+
if ( ! class_exists( $field_class ) ) {
|
437 |
+
$class_file = apply_filters( 'redux-typeclass-load', ReduxFramework::$_dir . 'inc/fields/' . $field_type . '/field_' . $field_type . '.php', $field_class );
|
438 |
+
|
439 |
+
if ( file_exists( $class_file ) ) {
|
440 |
+
/** @noinspection PhpIncludeInspection */
|
441 |
+
require_once( $class_file );
|
442 |
+
}
|
443 |
+
}
|
444 |
+
|
445 |
+
if ( class_exists( $field_class ) && method_exists( $field_class, 'enqueue' ) ) {
|
446 |
+
$enqueue = new $field_class( '', '', $this );
|
447 |
+
$enqueue->enqueue();
|
448 |
+
}
|
449 |
+
}
|
450 |
+
}
|
451 |
+
}
|
inc/extensions/extensions/repeater/repeater/field_repeater.scss
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.redux-container-repeater {
|
2 |
+
padding: 15px 20px;
|
3 |
+
margin-bottom: 7px;
|
4 |
+
padding-top: 0;
|
5 |
+
|
6 |
+
h4 {
|
7 |
+
margin: 5px 0px 0px 0px;
|
8 |
+
&:first-child {
|
9 |
+
margin-top: 0px;
|
10 |
+
}
|
11 |
+
}
|
12 |
+
|
13 |
+
.description {
|
14 |
+
margin: 5px 0 5px 0px;
|
15 |
+
}
|
16 |
+
|
17 |
+
.redux-repeater-accordion {
|
18 |
+
width: 100%;
|
19 |
+
}
|
20 |
+
|
21 |
+
.redux-repeater-accordion .ui-state-focus {
|
22 |
+
outline: none;
|
23 |
+
}
|
24 |
+
|
25 |
+
.redux-repeater-accordion-repeater {
|
26 |
+
margin-bottom: 10px;
|
27 |
+
}
|
28 |
+
|
29 |
+
.redux-repeater-accordion-repeater > div {
|
30 |
+
border: 1px solid #dfdfdf !important;
|
31 |
+
border-radius: 0 !important;
|
32 |
+
margin-top: 0px !important;
|
33 |
+
padding: 10px;
|
34 |
+
}
|
35 |
+
|
36 |
+
.redux-repeater-accordion-repeater h3.ui-accordion-header {
|
37 |
+
border: 1px solid #dfdfdf;
|
38 |
+
cursor: move;
|
39 |
+
font-weight: bold;
|
40 |
+
padding: 0 10px;
|
41 |
+
height: 40px;
|
42 |
+
line-height: 40px;
|
43 |
+
background-color: #f1f1f1;
|
44 |
+
background-image: -ms-linear-gradient(top, #f9f9f9, #ececec);
|
45 |
+
background-image: -moz-linear-gradient(top, #f9f9f9, #ececec);
|
46 |
+
background-image: -o-linear-gradient(top, #f9f9f9, #ececec);
|
47 |
+
background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#ececec));
|
48 |
+
background-image: -webkit-linear-gradient(top, #f9f9f9, #ececec);
|
49 |
+
background-image: linear-gradient(top, #f9f9f9, #ececec);
|
50 |
+
overflow: hidden;
|
51 |
+
-webkit-border-radius: 3px;
|
52 |
+
-moz-border-radius: 3px;
|
53 |
+
border-radius: 3px;
|
54 |
+
-moz-box-shadow: inset 0 1px 0 #fff;
|
55 |
+
-webkit-box-shadow: inset 0 1px 0 #fff;
|
56 |
+
box-shadow: inset 0 1px 0 #fff;
|
57 |
+
text-align: center;
|
58 |
+
margin-bottom: 0;
|
59 |
+
}
|
60 |
+
.redux-repeaters-add {
|
61 |
+
float: right;
|
62 |
+
&:after {
|
63 |
+
clear: both;
|
64 |
+
}
|
65 |
+
}
|
66 |
+
.redux-repeaters-remove {
|
67 |
+
color: #ef521d !important;
|
68 |
+
float: right;
|
69 |
+
&:after {
|
70 |
+
clear: both;
|
71 |
+
}
|
72 |
+
}
|
73 |
+
.redux-repeater-header {
|
74 |
+
font-weight: bold;
|
75 |
+
}
|
76 |
+
.redux_repeaters_add_remove {
|
77 |
+
margin-bottom: 10px;
|
78 |
+
}
|
79 |
+
.redux-field-container {
|
80 |
+
padding: 0 0 10px 0;
|
81 |
+
}
|
82 |
+
.redux-field-container:last-child {
|
83 |
+
padding-bottom: 0;
|
84 |
+
}
|
85 |
+
.ui-accordion .ui-accordion-content {
|
86 |
+
padding: 1em;
|
87 |
+
}
|
88 |
+
.redux-container-sorter {
|
89 |
+
margin-right: 0 !important;
|
90 |
+
}
|
91 |
+
}
|
92 |
+
|
93 |
+
#poststuff .redux-container-repeater h3 {
|
94 |
+
padding: 0;
|
95 |
+
cursor: move !important;
|
96 |
+
line-height: 40px;
|
97 |
+
}
|
inc/extensions/extensions/widget_areas/assets/css/sidebars.css
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.redux-widget_area-delete{
|
2 |
+
position: absolute;
|
3 |
+
right: 50px;
|
4 |
+
margin-top: -28px;
|
5 |
+
display: block;
|
6 |
+
height: 26px;
|
7 |
+
width: 26px;
|
8 |
+
z-index: 500;
|
9 |
+
content: "\f182";
|
10 |
+
|
11 |
+
}
|
12 |
+
|
13 |
+
#redux-add-widget h3 {
|
14 |
+
text-align:center !important;
|
15 |
+
}
|
16 |
+
|
17 |
+
.redux-widget_area-area-delete:hover{
|
18 |
+
content: "\f182";
|
19 |
+
cursor: pointer;
|
20 |
+
margin-top: -30px;
|
21 |
+
}
|
22 |
+
|
23 |
+
.activate_spinner{
|
24 |
+
display: block !important;
|
25 |
+
position: absolute;
|
26 |
+
top: 10px;
|
27 |
+
right: 4px;
|
28 |
+
background-color: #ECECEC;
|
29 |
+
}
|
30 |
+
|
31 |
+
#redux-add-widget form {
|
32 |
+
text-align: center;
|
33 |
+
}
|
34 |
+
|
35 |
+
#widget_area-redux-custom, #widget_area-redux-custom h3 {
|
36 |
+
position: relative;
|
37 |
+
}
|
38 |
+
|
39 |
+
#redux-add-widget p {
|
40 |
+
margin-top: 0;
|
41 |
+
}
|
42 |
+
#redux-add-widget {
|
43 |
+
w2idth: 285px;
|
44 |
+
margin: 0 auto;
|
45 |
+
position: relative;
|
46 |
+
}
|
47 |
+
|
48 |
+
#redux-add-widget-input {
|
49 |
+
max-width: 95%;
|
50 |
+
}
|
inc/extensions/extensions/widget_areas/assets/css/widget_areas.css
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#redux-add-widget h3 {
|
2 |
+
text-align:center !important;
|
3 |
+
padding: 15px 7px;
|
4 |
+
font-size: 1.3em;
|
5 |
+
margin-top: 5px;
|
6 |
+
}
|
7 |
+
|
8 |
+
|
9 |
+
.redux-widget_area-delete{
|
10 |
+
position: absolute;
|
11 |
+
top: 0;
|
12 |
+
right: 35px;
|
13 |
+
padding: 12px 10px;
|
14 |
+
cursor: pointer;
|
15 |
+
}
|
16 |
+
.redux-widget_area-delete:before {
|
17 |
+
font-family: "dashicons";
|
18 |
+
content: "\f182";
|
19 |
+
font: 400 20px/1 dashicons;
|
20 |
+
speak: none;
|
21 |
+
display: inline-block;
|
22 |
+
-webkit-font-smoothing: antialiased;
|
23 |
+
-moz-osx-font-smoothing: grayscale;
|
24 |
+
text-decoration: none!important;
|
25 |
+
color: #aaa;
|
26 |
+
}
|
27 |
+
|
28 |
+
.redux-widget_area-delete:hover:before{
|
29 |
+
color: #888;
|
30 |
+
}
|
31 |
+
|
32 |
+
.activate_spinner{
|
33 |
+
display: block !important;
|
34 |
+
position: absolute;
|
35 |
+
top: 10px;
|
36 |
+
right: 4px;
|
37 |
+
background-color: #ECECEC;
|
38 |
+
}
|
39 |
+
|
40 |
+
#redux-add-widget form {
|
41 |
+
text-align: center;
|
42 |
+
}
|
43 |
+
|
44 |
+
#widget_area-redux-custom, #widget_area-redux-custom h3 {
|
45 |
+
position: relative;
|
46 |
+
}
|
47 |
+
|
48 |
+
#redux-add-widget p {
|
49 |
+
margin-top: 0;
|
50 |
+
}
|
51 |
+
#redux-add-widget {
|
52 |
+
margin: 10px 0 0;
|
53 |
+
position: relative;
|
54 |
+
}
|
55 |
+
|
56 |
+
#redux-add-widget-input {
|
57 |
+
max-width: 95%;
|
58 |
+
padding: 8px;
|
59 |
+
margin-bottom: 14px;
|
60 |
+
margin-top:3px;
|
61 |
+
text-align: center;
|
62 |
+
}
|
inc/extensions/extensions/widget_areas/assets/img/trash.png
ADDED
Binary file
|
inc/extensions/extensions/widget_areas/assets/js/widget_areas.js
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($) {
|
2 |
+
"use strict";
|
3 |
+
|
4 |
+
var Redux_Widget_Areas = function(){
|
5 |
+
this.widget_wrap = $('.sidebars-column-1');
|
6 |
+
this.widget_area = $('#widgets-right');
|
7 |
+
this.parent_area = $('.widget-liquid-right');
|
8 |
+
|
9 |
+
this.widget_template = $('#redux-add-widget-template');
|
10 |
+
|
11 |
+
this.add_form_html();
|
12 |
+
this.add_del_button();
|
13 |
+
this.bind_events();
|
14 |
+
};
|
15 |
+
|
16 |
+
Redux_Widget_Areas.prototype = {
|
17 |
+
|
18 |
+
|
19 |
+
add_form_html: function() {
|
20 |
+
|
21 |
+
this.widget_wrap.append(this.widget_template.html());
|
22 |
+
this.widget_name = this.widget_wrap.find('input[name="redux-add-widget-input"]');
|
23 |
+
this.nonce = this.widget_wrap.find('input[name="redux-nonce"]').val();
|
24 |
+
},
|
25 |
+
|
26 |
+
add_del_button: function() {
|
27 |
+
var i = 0;
|
28 |
+
this.widget_area.find('.sidebar-redux-custom .widgets-sortables').each(function() {
|
29 |
+
if ( i >= redux_widget_areas ) {
|
30 |
+
$(this).append('<span class="redux-widget_area-delete"></span>')
|
31 |
+
}
|
32 |
+
i++;
|
33 |
+
});
|
34 |
+
},
|
35 |
+
|
36 |
+
bind_events: function() {
|
37 |
+
this.parent_area.on('click', 'span.redux-widget_area-delete', $.proxy( this.delete_widget_area, this));
|
38 |
+
//this.parent_area.on('click', '.addWidgetArea-button', $.proxy( this.add_widget_area, this));
|
39 |
+
|
40 |
+
$( "#addWidgetAreaForm" ).submit(function() { $.proxy( this.add_widget_area, this) });
|
41 |
+
|
42 |
+
},
|
43 |
+
|
44 |
+
add_widget_area: function(e) {
|
45 |
+
e.preventDefault();
|
46 |
+
// console.log(e);
|
47 |
+
// alert('yo'+$('#redux-add-widget-input').val());
|
48 |
+
return false;
|
49 |
+
},
|
50 |
+
|
51 |
+
//delete the widget_area area with all widgets within, then re calculate the other widget_area ids and re save the order
|
52 |
+
delete_widget_area: function(e) {
|
53 |
+
|
54 |
+
var widget = $(e.currentTarget).parents('.widgets-holder-wrap:eq(0)'),
|
55 |
+
title = widget.find('.sidebar-name h3'),
|
56 |
+
spinner = title.find('.spinner'),
|
57 |
+
widget_name = $.trim(title.text()),
|
58 |
+
obj = this;
|
59 |
+
widget.addClass('closed');
|
60 |
+
spinner.css('display', 'inline-block');
|
61 |
+
$.ajax({
|
62 |
+
type: "POST",
|
63 |
+
url: window.ajaxurl,
|
64 |
+
data: {
|
65 |
+
action: 'redux_delete_widget_area',
|
66 |
+
name: widget_name,
|
67 |
+
_wpnonce: obj.nonce
|
68 |
+
},
|
69 |
+
|
70 |
+
success: function(response) {
|
71 |
+
if(response.trim() == 'widget_area-deleted') {
|
72 |
+
widget.slideUp(200).remove();
|
73 |
+
}
|
74 |
+
}
|
75 |
+
});
|
76 |
+
}
|
77 |
+
};
|
78 |
+
|
79 |
+
$(function() {
|
80 |
+
new Redux_Widget_Areas();
|
81 |
+
});
|
82 |
+
|
83 |
+
})(jQuery);
|
inc/extensions/extensions/widget_areas/class.redux_widget_areas.php
ADDED
@@ -0,0 +1,303 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Redux Framework is free software: you can redistribute it and/or modify
|
5 |
+
* it under the terms of the GNU General Public License as published by
|
6 |
+
* the Free Software Foundation, either version 2 of the License, or
|
7 |
+
* any later version.
|
8 |
+
*
|
9 |
+
* Redux Framework is distributed in the hope that it will be useful,
|
10 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
+
* GNU General Public License for more details.
|
13 |
+
*
|
14 |
+
* You should have received a copy of the GNU General Public License
|
15 |
+
* along with Redux Framework. If not, see <http://www.gnu.org/licenses/>.
|
16 |
+
*
|
17 |
+
* @package ReduxFramework
|
18 |
+
* @author Dovy Paukstys (dovy)
|
19 |
+
* @version 3.0.0
|
20 |
+
*/
|
21 |
+
|
22 |
+
// Exit if accessed directly
|
23 |
+
if( !defined( 'ABSPATH' ) ) exit;
|
24 |
+
|
25 |
+
// Don't duplicate me!
|
26 |
+
if( !class_exists( 'Redux_Widget_Areas' ) ) {
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Main ReduxFramework customizer extension class
|
30 |
+
*
|
31 |
+
* @since 1.0.0
|
32 |
+
*/
|
33 |
+
class Redux_Widget_Areas {
|
34 |
+
|
35 |
+
// Protected vars
|
36 |
+
private $extension_url;
|
37 |
+
private $extension_dir;
|
38 |
+
/**
|
39 |
+
* Array of enabled widget_areas
|
40 |
+
*
|
41 |
+
* @since 1.0.0
|
42 |
+
*
|
43 |
+
* @var array
|
44 |
+
*/
|
45 |
+
protected $widget_areas = array();
|
46 |
+
protected $orig = array();
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Class Constructor. Defines the args for the extions class
|
50 |
+
*
|
51 |
+
* @since 1.0.0
|
52 |
+
* @access public
|
53 |
+
* @param array $sections Panel sections.
|
54 |
+
* @param array $args Class constructor arguments.
|
55 |
+
* @param array $extra_tabs Extra panel tabs.
|
56 |
+
* @return void
|
57 |
+
*/
|
58 |
+
public function __construct( $widget_areas = array() ) {
|
59 |
+
|
60 |
+
if ( empty( $this->extension_dir ) ) {
|
61 |
+
$this->extension_dir = trailingslashit( str_replace( '\\', '/', dirname( __FILE__ ) ) );
|
62 |
+
$this->extension_url = site_url( str_replace( trailingslashit( str_replace( '\\', '/', ABSPATH ) ), '', $this->extension_dir ) );
|
63 |
+
}
|
64 |
+
add_action( 'init', array(&$this, 'register_custom_widget_areas') , 1000 );
|
65 |
+
add_action( 'admin_print_scripts', array($this, 'add_new_widget_area_box') );
|
66 |
+
add_action( 'load-widgets.php', array($this, 'add_widget_area_area'), 100 );
|
67 |
+
add_action( 'load-widgets.php', array( $this, '_enqueue' ), 100 );
|
68 |
+
add_action( 'wp_ajax_redux_delete_widget_area', array( $this, 'redux_delete_widget_area_area' ) );
|
69 |
+
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Function to create the HTML used to create widget_areas.
|
74 |
+
*
|
75 |
+
* @since 1.0.0
|
76 |
+
*
|
77 |
+
*/
|
78 |
+
public function add_new_widget_area_box() {
|
79 |
+
$nonce = wp_create_nonce ('delete-redux-widget_area-nonce');
|
80 |
+
?>
|
81 |
+
<script type="text/html" id="redux-add-widget-template">
|
82 |
+
<div id="redux-add-widget" class="widgets-holder-wrap">
|
83 |
+
<div class="">
|
84 |
+
<input type="hidden" name="redux-nonce" value="<?php echo $nonce ?>" />
|
85 |
+
<div class="sidebar-name">
|
86 |
+
<h3><?php echo __('Create Widget Area', 'redux-framework'); ?> <span class="spinner"></span></h3>
|
87 |
+
</div>
|
88 |
+
<div class="sidebar-description">
|
89 |
+
<form id="addWidgetAreaForm" action="" method="post">
|
90 |
+
<div class="widget-content">
|
91 |
+
<input id="redux-add-widget-input" name="redux-add-widget-input" type="text" class="regular-text" title="<?php echo __('Name', 'redux-framework'); ?>" placeholder="<?php echo __('Name', 'redux-framework'); ?>" />
|
92 |
+
</div>
|
93 |
+
<div class="widget-control-actions">
|
94 |
+
<div class="aligncenter">
|
95 |
+
<input class="addWidgetArea-button button-primary" type="submit" value="<?php echo __('Create Widget Area', 'redux-framework'); ?>" />
|
96 |
+
</div>
|
97 |
+
<br class="clear">
|
98 |
+
</div>
|
99 |
+
</form>
|
100 |
+
</div>
|
101 |
+
</div>
|
102 |
+
</div>
|
103 |
+
</script>
|
104 |
+
<?php
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Function to create a new widget_area
|
109 |
+
*
|
110 |
+
* @since 1.0.0
|
111 |
+
*
|
112 |
+
* @param string Name of the widget_area to be deleted.
|
113 |
+
*
|
114 |
+
* @return string 'widget_area-deleted' if successful.
|
115 |
+
*
|
116 |
+
*/
|
117 |
+
function add_widget_area_area() {
|
118 |
+
if(!empty($_POST['redux-add-widget-input'])) {
|
119 |
+
//set_theme_mod('redux-widget_areas', '');
|
120 |
+
$this->widget_areas = $this->get_widget_areas();
|
121 |
+
array_push($this->widget_areas, $this->check_widget_area_name($_POST['redux-add-widget-input']));
|
122 |
+
$this->save_widget_areas();
|
123 |
+
wp_redirect( admin_url('widgets.php') );
|
124 |
+
|
125 |
+
die();
|
126 |
+
}
|
127 |
+
}
|
128 |
+
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Before we create a new widget_area, verify it doesn't already exist. If it does, append a number to the name.
|
132 |
+
*
|
133 |
+
* @since 1.0.0
|
134 |
+
*
|
135 |
+
* @param string $name Name of the widget_area to be created.
|
136 |
+
*
|
137 |
+
* @return name $name Name of the new widget_area just created.
|
138 |
+
*
|
139 |
+
*/
|
140 |
+
function check_widget_area_name($name) {
|
141 |
+
if(empty($GLOBALS['wp_registered_widget_areas']))
|
142 |
+
return $name;
|
143 |
+
|
144 |
+
$taken = array();
|
145 |
+
foreach ( $GLOBALS['wp_registered_widget_areas'] as $widget_area ) {
|
146 |
+
$taken[] = $widget_area['name'];
|
147 |
+
}
|
148 |
+
|
149 |
+
$taken = array_merge($taken, $this->widget_areas);
|
150 |
+
|
151 |
+
if(in_array($name, $taken)) {
|
152 |
+
$counter = substr($name, -1);
|
153 |
+
$new_name = "";
|
154 |
+
|
155 |
+
if(!is_numeric($counter)) {
|
156 |
+
$new_name = $name . " 1";
|
157 |
+
} else {
|
158 |
+
$new_name = substr($name, 0, -1) . ((int) $counter + 1);
|
159 |
+
}
|
160 |
+
|
161 |
+
$name = $this->check_widget_area_name($new_name);
|
162 |
+
}
|
163 |
+
echo $name;
|
164 |
+
exit();
|
165 |
+
|
166 |
+
return $name;
|
167 |
+
}
|
168 |
+
|
169 |
+
function save_widget_areas() {
|
170 |
+
set_theme_mod( 'redux-widget-areas', array_unique( $this->widget_areas ));
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Register and display the custom widget_area areas we have set.
|
175 |
+
*
|
176 |
+
* @since 1.0.0
|
177 |
+
*
|
178 |
+
*/
|
179 |
+
function register_custom_widget_areas() {
|
180 |
+
// If the single instance hasn't been set, set it now.
|
181 |
+
if ( empty($this->widget_areas) ) {
|
182 |
+
$this->widget_areas = $this->get_widget_areas();
|
183 |
+
}
|
184 |
+
|
185 |
+
$this->orig = array_unique(apply_filters('redux/widget_areas', array()));
|
186 |
+
if ( !empty( $this->orig ) && $this->orig != $this->widget_areas ) {
|
187 |
+
$this->widget_areas = array_unique(array_merge($this->widget_areas, $this->orig));
|
188 |
+
$this->save_widget_areas();
|
189 |
+
}
|
190 |
+
|
191 |
+
$options = array(
|
192 |
+
'before_title' => '<h3 class="widgettitle">',
|
193 |
+
'after_title' => '</h3>',
|
194 |
+
'before_widget' => '<div id="%1$s" class="widget clearfix %2$s">',
|
195 |
+
'after_widget' => '</div>'
|
196 |
+
);
|
197 |
+
|
198 |
+
$options = apply_filters('redux_custom_widget_args', $options);
|
199 |
+
|
200 |
+
if(is_array($this->widget_areas)) {
|
201 |
+
foreach (array_unique($this->widget_areas) as $widget_area) {
|
202 |
+
$options['class'] = 'redux-custom';
|
203 |
+
$options['name'] = $widget_area;
|
204 |
+
$options['id'] = sanitize_key( $widget_area );
|
205 |
+
register_sidebar($options);
|
206 |
+
}
|
207 |
+
}
|
208 |
+
}
|
209 |
+
|
210 |
+
|
211 |
+
/**
|
212 |
+
* Return the widget_areas array.
|
213 |
+
*
|
214 |
+
* @since 1.0.0
|
215 |
+
*
|
216 |
+
* @return array If not empty, active redux widget_areas are returned.
|
217 |
+
*/
|
218 |
+
public function get_widget_areas() {
|
219 |
+
|
220 |
+
// If the single instance hasn't been set, set it now.
|
221 |
+
if ( !empty($this->widget_areas) ) {
|
222 |
+
return $this->widget_areas;
|
223 |
+
}
|
224 |
+
|
225 |
+
$db = get_theme_mod('redux-widget-areas');
|
226 |
+
|
227 |
+
if (!empty($db)) {
|
228 |
+
$this->widget_areas = array_unique(array_merge($this->widget_areas, $db));
|
229 |
+
}
|
230 |
+
|
231 |
+
return $this->widget_areas;
|
232 |
+
|
233 |
+
}
|
234 |
+
|
235 |
+
/**
|
236 |
+
* Before we create a new widget_area, verify it doesn't already exist. If it does, append a number to the name.
|
237 |
+
*
|
238 |
+
* @since 1.0.0
|
239 |
+
*
|
240 |
+
* @param string Name of the widget_area to be deleted.
|
241 |
+
*
|
242 |
+
* @return string 'widget_area-deleted' if successful.
|
243 |
+
*
|
244 |
+
*/
|
245 |
+
function redux_delete_widget_area_area() {
|
246 |
+
//check_ajax_referer('delete-redux-widget_area-nonce');
|
247 |
+
|
248 |
+
if(!empty($_REQUEST['name'])) {
|
249 |
+
$name = strip_tags( ( stripslashes( $_REQUEST['name'] ) ) );
|
250 |
+
$this->widget_areas = $this->get_widget_areas();
|
251 |
+
$key = array_search($name, $this->widget_areas );
|
252 |
+
if( $key >= 0 ) {
|
253 |
+
unset($this->widget_areas[$key]);
|
254 |
+
$this->save_widget_areas();
|
255 |
+
}
|
256 |
+
echo "widget_area-deleted";
|
257 |
+
}
|
258 |
+
|
259 |
+
die();
|
260 |
+
}
|
261 |
+
|
262 |
+
|
263 |
+
/**
|
264 |
+
* Enqueue CSS/JS for the customizer controls
|
265 |
+
*
|
266 |
+
* @since 1.0.0
|
267 |
+
* @access public
|
268 |
+
* @global $wp_styles
|
269 |
+
* @return void
|
270 |
+
*/
|
271 |
+
function _enqueue(){
|
272 |
+
|
273 |
+
wp_enqueue_style( 'dashicons' );
|
274 |
+
|
275 |
+
wp_enqueue_script(
|
276 |
+
'redux-widget_areas-js',
|
277 |
+
$this->extension_url.'assets/js/widget_areas.js',
|
278 |
+
array('jquery'),
|
279 |
+
time(),
|
280 |
+
true
|
281 |
+
);
|
282 |
+
|
283 |
+
wp_enqueue_style(
|
284 |
+
'redux-widget_areas-css',
|
285 |
+
$this->extension_url.'assets/css/widget_areas.css',
|
286 |
+
time(),
|
287 |
+
true
|
288 |
+
);
|
289 |
+
$widgets = array();
|
290 |
+
if (!empty($this->widget_areas)) {
|
291 |
+
foreach ($this->widget_areas as $widget) {
|
292 |
+
$widgets[$widget] = 1;
|
293 |
+
}
|
294 |
+
}
|
295 |
+
|
296 |
+
|
297 |
+
wp_localize_script( 'redux-widget_areas-js', 'redux_widget_areas', array((count($this->orig))) );
|
298 |
+
|
299 |
+
}//function
|
300 |
+
|
301 |
+
} // class
|
302 |
+
|
303 |
+
} // if
|
inc/extensions/extensions/widget_areas/extension_widget_areas.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Redux Framework is free software: you can redistribute it and/or modify
|
5 |
+
* it under the terms of the GNU General Public License as published by
|
6 |
+
* the Free Software Foundation, either version 2 of the License, or
|
7 |
+
* any later version.
|
8 |
+
*
|
9 |
+
* Redux Framework is distributed in the hope that it will be useful,
|
10 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
+
* GNU General Public License for more details.
|
13 |
+
*
|
14 |
+
* You should have received a copy of the GNU General Public License
|
15 |
+
* along with Redux Framework. If not, see <http://www.gnu.org/licenses/>.
|
16 |
+
*
|
17 |
+
* @package Redux_Framework
|
18 |
+
* @subpackage Premium Extensions
|
19 |
+
* @author Dovy Paukstys (dovy)
|
20 |
+
* @version 1.0.0
|
21 |
+
*/
|
22 |
+
|
23 |
+
// Exit if accessed directly
|
24 |
+
if( !defined( 'ABSPATH' ) ) exit;
|
25 |
+
|
26 |
+
// Don't duplicate me!
|
27 |
+
if( !class_exists( 'ReduxFramework_extension_widget_areas' ) ) {
|
28 |
+
|
29 |
+
class ReduxFramework_extension_widget_areas {
|
30 |
+
|
31 |
+
public static $version = "1.0.1";
|
32 |
+
|
33 |
+
// Protected vars
|
34 |
+
protected $parent;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Class Constructor. Defines the args for the extions class
|
38 |
+
*
|
39 |
+
* @since 1.0.0
|
40 |
+
* @access public
|
41 |
+
* @param array $parent Redux_Options class instance
|
42 |
+
* @return void
|
43 |
+
*/
|
44 |
+
public function __construct( $parent ) {
|
45 |
+
if ( !class_exists( 'Redux_Widget_Areas' ) ) {
|
46 |
+
require_once(dirname(__FILE__).'/class.redux_widget_areas.php');
|
47 |
+
new Redux_Widget_Areas();
|
48 |
+
}
|
49 |
+
|
50 |
+
// Allow users to extend if they want
|
51 |
+
do_action('redux/widget_areas/'.$parent->args['opt_name'].'/construct');
|
52 |
+
|
53 |
+
}
|
54 |
+
|
55 |
+
} // class
|
56 |
+
|
57 |
+
} // if
|
inc/fuse_social_sidebar_func.php
CHANGED
@@ -102,15 +102,6 @@ class Making_Fuse_Icons
|
|
102 |
$pages_hide_from = "";
|
103 |
$hide_blog_posts = "";
|
104 |
$custom_icons = "";
|
105 |
-
if ( !empty($fuse_settings['not_display_on']) ) {
|
106 |
-
$pages_hide_from = $fuse_settings['not_display_on'];
|
107 |
-
}
|
108 |
-
if ( !empty($fuse_settings['hide_blog_posts']) ) {
|
109 |
-
$hide_blog_posts = $fuse_settings['hide_blog_posts'];
|
110 |
-
}
|
111 |
-
if ( !empty($fuse_settings['fuse-custom-icons']) ) {
|
112 |
-
$custom_icons = $fuse_settings['fuse-custom-icons'];
|
113 |
-
}
|
114 |
$options = $options['opt-sortable'];
|
115 |
// Checking if target is _self or _blank
|
116 |
|
@@ -264,6 +255,8 @@ class Making_Fuse_Icons
|
|
264 |
$this->fuse_get_custom_icons( $fuse_settings );
|
265 |
}
|
266 |
}
|
|
|
|
|
267 |
|
268 |
}
|
269 |
|
102 |
$pages_hide_from = "";
|
103 |
$hide_blog_posts = "";
|
104 |
$custom_icons = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
$options = $options['opt-sortable'];
|
106 |
// Checking if target is _self or _blank
|
107 |
|
255 |
$this->fuse_get_custom_icons( $fuse_settings );
|
256 |
}
|
257 |
}
|
258 |
+
|
259 |
+
echo "</div>";
|
260 |
|
261 |
}
|
262 |
|
inc/fuse_social_sidebar_scripts.php
CHANGED
@@ -14,7 +14,7 @@ add_action( 'admin_enqueue_scripts', 'fuse_social_styles_enqueue' );
|
|
14 |
|
15 |
|
16 |
function fuse_social_add_scripts_method() {
|
17 |
-
wp_enqueue_script( 'fuse-social-script', plugin_dir_url( __FILE__ ) . '
|
18 |
|
19 |
wp_localize_script( 'fuse-social-script', 'fuse_social',
|
20 |
array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
|
14 |
|
15 |
|
16 |
function fuse_social_add_scripts_method() {
|
17 |
+
wp_enqueue_script( 'fuse-social-script', plugin_dir_url( __FILE__ ) . 'js/fuse_script.js', array( 'jquery' ), rand() );
|
18 |
|
19 |
wp_localize_script( 'fuse-social-script', 'fuse_social',
|
20 |
array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
|
inc/js/admin-fuse.js
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function($){
|
2 |
+
jQuery(document.body).on("click",".overlay_pro_upgrade",function(){
|
3 |
+
jQuery(".upgrade_take_screen").show();
|
4 |
+
});
|
5 |
+
$(document.body).on("click",".close-time",function(event){
|
6 |
+
event.preventDefault();
|
7 |
+
jQuery(".upgrade_take_screen").hide();
|
8 |
+
});
|
9 |
+
});
|
readme.txt
CHANGED
@@ -3,17 +3,15 @@ Contributors: daniyalahmedk, freemius
|
|
3 |
Donate link: http://photontechs.com/donate
|
4 |
Tags: social media, floating sidebar, social widget, social icons,animated social icons
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 5.8
|
7 |
-
Stable tag: 5.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
This plugin allows you to add social media floating sidebar icons which can be connected with your social media profiles.
|
12 |
|
13 |
== Description ==
|
14 |
-
|
15 |
-
|
16 |
-
By simply inserting links from Admin Dashboard under Settings Menu, one can show social media icons as floating on the website. This plugin provides very attractive interface which allows you to make settings for those social media icons, in the means of :
|
17 |
<ul>
|
18 |
<li>Type of icons round and square</li>
|
19 |
<li> Animated Rotation Effect in Icons.</li>
|
@@ -23,10 +21,22 @@ By simply inserting links from Admin Dashboard under Settings Menu, one can show
|
|
23 |
|
24 |
You can check live demo with all features as well :
|
25 |
<strong>Fuse Social </strong> [Demo](https://www.fusefloat.com/demo/ "Fuse Social Floating")
|
26 |
-
<br />
|
27 |
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
Fuse Pro allow you to add custom icons, and give you more control on the social icon visiblity and analytics as well. Pro version includes following features as well.
|
31 |
<ul>
|
32 |
<li>Upload icon as image or select from icons library.</li>
|
@@ -38,8 +48,9 @@ Fuse Pro allow you to add custom icons, and give you more control on the social
|
|
38 |
<li>24/7 Lifetime support and updates with unlimited websites.</li>
|
39 |
<li>and much much more!</li>
|
40 |
</ul>
|
41 |
-
|
42 |
-
|
|
|
43 |
<br />
|
44 |
[youtube https://www.youtube.com/watch?v=fBC0SL5Ieig]
|
45 |
Its simple,unique and best WordPress plugin for floating social icons.
|
@@ -83,9 +94,11 @@ Go to Settings>Fuse Social from left side admin menu bar, then click on Settings
|
|
83 |
In settings simply checked " Don't use shadow in icons.", by default its unchecked.
|
84 |
|
85 |
== Screenshots ==
|
86 |
-
1.
|
87 |
-
2.
|
88 |
-
3. Add
|
|
|
|
|
89 |
|
90 |
== Upgrade Notice ==
|
91 |
|
3 |
Donate link: http://photontechs.com/donate
|
4 |
Tags: social media, floating sidebar, social widget, social icons,animated social icons
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 5.8.1
|
7 |
+
Stable tag: 5.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
This plugin allows you to add social media floating sidebar icons which can be connected with your social media profiles.
|
12 |
|
13 |
== Description ==
|
14 |
+
Fuse Social Floating Sidebar allow you to insert social media links very easily, you can show social media icons as floating on the website. This plugin provides very attractive interface which allows you to make settings for those social media icons, in the means of :
|
|
|
|
|
15 |
<ul>
|
16 |
<li>Type of icons round and square</li>
|
17 |
<li> Animated Rotation Effect in Icons.</li>
|
21 |
|
22 |
You can check live demo with all features as well :
|
23 |
<strong>Fuse Social </strong> [Demo](https://www.fusefloat.com/demo/ "Fuse Social Floating")
|
|
|
24 |
|
25 |
+
Action Button Feature
|
26 |
+
=============
|
27 |
+
|
28 |
+
>Now you can display social icons under the action button so you need to click on the action button to view the social icon
|
29 |
+
|
30 |
+
Sticky Social Icons
|
31 |
+
=============
|
32 |
|
33 |
+
>Floating social icons with custom colors, allow you to match the design icons according to your site.
|
34 |
+
|
35 |
+
<br />
|
36 |
+
|
37 |
+
Pro Version
|
38 |
+
=========
|
39 |
+
|
40 |
Fuse Pro allow you to add custom icons, and give you more control on the social icon visiblity and analytics as well. Pro version includes following features as well.
|
41 |
<ul>
|
42 |
<li>Upload icon as image or select from icons library.</li>
|
48 |
<li>24/7 Lifetime support and updates with unlimited websites.</li>
|
49 |
<li>and much much more!</li>
|
50 |
</ul>
|
51 |
+
[Get Pro Version Now](https://www.fusefloat.com "Fuse Social Floating")
|
52 |
+
|
53 |
+
<u>Use coupon code WPORG20 to get 20% discount.</u>
|
54 |
<br />
|
55 |
[youtube https://www.youtube.com/watch?v=fBC0SL5Ieig]
|
56 |
Its simple,unique and best WordPress plugin for floating social icons.
|
94 |
In settings simply checked " Don't use shadow in icons.", by default its unchecked.
|
95 |
|
96 |
== Screenshots ==
|
97 |
+
1. Sticky Social Icons
|
98 |
+
2. Action button allow you to social icons on click.
|
99 |
+
3. Add social media profiles links in these boxes.
|
100 |
+
4. Select icons style, square/circle. Confgiure options, like open link in new tab,sizes etc.
|
101 |
+
5. Add on hover animation on icons. Put a number to make delay in animations. Like (0.5)
|
102 |
|
103 |
== Upgrade Notice ==
|
104 |
|