Version Description
Download this release
Release Info
Developer | colorlibplugins |
Plugin | Shapely Companion |
Version | 1.2.8 |
Comparing to | |
See all releases |
Code changes from version 1.2.7 to 1.2.8
- assets/css/admin.css +50 -50
- assets/js/admin.js +113 -113
- assets/js/nav-menu.js +46 -46
- assets/js/previewer.js +74 -74
- assets/js/vendor/jquery-cloneya.js +517 -517
- assets/js/vendor/jquery-cloneya.min.js +1 -1
- assets/js/vendor/jquery.vide.js +501 -501
- assets/js/vendor/jquery.vide.min.js +8 -8
- assets/js/vendor/jquery.youtubebackground.js +334 -334
- assets/js/vendor/player.js +2118 -2118
- assets/js/vendor/player.min.js +2 -2
- assets/js/widget.js +113 -113
- inc/class-shapely-walker-nav-menu-edit.php +210 -208
- inc/epsilon-dashboard/class-epsilon-dashboard.php +224 -224
- inc/shapely-demo-content.php +167 -167
- inc/shapely-enqueues.php +34 -34
- inc/shapely-helper.php +64 -64
- inc/shapely-metabox.php +84 -84
- inc/shapely-navmenu.php +95 -95
- inc/shapely-widgets.php +53 -53
- inc/views/shapely-demo-content.php +33 -33
- inc/widgets/class-shapely-categories.php +148 -148
- inc/widgets/class-shapely-home-call-for-action.php +122 -122
- inc/widgets/class-shapely-home-clients.php +177 -177
- inc/widgets/class-shapely-home-contact.php +271 -271
- inc/widgets/class-shapely-home-features.php +752 -752
- inc/widgets/class-shapely-home-parallax.php +284 -284
- inc/widgets/class-shapely-home-portfolio.php +254 -254
- inc/widgets/class-shapely-home-testimonials.php +170 -170
- inc/widgets/class-shapely-page-content.php +70 -70
- inc/widgets/class-shapely-page-title.php +48 -48
- inc/widgets/class-shapely-recent-posts.php +164 -164
- inc/widgets/class-shapely-social.php +115 -115
- inc/widgets/class-shapely-video.php +250 -250
- languages/shapely.pot +425 -425
- license.txt +673 -673
- readme.txt +101 -101
- shapely-companion.php +92 -92
assets/css/admin.css
CHANGED
@@ -1,51 +1,51 @@
|
|
1 |
-
.shapely-media-control img {
|
2 |
-
width: 100%;
|
3 |
-
height: auto;
|
4 |
-
}
|
5 |
-
|
6 |
-
.logo_heading {
|
7 |
-
display: block;
|
8 |
-
width: 100%;
|
9 |
-
}
|
10 |
-
|
11 |
-
#setting-error-tgmpa.notice {
|
12 |
-
display: block;
|
13 |
-
}
|
14 |
-
|
15 |
-
.client-sortable .logo_heading {
|
16 |
-
background: #f3f3f3;
|
17 |
-
border: 1px dotted;
|
18 |
-
cursor: move;
|
19 |
-
display: block;
|
20 |
-
font-size: 14px;
|
21 |
-
padding: 8px 0;
|
22 |
-
text-align: center;
|
23 |
-
width: 100%;
|
24 |
-
}
|
25 |
-
|
26 |
-
.client-sortable .logo_heading:hover {
|
27 |
-
border: 1px solid;
|
28 |
-
}
|
29 |
-
|
30 |
-
.client-sortable .cloneya a.clone,
|
31 |
-
.client-sortable .cloneya a.delete {
|
32 |
-
display: none;
|
33 |
-
}
|
34 |
-
|
35 |
-
.client-sortable .cloneya:last-child a.clone,
|
36 |
-
.client-sortable .cloneya:last-child a.delete {
|
37 |
-
display: inline-block;
|
38 |
-
}
|
39 |
-
|
40 |
-
.shapely-media-control img {
|
41 |
-
width: 100%;
|
42 |
-
}
|
43 |
-
|
44 |
-
.shapely-editor-container label {
|
45 |
-
position: relative;
|
46 |
-
top: 30px;
|
47 |
-
}
|
48 |
-
|
49 |
-
.checkbox_switch {
|
50 |
-
margin: 10px auto;
|
51 |
}
|
1 |
+
.shapely-media-control img {
|
2 |
+
width: 100%;
|
3 |
+
height: auto;
|
4 |
+
}
|
5 |
+
|
6 |
+
.logo_heading {
|
7 |
+
display: block;
|
8 |
+
width: 100%;
|
9 |
+
}
|
10 |
+
|
11 |
+
#setting-error-tgmpa.notice {
|
12 |
+
display: block;
|
13 |
+
}
|
14 |
+
|
15 |
+
.client-sortable .logo_heading {
|
16 |
+
background: #f3f3f3;
|
17 |
+
border: 1px dotted;
|
18 |
+
cursor: move;
|
19 |
+
display: block;
|
20 |
+
font-size: 14px;
|
21 |
+
padding: 8px 0;
|
22 |
+
text-align: center;
|
23 |
+
width: 100%;
|
24 |
+
}
|
25 |
+
|
26 |
+
.client-sortable .logo_heading:hover {
|
27 |
+
border: 1px solid;
|
28 |
+
}
|
29 |
+
|
30 |
+
.client-sortable .cloneya a.clone,
|
31 |
+
.client-sortable .cloneya a.delete {
|
32 |
+
display: none;
|
33 |
+
}
|
34 |
+
|
35 |
+
.client-sortable .cloneya:last-child a.clone,
|
36 |
+
.client-sortable .cloneya:last-child a.delete {
|
37 |
+
display: inline-block;
|
38 |
+
}
|
39 |
+
|
40 |
+
.shapely-media-control img {
|
41 |
+
width: 100%;
|
42 |
+
}
|
43 |
+
|
44 |
+
.shapely-editor-container label {
|
45 |
+
position: relative;
|
46 |
+
top: 30px;
|
47 |
+
}
|
48 |
+
|
49 |
+
.checkbox_switch {
|
50 |
+
margin: 10px auto;
|
51 |
}
|
assets/js/admin.js
CHANGED
@@ -1,113 +1,113 @@
|
|
1 |
-
jQuery( document ).ready(function() {// jscs:ignore validateLineBreaks
|
2 |
-
|
3 |
-
jQuery( '#demo_content .button' ).on('click', function( evt ) {
|
4 |
-
var currentButton = jQuery( this );
|
5 |
-
var ajaxData = { 'action': 'shapely_companion_import_content', 'import': jQuery( this ).data( 'action' ), 'nonce': shapelyCompanion.nonce };
|
6 |
-
evt.preventDefault();
|
7 |
-
jQuery( this ).addClass( 'disabled' );
|
8 |
-
jQuery( this ).next( '.spinner' ).addClass( 'is-active' );
|
9 |
-
jQuery.ajax({
|
10 |
-
type: 'POST',
|
11 |
-
data: ajaxData,
|
12 |
-
url: shapelyCompanion.ajaxurl,
|
13 |
-
success: function( data ) {
|
14 |
-
if ( 'succes' === data ) {
|
15 |
-
currentButton.removeClass( 'disabled' );
|
16 |
-
currentButton.next( '.spinner' ).removeClass( 'is-active' );
|
17 |
-
currentButton.parent().parent().find( '.updated-message' ).show();
|
18 |
-
location.reload();
|
19 |
-
}
|
20 |
-
|
21 |
-
}
|
22 |
-
|
23 |
-
});
|
24 |
-
|
25 |
-
});
|
26 |
-
|
27 |
-
});
|
28 |
-
|
29 |
-
jQuery(function( $ ) {
|
30 |
-
var mediaControl = {
|
31 |
-
|
32 |
-
// Initializes a new media manager or returns an existing frame.
|
33 |
-
// @see wp.media.featuredImage.frame()
|
34 |
-
selector: null,
|
35 |
-
size: null,
|
36 |
-
container: null,
|
37 |
-
frame: function() {
|
38 |
-
if ( this._frame ) {
|
39 |
-
return this._frame;
|
40 |
-
|
41 |
-
}
|
42 |
-
|
43 |
-
this._frame = wp.media({
|
44 |
-
title: 'Media',
|
45 |
-
button: {
|
46 |
-
text: 'Update'
|
47 |
-
},
|
48 |
-
multiple: false
|
49 |
-
});
|
50 |
-
|
51 |
-
this._frame.on( 'open', this.updateFrame ).state( 'library' ).on( 'select', this.select );
|
52 |
-
|
53 |
-
return this._frame;
|
54 |
-
|
55 |
-
},
|
56 |
-
|
57 |
-
select: function() {
|
58 |
-
|
59 |
-
// Do something when the "update" button is clicked after a selection is made.
|
60 |
-
var id = $( '.attachments' ).find( '.selected' ).attr( 'data-id' );
|
61 |
-
var selector = $( '.shapely-media-control' ).find( mediaControl.selector );
|
62 |
-
var data = {
|
63 |
-
action: 'shapely_get_attachment_media',
|
64 |
-
attachment_id: id
|
65 |
-
};
|
66 |
-
|
67 |
-
if ( ! selector.length ) {
|
68 |
-
return false;
|
69 |
-
|
70 |
-
}
|
71 |
-
|
72 |
-
jQuery.post( shapelyCompanion.ajaxurl, data, function( response ) {
|
73 |
-
var ext = response.substr( ( response.lastIndexOf( '.' ) + 1 ) );
|
74 |
-
if ( 'mp4' !== ext ) {
|
75 |
-
$( mediaControl.container ).find( 'img' ).attr( 'src', response );
|
76 |
-
}
|
77 |
-
|
78 |
-
selector.val( response ).trigger('change');
|
79 |
-
|
80 |
-
});
|
81 |
-
|
82 |
-
},
|
83 |
-
|
84 |
-
init: function() {
|
85 |
-
var context = $( '#wpbody, .wp-customizer' );
|
86 |
-
context.on( 'click', '.shapely-media-control > .upload-button', function( e ) {
|
87 |
-
var container = $( this ).parent(),
|
88 |
-
sibling = container.find( '.image-id' ),
|
89 |
-
id = sibling.attr( 'id' );
|
90 |
-
e.preventDefault();
|
91 |
-
mediaControl.size = $( '[data-delegate="' + id + '"]' ).val();
|
92 |
-
mediaControl.container = container;
|
93 |
-
mediaControl.selector = '#' + id;
|
94 |
-
mediaControl.frame().open();
|
95 |
-
|
96 |
-
});
|
97 |
-
|
98 |
-
context.on( 'click', '.shapely-media-control > .remove-button', function( e ) {
|
99 |
-
var container = $( this ).parent(),
|
100 |
-
sibling = container.find( '.image-id' ),
|
101 |
-
img = container.find( 'img' );
|
102 |
-
e.preventDefault();
|
103 |
-
img.attr( 'src', img.attr( 'data-default' ) );
|
104 |
-
sibling.val( '' ).trigger( 'change' );
|
105 |
-
|
106 |
-
});
|
107 |
-
|
108 |
-
}
|
109 |
-
|
110 |
-
};
|
111 |
-
|
112 |
-
mediaControl.init();
|
113 |
-
});
|
1 |
+
jQuery( document ).ready(function() {// jscs:ignore validateLineBreaks
|
2 |
+
|
3 |
+
jQuery( '#demo_content .button' ).on('click', function( evt ) {
|
4 |
+
var currentButton = jQuery( this );
|
5 |
+
var ajaxData = { 'action': 'shapely_companion_import_content', 'import': jQuery( this ).data( 'action' ), 'nonce': shapelyCompanion.nonce };
|
6 |
+
evt.preventDefault();
|
7 |
+
jQuery( this ).addClass( 'disabled' );
|
8 |
+
jQuery( this ).next( '.spinner' ).addClass( 'is-active' );
|
9 |
+
jQuery.ajax({
|
10 |
+
type: 'POST',
|
11 |
+
data: ajaxData,
|
12 |
+
url: shapelyCompanion.ajaxurl,
|
13 |
+
success: function( data ) {
|
14 |
+
if ( 'succes' === data ) {
|
15 |
+
currentButton.removeClass( 'disabled' );
|
16 |
+
currentButton.next( '.spinner' ).removeClass( 'is-active' );
|
17 |
+
currentButton.parent().parent().find( '.updated-message' ).show();
|
18 |
+
location.reload();
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
22 |
+
|
23 |
+
});
|
24 |
+
|
25 |
+
});
|
26 |
+
|
27 |
+
});
|
28 |
+
|
29 |
+
jQuery(function( $ ) {
|
30 |
+
var mediaControl = {
|
31 |
+
|
32 |
+
// Initializes a new media manager or returns an existing frame.
|
33 |
+
// @see wp.media.featuredImage.frame()
|
34 |
+
selector: null,
|
35 |
+
size: null,
|
36 |
+
container: null,
|
37 |
+
frame: function() {
|
38 |
+
if ( this._frame ) {
|
39 |
+
return this._frame;
|
40 |
+
|
41 |
+
}
|
42 |
+
|
43 |
+
this._frame = wp.media({
|
44 |
+
title: 'Media',
|
45 |
+
button: {
|
46 |
+
text: 'Update'
|
47 |
+
},
|
48 |
+
multiple: false
|
49 |
+
});
|
50 |
+
|
51 |
+
this._frame.on( 'open', this.updateFrame ).state( 'library' ).on( 'select', this.select );
|
52 |
+
|
53 |
+
return this._frame;
|
54 |
+
|
55 |
+
},
|
56 |
+
|
57 |
+
select: function() {
|
58 |
+
|
59 |
+
// Do something when the "update" button is clicked after a selection is made.
|
60 |
+
var id = $( '.attachments' ).find( '.selected' ).attr( 'data-id' );
|
61 |
+
var selector = $( '.shapely-media-control' ).find( mediaControl.selector );
|
62 |
+
var data = {
|
63 |
+
action: 'shapely_get_attachment_media',
|
64 |
+
attachment_id: id
|
65 |
+
};
|
66 |
+
|
67 |
+
if ( ! selector.length ) {
|
68 |
+
return false;
|
69 |
+
|
70 |
+
}
|
71 |
+
|
72 |
+
jQuery.post( shapelyCompanion.ajaxurl, data, function( response ) {
|
73 |
+
var ext = response.substr( ( response.lastIndexOf( '.' ) + 1 ) );
|
74 |
+
if ( 'mp4' !== ext ) {
|
75 |
+
$( mediaControl.container ).find( 'img' ).attr( 'src', response );
|
76 |
+
}
|
77 |
+
|
78 |
+
selector.val( response ).trigger('change');
|
79 |
+
|
80 |
+
});
|
81 |
+
|
82 |
+
},
|
83 |
+
|
84 |
+
init: function() {
|
85 |
+
var context = $( '#wpbody, .wp-customizer' );
|
86 |
+
context.on( 'click', '.shapely-media-control > .upload-button', function( e ) {
|
87 |
+
var container = $( this ).parent(),
|
88 |
+
sibling = container.find( '.image-id' ),
|
89 |
+
id = sibling.attr( 'id' );
|
90 |
+
e.preventDefault();
|
91 |
+
mediaControl.size = $( '[data-delegate="' + id + '"]' ).val();
|
92 |
+
mediaControl.container = container;
|
93 |
+
mediaControl.selector = '#' + id;
|
94 |
+
mediaControl.frame().open();
|
95 |
+
|
96 |
+
});
|
97 |
+
|
98 |
+
context.on( 'click', '.shapely-media-control > .remove-button', function( e ) {
|
99 |
+
var container = $( this ).parent(),
|
100 |
+
sibling = container.find( '.image-id' ),
|
101 |
+
img = container.find( 'img' );
|
102 |
+
e.preventDefault();
|
103 |
+
img.attr( 'src', img.attr( 'data-default' ) );
|
104 |
+
sibling.val( '' ).trigger( 'change' );
|
105 |
+
|
106 |
+
});
|
107 |
+
|
108 |
+
}
|
109 |
+
|
110 |
+
};
|
111 |
+
|
112 |
+
mediaControl.init();
|
113 |
+
});
|
assets/js/nav-menu.js
CHANGED
@@ -1,46 +1,46 @@
|
|
1 |
-
(function( $ ) {// jscs:ignore validateLineBreaks
|
2 |
-
|
3 |
-
'use strict';
|
4 |
-
var api;
|
5 |
-
|
6 |
-
api = wpNavMenu;
|
7 |
-
|
8 |
-
$( '#submit-shapelysection' ).on('click', function( evt ) {
|
9 |
-
var section = $( '#shapelysectionsdiv' ).find( '#shapely-section-item-widget' ).val(),
|
10 |
-
label = $( '#shapelysectionsdiv' ).find( '#shapely-section-item-name' ).val(),
|
11 |
-
url = $( '#shapelysectionsdiv' ).find( '#shapely-section-item-url' ).val();
|
12 |
-
|
13 |
-
evt.preventDefault();
|
14 |
-
|
15 |
-
if ( '0' === section || '' === label || '' === url ) {
|
16 |
-
$( '#shapelysectionsdiv' ).addClass( 'form-invalid' );
|
17 |
-
return false;
|
18 |
-
}
|
19 |
-
|
20 |
-
$( '.customlinkdiv .spinner' ).addClass( 'is-active' );
|
21 |
-
|
22 |
-
api.addItemToMenu( {
|
23 |
-
'-1': {
|
24 |
-
'menu-item-type': 'custom',
|
25 |
-
'menu-item-extra': 'shapely-section',
|
26 |
-
'menu-item-url': url,
|
27 |
-
'menu-item-widget': section,
|
28 |
-
'menu-item-title': label
|
29 |
-
}
|
30 |
-
}, api.addMenuItemToBottom, shapelyMenuAdded );
|
31 |
-
|
32 |
-
} );
|
33 |
-
|
34 |
-
function shapelyMenuAdded() {
|
35 |
-
|
36 |
-
// Remove the ajax spinner
|
37 |
-
$( '#shapelysectionsdiv .spinner' ).removeClass( 'is-active' );
|
38 |
-
|
39 |
-
// Set custom link form back to defaults
|
40 |
-
$( '#shapelysectionsdiv #shapely-section-item-widget' ).val( '0' ).trigger('blur');
|
41 |
-
$( '#shapelysectionsdiv #shapely-section-item-url' ).val( '' ).trigger('blur');
|
42 |
-
$( '#shapelysectionsdiv #shapely-section-item-name' ).val( '' ).trigger('blur');
|
43 |
-
|
44 |
-
}
|
45 |
-
|
46 |
-
})( jQuery );
|
1 |
+
(function( $ ) {// jscs:ignore validateLineBreaks
|
2 |
+
|
3 |
+
'use strict';
|
4 |
+
var api;
|
5 |
+
|
6 |
+
api = wpNavMenu;
|
7 |
+
|
8 |
+
$( '#submit-shapelysection' ).on('click', function( evt ) {
|
9 |
+
var section = $( '#shapelysectionsdiv' ).find( '#shapely-section-item-widget' ).val(),
|
10 |
+
label = $( '#shapelysectionsdiv' ).find( '#shapely-section-item-name' ).val(),
|
11 |
+
url = $( '#shapelysectionsdiv' ).find( '#shapely-section-item-url' ).val();
|
12 |
+
|
13 |
+
evt.preventDefault();
|
14 |
+
|
15 |
+
if ( '0' === section || '' === label || '' === url ) {
|
16 |
+
$( '#shapelysectionsdiv' ).addClass( 'form-invalid' );
|
17 |
+
return false;
|
18 |
+
}
|
19 |
+
|
20 |
+
$( '.customlinkdiv .spinner' ).addClass( 'is-active' );
|
21 |
+
|
22 |
+
api.addItemToMenu( {
|
23 |
+
'-1': {
|
24 |
+
'menu-item-type': 'custom',
|
25 |
+
'menu-item-extra': 'shapely-section',
|
26 |
+
'menu-item-url': url,
|
27 |
+
'menu-item-widget': section,
|
28 |
+
'menu-item-title': label
|
29 |
+
}
|
30 |
+
}, api.addMenuItemToBottom, shapelyMenuAdded );
|
31 |
+
|
32 |
+
} );
|
33 |
+
|
34 |
+
function shapelyMenuAdded() {
|
35 |
+
|
36 |
+
// Remove the ajax spinner
|
37 |
+
$( '#shapelysectionsdiv .spinner' ).removeClass( 'is-active' );
|
38 |
+
|
39 |
+
// Set custom link form back to defaults
|
40 |
+
$( '#shapelysectionsdiv #shapely-section-item-widget' ).val( '0' ).trigger('blur');
|
41 |
+
$( '#shapelysectionsdiv #shapely-section-item-url' ).val( '' ).trigger('blur');
|
42 |
+
$( '#shapelysectionsdiv #shapely-section-item-name' ).val( '' ).trigger('blur');
|
43 |
+
|
44 |
+
}
|
45 |
+
|
46 |
+
})( jQuery );
|
assets/js/previewer.js
CHANGED
@@ -1,74 +1,74 @@
|
|
1 |
-
(function( $ ) {// jscs:ignore validateLineBreaks
|
2 |
-
|
3 |
-
'use strict';
|
4 |
-
|
5 |
-
$( document ).ready( function() {
|
6 |
-
if ( 'undefined' === typeof wp || ! wp.customize || ! wp.customize.selectiveRefresh ) {
|
7 |
-
return;
|
8 |
-
}
|
9 |
-
|
10 |
-
wp.customize.selectiveRefresh.bind( 'widget-updated', function( placement ) {
|
11 |
-
var maxHeight, container, msnry, element;
|
12 |
-
$( '.logo-carousel' ).flexslider( {
|
13 |
-
minItems: 1,
|
14 |
-
maxItems: 4,
|
15 |
-
move: 1,
|
16 |
-
itemWidth: 200,
|
17 |
-
itemMargin: 0,
|
18 |
-
animation: 'slide',
|
19 |
-
slideshow: true,
|
20 |
-
slideshowSpeed: 3000,
|
21 |
-
directionNav: false,
|
22 |
-
controlNav: false
|
23 |
-
} );
|
24 |
-
|
25 |
-
if ( 'function' === typeof $( '.parallax-window' ).parallax ) {
|
26 |
-
$( '.parallax-window' ).parallax();
|
27 |
-
}
|
28 |
-
|
29 |
-
if ( $( '.masonry' ).length && 'undefined' !== typeof Masonry ) {
|
30 |
-
container = document.querySelector( '.masonry' );
|
31 |
-
msnry = new Masonry( container, {
|
32 |
-
itemSelector: '.masonry-item'
|
33 |
-
} );
|
34 |
-
maxHeight = -1;
|
35 |
-
msnry.on( 'layoutComplete', function() {
|
36 |
-
var element = jQuery( msnry.element ),
|
37 |
-
cols = element.find( '.masonry-item img' );
|
38 |
-
jQuery.each( cols, function() {
|
39 |
-
if ( parseInt( jQuery( this ).attr( 'height' ), 10 ) > maxHeight ) {
|
40 |
-
maxHeight = parseInt( jQuery( this ).attr( 'height' ), 10 );
|
41 |
-
}
|
42 |
-
} );
|
43 |
-
|
44 |
-
} );
|
45 |
-
|
46 |
-
msnry.layout();
|
47 |
-
element = jQuery( msnry.element );
|
48 |
-
|
49 |
-
jQuery( element ).css( 'height', maxHeight + 'px' );
|
50 |
-
}
|
51 |
-
|
52 |
-
if ( 0 !== jQuery( '.testimonial-section' ).length ) {
|
53 |
-
testimonialHeight();
|
54 |
-
setTimeout( function() {
|
55 |
-
testimonialHeight();
|
56 |
-
}, 3000 );
|
57 |
-
}
|
58 |
-
|
59 |
-
$( '.slider-arrow-controls' ).flexslider( {
|
60 |
-
controlNav: false
|
61 |
-
} );
|
62 |
-
|
63 |
-
/*
|
64 |
-
* Resetting testimonial parallax height
|
65 |
-
*/
|
66 |
-
function testimonialHeight() {
|
67 |
-
var testimonialHeight = jQuery( '.testimonial-section .parallax-window .container' ).outerHeight() + 150;
|
68 |
-
jQuery( '.testimonial-section .parallax-window' ).css( 'height', testimonialHeight );
|
69 |
-
jQuery( window ).trigger( 'resize' ).trigger( 'scroll' );
|
70 |
-
}
|
71 |
-
} );
|
72 |
-
} );
|
73 |
-
|
74 |
-
})( jQuery );
|
1 |
+
(function( $ ) {// jscs:ignore validateLineBreaks
|
2 |
+
|
3 |
+
'use strict';
|
4 |
+
|
5 |
+
$( document ).ready( function() {
|
6 |
+
if ( 'undefined' === typeof wp || ! wp.customize || ! wp.customize.selectiveRefresh ) {
|
7 |
+
return;
|
8 |
+
}
|
9 |
+
|
10 |
+
wp.customize.selectiveRefresh.bind( 'widget-updated', function( placement ) {
|
11 |
+
var maxHeight, container, msnry, element;
|
12 |
+
$( '.logo-carousel' ).flexslider( {
|
13 |
+
minItems: 1,
|
14 |
+
maxItems: 4,
|
15 |
+
move: 1,
|
16 |
+
itemWidth: 200,
|
17 |
+
itemMargin: 0,
|
18 |
+
animation: 'slide',
|
19 |
+
slideshow: true,
|
20 |
+
slideshowSpeed: 3000,
|
21 |
+
directionNav: false,
|
22 |
+
controlNav: false
|
23 |
+
} );
|
24 |
+
|
25 |
+
if ( 'function' === typeof $( '.parallax-window' ).parallax ) {
|
26 |
+
$( '.parallax-window' ).parallax();
|
27 |
+
}
|
28 |
+
|
29 |
+
if ( $( '.masonry' ).length && 'undefined' !== typeof Masonry ) {
|
30 |
+
container = document.querySelector( '.masonry' );
|
31 |
+
msnry = new Masonry( container, {
|
32 |
+
itemSelector: '.masonry-item'
|
33 |
+
} );
|
34 |
+
maxHeight = -1;
|
35 |
+
msnry.on( 'layoutComplete', function() {
|
36 |
+
var element = jQuery( msnry.element ),
|
37 |
+
cols = element.find( '.masonry-item img' );
|
38 |
+
jQuery.each( cols, function() {
|
39 |
+
if ( parseInt( jQuery( this ).attr( 'height' ), 10 ) > maxHeight ) {
|
40 |
+
maxHeight = parseInt( jQuery( this ).attr( 'height' ), 10 );
|
41 |
+
}
|
42 |
+
} );
|
43 |
+
|
44 |
+
} );
|
45 |
+
|
46 |
+
msnry.layout();
|
47 |
+
element = jQuery( msnry.element );
|
48 |
+
|
49 |
+
jQuery( element ).css( 'height', maxHeight + 'px' );
|
50 |
+
}
|
51 |
+
|
52 |
+
if ( 0 !== jQuery( '.testimonial-section' ).length ) {
|
53 |
+
testimonialHeight();
|
54 |
+
setTimeout( function() {
|
55 |
+
testimonialHeight();
|
56 |
+
}, 3000 );
|
57 |
+
}
|
58 |
+
|
59 |
+
$( '.slider-arrow-controls' ).flexslider( {
|
60 |
+
controlNav: false
|
61 |
+
} );
|
62 |
+
|
63 |
+
/*
|
64 |
+
* Resetting testimonial parallax height
|
65 |
+
*/
|
66 |
+
function testimonialHeight() {
|
67 |
+
var testimonialHeight = jQuery( '.testimonial-section .parallax-window .container' ).outerHeight() + 150;
|
68 |
+
jQuery( '.testimonial-section .parallax-window' ).css( 'height', testimonialHeight );
|
69 |
+
jQuery( window ).trigger( 'resize' ).trigger( 'scroll' );
|
70 |
+
}
|
71 |
+
} );
|
72 |
+
} );
|
73 |
+
|
74 |
+
})( jQuery );
|
assets/js/vendor/jquery-cloneya.js
CHANGED
@@ -1,518 +1,518 @@
|
|
1 |
-
/**
|
2 |
-
* CloneYa!: Plugin to clone form elements in a nested manner
|
3 |
-
* @author Saurabh Shukla <saurabh@yapapaya.com>
|
4 |
-
* http://hookrefineandtinker.com
|
5 |
-
* License GNU/GPL & MIT
|
6 |
-
*/
|
7 |
-
|
8 |
-
(function( $ ) {
|
9 |
-
|
10 |
-
"use strict";
|
11 |
-
|
12 |
-
var name = "cloneya", defaults = {
|
13 |
-
cloneThis: '.toclone',
|
14 |
-
cloneButton: '.clone',
|
15 |
-
deleteButton: '.delete',
|
16 |
-
clonePosition: 'after',
|
17 |
-
minimum: 1,
|
18 |
-
// renaming limit
|
19 |
-
maximum: 999, //setting it to a high number, by default
|
20 |
-
|
21 |
-
//limit: 999,
|
22 |
-
|
23 |
-
valueClone: false,
|
24 |
-
dataClone: false,
|
25 |
-
deepClone: false,
|
26 |
-
serializeID: true,
|
27 |
-
ignore: 'label.error',
|
28 |
-
preserveChildCount: false
|
29 |
-
};
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Create the class CloneYa
|
33 |
-
*
|
34 |
-
* @class CloneYa
|
35 |
-
* @classdesc Adds cloning functionality to element
|
36 |
-
*
|
37 |
-
* @param {String | Object} element - the clone wrapper
|
38 |
-
*
|
39 |
-
* @param {Object} options - options to initialise with
|
40 |
-
*
|
41 |
-
* @param {String} options.cloneThis - Selector for the clone element
|
42 |
-
* @param {String} options.cloneButton - Selector for the clone button
|
43 |
-
* @param {String} options.deleteButton - Selector for the delete button
|
44 |
-
*
|
45 |
-
* @param {String} options.clonePosition - Where should the clone be added 'before' or 'after'
|
46 |
-
*
|
47 |
-
* @param {Number} options.limit - The maximum number of clones
|
48 |
-
*
|
49 |
-
* @param {Boolean} options.valueClone - Clone the input values as well?
|
50 |
-
* @param {Boolean} options.dataClone - Clone the data attributes?
|
51 |
-
* @param {Boolean} options.deepClone - Clone other data added to the jQuery object
|
52 |
-
*
|
53 |
-
* @param {Boolean} options.serializeID - Whether to serialize the IDs, automatically
|
54 |
-
* @param {String} options.ignore - Selectors for clonables' elements that should not be cloned
|
55 |
-
* @param {Boolean} options.defaultRender - Start with this number of clones, by default
|
56 |
-
* @param {Boolean} options.preserveChildCount - whether to preserve the initial number of clone's child clones, works with nesting as well.
|
57 |
-
*
|
58 |
-
* @returns {_L13.CloneYa}
|
59 |
-
*/
|
60 |
-
function CloneYa( element, options ) {
|
61 |
-
/**
|
62 |
-
* regex for recalculating the ids
|
63 |
-
*
|
64 |
-
* @type RegExp
|
65 |
-
*/
|
66 |
-
this.regex = /^(.*)(\d)+$/i;
|
67 |
-
|
68 |
-
this.elem = element;
|
69 |
-
|
70 |
-
this.$elem = $( element );
|
71 |
-
|
72 |
-
this.elemClass = name + '-wrap';
|
73 |
-
|
74 |
-
/**
|
75 |
-
* creating a jQuery object, just in case
|
76 |
-
*
|
77 |
-
* @type @call;$
|
78 |
-
*/
|
79 |
-
//var elem = $(element);
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Support deprecated parameters
|
83 |
-
*/
|
84 |
-
if ( typeof options !== 'undefined' ) {
|
85 |
-
if ( typeof options.limit !== 'undefined' && options.limit > 0 ) {
|
86 |
-
options.maximum = options.limit;
|
87 |
-
}
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* merge the passed options object with defaults
|
92 |
-
*
|
93 |
-
* @type @exp;$@call;extend
|
94 |
-
*/
|
95 |
-
this.config = $.extend( {}, defaults, options );
|
96 |
-
|
97 |
-
/**
|
98 |
-
*
|
99 |
-
* @type @exp;elem@call;closestChild
|
100 |
-
*/
|
101 |
-
this.clones = this.$elem.closestChild( this.config.cloneThis );
|
102 |
-
|
103 |
-
this.init();
|
104 |
-
|
105 |
-
}
|
106 |
-
|
107 |
-
CloneYa.prototype = {
|
108 |
-
init: function() {
|
109 |
-
|
110 |
-
var $this = this;
|
111 |
-
|
112 |
-
// add our classes
|
113 |
-
$this.$elem.addClass( $this.elemClass );
|
114 |
-
$this.clones.addClass( name );
|
115 |
-
|
116 |
-
// save the sibling count into data attr
|
117 |
-
$this.clones.data( 'initialCount', $this.clones.length );
|
118 |
-
|
119 |
-
//Now, what if the clone button and delete button are not contained in
|
120 |
-
//the clonable?
|
121 |
-
// add a click handler for the clone buttons
|
122 |
-
$this.$elem.on( 'click.' + name, $this.config.cloneThis + '>' + $this.config.cloneButton, function( event ) {
|
123 |
-
event.preventDefault();
|
124 |
-
event.stopPropagation();
|
125 |
-
|
126 |
-
var toClone = $( this ).closest( $this.config.cloneThis );
|
127 |
-
|
128 |
-
// this is just a wrapper for the custom clone event
|
129 |
-
$this.$elem.triggerAll( 'clone_clone clone.' + name, [ toClone ] );
|
130 |
-
} );
|
131 |
-
|
132 |
-
// the custom clone event
|
133 |
-
$this.$elem.on( 'clone.' + name, function( event, toClone ) {
|
134 |
-
if ( event.namespace === name ) {
|
135 |
-
$this._cloneAndAppend( toClone );
|
136 |
-
}
|
137 |
-
} );
|
138 |
-
|
139 |
-
// click handler for delete button
|
140 |
-
$this.$elem.on( 'click.' + name, $this.config.cloneThis + '>' + $this.config.deleteButton, function( event ) {
|
141 |
-
event.preventDefault();
|
142 |
-
event.stopPropagation();
|
143 |
-
|
144 |
-
var toDelete = $( this ).closest( $this.config.cloneThis );
|
145 |
-
// just a wrapper for delclone event
|
146 |
-
$this.$elem.triggerAll( 'clone_delete delete.' + name, [ toDelete ] );
|
147 |
-
} );
|
148 |
-
|
149 |
-
// the delete clone event
|
150 |
-
$this.$elem.on( 'delete.' + name, function( event, toDelete ) {
|
151 |
-
|
152 |
-
// get the count of all the sibling clones
|
153 |
-
/**
|
154 |
-
*
|
155 |
-
* @type @exp;$todelete@call;closest@call;closestChild@pro;length
|
156 |
-
*/
|
157 |
-
var cloneCount = toDelete.closest( '.' + $this.elemClass ).closestChild( $this.config.cloneThis ).length;
|
158 |
-
|
159 |
-
if ( cloneCount > $this.config.minimum ) {
|
160 |
-
// trigger hook
|
161 |
-
$this.$elem.triggerAll( 'clone_before_delete before_delete.' + name, [ toDelete, cloneCount ] );
|
162 |
-
$this.$elem.triggerHandler( 'remove.' + name, [ toDelete ] );
|
163 |
-
$this.$elem.triggerAll( 'clone_after_delete after_delete.' + name );
|
164 |
-
|
165 |
-
}
|
166 |
-
else {
|
167 |
-
|
168 |
-
$this.$elem.triggerHandler( 'minimum.' + name, $this.config.minimum, [ toDelete ] );
|
169 |
-
|
170 |
-
// First clone form can't be deleted, but the values should be removed from first form
|
171 |
-
// is this expected behaviour? especially since we use minimum?
|
172 |
-
toDelete.find( 'input, textarea, select' ).each( function() {
|
173 |
-
$this._clearForm( $( this ) );
|
174 |
-
} );
|
175 |
-
|
176 |
-
}
|
177 |
-
} );
|
178 |
-
|
179 |
-
$this.$elem.on( 'remove.' + name, function( event, toDelete ) {
|
180 |
-
$( toDelete ).remove();
|
181 |
-
|
182 |
-
} );
|
183 |
-
|
184 |
-
},
|
185 |
-
_clean: function() {
|
186 |
-
var $this = this;
|
187 |
-
$this.$elem.removeClass( name + '-wrap' );
|
188 |
-
$this.clones.removeClass( name );
|
189 |
-
$this.$elem.off( 'click.' + name, $this.config.cloneThis + '>' + $this.config.cloneButton );
|
190 |
-
$this.$elem.off( 'click.' + name, $this.config.cloneThis + '>' + $this.config.deleteButton );
|
191 |
-
$this.$elem.off( 'clone_clone clone_delete clone_before_delete clone.' + name + ' delete.' + name + ' before_delete.' + name );
|
192 |
-
|
193 |
-
},
|
194 |
-
destroy: function() {
|
195 |
-
this._clean();
|
196 |
-
this.$elem.removeData( name );
|
197 |
-
},
|
198 |
-
getOption: function() {
|
199 |
-
return this.config;
|
200 |
-
},
|
201 |
-
setOption: function( lateOptions ) {
|
202 |
-
$.extend( this.config, lateOptions || {} );
|
203 |
-
this._clean();
|
204 |
-
this.init();
|
205 |
-
|
206 |
-
},
|
207 |
-
_cloneAndAppend: function( toClone ) {
|
208 |
-
|
209 |
-
|
210 |
-
// get the count of all the sibling clones
|
211 |
-
/**
|
212 |
-
*
|
213 |
-
* @type @exp;$toclone@call;closest@call;closestChild@pro;length
|
214 |
-
*/
|
215 |
-
var cloneCount = toClone.closest( '.' + this.elemClass ).closestChild( this.config.cloneThis ).length;
|
216 |
-
|
217 |
-
// check if we've reached the maximum limit
|
218 |
-
if ( cloneCount < this.config.maximum ) {
|
219 |
-
|
220 |
-
// trigger a custom event for hooking in
|
221 |
-
this.$elem.triggerAll( 'clone_before_clone before_clone.' + name, [ toClone ] );
|
222 |
-
|
223 |
-
var newClone = this._cloneItem( toClone );
|
224 |
-
|
225 |
-
// trigger custom event on the original element
|
226 |
-
this.$elem.triggerAll( 'clone_after_clone after_clone.' + name, [ toClone, newClone ] );
|
227 |
-
|
228 |
-
// add to our clones object
|
229 |
-
this.clones.add( newClone );
|
230 |
-
|
231 |
-
// trigger custom event on the new clone
|
232 |
-
this.$elem.triggerAll( 'clone_before_append before_append.' + name, [ toClone, newClone ] );
|
233 |
-
|
234 |
-
// get the position where the clone has to be added
|
235 |
-
// and add the newclone
|
236 |
-
if ( this.config.clonePosition !== 'after' ) {
|
237 |
-
toClone.before( newClone );
|
238 |
-
} else {
|
239 |
-
toClone.after( newClone );
|
240 |
-
|
241 |
-
}
|
242 |
-
|
243 |
-
if ( this.config.ignore ) {
|
244 |
-
newClone.find( this.config.ignore ).remove();
|
245 |
-
}
|
246 |
-
|
247 |
-
// reformat the id attributes
|
248 |
-
this._redoIDs();
|
249 |
-
|
250 |
-
// trigger custom event for hooking
|
251 |
-
this.$elem.triggerAll( 'clone_after_append after_append.' + name, [ toClone, newClone ] );
|
252 |
-
} else {
|
253 |
-
// trigger a custom event for hooking
|
254 |
-
this.$elem.triggerAll( 'clone_limit maximum.' + name, this.config.maximum, [ toClone ] );
|
255 |
-
}
|
256 |
-
|
257 |
-
},
|
258 |
-
_cloneItem: function( toClone ) {
|
259 |
-
var $this = this;
|
260 |
-
|
261 |
-
// clone it
|
262 |
-
/**
|
263 |
-
*
|
264 |
-
* @type @exp;$toclone@call;clone
|
265 |
-
*/
|
266 |
-
var newClone = toClone.clone( $this.config.dataClone, $this.config.deepClone );
|
267 |
-
|
268 |
-
// we want to preserve the initial child count
|
269 |
-
if ( $this.config.preserveChildCount !== false ) {
|
270 |
-
// the child count only needs preservation if they are clonable.
|
271 |
-
|
272 |
-
var originalChildren = toClone.find( '.' + name + '-wrap' );
|
273 |
-
|
274 |
-
// for each wrapper
|
275 |
-
newClone.find( '.' + name + '-wrap' ).each( function( index ) {
|
276 |
-
|
277 |
-
/**
|
278 |
-
*
|
279 |
-
* @type @call;jquery-cloneya_L8.$@call;closestChild
|
280 |
-
*/
|
281 |
-
var inNewClone = $( this ).closestChild( '.' + name );
|
282 |
-
|
283 |
-
var inOriginal = $( originalChildren[ index ] ).closestChild( '.' + name );
|
284 |
-
|
285 |
-
/**
|
286 |
-
*
|
287 |
-
* @type @exp;inOriginal@call;data
|
288 |
-
*/
|
289 |
-
var originalCount = inOriginal.data( 'initialCount' );
|
290 |
-
|
291 |
-
/**
|
292 |
-
*
|
293 |
-
* @type @exp;inNewClone@call;slice
|
294 |
-
*/
|
295 |
-
var $extra = inNewClone.slice( originalCount, inNewClone.length );
|
296 |
-
|
297 |
-
$extra.remove();
|
298 |
-
|
299 |
-
inNewClone.data( 'initial-count', originalCount );
|
300 |
-
} );
|
301 |
-
|
302 |
-
}
|
303 |
-
|
304 |
-
// get the form input
|
305 |
-
newClone.find( 'input, textarea, select' ).each( function() {
|
306 |
-
|
307 |
-
// check if the values need to be copied, if not empty them
|
308 |
-
$this._clearForm( $( this ) );
|
309 |
-
|
310 |
-
// removed the portion taking care of the index
|
311 |
-
// each case is specific and I'd rather leave it to the developer
|
312 |
-
|
313 |
-
// custom event hook for index handling
|
314 |
-
$this.$elem.triggerAll( 'clone_form_input form_input.' + name, [ $( this ), toClone, newClone ] );
|
315 |
-
} );
|
316 |
-
|
317 |
-
return newClone;
|
318 |
-
|
319 |
-
},
|
320 |
-
/*
|
321 |
-
* Clear Form will used to clear the values of the form
|
322 |
-
*/
|
323 |
-
/**
|
324 |
-
*
|
325 |
-
* @param {type} $el
|
326 |
-
* @returns {undefined}
|
327 |
-
*/
|
328 |
-
_clearForm: function( $el ) {
|
329 |
-
|
330 |
-
if ( !this.config.valueClone && !$el.hasClass( 'noEmpty' ) ) {
|
331 |
-
|
332 |
-
if ( $el.is( ':checkbox' ) || $el.is( ':radio' ) ) {
|
333 |
-
|
334 |
-
$el.prop( 'checked', false );
|
335 |
-
}
|
336 |
-
else {
|
337 |
-
$el.val( '' );
|
338 |
-
}
|
339 |
-
|
340 |
-
}
|
341 |
-
|
342 |
-
},
|
343 |
-
/**
|
344 |
-
* Redo the id attribute, serially
|
345 |
-
*/
|
346 |
-
/**
|
347 |
-
*
|
348 |
-
* @returns {undefined}
|
349 |
-
*/
|
350 |
-
_redoIDs: function() {
|
351 |
-
|
352 |
-
var $this = this;
|
353 |
-
|
354 |
-
// check if this even needs to be done
|
355 |
-
if ( $this.config.serializeID !== true ) {
|
356 |
-
return;
|
357 |
-
}
|
358 |
-
|
359 |
-
// get the id of the first clone (hoping to increment the ids)
|
360 |
-
/**
|
361 |
-
*
|
362 |
-
* @type @exp;elem@call;find@call;first@call;attr
|
363 |
-
*/
|
364 |
-
var mainid = $this.$elem.find( $this.config.cloneThis ).first().attr( 'id' );
|
365 |
-
|
366 |
-
$this.$elem.find( $this.config.cloneThis ).each( function( i ) {
|
367 |
-
|
368 |
-
var j;
|
369 |
-
// assign the index to a string var for appending to the ids
|
370 |
-
// 0 index will have no number at the end
|
371 |
-
if ( i !== 0 ) {
|
372 |
-
j = i;
|
373 |
-
} else {
|
374 |
-
j = '';
|
375 |
-
}
|
376 |
-
|
377 |
-
// first modify the clone id
|
378 |
-
if ( $( this ).attr( 'id' ) ) {
|
379 |
-
$( this ).attr( 'id', mainid + j );
|
380 |
-
}
|
381 |
-
|
382 |
-
var id, nId;
|
383 |
-
// take all the elements inside the clone
|
384 |
-
$( this ).find( '*' ).each( function() {
|
385 |
-
|
386 |
-
id = $( this ).attr( 'id' );
|
387 |
-
if ( id ) {
|
388 |
-
// match the id with the regex to get the string part
|
389 |
-
// separate from the number part
|
390 |
-
var match = id.match( $this.regex );
|
391 |
-
|
392 |
-
// if there was a number
|
393 |
-
if ( match && match.length === 3 ) {
|
394 |
-
// just take the string part
|
395 |
-
// add the new number to it
|
396 |
-
nId = id.replace( /\d+$/, "" ) + j;
|
397 |
-
|
398 |
-
$( this ).attr( 'id', nId );
|
399 |
-
} else {
|
400 |
-
// else there was no number,
|
401 |
-
// this was earlier the first element
|
402 |
-
// just add the number to its id
|
403 |
-
nId = id + j;
|
404 |
-
$( this ).attr( 'id', nId );
|
405 |
-
}
|
406 |
-
}
|
407 |
-
|
408 |
-
//update label
|
409 |
-
$( this ).closest( $this.config.cloneThis ).find( "label[for='" + id + "']" ).attr( 'for', nId );
|
410 |
-
|
411 |
-
if ( $this.config.serializeIndex ) {
|
412 |
-
var name = $( this ).attr( 'name' );
|
413 |
-
// This will increment the numeric array index for cloned field names
|
414 |
-
if ( name ) {
|
415 |
-
var matches = name.match( /\[([0-9}]+)\]/ );
|
416 |
-
|
417 |
-
if ( matches && matches.length >= 1 ) {
|
418 |
-
|
419 |
-
var st = name;
|
420 |
-
var name = st.replace( matches[ 0 ], "[" + i + "]" );
|
421 |
-
|
422 |
-
$( this ).attr( 'name', name );
|
423 |
-
}
|
424 |
-
}
|
425 |
-
}
|
426 |
-
|
427 |
-
} );
|
428 |
-
} );
|
429 |
-
|
430 |
-
}
|
431 |
-
|
432 |
-
};
|
433 |
-
|
434 |
-
// add the cloneya to the global object
|
435 |
-
/**
|
436 |
-
*
|
437 |
-
* @param {type} options
|
438 |
-
* @returns {jquery-cloneya_L8.$.fn@call;each}
|
439 |
-
*/
|
440 |
-
$.fn[ name ] = function( options ) {
|
441 |
-
var args = arguments;
|
442 |
-
|
443 |
-
if ( options === undefined || typeof options === 'object' ) {
|
444 |
-
// Creates a new plugin instance, for each selected element, and
|
445 |
-
// stores a reference withint the element's data
|
446 |
-
return this.each( function() {
|
447 |
-
if ( !$.data( this, name ) ) {
|
448 |
-
$.data( this, name, new CloneYa( this, options ) );
|
449 |
-
}
|
450 |
-
} );
|
451 |
-
} else if ( typeof options === 'string' && options[ 0 ] !== '_' && options !== 'init' ) {
|
452 |
-
// Call a public pluguin method (not starting with an underscore) for each
|
453 |
-
// selected element.
|
454 |
-
if ( Array.prototype.slice.call( args, 1 ).length === 0 && $.inArray( options, $.fn[ name ].getters ) !== -1 ) {
|
455 |
-
// If the user does not pass any arguments and the method allows to
|
456 |
-
// work as a getter then break the chainability so we can return a value
|
457 |
-
// instead the element reference.
|
458 |
-
var instance = $.data( this[ 0 ], name );
|
459 |
-
return instance[ options ].apply( instance, Array.prototype.slice.call( args, 1 ) );
|
460 |
-
} else {
|
461 |
-
// Invoke the speficied method on each selected element
|
462 |
-
return this.each( function() {
|
463 |
-
var instance = $.data( this, name );
|
464 |
-
if ( instance instanceof CloneYa && typeof instance[ options ] === 'function' ) {
|
465 |
-
instance[ options ].apply( instance, Array.prototype.slice.call( args, 1 ) );
|
466 |
-
}
|
467 |
-
} );
|
468 |
-
}
|
469 |
-
}
|
470 |
-
};
|
471 |
-
|
472 |
-
$.fn[ name ].getters = [ 'getOption' ];
|
473 |
-
|
474 |
-
/*
|
475 |
-
* jquery.closestchild 0.1.1
|
476 |
-
*
|
477 |
-
* Author: Andrey Mikhaylov aka lolmaus
|
478 |
-
* Email: lolmaus@gmail.com
|
479 |
-
*
|
480 |
-
*/
|
481 |
-
/**
|
482 |
-
*
|
483 |
-
* @param {type} selector
|
484 |
-
* @returns {$}
|
485 |
-
*/
|
486 |
-
$.fn.closestChild = function( selector ) {
|
487 |
-
var $children, $results;
|
488 |
-
|
489 |
-
$children = this.children();
|
490 |
-
|
491 |
-
if ( $children.length === 0 ) {
|
492 |
-
return $();
|
493 |
-
}
|
494 |
-
|
495 |
-
$results = $children.filter( selector );
|
496 |
-
|
497 |
-
if ( $results.length > 0 ) {
|
498 |
-
return $results;
|
499 |
-
} else {
|
500 |
-
return $children.closestChild( selector );
|
501 |
-
}
|
502 |
-
};
|
503 |
-
|
504 |
-
/*
|
505 |
-
* TriggerAll, modified from stackoverflow
|
506 |
-
* http://stackoverflow.com/questions/11850625/jquery-trigger-multiple-events
|
507 |
-
*/
|
508 |
-
$.fn.extend( {
|
509 |
-
triggerAll: function( events, params ) {
|
510 |
-
var el = this, i, evts = events.split( ' ' );
|
511 |
-
for ( i = 0; i < evts.length; i += 1 ) {
|
512 |
-
el.triggerHandler( evts[ i ], params );
|
513 |
-
}
|
514 |
-
return el;
|
515 |
-
}
|
516 |
-
} );
|
517 |
-
|
518 |
})( jQuery );
|
1 |
+
/**
|
2 |
+
* CloneYa!: Plugin to clone form elements in a nested manner
|
3 |
+
* @author Saurabh Shukla <saurabh@yapapaya.com>
|
4 |
+
* http://hookrefineandtinker.com
|
5 |
+
* License GNU/GPL & MIT
|
6 |
+
*/
|
7 |
+
|
8 |
+
(function( $ ) {
|
9 |
+
|
10 |
+
"use strict";
|
11 |
+
|
12 |
+
var name = "cloneya", defaults = {
|
13 |
+
cloneThis: '.toclone',
|
14 |
+
cloneButton: '.clone',
|
15 |
+
deleteButton: '.delete',
|
16 |
+
clonePosition: 'after',
|
17 |
+
minimum: 1,
|
18 |
+
// renaming limit
|
19 |
+
maximum: 999, //setting it to a high number, by default
|
20 |
+
|
21 |
+
//limit: 999,
|
22 |
+
|
23 |
+
valueClone: false,
|
24 |
+
dataClone: false,
|
25 |
+
deepClone: false,
|
26 |
+
serializeID: true,
|
27 |
+
ignore: 'label.error',
|
28 |
+
preserveChildCount: false
|
29 |
+
};
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Create the class CloneYa
|
33 |
+
*
|
34 |
+
* @class CloneYa
|
35 |
+
* @classdesc Adds cloning functionality to element
|
36 |
+
*
|
37 |
+
* @param {String | Object} element - the clone wrapper
|
38 |
+
*
|
39 |
+
* @param {Object} options - options to initialise with
|
40 |
+
*
|
41 |
+
* @param {String} options.cloneThis - Selector for the clone element
|
42 |
+
* @param {String} options.cloneButton - Selector for the clone button
|
43 |
+
* @param {String} options.deleteButton - Selector for the delete button
|
44 |
+
*
|
45 |
+
* @param {String} options.clonePosition - Where should the clone be added 'before' or 'after'
|
46 |
+
*
|
47 |
+
* @param {Number} options.limit - The maximum number of clones
|
48 |
+
*
|
49 |
+
* @param {Boolean} options.valueClone - Clone the input values as well?
|
50 |
+
* @param {Boolean} options.dataClone - Clone the data attributes?
|
51 |
+
* @param {Boolean} options.deepClone - Clone other data added to the jQuery object
|
52 |
+
*
|
53 |
+
* @param {Boolean} options.serializeID - Whether to serialize the IDs, automatically
|
54 |
+
* @param {String} options.ignore - Selectors for clonables' elements that should not be cloned
|
55 |
+
* @param {Boolean} options.defaultRender - Start with this number of clones, by default
|
56 |
+
* @param {Boolean} options.preserveChildCount - whether to preserve the initial number of clone's child clones, works with nesting as well.
|
57 |
+
*
|
58 |
+
* @returns {_L13.CloneYa}
|
59 |
+
*/
|
60 |
+
function CloneYa( element, options ) {
|
61 |
+
/**
|
62 |
+
* regex for recalculating the ids
|
63 |
+
*
|
64 |
+
* @type RegExp
|
65 |
+
*/
|
66 |
+
this.regex = /^(.*)(\d)+$/i;
|
67 |
+
|
68 |
+
this.elem = element;
|
69 |
+
|
70 |
+
this.$elem = $( element );
|
71 |
+
|
72 |
+
this.elemClass = name + '-wrap';
|
73 |
+
|
74 |
+
/**
|
75 |
+
* creating a jQuery object, just in case
|
76 |
+
*
|
77 |
+
* @type @call;$
|
78 |
+
*/
|
79 |
+
//var elem = $(element);
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Support deprecated parameters
|
83 |
+
*/
|
84 |
+
if ( typeof options !== 'undefined' ) {
|
85 |
+
if ( typeof options.limit !== 'undefined' && options.limit > 0 ) {
|
86 |
+
options.maximum = options.limit;
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* merge the passed options object with defaults
|
92 |
+
*
|
93 |
+
* @type @exp;$@call;extend
|
94 |
+
*/
|
95 |
+
this.config = $.extend( {}, defaults, options );
|
96 |
+
|
97 |
+
/**
|
98 |
+
*
|
99 |
+
* @type @exp;elem@call;closestChild
|
100 |
+
*/
|
101 |
+
this.clones = this.$elem.closestChild( this.config.cloneThis );
|
102 |
+
|
103 |
+
this.init();
|
104 |
+
|
105 |
+
}
|
106 |
+
|
107 |
+
CloneYa.prototype = {
|
108 |
+
init: function() {
|
109 |
+
|
110 |
+
var $this = this;
|
111 |
+
|
112 |
+
// add our classes
|
113 |
+
$this.$elem.addClass( $this.elemClass );
|
114 |
+
$this.clones.addClass( name );
|
115 |
+
|
116 |
+
// save the sibling count into data attr
|
117 |
+
$this.clones.data( 'initialCount', $this.clones.length );
|
118 |
+
|
119 |
+
//Now, what if the clone button and delete button are not contained in
|
120 |
+
//the clonable?
|
121 |
+
// add a click handler for the clone buttons
|
122 |
+
$this.$elem.on( 'click.' + name, $this.config.cloneThis + '>' + $this.config.cloneButton, function( event ) {
|
123 |
+
event.preventDefault();
|
124 |
+
event.stopPropagation();
|
125 |
+
|
126 |
+
var toClone = $( this ).closest( $this.config.cloneThis );
|
127 |
+
|
128 |
+
// this is just a wrapper for the custom clone event
|
129 |
+
$this.$elem.triggerAll( 'clone_clone clone.' + name, [ toClone ] );
|
130 |
+
} );
|
131 |
+
|
132 |
+
// the custom clone event
|
133 |
+
$this.$elem.on( 'clone.' + name, function( event, toClone ) {
|
134 |
+
if ( event.namespace === name ) {
|
135 |
+
$this._cloneAndAppend( toClone );
|
136 |
+
}
|
137 |
+
} );
|
138 |
+
|
139 |
+
// click handler for delete button
|
140 |
+
$this.$elem.on( 'click.' + name, $this.config.cloneThis + '>' + $this.config.deleteButton, function( event ) {
|
141 |
+
event.preventDefault();
|
142 |
+
event.stopPropagation();
|
143 |
+
|
144 |
+
var toDelete = $( this ).closest( $this.config.cloneThis );
|
145 |
+
// just a wrapper for delclone event
|
146 |
+
$this.$elem.triggerAll( 'clone_delete delete.' + name, [ toDelete ] );
|
147 |
+
} );
|
148 |
+
|
149 |
+
// the delete clone event
|
150 |
+
$this.$elem.on( 'delete.' + name, function( event, toDelete ) {
|
151 |
+
|
152 |
+
// get the count of all the sibling clones
|
153 |
+
/**
|
154 |
+
*
|
155 |
+
* @type @exp;$todelete@call;closest@call;closestChild@pro;length
|
156 |
+
*/
|
157 |
+
var cloneCount = toDelete.closest( '.' + $this.elemClass ).closestChild( $this.config.cloneThis ).length;
|
158 |
+
|
159 |
+
if ( cloneCount > $this.config.minimum ) {
|
160 |
+
// trigger hook
|
161 |
+
$this.$elem.triggerAll( 'clone_before_delete before_delete.' + name, [ toDelete, cloneCount ] );
|
162 |
+
$this.$elem.triggerHandler( 'remove.' + name, [ toDelete ] );
|
163 |
+
$this.$elem.triggerAll( 'clone_after_delete after_delete.' + name );
|
164 |
+
|
165 |
+
}
|
166 |
+
else {
|
167 |
+
|
168 |
+
$this.$elem.triggerHandler( 'minimum.' + name, $this.config.minimum, [ toDelete ] );
|
169 |
+
|
170 |
+
// First clone form can't be deleted, but the values should be removed from first form
|
171 |
+
// is this expected behaviour? especially since we use minimum?
|
172 |
+
toDelete.find( 'input, textarea, select' ).each( function() {
|
173 |
+
$this._clearForm( $( this ) );
|
174 |
+
} );
|
175 |
+
|
176 |
+
}
|
177 |
+
} );
|
178 |
+
|
179 |
+
$this.$elem.on( 'remove.' + name, function( event, toDelete ) {
|
180 |
+
$( toDelete ).remove();
|
181 |
+
|
182 |
+
} );
|
183 |
+
|
184 |
+
},
|
185 |
+
_clean: function() {
|
186 |
+
var $this = this;
|
187 |
+
$this.$elem.removeClass( name + '-wrap' );
|
188 |
+
$this.clones.removeClass( name );
|
189 |
+
$this.$elem.off( 'click.' + name, $this.config.cloneThis + '>' + $this.config.cloneButton );
|
190 |
+
$this.$elem.off( 'click.' + name, $this.config.cloneThis + '>' + $this.config.deleteButton );
|
191 |
+
$this.$elem.off( 'clone_clone clone_delete clone_before_delete clone.' + name + ' delete.' + name + ' before_delete.' + name );
|
192 |
+
|
193 |
+
},
|
194 |
+
destroy: function() {
|
195 |
+
this._clean();
|
196 |
+
this.$elem.removeData( name );
|
197 |
+
},
|
198 |
+
getOption: function() {
|
199 |
+
return this.config;
|
200 |
+
},
|
201 |
+
setOption: function( lateOptions ) {
|
202 |
+
$.extend( this.config, lateOptions || {} );
|
203 |
+
this._clean();
|
204 |
+
this.init();
|
205 |
+
|
206 |
+
},
|
207 |
+
_cloneAndAppend: function( toClone ) {
|
208 |
+
|
209 |
+
|
210 |
+
// get the count of all the sibling clones
|
211 |
+
/**
|
212 |
+
*
|
213 |
+
* @type @exp;$toclone@call;closest@call;closestChild@pro;length
|
214 |
+
*/
|
215 |
+
var cloneCount = toClone.closest( '.' + this.elemClass ).closestChild( this.config.cloneThis ).length;
|
216 |
+
|
217 |
+
// check if we've reached the maximum limit
|
218 |
+
if ( cloneCount < this.config.maximum ) {
|
219 |
+
|
220 |
+
// trigger a custom event for hooking in
|
221 |
+
this.$elem.triggerAll( 'clone_before_clone before_clone.' + name, [ toClone ] );
|
222 |
+
|
223 |
+
var newClone = this._cloneItem( toClone );
|
224 |
+
|
225 |
+
// trigger custom event on the original element
|
226 |
+
this.$elem.triggerAll( 'clone_after_clone after_clone.' + name, [ toClone, newClone ] );
|
227 |
+
|
228 |
+
// add to our clones object
|
229 |
+
this.clones.add( newClone );
|
230 |
+
|
231 |
+
// trigger custom event on the new clone
|
232 |
+
this.$elem.triggerAll( 'clone_before_append before_append.' + name, [ toClone, newClone ] );
|
233 |
+
|
234 |
+
// get the position where the clone has to be added
|
235 |
+
// and add the newclone
|
236 |
+
if ( this.config.clonePosition !== 'after' ) {
|
237 |
+
toClone.before( newClone );
|
238 |
+
} else {
|
239 |
+
toClone.after( newClone );
|
240 |
+
|
241 |
+
}
|
242 |
+
|
243 |
+
if ( this.config.ignore ) {
|
244 |
+
newClone.find( this.config.ignore ).remove();
|
245 |
+
}
|
246 |
+
|
247 |
+
// reformat the id attributes
|
248 |
+
this._redoIDs();
|
249 |
+
|
250 |
+
// trigger custom event for hooking
|
251 |
+
this.$elem.triggerAll( 'clone_after_append after_append.' + name, [ toClone, newClone ] );
|
252 |
+
} else {
|
253 |
+
// trigger a custom event for hooking
|
254 |
+
this.$elem.triggerAll( 'clone_limit maximum.' + name, this.config.maximum, [ toClone ] );
|
255 |
+
}
|
256 |
+
|
257 |
+
},
|
258 |
+
_cloneItem: function( toClone ) {
|
259 |
+
var $this = this;
|
260 |
+
|
261 |
+
// clone it
|
262 |
+
/**
|
263 |
+
*
|
264 |
+
* @type @exp;$toclone@call;clone
|
265 |
+
*/
|
266 |
+
var newClone = toClone.clone( $this.config.dataClone, $this.config.deepClone );
|
267 |
+
|
268 |
+
// we want to preserve the initial child count
|
269 |
+
if ( $this.config.preserveChildCount !== false ) {
|
270 |
+
// the child count only needs preservation if they are clonable.
|
271 |
+
|
272 |
+
var originalChildren = toClone.find( '.' + name + '-wrap' );
|
273 |
+
|
274 |
+
// for each wrapper
|
275 |
+
newClone.find( '.' + name + '-wrap' ).each( function( index ) {
|
276 |
+
|
277 |
+
/**
|
278 |
+
*
|
279 |
+
* @type @call;jquery-cloneya_L8.$@call;closestChild
|
280 |
+
*/
|
281 |
+
var inNewClone = $( this ).closestChild( '.' + name );
|
282 |
+
|
283 |
+
var inOriginal = $( originalChildren[ index ] ).closestChild( '.' + name );
|
284 |
+
|
285 |
+
/**
|
286 |
+
*
|
287 |
+
* @type @exp;inOriginal@call;data
|
288 |
+
*/
|
289 |
+
var originalCount = inOriginal.data( 'initialCount' );
|
290 |
+
|
291 |
+
/**
|
292 |
+
*
|
293 |
+
* @type @exp;inNewClone@call;slice
|
294 |
+
*/
|
295 |
+
var $extra = inNewClone.slice( originalCount, inNewClone.length );
|
296 |
+
|
297 |
+
$extra.remove();
|
298 |
+
|
299 |
+
inNewClone.data( 'initial-count', originalCount );
|
300 |
+
} );
|
301 |
+
|
302 |
+
}
|
303 |
+
|
304 |
+
// get the form input
|
305 |
+
newClone.find( 'input, textarea, select' ).each( function() {
|
306 |
+
|
307 |
+
// check if the values need to be copied, if not empty them
|
308 |
+
$this._clearForm( $( this ) );
|
309 |
+
|
310 |
+
// removed the portion taking care of the index
|
311 |
+
// each case is specific and I'd rather leave it to the developer
|
312 |
+
|
313 |
+
// custom event hook for index handling
|
314 |
+
$this.$elem.triggerAll( 'clone_form_input form_input.' + name, [ $( this ), toClone, newClone ] );
|
315 |
+
} );
|
316 |
+
|
317 |
+
return newClone;
|
318 |
+
|
319 |
+
},
|
320 |
+
/*
|
321 |
+
* Clear Form will used to clear the values of the form
|
322 |
+
*/
|
323 |
+
/**
|
324 |
+
*
|
325 |
+
* @param {type} $el
|
326 |
+
* @returns {undefined}
|
327 |
+
*/
|
328 |
+
_clearForm: function( $el ) {
|
329 |
+
|
330 |
+
if ( !this.config.valueClone && !$el.hasClass( 'noEmpty' ) ) {
|
331 |
+
|
332 |
+
if ( $el.is( ':checkbox' ) || $el.is( ':radio' ) ) {
|
333 |
+
|
334 |
+
$el.prop( 'checked', false );
|
335 |
+
}
|
336 |
+
else {
|
337 |
+
$el.val( '' );
|
338 |
+
}
|
339 |
+
|
340 |
+
}
|
341 |
+
|
342 |
+
},
|
343 |
+
/**
|
344 |
+
* Redo the id attribute, serially
|
345 |
+
*/
|
346 |
+
/**
|
347 |
+
*
|
348 |
+
* @returns {undefined}
|
349 |
+
*/
|
350 |
+
_redoIDs: function() {
|
351 |
+
|
352 |
+
var $this = this;
|
353 |
+
|
354 |
+
// check if this even needs to be done
|
355 |
+
if ( $this.config.serializeID !== true ) {
|
356 |
+
return;
|
357 |
+
}
|
358 |
+
|
359 |
+
// get the id of the first clone (hoping to increment the ids)
|
360 |
+
/**
|
361 |
+
*
|
362 |
+
* @type @exp;elem@call;find@call;first@call;attr
|
363 |
+
*/
|
364 |
+
var mainid = $this.$elem.find( $this.config.cloneThis ).first().attr( 'id' );
|
365 |
+
|
366 |
+
$this.$elem.find( $this.config.cloneThis ).each( function( i ) {
|
367 |
+
|
368 |
+
var j;
|
369 |
+
// assign the index to a string var for appending to the ids
|
370 |
+
// 0 index will have no number at the end
|
371 |
+
if ( i !== 0 ) {
|
372 |
+
j = i;
|
373 |
+
} else {
|
374 |
+
j = '';
|
375 |
+
}
|
376 |
+
|
377 |
+
// first modify the clone id
|
378 |
+
if ( $( this ).attr( 'id' ) ) {
|
379 |
+
$( this ).attr( 'id', mainid + j );
|
380 |
+
}
|
381 |
+
|
382 |
+
var id, nId;
|
383 |
+
// take all the elements inside the clone
|
384 |
+
$( this ).find( '*' ).each( function() {
|
385 |
+
|
386 |
+
id = $( this ).attr( 'id' );
|
387 |
+
if ( id ) {
|
388 |
+
// match the id with the regex to get the string part
|
389 |
+
// separate from the number part
|
390 |
+
var match = id.match( $this.regex );
|
391 |
+
|
392 |
+
// if there was a number
|
393 |
+
if ( match && match.length === 3 ) {
|
394 |
+
// just take the string part
|
395 |
+
// add the new number to it
|
396 |
+
nId = id.replace( /\d+$/, "" ) + j;
|
397 |
+
|
398 |
+
$( this ).attr( 'id', nId );
|
399 |
+
} else {
|
400 |
+
// else there was no number,
|
401 |
+
// this was earlier the first element
|
402 |
+
// just add the number to its id
|
403 |
+
nId = id + j;
|
404 |
+
$( this ).attr( 'id', nId );
|
405 |
+
}
|
406 |
+
}
|
407 |
+
|
408 |
+
//update label
|
409 |
+
$( this ).closest( $this.config.cloneThis ).find( "label[for='" + id + "']" ).attr( 'for', nId );
|
410 |
+
|
411 |
+
if ( $this.config.serializeIndex ) {
|
412 |
+
var name = $( this ).attr( 'name' );
|
413 |
+
// This will increment the numeric array index for cloned field names
|
414 |
+
if ( name ) {
|
415 |
+
var matches = name.match( /\[([0-9}]+)\]/ );
|
416 |
+
|
417 |
+
if ( matches && matches.length >= 1 ) {
|
418 |
+
|
419 |
+
var st = name;
|
420 |
+
var name = st.replace( matches[ 0 ], "[" + i + "]" );
|
421 |
+
|
422 |
+
$( this ).attr( 'name', name );
|
423 |
+
}
|
424 |
+
}
|
425 |
+
}
|
426 |
+
|
427 |
+
} );
|
428 |
+
} );
|
429 |
+
|
430 |
+
}
|
431 |
+
|
432 |
+
};
|
433 |
+
|
434 |
+
// add the cloneya to the global object
|
435 |
+
/**
|
436 |
+
*
|
437 |
+
* @param {type} options
|
438 |
+
* @returns {jquery-cloneya_L8.$.fn@call;each}
|
439 |
+
*/
|
440 |
+
$.fn[ name ] = function( options ) {
|
441 |
+
var args = arguments;
|
442 |
+
|
443 |
+
if ( options === undefined || typeof options === 'object' ) {
|
444 |
+
// Creates a new plugin instance, for each selected element, and
|
445 |
+
// stores a reference withint the element's data
|
446 |
+
return this.each( function() {
|
447 |
+
if ( !$.data( this, name ) ) {
|
448 |
+
$.data( this, name, new CloneYa( this, options ) );
|
449 |
+
}
|
450 |
+
} );
|
451 |
+
} else if ( typeof options === 'string' && options[ 0 ] !== '_' && options !== 'init' ) {
|
452 |
+
// Call a public pluguin method (not starting with an underscore) for each
|
453 |
+
// selected element.
|
454 |
+
if ( Array.prototype.slice.call( args, 1 ).length === 0 && $.inArray( options, $.fn[ name ].getters ) !== -1 ) {
|
455 |
+
// If the user does not pass any arguments and the method allows to
|
456 |
+
// work as a getter then break the chainability so we can return a value
|
457 |
+
// instead the element reference.
|
458 |
+
var instance = $.data( this[ 0 ], name );
|
459 |
+
return instance[ options ].apply( instance, Array.prototype.slice.call( args, 1 ) );
|
460 |
+
} else {
|
461 |
+
// Invoke the speficied method on each selected element
|
462 |
+
return this.each( function() {
|
463 |
+
var instance = $.data( this, name );
|
464 |
+
if ( instance instanceof CloneYa && typeof instance[ options ] === 'function' ) {
|
465 |
+
instance[ options ].apply( instance, Array.prototype.slice.call( args, 1 ) );
|
466 |
+
}
|
467 |
+
} );
|
468 |
+
}
|
469 |
+
}
|
470 |
+
};
|
471 |
+
|
472 |
+
$.fn[ name ].getters = [ 'getOption' ];
|
473 |
+
|
474 |
+
/*
|
475 |
+
* jquery.closestchild 0.1.1
|
476 |
+
*
|
477 |
+
* Author: Andrey Mikhaylov aka lolmaus
|
478 |
+
* Email: lolmaus@gmail.com
|
479 |
+
*
|
480 |
+
*/
|
481 |
+
/**
|
482 |
+
*
|
483 |
+
* @param {type} selector
|
484 |
+
* @returns {$}
|
485 |
+
*/
|
486 |
+
$.fn.closestChild = function( selector ) {
|
487 |
+
var $children, $results;
|
488 |
+
|
489 |
+
$children = this.children();
|
490 |
+
|
491 |
+
if ( $children.length === 0 ) {
|
492 |
+
return $();
|
493 |
+
}
|
494 |
+
|
495 |
+
$results = $children.filter( selector );
|
496 |
+
|
497 |
+
if ( $results.length > 0 ) {
|
498 |
+
return $results;
|
499 |
+
} else {
|
500 |
+
return $children.closestChild( selector );
|
501 |
+
}
|
502 |
+
};
|
503 |
+
|
504 |
+
/*
|
505 |
+
* TriggerAll, modified from stackoverflow
|
506 |
+
* http://stackoverflow.com/questions/11850625/jquery-trigger-multiple-events
|
507 |
+
*/
|
508 |
+
$.fn.extend( {
|
509 |
+
triggerAll: function( events, params ) {
|
510 |
+
var el = this, i, evts = events.split( ' ' );
|
511 |
+
for ( i = 0; i < evts.length; i += 1 ) {
|
512 |
+
el.triggerHandler( evts[ i ], params );
|
513 |
+
}
|
514 |
+
return el;
|
515 |
+
}
|
516 |
+
} );
|
517 |
+
|
518 |
})( jQuery );
|
assets/js/vendor/jquery-cloneya.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(a){"use strict";function b(b,e){this.regex=/^(.*)(\d)+$/i,this.elem=b,this.$elem=a(b),this.elemClass=c+"-wrap","undefined"!=typeof e&&"undefined"!=typeof e.limit&&e.limit>0&&(e.maximum=e.limit),this.config=a.extend({},d,e),this.clones=this.$elem.closestChild(this.config.cloneThis),this.init()}var c="cloneya",d={cloneThis:".toclone",cloneButton:".clone",deleteButton:".delete",clonePosition:"after",minimum:1,maximum:999,valueClone:!1,dataClone:!1,deepClone:!1,serializeID:!0,ignore:"label.error",preserveChildCount:!1};b.prototype={init:function(){var b=this;b.$elem.addClass(b.elemClass),b.clones.addClass(c),b.clones.data("initialCount",b.clones.length),b.$elem.on("click."+c,b.config.cloneThis+">"+b.config.cloneButton,function(d){d.preventDefault(),d.stopPropagation();var e=a(this).closest(b.config.cloneThis);b.$elem.triggerAll("clone_clone clone."+c,[e])}),b.$elem.on("clone."+c,function(a,c){b._cloneAndAppend(c)}),b.$elem.on("click."+c,b.config.cloneThis+">"+b.config.deleteButton,function(d){d.preventDefault(),d.stopPropagation();var e=a(this).closest(b.config.cloneThis);b.$elem.triggerAll("clone_delete delete."+c,[e])}),b.$elem.on("delete."+c,function(d,e){var f=e.closest("."+b.elemClass).closestChild(b.config.cloneThis).length;f>b.config.minimum?(b.$elem.triggerAll("clone_before_delete before_delete."+c,[e,f]),b.$elem.triggerHandler("remove."+c,[e]),b.$elem.triggerAll("clone_after_delete after_delete."+c)):(b.$elem.triggerHandler("minimum."+c,b.config.minimum,[e]),e.find("input, textarea, select").each(function(){b._clearForm(a(this))}))}),b.$elem.on("remove."+c,function(b,c){a(c).remove()})},_clean:function(){var a=this;a.$elem.removeClass(c+"-wrap"),a.clones.removeClass(c),a.$elem.off("click."+c,a.config.cloneThis+">"+a.config.cloneButton),a.$elem.off("click."+c,a.config.cloneThis+">"+a.config.deleteButton),a.$elem.off("clone_clone clone_delete clone_before_delete clone."+c+" delete."+c+" before_delete."+c)},destroy:function(){this._clean(),this.$elem.removeData(c)},getOption:function(){return this.config},setOption:function(b){a.extend(this.config,b||{}),this._clean(),this.init()},_cloneAndAppend:function(a){var b=a.closest("."+this.elemClass).closestChild(this.config.cloneThis).length;if(b<this.config.maximum){this.$elem.triggerAll("clone_before_clone before_clone."+c,[a]);var d=this._cloneItem(a);this.$elem.triggerAll("clone_after_clone after_clone."+c,[a,d]),this.clones.add(d),this.$elem.triggerAll("clone_before_append before_append."+c,[a,d]),"after"!==this.config.clonePosition?a.before(d):a.after(d),this.config.ignore&&d.find(this.config.ignore).remove(),this._redoIDs(),this.$elem.triggerAll("clone_after_append after_append."+c,[a,d])}else this.$elem.triggerAll("clone_limit maximum."+c,this.config.maximum,[a])},_cloneItem:function(b){var d=this,e=b.clone(d.config.dataClone,d.config.deepClone);if(d.config.preserveChildCount!==!1){var f=b.find("."+c+"-wrap");e.find("."+c+"-wrap").each(function(b){var d=a(this).closestChild("."+c),e=a(f[b]).closestChild("."+c),g=e.data("initialCount"),h=d.slice(g,d.length);h.remove(),d.data("initial-count",g)})}return e.find("input, textarea, select").each(function(){d._clearForm(a(this)),d.$elem.triggerAll("clone_form_input form_input."+c,[a(this),b,e])}),e},_clearForm:function(a){this.config.valueClone||a.hasClass("noEmpty")||(a.is(":checkbox")||a.is(":radio")?a.prop("checked",!1):a.val(""))},_redoIDs:function(){var b=this;if(b.config.serializeID===!0){var c=b.$elem.find(b.config.cloneThis).first().attr("id");b.$elem.find(b.config.cloneThis).each(function(d){var e;e=0!==d?d:"",a(this).attr("id")&&a(this).attr("id",c+e);var f,g;a(this).find("*").each(function(){if(f=a(this).attr("id")){var c=f.match(b.regex);c&&3===c.length?(g=f.replace(/\d+$/,"")+e,a(this).attr("id",g)):(g=f+e,a(this).attr("id",g))}if(a(this).closest(b.config.cloneThis).find("label[for='"+f+"']").attr("for",g),b.config.serializeIndex){var h=a(this).attr("name");if(h){var i=h.match(/\[([^}]+)\]/);if(i&&i.length>=1){var j=h;h=[].map.call(j,function(a,b){return isNaN(+a)||"["!==j[b-1]||"]"!==j[b+1]?a:d}).join(""),a(this).attr("name",h)}}}})})}}},a.fn[c]=function(d){var e=arguments;if(void 0===d||"object"==typeof d)return this.each(function(){a.data(this,c)||a.data(this,c,new b(this,d))});if("string"==typeof d&&"_"!==d[0]&&"init"!==d){if(0===Array.prototype.slice.call(e,1).length&&-1!==a.inArray(d,a.fn[c].getters)){var f=a.data(this[0],c);return f[d].apply(f,Array.prototype.slice.call(e,1))}return this.each(function(){var f=a.data(this,c);f instanceof b&&"function"==typeof f[d]&&f[d].apply(f,Array.prototype.slice.call(e,1))})}},a.fn[c].getters=["getOption"],a.fn.closestChild=function(b){var c,d;return c=this.children(),0===c.length?a():(d=c.filter(b),d.length>0?d:c.closestChild(b))},a.fn.extend({triggerAll:function(a,b){var c,d=this,e=a.split(" ");for(c=0;c<e.length;c+=1)d.triggerHandler(e[c],b);return d}})}(jQuery);
|
1 |
+
!function(a){"use strict";function b(b,e){this.regex=/^(.*)(\d)+$/i,this.elem=b,this.$elem=a(b),this.elemClass=c+"-wrap","undefined"!=typeof e&&"undefined"!=typeof e.limit&&e.limit>0&&(e.maximum=e.limit),this.config=a.extend({},d,e),this.clones=this.$elem.closestChild(this.config.cloneThis),this.init()}var c="cloneya",d={cloneThis:".toclone",cloneButton:".clone",deleteButton:".delete",clonePosition:"after",minimum:1,maximum:999,valueClone:!1,dataClone:!1,deepClone:!1,serializeID:!0,ignore:"label.error",preserveChildCount:!1};b.prototype={init:function(){var b=this;b.$elem.addClass(b.elemClass),b.clones.addClass(c),b.clones.data("initialCount",b.clones.length),b.$elem.on("click."+c,b.config.cloneThis+">"+b.config.cloneButton,function(d){d.preventDefault(),d.stopPropagation();var e=a(this).closest(b.config.cloneThis);b.$elem.triggerAll("clone_clone clone."+c,[e])}),b.$elem.on("clone."+c,function(a,c){b._cloneAndAppend(c)}),b.$elem.on("click."+c,b.config.cloneThis+">"+b.config.deleteButton,function(d){d.preventDefault(),d.stopPropagation();var e=a(this).closest(b.config.cloneThis);b.$elem.triggerAll("clone_delete delete."+c,[e])}),b.$elem.on("delete."+c,function(d,e){var f=e.closest("."+b.elemClass).closestChild(b.config.cloneThis).length;f>b.config.minimum?(b.$elem.triggerAll("clone_before_delete before_delete."+c,[e,f]),b.$elem.triggerHandler("remove."+c,[e]),b.$elem.triggerAll("clone_after_delete after_delete."+c)):(b.$elem.triggerHandler("minimum."+c,b.config.minimum,[e]),e.find("input, textarea, select").each(function(){b._clearForm(a(this))}))}),b.$elem.on("remove."+c,function(b,c){a(c).remove()})},_clean:function(){var a=this;a.$elem.removeClass(c+"-wrap"),a.clones.removeClass(c),a.$elem.off("click."+c,a.config.cloneThis+">"+a.config.cloneButton),a.$elem.off("click."+c,a.config.cloneThis+">"+a.config.deleteButton),a.$elem.off("clone_clone clone_delete clone_before_delete clone."+c+" delete."+c+" before_delete."+c)},destroy:function(){this._clean(),this.$elem.removeData(c)},getOption:function(){return this.config},setOption:function(b){a.extend(this.config,b||{}),this._clean(),this.init()},_cloneAndAppend:function(a){var b=a.closest("."+this.elemClass).closestChild(this.config.cloneThis).length;if(b<this.config.maximum){this.$elem.triggerAll("clone_before_clone before_clone."+c,[a]);var d=this._cloneItem(a);this.$elem.triggerAll("clone_after_clone after_clone."+c,[a,d]),this.clones.add(d),this.$elem.triggerAll("clone_before_append before_append."+c,[a,d]),"after"!==this.config.clonePosition?a.before(d):a.after(d),this.config.ignore&&d.find(this.config.ignore).remove(),this._redoIDs(),this.$elem.triggerAll("clone_after_append after_append."+c,[a,d])}else this.$elem.triggerAll("clone_limit maximum."+c,this.config.maximum,[a])},_cloneItem:function(b){var d=this,e=b.clone(d.config.dataClone,d.config.deepClone);if(d.config.preserveChildCount!==!1){var f=b.find("."+c+"-wrap");e.find("."+c+"-wrap").each(function(b){var d=a(this).closestChild("."+c),e=a(f[b]).closestChild("."+c),g=e.data("initialCount"),h=d.slice(g,d.length);h.remove(),d.data("initial-count",g)})}return e.find("input, textarea, select").each(function(){d._clearForm(a(this)),d.$elem.triggerAll("clone_form_input form_input."+c,[a(this),b,e])}),e},_clearForm:function(a){this.config.valueClone||a.hasClass("noEmpty")||(a.is(":checkbox")||a.is(":radio")?a.prop("checked",!1):a.val(""))},_redoIDs:function(){var b=this;if(b.config.serializeID===!0){var c=b.$elem.find(b.config.cloneThis).first().attr("id");b.$elem.find(b.config.cloneThis).each(function(d){var e;e=0!==d?d:"",a(this).attr("id")&&a(this).attr("id",c+e);var f,g;a(this).find("*").each(function(){if(f=a(this).attr("id")){var c=f.match(b.regex);c&&3===c.length?(g=f.replace(/\d+$/,"")+e,a(this).attr("id",g)):(g=f+e,a(this).attr("id",g))}if(a(this).closest(b.config.cloneThis).find("label[for='"+f+"']").attr("for",g),b.config.serializeIndex){var h=a(this).attr("name");if(h){var i=h.match(/\[([^}]+)\]/);if(i&&i.length>=1){var j=h;h=[].map.call(j,function(a,b){return isNaN(+a)||"["!==j[b-1]||"]"!==j[b+1]?a:d}).join(""),a(this).attr("name",h)}}}})})}}},a.fn[c]=function(d){var e=arguments;if(void 0===d||"object"==typeof d)return this.each(function(){a.data(this,c)||a.data(this,c,new b(this,d))});if("string"==typeof d&&"_"!==d[0]&&"init"!==d){if(0===Array.prototype.slice.call(e,1).length&&-1!==a.inArray(d,a.fn[c].getters)){var f=a.data(this[0],c);return f[d].apply(f,Array.prototype.slice.call(e,1))}return this.each(function(){var f=a.data(this,c);f instanceof b&&"function"==typeof f[d]&&f[d].apply(f,Array.prototype.slice.call(e,1))})}},a.fn[c].getters=["getOption"],a.fn.closestChild=function(b){var c,d;return c=this.children(),0===c.length?a():(d=c.filter(b),d.length>0?d:c.closestChild(b))},a.fn.extend({triggerAll:function(a,b){var c,d=this,e=a.split(" ");for(c=0;c<e.length;c+=1)d.triggerHandler(e[c],b);return d}})}(jQuery);
|
assets/js/vendor/jquery.vide.js
CHANGED
@@ -1,501 +1,501 @@
|
|
1 |
-
/*
|
2 |
-
* Vide - v0.5.1
|
3 |
-
* Easy as hell jQuery plugin for video backgrounds.
|
4 |
-
* http://vodkabears.github.io/vide/
|
5 |
-
*
|
6 |
-
* Made by Ilya Makarov
|
7 |
-
* Under MIT License
|
8 |
-
*/
|
9 |
-
!(function(root, factory) {
|
10 |
-
if (typeof define === 'function' && define.amd) {
|
11 |
-
define(['jquery'], factory);
|
12 |
-
} else if (typeof exports === 'object') {
|
13 |
-
factory(require('jquery'));
|
14 |
-
} else {
|
15 |
-
factory(root.jQuery);
|
16 |
-
}
|
17 |
-
})(this, function($) {
|
18 |
-
|
19 |
-
'use strict';
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Name of the plugin
|
23 |
-
* @private
|
24 |
-
* @const
|
25 |
-
* @type {String}
|
26 |
-
*/
|
27 |
-
var PLUGIN_NAME = 'vide';
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Default settings
|
31 |
-
* @private
|
32 |
-
* @const
|
33 |
-
* @type {Object}
|
34 |
-
*/
|
35 |
-
var DEFAULTS = {
|
36 |
-
volume: 1,
|
37 |
-
playbackRate: 1,
|
38 |
-
muted: true,
|
39 |
-
loop: true,
|
40 |
-
autoplay: true,
|
41 |
-
position: '50% 50%',
|
42 |
-
posterType: 'detect',
|
43 |
-
resizing: true,
|
44 |
-
bgColor: 'transparent',
|
45 |
-
className: ''
|
46 |
-
};
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Not implemented error message
|
50 |
-
* @private
|
51 |
-
* @const
|
52 |
-
* @type {String}
|
53 |
-
*/
|
54 |
-
var NOT_IMPLEMENTED_MSG = 'Not implemented';
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Parse a string with options
|
58 |
-
* @private
|
59 |
-
* @param {String} str
|
60 |
-
* @returns {Object|String}
|
61 |
-
*/
|
62 |
-
function parseOptions(str) {
|
63 |
-
var obj = {};
|
64 |
-
var delimiterIndex;
|
65 |
-
var option;
|
66 |
-
var prop;
|
67 |
-
var val;
|
68 |
-
var arr;
|
69 |
-
var len;
|
70 |
-
var i;
|
71 |
-
|
72 |
-
// Remove spaces around delimiters and split
|
73 |
-
arr = str.replace(/\s*:\s*/g, ':').replace(/\s*,\s*/g, ',').split(',');
|
74 |
-
|
75 |
-
// Parse a string
|
76 |
-
for (i = 0, len = arr.length; i < len; i++) {
|
77 |
-
option = arr[i];
|
78 |
-
|
79 |
-
// Ignore urls and a string without colon delimiters
|
80 |
-
if (
|
81 |
-
option.search(/^(http|https|ftp):\/\//) !== -1 ||
|
82 |
-
option.search(':') === -1
|
83 |
-
) {
|
84 |
-
break;
|
85 |
-
}
|
86 |
-
|
87 |
-
delimiterIndex = option.indexOf(':');
|
88 |
-
prop = option.substring(0, delimiterIndex);
|
89 |
-
val = option.substring(delimiterIndex + 1);
|
90 |
-
|
91 |
-
// If val is an empty string, make it undefined
|
92 |
-
if (!val) {
|
93 |
-
val = undefined;
|
94 |
-
}
|
95 |
-
|
96 |
-
// Convert a string value if it is like a boolean
|
97 |
-
if (typeof val === 'string') {
|
98 |
-
val = val === 'true' || (val === 'false' ? false : val);
|
99 |
-
}
|
100 |
-
|
101 |
-
// Convert a string value if it is like a number
|
102 |
-
if (typeof val === 'string') {
|
103 |
-
val = !isNaN(val) ? +val : val;
|
104 |
-
}
|
105 |
-
|
106 |
-
obj[prop] = val;
|
107 |
-
}
|
108 |
-
|
109 |
-
// If nothing is parsed
|
110 |
-
if (prop == null && val == null) {
|
111 |
-
return str;
|
112 |
-
}
|
113 |
-
|
114 |
-
return obj;
|
115 |
-
}
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Parse a position option
|
119 |
-
* @private
|
120 |
-
* @param {String} str
|
121 |
-
* @returns {Object}
|
122 |
-
*/
|
123 |
-
function parsePosition(str) {
|
124 |
-
str = '' + str;
|
125 |
-
|
126 |
-
// Default value is a center
|
127 |
-
var args = str.split(/\s+/);
|
128 |
-
var x = '50%';
|
129 |
-
var y = '50%';
|
130 |
-
var len;
|
131 |
-
var arg;
|
132 |
-
var i;
|
133 |
-
|
134 |
-
for (i = 0, len = args.length; i < len; i++) {
|
135 |
-
arg = args[i];
|
136 |
-
|
137 |
-
// Convert values
|
138 |
-
if (arg === 'left') {
|
139 |
-
x = '0%';
|
140 |
-
} else if (arg === 'right') {
|
141 |
-
x = '100%';
|
142 |
-
} else if (arg === 'top') {
|
143 |
-
y = '0%';
|
144 |
-
} else if (arg === 'bottom') {
|
145 |
-
y = '100%';
|
146 |
-
} else if (arg === 'center') {
|
147 |
-
if (i === 0) {
|
148 |
-
x = '50%';
|
149 |
-
} else {
|
150 |
-
y = '50%';
|
151 |
-
}
|
152 |
-
} else {
|
153 |
-
if (i === 0) {
|
154 |
-
x = arg;
|
155 |
-
} else {
|
156 |
-
y = arg;
|
157 |
-
}
|
158 |
-
}
|
159 |
-
}
|
160 |
-
|
161 |
-
return { x: x, y: y };
|
162 |
-
}
|
163 |
-
|
164 |
-
/**
|
165 |
-
* Search a poster
|
166 |
-
* @private
|
167 |
-
* @param {String} path
|
168 |
-
* @param {Function} callback
|
169 |
-
*/
|
170 |
-
function findPoster(path, callback) {
|
171 |
-
var onLoad = function() {
|
172 |
-
callback(this.src);
|
173 |
-
};
|
174 |
-
|
175 |
-
$('<img src="' + path + '.gif">').on('load', onLoad);
|
176 |
-
$('<img src="' + path + '.jpg">').on('load', onLoad);
|
177 |
-
$('<img src="' + path + '.jpeg">').on('load', onLoad);
|
178 |
-
$('<img src="' + path + '.png">').on('load', onLoad);
|
179 |
-
}
|
180 |
-
|
181 |
-
/**
|
182 |
-
* Vide constructor
|
183 |
-
* @param {HTMLElement} element
|
184 |
-
* @param {Object|String} path
|
185 |
-
* @param {Object|String} options
|
186 |
-
* @constructor
|
187 |
-
*/
|
188 |
-
function Vide(element, path, options) {
|
189 |
-
this.$element = $(element);
|
190 |
-
|
191 |
-
// Parse path
|
192 |
-
if (typeof path === 'string') {
|
193 |
-
path = parseOptions(path);
|
194 |
-
}
|
195 |
-
|
196 |
-
// Parse options
|
197 |
-
if (!options) {
|
198 |
-
options = {};
|
199 |
-
} else if (typeof options === 'string') {
|
200 |
-
options = parseOptions(options);
|
201 |
-
}
|
202 |
-
|
203 |
-
// Remove an extension
|
204 |
-
if (typeof path === 'string') {
|
205 |
-
path = path.replace(/\.\w*$/, '');
|
206 |
-
} else if (typeof path === 'object') {
|
207 |
-
for (var i in path) {
|
208 |
-
if (path.hasOwnProperty(i)) {
|
209 |
-
path[i] = path[i].replace(/\.\w*$/, '');
|
210 |
-
}
|
211 |
-
}
|
212 |
-
}
|
213 |
-
|
214 |
-
this.settings = $.extend({}, DEFAULTS, options);
|
215 |
-
this.path = path;
|
216 |
-
|
217 |
-
// https://github.com/VodkaBears/Vide/issues/110
|
218 |
-
try {
|
219 |
-
this.init();
|
220 |
-
} catch (e) {
|
221 |
-
if (e.message !== NOT_IMPLEMENTED_MSG) {
|
222 |
-
throw e;
|
223 |
-
}
|
224 |
-
}
|
225 |
-
}
|
226 |
-
|
227 |
-
/**
|
228 |
-
* Initialization
|
229 |
-
* @public
|
230 |
-
*/
|
231 |
-
Vide.prototype.init = function() {
|
232 |
-
var vide = this;
|
233 |
-
var path = vide.path;
|
234 |
-
var poster = path;
|
235 |
-
var sources = '';
|
236 |
-
var $element = vide.$element;
|
237 |
-
var settings = vide.settings;
|
238 |
-
var position = parsePosition(settings.position);
|
239 |
-
var posterType = settings.posterType;
|
240 |
-
var $video;
|
241 |
-
var $wrapper;
|
242 |
-
|
243 |
-
// Set styles of a video wrapper
|
244 |
-
$wrapper = vide.$wrapper = $('<div>')
|
245 |
-
.addClass(settings.className)
|
246 |
-
.css({
|
247 |
-
position: 'absolute',
|
248 |
-
'z-index': -1,
|
249 |
-
top: 0,
|
250 |
-
left: 0,
|
251 |
-
bottom: 0,
|
252 |
-
right: 0,
|
253 |
-
overflow: 'hidden',
|
254 |
-
'-webkit-background-size': 'cover',
|
255 |
-
'-moz-background-size': 'cover',
|
256 |
-
'-o-background-size': 'cover',
|
257 |
-
'background-size': 'cover',
|
258 |
-
'background-color': settings.bgColor,
|
259 |
-
'background-repeat': 'no-repeat',
|
260 |
-
'background-position': position.x + ' ' + position.y
|
261 |
-
});
|
262 |
-
|
263 |
-
// Get a poster path
|
264 |
-
if (typeof path === 'object') {
|
265 |
-
if (path.poster) {
|
266 |
-
poster = path.poster;
|
267 |
-
} else {
|
268 |
-
if (path.mp4) {
|
269 |
-
poster = path.mp4;
|
270 |
-
} else if (path.webm) {
|
271 |
-
poster = path.webm;
|
272 |
-
} else if (path.ogv) {
|
273 |
-
poster = path.ogv;
|
274 |
-
}
|
275 |
-
}
|
276 |
-
}
|
277 |
-
|
278 |
-
// Set a video poster
|
279 |
-
if (posterType === 'detect') {
|
280 |
-
findPoster(poster, function(url) {
|
281 |
-
$wrapper.css('background-image', 'url(' + url + ')');
|
282 |
-
});
|
283 |
-
} else if (posterType !== 'none') {
|
284 |
-
$wrapper.css('background-image', 'url(' + poster + '.' + posterType + ')');
|
285 |
-
}
|
286 |
-
|
287 |
-
// If a parent element has a static position, make it relative
|
288 |
-
if ($element.css('position') === 'static') {
|
289 |
-
$element.css('position', 'relative');
|
290 |
-
}
|
291 |
-
|
292 |
-
$element.prepend($wrapper);
|
293 |
-
|
294 |
-
if (typeof path === 'object') {
|
295 |
-
if (path.mp4) {
|
296 |
-
sources += '<source src="' + path.mp4 + '.mp4" type="video/mp4">';
|
297 |
-
}
|
298 |
-
|
299 |
-
if (path.webm) {
|
300 |
-
sources += '<source src="' + path.webm + '.webm" type="video/webm">';
|
301 |
-
}
|
302 |
-
|
303 |
-
if (path.ogv) {
|
304 |
-
sources += '<source src="' + path.ogv + '.ogv" type="video/ogg">';
|
305 |
-
}
|
306 |
-
|
307 |
-
$video = vide.$video = $('<video>' + sources + '</video>');
|
308 |
-
} else {
|
309 |
-
$video = vide.$video = $('<video>' +
|
310 |
-
'<source src="' + path + '.mp4" type="video/mp4">' +
|
311 |
-
'<source src="' + path + '.webm" type="video/webm">' +
|
312 |
-
'<source src="' + path + '.ogv" type="video/ogg">' +
|
313 |
-
'</video>');
|
314 |
-
}
|
315 |
-
|
316 |
-
// https://github.com/VodkaBears/Vide/issues/110
|
317 |
-
try {
|
318 |
-
$video
|
319 |
-
|
320 |
-
// Set video properties
|
321 |
-
.prop({
|
322 |
-
autoplay: settings.autoplay,
|
323 |
-
loop: settings.loop,
|
324 |
-
volume: settings.volume,
|
325 |
-
muted: settings.muted,
|
326 |
-
defaultMuted: settings.muted,
|
327 |
-
playbackRate: settings.playbackRate,
|
328 |
-
defaultPlaybackRate: settings.playbackRate
|
329 |
-
});
|
330 |
-
} catch (e) {
|
331 |
-
throw new Error(NOT_IMPLEMENTED_MSG);
|
332 |
-
}
|
333 |
-
|
334 |
-
// Video alignment
|
335 |
-
$video.css({
|
336 |
-
margin: 'auto',
|
337 |
-
position: 'absolute',
|
338 |
-
'z-index': -1,
|
339 |
-
top: position.y,
|
340 |
-
left: position.x,
|
341 |
-
'-webkit-transform': 'translate(-' + position.x + ', -' + position.y + ')',
|
342 |
-
'-ms-transform': 'translate(-' + position.x + ', -' + position.y + ')',
|
343 |
-
'-moz-transform': 'translate(-' + position.x + ', -' + position.y + ')',
|
344 |
-
transform: 'translate(-' + position.x + ', -' + position.y + ')',
|
345 |
-
|
346 |
-
// Disable visibility, while loading
|
347 |
-
visibility: 'hidden',
|
348 |
-
opacity: 0
|
349 |
-
})
|
350 |
-
|
351 |
-
// Resize a video, when it's loaded
|
352 |
-
.one('canplaythrough.' + PLUGIN_NAME, function() {
|
353 |
-
vide.resize();
|
354 |
-
})
|
355 |
-
|
356 |
-
// Make it visible, when it's already playing
|
357 |
-
.one('playing.' + PLUGIN_NAME, function() {
|
358 |
-
$video.css({
|
359 |
-
visibility: 'visible',
|
360 |
-
opacity: 1
|
361 |
-
});
|
362 |
-
$wrapper.css('background-image', 'none');
|
363 |
-
});
|
364 |
-
|
365 |
-
// Resize event is available only for 'window'
|
366 |
-
// Use another code solutions to detect DOM elements resizing
|
367 |
-
$element.on('resize.' + PLUGIN_NAME, function() {
|
368 |
-
if (settings.resizing) {
|
369 |
-
vide.resize();
|
370 |
-
}
|
371 |
-
});
|
372 |
-
|
373 |
-
// Append a video
|
374 |
-
$wrapper.append($video);
|
375 |
-
};
|
376 |
-
|
377 |
-
/**
|
378 |
-
* Get a video element
|
379 |
-
* @public
|
380 |
-
* @returns {HTMLVideoElement}
|
381 |
-
*/
|
382 |
-
Vide.prototype.getVideoObject = function() {
|
383 |
-
return this.$video[0];
|
384 |
-
};
|
385 |
-
|
386 |
-
/**
|
387 |
-
* Resize a video background
|
388 |
-
* @public
|
389 |
-
*/
|
390 |
-
Vide.prototype.resize = function() {
|
391 |
-
if (!this.$video) {
|
392 |
-
return;
|
393 |
-
}
|
394 |
-
|
395 |
-
var $wrapper = this.$wrapper;
|
396 |
-
var $video = this.$video;
|
397 |
-
var video = $video[0];
|
398 |
-
|
399 |
-
// Get a native video size
|
400 |
-
var videoHeight = video.videoHeight;
|
401 |
-
var videoWidth = video.videoWidth;
|
402 |
-
|
403 |
-
// Get a wrapper size
|
404 |
-
var wrapperHeight = $wrapper.height();
|
405 |
-
var wrapperWidth = $wrapper.width();
|
406 |
-
|
407 |
-
if (wrapperWidth / videoWidth > wrapperHeight / videoHeight) {
|
408 |
-
$video.css({
|
409 |
-
|
410 |
-
// +2 pixels to prevent an empty space after transformation
|
411 |
-
width: wrapperWidth + 2,
|
412 |
-
height: 'auto'
|
413 |
-
});
|
414 |
-
} else {
|
415 |
-
$video.css({
|
416 |
-
width: 'auto',
|
417 |
-
|
418 |
-
// +2 pixels to prevent an empty space after transformation
|
419 |
-
height: wrapperHeight + 2
|
420 |
-
});
|
421 |
-
}
|
422 |
-
};
|
423 |
-
|
424 |
-
/**
|
425 |
-
* Destroy a video background
|
426 |
-
* @public
|
427 |
-
*/
|
428 |
-
Vide.prototype.destroy = function() {
|
429 |
-
delete $[PLUGIN_NAME].lookup[this.index];
|
430 |
-
this.$video && this.$video.off(PLUGIN_NAME);
|
431 |
-
this.$element.off(PLUGIN_NAME).removeData(PLUGIN_NAME);
|
432 |
-
this.$wrapper.remove();
|
433 |
-
};
|
434 |
-
|
435 |
-
/**
|
436 |
-
* Special plugin object for instances.
|
437 |
-
* @public
|
438 |
-
* @type {Object}
|
439 |
-
*/
|
440 |
-
$[PLUGIN_NAME] = {
|
441 |
-
lookup: []
|
442 |
-
};
|
443 |
-
|
444 |
-
/**
|
445 |
-
* Plugin constructor
|
446 |
-
* @param {Object|String} path
|
447 |
-
* @param {Object|String} options
|
448 |
-
* @returns {JQuery}
|
449 |
-
* @constructor
|
450 |
-
*/
|
451 |
-
$.fn[PLUGIN_NAME] = function(path, options) {
|
452 |
-
var instance;
|
453 |
-
|
454 |
-
this.each(function() {
|
455 |
-
instance = $.data(this, PLUGIN_NAME);
|
456 |
-
|
457 |
-
// Destroy the plugin instance if exists
|
458 |
-
instance && instance.destroy();
|
459 |
-
|
460 |
-
// Create the plugin instance
|
461 |
-
instance = new Vide(this, path, options);
|
462 |
-
instance.index = $[PLUGIN_NAME].lookup.push(instance) - 1;
|
463 |
-
$.data(this, PLUGIN_NAME, instance);
|
464 |
-
});
|
465 |
-
|
466 |
-
return this;
|
467 |
-
};
|
468 |
-
|
469 |
-
$(document).ready(function() {
|
470 |
-
var $window = $(window);
|
471 |
-
|
472 |
-
// Window resize event listener
|
473 |
-
$window.on('resize.' + PLUGIN_NAME, function() {
|
474 |
-
for (var len = $[PLUGIN_NAME].lookup.length, i = 0, instance; i < len; i++) {
|
475 |
-
instance = $[PLUGIN_NAME].lookup[i];
|
476 |
-
|
477 |
-
if (instance && instance.settings.resizing) {
|
478 |
-
instance.resize();
|
479 |
-
}
|
480 |
-
}
|
481 |
-
});
|
482 |
-
|
483 |
-
// https://github.com/VodkaBears/Vide/issues/68
|
484 |
-
$window.on('unload.' + PLUGIN_NAME, function() {
|
485 |
-
return false;
|
486 |
-
});
|
487 |
-
|
488 |
-
// Auto initialization
|
489 |
-
// Add 'data-vide-bg' attribute with a path to the video without extension
|
490 |
-
// Also you can pass options throw the 'data-vide-options' attribute
|
491 |
-
// 'data-vide-options' must be like 'muted: false, volume: 0.5'
|
492 |
-
$(document).find('[data-' + PLUGIN_NAME + '-bg]').each(function(i, element) {
|
493 |
-
var $element = $(element);
|
494 |
-
var options = $element.data(PLUGIN_NAME + '-options');
|
495 |
-
var path = $element.data(PLUGIN_NAME + '-bg');
|
496 |
-
|
497 |
-
$element[PLUGIN_NAME](path, options);
|
498 |
-
});
|
499 |
-
});
|
500 |
-
|
501 |
-
});
|
1 |
+
/*
|
2 |
+
* Vide - v0.5.1
|
3 |
+
* Easy as hell jQuery plugin for video backgrounds.
|
4 |
+
* http://vodkabears.github.io/vide/
|
5 |
+
*
|
6 |
+
* Made by Ilya Makarov
|
7 |
+
* Under MIT License
|
8 |
+
*/
|
9 |
+
!(function(root, factory) {
|
10 |
+
if (typeof define === 'function' && define.amd) {
|
11 |
+
define(['jquery'], factory);
|
12 |
+
} else if (typeof exports === 'object') {
|
13 |
+
factory(require('jquery'));
|
14 |
+
} else {
|
15 |
+
factory(root.jQuery);
|
16 |
+
}
|
17 |
+
})(this, function($) {
|
18 |
+
|
19 |
+
'use strict';
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Name of the plugin
|
23 |
+
* @private
|
24 |
+
* @const
|
25 |
+
* @type {String}
|
26 |
+
*/
|
27 |
+
var PLUGIN_NAME = 'vide';
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Default settings
|
31 |
+
* @private
|
32 |
+
* @const
|
33 |
+
* @type {Object}
|
34 |
+
*/
|
35 |
+
var DEFAULTS = {
|
36 |
+
volume: 1,
|
37 |
+
playbackRate: 1,
|
38 |
+
muted: true,
|
39 |
+
loop: true,
|
40 |
+
autoplay: true,
|
41 |
+
position: '50% 50%',
|
42 |
+
posterType: 'detect',
|
43 |
+
resizing: true,
|
44 |
+
bgColor: 'transparent',
|
45 |
+
className: ''
|
46 |
+
};
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Not implemented error message
|
50 |
+
* @private
|
51 |
+
* @const
|
52 |
+
* @type {String}
|
53 |
+
*/
|
54 |
+
var NOT_IMPLEMENTED_MSG = 'Not implemented';
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Parse a string with options
|
58 |
+
* @private
|
59 |
+
* @param {String} str
|
60 |
+
* @returns {Object|String}
|
61 |
+
*/
|
62 |
+
function parseOptions(str) {
|
63 |
+
var obj = {};
|
64 |
+
var delimiterIndex;
|
65 |
+
var option;
|
66 |
+
var prop;
|
67 |
+
var val;
|
68 |
+
var arr;
|
69 |
+
var len;
|
70 |
+
var i;
|
71 |
+
|
72 |
+
// Remove spaces around delimiters and split
|
73 |
+
arr = str.replace(/\s*:\s*/g, ':').replace(/\s*,\s*/g, ',').split(',');
|
74 |
+
|
75 |
+
// Parse a string
|
76 |
+
for (i = 0, len = arr.length; i < len; i++) {
|
77 |
+
option = arr[i];
|
78 |
+
|
79 |
+
// Ignore urls and a string without colon delimiters
|
80 |
+
if (
|
81 |
+
option.search(/^(http|https|ftp):\/\//) !== -1 ||
|
82 |
+
option.search(':') === -1
|
83 |
+
) {
|
84 |
+
break;
|
85 |
+
}
|
86 |
+
|
87 |
+
delimiterIndex = option.indexOf(':');
|
88 |
+
prop = option.substring(0, delimiterIndex);
|
89 |
+
val = option.substring(delimiterIndex + 1);
|
90 |
+
|
91 |
+
// If val is an empty string, make it undefined
|
92 |
+
if (!val) {
|
93 |
+
val = undefined;
|
94 |
+
}
|
95 |
+
|
96 |
+
// Convert a string value if it is like a boolean
|
97 |
+
if (typeof val === 'string') {
|
98 |
+
val = val === 'true' || (val === 'false' ? false : val);
|
99 |
+
}
|
100 |
+
|
101 |
+
// Convert a string value if it is like a number
|
102 |
+
if (typeof val === 'string') {
|
103 |
+
val = !isNaN(val) ? +val : val;
|
104 |
+
}
|
105 |
+
|
106 |
+
obj[prop] = val;
|
107 |
+
}
|
108 |
+
|
109 |
+
// If nothing is parsed
|
110 |
+
if (prop == null && val == null) {
|
111 |
+
return str;
|
112 |
+
}
|
113 |
+
|
114 |
+
return obj;
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Parse a position option
|
119 |
+
* @private
|
120 |
+
* @param {String} str
|
121 |
+
* @returns {Object}
|
122 |
+
*/
|
123 |
+
function parsePosition(str) {
|
124 |
+
str = '' + str;
|
125 |
+
|
126 |
+
// Default value is a center
|
127 |
+
var args = str.split(/\s+/);
|
128 |
+
var x = '50%';
|
129 |
+
var y = '50%';
|
130 |
+
var len;
|
131 |
+
var arg;
|
132 |
+
var i;
|
133 |
+
|
134 |
+
for (i = 0, len = args.length; i < len; i++) {
|
135 |
+
arg = args[i];
|
136 |
+
|
137 |
+
// Convert values
|
138 |
+
if (arg === 'left') {
|
139 |
+
x = '0%';
|
140 |
+
} else if (arg === 'right') {
|
141 |
+
x = '100%';
|
142 |
+
} else if (arg === 'top') {
|
143 |
+
y = '0%';
|
144 |
+
} else if (arg === 'bottom') {
|
145 |
+
y = '100%';
|
146 |
+
} else if (arg === 'center') {
|
147 |
+
if (i === 0) {
|
148 |
+
x = '50%';
|
149 |
+
} else {
|
150 |
+
y = '50%';
|
151 |
+
}
|
152 |
+
} else {
|
153 |
+
if (i === 0) {
|
154 |
+
x = arg;
|
155 |
+
} else {
|
156 |
+
y = arg;
|
157 |
+
}
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
return { x: x, y: y };
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Search a poster
|
166 |
+
* @private
|
167 |
+
* @param {String} path
|
168 |
+
* @param {Function} callback
|
169 |
+
*/
|
170 |
+
function findPoster(path, callback) {
|
171 |
+
var onLoad = function() {
|
172 |
+
callback(this.src);
|
173 |
+
};
|
174 |
+
|
175 |
+
$('<img src="' + path + '.gif">').on('load', onLoad);
|
176 |
+
$('<img src="' + path + '.jpg">').on('load', onLoad);
|
177 |
+
$('<img src="' + path + '.jpeg">').on('load', onLoad);
|
178 |
+
$('<img src="' + path + '.png">').on('load', onLoad);
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Vide constructor
|
183 |
+
* @param {HTMLElement} element
|
184 |
+
* @param {Object|String} path
|
185 |
+
* @param {Object|String} options
|
186 |
+
* @constructor
|
187 |
+
*/
|
188 |
+
function Vide(element, path, options) {
|
189 |
+
this.$element = $(element);
|
190 |
+
|
191 |
+
// Parse path
|
192 |
+
if (typeof path === 'string') {
|
193 |
+
path = parseOptions(path);
|
194 |
+
}
|
195 |
+
|
196 |
+
// Parse options
|
197 |
+
if (!options) {
|
198 |
+
options = {};
|
199 |
+
} else if (typeof options === 'string') {
|
200 |
+
options = parseOptions(options);
|
201 |
+
}
|
202 |
+
|
203 |
+
// Remove an extension
|
204 |
+
if (typeof path === 'string') {
|
205 |
+
path = path.replace(/\.\w*$/, '');
|
206 |
+
} else if (typeof path === 'object') {
|
207 |
+
for (var i in path) {
|
208 |
+
if (path.hasOwnProperty(i)) {
|
209 |
+
path[i] = path[i].replace(/\.\w*$/, '');
|
210 |
+
}
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
+
this.settings = $.extend({}, DEFAULTS, options);
|
215 |
+
this.path = path;
|
216 |
+
|
217 |
+
// https://github.com/VodkaBears/Vide/issues/110
|
218 |
+
try {
|
219 |
+
this.init();
|
220 |
+
} catch (e) {
|
221 |
+
if (e.message !== NOT_IMPLEMENTED_MSG) {
|
222 |
+
throw e;
|
223 |
+
}
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Initialization
|
229 |
+
* @public
|
230 |
+
*/
|
231 |
+
Vide.prototype.init = function() {
|
232 |
+
var vide = this;
|
233 |
+
var path = vide.path;
|
234 |
+
var poster = path;
|
235 |
+
var sources = '';
|
236 |
+
var $element = vide.$element;
|
237 |
+
var settings = vide.settings;
|
238 |
+
var position = parsePosition(settings.position);
|
239 |
+
var posterType = settings.posterType;
|
240 |
+
var $video;
|
241 |
+
var $wrapper;
|
242 |
+
|
243 |
+
// Set styles of a video wrapper
|
244 |
+
$wrapper = vide.$wrapper = $('<div>')
|
245 |
+
.addClass(settings.className)
|
246 |
+
.css({
|
247 |
+
position: 'absolute',
|
248 |
+
'z-index': -1,
|
249 |
+
top: 0,
|
250 |
+
left: 0,
|
251 |
+
bottom: 0,
|
252 |
+
right: 0,
|
253 |
+
overflow: 'hidden',
|
254 |
+
'-webkit-background-size': 'cover',
|
255 |
+
'-moz-background-size': 'cover',
|
256 |
+
'-o-background-size': 'cover',
|
257 |
+
'background-size': 'cover',
|
258 |
+
'background-color': settings.bgColor,
|
259 |
+
'background-repeat': 'no-repeat',
|
260 |
+
'background-position': position.x + ' ' + position.y
|
261 |
+
});
|
262 |
+
|
263 |
+
// Get a poster path
|
264 |
+
if (typeof path === 'object') {
|
265 |
+
if (path.poster) {
|
266 |
+
poster = path.poster;
|
267 |
+
} else {
|
268 |
+
if (path.mp4) {
|
269 |
+
poster = path.mp4;
|
270 |
+
} else if (path.webm) {
|
271 |
+
poster = path.webm;
|
272 |
+
} else if (path.ogv) {
|
273 |
+
poster = path.ogv;
|
274 |
+
}
|
275 |
+
}
|
276 |
+
}
|
277 |
+
|
278 |
+
// Set a video poster
|
279 |
+
if (posterType === 'detect') {
|
280 |
+
findPoster(poster, function(url) {
|
281 |
+
$wrapper.css('background-image', 'url(' + url + ')');
|
282 |
+
});
|
283 |
+
} else if (posterType !== 'none') {
|
284 |
+
$wrapper.css('background-image', 'url(' + poster + '.' + posterType + ')');
|
285 |
+
}
|
286 |
+
|
287 |
+
// If a parent element has a static position, make it relative
|
288 |
+
if ($element.css('position') === 'static') {
|
289 |
+
$element.css('position', 'relative');
|
290 |
+
}
|
291 |
+
|
292 |
+
$element.prepend($wrapper);
|
293 |
+
|
294 |
+
if (typeof path === 'object') {
|
295 |
+
if (path.mp4) {
|
296 |
+
sources += '<source src="' + path.mp4 + '.mp4" type="video/mp4">';
|
297 |
+
}
|
298 |
+
|
299 |
+
if (path.webm) {
|
300 |
+
sources += '<source src="' + path.webm + '.webm" type="video/webm">';
|
301 |
+
}
|
302 |
+
|
303 |
+
if (path.ogv) {
|
304 |
+
sources += '<source src="' + path.ogv + '.ogv" type="video/ogg">';
|
305 |
+
}
|
306 |
+
|
307 |
+
$video = vide.$video = $('<video>' + sources + '</video>');
|
308 |
+
} else {
|
309 |
+
$video = vide.$video = $('<video>' +
|
310 |
+
'<source src="' + path + '.mp4" type="video/mp4">' +
|
311 |
+
'<source src="' + path + '.webm" type="video/webm">' +
|
312 |
+
'<source src="' + path + '.ogv" type="video/ogg">' +
|
313 |
+
'</video>');
|
314 |
+
}
|
315 |
+
|
316 |
+
// https://github.com/VodkaBears/Vide/issues/110
|
317 |
+
try {
|
318 |
+
$video
|
319 |
+
|
320 |
+
// Set video properties
|
321 |
+
.prop({
|
322 |
+
autoplay: settings.autoplay,
|
323 |
+
loop: settings.loop,
|
324 |
+
volume: settings.volume,
|
325 |
+
muted: settings.muted,
|
326 |
+
defaultMuted: settings.muted,
|
327 |
+
playbackRate: settings.playbackRate,
|
328 |
+
defaultPlaybackRate: settings.playbackRate
|
329 |
+
});
|
330 |
+
} catch (e) {
|
331 |
+
throw new Error(NOT_IMPLEMENTED_MSG);
|
332 |
+
}
|
333 |
+
|
334 |
+
// Video alignment
|
335 |
+
$video.css({
|
336 |
+
margin: 'auto',
|
337 |
+
position: 'absolute',
|
338 |
+
'z-index': -1,
|
339 |
+
top: position.y,
|
340 |
+
left: position.x,
|
341 |
+
'-webkit-transform': 'translate(-' + position.x + ', -' + position.y + ')',
|
342 |
+
'-ms-transform': 'translate(-' + position.x + ', -' + position.y + ')',
|
343 |
+
'-moz-transform': 'translate(-' + position.x + ', -' + position.y + ')',
|
344 |
+
transform: 'translate(-' + position.x + ', -' + position.y + ')',
|
345 |
+
|
346 |
+
// Disable visibility, while loading
|
347 |
+
visibility: 'hidden',
|
348 |
+
opacity: 0
|
349 |
+
})
|
350 |
+
|
351 |
+
// Resize a video, when it's loaded
|
352 |
+
.one('canplaythrough.' + PLUGIN_NAME, function() {
|
353 |
+
vide.resize();
|
354 |
+
})
|
355 |
+
|
356 |
+
// Make it visible, when it's already playing
|
357 |
+
.one('playing.' + PLUGIN_NAME, function() {
|
358 |
+
$video.css({
|
359 |
+
visibility: 'visible',
|
360 |
+
opacity: 1
|
361 |
+
});
|
362 |
+
$wrapper.css('background-image', 'none');
|
363 |
+
});
|
364 |
+
|
365 |
+
// Resize event is available only for 'window'
|
366 |
+
// Use another code solutions to detect DOM elements resizing
|
367 |
+
$element.on('resize.' + PLUGIN_NAME, function() {
|
368 |
+
if (settings.resizing) {
|
369 |
+
vide.resize();
|
370 |
+
}
|
371 |
+
});
|
372 |
+
|
373 |
+
// Append a video
|
374 |
+
$wrapper.append($video);
|
375 |
+
};
|
376 |
+
|
377 |
+
/**
|
378 |
+
* Get a video element
|
379 |
+
* @public
|
380 |
+
* @returns {HTMLVideoElement}
|
381 |
+
*/
|
382 |
+
Vide.prototype.getVideoObject = function() {
|
383 |
+
return this.$video[0];
|
384 |
+
};
|
385 |
+
|
386 |
+
/**
|
387 |
+
* Resize a video background
|
388 |
+
* @public
|
389 |
+
*/
|
390 |
+
Vide.prototype.resize = function() {
|
391 |
+
if (!this.$video) {
|
392 |
+
return;
|
393 |
+
}
|
394 |
+
|
395 |
+
var $wrapper = this.$wrapper;
|
396 |
+
var $video = this.$video;
|
397 |
+
var video = $video[0];
|
398 |
+
|
399 |
+
// Get a native video size
|
400 |
+
var videoHeight = video.videoHeight;
|
401 |
+
var videoWidth = video.videoWidth;
|
402 |
+
|
403 |
+
// Get a wrapper size
|
404 |
+
var wrapperHeight = $wrapper.height();
|
405 |
+
var wrapperWidth = $wrapper.width();
|
406 |
+
|
407 |
+
if (wrapperWidth / videoWidth > wrapperHeight / videoHeight) {
|
408 |
+
$video.css({
|
409 |
+
|
410 |
+
// +2 pixels to prevent an empty space after transformation
|
411 |
+
width: wrapperWidth + 2,
|
412 |
+
height: 'auto'
|
413 |
+
});
|
414 |
+
} else {
|
415 |
+
$video.css({
|
416 |
+
width: 'auto',
|
417 |
+
|
418 |
+
// +2 pixels to prevent an empty space after transformation
|
419 |
+
height: wrapperHeight + 2
|
420 |
+
});
|
421 |
+
}
|
422 |
+
};
|
423 |
+
|
424 |
+
/**
|
425 |
+
* Destroy a video background
|
426 |
+
* @public
|
427 |
+
*/
|
428 |
+
Vide.prototype.destroy = function() {
|
429 |
+
delete $[PLUGIN_NAME].lookup[this.index];
|
430 |
+
this.$video && this.$video.off(PLUGIN_NAME);
|
431 |
+
this.$element.off(PLUGIN_NAME).removeData(PLUGIN_NAME);
|
432 |
+
this.$wrapper.remove();
|
433 |
+
};
|
434 |
+
|
435 |
+
/**
|
436 |
+
* Special plugin object for instances.
|
437 |
+
* @public
|
438 |
+
* @type {Object}
|
439 |
+
*/
|
440 |
+
$[PLUGIN_NAME] = {
|
441 |
+
lookup: []
|
442 |
+
};
|
443 |
+
|
444 |
+
/**
|
445 |
+
* Plugin constructor
|
446 |
+
* @param {Object|String} path
|
447 |
+
* @param {Object|String} options
|
448 |
+
* @returns {JQuery}
|
449 |
+
* @constructor
|
450 |
+
*/
|
451 |
+
$.fn[PLUGIN_NAME] = function(path, options) {
|
452 |
+
var instance;
|
453 |
+
|
454 |
+
this.each(function() {
|
455 |
+
instance = $.data(this, PLUGIN_NAME);
|
456 |
+
|
457 |
+
// Destroy the plugin instance if exists
|
458 |
+
instance && instance.destroy();
|
459 |
+
|
460 |
+
// Create the plugin instance
|
461 |
+
instance = new Vide(this, path, options);
|
462 |
+
instance.index = $[PLUGIN_NAME].lookup.push(instance) - 1;
|
463 |
+
$.data(this, PLUGIN_NAME, instance);
|
464 |
+
});
|
465 |
+
|
466 |
+
return this;
|
467 |
+
};
|
468 |
+
|
469 |
+
$(document).ready(function() {
|
470 |
+
var $window = $(window);
|
471 |
+
|
472 |
+
// Window resize event listener
|
473 |
+
$window.on('resize.' + PLUGIN_NAME, function() {
|
474 |
+
for (var len = $[PLUGIN_NAME].lookup.length, i = 0, instance; i < len; i++) {
|
475 |
+
instance = $[PLUGIN_NAME].lookup[i];
|
476 |
+
|
477 |
+
if (instance && instance.settings.resizing) {
|
478 |
+
instance.resize();
|
479 |
+
}
|
480 |
+
}
|
481 |
+
});
|
482 |
+
|
483 |
+
// https://github.com/VodkaBears/Vide/issues/68
|
484 |
+
$window.on('unload.' + PLUGIN_NAME, function() {
|
485 |
+
return false;
|
486 |
+
});
|
487 |
+
|
488 |
+
// Auto initialization
|
489 |
+
// Add 'data-vide-bg' attribute with a path to the video without extension
|
490 |
+
// Also you can pass options throw the 'data-vide-options' attribute
|
491 |
+
// 'data-vide-options' must be like 'muted: false, volume: 0.5'
|
492 |
+
$(document).find('[data-' + PLUGIN_NAME + '-bg]').each(function(i, element) {
|
493 |
+
var $element = $(element);
|
494 |
+
var options = $element.data(PLUGIN_NAME + '-options');
|
495 |
+
var path = $element.data(PLUGIN_NAME + '-bg');
|
496 |
+
|
497 |
+
$element[PLUGIN_NAME](path, options);
|
498 |
+
});
|
499 |
+
});
|
500 |
+
|
501 |
+
});
|
assets/js/vendor/jquery.vide.min.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
/*
|
2 |
-
* Vide - v0.5.1
|
3 |
-
* Easy as hell jQuery plugin for video backgrounds.
|
4 |
-
* http://vodkabears.github.io/vide/
|
5 |
-
*
|
6 |
-
* Made by Ilya Makarov
|
7 |
-
* Under MIT License
|
8 |
-
*/
|
9 |
!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],b):b("object"==typeof exports?require("jquery"):a.jQuery)}(this,function(a){"use strict";function b(a){var b,c,d,e,f,g,h,i={};for(f=a.replace(/\s*:\s*/g,":").replace(/\s*,\s*/g,",").split(","),h=0,g=f.length;h<g&&(c=f[h],c.search(/^(http|https|ftp):\/\//)===-1&&c.search(":")!==-1);h++)b=c.indexOf(":"),d=c.substring(0,b),e=c.substring(b+1),e||(e=void 0),"string"==typeof e&&(e="true"===e||"false"!==e&&e),"string"==typeof e&&(e=isNaN(e)?e:+e),i[d]=e;return null==d&&null==e?a:i}function c(a){a=""+a;var b,c,d,e=a.split(/\s+/),f="50%",g="50%";for(d=0,b=e.length;d<b;d++)c=e[d],"left"===c?f="0%":"right"===c?f="100%":"top"===c?g="0%":"bottom"===c?g="100%":"center"===c?0===d?f="50%":g="50%":0===d?f=c:g=c;return{x:f,y:g}}function d(b,c){var d=function(){c(this.src)};a('<img src="'+b+'.gif">').on("load",d),a('<img src="'+b+'.jpg">').on("load",d),a('<img src="'+b+'.jpeg">').on("load",d),a('<img src="'+b+'.png">').on("load",d)}function e(c,d,e){if(this.$element=a(c),"string"==typeof d&&(d=b(d)),e?"string"==typeof e&&(e=b(e)):e={},"string"==typeof d)d=d.replace(/\.\w*$/,"");else if("object"==typeof d)for(var f in d)d.hasOwnProperty(f)&&(d[f]=d[f].replace(/\.\w*$/,""));this.settings=a.extend({},g,e),this.path=d;try{this.init()}catch(i){if(i.message!==h)throw i}}var f="vide",g={volume:1,playbackRate:1,muted:!0,loop:!0,autoplay:!0,position:"50% 50%",posterType:"detect",resizing:!0,bgColor:"transparent",className:""},h="Not implemented";e.prototype.init=function(){var b,e,f=this,g=f.path,i=g,j="",k=f.$element,l=f.settings,m=c(l.position),n=l.posterType;e=f.$wrapper=a("<div>").addClass(l.className).css({position:"absolute","z-index":-1,top:0,left:0,bottom:0,right:0,overflow:"hidden","-webkit-background-size":"cover","-moz-background-size":"cover","-o-background-size":"cover","background-size":"cover","background-color":l.bgColor,"background-repeat":"no-repeat","background-position":m.x+" "+m.y}),"object"==typeof g&&(g.poster?i=g.poster:g.mp4?i=g.mp4:g.webm?i=g.webm:g.ogv&&(i=g.ogv)),"detect"===n?d(i,function(a){e.css("background-image","url("+a+")")}):"none"!==n&&e.css("background-image","url("+i+"."+n+")"),"static"===k.css("position")&&k.css("position","relative"),k.prepend(e),"object"==typeof g?(g.mp4&&(j+='<source src="'+g.mp4+'.mp4" type="video/mp4">'),g.webm&&(j+='<source src="'+g.webm+'.webm" type="video/webm">'),g.ogv&&(j+='<source src="'+g.ogv+'.ogv" type="video/ogg">'),b=f.$video=a("<video>"+j+"</video>")):b=f.$video=a('<video><source src="'+g+'.mp4" type="video/mp4"><source src="'+g+'.webm" type="video/webm"><source src="'+g+'.ogv" type="video/ogg"></video>');try{b.prop({autoplay:l.autoplay,loop:l.loop,volume:l.volume,muted:l.muted,defaultMuted:l.muted,playbackRate:l.playbackRate,defaultPlaybackRate:l.playbackRate})}catch(o){throw new Error(h)}b.css({margin:"auto",position:"absolute","z-index":-1,top:m.y,left:m.x,"-webkit-transform":"translate(-"+m.x+", -"+m.y+")","-ms-transform":"translate(-"+m.x+", -"+m.y+")","-moz-transform":"translate(-"+m.x+", -"+m.y+")",transform:"translate(-"+m.x+", -"+m.y+")",visibility:"hidden",opacity:0}).one("canplaythrough.vide",function(){f.resize()}).one("playing.vide",function(){b.css({visibility:"visible",opacity:1}),e.css("background-image","none")}),k.on("resize.vide",function(){l.resizing&&f.resize()}),e.append(b)},e.prototype.getVideoObject=function(){return this.$video[0]},e.prototype.resize=function(){if(this.$video){var a=this.$wrapper,b=this.$video,c=b[0],d=c.videoHeight,e=c.videoWidth,f=a.height(),g=a.width();g/e>f/d?b.css({width:g+2,height:"auto"}):b.css({width:"auto",height:f+2})}},e.prototype.destroy=function(){delete a[f].lookup[this.index],this.$video&&this.$video.off(f),this.$element.off(f).removeData(f),this.$wrapper.remove()},a[f]={lookup:[]},a.fn[f]=function(b,c){var d;return this.each(function(){d=a.data(this,f),d&&d.destroy(),d=new e(this,b,c),d.index=a[f].lookup.push(d)-1,a.data(this,f,d)}),this},a(document).ready(function(){var b=a(window);b.on("resize.vide",function(){for(var b,c=a[f].lookup.length,d=0;d<c;d++)b=a[f].lookup[d],b&&b.settings.resizing&&b.resize()}),b.on("unload.vide",function(){return!1}),a(document).find("[data-vide-bg]").each(function(b,c){var d=a(c),e=d.data("vide-options"),g=d.data("vide-bg");d[f](g,e)})})});
|
1 |
+
/*
|
2 |
+
* Vide - v0.5.1
|
3 |
+
* Easy as hell jQuery plugin for video backgrounds.
|
4 |
+
* http://vodkabears.github.io/vide/
|
5 |
+
*
|
6 |
+
* Made by Ilya Makarov
|
7 |
+
* Under MIT License
|
8 |
+
*/
|
9 |
!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],b):b("object"==typeof exports?require("jquery"):a.jQuery)}(this,function(a){"use strict";function b(a){var b,c,d,e,f,g,h,i={};for(f=a.replace(/\s*:\s*/g,":").replace(/\s*,\s*/g,",").split(","),h=0,g=f.length;h<g&&(c=f[h],c.search(/^(http|https|ftp):\/\//)===-1&&c.search(":")!==-1);h++)b=c.indexOf(":"),d=c.substring(0,b),e=c.substring(b+1),e||(e=void 0),"string"==typeof e&&(e="true"===e||"false"!==e&&e),"string"==typeof e&&(e=isNaN(e)?e:+e),i[d]=e;return null==d&&null==e?a:i}function c(a){a=""+a;var b,c,d,e=a.split(/\s+/),f="50%",g="50%";for(d=0,b=e.length;d<b;d++)c=e[d],"left"===c?f="0%":"right"===c?f="100%":"top"===c?g="0%":"bottom"===c?g="100%":"center"===c?0===d?f="50%":g="50%":0===d?f=c:g=c;return{x:f,y:g}}function d(b,c){var d=function(){c(this.src)};a('<img src="'+b+'.gif">').on("load",d),a('<img src="'+b+'.jpg">').on("load",d),a('<img src="'+b+'.jpeg">').on("load",d),a('<img src="'+b+'.png">').on("load",d)}function e(c,d,e){if(this.$element=a(c),"string"==typeof d&&(d=b(d)),e?"string"==typeof e&&(e=b(e)):e={},"string"==typeof d)d=d.replace(/\.\w*$/,"");else if("object"==typeof d)for(var f in d)d.hasOwnProperty(f)&&(d[f]=d[f].replace(/\.\w*$/,""));this.settings=a.extend({},g,e),this.path=d;try{this.init()}catch(i){if(i.message!==h)throw i}}var f="vide",g={volume:1,playbackRate:1,muted:!0,loop:!0,autoplay:!0,position:"50% 50%",posterType:"detect",resizing:!0,bgColor:"transparent",className:""},h="Not implemented";e.prototype.init=function(){var b,e,f=this,g=f.path,i=g,j="",k=f.$element,l=f.settings,m=c(l.position),n=l.posterType;e=f.$wrapper=a("<div>").addClass(l.className).css({position:"absolute","z-index":-1,top:0,left:0,bottom:0,right:0,overflow:"hidden","-webkit-background-size":"cover","-moz-background-size":"cover","-o-background-size":"cover","background-size":"cover","background-color":l.bgColor,"background-repeat":"no-repeat","background-position":m.x+" "+m.y}),"object"==typeof g&&(g.poster?i=g.poster:g.mp4?i=g.mp4:g.webm?i=g.webm:g.ogv&&(i=g.ogv)),"detect"===n?d(i,function(a){e.css("background-image","url("+a+")")}):"none"!==n&&e.css("background-image","url("+i+"."+n+")"),"static"===k.css("position")&&k.css("position","relative"),k.prepend(e),"object"==typeof g?(g.mp4&&(j+='<source src="'+g.mp4+'.mp4" type="video/mp4">'),g.webm&&(j+='<source src="'+g.webm+'.webm" type="video/webm">'),g.ogv&&(j+='<source src="'+g.ogv+'.ogv" type="video/ogg">'),b=f.$video=a("<video>"+j+"</video>")):b=f.$video=a('<video><source src="'+g+'.mp4" type="video/mp4"><source src="'+g+'.webm" type="video/webm"><source src="'+g+'.ogv" type="video/ogg"></video>');try{b.prop({autoplay:l.autoplay,loop:l.loop,volume:l.volume,muted:l.muted,defaultMuted:l.muted,playbackRate:l.playbackRate,defaultPlaybackRate:l.playbackRate})}catch(o){throw new Error(h)}b.css({margin:"auto",position:"absolute","z-index":-1,top:m.y,left:m.x,"-webkit-transform":"translate(-"+m.x+", -"+m.y+")","-ms-transform":"translate(-"+m.x+", -"+m.y+")","-moz-transform":"translate(-"+m.x+", -"+m.y+")",transform:"translate(-"+m.x+", -"+m.y+")",visibility:"hidden",opacity:0}).one("canplaythrough.vide",function(){f.resize()}).one("playing.vide",function(){b.css({visibility:"visible",opacity:1}),e.css("background-image","none")}),k.on("resize.vide",function(){l.resizing&&f.resize()}),e.append(b)},e.prototype.getVideoObject=function(){return this.$video[0]},e.prototype.resize=function(){if(this.$video){var a=this.$wrapper,b=this.$video,c=b[0],d=c.videoHeight,e=c.videoWidth,f=a.height(),g=a.width();g/e>f/d?b.css({width:g+2,height:"auto"}):b.css({width:"auto",height:f+2})}},e.prototype.destroy=function(){delete a[f].lookup[this.index],this.$video&&this.$video.off(f),this.$element.off(f).removeData(f),this.$wrapper.remove()},a[f]={lookup:[]},a.fn[f]=function(b,c){var d;return this.each(function(){d=a.data(this,f),d&&d.destroy(),d=new e(this,b,c),d.index=a[f].lookup.push(d)-1,a.data(this,f,d)}),this},a(document).ready(function(){var b=a(window);b.on("resize.vide",function(){for(var b,c=a[f].lookup.length,d=0;d<c;d++)b=a[f].lookup[d],b&&b.settings.resizing&&b.resize()}),b.on("unload.vide",function(){return!1}),a(document).find("[data-vide-bg]").each(function(b,c){var d=a(c),e=d.data("vide-options"),g=d.data("vide-bg");d[f](g,e)})})});
|
assets/js/vendor/jquery.youtubebackground.js
CHANGED
@@ -1,334 +1,334 @@
|
|
1 |
-
/*
|
2 |
-
* YoutubeBackground - A wrapper for the Youtube API - Great for fullscreen background videos or just regular videos.
|
3 |
-
*
|
4 |
-
* Licensed under the MIT license:
|
5 |
-
* http://www.opensource.org/licenses/mit-license.php
|
6 |
-
*
|
7 |
-
*
|
8 |
-
* Version: 1.0.5
|
9 |
-
*
|
10 |
-
*/
|
11 |
-
|
12 |
-
// Chain of Responsibility pattern. Creates base class that can be overridden.
|
13 |
-
if ( typeof Object.create !== "function" ) {
|
14 |
-
Object.create = function (obj) {
|
15 |
-
function F() {
|
16 |
-
}
|
17 |
-
|
18 |
-
F.prototype = obj;
|
19 |
-
return new F();
|
20 |
-
};
|
21 |
-
}
|
22 |
-
|
23 |
-
(function ($, window, document) {
|
24 |
-
var
|
25 |
-
loadAPI = function loadAPI(callback) {
|
26 |
-
|
27 |
-
// Load Youtube API
|
28 |
-
var tag = document.createElement('script'),
|
29 |
-
head = document.getElementsByTagName('head')[ 0 ];
|
30 |
-
|
31 |
-
if ( window.location.origin == 'file://' ) {
|
32 |
-
tag.src = 'http://www.youtube.com/iframe_api';
|
33 |
-
} else {
|
34 |
-
tag.src = '//www.youtube.com/iframe_api';
|
35 |
-
}
|
36 |
-
|
37 |
-
head.appendChild(tag);
|
38 |
-
|
39 |
-
// Clean up Tags.
|
40 |
-
head = null;
|
41 |
-
tag = null;
|
42 |
-
|
43 |
-
iframeIsReady(callback);
|
44 |
-
},
|
45 |
-
iframeIsReady = function iframeIsReady(callback) {
|
46 |
-
// Listen for Gobal YT player callback
|
47 |
-
if ( typeof YT === 'undefined' && typeof window.loadingPlayer === 'undefined' ) {
|
48 |
-
// Prevents Ready Event from being called twice
|
49 |
-
window.loadingPlayer = true;
|
50 |
-
|
51 |
-
|
52 |
-
// Creates deferred so, other players know when to wait.
|
53 |
-
window.dfd = $.Deferred();
|
54 |
-
window.onYouTubeIframeAPIReady = function () {
|
55 |
-
window.onYouTubeIframeAPIReady = null;
|
56 |
-
window.dfd.resolve("done");
|
57 |
-
callback();
|
58 |
-
};
|
59 |
-
} else if ( typeof YT === 'object' ) {
|
60 |
-
callback();
|
61 |
-
} else {
|
62 |
-
window.dfd.done(function (name) {
|
63 |
-
callback();
|
64 |
-
});
|
65 |
-
}
|
66 |
-
};
|
67 |
-
|
68 |
-
// YTPlayer Object
|
69 |
-
YTPlayer = {
|
70 |
-
player: null,
|
71 |
-
|
72 |
-
// Defaults
|
73 |
-
defaults: {
|
74 |
-
ratio : 16 / 9,
|
75 |
-
videoId : 'LSmgKRx5pBo',
|
76 |
-
mute : true,
|
77 |
-
repeat : true,
|
78 |
-
width : $(window).width(),
|
79 |
-
playButtonClass : 'YTPlayer-play',
|
80 |
-
pauseButtonClass: 'YTPlayer-pause',
|
81 |
-
muteButtonClass : 'YTPlayer-mute',
|
82 |
-
volumeUpClass : 'YTPlayer-volume-up',
|
83 |
-
volumeDownClass : 'YTPlayer-volume-down',
|
84 |
-
start : 0,
|
85 |
-
pauseOnScroll : false,
|
86 |
-
fitToBackground : true,
|
87 |
-
playerVars : {
|
88 |
-
iv_load_policy: 3,
|
89 |
-
modestbranding: 1,
|
90 |
-
autoplay : 1,
|
91 |
-
controls : 0,
|
92 |
-
showinfo : 0,
|
93 |
-
wmode : 'opaque',
|
94 |
-
branding : 0,
|
95 |
-
autohide : 0
|
96 |
-
},
|
97 |
-
events : null
|
98 |
-
},
|
99 |
-
|
100 |
-
/**
|
101 |
-
* @function init
|
102 |
-
* Intializes YTPlayer object
|
103 |
-
*/
|
104 |
-
init: function init(node, userOptions) {
|
105 |
-
var self = this;
|
106 |
-
|
107 |
-
self.userOptions = userOptions;
|
108 |
-
|
109 |
-
self.$body = $('body'),
|
110 |
-
self.$node = $(node),
|
111 |
-
self.$window = $(window);
|
112 |
-
|
113 |
-
// Setup event defaults with the reference to this
|
114 |
-
self.defaults.events = {
|
115 |
-
'onReady' : function (e) {
|
116 |
-
self.onPlayerReady(e);
|
117 |
-
|
118 |
-
// setup up pause on scroll
|
119 |
-
if ( self.options.pauseOnScroll ) {
|
120 |
-
self.pauseOnScroll();
|
121 |
-
}
|
122 |
-
|
123 |
-
// Callback for when finished
|
124 |
-
if ( typeof self.options.callback == 'function' ) {
|
125 |
-
self.options.callback.call(this);
|
126 |
-
}
|
127 |
-
},
|
128 |
-
'onStateChange': function (e) {
|
129 |
-
if ( e.data === 1 ) {
|
130 |
-
|
131 |
-
self.$node.find('img').fadeOut(400);
|
132 |
-
self.$node.addClass('loaded');
|
133 |
-
} else if ( e.data === 0 && self.options.repeat ) { // video ended and repeat option is set true
|
134 |
-
self.player.seekTo(self.options.start);
|
135 |
-
}
|
136 |
-
}
|
137 |
-
}
|
138 |
-
|
139 |
-
|
140 |
-
self.options = $.extend(true, {}, self.defaults, self.userOptions);
|
141 |
-
self.options.height = Math.ceil(self.options.width / self.options.ratio);
|
142 |
-
self.ID = (new Date()).getTime();
|
143 |
-
self.holderID = 'YTPlayer-ID-' + self.ID;
|
144 |
-
|
145 |
-
if ( self.options.fitToBackground ) {
|
146 |
-
self.createBackgroundVideo();
|
147 |
-
} else {
|
148 |
-
self.createContainerVideo();
|
149 |
-
}
|
150 |
-
// Listen for Resize Event
|
151 |
-
self.$window.on('resize.YTplayer' + self.ID, function () {
|
152 |
-
self.resize(self);
|
153 |
-
});
|
154 |
-
|
155 |
-
loadAPI(self.onYouTubeIframeAPIReady.bind(self));
|
156 |
-
|
157 |
-
self.resize(self);
|
158 |
-
|
159 |
-
return self;
|
160 |
-
},
|
161 |
-
|
162 |
-
|
163 |
-
/**
|
164 |
-
* @function pauseOnScroll
|
165 |
-
* Adds window events to pause video on scroll.
|
166 |
-
*/
|
167 |
-
pauseOnScroll : function pauseOnScroll() {
|
168 |
-
var self = this;
|
169 |
-
self.$window.on('scroll.YTplayer' + self.ID, function () {
|
170 |
-
var state = self.player.getPlayerState();
|
171 |
-
if ( state === 1 ) {
|
172 |
-
self.player.pauseVideo();
|
173 |
-
}
|
174 |
-
});
|
175 |
-
self.$window.scrollStopped(function () {
|
176 |
-
var state = self.player.getPlayerState();
|
177 |
-
if ( state === 2 ) {
|
178 |
-
self.player.playVideo();
|
179 |
-
}
|
180 |
-
});
|
181 |
-
},
|
182 |
-
/**
|
183 |
-
* @function createContainerVideo
|
184 |
-
* Adds HTML for video in a container
|
185 |
-
*/
|
186 |
-
createContainerVideo: function createContainerVideo() {
|
187 |
-
var self = this;
|
188 |
-
|
189 |
-
/*jshint multistr: true */
|
190 |
-
var $YTPlayerString = $('<div id="ytplayer-container' + self.ID + '" >\
|
191 |
-
<div id="' + self.holderID + '" class="ytplayer-player-inline"></div> \
|
192 |
-
</div> \
|
193 |
-
<div id="ytplayer-shield" class="ytplayer-shield"></div>');
|
194 |
-
|
195 |
-
self.$node.append($YTPlayerString);
|
196 |
-
self.$YTPlayerString = $YTPlayerString;
|
197 |
-
$YTPlayerString = null;
|
198 |
-
},
|
199 |
-
|
200 |
-
/**
|
201 |
-
* @function createBackgroundVideo
|
202 |
-
* Adds HTML for video background
|
203 |
-
*/
|
204 |
-
createBackgroundVideo: function createBackgroundVideo() {
|
205 |
-
/*jshint multistr: true */
|
206 |
-
var self = this,
|
207 |
-
$YTPlayerString = $('<div id="ytplayer-container' + self.ID + '" class="ytplayer-container background">\
|
208 |
-
<div id="' + self.holderID + '" class="ytplayer-player"></div>\
|
209 |
-
</div>\
|
210 |
-
<div id="ytplayer-shield" class="ytplayer-shield"></div>');
|
211 |
-
|
212 |
-
self.$node.append($YTPlayerString);
|
213 |
-
self.$YTPlayerString = $YTPlayerString;
|
214 |
-
$YTPlayerString = null;
|
215 |
-
},
|
216 |
-
|
217 |
-
/**
|
218 |
-
* @function resize
|
219 |
-
* Resize event to change video size
|
220 |
-
*/
|
221 |
-
resize: function resize(self) {
|
222 |
-
//var self = this;
|
223 |
-
var container = $(window);
|
224 |
-
|
225 |
-
if ( !self.options.fitToBackground ) {
|
226 |
-
container = self.$node;
|
227 |
-
}
|
228 |
-
|
229 |
-
var width = container.width(),
|
230 |
-
pWidth, // player width, to be defined
|
231 |
-
height = container.height(),
|
232 |
-
pHeight, // player height, tbd
|
233 |
-
$YTPlayerPlayer = $('#' + self.holderID);
|
234 |
-
|
235 |
-
// when screen aspect ratio differs from video, video must center and underlay one dimension
|
236 |
-
if ( width / self.options.ratio < height ) {
|
237 |
-
pWidth = Math.ceil(height * self.options.ratio); // get new player width
|
238 |
-
$YTPlayerPlayer.width(pWidth).height(height).css({
|
239 |
-
left: (width - pWidth) / 2,
|
240 |
-
top : 0
|
241 |
-
}); // player width is greater, offset left; reset top
|
242 |
-
} else { // new video width < window width (gap to right)
|
243 |
-
pHeight = Math.ceil(width / self.options.ratio); // get new player height
|
244 |
-
$YTPlayerPlayer.width(width).height(pHeight).css({
|
245 |
-
left: 0,
|
246 |
-
top : (height - pHeight) / 2
|
247 |
-
}); // player height is greater, offset top; reset left
|
248 |
-
}
|
249 |
-
|
250 |
-
$YTPlayerPlayer = null;
|
251 |
-
container = null;
|
252 |
-
},
|
253 |
-
|
254 |
-
/**
|
255 |
-
* @function onYouTubeIframeAPIReady
|
256 |
-
* @ params {object} YTPlayer object for access to options
|
257 |
-
* Youtube API calls this function when the player is ready.
|
258 |
-
*/
|
259 |
-
onYouTubeIframeAPIReady: function onYouTubeIframeAPIReady() {
|
260 |
-
var self = this;
|
261 |
-
self.player = new window.YT.Player(self.holderID, self.options);
|
262 |
-
},
|
263 |
-
|
264 |
-
/**
|
265 |
-
* @function onPlayerReady
|
266 |
-
* @ params {event} window event from youtube player
|
267 |
-
*/
|
268 |
-
onPlayerReady: function onPlayerReady(e) {
|
269 |
-
if ( this.options.mute ) {
|
270 |
-
e.target.mute();
|
271 |
-
}
|
272 |
-
if ( this.options.playerVars.autoplay ) {
|
273 |
-
e.target.playVideo();
|
274 |
-
}
|
275 |
-
$(document).trigger('YTBGREADY', {player: true});
|
276 |
-
},
|
277 |
-
|
278 |
-
/**
|
279 |
-
* @function getPlayer
|
280 |
-
* returns youtube player
|
281 |
-
*/
|
282 |
-
getPlayer: function getPlayer() {
|
283 |
-
return this.player;
|
284 |
-
},
|
285 |
-
|
286 |
-
/**
|
287 |
-
* @function destroy
|
288 |
-
* destroys all!
|
289 |
-
*/
|
290 |
-
destroy: function destroy() {
|
291 |
-
var self = this;
|
292 |
-
|
293 |
-
self.$node
|
294 |
-
.removeData('yt-init')
|
295 |
-
.removeData('ytPlayer')
|
296 |
-
.removeClass('loaded');
|
297 |
-
|
298 |
-
self.$YTPlayerString.remove();
|
299 |
-
|
300 |
-
$(window).off('resize.YTplayer' + self.ID);
|
301 |
-
$(window).off('scroll.YTplayer' + self.ID);
|
302 |
-
self.$body = null;
|
303 |
-
self.$node = null;
|
304 |
-
self.$YTPlayerString = null;
|
305 |
-
self.player.destroy();
|
306 |
-
self.player = null;
|
307 |
-
}
|
308 |
-
};
|
309 |
-
|
310 |
-
// Scroll Stopped event.
|
311 |
-
$.fn.scrollStopped = function (callback) {
|
312 |
-
var $this = $(this), self = this;
|
313 |
-
$this.on('scroll', function () {
|
314 |
-
if ( $this.data('scrollTimeout') ) {
|
315 |
-
clearTimeout($this.data('scrollTimeout'));
|
316 |
-
}
|
317 |
-
$this.data('scrollTimeout', setTimeout(callback, 250, self));
|
318 |
-
});
|
319 |
-
};
|
320 |
-
|
321 |
-
// Create plugin
|
322 |
-
$.fn.YTPlayer = function (options) {
|
323 |
-
|
324 |
-
return this.each(function () {
|
325 |
-
var el = this;
|
326 |
-
|
327 |
-
$(el).data("yt-init", true);
|
328 |
-
var player = Object.create(YTPlayer);
|
329 |
-
player.init(el, options);
|
330 |
-
$.data(el, "ytPlayer", player);
|
331 |
-
});
|
332 |
-
};
|
333 |
-
|
334 |
-
})(jQuery, window, document);
|
1 |
+
/*
|
2 |
+
* YoutubeBackground - A wrapper for the Youtube API - Great for fullscreen background videos or just regular videos.
|
3 |
+
*
|
4 |
+
* Licensed under the MIT license:
|
5 |
+
* http://www.opensource.org/licenses/mit-license.php
|
6 |
+
*
|
7 |
+
*
|
8 |
+
* Version: 1.0.5
|
9 |
+
*
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Chain of Responsibility pattern. Creates base class that can be overridden.
|
13 |
+
if ( typeof Object.create !== "function" ) {
|
14 |
+
Object.create = function (obj) {
|
15 |
+
function F() {
|
16 |
+
}
|
17 |
+
|
18 |
+
F.prototype = obj;
|
19 |
+
return new F();
|
20 |
+
};
|
21 |
+
}
|
22 |
+
|
23 |
+
(function ($, window, document) {
|
24 |
+
var
|
25 |
+
loadAPI = function loadAPI(callback) {
|
26 |
+
|
27 |
+
// Load Youtube API
|
28 |
+
var tag = document.createElement('script'),
|
29 |
+
head = document.getElementsByTagName('head')[ 0 ];
|
30 |
+
|
31 |
+
if ( window.location.origin == 'file://' ) {
|
32 |
+
tag.src = 'http://www.youtube.com/iframe_api';
|
33 |
+
} else {
|
34 |
+
tag.src = '//www.youtube.com/iframe_api';
|
35 |
+
}
|
36 |
+
|
37 |
+
head.appendChild(tag);
|
38 |
+
|
39 |
+
// Clean up Tags.
|
40 |
+
head = null;
|
41 |
+
tag = null;
|
42 |
+
|
43 |
+
iframeIsReady(callback);
|
44 |
+
},
|
45 |
+
iframeIsReady = function iframeIsReady(callback) {
|
46 |
+
// Listen for Gobal YT player callback
|
47 |
+
if ( typeof YT === 'undefined' && typeof window.loadingPlayer === 'undefined' ) {
|
48 |
+
// Prevents Ready Event from being called twice
|
49 |
+
window.loadingPlayer = true;
|
50 |
+
|
51 |
+
|
52 |
+
// Creates deferred so, other players know when to wait.
|
53 |
+
window.dfd = $.Deferred();
|
54 |
+
window.onYouTubeIframeAPIReady = function () {
|
55 |
+
window.onYouTubeIframeAPIReady = null;
|
56 |
+
window.dfd.resolve("done");
|
57 |
+
callback();
|
58 |
+
};
|
59 |
+
} else if ( typeof YT === 'object' ) {
|
60 |
+
callback();
|
61 |
+
} else {
|
62 |
+
window.dfd.done(function (name) {
|
63 |
+
callback();
|
64 |
+
});
|
65 |
+
}
|
66 |
+
};
|
67 |
+
|
68 |
+
// YTPlayer Object
|
69 |
+
YTPlayer = {
|
70 |
+
player: null,
|
71 |
+
|
72 |
+
// Defaults
|
73 |
+
defaults: {
|
74 |
+
ratio : 16 / 9,
|
75 |
+
videoId : 'LSmgKRx5pBo',
|
76 |
+
mute : true,
|
77 |
+
repeat : true,
|
78 |
+
width : $(window).width(),
|
79 |
+
playButtonClass : 'YTPlayer-play',
|
80 |
+
pauseButtonClass: 'YTPlayer-pause',
|
81 |
+
muteButtonClass : 'YTPlayer-mute',
|
82 |
+
volumeUpClass : 'YTPlayer-volume-up',
|
83 |
+
volumeDownClass : 'YTPlayer-volume-down',
|
84 |
+
start : 0,
|
85 |
+
pauseOnScroll : false,
|
86 |
+
fitToBackground : true,
|
87 |
+
playerVars : {
|
88 |
+
iv_load_policy: 3,
|
89 |
+
modestbranding: 1,
|
90 |
+
autoplay : 1,
|
91 |
+
controls : 0,
|
92 |
+
showinfo : 0,
|
93 |
+
wmode : 'opaque',
|
94 |
+
branding : 0,
|
95 |
+
autohide : 0
|
96 |
+
},
|
97 |
+
events : null
|
98 |
+
},
|
99 |
+
|
100 |
+
/**
|
101 |
+
* @function init
|
102 |
+
* Intializes YTPlayer object
|
103 |
+
*/
|
104 |
+
init: function init(node, userOptions) {
|
105 |
+
var self = this;
|
106 |
+
|
107 |
+
self.userOptions = userOptions;
|
108 |
+
|
109 |
+
self.$body = $('body'),
|
110 |
+
self.$node = $(node),
|
111 |
+
self.$window = $(window);
|
112 |
+
|
113 |
+
// Setup event defaults with the reference to this
|
114 |
+
self.defaults.events = {
|
115 |
+
'onReady' : function (e) {
|
116 |
+
self.onPlayerReady(e);
|
117 |
+
|
118 |
+
// setup up pause on scroll
|
119 |
+
if ( self.options.pauseOnScroll ) {
|
120 |
+
self.pauseOnScroll();
|
121 |
+
}
|
122 |
+
|
123 |
+
// Callback for when finished
|
124 |
+
if ( typeof self.options.callback == 'function' ) {
|
125 |
+
self.options.callback.call(this);
|
126 |
+
}
|
127 |
+
},
|
128 |
+
'onStateChange': function (e) {
|
129 |
+
if ( e.data === 1 ) {
|
130 |
+
|
131 |
+
self.$node.find('img').fadeOut(400);
|
132 |
+
self.$node.addClass('loaded');
|
133 |
+
} else if ( e.data === 0 && self.options.repeat ) { // video ended and repeat option is set true
|
134 |
+
self.player.seekTo(self.options.start);
|
135 |
+
}
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
|
140 |
+
self.options = $.extend(true, {}, self.defaults, self.userOptions);
|
141 |
+
self.options.height = Math.ceil(self.options.width / self.options.ratio);
|
142 |
+
self.ID = (new Date()).getTime();
|
143 |
+
self.holderID = 'YTPlayer-ID-' + self.ID;
|
144 |
+
|
145 |
+
if ( self.options.fitToBackground ) {
|
146 |
+
self.createBackgroundVideo();
|
147 |
+
} else {
|
148 |
+
self.createContainerVideo();
|
149 |
+
}
|
150 |
+
// Listen for Resize Event
|
151 |
+
self.$window.on('resize.YTplayer' + self.ID, function () {
|
152 |
+
self.resize(self);
|
153 |
+
});
|
154 |
+
|
155 |
+
loadAPI(self.onYouTubeIframeAPIReady.bind(self));
|
156 |
+
|
157 |
+
self.resize(self);
|
158 |
+
|
159 |
+
return self;
|
160 |
+
},
|
161 |
+
|
162 |
+
|
163 |
+
/**
|
164 |
+
* @function pauseOnScroll
|
165 |
+
* Adds window events to pause video on scroll.
|
166 |
+
*/
|
167 |
+
pauseOnScroll : function pauseOnScroll() {
|
168 |
+
var self = this;
|
169 |
+
self.$window.on('scroll.YTplayer' + self.ID, function () {
|
170 |
+
var state = self.player.getPlayerState();
|
171 |
+
if ( state === 1 ) {
|
172 |
+
self.player.pauseVideo();
|
173 |
+
}
|
174 |
+
});
|
175 |
+
self.$window.scrollStopped(function () {
|
176 |
+
var state = self.player.getPlayerState();
|
177 |
+
if ( state === 2 ) {
|
178 |
+
self.player.playVideo();
|
179 |
+
}
|
180 |
+
});
|
181 |
+
},
|
182 |
+
/**
|
183 |
+
* @function createContainerVideo
|
184 |
+
* Adds HTML for video in a container
|
185 |
+
*/
|
186 |
+
createContainerVideo: function createContainerVideo() {
|
187 |
+
var self = this;
|
188 |
+
|
189 |
+
/*jshint multistr: true */
|
190 |
+
var $YTPlayerString = $('<div id="ytplayer-container' + self.ID + '" >\
|
191 |
+
<div id="' + self.holderID + '" class="ytplayer-player-inline"></div> \
|
192 |
+
</div> \
|
193 |
+
<div id="ytplayer-shield" class="ytplayer-shield"></div>');
|
194 |
+
|
195 |
+
self.$node.append($YTPlayerString);
|
196 |
+
self.$YTPlayerString = $YTPlayerString;
|
197 |
+
$YTPlayerString = null;
|
198 |
+
},
|
199 |
+
|
200 |
+
/**
|
201 |
+
* @function createBackgroundVideo
|
202 |
+
* Adds HTML for video background
|
203 |
+
*/
|
204 |
+
createBackgroundVideo: function createBackgroundVideo() {
|
205 |
+
/*jshint multistr: true */
|
206 |
+
var self = this,
|
207 |
+
$YTPlayerString = $('<div id="ytplayer-container' + self.ID + '" class="ytplayer-container background">\
|
208 |
+
<div id="' + self.holderID + '" class="ytplayer-player"></div>\
|
209 |
+
</div>\
|
210 |
+
<div id="ytplayer-shield" class="ytplayer-shield"></div>');
|
211 |
+
|
212 |
+
self.$node.append($YTPlayerString);
|
213 |
+
self.$YTPlayerString = $YTPlayerString;
|
214 |
+
$YTPlayerString = null;
|
215 |
+
},
|
216 |
+
|
217 |
+
/**
|
218 |
+
* @function resize
|
219 |
+
* Resize event to change video size
|
220 |
+
*/
|
221 |
+
resize: function resize(self) {
|
222 |
+
//var self = this;
|
223 |
+
var container = $(window);
|
224 |
+
|
225 |
+
if ( !self.options.fitToBackground ) {
|
226 |
+
container = self.$node;
|
227 |
+
}
|
228 |
+
|
229 |
+
var width = container.width(),
|
230 |
+
pWidth, // player width, to be defined
|
231 |
+
height = container.height(),
|
232 |
+
pHeight, // player height, tbd
|
233 |
+
$YTPlayerPlayer = $('#' + self.holderID);
|
234 |
+
|
235 |
+
// when screen aspect ratio differs from video, video must center and underlay one dimension
|
236 |
+
if ( width / self.options.ratio < height ) {
|
237 |
+
pWidth = Math.ceil(height * self.options.ratio); // get new player width
|
238 |
+
$YTPlayerPlayer.width(pWidth).height(height).css({
|
239 |
+
left: (width - pWidth) / 2,
|
240 |
+
top : 0
|
241 |
+
}); // player width is greater, offset left; reset top
|
242 |
+
} else { // new video width < window width (gap to right)
|
243 |
+
pHeight = Math.ceil(width / self.options.ratio); // get new player height
|
244 |
+
$YTPlayerPlayer.width(width).height(pHeight).css({
|
245 |
+
left: 0,
|
246 |
+
top : (height - pHeight) / 2
|
247 |
+
}); // player height is greater, offset top; reset left
|
248 |
+
}
|
249 |
+
|
250 |
+
$YTPlayerPlayer = null;
|
251 |
+
container = null;
|
252 |
+
},
|
253 |
+
|
254 |
+
/**
|
255 |
+
* @function onYouTubeIframeAPIReady
|
256 |
+
* @ params {object} YTPlayer object for access to options
|
257 |
+
* Youtube API calls this function when the player is ready.
|
258 |
+
*/
|
259 |
+
onYouTubeIframeAPIReady: function onYouTubeIframeAPIReady() {
|
260 |
+
var self = this;
|
261 |
+
self.player = new window.YT.Player(self.holderID, self.options);
|
262 |
+
},
|
263 |
+
|
264 |
+
/**
|
265 |
+
* @function onPlayerReady
|
266 |
+
* @ params {event} window event from youtube player
|
267 |
+
*/
|
268 |
+
onPlayerReady: function onPlayerReady(e) {
|
269 |
+
if ( this.options.mute ) {
|
270 |
+
e.target.mute();
|
271 |
+
}
|
272 |
+
if ( this.options.playerVars.autoplay ) {
|
273 |
+
e.target.playVideo();
|
274 |
+
}
|
275 |
+
$(document).trigger('YTBGREADY', {player: true});
|
276 |
+
},
|
277 |
+
|
278 |
+
/**
|
279 |
+
* @function getPlayer
|
280 |
+
* returns youtube player
|
281 |
+
*/
|
282 |
+
getPlayer: function getPlayer() {
|
283 |
+
return this.player;
|
284 |
+
},
|
285 |
+
|
286 |
+
/**
|
287 |
+
* @function destroy
|
288 |
+
* destroys all!
|
289 |
+
*/
|
290 |
+
destroy: function destroy() {
|
291 |
+
var self = this;
|
292 |
+
|
293 |
+
self.$node
|
294 |
+
.removeData('yt-init')
|
295 |
+
.removeData('ytPlayer')
|
296 |
+
.removeClass('loaded');
|
297 |
+
|
298 |
+
self.$YTPlayerString.remove();
|
299 |
+
|
300 |
+
$(window).off('resize.YTplayer' + self.ID);
|
301 |
+
$(window).off('scroll.YTplayer' + self.ID);
|
302 |
+
self.$body = null;
|
303 |
+
self.$node = null;
|
304 |
+
self.$YTPlayerString = null;
|
305 |
+
self.player.destroy();
|
306 |
+
self.player = null;
|
307 |
+
}
|
308 |
+
};
|
309 |
+
|
310 |
+
// Scroll Stopped event.
|
311 |
+
$.fn.scrollStopped = function (callback) {
|
312 |
+
var $this = $(this), self = this;
|
313 |
+
$this.on('scroll', function () {
|
314 |
+
if ( $this.data('scrollTimeout') ) {
|
315 |
+
clearTimeout($this.data('scrollTimeout'));
|
316 |
+
}
|
317 |
+
$this.data('scrollTimeout', setTimeout(callback, 250, self));
|
318 |
+
});
|
319 |
+
};
|
320 |
+
|
321 |
+
// Create plugin
|
322 |
+
$.fn.YTPlayer = function (options) {
|
323 |
+
|
324 |
+
return this.each(function () {
|
325 |
+
var el = this;
|
326 |
+
|
327 |
+
$(el).data("yt-init", true);
|
328 |
+
var player = Object.create(YTPlayer);
|
329 |
+
player.init(el, options);
|
330 |
+
$.data(el, "ytPlayer", player);
|
331 |
+
});
|
332 |
+
};
|
333 |
+
|
334 |
+
})(jQuery, window, document);
|
assets/js/vendor/player.js
CHANGED
@@ -1,2119 +1,2119 @@
|
|
1 |
-
/*! @vimeo/player v2.6.1 | (c) 2018 Vimeo | MIT License | https://github.com/vimeo/player.js */
|
2 |
-
(function (global, factory) {
|
3 |
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
4 |
-
typeof define === 'function' && define.amd ? define(factory) :
|
5 |
-
(global.Vimeo = global.Vimeo || {}, global.Vimeo.Player = factory());
|
6 |
-
}(this, (function () { 'use strict';
|
7 |
-
|
8 |
-
/**
|
9 |
-
* @module lib/functions
|
10 |
-
*/
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Check to see this is a node environment.
|
14 |
-
* @type {Boolean}
|
15 |
-
*/
|
16 |
-
/* global global */
|
17 |
-
var isNode = typeof global !== 'undefined' && {}.toString.call(global) === '[object global]';
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Get the name of the method for a given getter or setter.
|
21 |
-
*
|
22 |
-
* @param {string} prop The name of the property.
|
23 |
-
* @param {string} type Either “get” or “set”.
|
24 |
-
* @return {string}
|
25 |
-
*/
|
26 |
-
function getMethodName(prop, type) {
|
27 |
-
if (prop.indexOf(type.toLowerCase()) === 0) {
|
28 |
-
return prop;
|
29 |
-
}
|
30 |
-
|
31 |
-
return '' + type.toLowerCase() + prop.substr(0, 1).toUpperCase() + prop.substr(1);
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Check to see if the object is a DOM Element.
|
36 |
-
*
|
37 |
-
* @param {*} element The object to check.
|
38 |
-
* @return {boolean}
|
39 |
-
*/
|
40 |
-
function isDomElement(element) {
|
41 |
-
return element instanceof window.HTMLElement;
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Check to see whether the value is a number.
|
46 |
-
*
|
47 |
-
* @see http://dl.dropboxusercontent.com/u/35146/js/tests/isNumber.html
|
48 |
-
* @param {*} value The value to check.
|
49 |
-
* @param {boolean} integer Check if the value is an integer.
|
50 |
-
* @return {boolean}
|
51 |
-
*/
|
52 |
-
function isInteger(value) {
|
53 |
-
// eslint-disable-next-line eqeqeq
|
54 |
-
return !isNaN(parseFloat(value)) && isFinite(value) && Math.floor(value) == value;
|
55 |
-
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Check to see if the URL is a Vimeo url.
|
59 |
-
*
|
60 |
-
* @param {string} url The url string.
|
61 |
-
* @return {boolean}
|
62 |
-
*/
|
63 |
-
function isVimeoUrl(url) {
|
64 |
-
return (/^(https?:)?\/\/((player|www).)?vimeo.com(?=$|\/)/.test(url)
|
65 |
-
);
|
66 |
-
}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Get the Vimeo URL from an element.
|
70 |
-
* The element must have either a data-vimeo-id or data-vimeo-url attribute.
|
71 |
-
*
|
72 |
-
* @param {object} oEmbedParameters The oEmbed parameters.
|
73 |
-
* @return {string}
|
74 |
-
*/
|
75 |
-
function getVimeoUrl() {
|
76 |
-
var oEmbedParameters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
77 |
-
|
78 |
-
var id = oEmbedParameters.id;
|
79 |
-
var url = oEmbedParameters.url;
|
80 |
-
var idOrUrl = id || url;
|
81 |
-
|
82 |
-
if (!idOrUrl) {
|
83 |
-
throw new Error('An id or url must be passed, either in an options object or as a data-vimeo-id or data-vimeo-url attribute.');
|
84 |
-
}
|
85 |
-
|
86 |
-
if (isInteger(idOrUrl)) {
|
87 |
-
return 'https://vimeo.com/' + idOrUrl;
|
88 |
-
}
|
89 |
-
|
90 |
-
if (isVimeoUrl(idOrUrl)) {
|
91 |
-
return idOrUrl.replace('http:', 'https:');
|
92 |
-
}
|
93 |
-
|
94 |
-
if (id) {
|
95 |
-
throw new TypeError('\u201C' + id + '\u201D is not a valid video id.');
|
96 |
-
}
|
97 |
-
|
98 |
-
throw new TypeError('\u201C' + idOrUrl + '\u201D is not a vimeo.com url.');
|
99 |
-
}
|
100 |
-
|
101 |
-
var arrayIndexOfSupport = typeof Array.prototype.indexOf !== 'undefined';
|
102 |
-
var postMessageSupport = typeof window !== 'undefined' && typeof window.postMessage !== 'undefined';
|
103 |
-
|
104 |
-
if (!isNode && (!arrayIndexOfSupport || !postMessageSupport)) {
|
105 |
-
throw new Error('Sorry, the Vimeo Player API is not available in this browser.');
|
106 |
-
}
|
107 |
-
|
108 |
-
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
function createCommonjsModule(fn, module) {
|
115 |
-
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
116 |
-
}
|
117 |
-
|
118 |
-
var index = createCommonjsModule(function (module, exports) {
|
119 |
-
(function (exports) {
|
120 |
-
'use strict';
|
121 |
-
//shared pointer
|
122 |
-
|
123 |
-
var i;
|
124 |
-
//shortcuts
|
125 |
-
var defineProperty = Object.defineProperty,
|
126 |
-
is = function is(a, b) {
|
127 |
-
return a === b || a !== a && b !== b;
|
128 |
-
};
|
129 |
-
|
130 |
-
//Polyfill global objects
|
131 |
-
if (typeof WeakMap == 'undefined') {
|
132 |
-
exports.WeakMap = createCollection({
|
133 |
-
// WeakMap#delete(key:void*):boolean
|
134 |
-
'delete': sharedDelete,
|
135 |
-
// WeakMap#clear():
|
136 |
-
clear: sharedClear,
|
137 |
-
// WeakMap#get(key:void*):void*
|
138 |
-
get: sharedGet,
|
139 |
-
// WeakMap#has(key:void*):boolean
|
140 |
-
has: mapHas,
|
141 |
-
// WeakMap#set(key:void*, value:void*):void
|
142 |
-
set: sharedSet
|
143 |
-
}, true);
|
144 |
-
}
|
145 |
-
|
146 |
-
if (typeof Map == 'undefined' || typeof new Map().values !== 'function' || !new Map().values().next) {
|
147 |
-
exports.Map = createCollection({
|
148 |
-
// WeakMap#delete(key:void*):boolean
|
149 |
-
'delete': sharedDelete,
|
150 |
-
//:was Map#get(key:void*[, d3fault:void*]):void*
|
151 |
-
// Map#has(key:void*):boolean
|
152 |
-
has: mapHas,
|
153 |
-
// Map#get(key:void*):boolean
|
154 |
-
get: sharedGet,
|
155 |
-
// Map#set(key:void*, value:void*):void
|
156 |
-
set: sharedSet,
|
157 |
-
// Map#keys(void):Iterator
|
158 |
-
keys: sharedKeys,
|
159 |
-
// Map#values(void):Iterator
|
160 |
-
values: sharedValues,
|
161 |
-
// Map#entries(void):Iterator
|
162 |
-
entries: mapEntries,
|
163 |
-
// Map#forEach(callback:Function, context:void*):void ==> callback.call(context, key, value, mapObject) === not in specs`
|
164 |
-
forEach: sharedForEach,
|
165 |
-
// Map#clear():
|
166 |
-
clear: sharedClear
|
167 |
-
});
|
168 |
-
}
|
169 |
-
|
170 |
-
if (typeof Set == 'undefined' || typeof new Set().values !== 'function' || !new Set().values().next) {
|
171 |
-
exports.Set = createCollection({
|
172 |
-
// Set#has(value:void*):boolean
|
173 |
-
has: setHas,
|
174 |
-
// Set#add(value:void*):boolean
|
175 |
-
add: sharedAdd,
|
176 |
-
// Set#delete(key:void*):boolean
|
177 |
-
'delete': sharedDelete,
|
178 |
-
// Set#clear():
|
179 |
-
clear: sharedClear,
|
180 |
-
// Set#keys(void):Iterator
|
181 |
-
keys: sharedValues, // specs actually say "the same function object as the initial value of the values property"
|
182 |
-
// Set#values(void):Iterator
|
183 |
-
values: sharedValues,
|
184 |
-
// Set#entries(void):Iterator
|
185 |
-
entries: setEntries,
|
186 |
-
// Set#forEach(callback:Function, context:void*):void ==> callback.call(context, value, index) === not in specs
|
187 |
-
forEach: sharedForEach
|
188 |
-
});
|
189 |
-
}
|
190 |
-
|
191 |
-
if (typeof WeakSet == 'undefined') {
|
192 |
-
exports.WeakSet = createCollection({
|
193 |
-
// WeakSet#delete(key:void*):boolean
|
194 |
-
'delete': sharedDelete,
|
195 |
-
// WeakSet#add(value:void*):boolean
|
196 |
-
add: sharedAdd,
|
197 |
-
// WeakSet#clear():
|
198 |
-
clear: sharedClear,
|
199 |
-
// WeakSet#has(value:void*):boolean
|
200 |
-
has: setHas
|
201 |
-
}, true);
|
202 |
-
}
|
203 |
-
|
204 |
-
/**
|
205 |
-
* ES6 collection constructor
|
206 |
-
* @return {Function} a collection class
|
207 |
-
*/
|
208 |
-
function createCollection(proto, objectOnly) {
|
209 |
-
function Collection(a) {
|
210 |
-
if (!this || this.constructor !== Collection) return new Collection(a);
|
211 |
-
this._keys = [];
|
212 |
-
this._values = [];
|
213 |
-
this._itp = []; // iteration pointers
|
214 |
-
this.objectOnly = objectOnly;
|
215 |
-
|
216 |
-
//parse initial iterable argument passed
|
217 |
-
if (a) init.call(this, a);
|
218 |
-
}
|
219 |
-
|
220 |
-
//define size for non object-only collections
|
221 |
-
if (!objectOnly) {
|
222 |
-
defineProperty(proto, 'size', {
|
223 |
-
get: sharedSize
|
224 |
-
});
|
225 |
-
}
|
226 |
-
|
227 |
-
//set prototype
|
228 |
-
proto.constructor = Collection;
|
229 |
-
Collection.prototype = proto;
|
230 |
-
|
231 |
-
return Collection;
|
232 |
-
}
|
233 |
-
|
234 |
-
/** parse initial iterable argument passed */
|
235 |
-
function init(a) {
|
236 |
-
var i;
|
237 |
-
//init Set argument, like `[1,2,3,{}]`
|
238 |
-
if (this.add) a.forEach(this.add, this);
|
239 |
-
//init Map argument like `[[1,2], [{}, 4]]`
|
240 |
-
else a.forEach(function (a) {
|
241 |
-
this.set(a[0], a[1]);
|
242 |
-
}, this);
|
243 |
-
}
|
244 |
-
|
245 |
-
/** delete */
|
246 |
-
function sharedDelete(key) {
|
247 |
-
if (this.has(key)) {
|
248 |
-
this._keys.splice(i, 1);
|
249 |
-
this._values.splice(i, 1);
|
250 |
-
// update iteration pointers
|
251 |
-
this._itp.forEach(function (p) {
|
252 |
-
if (i < p[0]) p[0]--;
|
253 |
-
});
|
254 |
-
}
|
255 |
-
// Aurora here does it while Canary doesn't
|
256 |
-
return -1 < i;
|
257 |
-
}
|
258 |
-
|
259 |
-
function sharedGet(key) {
|
260 |
-
return this.has(key) ? this._values[i] : undefined;
|
261 |
-
}
|
262 |
-
|
263 |
-
function has(list, key) {
|
264 |
-
if (this.objectOnly && key !== Object(key)) throw new TypeError("Invalid value used as weak collection key");
|
265 |
-
//NaN or 0 passed
|
266 |
-
if (key != key || key === 0) for (i = list.length; i-- && !is(list[i], key);) {} else i = list.indexOf(key);
|
267 |
-
return -1 < i;
|
268 |
-
}
|
269 |
-
|
270 |
-
function setHas(value) {
|
271 |
-
return has.call(this, this._values, value);
|
272 |
-
}
|
273 |
-
|
274 |
-
function mapHas(value) {
|
275 |
-
return has.call(this, this._keys, value);
|
276 |
-
}
|
277 |
-
|
278 |
-
/** @chainable */
|
279 |
-
function sharedSet(key, value) {
|
280 |
-
this.has(key) ? this._values[i] = value : this._values[this._keys.push(key) - 1] = value;
|
281 |
-
return this;
|
282 |
-
}
|
283 |
-
|
284 |
-
/** @chainable */
|
285 |
-
function sharedAdd(value) {
|
286 |
-
if (!this.has(value)) this._values.push(value);
|
287 |
-
return this;
|
288 |
-
}
|
289 |
-
|
290 |
-
function sharedClear() {
|
291 |
-
(this._keys || 0).length = this._values.length = 0;
|
292 |
-
}
|
293 |
-
|
294 |
-
/** keys, values, and iterate related methods */
|
295 |
-
function sharedKeys() {
|
296 |
-
return sharedIterator(this._itp, this._keys);
|
297 |
-
}
|
298 |
-
|
299 |
-
function sharedValues() {
|
300 |
-
return sharedIterator(this._itp, this._values);
|
301 |
-
}
|
302 |
-
|
303 |
-
function mapEntries() {
|
304 |
-
return sharedIterator(this._itp, this._keys, this._values);
|
305 |
-
}
|
306 |
-
|
307 |
-
function setEntries() {
|
308 |
-
return sharedIterator(this._itp, this._values, this._values);
|
309 |
-
}
|
310 |
-
|
311 |
-
function sharedIterator(itp, array, array2) {
|
312 |
-
var p = [0],
|
313 |
-
done = false;
|
314 |
-
itp.push(p);
|
315 |
-
return {
|
316 |
-
next: function next() {
|
317 |
-
var v,
|
318 |
-
k = p[0];
|
319 |
-
if (!done && k < array.length) {
|
320 |
-
v = array2 ? [array[k], array2[k]] : array[k];
|
321 |
-
p[0]++;
|
322 |
-
} else {
|
323 |
-
done = true;
|
324 |
-
itp.splice(itp.indexOf(p), 1);
|
325 |
-
}
|
326 |
-
return { done: done, value: v };
|
327 |
-
}
|
328 |
-
};
|
329 |
-
}
|
330 |
-
|
331 |
-
function sharedSize() {
|
332 |
-
return this._values.length;
|
333 |
-
}
|
334 |
-
|
335 |
-
function sharedForEach(callback, context) {
|
336 |
-
var it = this.entries();
|
337 |
-
for (;;) {
|
338 |
-
var r = it.next();
|
339 |
-
if (r.done) break;
|
340 |
-
callback.call(context, r.value[1], r.value[0], this);
|
341 |
-
}
|
342 |
-
}
|
343 |
-
})('object' != 'undefined' && typeof commonjsGlobal != 'undefined' ? commonjsGlobal : window);
|
344 |
-
});
|
345 |
-
|
346 |
-
var npo_src = createCommonjsModule(function (module) {
|
347 |
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
348 |
-
|
349 |
-
/*! Native Promise Only
|
350 |
-
v0.8.1 (c) Kyle Simpson
|
351 |
-
MIT License: http://getify.mit-license.org
|
352 |
-
*/
|
353 |
-
|
354 |
-
(function UMD(name, context, definition) {
|
355 |
-
// special form of UMD for polyfilling across evironments
|
356 |
-
context[name] = context[name] || definition();
|
357 |
-
if ('object' != "undefined" && module.exports) {
|
358 |
-
module.exports = context[name];
|
359 |
-
} else if (typeof undefined == "function" && undefined.amd) {
|
360 |
-
undefined(function $AMD$() {
|
361 |
-
return context[name];
|
362 |
-
});
|
363 |
-
}
|
364 |
-
})("Promise", typeof commonjsGlobal != "undefined" ? commonjsGlobal : commonjsGlobal, function DEF() {
|
365 |
-
/*jshint validthis:true */
|
366 |
-
"use strict";
|
367 |
-
|
368 |
-
var builtInProp,
|
369 |
-
cycle,
|
370 |
-
scheduling_queue,
|
371 |
-
ToString = Object.prototype.toString,
|
372 |
-
timer = typeof setImmediate != "undefined" ? function timer(fn) {
|
373 |
-
return setImmediate(fn);
|
374 |
-
} : setTimeout;
|
375 |
-
|
376 |
-
// dammit, IE8.
|
377 |
-
try {
|
378 |
-
Object.defineProperty({}, "x", {});
|
379 |
-
builtInProp = function builtInProp(obj, name, val, config) {
|
380 |
-
return Object.defineProperty(obj, name, {
|
381 |
-
value: val,
|
382 |
-
writable: true,
|
383 |
-
configurable: config !== false
|
384 |
-
});
|
385 |
-
};
|
386 |
-
} catch (err) {
|
387 |
-
builtInProp = function builtInProp(obj, name, val) {
|
388 |
-
obj[name] = val;
|
389 |
-
return obj;
|
390 |
-
};
|
391 |
-
}
|
392 |
-
|
393 |
-
// Note: using a queue instead of array for efficiency
|
394 |
-
scheduling_queue = function Queue() {
|
395 |
-
var first, last, item;
|
396 |
-
|
397 |
-
function Item(fn, self) {
|
398 |
-
this.fn = fn;
|
399 |
-
this.self = self;
|
400 |
-
this.next = void 0;
|
401 |
-
}
|
402 |
-
|
403 |
-
return {
|
404 |
-
add: function add(fn, self) {
|
405 |
-
item = new Item(fn, self);
|
406 |
-
if (last) {
|
407 |
-
last.next = item;
|
408 |
-
} else {
|
409 |
-
first = item;
|
410 |
-
}
|
411 |
-
last = item;
|
412 |
-
item = void 0;
|
413 |
-
},
|
414 |
-
drain: function drain() {
|
415 |
-
var f = first;
|
416 |
-
first = last = cycle = void 0;
|
417 |
-
|
418 |
-
while (f) {
|
419 |
-
f.fn.call(f.self);
|
420 |
-
f = f.next;
|
421 |
-
}
|
422 |
-
}
|
423 |
-
};
|
424 |
-
}();
|
425 |
-
|
426 |
-
function schedule(fn, self) {
|
427 |
-
scheduling_queue.add(fn, self);
|
428 |
-
if (!cycle) {
|
429 |
-
cycle = timer(scheduling_queue.drain);
|
430 |
-
}
|
431 |
-
}
|
432 |
-
|
433 |
-
// promise duck typing
|
434 |
-
function isThenable(o) {
|
435 |
-
var _then,
|
436 |
-
o_type = typeof o === "undefined" ? "undefined" : _typeof(o);
|
437 |
-
|
438 |
-
if (o != null && (o_type == "object" || o_type == "function")) {
|
439 |
-
_then = o.then;
|
440 |
-
}
|
441 |
-
return typeof _then == "function" ? _then : false;
|
442 |
-
}
|
443 |
-
|
444 |
-
function notify() {
|
445 |
-
for (var i = 0; i < this.chain.length; i++) {
|
446 |
-
notifyIsolated(this, this.state === 1 ? this.chain[i].success : this.chain[i].failure, this.chain[i]);
|
447 |
-
}
|
448 |
-
this.chain.length = 0;
|
449 |
-
}
|
450 |
-
|
451 |
-
// NOTE: This is a separate function to isolate
|
452 |
-
// the `try..catch` so that other code can be
|
453 |
-
// optimized better
|
454 |
-
function notifyIsolated(self, cb, chain) {
|
455 |
-
var ret, _then;
|
456 |
-
try {
|
457 |
-
if (cb === false) {
|
458 |
-
chain.reject(self.msg);
|
459 |
-
} else {
|
460 |
-
if (cb === true) {
|
461 |
-
ret = self.msg;
|
462 |
-
} else {
|
463 |
-
ret = cb.call(void 0, self.msg);
|
464 |
-
}
|
465 |
-
|
466 |
-
if (ret === chain.promise) {
|
467 |
-
chain.reject(TypeError("Promise-chain cycle"));
|
468 |
-
} else if (_then = isThenable(ret)) {
|
469 |
-
_then.call(ret, chain.resolve, chain.reject);
|
470 |
-
} else {
|
471 |
-
chain.resolve(ret);
|
472 |
-
}
|
473 |
-
}
|
474 |
-
} catch (err) {
|
475 |
-
chain.reject(err);
|
476 |
-
}
|
477 |
-
}
|
478 |
-
|
479 |
-
function resolve(msg) {
|
480 |
-
var _then,
|
481 |
-
self = this;
|
482 |
-
|
483 |
-
// already triggered?
|
484 |
-
if (self.triggered) {
|
485 |
-
return;
|
486 |
-
}
|
487 |
-
|
488 |
-
self.triggered = true;
|
489 |
-
|
490 |
-
// unwrap
|
491 |
-
if (self.def) {
|
492 |
-
self = self.def;
|
493 |
-
}
|
494 |
-
|
495 |
-
try {
|
496 |
-
if (_then = isThenable(msg)) {
|
497 |
-
schedule(function () {
|
498 |
-
var def_wrapper = new MakeDefWrapper(self);
|
499 |
-
try {
|
500 |
-
_then.call(msg, function $resolve$() {
|
501 |
-
resolve.apply(def_wrapper, arguments);
|
502 |
-
}, function $reject$() {
|
503 |
-
reject.apply(def_wrapper, arguments);
|
504 |
-
});
|
505 |
-
} catch (err) {
|
506 |
-
reject.call(def_wrapper, err);
|
507 |
-
}
|
508 |
-
});
|
509 |
-
} else {
|
510 |
-
self.msg = msg;
|
511 |
-
self.state = 1;
|
512 |
-
if (self.chain.length > 0) {
|
513 |
-
schedule(notify, self);
|
514 |
-
}
|
515 |
-
}
|
516 |
-
} catch (err) {
|
517 |
-
reject.call(new MakeDefWrapper(self), err);
|
518 |
-
}
|
519 |
-
}
|
520 |
-
|
521 |
-
function reject(msg) {
|
522 |
-
var self = this;
|
523 |
-
|
524 |
-
// already triggered?
|
525 |
-
if (self.triggered) {
|
526 |
-
return;
|
527 |
-
}
|
528 |
-
|
529 |
-
self.triggered = true;
|
530 |
-
|
531 |
-
// unwrap
|
532 |
-
if (self.def) {
|
533 |
-
self = self.def;
|
534 |
-
}
|
535 |
-
|
536 |
-
self.msg = msg;
|
537 |
-
self.state = 2;
|
538 |
-
if (self.chain.length > 0) {
|
539 |
-
schedule(notify, self);
|
540 |
-
}
|
541 |
-
}
|
542 |
-
|
543 |
-
function iteratePromises(Constructor, arr, resolver, rejecter) {
|
544 |
-
for (var idx = 0; idx < arr.length; idx++) {
|
545 |
-
(function IIFE(idx) {
|
546 |
-
Constructor.resolve(arr[idx]).then(function $resolver$(msg) {
|
547 |
-
resolver(idx, msg);
|
548 |
-
}, rejecter);
|
549 |
-
})(idx);
|
550 |
-
}
|
551 |
-
}
|
552 |
-
|
553 |
-
function MakeDefWrapper(self) {
|
554 |
-
this.def = self;
|
555 |
-
this.triggered = false;
|
556 |
-
}
|
557 |
-
|
558 |
-
function MakeDef(self) {
|
559 |
-
this.promise = self;
|
560 |
-
this.state = 0;
|
561 |
-
this.triggered = false;
|
562 |
-
this.chain = [];
|
563 |
-
this.msg = void 0;
|
564 |
-
}
|
565 |
-
|
566 |
-
function Promise(executor) {
|
567 |
-
if (typeof executor != "function") {
|
568 |
-
throw TypeError("Not a function");
|
569 |
-
}
|
570 |
-
|
571 |
-
if (this.__NPO__ !== 0) {
|
572 |
-
throw TypeError("Not a promise");
|
573 |
-
}
|
574 |
-
|
575 |
-
// instance shadowing the inherited "brand"
|
576 |
-
// to signal an already "initialized" promise
|
577 |
-
this.__NPO__ = 1;
|
578 |
-
|
579 |
-
var def = new MakeDef(this);
|
580 |
-
|
581 |
-
this["then"] = function then(success, failure) {
|
582 |
-
var o = {
|
583 |
-
success: typeof success == "function" ? success : true,
|
584 |
-
failure: typeof failure == "function" ? failure : false
|
585 |
-
};
|
586 |
-
// Note: `then(..)` itself can be borrowed to be used against
|
587 |
-
// a different promise constructor for making the chained promise,
|
588 |
-
// by substituting a different `this` binding.
|
589 |
-
o.promise = new this.constructor(function extractChain(resolve, reject) {
|
590 |
-
if (typeof resolve != "function" || typeof reject != "function") {
|
591 |
-
throw TypeError("Not a function");
|
592 |
-
}
|
593 |
-
|
594 |
-
o.resolve = resolve;
|
595 |
-
o.reject = reject;
|
596 |
-
});
|
597 |
-
def.chain.push(o);
|
598 |
-
|
599 |
-
if (def.state !== 0) {
|
600 |
-
schedule(notify, def);
|
601 |
-
}
|
602 |
-
|
603 |
-
return o.promise;
|
604 |
-
};
|
605 |
-
this["catch"] = function $catch$(failure) {
|
606 |
-
return this.then(void 0, failure);
|
607 |
-
};
|
608 |
-
|
609 |
-
try {
|
610 |
-
executor.call(void 0, function publicResolve(msg) {
|
611 |
-
resolve.call(def, msg);
|
612 |
-
}, function publicReject(msg) {
|
613 |
-
reject.call(def, msg);
|
614 |
-
});
|
615 |
-
} catch (err) {
|
616 |
-
reject.call(def, err);
|
617 |
-
}
|
618 |
-
}
|
619 |
-
|
620 |
-
var PromisePrototype = builtInProp({}, "constructor", Promise,
|
621 |
-
/*configurable=*/false);
|
622 |
-
|
623 |
-
// Note: Android 4 cannot use `Object.defineProperty(..)` here
|
624 |
-
Promise.prototype = PromisePrototype;
|
625 |
-
|
626 |
-
// built-in "brand" to signal an "uninitialized" promise
|
627 |
-
builtInProp(PromisePrototype, "__NPO__", 0,
|
628 |
-
/*configurable=*/false);
|
629 |
-
|
630 |
-
builtInProp(Promise, "resolve", function Promise$resolve(msg) {
|
631 |
-
var Constructor = this;
|
632 |
-
|
633 |
-
// spec mandated checks
|
634 |
-
// note: best "isPromise" check that's practical for now
|
635 |
-
if (msg && (typeof msg === "undefined" ? "undefined" : _typeof(msg)) == "object" && msg.__NPO__ === 1) {
|
636 |
-
return msg;
|
637 |
-
}
|
638 |
-
|
639 |
-
return new Constructor(function executor(resolve, reject) {
|
640 |
-
if (typeof resolve != "function" || typeof reject != "function") {
|
641 |
-
throw TypeError("Not a function");
|
642 |
-
}
|
643 |
-
|
644 |
-
resolve(msg);
|
645 |
-
});
|
646 |
-
});
|
647 |
-
|
648 |
-
builtInProp(Promise, "reject", function Promise$reject(msg) {
|
649 |
-
return new this(function executor(resolve, reject) {
|
650 |
-
if (typeof resolve != "function" || typeof reject != "function") {
|
651 |
-
throw TypeError("Not a function");
|
652 |
-
}
|
653 |
-
|
654 |
-
reject(msg);
|
655 |
-
});
|
656 |
-
});
|
657 |
-
|
658 |
-
builtInProp(Promise, "all", function Promise$all(arr) {
|
659 |
-
var Constructor = this;
|
660 |
-
|
661 |
-
// spec mandated checks
|
662 |
-
if (ToString.call(arr) != "[object Array]") {
|
663 |
-
return Constructor.reject(TypeError("Not an array"));
|
664 |
-
}
|
665 |
-
if (arr.length === 0) {
|
666 |
-
return Constructor.resolve([]);
|
667 |
-
}
|
668 |
-
|
669 |
-
return new Constructor(function executor(resolve, reject) {
|
670 |
-
if (typeof resolve != "function" || typeof reject != "function") {
|
671 |
-
throw TypeError("Not a function");
|
672 |
-
}
|
673 |
-
|
674 |
-
var len = arr.length,
|
675 |
-
msgs = Array(len),
|
676 |
-
count = 0;
|
677 |
-
|
678 |
-
iteratePromises(Constructor, arr, function resolver(idx, msg) {
|
679 |
-
msgs[idx] = msg;
|
680 |
-
if (++count === len) {
|
681 |
-
resolve(msgs);
|
682 |
-
}
|
683 |
-
}, reject);
|
684 |
-
});
|
685 |
-
});
|
686 |
-
|
687 |
-
builtInProp(Promise, "race", function Promise$race(arr) {
|
688 |
-
var Constructor = this;
|
689 |
-
|
690 |
-
// spec mandated checks
|
691 |
-
if (ToString.call(arr) != "[object Array]") {
|
692 |
-
return Constructor.reject(TypeError("Not an array"));
|
693 |
-
}
|
694 |
-
|
695 |
-
return new Constructor(function executor(resolve, reject) {
|
696 |
-
if (typeof resolve != "function" || typeof reject != "function") {
|
697 |
-
throw TypeError("Not a function");
|
698 |
-
}
|
699 |
-
|
700 |
-
iteratePromises(Constructor, arr, function resolver(idx, msg) {
|
701 |
-
resolve(msg);
|
702 |
-
}, reject);
|
703 |
-
});
|
704 |
-
});
|
705 |
-
|
706 |
-
return Promise;
|
707 |
-
});
|
708 |
-
});
|
709 |
-
|
710 |
-
/**
|
711 |
-
* @module lib/callbacks
|
712 |
-
*/
|
713 |
-
|
714 |
-
var callbackMap = new WeakMap();
|
715 |
-
|
716 |
-
/**
|
717 |
-
* Store a callback for a method or event for a player.
|
718 |
-
*
|
719 |
-
* @param {Player} player The player object.
|
720 |
-
* @param {string} name The method or event name.
|
721 |
-
* @param {(function(this:Player, *): void|{resolve: function, reject: function})} callback
|
722 |
-
* The callback to call or an object with resolve and reject functions for a promise.
|
723 |
-
* @return {void}
|
724 |
-
*/
|
725 |
-
function storeCallback(player, name, callback) {
|
726 |
-
var playerCallbacks = callbackMap.get(player.element) || {};
|
727 |
-
|
728 |
-
if (!(name in playerCallbacks)) {
|
729 |
-
playerCallbacks[name] = [];
|
730 |
-
}
|
731 |
-
|
732 |
-
playerCallbacks[name].push(callback);
|
733 |
-
callbackMap.set(player.element, playerCallbacks);
|
734 |
-
}
|
735 |
-
|
736 |
-
/**
|
737 |
-
* Get the callbacks for a player and event or method.
|
738 |
-
*
|
739 |
-
* @param {Player} player The player object.
|
740 |
-
* @param {string} name The method or event name
|
741 |
-
* @return {function[]}
|
742 |
-
*/
|
743 |
-
function getCallbacks(player, name) {
|
744 |
-
var playerCallbacks = callbackMap.get(player.element) || {};
|
745 |
-
return playerCallbacks[name] || [];
|
746 |
-
}
|
747 |
-
|
748 |
-
/**
|
749 |
-
* Remove a stored callback for a method or event for a player.
|
750 |
-
*
|
751 |
-
* @param {Player} player The player object.
|
752 |
-
* @param {string} name The method or event name
|
753 |
-
* @param {function} [callback] The specific callback to remove.
|
754 |
-
* @return {boolean} Was this the last callback?
|
755 |
-
*/
|
756 |
-
function removeCallback(player, name, callback) {
|
757 |
-
var playerCallbacks = callbackMap.get(player.element) || {};
|
758 |
-
|
759 |
-
if (!playerCallbacks[name]) {
|
760 |
-
return true;
|
761 |
-
}
|
762 |
-
|
763 |
-
// If no callback is passed, remove all callbacks for the event
|
764 |
-
if (!callback) {
|
765 |
-
playerCallbacks[name] = [];
|
766 |
-
callbackMap.set(player.element, playerCallbacks);
|
767 |
-
|
768 |
-
return true;
|
769 |
-
}
|
770 |
-
|
771 |
-
var index = playerCallbacks[name].indexOf(callback);
|
772 |
-
|
773 |
-
if (index !== -1) {
|
774 |
-
playerCallbacks[name].splice(index, 1);
|
775 |
-
}
|
776 |
-
|
777 |
-
callbackMap.set(player.element, playerCallbacks);
|
778 |
-
return playerCallbacks[name] && playerCallbacks[name].length === 0;
|
779 |
-
}
|
780 |
-
|
781 |
-
/**
|
782 |
-
* Return the first stored callback for a player and event or method.
|
783 |
-
*
|
784 |
-
* @param {Player} player The player object.
|
785 |
-
* @param {string} name The method or event name.
|
786 |
-
* @return {function} The callback, or false if there were none
|
787 |
-
*/
|
788 |
-
function shiftCallbacks(player, name) {
|
789 |
-
var playerCallbacks = getCallbacks(player, name);
|
790 |
-
|
791 |
-
if (playerCallbacks.length < 1) {
|
792 |
-
return false;
|
793 |
-
}
|
794 |
-
|
795 |
-
var callback = playerCallbacks.shift();
|
796 |
-
removeCallback(player, name, callback);
|
797 |
-
return callback;
|
798 |
-
}
|
799 |
-
|
800 |
-
/**
|
801 |
-
* Move callbacks associated with an element to another element.
|
802 |
-
*
|
803 |
-
* @param {HTMLElement} oldElement The old element.
|
804 |
-
* @param {HTMLElement} newElement The new element.
|
805 |
-
* @return {void}
|
806 |
-
*/
|
807 |
-
function swapCallbacks(oldElement, newElement) {
|
808 |
-
var playerCallbacks = callbackMap.get(oldElement);
|
809 |
-
|
810 |
-
callbackMap.set(newElement, playerCallbacks);
|
811 |
-
callbackMap.delete(oldElement);
|
812 |
-
}
|
813 |
-
|
814 |
-
/**
|
815 |
-
* @module lib/embed
|
816 |
-
*/
|
817 |
-
|
818 |
-
var oEmbedParameters = ['autopause', 'autoplay', 'background', 'byline', 'color', 'height', 'id', 'loop', 'maxheight', 'maxwidth', 'muted', 'playsinline', 'portrait', 'responsive', 'speed', 'title', 'transparent', 'url', 'width'];
|
819 |
-
|
820 |
-
/**
|
821 |
-
* Get the 'data-vimeo'-prefixed attributes from an element as an object.
|
822 |
-
*
|
823 |
-
* @param {HTMLElement} element The element.
|
824 |
-
* @param {Object} [defaults={}] The default values to use.
|
825 |
-
* @return {Object<string, string>}
|
826 |
-
*/
|
827 |
-
function getOEmbedParameters(element) {
|
828 |
-
var defaults = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
829 |
-
|
830 |
-
return oEmbedParameters.reduce(function (params, param) {
|
831 |
-
var value = element.getAttribute('data-vimeo-' + param);
|
832 |
-
|
833 |
-
if (value || value === '') {
|
834 |
-
params[param] = value === '' ? 1 : value;
|
835 |
-
}
|
836 |
-
|
837 |
-
return params;
|
838 |
-
}, defaults);
|
839 |
-
}
|
840 |
-
|
841 |
-
/**
|
842 |
-
* Make an oEmbed call for the specified URL.
|
843 |
-
*
|
844 |
-
* @param {string} videoUrl The vimeo.com url for the video.
|
845 |
-
* @param {Object} [params] Parameters to pass to oEmbed.
|
846 |
-
* @return {Promise}
|
847 |
-
*/
|
848 |
-
function getOEmbedData(videoUrl) {
|
849 |
-
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
850 |
-
|
851 |
-
return new Promise(function (resolve, reject) {
|
852 |
-
if (!isVimeoUrl(videoUrl)) {
|
853 |
-
throw new TypeError('\u201C' + videoUrl + '\u201D is not a vimeo.com url.');
|
854 |
-
}
|
855 |
-
|
856 |
-
var url = 'https://vimeo.com/api/oembed.json?url=' + encodeURIComponent(videoUrl);
|
857 |
-
|
858 |
-
for (var param in params) {
|
859 |
-
if (params.hasOwnProperty(param)) {
|
860 |
-
url += '&' + param + '=' + encodeURIComponent(params[param]);
|
861 |
-
}
|
862 |
-
}
|
863 |
-
|
864 |
-
var xhr = 'XDomainRequest' in window ? new XDomainRequest() : new XMLHttpRequest();
|
865 |
-
xhr.open('GET', url, true);
|
866 |
-
|
867 |
-
xhr.onload = function () {
|
868 |
-
if (xhr.status === 404) {
|
869 |
-
reject(new Error('\u201C' + videoUrl + '\u201D was not found.'));
|
870 |
-
return;
|
871 |
-
}
|
872 |
-
|
873 |
-
if (xhr.status === 403) {
|
874 |
-
reject(new Error('\u201C' + videoUrl + '\u201D is not embeddable.'));
|
875 |
-
return;
|
876 |
-
}
|
877 |
-
|
878 |
-
try {
|
879 |
-
var json = JSON.parse(xhr.responseText);
|
880 |
-
resolve(json);
|
881 |
-
} catch (error) {
|
882 |
-
reject(error);
|
883 |
-
}
|
884 |
-
};
|
885 |
-
|
886 |
-
xhr.onerror = function () {
|
887 |
-
var status = xhr.status ? ' (' + xhr.status + ')' : '';
|
888 |
-
reject(new Error('There was an error fetching the embed code from Vimeo' + status + '.'));
|
889 |
-
};
|
890 |
-
|
891 |
-
xhr.send();
|
892 |
-
});
|
893 |
-
}
|
894 |
-
|
895 |
-
/**
|
896 |
-
* Create an embed from oEmbed data inside an element.
|
897 |
-
*
|
898 |
-
* @param {object} data The oEmbed data.
|
899 |
-
* @param {HTMLElement} element The element to put the iframe in.
|
900 |
-
* @return {HTMLIFrameElement} The iframe embed.
|
901 |
-
*/
|
902 |
-
function createEmbed(_ref, element) {
|
903 |
-
var html = _ref.html;
|
904 |
-
|
905 |
-
if (!element) {
|
906 |
-
throw new TypeError('An element must be provided');
|
907 |
-
}
|
908 |
-
|
909 |
-
if (element.getAttribute('data-vimeo-initialized') !== null) {
|
910 |
-
return element.querySelector('iframe');
|
911 |
-
}
|
912 |
-
|
913 |
-
var div = document.createElement('div');
|
914 |
-
div.innerHTML = html;
|
915 |
-
|
916 |
-
element.appendChild(div.firstChild);
|
917 |
-
element.setAttribute('data-vimeo-initialized', 'true');
|
918 |
-
|
919 |
-
return element.querySelector('iframe');
|
920 |
-
}
|
921 |
-
|
922 |
-
/**
|
923 |
-
* Initialize all embeds within a specific element
|
924 |
-
*
|
925 |
-
* @param {HTMLElement} [parent=document] The parent element.
|
926 |
-
* @return {void}
|
927 |
-
*/
|
928 |
-
function initializeEmbeds() {
|
929 |
-
var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
930 |
-
|
931 |
-
var elements = [].slice.call(parent.querySelectorAll('[data-vimeo-id], [data-vimeo-url]'));
|
932 |
-
|
933 |
-
var handleError = function handleError(error) {
|
934 |
-
if ('console' in window && console.error) {
|
935 |
-
console.error('There was an error creating an embed: ' + error);
|
936 |
-
}
|
937 |
-
};
|
938 |
-
|
939 |
-
elements.forEach(function (element) {
|
940 |
-
try {
|
941 |
-
// Skip any that have data-vimeo-defer
|
942 |
-
if (element.getAttribute('data-vimeo-defer') !== null) {
|
943 |
-
return;
|
944 |
-
}
|
945 |
-
|
946 |
-
var params = getOEmbedParameters(element);
|
947 |
-
var url = getVimeoUrl(params);
|
948 |
-
|
949 |
-
getOEmbedData(url, params).then(function (data) {
|
950 |
-
return createEmbed(data, element);
|
951 |
-
}).catch(handleError);
|
952 |
-
} catch (error) {
|
953 |
-
handleError(error);
|
954 |
-
}
|
955 |
-
});
|
956 |
-
}
|
957 |
-
|
958 |
-
/**
|
959 |
-
* Resize embeds when messaged by the player.
|
960 |
-
*
|
961 |
-
* @param {HTMLElement} [parent=document] The parent element.
|
962 |
-
* @return {void}
|
963 |
-
*/
|
964 |
-
function resizeEmbeds() {
|
965 |
-
var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
966 |
-
|
967 |
-
var onMessage = function onMessage(event) {
|
968 |
-
if (!isVimeoUrl(event.origin)) {
|
969 |
-
return;
|
970 |
-
}
|
971 |
-
|
972 |
-
// 'spacechange' is fired only on embeds with cards
|
973 |
-
if (!event.data || event.data.event !== 'spacechange') {
|
974 |
-
return;
|
975 |
-
}
|
976 |
-
|
977 |
-
var iframes = parent.querySelectorAll('iframe');
|
978 |
-
|
979 |
-
for (var i = 0; i < iframes.length; i++) {
|
980 |
-
if (iframes[i].contentWindow !== event.source) {
|
981 |
-
continue;
|
982 |
-
}
|
983 |
-
|
984 |
-
// Change padding-bottom of the enclosing div to accommodate
|
985 |
-
// card carousel without distorting aspect ratio
|
986 |
-
var space = iframes[i].parentElement;
|
987 |
-
space.style.paddingBottom = event.data.data[0].bottom + 'px';
|
988 |
-
|
989 |
-
break;
|
990 |
-
}
|
991 |
-
};
|
992 |
-
|
993 |
-
if (window.addEventListener) {
|
994 |
-
window.addEventListener('message', onMessage, false);
|
995 |
-
} else if (window.attachEvent) {
|
996 |
-
window.attachEvent('onmessage', onMessage);
|
997 |
-
}
|
998 |
-
}
|
999 |
-
|
1000 |
-
/**
|
1001 |
-
* @module lib/postmessage
|
1002 |
-
*/
|
1003 |
-
|
1004 |
-
/**
|
1005 |
-
* Parse a message received from postMessage.
|
1006 |
-
*
|
1007 |
-
* @param {*} data The data received from postMessage.
|
1008 |
-
* @return {object}
|
1009 |
-
*/
|
1010 |
-
function parseMessageData(data) {
|
1011 |
-
if (typeof data === 'string') {
|
1012 |
-
data = JSON.parse(data);
|
1013 |
-
}
|
1014 |
-
|
1015 |
-
return data;
|
1016 |
-
}
|
1017 |
-
|
1018 |
-
/**
|
1019 |
-
* Post a message to the specified target.
|
1020 |
-
*
|
1021 |
-
* @param {Player} player The player object to use.
|
1022 |
-
* @param {string} method The API method to call.
|
1023 |
-
* @param {object} params The parameters to send to the player.
|
1024 |
-
* @return {void}
|
1025 |
-
*/
|
1026 |
-
function postMessage(player, method, params) {
|
1027 |
-
if (!player.element.contentWindow || !player.element.contentWindow.postMessage) {
|
1028 |
-
return;
|
1029 |
-
}
|
1030 |
-
|
1031 |
-
var message = {
|
1032 |
-
method: method
|
1033 |
-
};
|
1034 |
-
|
1035 |
-
if (params !== undefined) {
|
1036 |
-
message.value = params;
|
1037 |
-
}
|
1038 |
-
|
1039 |
-
// IE 8 and 9 do not support passing messages, so stringify them
|
1040 |
-
var ieVersion = parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/, '$1'));
|
1041 |
-
if (ieVersion >= 8 && ieVersion < 10) {
|
1042 |
-
message = JSON.stringify(message);
|
1043 |
-
}
|
1044 |
-
|
1045 |
-
player.element.contentWindow.postMessage(message, player.origin);
|
1046 |
-
}
|
1047 |
-
|
1048 |
-
/**
|
1049 |
-
* Parse the data received from a message event.
|
1050 |
-
*
|
1051 |
-
* @param {Player} player The player that received the message.
|
1052 |
-
* @param {(Object|string)} data The message data. Strings will be parsed into JSON.
|
1053 |
-
* @return {void}
|
1054 |
-
*/
|
1055 |
-
function processData(player, data) {
|
1056 |
-
data = parseMessageData(data);
|
1057 |
-
var callbacks = [];
|
1058 |
-
var param = void 0;
|
1059 |
-
|
1060 |
-
if (data.event) {
|
1061 |
-
if (data.event === 'error') {
|
1062 |
-
var promises = getCallbacks(player, data.data.method);
|
1063 |
-
|
1064 |
-
promises.forEach(function (promise) {
|
1065 |
-
var error = new Error(data.data.message);
|
1066 |
-
error.name = data.data.name;
|
1067 |
-
|
1068 |
-
promise.reject(error);
|
1069 |
-
removeCallback(player, data.data.method, promise);
|
1070 |
-
});
|
1071 |
-
}
|
1072 |
-
|
1073 |
-
callbacks = getCallbacks(player, 'event:' + data.event);
|
1074 |
-
param = data.data;
|
1075 |
-
} else if (data.method) {
|
1076 |
-
var callback = shiftCallbacks(player, data.method);
|
1077 |
-
|
1078 |
-
if (callback) {
|
1079 |
-
callbacks.push(callback);
|
1080 |
-
param = data.value;
|
1081 |
-
}
|
1082 |
-
}
|
1083 |
-
|
1084 |
-
callbacks.forEach(function (callback) {
|
1085 |
-
try {
|
1086 |
-
if (typeof callback === 'function') {
|
1087 |
-
callback.call(player, param);
|
1088 |
-
return;
|
1089 |
-
}
|
1090 |
-
|
1091 |
-
callback.resolve(param);
|
1092 |
-
} catch (e) {
|
1093 |
-
// empty
|
1094 |
-
}
|
1095 |
-
});
|
1096 |
-
}
|
1097 |
-
|
1098 |
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
1099 |
-
|
1100 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
1101 |
-
|
1102 |
-
var playerMap = new WeakMap();
|
1103 |
-
var readyMap = new WeakMap();
|
1104 |
-
|
1105 |
-
var Player = function () {
|
1106 |
-
/**
|
1107 |
-
* Create a Player.
|
1108 |
-
*
|
1109 |
-
* @param {(HTMLIFrameElement|HTMLElement|string|jQuery)} element A reference to the Vimeo
|
1110 |
-
* player iframe, and id, or a jQuery object.
|
1111 |
-
* @param {object} [options] oEmbed parameters to use when creating an embed in the element.
|
1112 |
-
* @return {Player}
|
1113 |
-
*/
|
1114 |
-
function Player(element) {
|
1115 |
-
var _this = this;
|
1116 |
-
|
1117 |
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
1118 |
-
|
1119 |
-
_classCallCheck(this, Player);
|
1120 |
-
|
1121 |
-
/* global jQuery */
|
1122 |
-
if (window.jQuery && element instanceof jQuery) {
|
1123 |
-
if (element.length > 1 && window.console && console.warn) {
|
1124 |
-
console.warn('A jQuery object with multiple elements was passed, using the first element.');
|
1125 |
-
}
|
1126 |
-
|
1127 |
-
element = element[0];
|
1128 |
-
}
|
1129 |
-
|
1130 |
-
// Find an element by ID
|
1131 |
-
if (typeof document !== 'undefined' && typeof element === 'string') {
|
1132 |
-
element = document.getElementById(element);
|
1133 |
-
}
|
1134 |
-
|
1135 |
-
// Not an element!
|
1136 |
-
if (!isDomElement(element)) {
|
1137 |
-
throw new TypeError('You must pass either a valid element or a valid id.');
|
1138 |
-
}
|
1139 |
-
|
1140 |
-
// Already initialized an embed in this div, so grab the iframe
|
1141 |
-
if (element.nodeName !== 'IFRAME') {
|
1142 |
-
var iframe = element.querySelector('iframe');
|
1143 |
-
|
1144 |
-
if (iframe) {
|
1145 |
-
element = iframe;
|
1146 |
-
}
|
1147 |
-
}
|
1148 |
-
|
1149 |
-
// iframe url is not a Vimeo url
|
1150 |
-
if (element.nodeName === 'IFRAME' && !isVimeoUrl(element.getAttribute('src') || '')) {
|
1151 |
-
throw new Error('The player element passed isn’t a Vimeo embed.');
|
1152 |
-
}
|
1153 |
-
|
1154 |
-
// If there is already a player object in the map, return that
|
1155 |
-
if (playerMap.has(element)) {
|
1156 |
-
return playerMap.get(element);
|
1157 |
-
}
|
1158 |
-
|
1159 |
-
this.element = element;
|
1160 |
-
this.origin = '*';
|
1161 |
-
|
1162 |
-
var readyPromise = new npo_src(function (resolve, reject) {
|
1163 |
-
var onMessage = function onMessage(event) {
|
1164 |
-
if (!isVimeoUrl(event.origin) || _this.element.contentWindow !== event.source) {
|
1165 |
-
return;
|
1166 |
-
}
|
1167 |
-
|
1168 |
-
if (_this.origin === '*') {
|
1169 |
-
_this.origin = event.origin;
|
1170 |
-
}
|
1171 |
-
|
1172 |
-
var data = parseMessageData(event.data);
|
1173 |
-
var isReadyEvent = 'event' in data && data.event === 'ready';
|
1174 |
-
var isPingResponse = 'method' in data && data.method === 'ping';
|
1175 |
-
|
1176 |
-
if (isReadyEvent || isPingResponse) {
|
1177 |
-
_this.element.setAttribute('data-ready', 'true');
|
1178 |
-
resolve();
|
1179 |
-
return;
|
1180 |
-
}
|
1181 |
-
|
1182 |
-
processData(_this, data);
|
1183 |
-
};
|
1184 |
-
|
1185 |
-
if (window.addEventListener) {
|
1186 |
-
window.addEventListener('message', onMessage, false);
|
1187 |
-
} else if (window.attachEvent) {
|
1188 |
-
window.attachEvent('onmessage', onMessage);
|
1189 |
-
}
|
1190 |
-
|
1191 |
-
if (_this.element.nodeName !== 'IFRAME') {
|
1192 |
-
var params = getOEmbedParameters(element, options);
|
1193 |
-
var url = getVimeoUrl(params);
|
1194 |
-
|
1195 |
-
getOEmbedData(url, params).then(function (data) {
|
1196 |
-
var iframe = createEmbed(data, element);
|
1197 |
-
// Overwrite element with the new iframe,
|
1198 |
-
// but store reference to the original element
|
1199 |
-
_this.element = iframe;
|
1200 |
-
_this._originalElement = element;
|
1201 |
-
|
1202 |
-
swapCallbacks(element, iframe);
|
1203 |
-
playerMap.set(_this.element, _this);
|
1204 |
-
|
1205 |
-
return data;
|
1206 |
-
}).catch(function (error) {
|
1207 |
-
return reject(error);
|
1208 |
-
});
|
1209 |
-
}
|
1210 |
-
});
|
1211 |
-
|
1212 |
-
// Store a copy of this Player in the map
|
1213 |
-
readyMap.set(this, readyPromise);
|
1214 |
-
playerMap.set(this.element, this);
|
1215 |
-
|
1216 |
-
// Send a ping to the iframe so the ready promise will be resolved if
|
1217 |
-
// the player is already ready.
|
1218 |
-
if (this.element.nodeName === 'IFRAME') {
|
1219 |
-
postMessage(this, 'ping');
|
1220 |
-
}
|
1221 |
-
|
1222 |
-
return this;
|
1223 |
-
}
|
1224 |
-
|
1225 |
-
/**
|
1226 |
-
* Get a promise for a method.
|
1227 |
-
*
|
1228 |
-
* @param {string} name The API method to call.
|
1229 |
-
* @param {Object} [args={}] Arguments to send via postMessage.
|
1230 |
-
* @return {Promise}
|
1231 |
-
*/
|
1232 |
-
|
1233 |
-
|
1234 |
-
_createClass(Player, [{
|
1235 |
-
key: 'callMethod',
|
1236 |
-
value: function callMethod(name) {
|
1237 |
-
var _this2 = this;
|
1238 |
-
|
1239 |
-
var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
1240 |
-
|
1241 |
-
return new npo_src(function (resolve, reject) {
|
1242 |
-
// We are storing the resolve/reject handlers to call later, so we
|
1243 |
-
// can’t return here.
|
1244 |
-
// eslint-disable-next-line promise/always-return
|
1245 |
-
return _this2.ready().then(function () {
|
1246 |
-
storeCallback(_this2, name, {
|
1247 |
-
resolve: resolve,
|
1248 |
-
reject: reject
|
1249 |
-
});
|
1250 |
-
|
1251 |
-
postMessage(_this2, name, args);
|
1252 |
-
}).catch(function (error) {
|
1253 |
-
reject(error);
|
1254 |
-
});
|
1255 |
-
});
|
1256 |
-
}
|
1257 |
-
|
1258 |
-
/**
|
1259 |
-
* Get a promise for the value of a player property.
|
1260 |
-
*
|
1261 |
-
* @param {string} name The property name
|
1262 |
-
* @return {Promise}
|
1263 |
-
*/
|
1264 |
-
|
1265 |
-
}, {
|
1266 |
-
key: 'get',
|
1267 |
-
value: function get(name) {
|
1268 |
-
var _this3 = this;
|
1269 |
-
|
1270 |
-
return new npo_src(function (resolve, reject) {
|
1271 |
-
name = getMethodName(name, 'get');
|
1272 |
-
|
1273 |
-
// We are storing the resolve/reject handlers to call later, so we
|
1274 |
-
// can’t return here.
|
1275 |
-
// eslint-disable-next-line promise/always-return
|
1276 |
-
return _this3.ready().then(function () {
|
1277 |
-
storeCallback(_this3, name, {
|
1278 |
-
resolve: resolve,
|
1279 |
-
reject: reject
|
1280 |
-
});
|
1281 |
-
|
1282 |
-
postMessage(_this3, name);
|
1283 |
-
});
|
1284 |
-
});
|
1285 |
-
}
|
1286 |
-
|
1287 |
-
/**
|
1288 |
-
* Get a promise for setting the value of a player property.
|
1289 |
-
*
|
1290 |
-
* @param {string} name The API method to call.
|
1291 |
-
* @param {mixed} value The value to set.
|
1292 |
-
* @return {Promise}
|
1293 |
-
*/
|
1294 |
-
|
1295 |
-
}, {
|
1296 |
-
key: 'set',
|
1297 |
-
value: function set(name, value) {
|
1298 |
-
var _this4 = this;
|
1299 |
-
|
1300 |
-
return npo_src.resolve(value).then(function (val) {
|
1301 |
-
name = getMethodName(name, 'set');
|
1302 |
-
|
1303 |
-
if (val === undefined || val === null) {
|
1304 |
-
throw new TypeError('There must be a value to set.');
|
1305 |
-
}
|
1306 |
-
|
1307 |
-
return _this4.ready().then(function () {
|
1308 |
-
return new npo_src(function (resolve, reject) {
|
1309 |
-
storeCallback(_this4, name, {
|
1310 |
-
resolve: resolve,
|
1311 |
-
reject: reject
|
1312 |
-
});
|
1313 |
-
|
1314 |
-
postMessage(_this4, name, val);
|
1315 |
-
});
|
1316 |
-
});
|
1317 |
-
});
|
1318 |
-
}
|
1319 |
-
|
1320 |
-
/**
|
1321 |
-
* Add an event listener for the specified event. Will call the
|
1322 |
-
* callback with a single parameter, `data`, that contains the data for
|
1323 |
-
* that event.
|
1324 |
-
*
|
1325 |
-
* @param {string} eventName The name of the event.
|
1326 |
-
* @param {function(*)} callback The function to call when the event fires.
|
1327 |
-
* @return {void}
|
1328 |
-
*/
|
1329 |
-
|
1330 |
-
}, {
|
1331 |
-
key: 'on',
|
1332 |
-
value: function on(eventName, callback) {
|
1333 |
-
if (!eventName) {
|
1334 |
-
throw new TypeError('You must pass an event name.');
|
1335 |
-
}
|
1336 |
-
|
1337 |
-
if (!callback) {
|
1338 |
-
throw new TypeError('You must pass a callback function.');
|
1339 |
-
}
|
1340 |
-
|
1341 |
-
if (typeof callback !== 'function') {
|
1342 |
-
throw new TypeError('The callback must be a function.');
|
1343 |
-
}
|
1344 |
-
|
1345 |
-
var callbacks = getCallbacks(this, 'event:' + eventName);
|
1346 |
-
if (callbacks.length === 0) {
|
1347 |
-
this.callMethod('addEventListener', eventName).catch(function () {
|
1348 |
-
// Ignore the error. There will be an error event fired that
|
1349 |
-
// will trigger the error callback if they are listening.
|
1350 |
-
});
|
1351 |
-
}
|
1352 |
-
|
1353 |
-
storeCallback(this, 'event:' + eventName, callback);
|
1354 |
-
}
|
1355 |
-
|
1356 |
-
/**
|
1357 |
-
* Remove an event listener for the specified event. Will remove all
|
1358 |
-
* listeners for that event if a `callback` isn’t passed, or only that
|
1359 |
-
* specific callback if it is passed.
|
1360 |
-
*
|
1361 |
-
* @param {string} eventName The name of the event.
|
1362 |
-
* @param {function} [callback] The specific callback to remove.
|
1363 |
-
* @return {void}
|
1364 |
-
*/
|
1365 |
-
|
1366 |
-
}, {
|
1367 |
-
key: 'off',
|
1368 |
-
value: function off(eventName, callback) {
|
1369 |
-
if (!eventName) {
|
1370 |
-
throw new TypeError('You must pass an event name.');
|
1371 |
-
}
|
1372 |
-
|
1373 |
-
if (callback && typeof callback !== 'function') {
|
1374 |
-
throw new TypeError('The callback must be a function.');
|
1375 |
-
}
|
1376 |
-
|
1377 |
-
var lastCallback = removeCallback(this, 'event:' + eventName, callback);
|
1378 |
-
|
1379 |
-
// If there are no callbacks left, remove the listener
|
1380 |
-
if (lastCallback) {
|
1381 |
-
this.callMethod('removeEventListener', eventName).catch(function (e) {
|
1382 |
-
// Ignore the error. There will be an error event fired that
|
1383 |
-
// will trigger the error callback if they are listening.
|
1384 |
-
});
|
1385 |
-
}
|
1386 |
-
}
|
1387 |
-
|
1388 |
-
/**
|
1389 |
-
* A promise to load a new video.
|
1390 |
-
*
|
1391 |
-
* @promise LoadVideoPromise
|
1392 |
-
* @fulfill {number} The video with this id successfully loaded.
|
1393 |
-
* @reject {TypeError} The id was not a number.
|
1394 |
-
*/
|
1395 |
-
/**
|
1396 |
-
* Load a new video into this embed. The promise will be resolved if
|
1397 |
-
* the video is successfully loaded, or it will be rejected if it could
|
1398 |
-
* not be loaded.
|
1399 |
-
*
|
1400 |
-
* @param {number} id The id of the video.
|
1401 |
-
* @return {LoadVideoPromise}
|
1402 |
-
*/
|
1403 |
-
|
1404 |
-
}, {
|
1405 |
-
key: 'loadVideo',
|
1406 |
-
value: function loadVideo(id) {
|
1407 |
-
return this.callMethod('loadVideo', id);
|
1408 |
-
}
|
1409 |
-
|
1410 |
-
/**
|
1411 |
-
* A promise to perform an action when the Player is ready.
|
1412 |
-
*
|
1413 |
-
* @todo document errors
|
1414 |
-
* @promise LoadVideoPromise
|
1415 |
-
* @fulfill {void}
|
1416 |
-
*/
|
1417 |
-
/**
|
1418 |
-
* Trigger a function when the player iframe has initialized. You do not
|
1419 |
-
* need to wait for `ready` to trigger to begin adding event listeners
|
1420 |
-
* or calling other methods.
|
1421 |
-
*
|
1422 |
-
* @return {ReadyPromise}
|
1423 |
-
*/
|
1424 |
-
|
1425 |
-
}, {
|
1426 |
-
key: 'ready',
|
1427 |
-
value: function ready() {
|
1428 |
-
var readyPromise = readyMap.get(this) || new npo_src(function (resolve, reject) {
|
1429 |
-
reject('Unknown player. Probably unloaded.');
|
1430 |
-
});
|
1431 |
-
return npo_src.resolve(readyPromise);
|
1432 |
-
}
|
1433 |
-
|
1434 |
-
/**
|
1435 |
-
* A promise to add a cue point to the player.
|
1436 |
-
*
|
1437 |
-
* @promise AddCuePointPromise
|
1438 |
-
* @fulfill {string} The id of the cue point to use for removeCuePoint.
|
1439 |
-
* @reject {RangeError} the time was less than 0 or greater than the
|
1440 |
-
* video’s duration.
|
1441 |
-
* @reject {UnsupportedError} Cue points are not supported with the current
|
1442 |
-
* player or browser.
|
1443 |
-
*/
|
1444 |
-
/**
|
1445 |
-
* Add a cue point to the player.
|
1446 |
-
*
|
1447 |
-
* @param {number} time The time for the cue point.
|
1448 |
-
* @param {object} [data] Arbitrary data to be returned with the cue point.
|
1449 |
-
* @return {AddCuePointPromise}
|
1450 |
-
*/
|
1451 |
-
|
1452 |
-
}, {
|
1453 |
-
key: 'addCuePoint',
|
1454 |
-
value: function addCuePoint(time) {
|
1455 |
-
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
1456 |
-
|
1457 |
-
return this.callMethod('addCuePoint', { time: time, data: data });
|
1458 |
-
}
|
1459 |
-
|
1460 |
-
/**
|
1461 |
-
* A promise to remove a cue point from the player.
|
1462 |
-
*
|
1463 |
-
* @promise AddCuePointPromise
|
1464 |
-
* @fulfill {string} The id of the cue point that was removed.
|
1465 |
-
* @reject {InvalidCuePoint} The cue point with the specified id was not
|
1466 |
-
* found.
|
1467 |
-
* @reject {UnsupportedError} Cue points are not supported with the current
|
1468 |
-
* player or browser.
|
1469 |
-
*/
|
1470 |
-
/**
|
1471 |
-
* Remove a cue point from the video.
|
1472 |
-
*
|
1473 |
-
* @param {string} id The id of the cue point to remove.
|
1474 |
-
* @return {RemoveCuePointPromise}
|
1475 |
-
*/
|
1476 |
-
|
1477 |
-
}, {
|
1478 |
-
key: 'removeCuePoint',
|
1479 |
-
value: function removeCuePoint(id) {
|
1480 |
-
return this.callMethod('removeCuePoint', id);
|
1481 |
-
}
|
1482 |
-
|
1483 |
-
/**
|
1484 |
-
* A representation of a text track on a video.
|
1485 |
-
*
|
1486 |
-
* @typedef {Object} VimeoTextTrack
|
1487 |
-
* @property {string} language The ISO language code.
|
1488 |
-
* @property {string} kind The kind of track it is (captions or subtitles).
|
1489 |
-
* @property {string} label The human‐readable label for the track.
|
1490 |
-
*/
|
1491 |
-
/**
|
1492 |
-
* A promise to enable a text track.
|
1493 |
-
*
|
1494 |
-
* @promise EnableTextTrackPromise
|
1495 |
-
* @fulfill {VimeoTextTrack} The text track that was enabled.
|
1496 |
-
* @reject {InvalidTrackLanguageError} No track was available with the
|
1497 |
-
* specified language.
|
1498 |
-
* @reject {InvalidTrackError} No track was available with the specified
|
1499 |
-
* language and kind.
|
1500 |
-
*/
|
1501 |
-
/**
|
1502 |
-
* Enable the text track with the specified language, and optionally the
|
1503 |
-
* specified kind (captions or subtitles).
|
1504 |
-
*
|
1505 |
-
* When set via the API, the track language will not change the viewer’s
|
1506 |
-
* stored preference.
|
1507 |
-
*
|
1508 |
-
* @param {string} language The two‐letter language code.
|
1509 |
-
* @param {string} [kind] The kind of track to enable (captions or subtitles).
|
1510 |
-
* @return {EnableTextTrackPromise}
|
1511 |
-
*/
|
1512 |
-
|
1513 |
-
}, {
|
1514 |
-
key: 'enableTextTrack',
|
1515 |
-
value: function enableTextTrack(language, kind) {
|
1516 |
-
if (!language) {
|
1517 |
-
throw new TypeError('You must pass a language.');
|
1518 |
-
}
|
1519 |
-
|
1520 |
-
return this.callMethod('enableTextTrack', {
|
1521 |
-
language: language,
|
1522 |
-
kind: kind
|
1523 |
-
});
|
1524 |
-
}
|
1525 |
-
|
1526 |
-
/**
|
1527 |
-
* A promise to disable the active text track.
|
1528 |
-
*
|
1529 |
-
* @promise DisableTextTrackPromise
|
1530 |
-
* @fulfill {void} The track was disabled.
|
1531 |
-
*/
|
1532 |
-
/**
|
1533 |
-
* Disable the currently-active text track.
|
1534 |
-
*
|
1535 |
-
* @return {DisableTextTrackPromise}
|
1536 |
-
*/
|
1537 |
-
|
1538 |
-
}, {
|
1539 |
-
key: 'disableTextTrack',
|
1540 |
-
value: function disableTextTrack() {
|
1541 |
-
return this.callMethod('disableTextTrack');
|
1542 |
-
}
|
1543 |
-
|
1544 |
-
/**
|
1545 |
-
* A promise to pause the video.
|
1546 |
-
*
|
1547 |
-
* @promise PausePromise
|
1548 |
-
* @fulfill {void} The video was paused.
|
1549 |
-
*/
|
1550 |
-
/**
|
1551 |
-
* Pause the video if it’s playing.
|
1552 |
-
*
|
1553 |
-
* @return {PausePromise}
|
1554 |
-
*/
|
1555 |
-
|
1556 |
-
}, {
|
1557 |
-
key: 'pause',
|
1558 |
-
value: function pause() {
|
1559 |
-
return this.callMethod('pause');
|
1560 |
-
}
|
1561 |
-
|
1562 |
-
/**
|
1563 |
-
* A promise to play the video.
|
1564 |
-
*
|
1565 |
-
* @promise PlayPromise
|
1566 |
-
* @fulfill {void} The video was played.
|
1567 |
-
*/
|
1568 |
-
/**
|
1569 |
-
* Play the video if it’s paused. **Note:** on iOS and some other
|
1570 |
-
* mobile devices, you cannot programmatically trigger play. Once the
|
1571 |
-
* viewer has tapped on the play button in the player, however, you
|
1572 |
-
* will be able to use this function.
|
1573 |
-
*
|
1574 |
-
* @return {PlayPromise}
|
1575 |
-
*/
|
1576 |
-
|
1577 |
-
}, {
|
1578 |
-
key: 'play',
|
1579 |
-
value: function play() {
|
1580 |
-
return this.callMethod('play');
|
1581 |
-
}
|
1582 |
-
|
1583 |
-
/**
|
1584 |
-
* A promise to unload the video.
|
1585 |
-
*
|
1586 |
-
* @promise UnloadPromise
|
1587 |
-
* @fulfill {void} The video was unloaded.
|
1588 |
-
*/
|
1589 |
-
/**
|
1590 |
-
* Return the player to its initial state.
|
1591 |
-
*
|
1592 |
-
* @return {UnloadPromise}
|
1593 |
-
*/
|
1594 |
-
|
1595 |
-
}, {
|
1596 |
-
key: 'unload',
|
1597 |
-
value: function unload() {
|
1598 |
-
return this.callMethod('unload');
|
1599 |
-
}
|
1600 |
-
|
1601 |
-
/**
|
1602 |
-
* Cleanup the player and remove it from the DOM
|
1603 |
-
*
|
1604 |
-
* It won't be usable and a new one should be constructed
|
1605 |
-
* in order to do any operations.
|
1606 |
-
*
|
1607 |
-
* @return {Promise}
|
1608 |
-
*/
|
1609 |
-
|
1610 |
-
}, {
|
1611 |
-
key: 'destroy',
|
1612 |
-
value: function destroy() {
|
1613 |
-
var _this5 = this;
|
1614 |
-
|
1615 |
-
return new npo_src(function (resolve) {
|
1616 |
-
readyMap.delete(_this5);
|
1617 |
-
playerMap.delete(_this5.element);
|
1618 |
-
if (_this5._originalElement) {
|
1619 |
-
playerMap.delete(_this5._originalElement);
|
1620 |
-
_this5._originalElement.removeAttribute('data-vimeo-initialized');
|
1621 |
-
}
|
1622 |
-
if (_this5.element && _this5.element.nodeName === 'IFRAME') {
|
1623 |
-
_this5.element.remove();
|
1624 |
-
}
|
1625 |
-
resolve();
|
1626 |
-
});
|
1627 |
-
}
|
1628 |
-
|
1629 |
-
/**
|
1630 |
-
* A promise to get the autopause behavior of the video.
|
1631 |
-
*
|
1632 |
-
* @promise GetAutopausePromise
|
1633 |
-
* @fulfill {boolean} Whether autopause is turned on or off.
|
1634 |
-
* @reject {UnsupportedError} Autopause is not supported with the current
|
1635 |
-
* player or browser.
|
1636 |
-
*/
|
1637 |
-
/**
|
1638 |
-
* Get the autopause behavior for this player.
|
1639 |
-
*
|
1640 |
-
* @return {GetAutopausePromise}
|
1641 |
-
*/
|
1642 |
-
|
1643 |
-
}, {
|
1644 |
-
key: 'getAutopause',
|
1645 |
-
value: function getAutopause() {
|
1646 |
-
return this.get('autopause');
|
1647 |
-
}
|
1648 |
-
|
1649 |
-
/**
|
1650 |
-
* A promise to set the autopause behavior of the video.
|
1651 |
-
*
|
1652 |
-
* @promise SetAutopausePromise
|
1653 |
-
* @fulfill {boolean} Whether autopause is turned on or off.
|
1654 |
-
* @reject {UnsupportedError} Autopause is not supported with the current
|
1655 |
-
* player or browser.
|
1656 |
-
*/
|
1657 |
-
/**
|
1658 |
-
* Enable or disable the autopause behavior of this player.
|
1659 |
-
*
|
1660 |
-
* By default, when another video is played in the same browser, this
|
1661 |
-
* player will automatically pause. Unless you have a specific reason
|
1662 |
-
* for doing so, we recommend that you leave autopause set to the
|
1663 |
-
* default (`true`).
|
1664 |
-
*
|
1665 |
-
* @param {boolean} autopause
|
1666 |
-
* @return {SetAutopausePromise}
|
1667 |
-
*/
|
1668 |
-
|
1669 |
-
}, {
|
1670 |
-
key: 'setAutopause',
|
1671 |
-
value: function setAutopause(autopause) {
|
1672 |
-
return this.set('autopause', autopause);
|
1673 |
-
}
|
1674 |
-
|
1675 |
-
/**
|
1676 |
-
* A promise to get the color of the player.
|
1677 |
-
*
|
1678 |
-
* @promise GetColorPromise
|
1679 |
-
* @fulfill {string} The hex color of the player.
|
1680 |
-
*/
|
1681 |
-
/**
|
1682 |
-
* Get the color for this player.
|
1683 |
-
*
|
1684 |
-
* @return {GetColorPromise}
|
1685 |
-
*/
|
1686 |
-
|
1687 |
-
}, {
|
1688 |
-
key: 'getColor',
|
1689 |
-
value: function getColor() {
|
1690 |
-
return this.get('color');
|
1691 |
-
}
|
1692 |
-
|
1693 |
-
/**
|
1694 |
-
* A promise to set the color of the player.
|
1695 |
-
*
|
1696 |
-
* @promise SetColorPromise
|
1697 |
-
* @fulfill {string} The color was successfully set.
|
1698 |
-
* @reject {TypeError} The string was not a valid hex or rgb color.
|
1699 |
-
* @reject {ContrastError} The color was set, but the contrast is
|
1700 |
-
* outside of the acceptable range.
|
1701 |
-
* @reject {EmbedSettingsError} The owner of the player has chosen to
|
1702 |
-
* use a specific color.
|
1703 |
-
*/
|
1704 |
-
/**
|
1705 |
-
* Set the color of this player to a hex or rgb string. Setting the
|
1706 |
-
* color may fail if the owner of the video has set their embed
|
1707 |
-
* preferences to force a specific color.
|
1708 |
-
*
|
1709 |
-
* @param {string} color The hex or rgb color string to set.
|
1710 |
-
* @return {SetColorPromise}
|
1711 |
-
*/
|
1712 |
-
|
1713 |
-
}, {
|
1714 |
-
key: 'setColor',
|
1715 |
-
value: function setColor(color) {
|
1716 |
-
return this.set('color', color);
|
1717 |
-
}
|
1718 |
-
|
1719 |
-
/**
|
1720 |
-
* A representation of a cue point.
|
1721 |
-
*
|
1722 |
-
* @typedef {Object} VimeoCuePoint
|
1723 |
-
* @property {number} time The time of the cue point.
|
1724 |
-
* @property {object} data The data passed when adding the cue point.
|
1725 |
-
* @property {string} id The unique id for use with removeCuePoint.
|
1726 |
-
*/
|
1727 |
-
/**
|
1728 |
-
* A promise to get the cue points of a video.
|
1729 |
-
*
|
1730 |
-
* @promise GetCuePointsPromise
|
1731 |
-
* @fulfill {VimeoCuePoint[]} The cue points added to the video.
|
1732 |
-
* @reject {UnsupportedError} Cue points are not supported with the current
|
1733 |
-
* player or browser.
|
1734 |
-
*/
|
1735 |
-
/**
|
1736 |
-
* Get an array of the cue points added to the video.
|
1737 |
-
*
|
1738 |
-
* @return {GetCuePointsPromise}
|
1739 |
-
*/
|
1740 |
-
|
1741 |
-
}, {
|
1742 |
-
key: 'getCuePoints',
|
1743 |
-
value: function getCuePoints() {
|
1744 |
-
return this.get('cuePoints');
|
1745 |
-
}
|
1746 |
-
|
1747 |
-
/**
|
1748 |
-
* A promise to get the current time of the video.
|
1749 |
-
*
|
1750 |
-
* @promise GetCurrentTimePromise
|
1751 |
-
* @fulfill {number} The current time in seconds.
|
1752 |
-
*/
|
1753 |
-
/**
|
1754 |
-
* Get the current playback position in seconds.
|
1755 |
-
*
|
1756 |
-
* @return {GetCurrentTimePromise}
|
1757 |
-
*/
|
1758 |
-
|
1759 |
-
}, {
|
1760 |
-
key: 'getCurrentTime',
|
1761 |
-
value: function getCurrentTime() {
|
1762 |
-
return this.get('currentTime');
|
1763 |
-
}
|
1764 |
-
|
1765 |
-
/**
|
1766 |
-
* A promise to set the current time of the video.
|
1767 |
-
*
|
1768 |
-
* @promise SetCurrentTimePromise
|
1769 |
-
* @fulfill {number} The actual current time that was set.
|
1770 |
-
* @reject {RangeError} the time was less than 0 or greater than the
|
1771 |
-
* video’s duration.
|
1772 |
-
*/
|
1773 |
-
/**
|
1774 |
-
* Set the current playback position in seconds. If the player was
|
1775 |
-
* paused, it will remain paused. Likewise, if the player was playing,
|
1776 |
-
* it will resume playing once the video has buffered.
|
1777 |
-
*
|
1778 |
-
* You can provide an accurate time and the player will attempt to seek
|
1779 |
-
* to as close to that time as possible. The exact time will be the
|
1780 |
-
* fulfilled value of the promise.
|
1781 |
-
*
|
1782 |
-
* @param {number} currentTime
|
1783 |
-
* @return {SetCurrentTimePromise}
|
1784 |
-
*/
|
1785 |
-
|
1786 |
-
}, {
|
1787 |
-
key: 'setCurrentTime',
|
1788 |
-
value: function setCurrentTime(currentTime) {
|
1789 |
-
return this.set('currentTime', currentTime);
|
1790 |
-
}
|
1791 |
-
|
1792 |
-
/**
|
1793 |
-
* A promise to get the duration of the video.
|
1794 |
-
*
|
1795 |
-
* @promise GetDurationPromise
|
1796 |
-
* @fulfill {number} The duration in seconds.
|
1797 |
-
*/
|
1798 |
-
/**
|
1799 |
-
* Get the duration of the video in seconds. It will be rounded to the
|
1800 |
-
* nearest second before playback begins, and to the nearest thousandth
|
1801 |
-
* of a second after playback begins.
|
1802 |
-
*
|
1803 |
-
* @return {GetDurationPromise}
|
1804 |
-
*/
|
1805 |
-
|
1806 |
-
}, {
|
1807 |
-
key: 'getDuration',
|
1808 |
-
value: function getDuration() {
|
1809 |
-
return this.get('duration');
|
1810 |
-
}
|
1811 |
-
|
1812 |
-
/**
|
1813 |
-
* A promise to get the ended state of the video.
|
1814 |
-
*
|
1815 |
-
* @promise GetEndedPromise
|
1816 |
-
* @fulfill {boolean} Whether or not the video has ended.
|
1817 |
-
*/
|
1818 |
-
/**
|
1819 |
-
* Get the ended state of the video. The video has ended if
|
1820 |
-
* `currentTime === duration`.
|
1821 |
-
*
|
1822 |
-
* @return {GetEndedPromise}
|
1823 |
-
*/
|
1824 |
-
|
1825 |
-
}, {
|
1826 |
-
key: 'getEnded',
|
1827 |
-
value: function getEnded() {
|
1828 |
-
return this.get('ended');
|
1829 |
-
}
|
1830 |
-
|
1831 |
-
/**
|
1832 |
-
* A promise to get the loop state of the player.
|
1833 |
-
*
|
1834 |
-
* @promise GetLoopPromise
|
1835 |
-
* @fulfill {boolean} Whether or not the player is set to loop.
|
1836 |
-
*/
|
1837 |
-
/**
|
1838 |
-
* Get the loop state of the player.
|
1839 |
-
*
|
1840 |
-
* @return {GetLoopPromise}
|
1841 |
-
*/
|
1842 |
-
|
1843 |
-
}, {
|
1844 |
-
key: 'getLoop',
|
1845 |
-
value: function getLoop() {
|
1846 |
-
return this.get('loop');
|
1847 |
-
}
|
1848 |
-
|
1849 |
-
/**
|
1850 |
-
* A promise to set the loop state of the player.
|
1851 |
-
*
|
1852 |
-
* @promise SetLoopPromise
|
1853 |
-
* @fulfill {boolean} The loop state that was set.
|
1854 |
-
*/
|
1855 |
-
/**
|
1856 |
-
* Set the loop state of the player. When set to `true`, the player
|
1857 |
-
* will start over immediately once playback ends.
|
1858 |
-
*
|
1859 |
-
* @param {boolean} loop
|
1860 |
-
* @return {SetLoopPromise}
|
1861 |
-
*/
|
1862 |
-
|
1863 |
-
}, {
|
1864 |
-
key: 'setLoop',
|
1865 |
-
value: function setLoop(loop) {
|
1866 |
-
return this.set('loop', loop);
|
1867 |
-
}
|
1868 |
-
|
1869 |
-
/**
|
1870 |
-
* A promise to get the paused state of the player.
|
1871 |
-
*
|
1872 |
-
* @promise GetLoopPromise
|
1873 |
-
* @fulfill {boolean} Whether or not the video is paused.
|
1874 |
-
*/
|
1875 |
-
/**
|
1876 |
-
* Get the paused state of the player.
|
1877 |
-
*
|
1878 |
-
* @return {GetLoopPromise}
|
1879 |
-
*/
|
1880 |
-
|
1881 |
-
}, {
|
1882 |
-
key: 'getPaused',
|
1883 |
-
value: function getPaused() {
|
1884 |
-
return this.get('paused');
|
1885 |
-
}
|
1886 |
-
|
1887 |
-
/**
|
1888 |
-
* A promise to get the playback rate of the player.
|
1889 |
-
*
|
1890 |
-
* @promise GetPlaybackRatePromise
|
1891 |
-
* @fulfill {number} The playback rate of the player on a scale from 0.5 to 2.
|
1892 |
-
*/
|
1893 |
-
/**
|
1894 |
-
* Get the playback rate of the player on a scale from `0.5` to `2`.
|
1895 |
-
*
|
1896 |
-
* @return {GetPlaybackRatePromise}
|
1897 |
-
*/
|
1898 |
-
|
1899 |
-
}, {
|
1900 |
-
key: 'getPlaybackRate',
|
1901 |
-
value: function getPlaybackRate() {
|
1902 |
-
return this.get('playbackRate');
|
1903 |
-
}
|
1904 |
-
|
1905 |
-
/**
|
1906 |
-
* A promise to set the playbackrate of the player.
|
1907 |
-
*
|
1908 |
-
* @promise SetPlaybackRatePromise
|
1909 |
-
* @fulfill {number} The playback rate was set.
|
1910 |
-
* @reject {RangeError} The playback rate was less than 0.5 or greater than 2.
|
1911 |
-
*/
|
1912 |
-
/**
|
1913 |
-
* Set the playback rate of the player on a scale from `0.5` to `2`. When set
|
1914 |
-
* via the API, the playback rate will not be synchronized to other
|
1915 |
-
* players or stored as the viewer's preference.
|
1916 |
-
*
|
1917 |
-
* @param {number} playbackRate
|
1918 |
-
* @return {SetPlaybackRatePromise}
|
1919 |
-
*/
|
1920 |
-
|
1921 |
-
}, {
|
1922 |
-
key: 'setPlaybackRate',
|
1923 |
-
value: function setPlaybackRate(playbackRate) {
|
1924 |
-
return this.set('playbackRate', playbackRate);
|
1925 |
-
}
|
1926 |
-
|
1927 |
-
/**
|
1928 |
-
* A promise to get the text tracks of a video.
|
1929 |
-
*
|
1930 |
-
* @promise GetTextTracksPromise
|
1931 |
-
* @fulfill {VimeoTextTrack[]} The text tracks associated with the video.
|
1932 |
-
*/
|
1933 |
-
/**
|
1934 |
-
* Get an array of the text tracks that exist for the video.
|
1935 |
-
*
|
1936 |
-
* @return {GetTextTracksPromise}
|
1937 |
-
*/
|
1938 |
-
|
1939 |
-
}, {
|
1940 |
-
key: 'getTextTracks',
|
1941 |
-
value: function getTextTracks() {
|
1942 |
-
return this.get('textTracks');
|
1943 |
-
}
|
1944 |
-
|
1945 |
-
/**
|
1946 |
-
* A promise to get the embed code for the video.
|
1947 |
-
*
|
1948 |
-
* @promise GetVideoEmbedCodePromise
|
1949 |
-
* @fulfill {string} The `<iframe>` embed code for the video.
|
1950 |
-
*/
|
1951 |
-
/**
|
1952 |
-
* Get the `<iframe>` embed code for the video.
|
1953 |
-
*
|
1954 |
-
* @return {GetVideoEmbedCodePromise}
|
1955 |
-
*/
|
1956 |
-
|
1957 |
-
}, {
|
1958 |
-
key: 'getVideoEmbedCode',
|
1959 |
-
value: function getVideoEmbedCode() {
|
1960 |
-
return this.get('videoEmbedCode');
|
1961 |
-
}
|
1962 |
-
|
1963 |
-
/**
|
1964 |
-
* A promise to get the id of the video.
|
1965 |
-
*
|
1966 |
-
* @promise GetVideoIdPromise
|
1967 |
-
* @fulfill {number} The id of the video.
|
1968 |
-
*/
|
1969 |
-
/**
|
1970 |
-
* Get the id of the video.
|
1971 |
-
*
|
1972 |
-
* @return {GetVideoIdPromise}
|
1973 |
-
*/
|
1974 |
-
|
1975 |
-
}, {
|
1976 |
-
key: 'getVideoId',
|
1977 |
-
value: function getVideoId() {
|
1978 |
-
return this.get('videoId');
|
1979 |
-
}
|
1980 |
-
|
1981 |
-
/**
|
1982 |
-
* A promise to get the title of the video.
|
1983 |
-
*
|
1984 |
-
* @promise GetVideoTitlePromise
|
1985 |
-
* @fulfill {number} The title of the video.
|
1986 |
-
*/
|
1987 |
-
/**
|
1988 |
-
* Get the title of the video.
|
1989 |
-
*
|
1990 |
-
* @return {GetVideoTitlePromise}
|
1991 |
-
*/
|
1992 |
-
|
1993 |
-
}, {
|
1994 |
-
key: 'getVideoTitle',
|
1995 |
-
value: function getVideoTitle() {
|
1996 |
-
return this.get('videoTitle');
|
1997 |
-
}
|
1998 |
-
|
1999 |
-
/**
|
2000 |
-
* A promise to get the native width of the video.
|
2001 |
-
*
|
2002 |
-
* @promise GetVideoWidthPromise
|
2003 |
-
* @fulfill {number} The native width of the video.
|
2004 |
-
*/
|
2005 |
-
/**
|
2006 |
-
* Get the native width of the currently‐playing video. The width of
|
2007 |
-
* the highest‐resolution available will be used before playback begins.
|
2008 |
-
*
|
2009 |
-
* @return {GetVideoWidthPromise}
|
2010 |
-
*/
|
2011 |
-
|
2012 |
-
}, {
|
2013 |
-
key: 'getVideoWidth',
|
2014 |
-
value: function getVideoWidth() {
|
2015 |
-
return this.get('videoWidth');
|
2016 |
-
}
|
2017 |
-
|
2018 |
-
/**
|
2019 |
-
* A promise to get the native height of the video.
|
2020 |
-
*
|
2021 |
-
* @promise GetVideoHeightPromise
|
2022 |
-
* @fulfill {number} The native height of the video.
|
2023 |
-
*/
|
2024 |
-
/**
|
2025 |
-
* Get the native height of the currently‐playing video. The height of
|
2026 |
-
* the highest‐resolution available will be used before playback begins.
|
2027 |
-
*
|
2028 |
-
* @return {GetVideoHeightPromise}
|
2029 |
-
*/
|
2030 |
-
|
2031 |
-
}, {
|
2032 |
-
key: 'getVideoHeight',
|
2033 |
-
value: function getVideoHeight() {
|
2034 |
-
return this.get('videoHeight');
|
2035 |
-
}
|
2036 |
-
|
2037 |
-
/**
|
2038 |
-
* A promise to get the vimeo.com url for the video.
|
2039 |
-
*
|
2040 |
-
* @promise GetVideoUrlPromise
|
2041 |
-
* @fulfill {number} The vimeo.com url for the video.
|
2042 |
-
* @reject {PrivacyError} The url isn’t available because of the video’s privacy setting.
|
2043 |
-
*/
|
2044 |
-
/**
|
2045 |
-
* Get the vimeo.com url for the video.
|
2046 |
-
*
|
2047 |
-
* @return {GetVideoUrlPromise}
|
2048 |
-
*/
|
2049 |
-
|
2050 |
-
}, {
|
2051 |
-
key: 'getVideoUrl',
|
2052 |
-
value: function getVideoUrl() {
|
2053 |
-
return this.get('videoUrl');
|
2054 |
-
}
|
2055 |
-
|
2056 |
-
/**
|
2057 |
-
* A promise to get the volume level of the player.
|
2058 |
-
*
|
2059 |
-
* @promise GetVolumePromise
|
2060 |
-
* @fulfill {number} The volume level of the player on a scale from 0 to 1.
|
2061 |
-
*/
|
2062 |
-
/**
|
2063 |
-
* Get the current volume level of the player on a scale from `0` to `1`.
|
2064 |
-
*
|
2065 |
-
* Most mobile devices do not support an independent volume from the
|
2066 |
-
* system volume. In those cases, this method will always return `1`.
|
2067 |
-
*
|
2068 |
-
* @return {GetVolumePromise}
|
2069 |
-
*/
|
2070 |
-
|
2071 |
-
}, {
|
2072 |
-
key: 'getVolume',
|
2073 |
-
value: function getVolume() {
|
2074 |
-
return this.get('volume');
|
2075 |
-
}
|
2076 |
-
|
2077 |
-
/**
|
2078 |
-
* A promise to set the volume level of the player.
|
2079 |
-
*
|
2080 |
-
* @promise SetVolumePromise
|
2081 |
-
* @fulfill {number} The volume was set.
|
2082 |
-
* @reject {RangeError} The volume was less than 0 or greater than 1.
|
2083 |
-
*/
|
2084 |
-
/**
|
2085 |
-
* Set the volume of the player on a scale from `0` to `1`. When set
|
2086 |
-
* via the API, the volume level will not be synchronized to other
|
2087 |
-
* players or stored as the viewer’s preference.
|
2088 |
-
*
|
2089 |
-
* Most mobile devices do not support setting the volume. An error will
|
2090 |
-
* *not* be triggered in that situation.
|
2091 |
-
*
|
2092 |
-
* @param {number} volume
|
2093 |
-
* @return {SetVolumePromise}
|
2094 |
-
*/
|
2095 |
-
|
2096 |
-
}, {
|
2097 |
-
key: 'setVolume',
|
2098 |
-
value: function setVolume(volume) {
|
2099 |
-
return this.set('volume', volume);
|
2100 |
-
}
|
2101 |
-
}]);
|
2102 |
-
|
2103 |
-
return Player;
|
2104 |
-
}();
|
2105 |
-
|
2106 |
-
// Setup embed only if this is not a node environment
|
2107 |
-
// and if there is no existing Vimeo Player object
|
2108 |
-
|
2109 |
-
|
2110 |
-
if (!isNode && window.Vimeo && !window.Vimeo.Player) {
|
2111 |
-
initializeEmbeds();
|
2112 |
-
resizeEmbeds();
|
2113 |
-
}
|
2114 |
-
|
2115 |
-
return Player;
|
2116 |
-
|
2117 |
-
})));
|
2118 |
-
|
2119 |
//# sourceMappingURL=player.js.map
|
1 |
+
/*! @vimeo/player v2.6.1 | (c) 2018 Vimeo | MIT License | https://github.com/vimeo/player.js */
|
2 |
+
(function (global, factory) {
|
3 |
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
4 |
+
typeof define === 'function' && define.amd ? define(factory) :
|
5 |
+
(global.Vimeo = global.Vimeo || {}, global.Vimeo.Player = factory());
|
6 |
+
}(this, (function () { 'use strict';
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @module lib/functions
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Check to see this is a node environment.
|
14 |
+
* @type {Boolean}
|
15 |
+
*/
|
16 |
+
/* global global */
|
17 |
+
var isNode = typeof global !== 'undefined' && {}.toString.call(global) === '[object global]';
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Get the name of the method for a given getter or setter.
|
21 |
+
*
|
22 |
+
* @param {string} prop The name of the property.
|
23 |
+
* @param {string} type Either “get” or “set”.
|
24 |
+
* @return {string}
|
25 |
+
*/
|
26 |
+
function getMethodName(prop, type) {
|
27 |
+
if (prop.indexOf(type.toLowerCase()) === 0) {
|
28 |
+
return prop;
|
29 |
+
}
|
30 |
+
|
31 |
+
return '' + type.toLowerCase() + prop.substr(0, 1).toUpperCase() + prop.substr(1);
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Check to see if the object is a DOM Element.
|
36 |
+
*
|
37 |
+
* @param {*} element The object to check.
|
38 |
+
* @return {boolean}
|
39 |
+
*/
|
40 |
+
function isDomElement(element) {
|
41 |
+
return element instanceof window.HTMLElement;
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Check to see whether the value is a number.
|
46 |
+
*
|
47 |
+
* @see http://dl.dropboxusercontent.com/u/35146/js/tests/isNumber.html
|
48 |
+
* @param {*} value The value to check.
|
49 |
+
* @param {boolean} integer Check if the value is an integer.
|
50 |
+
* @return {boolean}
|
51 |
+
*/
|
52 |
+
function isInteger(value) {
|
53 |
+
// eslint-disable-next-line eqeqeq
|
54 |
+
return !isNaN(parseFloat(value)) && isFinite(value) && Math.floor(value) == value;
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Check to see if the URL is a Vimeo url.
|
59 |
+
*
|
60 |
+
* @param {string} url The url string.
|
61 |
+
* @return {boolean}
|
62 |
+
*/
|
63 |
+
function isVimeoUrl(url) {
|
64 |
+
return (/^(https?:)?\/\/((player|www).)?vimeo.com(?=$|\/)/.test(url)
|
65 |
+
);
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Get the Vimeo URL from an element.
|
70 |
+
* The element must have either a data-vimeo-id or data-vimeo-url attribute.
|
71 |
+
*
|
72 |
+
* @param {object} oEmbedParameters The oEmbed parameters.
|
73 |
+
* @return {string}
|
74 |
+
*/
|
75 |
+
function getVimeoUrl() {
|
76 |
+
var oEmbedParameters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
77 |
+
|
78 |
+
var id = oEmbedParameters.id;
|
79 |
+
var url = oEmbedParameters.url;
|
80 |
+
var idOrUrl = id || url;
|
81 |
+
|
82 |
+
if (!idOrUrl) {
|
83 |
+
throw new Error('An id or url must be passed, either in an options object or as a data-vimeo-id or data-vimeo-url attribute.');
|
84 |
+
}
|
85 |
+
|
86 |
+
if (isInteger(idOrUrl)) {
|
87 |
+
return 'https://vimeo.com/' + idOrUrl;
|
88 |
+
}
|
89 |
+
|
90 |
+
if (isVimeoUrl(idOrUrl)) {
|
91 |
+
return idOrUrl.replace('http:', 'https:');
|
92 |
+
}
|
93 |
+
|
94 |
+
if (id) {
|
95 |
+
throw new TypeError('\u201C' + id + '\u201D is not a valid video id.');
|
96 |
+
}
|
97 |
+
|
98 |
+
throw new TypeError('\u201C' + idOrUrl + '\u201D is not a vimeo.com url.');
|
99 |
+
}
|
100 |
+
|
101 |
+
var arrayIndexOfSupport = typeof Array.prototype.indexOf !== 'undefined';
|
102 |
+
var postMessageSupport = typeof window !== 'undefined' && typeof window.postMessage !== 'undefined';
|
103 |
+
|
104 |
+
if (!isNode && (!arrayIndexOfSupport || !postMessageSupport)) {
|
105 |
+
throw new Error('Sorry, the Vimeo Player API is not available in this browser.');
|
106 |
+
}
|
107 |
+
|
108 |
+
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
109 |
+
|
110 |
+
|
111 |
+
|
112 |
+
|
113 |
+
|
114 |
+
function createCommonjsModule(fn, module) {
|
115 |
+
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
116 |
+
}
|
117 |
+
|
118 |
+
var index = createCommonjsModule(function (module, exports) {
|
119 |
+
(function (exports) {
|
120 |
+
'use strict';
|
121 |
+
//shared pointer
|
122 |
+
|
123 |
+
var i;
|
124 |
+
//shortcuts
|
125 |
+
var defineProperty = Object.defineProperty,
|
126 |
+
is = function is(a, b) {
|
127 |
+
return a === b || a !== a && b !== b;
|
128 |
+
};
|
129 |
+
|
130 |
+
//Polyfill global objects
|
131 |
+
if (typeof WeakMap == 'undefined') {
|
132 |
+
exports.WeakMap = createCollection({
|
133 |
+
// WeakMap#delete(key:void*):boolean
|
134 |
+
'delete': sharedDelete,
|
135 |
+
// WeakMap#clear():
|
136 |
+
clear: sharedClear,
|
137 |
+
// WeakMap#get(key:void*):void*
|
138 |
+
get: sharedGet,
|
139 |
+
// WeakMap#has(key:void*):boolean
|
140 |
+
has: mapHas,
|
141 |
+
// WeakMap#set(key:void*, value:void*):void
|
142 |
+
set: sharedSet
|
143 |
+
}, true);
|
144 |
+
}
|
145 |
+
|
146 |
+
if (typeof Map == 'undefined' || typeof new Map().values !== 'function' || !new Map().values().next) {
|
147 |
+
exports.Map = createCollection({
|
148 |
+
// WeakMap#delete(key:void*):boolean
|
149 |
+
'delete': sharedDelete,
|
150 |
+
//:was Map#get(key:void*[, d3fault:void*]):void*
|
151 |
+
// Map#has(key:void*):boolean
|
152 |
+
has: mapHas,
|
153 |
+
// Map#get(key:void*):boolean
|
154 |
+
get: sharedGet,
|
155 |
+
// Map#set(key:void*, value:void*):void
|
156 |
+
set: sharedSet,
|
157 |
+
// Map#keys(void):Iterator
|
158 |
+
keys: sharedKeys,
|
159 |
+
// Map#values(void):Iterator
|
160 |
+
values: sharedValues,
|
161 |
+
// Map#entries(void):Iterator
|
162 |
+
entries: mapEntries,
|
163 |
+
// Map#forEach(callback:Function, context:void*):void ==> callback.call(context, key, value, mapObject) === not in specs`
|
164 |
+
forEach: sharedForEach,
|
165 |
+
// Map#clear():
|
166 |
+
clear: sharedClear
|
167 |
+
});
|
168 |
+
}
|
169 |
+
|
170 |
+
if (typeof Set == 'undefined' || typeof new Set().values !== 'function' || !new Set().values().next) {
|
171 |
+
exports.Set = createCollection({
|
172 |
+
// Set#has(value:void*):boolean
|
173 |
+
has: setHas,
|
174 |
+
// Set#add(value:void*):boolean
|
175 |
+
add: sharedAdd,
|
176 |
+
// Set#delete(key:void*):boolean
|
177 |
+
'delete': sharedDelete,
|
178 |
+
// Set#clear():
|
179 |
+
clear: sharedClear,
|
180 |
+
// Set#keys(void):Iterator
|
181 |
+
keys: sharedValues, // specs actually say "the same function object as the initial value of the values property"
|
182 |
+
// Set#values(void):Iterator
|
183 |
+
values: sharedValues,
|
184 |
+
// Set#entries(void):Iterator
|
185 |
+
entries: setEntries,
|
186 |
+
// Set#forEach(callback:Function, context:void*):void ==> callback.call(context, value, index) === not in specs
|
187 |
+
forEach: sharedForEach
|
188 |
+
});
|
189 |
+
}
|
190 |
+
|
191 |
+
if (typeof WeakSet == 'undefined') {
|
192 |
+
exports.WeakSet = createCollection({
|
193 |
+
// WeakSet#delete(key:void*):boolean
|
194 |
+
'delete': sharedDelete,
|
195 |
+
// WeakSet#add(value:void*):boolean
|
196 |
+
add: sharedAdd,
|
197 |
+
// WeakSet#clear():
|
198 |
+
clear: sharedClear,
|
199 |
+
// WeakSet#has(value:void*):boolean
|
200 |
+
has: setHas
|
201 |
+
}, true);
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* ES6 collection constructor
|
206 |
+
* @return {Function} a collection class
|
207 |
+
*/
|
208 |
+
function createCollection(proto, objectOnly) {
|
209 |
+
function Collection(a) {
|
210 |
+
if (!this || this.constructor !== Collection) return new Collection(a);
|
211 |
+
this._keys = [];
|
212 |
+
this._values = [];
|
213 |
+
this._itp = []; // iteration pointers
|
214 |
+
this.objectOnly = objectOnly;
|
215 |
+
|
216 |
+
//parse initial iterable argument passed
|
217 |
+
if (a) init.call(this, a);
|
218 |
+
}
|
219 |
+
|
220 |
+
//define size for non object-only collections
|
221 |
+
if (!objectOnly) {
|
222 |
+
defineProperty(proto, 'size', {
|
223 |
+
get: sharedSize
|
224 |
+
});
|
225 |
+
}
|
226 |
+
|
227 |
+
//set prototype
|
228 |
+
proto.constructor = Collection;
|
229 |
+
Collection.prototype = proto;
|
230 |
+
|
231 |
+
return Collection;
|
232 |
+
}
|
233 |
+
|
234 |
+
/** parse initial iterable argument passed */
|
235 |
+
function init(a) {
|
236 |
+
var i;
|
237 |
+
//init Set argument, like `[1,2,3,{}]`
|
238 |
+
if (this.add) a.forEach(this.add, this);
|
239 |
+
//init Map argument like `[[1,2], [{}, 4]]`
|
240 |
+
else a.forEach(function (a) {
|
241 |
+
this.set(a[0], a[1]);
|
242 |
+
}, this);
|
243 |
+
}
|
244 |
+
|
245 |
+
/** delete */
|
246 |
+
function sharedDelete(key) {
|
247 |
+
if (this.has(key)) {
|
248 |
+
this._keys.splice(i, 1);
|
249 |
+
this._values.splice(i, 1);
|
250 |
+
// update iteration pointers
|
251 |
+
this._itp.forEach(function (p) {
|
252 |
+
if (i < p[0]) p[0]--;
|
253 |
+
});
|
254 |
+
}
|
255 |
+
// Aurora here does it while Canary doesn't
|
256 |
+
return -1 < i;
|
257 |
+
}
|
258 |
+
|
259 |
+
function sharedGet(key) {
|
260 |
+
return this.has(key) ? this._values[i] : undefined;
|
261 |
+
}
|
262 |
+
|
263 |
+
function has(list, key) {
|
264 |
+
if (this.objectOnly && key !== Object(key)) throw new TypeError("Invalid value used as weak collection key");
|
265 |
+
//NaN or 0 passed
|
266 |
+
if (key != key || key === 0) for (i = list.length; i-- && !is(list[i], key);) {} else i = list.indexOf(key);
|
267 |
+
return -1 < i;
|
268 |
+
}
|
269 |
+
|
270 |
+
function setHas(value) {
|
271 |
+
return has.call(this, this._values, value);
|
272 |
+
}
|
273 |
+
|
274 |
+
function mapHas(value) {
|
275 |
+
return has.call(this, this._keys, value);
|
276 |
+
}
|
277 |
+
|
278 |
+
/** @chainable */
|
279 |
+
function sharedSet(key, value) {
|
280 |
+
this.has(key) ? this._values[i] = value : this._values[this._keys.push(key) - 1] = value;
|
281 |
+
return this;
|
282 |
+
}
|
283 |
+
|
284 |
+
/** @chainable */
|
285 |
+
function sharedAdd(value) {
|
286 |
+
if (!this.has(value)) this._values.push(value);
|
287 |
+
return this;
|
288 |
+
}
|
289 |
+
|
290 |
+
function sharedClear() {
|
291 |
+
(this._keys || 0).length = this._values.length = 0;
|
292 |
+
}
|
293 |
+
|
294 |
+
/** keys, values, and iterate related methods */
|
295 |
+
function sharedKeys() {
|
296 |
+
return sharedIterator(this._itp, this._keys);
|
297 |
+
}
|
298 |
+
|
299 |
+
function sharedValues() {
|
300 |
+
return sharedIterator(this._itp, this._values);
|
301 |
+
}
|
302 |
+
|
303 |
+
function mapEntries() {
|
304 |
+
return sharedIterator(this._itp, this._keys, this._values);
|
305 |
+
}
|
306 |
+
|
307 |
+
function setEntries() {
|
308 |
+
return sharedIterator(this._itp, this._values, this._values);
|
309 |
+
}
|
310 |
+
|
311 |
+
function sharedIterator(itp, array, array2) {
|
312 |
+
var p = [0],
|
313 |
+
done = false;
|
314 |
+
itp.push(p);
|
315 |
+
return {
|
316 |
+
next: function next() {
|
317 |
+
var v,
|
318 |
+
k = p[0];
|
319 |
+
if (!done && k < array.length) {
|
320 |
+
v = array2 ? [array[k], array2[k]] : array[k];
|
321 |
+
p[0]++;
|
322 |
+
} else {
|
323 |
+
done = true;
|
324 |
+
itp.splice(itp.indexOf(p), 1);
|
325 |
+
}
|
326 |
+
return { done: done, value: v };
|
327 |
+
}
|
328 |
+
};
|
329 |
+
}
|
330 |
+
|
331 |
+
function sharedSize() {
|
332 |
+
return this._values.length;
|
333 |
+
}
|
334 |
+
|
335 |
+
function sharedForEach(callback, context) {
|
336 |
+
var it = this.entries();
|
337 |
+
for (;;) {
|
338 |
+
var r = it.next();
|
339 |
+
if (r.done) break;
|
340 |
+
callback.call(context, r.value[1], r.value[0], this);
|
341 |
+
}
|
342 |
+
}
|
343 |
+
})('object' != 'undefined' && typeof commonjsGlobal != 'undefined' ? commonjsGlobal : window);
|
344 |
+
});
|
345 |
+
|
346 |
+
var npo_src = createCommonjsModule(function (module) {
|
347 |
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
348 |
+
|
349 |
+
/*! Native Promise Only
|
350 |
+
v0.8.1 (c) Kyle Simpson
|
351 |
+
MIT License: http://getify.mit-license.org
|
352 |
+
*/
|
353 |
+
|
354 |
+
(function UMD(name, context, definition) {
|
355 |
+
// special form of UMD for polyfilling across evironments
|
356 |
+
context[name] = context[name] || definition();
|
357 |
+
if ('object' != "undefined" && module.exports) {
|
358 |
+
module.exports = context[name];
|
359 |
+
} else if (typeof undefined == "function" && undefined.amd) {
|
360 |
+
undefined(function $AMD$() {
|
361 |
+
return context[name];
|
362 |
+
});
|
363 |
+
}
|
364 |
+
})("Promise", typeof commonjsGlobal != "undefined" ? commonjsGlobal : commonjsGlobal, function DEF() {
|
365 |
+
/*jshint validthis:true */
|
366 |
+
"use strict";
|
367 |
+
|
368 |
+
var builtInProp,
|
369 |
+
cycle,
|
370 |
+
scheduling_queue,
|
371 |
+
ToString = Object.prototype.toString,
|
372 |
+
timer = typeof setImmediate != "undefined" ? function timer(fn) {
|
373 |
+
return setImmediate(fn);
|
374 |
+
} : setTimeout;
|
375 |
+
|
376 |
+
// dammit, IE8.
|
377 |
+
try {
|
378 |
+
Object.defineProperty({}, "x", {});
|
379 |
+
builtInProp = function builtInProp(obj, name, val, config) {
|
380 |
+
return Object.defineProperty(obj, name, {
|
381 |
+
value: val,
|
382 |
+
writable: true,
|
383 |
+
configurable: config !== false
|
384 |
+
});
|
385 |
+
};
|
386 |
+
} catch (err) {
|
387 |
+
builtInProp = function builtInProp(obj, name, val) {
|
388 |
+
obj[name] = val;
|
389 |
+
return obj;
|
390 |
+
};
|
391 |
+
}
|
392 |
+
|
393 |
+
// Note: using a queue instead of array for efficiency
|
394 |
+
scheduling_queue = function Queue() {
|
395 |
+
var first, last, item;
|
396 |
+
|
397 |
+
function Item(fn, self) {
|
398 |
+
this.fn = fn;
|
399 |
+
this.self = self;
|
400 |
+
this.next = void 0;
|
401 |
+
}
|
402 |
+
|
403 |
+
return {
|
404 |
+
add: function add(fn, self) {
|
405 |
+
item = new Item(fn, self);
|
406 |
+
if (last) {
|
407 |
+
last.next = item;
|
408 |
+
} else {
|
409 |
+
first = item;
|
410 |
+
}
|
411 |
+
last = item;
|
412 |
+
item = void 0;
|
413 |
+
},
|
414 |
+
drain: function drain() {
|
415 |
+
var f = first;
|
416 |
+
first = last = cycle = void 0;
|
417 |
+
|
418 |
+
while (f) {
|
419 |
+
f.fn.call(f.self);
|
420 |
+
f = f.next;
|
421 |
+
}
|
422 |
+
}
|
423 |
+
};
|
424 |
+
}();
|
425 |
+
|
426 |
+
function schedule(fn, self) {
|
427 |
+
scheduling_queue.add(fn, self);
|
428 |
+
if (!cycle) {
|
429 |
+
cycle = timer(scheduling_queue.drain);
|
430 |
+
}
|
431 |
+
}
|
432 |
+
|
433 |
+
// promise duck typing
|
434 |
+
function isThenable(o) {
|
435 |
+
var _then,
|
436 |
+
o_type = typeof o === "undefined" ? "undefined" : _typeof(o);
|
437 |
+
|
438 |
+
if (o != null && (o_type == "object" || o_type == "function")) {
|
439 |
+
_then = o.then;
|
440 |
+
}
|
441 |
+
return typeof _then == "function" ? _then : false;
|
442 |
+
}
|
443 |
+
|
444 |
+
function notify() {
|
445 |
+
for (var i = 0; i < this.chain.length; i++) {
|
446 |
+
notifyIsolated(this, this.state === 1 ? this.chain[i].success : this.chain[i].failure, this.chain[i]);
|
447 |
+
}
|
448 |
+
this.chain.length = 0;
|
449 |
+
}
|
450 |
+
|
451 |
+
// NOTE: This is a separate function to isolate
|
452 |
+
// the `try..catch` so that other code can be
|
453 |
+
// optimized better
|
454 |
+
function notifyIsolated(self, cb, chain) {
|
455 |
+
var ret, _then;
|
456 |
+
try {
|
457 |
+
if (cb === false) {
|
458 |
+
chain.reject(self.msg);
|
459 |
+
} else {
|
460 |
+
if (cb === true) {
|
461 |
+
ret = self.msg;
|
462 |
+
} else {
|
463 |
+
ret = cb.call(void 0, self.msg);
|
464 |
+
}
|
465 |
+
|
466 |
+
if (ret === chain.promise) {
|
467 |
+
chain.reject(TypeError("Promise-chain cycle"));
|
468 |
+
} else if (_then = isThenable(ret)) {
|
469 |
+
_then.call(ret, chain.resolve, chain.reject);
|
470 |
+
} else {
|
471 |
+
chain.resolve(ret);
|
472 |
+
}
|
473 |
+
}
|
474 |
+
} catch (err) {
|
475 |
+
chain.reject(err);
|
476 |
+
}
|
477 |
+
}
|
478 |
+
|
479 |
+
function resolve(msg) {
|
480 |
+
var _then,
|
481 |
+
self = this;
|
482 |
+
|
483 |
+
// already triggered?
|
484 |
+
if (self.triggered) {
|
485 |
+
return;
|
486 |
+
}
|
487 |
+
|
488 |
+
self.triggered = true;
|
489 |
+
|
490 |
+
// unwrap
|
491 |
+
if (self.def) {
|
492 |
+
self = self.def;
|
493 |
+
}
|
494 |
+
|
495 |
+
try {
|
496 |
+
if (_then = isThenable(msg)) {
|
497 |
+
schedule(function () {
|
498 |
+
var def_wrapper = new MakeDefWrapper(self);
|
499 |
+
try {
|
500 |
+
_then.call(msg, function $resolve$() {
|
501 |
+
resolve.apply(def_wrapper, arguments);
|
502 |
+
}, function $reject$() {
|
503 |
+
reject.apply(def_wrapper, arguments);
|
504 |
+
});
|
505 |
+
} catch (err) {
|
506 |
+
reject.call(def_wrapper, err);
|
507 |
+
}
|
508 |
+
});
|
509 |
+
} else {
|
510 |
+
self.msg = msg;
|
511 |
+
self.state = 1;
|
512 |
+
if (self.chain.length > 0) {
|
513 |
+
schedule(notify, self);
|
514 |
+
}
|
515 |
+
}
|
516 |
+
} catch (err) {
|
517 |
+
reject.call(new MakeDefWrapper(self), err);
|
518 |
+
}
|
519 |
+
}
|
520 |
+
|
521 |
+
function reject(msg) {
|
522 |
+
var self = this;
|
523 |
+
|
524 |
+
// already triggered?
|
525 |
+
if (self.triggered) {
|
526 |
+
return;
|
527 |
+
}
|
528 |
+
|
529 |
+
self.triggered = true;
|
530 |
+
|
531 |
+
// unwrap
|
532 |
+
if (self.def) {
|
533 |
+
self = self.def;
|
534 |
+
}
|
535 |
+
|
536 |
+
self.msg = msg;
|
537 |
+
self.state = 2;
|
538 |
+
if (self.chain.length > 0) {
|
539 |
+
schedule(notify, self);
|
540 |
+
}
|
541 |
+
}
|
542 |
+
|
543 |
+
function iteratePromises(Constructor, arr, resolver, rejecter) {
|
544 |
+
for (var idx = 0; idx < arr.length; idx++) {
|
545 |
+
(function IIFE(idx) {
|
546 |
+
Constructor.resolve(arr[idx]).then(function $resolver$(msg) {
|
547 |
+
resolver(idx, msg);
|
548 |
+
}, rejecter);
|
549 |
+
})(idx);
|
550 |
+
}
|
551 |
+
}
|
552 |
+
|
553 |
+
function MakeDefWrapper(self) {
|
554 |
+
this.def = self;
|
555 |
+
this.triggered = false;
|
556 |
+
}
|
557 |
+
|
558 |
+
function MakeDef(self) {
|
559 |
+
this.promise = self;
|
560 |
+
this.state = 0;
|
561 |
+
this.triggered = false;
|
562 |
+
this.chain = [];
|
563 |
+
this.msg = void 0;
|
564 |
+
}
|
565 |
+
|
566 |
+
function Promise(executor) {
|
567 |
+
if (typeof executor != "function") {
|
568 |
+
throw TypeError("Not a function");
|
569 |
+
}
|
570 |
+
|
571 |
+
if (this.__NPO__ !== 0) {
|
572 |
+
throw TypeError("Not a promise");
|
573 |
+
}
|
574 |
+
|
575 |
+
// instance shadowing the inherited "brand"
|
576 |
+
// to signal an already "initialized" promise
|
577 |
+
this.__NPO__ = 1;
|
578 |
+
|
579 |
+
var def = new MakeDef(this);
|
580 |
+
|
581 |
+
this["then"] = function then(success, failure) {
|
582 |
+
var o = {
|
583 |
+
success: typeof success == "function" ? success : true,
|
584 |
+
failure: typeof failure == "function" ? failure : false
|
585 |
+
};
|
586 |
+
// Note: `then(..)` itself can be borrowed to be used against
|
587 |
+
// a different promise constructor for making the chained promise,
|
588 |
+
// by substituting a different `this` binding.
|
589 |
+
o.promise = new this.constructor(function extractChain(resolve, reject) {
|
590 |
+
if (typeof resolve != "function" || typeof reject != "function") {
|
591 |
+
throw TypeError("Not a function");
|
592 |
+
}
|
593 |
+
|
594 |
+
o.resolve = resolve;
|
595 |
+
o.reject = reject;
|
596 |
+
});
|
597 |
+
def.chain.push(o);
|
598 |
+
|
599 |
+
if (def.state !== 0) {
|
600 |
+
schedule(notify, def);
|
601 |
+
}
|
602 |
+
|
603 |
+
return o.promise;
|
604 |
+
};
|
605 |
+
this["catch"] = function $catch$(failure) {
|
606 |
+
return this.then(void 0, failure);
|
607 |
+
};
|
608 |
+
|
609 |
+
try {
|
610 |
+
executor.call(void 0, function publicResolve(msg) {
|
611 |
+
resolve.call(def, msg);
|
612 |
+
}, function publicReject(msg) {
|
613 |
+
reject.call(def, msg);
|
614 |
+
});
|
615 |
+
} catch (err) {
|
616 |
+
reject.call(def, err);
|
617 |
+
}
|
618 |
+
}
|
619 |
+
|
620 |
+
var PromisePrototype = builtInProp({}, "constructor", Promise,
|
621 |
+
/*configurable=*/false);
|
622 |
+
|
623 |
+
// Note: Android 4 cannot use `Object.defineProperty(..)` here
|
624 |
+
Promise.prototype = PromisePrototype;
|
625 |
+
|
626 |
+
// built-in "brand" to signal an "uninitialized" promise
|
627 |
+
builtInProp(PromisePrototype, "__NPO__", 0,
|
628 |
+
/*configurable=*/false);
|
629 |
+
|
630 |
+
builtInProp(Promise, "resolve", function Promise$resolve(msg) {
|
631 |
+
var Constructor = this;
|
632 |
+
|
633 |
+
// spec mandated checks
|
634 |
+
// note: best "isPromise" check that's practical for now
|
635 |
+
if (msg && (typeof msg === "undefined" ? "undefined" : _typeof(msg)) == "object" && msg.__NPO__ === 1) {
|
636 |
+
return msg;
|
637 |
+
}
|
638 |
+
|
639 |
+
return new Constructor(function executor(resolve, reject) {
|
640 |
+
if (typeof resolve != "function" || typeof reject != "function") {
|
641 |
+
throw TypeError("Not a function");
|
642 |
+
}
|
643 |
+
|
644 |
+
resolve(msg);
|
645 |
+
});
|
646 |
+
});
|
647 |
+
|
648 |
+
builtInProp(Promise, "reject", function Promise$reject(msg) {
|
649 |
+
return new this(function executor(resolve, reject) {
|
650 |
+
if (typeof resolve != "function" || typeof reject != "function") {
|
651 |
+
throw TypeError("Not a function");
|
652 |
+
}
|
653 |
+
|
654 |
+
reject(msg);
|
655 |
+
});
|
656 |
+
});
|
657 |
+
|
658 |
+
builtInProp(Promise, "all", function Promise$all(arr) {
|
659 |
+
var Constructor = this;
|
660 |
+
|
661 |
+
// spec mandated checks
|
662 |
+
if (ToString.call(arr) != "[object Array]") {
|
663 |
+
return Constructor.reject(TypeError("Not an array"));
|
664 |
+
}
|
665 |
+
if (arr.length === 0) {
|
666 |
+
return Constructor.resolve([]);
|
667 |
+
}
|
668 |
+
|
669 |
+
return new Constructor(function executor(resolve, reject) {
|
670 |
+
if (typeof resolve != "function" || typeof reject != "function") {
|
671 |
+
throw TypeError("Not a function");
|
672 |
+
}
|
673 |
+
|
674 |
+
var len = arr.length,
|
675 |
+
msgs = Array(len),
|
676 |
+
count = 0;
|
677 |
+
|
678 |
+
iteratePromises(Constructor, arr, function resolver(idx, msg) {
|
679 |
+
msgs[idx] = msg;
|
680 |
+
if (++count === len) {
|
681 |
+
resolve(msgs);
|
682 |
+
}
|
683 |
+
}, reject);
|
684 |
+
});
|
685 |
+
});
|
686 |
+
|
687 |
+
builtInProp(Promise, "race", function Promise$race(arr) {
|
688 |
+
var Constructor = this;
|
689 |
+
|
690 |
+
// spec mandated checks
|
691 |
+
if (ToString.call(arr) != "[object Array]") {
|
692 |
+
return Constructor.reject(TypeError("Not an array"));
|
693 |
+
}
|
694 |
+
|
695 |
+
return new Constructor(function executor(resolve, reject) {
|
696 |
+
if (typeof resolve != "function" || typeof reject != "function") {
|
697 |
+
throw TypeError("Not a function");
|
698 |
+
}
|
699 |
+
|
700 |
+
iteratePromises(Constructor, arr, function resolver(idx, msg) {
|
701 |
+
resolve(msg);
|
702 |
+
}, reject);
|
703 |
+
});
|
704 |
+
});
|
705 |
+
|
706 |
+
return Promise;
|
707 |
+
});
|
708 |
+
});
|
709 |
+
|
710 |
+
/**
|
711 |
+
* @module lib/callbacks
|
712 |
+
*/
|
713 |
+
|
714 |
+
var callbackMap = new WeakMap();
|
715 |
+
|
716 |
+
/**
|
717 |
+
* Store a callback for a method or event for a player.
|
718 |
+
*
|
719 |
+
* @param {Player} player The player object.
|
720 |
+
* @param {string} name The method or event name.
|
721 |
+
* @param {(function(this:Player, *): void|{resolve: function, reject: function})} callback
|
722 |
+
* The callback to call or an object with resolve and reject functions for a promise.
|
723 |
+
* @return {void}
|
724 |
+
*/
|
725 |
+
function storeCallback(player, name, callback) {
|
726 |
+
var playerCallbacks = callbackMap.get(player.element) || {};
|
727 |
+
|
728 |
+
if (!(name in playerCallbacks)) {
|
729 |
+
playerCallbacks[name] = [];
|
730 |
+
}
|
731 |
+
|
732 |
+
playerCallbacks[name].push(callback);
|
733 |
+
callbackMap.set(player.element, playerCallbacks);
|
734 |
+
}
|
735 |
+
|
736 |
+
/**
|
737 |
+
* Get the callbacks for a player and event or method.
|
738 |
+
*
|
739 |
+
* @param {Player} player The player object.
|
740 |
+
* @param {string} name The method or event name
|
741 |
+
* @return {function[]}
|
742 |
+
*/
|
743 |
+
function getCallbacks(player, name) {
|
744 |
+
var playerCallbacks = callbackMap.get(player.element) || {};
|
745 |
+
return playerCallbacks[name] || [];
|
746 |
+
}
|
747 |
+
|
748 |
+
/**
|
749 |
+
* Remove a stored callback for a method or event for a player.
|
750 |
+
*
|
751 |
+
* @param {Player} player The player object.
|
752 |
+
* @param {string} name The method or event name
|
753 |
+
* @param {function} [callback] The specific callback to remove.
|
754 |
+
* @return {boolean} Was this the last callback?
|
755 |
+
*/
|
756 |
+
function removeCallback(player, name, callback) {
|
757 |
+
var playerCallbacks = callbackMap.get(player.element) || {};
|
758 |
+
|
759 |
+
if (!playerCallbacks[name]) {
|
760 |
+
return true;
|
761 |
+
}
|
762 |
+
|
763 |
+
// If no callback is passed, remove all callbacks for the event
|
764 |
+
if (!callback) {
|
765 |
+
playerCallbacks[name] = [];
|
766 |
+
callbackMap.set(player.element, playerCallbacks);
|
767 |
+
|
768 |
+
return true;
|
769 |
+
}
|
770 |
+
|
771 |
+
var index = playerCallbacks[name].indexOf(callback);
|
772 |
+
|
773 |
+
if (index !== -1) {
|
774 |
+
playerCallbacks[name].splice(index, 1);
|
775 |
+
}
|
776 |
+
|
777 |
+
callbackMap.set(player.element, playerCallbacks);
|
778 |
+
return playerCallbacks[name] && playerCallbacks[name].length === 0;
|
779 |
+
}
|
780 |
+
|
781 |
+
/**
|
782 |
+
* Return the first stored callback for a player and event or method.
|
783 |
+
*
|
784 |
+
* @param {Player} player The player object.
|
785 |
+
* @param {string} name The method or event name.
|
786 |
+
* @return {function} The callback, or false if there were none
|
787 |
+
*/
|
788 |
+
function shiftCallbacks(player, name) {
|
789 |
+
var playerCallbacks = getCallbacks(player, name);
|
790 |
+
|
791 |
+
if (playerCallbacks.length < 1) {
|
792 |
+
return false;
|
793 |
+
}
|
794 |
+
|
795 |
+
var callback = playerCallbacks.shift();
|
796 |
+
removeCallback(player, name, callback);
|
797 |
+
return callback;
|
798 |
+
}
|
799 |
+
|
800 |
+
/**
|
801 |
+
* Move callbacks associated with an element to another element.
|
802 |
+
*
|
803 |
+
* @param {HTMLElement} oldElement The old element.
|
804 |
+
* @param {HTMLElement} newElement The new element.
|
805 |
+
* @return {void}
|
806 |
+
*/
|
807 |
+
function swapCallbacks(oldElement, newElement) {
|
808 |
+
var playerCallbacks = callbackMap.get(oldElement);
|
809 |
+
|
810 |
+
callbackMap.set(newElement, playerCallbacks);
|
811 |
+
callbackMap.delete(oldElement);
|
812 |
+
}
|
813 |
+
|
814 |
+
/**
|
815 |
+
* @module lib/embed
|
816 |
+
*/
|
817 |
+
|
818 |
+
var oEmbedParameters = ['autopause', 'autoplay', 'background', 'byline', 'color', 'height', 'id', 'loop', 'maxheight', 'maxwidth', 'muted', 'playsinline', 'portrait', 'responsive', 'speed', 'title', 'transparent', 'url', 'width'];
|
819 |
+
|
820 |
+
/**
|
821 |
+
* Get the 'data-vimeo'-prefixed attributes from an element as an object.
|
822 |
+
*
|
823 |
+
* @param {HTMLElement} element The element.
|
824 |
+
* @param {Object} [defaults={}] The default values to use.
|
825 |
+
* @return {Object<string, string>}
|
826 |
+
*/
|
827 |
+
function getOEmbedParameters(element) {
|
828 |
+
var defaults = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
829 |
+
|
830 |
+
return oEmbedParameters.reduce(function (params, param) {
|
831 |
+
var value = element.getAttribute('data-vimeo-' + param);
|
832 |
+
|
833 |
+
if (value || value === '') {
|
834 |
+
params[param] = value === '' ? 1 : value;
|
835 |
+
}
|
836 |
+
|
837 |
+
return params;
|
838 |
+
}, defaults);
|
839 |
+
}
|
840 |
+
|
841 |
+
/**
|
842 |
+
* Make an oEmbed call for the specified URL.
|
843 |
+
*
|
844 |
+
* @param {string} videoUrl The vimeo.com url for the video.
|
845 |
+
* @param {Object} [params] Parameters to pass to oEmbed.
|
846 |
+
* @return {Promise}
|
847 |
+
*/
|
848 |
+
function getOEmbedData(videoUrl) {
|
849 |
+
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
850 |
+
|
851 |
+
return new Promise(function (resolve, reject) {
|
852 |
+
if (!isVimeoUrl(videoUrl)) {
|
853 |
+
throw new TypeError('\u201C' + videoUrl + '\u201D is not a vimeo.com url.');
|
854 |
+
}
|
855 |
+
|
856 |
+
var url = 'https://vimeo.com/api/oembed.json?url=' + encodeURIComponent(videoUrl);
|
857 |
+
|
858 |
+
for (var param in params) {
|
859 |
+
if (params.hasOwnProperty(param)) {
|
860 |
+
url += '&' + param + '=' + encodeURIComponent(params[param]);
|
861 |
+
}
|
862 |
+
}
|
863 |
+
|
864 |
+
var xhr = 'XDomainRequest' in window ? new XDomainRequest() : new XMLHttpRequest();
|
865 |
+
xhr.open('GET', url, true);
|
866 |
+
|
867 |
+
xhr.onload = function () {
|
868 |
+
if (xhr.status === 404) {
|
869 |
+
reject(new Error('\u201C' + videoUrl + '\u201D was not found.'));
|
870 |
+
return;
|
871 |
+
}
|
872 |
+
|
873 |
+
if (xhr.status === 403) {
|
874 |
+
reject(new Error('\u201C' + videoUrl + '\u201D is not embeddable.'));
|
875 |
+
return;
|
876 |
+
}
|
877 |
+
|
878 |
+
try {
|
879 |
+
var json = JSON.parse(xhr.responseText);
|
880 |
+
resolve(json);
|
881 |
+
} catch (error) {
|
882 |
+
reject(error);
|
883 |
+
}
|
884 |
+
};
|
885 |
+
|
886 |
+
xhr.onerror = function () {
|
887 |
+
var status = xhr.status ? ' (' + xhr.status + ')' : '';
|
888 |
+
reject(new Error('There was an error fetching the embed code from Vimeo' + status + '.'));
|
889 |
+
};
|
890 |
+
|
891 |
+
xhr.send();
|
892 |
+
});
|
893 |
+
}
|
894 |
+
|
895 |
+
/**
|
896 |
+
* Create an embed from oEmbed data inside an element.
|
897 |
+
*
|
898 |
+
* @param {object} data The oEmbed data.
|
899 |
+
* @param {HTMLElement} element The element to put the iframe in.
|
900 |
+
* @return {HTMLIFrameElement} The iframe embed.
|
901 |
+
*/
|
902 |
+
function createEmbed(_ref, element) {
|
903 |
+
var html = _ref.html;
|
904 |
+
|
905 |
+
if (!element) {
|
906 |
+
throw new TypeError('An element must be provided');
|
907 |
+
}
|
908 |
+
|
909 |
+
if (element.getAttribute('data-vimeo-initialized') !== null) {
|
910 |
+
return element.querySelector('iframe');
|
911 |
+
}
|
912 |
+
|
913 |
+
var div = document.createElement('div');
|
914 |
+
div.innerHTML = html;
|
915 |
+
|
916 |
+
element.appendChild(div.firstChild);
|
917 |
+
element.setAttribute('data-vimeo-initialized', 'true');
|
918 |
+
|
919 |
+
return element.querySelector('iframe');
|
920 |
+
}
|
921 |
+
|
922 |
+
/**
|
923 |
+
* Initialize all embeds within a specific element
|
924 |
+
*
|
925 |
+
* @param {HTMLElement} [parent=document] The parent element.
|
926 |
+
* @return {void}
|
927 |
+
*/
|
928 |
+
function initializeEmbeds() {
|
929 |
+
var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
930 |
+
|
931 |
+
var elements = [].slice.call(parent.querySelectorAll('[data-vimeo-id], [data-vimeo-url]'));
|
932 |
+
|
933 |
+
var handleError = function handleError(error) {
|
934 |
+
if ('console' in window && console.error) {
|
935 |
+
console.error('There was an error creating an embed: ' + error);
|
936 |
+
}
|
937 |
+
};
|
938 |
+
|
939 |
+
elements.forEach(function (element) {
|
940 |
+
try {
|
941 |
+
// Skip any that have data-vimeo-defer
|
942 |
+
if (element.getAttribute('data-vimeo-defer') !== null) {
|
943 |
+
return;
|
944 |
+
}
|
945 |
+
|
946 |
+
var params = getOEmbedParameters(element);
|
947 |
+
var url = getVimeoUrl(params);
|
948 |
+
|
949 |
+
getOEmbedData(url, params).then(function (data) {
|
950 |
+
return createEmbed(data, element);
|
951 |
+
}).catch(handleError);
|
952 |
+
} catch (error) {
|
953 |
+
handleError(error);
|
954 |
+
}
|
955 |
+
});
|
956 |
+
}
|
957 |
+
|
958 |
+
/**
|
959 |
+
* Resize embeds when messaged by the player.
|
960 |
+
*
|
961 |
+
* @param {HTMLElement} [parent=document] The parent element.
|
962 |
+
* @return {void}
|
963 |
+
*/
|
964 |
+
function resizeEmbeds() {
|
965 |
+
var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
966 |
+
|
967 |
+
var onMessage = function onMessage(event) {
|
968 |
+
if (!isVimeoUrl(event.origin)) {
|
969 |
+
return;
|
970 |
+
}
|
971 |
+
|
972 |
+
// 'spacechange' is fired only on embeds with cards
|
973 |
+
if (!event.data || event.data.event !== 'spacechange') {
|
974 |
+
return;
|
975 |
+
}
|
976 |
+
|
977 |
+
var iframes = parent.querySelectorAll('iframe');
|
978 |
+
|
979 |
+
for (var i = 0; i < iframes.length; i++) {
|
980 |
+
if (iframes[i].contentWindow !== event.source) {
|
981 |
+
continue;
|
982 |
+
}
|
983 |
+
|
984 |
+
// Change padding-bottom of the enclosing div to accommodate
|
985 |
+
// card carousel without distorting aspect ratio
|
986 |
+
var space = iframes[i].parentElement;
|
987 |
+
space.style.paddingBottom = event.data.data[0].bottom + 'px';
|
988 |
+
|
989 |
+
break;
|
990 |
+
}
|
991 |
+
};
|
992 |
+
|
993 |
+
if (window.addEventListener) {
|
994 |
+
window.addEventListener('message', onMessage, false);
|
995 |
+
} else if (window.attachEvent) {
|
996 |
+
window.attachEvent('onmessage', onMessage);
|
997 |
+
}
|
998 |
+
}
|
999 |
+
|
1000 |
+
/**
|
1001 |
+
* @module lib/postmessage
|
1002 |
+
*/
|
1003 |
+
|
1004 |
+
/**
|
1005 |
+
* Parse a message received from postMessage.
|
1006 |
+
*
|
1007 |
+
* @param {*} data The data received from postMessage.
|
1008 |
+
* @return {object}
|
1009 |
+
*/
|
1010 |
+
function parseMessageData(data) {
|
1011 |
+
if (typeof data === 'string') {
|
1012 |
+
data = JSON.parse(data);
|
1013 |
+
}
|
1014 |
+
|
1015 |
+
return data;
|
1016 |
+
}
|
1017 |
+
|
1018 |
+
/**
|
1019 |
+
* Post a message to the specified target.
|
1020 |
+
*
|
1021 |
+
* @param {Player} player The player object to use.
|
1022 |
+
* @param {string} method The API method to call.
|
1023 |
+
* @param {object} params The parameters to send to the player.
|
1024 |
+
* @return {void}
|
1025 |
+
*/
|
1026 |
+
function postMessage(player, method, params) {
|
1027 |
+
if (!player.element.contentWindow || !player.element.contentWindow.postMessage) {
|
1028 |
+
return;
|
1029 |
+
}
|
1030 |
+
|
1031 |
+
var message = {
|
1032 |
+
method: method
|
1033 |
+
};
|
1034 |
+
|
1035 |
+
if (params !== undefined) {
|
1036 |
+
message.value = params;
|
1037 |
+
}
|
1038 |
+
|
1039 |
+
// IE 8 and 9 do not support passing messages, so stringify them
|
1040 |
+
var ieVersion = parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/, '$1'));
|
1041 |
+
if (ieVersion >= 8 && ieVersion < 10) {
|
1042 |
+
message = JSON.stringify(message);
|
1043 |
+
}
|
1044 |
+
|
1045 |
+
player.element.contentWindow.postMessage(message, player.origin);
|
1046 |
+
}
|
1047 |
+
|
1048 |
+
/**
|
1049 |
+
* Parse the data received from a message event.
|
1050 |
+
*
|
1051 |
+
* @param {Player} player The player that received the message.
|
1052 |
+
* @param {(Object|string)} data The message data. Strings will be parsed into JSON.
|
1053 |
+
* @return {void}
|
1054 |
+
*/
|
1055 |
+
function processData(player, data) {
|
1056 |
+
data = parseMessageData(data);
|
1057 |
+
var callbacks = [];
|
1058 |
+
var param = void 0;
|
1059 |
+
|
1060 |
+
if (data.event) {
|
1061 |
+
if (data.event === 'error') {
|
1062 |
+
var promises = getCallbacks(player, data.data.method);
|
1063 |
+
|
1064 |
+
promises.forEach(function (promise) {
|
1065 |
+
var error = new Error(data.data.message);
|
1066 |
+
error.name = data.data.name;
|
1067 |
+
|
1068 |
+
promise.reject(error);
|
1069 |
+
removeCallback(player, data.data.method, promise);
|
1070 |
+
});
|
1071 |
+
}
|
1072 |
+
|
1073 |
+
callbacks = getCallbacks(player, 'event:' + data.event);
|
1074 |
+
param = data.data;
|
1075 |
+
} else if (data.method) {
|
1076 |
+
var callback = shiftCallbacks(player, data.method);
|
1077 |
+
|
1078 |
+
if (callback) {
|
1079 |
+
callbacks.push(callback);
|
1080 |
+
param = data.value;
|
1081 |
+
}
|
1082 |
+
}
|
1083 |
+
|
1084 |
+
callbacks.forEach(function (callback) {
|
1085 |
+
try {
|
1086 |
+
if (typeof callback === 'function') {
|
1087 |
+
callback.call(player, param);
|
1088 |
+
return;
|
1089 |
+
}
|
1090 |
+
|
1091 |
+
callback.resolve(param);
|
1092 |
+
} catch (e) {
|
1093 |
+
// empty
|
1094 |
+
}
|
1095 |
+
});
|
1096 |
+
}
|
1097 |
+
|
1098 |
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
1099 |
+
|
1100 |
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
1101 |
+
|
1102 |
+
var playerMap = new WeakMap();
|
1103 |
+
var readyMap = new WeakMap();
|
1104 |
+
|
1105 |
+
var Player = function () {
|
1106 |
+
/**
|
1107 |
+
* Create a Player.
|
1108 |
+
*
|
1109 |
+
* @param {(HTMLIFrameElement|HTMLElement|string|jQuery)} element A reference to the Vimeo
|
1110 |
+
* player iframe, and id, or a jQuery object.
|
1111 |
+
* @param {object} [options] oEmbed parameters to use when creating an embed in the element.
|
1112 |
+
* @return {Player}
|
1113 |
+
*/
|
1114 |
+
function Player(element) {
|
1115 |
+
var _this = this;
|
1116 |
+
|
1117 |
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
1118 |
+
|
1119 |
+
_classCallCheck(this, Player);
|
1120 |
+
|
1121 |
+
/* global jQuery */
|
1122 |
+
if (window.jQuery && element instanceof jQuery) {
|
1123 |
+
if (element.length > 1 && window.console && console.warn) {
|
1124 |
+
console.warn('A jQuery object with multiple elements was passed, using the first element.');
|
1125 |
+
}
|
1126 |
+
|
1127 |
+
element = element[0];
|
1128 |
+
}
|
1129 |
+
|
1130 |
+
// Find an element by ID
|
1131 |
+
if (typeof document !== 'undefined' && typeof element === 'string') {
|
1132 |
+
element = document.getElementById(element);
|
1133 |
+
}
|
1134 |
+
|
1135 |
+
// Not an element!
|
1136 |
+
if (!isDomElement(element)) {
|
1137 |
+
throw new TypeError('You must pass either a valid element or a valid id.');
|
1138 |
+
}
|
1139 |
+
|
1140 |
+
// Already initialized an embed in this div, so grab the iframe
|
1141 |
+
if (element.nodeName !== 'IFRAME') {
|
1142 |
+
var iframe = element.querySelector('iframe');
|
1143 |
+
|
1144 |
+
if (iframe) {
|
1145 |
+
element = iframe;
|
1146 |
+
}
|
1147 |
+
}
|
1148 |
+
|
1149 |
+
// iframe url is not a Vimeo url
|
1150 |
+
if (element.nodeName === 'IFRAME' && !isVimeoUrl(element.getAttribute('src') || '')) {
|
1151 |
+
throw new Error('The player element passed isn’t a Vimeo embed.');
|
1152 |
+
}
|
1153 |
+
|
1154 |
+
// If there is already a player object in the map, return that
|
1155 |
+
if (playerMap.has(element)) {
|
1156 |
+
return playerMap.get(element);
|
1157 |
+
}
|
1158 |
+
|
1159 |
+
this.element = element;
|
1160 |
+
this.origin = '*';
|
1161 |
+
|
1162 |
+
var readyPromise = new npo_src(function (resolve, reject) {
|
1163 |
+
var onMessage = function onMessage(event) {
|
1164 |
+
if (!isVimeoUrl(event.origin) || _this.element.contentWindow !== event.source) {
|
1165 |
+
return;
|
1166 |
+
}
|
1167 |
+
|
1168 |
+
if (_this.origin === '*') {
|
1169 |
+
_this.origin = event.origin;
|
1170 |
+
}
|
1171 |
+
|
1172 |
+
var data = parseMessageData(event.data);
|
1173 |
+
var isReadyEvent = 'event' in data && data.event === 'ready';
|
1174 |
+
var isPingResponse = 'method' in data && data.method === 'ping';
|
1175 |
+
|
1176 |
+
if (isReadyEvent || isPingResponse) {
|
1177 |
+
_this.element.setAttribute('data-ready', 'true');
|
1178 |
+
resolve();
|
1179 |
+
return;
|
1180 |
+
}
|
1181 |
+
|
1182 |
+
processData(_this, data);
|
1183 |
+
};
|
1184 |
+
|
1185 |
+
if (window.addEventListener) {
|
1186 |
+
window.addEventListener('message', onMessage, false);
|
1187 |
+
} else if (window.attachEvent) {
|
1188 |
+
window.attachEvent('onmessage', onMessage);
|
1189 |
+
}
|
1190 |
+
|
1191 |
+
if (_this.element.nodeName !== 'IFRAME') {
|
1192 |
+
var params = getOEmbedParameters(element, options);
|
1193 |
+
var url = getVimeoUrl(params);
|
1194 |
+
|
1195 |
+
getOEmbedData(url, params).then(function (data) {
|
1196 |
+
var iframe = createEmbed(data, element);
|
1197 |
+
// Overwrite element with the new iframe,
|
1198 |
+
// but store reference to the original element
|
1199 |
+
_this.element = iframe;
|
1200 |
+
_this._originalElement = element;
|
1201 |
+
|
1202 |
+
swapCallbacks(element, iframe);
|
1203 |
+
playerMap.set(_this.element, _this);
|
1204 |
+
|
1205 |
+
return data;
|
1206 |
+
}).catch(function (error) {
|
1207 |
+
return reject(error);
|
1208 |
+
});
|
1209 |
+
}
|
1210 |
+
});
|
1211 |
+
|
1212 |
+
// Store a copy of this Player in the map
|
1213 |
+
readyMap.set(this, readyPromise);
|
1214 |
+
playerMap.set(this.element, this);
|
1215 |
+
|
1216 |
+
// Send a ping to the iframe so the ready promise will be resolved if
|
1217 |
+
// the player is already ready.
|
1218 |
+
if (this.element.nodeName === 'IFRAME') {
|
1219 |
+
postMessage(this, 'ping');
|
1220 |
+
}
|
1221 |
+
|
1222 |
+
return this;
|
1223 |
+
}
|
1224 |
+
|
1225 |
+
/**
|
1226 |
+
* Get a promise for a method.
|
1227 |
+
*
|
1228 |
+
* @param {string} name The API method to call.
|
1229 |
+
* @param {Object} [args={}] Arguments to send via postMessage.
|
1230 |
+
* @return {Promise}
|
1231 |
+
*/
|
1232 |
+
|
1233 |
+
|
1234 |
+
_createClass(Player, [{
|
1235 |
+
key: 'callMethod',
|
1236 |
+
value: function callMethod(name) {
|
1237 |
+
var _this2 = this;
|
1238 |
+
|
1239 |
+
var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
1240 |
+
|
1241 |
+
return new npo_src(function (resolve, reject) {
|
1242 |
+
// We are storing the resolve/reject handlers to call later, so we
|
1243 |
+
// can’t return here.
|
1244 |
+
// eslint-disable-next-line promise/always-return
|
1245 |
+
return _this2.ready().then(function () {
|
1246 |
+
storeCallback(_this2, name, {
|
1247 |
+
resolve: resolve,
|
1248 |
+
reject: reject
|
1249 |
+
});
|
1250 |
+
|
1251 |
+
postMessage(_this2, name, args);
|
1252 |
+
}).catch(function (error) {
|
1253 |
+
reject(error);
|
1254 |
+
});
|
1255 |
+
});
|
1256 |
+
}
|
1257 |
+
|
1258 |
+
/**
|
1259 |
+
* Get a promise for the value of a player property.
|
1260 |
+
*
|
1261 |
+
* @param {string} name The property name
|
1262 |
+
* @return {Promise}
|
1263 |
+
*/
|
1264 |
+
|
1265 |
+
}, {
|
1266 |
+
key: 'get',
|
1267 |
+
value: function get(name) {
|
1268 |
+
var _this3 = this;
|
1269 |
+
|
1270 |
+
return new npo_src(function (resolve, reject) {
|
1271 |
+
name = getMethodName(name, 'get');
|
1272 |
+
|
1273 |
+
// We are storing the resolve/reject handlers to call later, so we
|
1274 |
+
// can’t return here.
|
1275 |
+
// eslint-disable-next-line promise/always-return
|
1276 |
+
return _this3.ready().then(function () {
|
1277 |
+
storeCallback(_this3, name, {
|
1278 |
+
resolve: resolve,
|
1279 |
+
reject: reject
|
1280 |
+
});
|
1281 |
+
|
1282 |
+
postMessage(_this3, name);
|
1283 |
+
});
|
1284 |
+
});
|
1285 |
+
}
|
1286 |
+
|
1287 |
+
/**
|
1288 |
+
* Get a promise for setting the value of a player property.
|
1289 |
+
*
|
1290 |
+
* @param {string} name The API method to call.
|
1291 |
+
* @param {mixed} value The value to set.
|
1292 |
+
* @return {Promise}
|
1293 |
+
*/
|
1294 |
+
|
1295 |
+
}, {
|
1296 |
+
key: 'set',
|
1297 |
+
value: function set(name, value) {
|
1298 |
+
var _this4 = this;
|
1299 |
+
|
1300 |
+
return npo_src.resolve(value).then(function (val) {
|
1301 |
+
name = getMethodName(name, 'set');
|
1302 |
+
|
1303 |
+
if (val === undefined || val === null) {
|
1304 |
+
throw new TypeError('There must be a value to set.');
|
1305 |
+
}
|
1306 |
+
|
1307 |
+
return _this4.ready().then(function () {
|
1308 |
+
return new npo_src(function (resolve, reject) {
|
1309 |
+
storeCallback(_this4, name, {
|
1310 |
+
resolve: resolve,
|
1311 |
+
reject: reject
|
1312 |
+
});
|
1313 |
+
|
1314 |
+
postMessage(_this4, name, val);
|
1315 |
+
});
|
1316 |
+
});
|
1317 |
+
});
|
1318 |
+
}
|
1319 |
+
|
1320 |
+
/**
|
1321 |
+
* Add an event listener for the specified event. Will call the
|
1322 |
+
* callback with a single parameter, `data`, that contains the data for
|
1323 |
+
* that event.
|
1324 |
+
*
|
1325 |
+
* @param {string} eventName The name of the event.
|
1326 |
+
* @param {function(*)} callback The function to call when the event fires.
|
1327 |
+
* @return {void}
|
1328 |
+
*/
|
1329 |
+
|
1330 |
+
}, {
|
1331 |
+
key: 'on',
|
1332 |
+
value: function on(eventName, callback) {
|
1333 |
+
if (!eventName) {
|
1334 |
+
throw new TypeError('You must pass an event name.');
|
1335 |
+
}
|
1336 |
+
|
1337 |
+
if (!callback) {
|
1338 |
+
throw new TypeError('You must pass a callback function.');
|
1339 |
+
}
|
1340 |
+
|
1341 |
+
if (typeof callback !== 'function') {
|
1342 |
+
throw new TypeError('The callback must be a function.');
|
1343 |
+
}
|
1344 |
+
|
1345 |
+
var callbacks = getCallbacks(this, 'event:' + eventName);
|
1346 |
+
if (callbacks.length === 0) {
|
1347 |
+
this.callMethod('addEventListener', eventName).catch(function () {
|
1348 |
+
// Ignore the error. There will be an error event fired that
|
1349 |
+
// will trigger the error callback if they are listening.
|
1350 |
+
});
|
1351 |
+
}
|
1352 |
+
|
1353 |
+
storeCallback(this, 'event:' + eventName, callback);
|
1354 |
+
}
|
1355 |
+
|
1356 |
+
/**
|
1357 |
+
* Remove an event listener for the specified event. Will remove all
|
1358 |
+
* listeners for that event if a `callback` isn’t passed, or only that
|
1359 |
+
* specific callback if it is passed.
|
1360 |
+
*
|
1361 |
+
* @param {string} eventName The name of the event.
|
1362 |
+
* @param {function} [callback] The specific callback to remove.
|
1363 |
+
* @return {void}
|
1364 |
+
*/
|
1365 |
+
|
1366 |
+
}, {
|
1367 |
+
key: 'off',
|
1368 |
+
value: function off(eventName, callback) {
|
1369 |
+
if (!eventName) {
|
1370 |
+
throw new TypeError('You must pass an event name.');
|
1371 |
+
}
|
1372 |
+
|
1373 |
+
if (callback && typeof callback !== 'function') {
|
1374 |
+
throw new TypeError('The callback must be a function.');
|
1375 |
+
}
|
1376 |
+
|
1377 |
+
var lastCallback = removeCallback(this, 'event:' + eventName, callback);
|
1378 |
+
|
1379 |
+
// If there are no callbacks left, remove the listener
|
1380 |
+
if (lastCallback) {
|
1381 |
+
this.callMethod('removeEventListener', eventName).catch(function (e) {
|
1382 |
+
// Ignore the error. There will be an error event fired that
|
1383 |
+
// will trigger the error callback if they are listening.
|
1384 |
+
});
|
1385 |
+
}
|
1386 |
+
}
|
1387 |
+
|
1388 |
+
/**
|
1389 |
+
* A promise to load a new video.
|
1390 |
+
*
|
1391 |
+
* @promise LoadVideoPromise
|
1392 |
+
* @fulfill {number} The video with this id successfully loaded.
|
1393 |
+
* @reject {TypeError} The id was not a number.
|
1394 |
+
*/
|
1395 |
+
/**
|
1396 |
+
* Load a new video into this embed. The promise will be resolved if
|
1397 |
+
* the video is successfully loaded, or it will be rejected if it could
|
1398 |
+
* not be loaded.
|
1399 |
+
*
|
1400 |
+
* @param {number} id The id of the video.
|
1401 |
+
* @return {LoadVideoPromise}
|
1402 |
+
*/
|
1403 |
+
|
1404 |
+
}, {
|
1405 |
+
key: 'loadVideo',
|
1406 |
+
value: function loadVideo(id) {
|
1407 |
+
return this.callMethod('loadVideo', id);
|
1408 |
+
}
|
1409 |
+
|
1410 |
+
/**
|
1411 |
+
* A promise to perform an action when the Player is ready.
|
1412 |
+
*
|
1413 |
+
* @todo document errors
|
1414 |
+
* @promise LoadVideoPromise
|
1415 |
+
* @fulfill {void}
|
1416 |
+
*/
|
1417 |
+
/**
|
1418 |
+
* Trigger a function when the player iframe has initialized. You do not
|
1419 |
+
* need to wait for `ready` to trigger to begin adding event listeners
|
1420 |
+
* or calling other methods.
|
1421 |
+
*
|
1422 |
+
* @return {ReadyPromise}
|
1423 |
+
*/
|
1424 |
+
|
1425 |
+
}, {
|
1426 |
+
key: 'ready',
|
1427 |
+
value: function ready() {
|
1428 |
+
var readyPromise = readyMap.get(this) || new npo_src(function (resolve, reject) {
|
1429 |
+
reject('Unknown player. Probably unloaded.');
|
1430 |
+
});
|
1431 |
+
return npo_src.resolve(readyPromise);
|
1432 |
+
}
|
1433 |
+
|
1434 |
+
/**
|
1435 |
+
* A promise to add a cue point to the player.
|
1436 |
+
*
|
1437 |
+
* @promise AddCuePointPromise
|
1438 |
+
* @fulfill {string} The id of the cue point to use for removeCuePoint.
|
1439 |
+
* @reject {RangeError} the time was less than 0 or greater than the
|
1440 |
+
* video’s duration.
|
1441 |
+
* @reject {UnsupportedError} Cue points are not supported with the current
|
1442 |
+
* player or browser.
|
1443 |
+
*/
|
1444 |
+
/**
|
1445 |
+
* Add a cue point to the player.
|
1446 |
+
*
|
1447 |
+
* @param {number} time The time for the cue point.
|
1448 |
+
* @param {object} [data] Arbitrary data to be returned with the cue point.
|
1449 |
+
* @return {AddCuePointPromise}
|
1450 |
+
*/
|
1451 |
+
|
1452 |
+
}, {
|
1453 |
+
key: 'addCuePoint',
|
1454 |
+
value: function addCuePoint(time) {
|
1455 |
+
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
1456 |
+
|
1457 |
+
return this.callMethod('addCuePoint', { time: time, data: data });
|
1458 |
+
}
|
1459 |
+
|
1460 |
+
/**
|
1461 |
+
* A promise to remove a cue point from the player.
|
1462 |
+
*
|
1463 |
+
* @promise AddCuePointPromise
|
1464 |
+
* @fulfill {string} The id of the cue point that was removed.
|
1465 |
+
* @reject {InvalidCuePoint} The cue point with the specified id was not
|
1466 |
+
* found.
|
1467 |
+
* @reject {UnsupportedError} Cue points are not supported with the current
|
1468 |
+
* player or browser.
|
1469 |
+
*/
|
1470 |
+
/**
|
1471 |
+
* Remove a cue point from the video.
|
1472 |
+
*
|
1473 |
+
* @param {string} id The id of the cue point to remove.
|
1474 |
+
* @return {RemoveCuePointPromise}
|
1475 |
+
*/
|
1476 |
+
|
1477 |
+
}, {
|
1478 |
+
key: 'removeCuePoint',
|
1479 |
+
value: function removeCuePoint(id) {
|
1480 |
+
return this.callMethod('removeCuePoint', id);
|
1481 |
+
}
|
1482 |
+
|
1483 |
+
/**
|
1484 |
+
* A representation of a text track on a video.
|
1485 |
+
*
|
1486 |
+
* @typedef {Object} VimeoTextTrack
|
1487 |
+
* @property {string} language The ISO language code.
|
1488 |
+
* @property {string} kind The kind of track it is (captions or subtitles).
|
1489 |
+
* @property {string} label The human‐readable label for the track.
|
1490 |
+
*/
|
1491 |
+
/**
|
1492 |
+
* A promise to enable a text track.
|
1493 |
+
*
|
1494 |
+
* @promise EnableTextTrackPromise
|
1495 |
+
* @fulfill {VimeoTextTrack} The text track that was enabled.
|
1496 |
+
* @reject {InvalidTrackLanguageError} No track was available with the
|
1497 |
+
* specified language.
|
1498 |
+
* @reject {InvalidTrackError} No track was available with the specified
|
1499 |
+
* language and kind.
|
1500 |
+
*/
|
1501 |
+
/**
|
1502 |
+
* Enable the text track with the specified language, and optionally the
|
1503 |
+
* specified kind (captions or subtitles).
|
1504 |
+
*
|
1505 |
+
* When set via the API, the track language will not change the viewer’s
|
1506 |
+
* stored preference.
|
1507 |
+
*
|
1508 |
+
* @param {string} language The two‐letter language code.
|
1509 |
+
* @param {string} [kind] The kind of track to enable (captions or subtitles).
|
1510 |
+
* @return {EnableTextTrackPromise}
|
1511 |
+
*/
|
1512 |
+
|
1513 |
+
}, {
|
1514 |
+
key: 'enableTextTrack',
|
1515 |
+
value: function enableTextTrack(language, kind) {
|
1516 |
+
if (!language) {
|
1517 |
+
throw new TypeError('You must pass a language.');
|
1518 |
+
}
|
1519 |
+
|
1520 |
+
return this.callMethod('enableTextTrack', {
|
1521 |
+
language: language,
|
1522 |
+
kind: kind
|
1523 |
+
});
|
1524 |
+
}
|
1525 |
+
|
1526 |
+
/**
|
1527 |
+
* A promise to disable the active text track.
|
1528 |
+
*
|
1529 |
+
* @promise DisableTextTrackPromise
|
1530 |
+
* @fulfill {void} The track was disabled.
|
1531 |
+
*/
|
1532 |
+
/**
|
1533 |
+
* Disable the currently-active text track.
|
1534 |
+
*
|
1535 |
+
* @return {DisableTextTrackPromise}
|
1536 |
+
*/
|
1537 |
+
|
1538 |
+
}, {
|
1539 |
+
key: 'disableTextTrack',
|
1540 |
+
value: function disableTextTrack() {
|
1541 |
+
return this.callMethod('disableTextTrack');
|
1542 |
+
}
|
1543 |
+
|
1544 |
+
/**
|
1545 |
+
* A promise to pause the video.
|
1546 |
+
*
|
1547 |
+
* @promise PausePromise
|
1548 |
+
* @fulfill {void} The video was paused.
|
1549 |
+
*/
|
1550 |
+
/**
|
1551 |
+
* Pause the video if it’s playing.
|
1552 |
+
*
|
1553 |
+
* @return {PausePromise}
|
1554 |
+
*/
|
1555 |
+
|
1556 |
+
}, {
|
1557 |
+
key: 'pause',
|
1558 |
+
value: function pause() {
|
1559 |
+
return this.callMethod('pause');
|
1560 |
+
}
|
1561 |
+
|
1562 |
+
/**
|
1563 |
+
* A promise to play the video.
|
1564 |
+
*
|
1565 |
+
* @promise PlayPromise
|
1566 |
+
* @fulfill {void} The video was played.
|
1567 |
+
*/
|
1568 |
+
/**
|
1569 |
+
* Play the video if it’s paused. **Note:** on iOS and some other
|
1570 |
+
* mobile devices, you cannot programmatically trigger play. Once the
|
1571 |
+
* viewer has tapped on the play button in the player, however, you
|
1572 |
+
* will be able to use this function.
|
1573 |
+
*
|
1574 |
+
* @return {PlayPromise}
|
1575 |
+
*/
|
1576 |
+
|
1577 |
+
}, {
|
1578 |
+
key: 'play',
|
1579 |
+
value: function play() {
|
1580 |
+
return this.callMethod('play');
|
1581 |
+
}
|
1582 |
+
|
1583 |
+
/**
|
1584 |
+
* A promise to unload the video.
|
1585 |
+
*
|
1586 |
+
* @promise UnloadPromise
|
1587 |
+
* @fulfill {void} The video was unloaded.
|
1588 |
+
*/
|
1589 |
+
/**
|
1590 |
+
* Return the player to its initial state.
|
1591 |
+
*
|
1592 |
+
* @return {UnloadPromise}
|
1593 |
+
*/
|
1594 |
+
|
1595 |
+
}, {
|
1596 |
+
key: 'unload',
|
1597 |
+
value: function unload() {
|
1598 |
+
return this.callMethod('unload');
|
1599 |
+
}
|
1600 |
+
|
1601 |
+
/**
|
1602 |
+
* Cleanup the player and remove it from the DOM
|
1603 |
+
*
|
1604 |
+
* It won't be usable and a new one should be constructed
|
1605 |
+
* in order to do any operations.
|
1606 |
+
*
|
1607 |
+
* @return {Promise}
|
1608 |
+
*/
|
1609 |
+
|
1610 |
+
}, {
|
1611 |
+
key: 'destroy',
|
1612 |
+
value: function destroy() {
|
1613 |
+
var _this5 = this;
|
1614 |
+
|
1615 |
+
return new npo_src(function (resolve) {
|
1616 |
+
readyMap.delete(_this5);
|
1617 |
+
playerMap.delete(_this5.element);
|
1618 |
+
if (_this5._originalElement) {
|
1619 |
+
playerMap.delete(_this5._originalElement);
|
1620 |
+
_this5._originalElement.removeAttribute('data-vimeo-initialized');
|
1621 |
+
}
|
1622 |
+
if (_this5.element && _this5.element.nodeName === 'IFRAME') {
|
1623 |
+
_this5.element.remove();
|
1624 |
+
}
|
1625 |
+
resolve();
|
1626 |
+
});
|
1627 |
+
}
|
1628 |
+
|
1629 |
+
/**
|
1630 |
+
* A promise to get the autopause behavior of the video.
|
1631 |
+
*
|
1632 |
+
* @promise GetAutopausePromise
|
1633 |
+
* @fulfill {boolean} Whether autopause is turned on or off.
|
1634 |
+
* @reject {UnsupportedError} Autopause is not supported with the current
|
1635 |
+
* player or browser.
|
1636 |
+
*/
|
1637 |
+
/**
|
1638 |
+
* Get the autopause behavior for this player.
|
1639 |
+
*
|
1640 |
+
* @return {GetAutopausePromise}
|
1641 |
+
*/
|
1642 |
+
|
1643 |
+
}, {
|
1644 |
+
key: 'getAutopause',
|
1645 |
+
value: function getAutopause() {
|
1646 |
+
return this.get('autopause');
|
1647 |
+
}
|
1648 |
+
|
1649 |
+
/**
|
1650 |
+
* A promise to set the autopause behavior of the video.
|
1651 |
+
*
|
1652 |
+
* @promise SetAutopausePromise
|
1653 |
+
* @fulfill {boolean} Whether autopause is turned on or off.
|
1654 |
+
* @reject {UnsupportedError} Autopause is not supported with the current
|
1655 |
+
* player or browser.
|
1656 |
+
*/
|
1657 |
+
/**
|
1658 |
+
* Enable or disable the autopause behavior of this player.
|
1659 |
+
*
|
1660 |
+
* By default, when another video is played in the same browser, this
|
1661 |
+
* player will automatically pause. Unless you have a specific reason
|
1662 |
+
* for doing so, we recommend that you leave autopause set to the
|
1663 |
+
* default (`true`).
|
1664 |
+
*
|
1665 |
+
* @param {boolean} autopause
|
1666 |
+
* @return {SetAutopausePromise}
|
1667 |
+
*/
|
1668 |
+
|
1669 |
+
}, {
|
1670 |
+
key: 'setAutopause',
|
1671 |
+
value: function setAutopause(autopause) {
|
1672 |
+
return this.set('autopause', autopause);
|
1673 |
+
}
|
1674 |
+
|
1675 |
+
/**
|
1676 |
+
* A promise to get the color of the player.
|
1677 |
+
*
|
1678 |
+
* @promise GetColorPromise
|
1679 |
+
* @fulfill {string} The hex color of the player.
|
1680 |
+
*/
|
1681 |
+
/**
|
1682 |
+
* Get the color for this player.
|
1683 |
+
*
|
1684 |
+
* @return {GetColorPromise}
|
1685 |
+
*/
|
1686 |
+
|
1687 |
+
}, {
|
1688 |
+
key: 'getColor',
|
1689 |
+
value: function getColor() {
|
1690 |
+
return this.get('color');
|
1691 |
+
}
|
1692 |
+
|
1693 |
+
/**
|
1694 |
+
* A promise to set the color of the player.
|
1695 |
+
*
|
1696 |
+
* @promise SetColorPromise
|
1697 |
+
* @fulfill {string} The color was successfully set.
|
1698 |
+
* @reject {TypeError} The string was not a valid hex or rgb color.
|
1699 |
+
* @reject {ContrastError} The color was set, but the contrast is
|
1700 |
+
* outside of the acceptable range.
|
1701 |
+
* @reject {EmbedSettingsError} The owner of the player has chosen to
|
1702 |
+
* use a specific color.
|
1703 |
+
*/
|
1704 |
+
/**
|
1705 |
+
* Set the color of this player to a hex or rgb string. Setting the
|
1706 |
+
* color may fail if the owner of the video has set their embed
|
1707 |
+
* preferences to force a specific color.
|
1708 |
+
*
|
1709 |
+
* @param {string} color The hex or rgb color string to set.
|
1710 |
+
* @return {SetColorPromise}
|
1711 |
+
*/
|
1712 |
+
|
1713 |
+
}, {
|
1714 |
+
key: 'setColor',
|
1715 |
+
value: function setColor(color) {
|
1716 |
+
return this.set('color', color);
|
1717 |
+
}
|
1718 |
+
|
1719 |
+
/**
|
1720 |
+
* A representation of a cue point.
|
1721 |
+
*
|
1722 |
+
* @typedef {Object} VimeoCuePoint
|
1723 |
+
* @property {number} time The time of the cue point.
|
1724 |
+
* @property {object} data The data passed when adding the cue point.
|
1725 |
+
* @property {string} id The unique id for use with removeCuePoint.
|
1726 |
+
*/
|
1727 |
+
/**
|
1728 |
+
* A promise to get the cue points of a video.
|
1729 |
+
*
|
1730 |
+
* @promise GetCuePointsPromise
|
1731 |
+
* @fulfill {VimeoCuePoint[]} The cue points added to the video.
|
1732 |
+
* @reject {UnsupportedError} Cue points are not supported with the current
|
1733 |
+
* player or browser.
|
1734 |
+
*/
|
1735 |
+
/**
|
1736 |
+
* Get an array of the cue points added to the video.
|
1737 |
+
*
|
1738 |
+
* @return {GetCuePointsPromise}
|
1739 |
+
*/
|
1740 |
+
|
1741 |
+
}, {
|
1742 |
+
key: 'getCuePoints',
|
1743 |
+
value: function getCuePoints() {
|
1744 |
+
return this.get('cuePoints');
|
1745 |
+
}
|
1746 |
+
|
1747 |
+
/**
|
1748 |
+
* A promise to get the current time of the video.
|
1749 |
+
*
|
1750 |
+
* @promise GetCurrentTimePromise
|
1751 |
+
* @fulfill {number} The current time in seconds.
|
1752 |
+
*/
|
1753 |
+
/**
|
1754 |
+
* Get the current playback position in seconds.
|
1755 |
+
*
|
1756 |
+
* @return {GetCurrentTimePromise}
|
1757 |
+
*/
|
1758 |
+
|
1759 |
+
}, {
|
1760 |
+
key: 'getCurrentTime',
|
1761 |
+
value: function getCurrentTime() {
|
1762 |
+
return this.get('currentTime');
|
1763 |
+
}
|
1764 |
+
|
1765 |
+
/**
|
1766 |
+
* A promise to set the current time of the video.
|
1767 |
+
*
|
1768 |
+
* @promise SetCurrentTimePromise
|
1769 |
+
* @fulfill {number} The actual current time that was set.
|
1770 |
+
* @reject {RangeError} the time was less than 0 or greater than the
|
1771 |
+
* video’s duration.
|
1772 |
+
*/
|
1773 |
+
/**
|
1774 |
+
* Set the current playback position in seconds. If the player was
|
1775 |
+
* paused, it will remain paused. Likewise, if the player was playing,
|
1776 |
+
* it will resume playing once the video has buffered.
|
1777 |
+
*
|
1778 |
+
* You can provide an accurate time and the player will attempt to seek
|
1779 |
+
* to as close to that time as possible. The exact time will be the
|
1780 |
+
* fulfilled value of the promise.
|
1781 |
+
*
|
1782 |
+
* @param {number} currentTime
|
1783 |
+
* @return {SetCurrentTimePromise}
|
1784 |
+
*/
|
1785 |
+
|
1786 |
+
}, {
|
1787 |
+
key: 'setCurrentTime',
|
1788 |
+
value: function setCurrentTime(currentTime) {
|
1789 |
+
return this.set('currentTime', currentTime);
|
1790 |
+
}
|
1791 |
+
|
1792 |
+
/**
|
1793 |
+
* A promise to get the duration of the video.
|
1794 |
+
*
|
1795 |
+
* @promise GetDurationPromise
|
1796 |
+
* @fulfill {number} The duration in seconds.
|
1797 |
+
*/
|
1798 |
+
/**
|
1799 |
+
* Get the duration of the video in seconds. It will be rounded to the
|
1800 |
+
* nearest second before playback begins, and to the nearest thousandth
|
1801 |
+
* of a second after playback begins.
|
1802 |
+
*
|
1803 |
+
* @return {GetDurationPromise}
|
1804 |
+
*/
|
1805 |
+
|
1806 |
+
}, {
|
1807 |
+
key: 'getDuration',
|
1808 |
+
value: function getDuration() {
|
1809 |
+
return this.get('duration');
|
1810 |
+
}
|
1811 |
+
|
1812 |
+
/**
|
1813 |
+
* A promise to get the ended state of the video.
|
1814 |
+
*
|
1815 |
+
* @promise GetEndedPromise
|
1816 |
+
* @fulfill {boolean} Whether or not the video has ended.
|
1817 |
+
*/
|
1818 |
+
/**
|
1819 |
+
* Get the ended state of the video. The video has ended if
|
1820 |
+
* `currentTime === duration`.
|
1821 |
+
*
|
1822 |
+
* @return {GetEndedPromise}
|
1823 |
+
*/
|
1824 |
+
|
1825 |
+
}, {
|
1826 |
+
key: 'getEnded',
|
1827 |
+
value: function getEnded() {
|
1828 |
+
return this.get('ended');
|
1829 |
+
}
|
1830 |
+
|
1831 |
+
/**
|
1832 |
+
* A promise to get the loop state of the player.
|
1833 |
+
*
|
1834 |
+
* @promise GetLoopPromise
|
1835 |
+
* @fulfill {boolean} Whether or not the player is set to loop.
|
1836 |
+
*/
|
1837 |
+
/**
|
1838 |
+
* Get the loop state of the player.
|
1839 |
+
*
|
1840 |
+
* @return {GetLoopPromise}
|
1841 |
+
*/
|
1842 |
+
|
1843 |
+
}, {
|
1844 |
+
key: 'getLoop',
|
1845 |
+
value: function getLoop() {
|
1846 |
+
return this.get('loop');
|
1847 |
+
}
|
1848 |
+
|
1849 |
+
/**
|
1850 |
+
* A promise to set the loop state of the player.
|
1851 |
+
*
|
1852 |
+
* @promise SetLoopPromise
|
1853 |
+
* @fulfill {boolean} The loop state that was set.
|
1854 |
+
*/
|
1855 |
+
/**
|
1856 |
+
* Set the loop state of the player. When set to `true`, the player
|
1857 |
+
* will start over immediately once playback ends.
|
1858 |
+
*
|
1859 |
+
* @param {boolean} loop
|
1860 |
+
* @return {SetLoopPromise}
|
1861 |
+
*/
|
1862 |
+
|
1863 |
+
}, {
|
1864 |
+
key: 'setLoop',
|
1865 |
+
value: function setLoop(loop) {
|
1866 |
+
return this.set('loop', loop);
|
1867 |
+
}
|
1868 |
+
|
1869 |
+
/**
|
1870 |
+
* A promise to get the paused state of the player.
|
1871 |
+
*
|
1872 |
+
* @promise GetLoopPromise
|
1873 |
+
* @fulfill {boolean} Whether or not the video is paused.
|
1874 |
+
*/
|
1875 |
+
/**
|
1876 |
+
* Get the paused state of the player.
|
1877 |
+
*
|
1878 |
+
* @return {GetLoopPromise}
|
1879 |
+
*/
|
1880 |
+
|
1881 |
+
}, {
|
1882 |
+
key: 'getPaused',
|
1883 |
+
value: function getPaused() {
|
1884 |
+
return this.get('paused');
|
1885 |
+
}
|
1886 |
+
|
1887 |
+
/**
|
1888 |
+
* A promise to get the playback rate of the player.
|
1889 |
+
*
|
1890 |
+
* @promise GetPlaybackRatePromise
|
1891 |
+
* @fulfill {number} The playback rate of the player on a scale from 0.5 to 2.
|
1892 |
+
*/
|
1893 |
+
/**
|
1894 |
+
* Get the playback rate of the player on a scale from `0.5` to `2`.
|
1895 |
+
*
|
1896 |
+
* @return {GetPlaybackRatePromise}
|
1897 |
+
*/
|
1898 |
+
|
1899 |
+
}, {
|
1900 |
+
key: 'getPlaybackRate',
|
1901 |
+
value: function getPlaybackRate() {
|
1902 |
+
return this.get('playbackRate');
|
1903 |
+
}
|
1904 |
+
|
1905 |
+
/**
|
1906 |
+
* A promise to set the playbackrate of the player.
|
1907 |
+
*
|
1908 |
+
* @promise SetPlaybackRatePromise
|
1909 |
+
* @fulfill {number} The playback rate was set.
|
1910 |
+
* @reject {RangeError} The playback rate was less than 0.5 or greater than 2.
|
1911 |
+
*/
|
1912 |
+
/**
|
1913 |
+
* Set the playback rate of the player on a scale from `0.5` to `2`. When set
|
1914 |
+
* via the API, the playback rate will not be synchronized to other
|
1915 |
+
* players or stored as the viewer's preference.
|
1916 |
+
*
|
1917 |
+
* @param {number} playbackRate
|
1918 |
+
* @return {SetPlaybackRatePromise}
|
1919 |
+
*/
|
1920 |
+
|
1921 |
+
}, {
|
1922 |
+
key: 'setPlaybackRate',
|
1923 |
+
value: function setPlaybackRate(playbackRate) {
|
1924 |
+
return this.set('playbackRate', playbackRate);
|
1925 |
+
}
|
1926 |
+
|
1927 |
+
/**
|
1928 |
+
* A promise to get the text tracks of a video.
|
1929 |
+
*
|
1930 |
+
* @promise GetTextTracksPromise
|
1931 |
+
* @fulfill {VimeoTextTrack[]} The text tracks associated with the video.
|
1932 |
+
*/
|
1933 |
+
/**
|
1934 |
+
* Get an array of the text tracks that exist for the video.
|
1935 |
+
*
|
1936 |
+
* @return {GetTextTracksPromise}
|
1937 |
+
*/
|
1938 |
+
|
1939 |
+
}, {
|
1940 |
+
key: 'getTextTracks',
|
1941 |
+
value: function getTextTracks() {
|
1942 |
+
return this.get('textTracks');
|
1943 |
+
}
|
1944 |
+
|
1945 |
+
/**
|
1946 |
+
* A promise to get the embed code for the video.
|
1947 |
+
*
|
1948 |
+
* @promise GetVideoEmbedCodePromise
|
1949 |
+
* @fulfill {string} The `<iframe>` embed code for the video.
|
1950 |
+
*/
|
1951 |
+
/**
|
1952 |
+
* Get the `<iframe>` embed code for the video.
|
1953 |
+
*
|
1954 |
+
* @return {GetVideoEmbedCodePromise}
|
1955 |
+
*/
|
1956 |
+
|
1957 |
+
}, {
|
1958 |
+
key: 'getVideoEmbedCode',
|
1959 |
+
value: function getVideoEmbedCode() {
|
1960 |
+
return this.get('videoEmbedCode');
|
1961 |
+
}
|
1962 |
+
|
1963 |
+
/**
|
1964 |
+
* A promise to get the id of the video.
|
1965 |
+
*
|
1966 |
+
* @promise GetVideoIdPromise
|
1967 |
+
* @fulfill {number} The id of the video.
|
1968 |
+
*/
|
1969 |
+
/**
|
1970 |
+
* Get the id of the video.
|
1971 |
+
*
|
1972 |
+
* @return {GetVideoIdPromise}
|
1973 |
+
*/
|
1974 |
+
|
1975 |
+
}, {
|
1976 |
+
key: 'getVideoId',
|
1977 |
+
value: function getVideoId() {
|
1978 |
+
return this.get('videoId');
|
1979 |
+
}
|
1980 |
+
|
1981 |
+
/**
|
1982 |
+
* A promise to get the title of the video.
|
1983 |
+
*
|
1984 |
+
* @promise GetVideoTitlePromise
|
1985 |
+
* @fulfill {number} The title of the video.
|
1986 |
+
*/
|
1987 |
+
/**
|
1988 |
+
* Get the title of the video.
|
1989 |
+
*
|
1990 |
+
* @return {GetVideoTitlePromise}
|
1991 |
+
*/
|
1992 |
+
|
1993 |
+
}, {
|
1994 |
+
key: 'getVideoTitle',
|
1995 |
+
value: function getVideoTitle() {
|
1996 |
+
return this.get('videoTitle');
|
1997 |
+
}
|
1998 |
+
|
1999 |
+
/**
|
2000 |
+
* A promise to get the native width of the video.
|
2001 |
+
*
|
2002 |
+
* @promise GetVideoWidthPromise
|
2003 |
+
* @fulfill {number} The native width of the video.
|
2004 |
+
*/
|
2005 |
+
/**
|
2006 |
+
* Get the native width of the currently‐playing video. The width of
|
2007 |
+
* the highest‐resolution available will be used before playback begins.
|
2008 |
+
*
|
2009 |
+
* @return {GetVideoWidthPromise}
|
2010 |
+
*/
|
2011 |
+
|
2012 |
+
}, {
|
2013 |
+
key: 'getVideoWidth',
|
2014 |
+
value: function getVideoWidth() {
|
2015 |
+
return this.get('videoWidth');
|
2016 |
+
}
|
2017 |
+
|
2018 |
+
/**
|
2019 |
+
* A promise to get the native height of the video.
|
2020 |
+
*
|
2021 |
+
* @promise GetVideoHeightPromise
|
2022 |
+
* @fulfill {number} The native height of the video.
|
2023 |
+
*/
|
2024 |
+
/**
|
2025 |
+
* Get the native height of the currently‐playing video. The height of
|
2026 |
+
* the highest‐resolution available will be used before playback begins.
|
2027 |
+
*
|
2028 |
+
* @return {GetVideoHeightPromise}
|
2029 |
+
*/
|
2030 |
+
|
2031 |
+
}, {
|
2032 |
+
key: 'getVideoHeight',
|
2033 |
+
value: function getVideoHeight() {
|
2034 |
+
return this.get('videoHeight');
|
2035 |
+
}
|
2036 |
+
|
2037 |
+
/**
|
2038 |
+
* A promise to get the vimeo.com url for the video.
|
2039 |
+
*
|
2040 |
+
* @promise GetVideoUrlPromise
|
2041 |
+
* @fulfill {number} The vimeo.com url for the video.
|
2042 |
+
* @reject {PrivacyError} The url isn’t available because of the video’s privacy setting.
|
2043 |
+
*/
|
2044 |
+
/**
|
2045 |
+
* Get the vimeo.com url for the video.
|
2046 |
+
*
|
2047 |
+
* @return {GetVideoUrlPromise}
|
2048 |
+
*/
|
2049 |
+
|
2050 |
+
}, {
|
2051 |
+
key: 'getVideoUrl',
|
2052 |
+
value: function getVideoUrl() {
|
2053 |
+
return this.get('videoUrl');
|
2054 |
+
}
|
2055 |
+
|
2056 |
+
/**
|
2057 |
+
* A promise to get the volume level of the player.
|
2058 |
+
*
|
2059 |
+
* @promise GetVolumePromise
|
2060 |
+
* @fulfill {number} The volume level of the player on a scale from 0 to 1.
|
2061 |
+
*/
|
2062 |
+
/**
|
2063 |
+
* Get the current volume level of the player on a scale from `0` to `1`.
|
2064 |
+
*
|
2065 |
+
* Most mobile devices do not support an independent volume from the
|
2066 |
+
* system volume. In those cases, this method will always return `1`.
|
2067 |
+
*
|
2068 |
+
* @return {GetVolumePromise}
|
2069 |
+
*/
|
2070 |
+
|
2071 |
+
}, {
|
2072 |
+
key: 'getVolume',
|
2073 |
+
value: function getVolume() {
|
2074 |
+
return this.get('volume');
|
2075 |
+
}
|
2076 |
+
|
2077 |
+
/**
|
2078 |
+
* A promise to set the volume level of the player.
|
2079 |
+
*
|
2080 |
+
* @promise SetVolumePromise
|
2081 |
+
* @fulfill {number} The volume was set.
|
2082 |
+
* @reject {RangeError} The volume was less than 0 or greater than 1.
|
2083 |
+
*/
|
2084 |
+
/**
|
2085 |
+
* Set the volume of the player on a scale from `0` to `1`. When set
|
2086 |
+
* via the API, the volume level will not be synchronized to other
|
2087 |
+
* players or stored as the viewer’s preference.
|
2088 |
+
*
|
2089 |
+
* Most mobile devices do not support setting the volume. An error will
|
2090 |
+
* *not* be triggered in that situation.
|
2091 |
+
*
|
2092 |
+
* @param {number} volume
|
2093 |
+
* @return {SetVolumePromise}
|
2094 |
+
*/
|
2095 |
+
|
2096 |
+
}, {
|
2097 |
+
key: 'setVolume',
|
2098 |
+
value: function setVolume(volume) {
|
2099 |
+
return this.set('volume', volume);
|
2100 |
+
}
|
2101 |
+
}]);
|
2102 |
+
|
2103 |
+
return Player;
|
2104 |
+
}();
|
2105 |
+
|
2106 |
+
// Setup embed only if this is not a node environment
|
2107 |
+
// and if there is no existing Vimeo Player object
|
2108 |
+
|
2109 |
+
|
2110 |
+
if (!isNode && window.Vimeo && !window.Vimeo.Player) {
|
2111 |
+
initializeEmbeds();
|
2112 |
+
resizeEmbeds();
|
2113 |
+
}
|
2114 |
+
|
2115 |
+
return Player;
|
2116 |
+
|
2117 |
+
})));
|
2118 |
+
|
2119 |
//# sourceMappingURL=player.js.map
|
assets/js/vendor/player.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/*! @vimeo/player v2.6.1 | (c) 2018 Vimeo | MIT License | https://github.com/vimeo/player.js */
|
2 |
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e.Vimeo=e.Vimeo||{},e.Vimeo.Player=t())}(this,function(){"use strict";function e(e,t){return 0===e.indexOf(t.toLowerCase())?e:""+t.toLowerCase()+e.substr(0,1).toUpperCase()+e.substr(1)}function t(e){return e instanceof window.HTMLElement}function n(e){return!isNaN(parseFloat(e))&&isFinite(e)&&Math.floor(e)==e}function r(e){return/^(https?:)?\/\/((player|www).)?vimeo.com(?=$|\/)/.test(e)}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.id,i=e.url,o=t||i;if(!o)throw new Error("An id or url must be passed, either in an options object or as a data-vimeo-id or data-vimeo-url attribute.");if(n(o))return"https://vimeo.com/"+o;if(r(o))return o.replace("http:","https:");if(t)throw new TypeError("“"+t+"” is not a valid video id.");throw new TypeError("“"+o+"” is not a vimeo.com url.")}function o(e,t){return t={exports:{}},e(t,t.exports),t.exports}function a(e,t,n){var r=T.get(e.element)||{};t in r||(r[t]=[]),r[t].push(n),T.set(e.element,r)}function u(e,t){return(T.get(e.element)||{})[t]||[]}function s(e,t,n){var r=T.get(e.element)||{};if(!r[t])return!0;if(!n)return r[t]=[],T.set(e.element,r),!0;var i=r[t].indexOf(n);return-1!==i&&r[t].splice(i,1),T.set(e.element,r),r[t]&&0===r[t].length}function c(e,t){var n=u(e,t);if(n.length<1)return!1;var r=n.shift();return s(e,t,r),r}function l(e,t){var n=T.get(e);T.set(t,n),T.delete(e)}function f(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return _.reduce(function(t,n){var r=e.getAttribute("data-vimeo-"+n);return(r||""===r)&&(t[n]=""===r?1:r),t},t)}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(n,i){if(!r(e))throw new TypeError("“"+e+"” is not a vimeo.com url.");var o="https://vimeo.com/api/oembed.json?url="+encodeURIComponent(e);for(var a in t)t.hasOwnProperty(a)&&(o+="&"+a+"="+encodeURIComponent(t[a]));var u="XDomainRequest"in window?new XDomainRequest:new XMLHttpRequest;u.open("GET",o,!0),u.onload=function(){if(404===u.status)return void i(new Error("“"+e+"” was not found."));if(403===u.status)return void i(new Error("“"+e+"” is not embeddable."));try{var t=JSON.parse(u.responseText);n(t)}catch(e){i(e)}},u.onerror=function(){var e=u.status?" ("+u.status+")":"";i(new Error("There was an error fetching the embed code from Vimeo"+e+"."))},u.send()})}function d(e,t){var n=e.html;if(!t)throw new TypeError("An element must be provided");if(null!==t.getAttribute("data-vimeo-initialized"))return t.querySelector("iframe");var r=document.createElement("div");return r.innerHTML=n,t.appendChild(r.firstChild),t.setAttribute("data-vimeo-initialized","true"),t.querySelector("iframe")}function v(e){return"string"==typeof e&&(e=JSON.parse(e)),e}function p(e,t,n){if(e.element.contentWindow&&e.element.contentWindow.postMessage){var r={method:t};void 0!==n&&(r.value=n);var i=parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/,"$1"));i>=8&&i<10&&(r=JSON.stringify(r)),e.element.contentWindow.postMessage(r,e.origin)}}function y(e,t){t=v(t);var n=[],r=void 0;if(t.event){if("error"===t.event){u(e,t.data.method).forEach(function(n){var r=new Error(t.data.message);r.name=t.data.name,n.reject(r),s(e,t.data.method,n)})}n=u(e,"event:"+t.event),r=t.data}else if(t.method){var i=c(e,t.method);i&&(n.push(i),r=t.value)}n.forEach(function(t){try{if("function"==typeof t)return void t.call(e,r);t.resolve(r)}catch(e){}})}function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var g="undefined"!=typeof global&&"[object global]"==={}.toString.call(global),w=void 0!==Array.prototype.indexOf,b="undefined"!=typeof window&&void 0!==window.postMessage;if(!(g||w&&b))throw new Error("Sorry, the Vimeo Player API is not available in this browser.");var k="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},E=(o(function(e,t){!function(e){function t(e,t){function r(e){if(!this||this.constructor!==r)return new r(e);this._keys=[],this._values=[],this._itp=[],this.objectOnly=t,e&&n.call(this,e)}return t||w(e,"size",{get:y}),e.constructor=r,r.prototype=e,r}function n(e){this.add?e.forEach(this.add,this):e.forEach(function(e){this.set(e[0],e[1])},this)}function r(e){return this.has(e)&&(this._keys.splice(g,1),this._values.splice(g,1),this._itp.forEach(function(e){g<e[0]&&e[0]--})),-1<g}function i(e){return this.has(e)?this._values[g]:void 0}function o(e,t){if(this.objectOnly&&t!==Object(t))throw new TypeError("Invalid value used as weak collection key");if(t!=t||0===t)for(g=e.length;g--&&!b(e[g],t););else g=e.indexOf(t);return-1<g}function a(e){return o.call(this,this._values,e)}function u(e){return o.call(this,this._keys,e)}function s(e,t){return this.has(e)?this._values[g]=t:this._values[this._keys.push(e)-1]=t,this}function c(e){return this.has(e)||this._values.push(e),this}function l(){(this._keys||0).length=this._values.length=0}function f(){return p(this._itp,this._keys)}function h(){return p(this._itp,this._values)}function d(){return p(this._itp,this._keys,this._values)}function v(){return p(this._itp,this._values,this._values)}function p(e,t,n){var r=[0],i=!1;return e.push(r),{next:function(){var o,a=r[0];return!i&&a<t.length?(o=n?[t[a],n[a]]:t[a],r[0]++):(i=!0,e.splice(e.indexOf(r),1)),{done:i,value:o}}}}function y(){return this._values.length}function m(e,t){for(var n=this.entries();;){var r=n.next();if(r.done)break;e.call(t,r.value[1],r.value[0],this)}}var g,w=Object.defineProperty,b=function(e,t){return e===t||e!==e&&t!==t};"undefined"==typeof WeakMap&&(e.WeakMap=t({delete:r,clear:l,get:i,has:u,set:s},!0)),"undefined"!=typeof Map&&"function"==typeof(new Map).values&&(new Map).values().next||(e.Map=t({delete:r,has:u,get:i,set:s,keys:f,values:h,entries:d,forEach:m,clear:l})),"undefined"!=typeof Set&&"function"==typeof(new Set).values&&(new Set).values().next||(e.Set=t({has:a,add:c,delete:r,clear:l,keys:h,values:h,entries:v,forEach:m})),"undefined"==typeof WeakSet&&(e.WeakSet=t({delete:r,add:c,clear:l,has:a},!0))}(void 0!==k?k:window)}),o(function(e){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(t,n,r){n[t]=n[t]||r(),e.exports&&(e.exports=n[t])}("Promise",k,function(){function e(e,t){d.add(e,t),h||(h=p(d.drain))}function n(e){var n,r=void 0===e?"undefined":t(e);return null==e||"object"!=r&&"function"!=r||(n=e.then),"function"==typeof n&&n}function r(){for(var e=0;e<this.chain.length;e++)i(this,1===this.state?this.chain[e].success:this.chain[e].failure,this.chain[e]);this.chain.length=0}function i(e,t,r){var i,o;try{!1===t?r.reject(e.msg):(i=!0===t?e.msg:t.call(void 0,e.msg),i===r.promise?r.reject(TypeError("Promise-chain cycle")):(o=n(i))?o.call(i,r.resolve,r.reject):r.resolve(i))}catch(e){r.reject(e)}}function o(t){var i,u=this;if(!u.triggered){u.triggered=!0,u.def&&(u=u.def);try{(i=n(t))?e(function(){var e=new s(u);try{i.call(t,function(){o.apply(e,arguments)},function(){a.apply(e,arguments)})}catch(t){a.call(e,t)}}):(u.msg=t,u.state=1,u.chain.length>0&&e(r,u))}catch(e){a.call(new s(u),e)}}}function a(t){var n=this;n.triggered||(n.triggered=!0,n.def&&(n=n.def),n.msg=t,n.state=2,n.chain.length>0&&e(r,n))}function u(e,t,n,r){for(var i=0;i<t.length;i++)!function(i){e.resolve(t[i]).then(function(e){n(i,e)},r)}(i)}function s(e){this.def=e,this.triggered=!1}function c(e){this.promise=e,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function l(t){if("function"!=typeof t)throw TypeError("Not a function");if(0!==this.__NPO__)throw TypeError("Not a promise");this.__NPO__=1;var n=new c(this);this.then=function(t,i){var o={success:"function"!=typeof t||t,failure:"function"==typeof i&&i};return o.promise=new this.constructor(function(e,t){if("function"!=typeof e||"function"!=typeof t)throw TypeError("Not a function");o.resolve=e,o.reject=t}),n.chain.push(o),0!==n.state&&e(r,n),o.promise},this.catch=function(e){return this.then(void 0,e)};try{t.call(void 0,function(e){o.call(n,e)},function(e){a.call(n,e)})}catch(e){a.call(n,e)}}var f,h,d,v=Object.prototype.toString,p="undefined"!=typeof setImmediate?function(e){return setImmediate(e)}:setTimeout;try{Object.defineProperty({},"x",{}),f=function(e,t,n,r){return Object.defineProperty(e,t,{value:n,writable:!0,configurable:!1!==r})}}catch(e){f=function(e,t,n){return e[t]=n,e}}d=function(){function e(e,t){this.fn=e,this.self=t,this.next=void 0}var t,n,r;return{add:function(i,o){r=new e(i,o),n?n.next=r:t=r,n=r,r=void 0},drain:function(){var e=t;for(t=n=h=void 0;e;)e.fn.call(e.self),e=e.next}}}();var y=f({},"constructor",l,!1);return l.prototype=y,f(y,"__NPO__",0,!1),f(l,"resolve",function(e){var n=this;return e&&"object"==(void 0===e?"undefined":t(e))&&1===e.__NPO__?e:new n(function(t,n){if("function"!=typeof t||"function"!=typeof n)throw TypeError("Not a function");t(e)})}),f(l,"reject",function(e){return new this(function(t,n){if("function"!=typeof t||"function"!=typeof n)throw TypeError("Not a function");n(e)})}),f(l,"all",function(e){var t=this;return"[object Array]"!=v.call(e)?t.reject(TypeError("Not an array")):0===e.length?t.resolve([]):new t(function(n,r){if("function"!=typeof n||"function"!=typeof r)throw TypeError("Not a function");var i=e.length,o=Array(i),a=0;u(t,e,function(e,t){o[e]=t,++a===i&&n(o)},r)})}),f(l,"race",function(e){var t=this;return"[object Array]"!=v.call(e)?t.reject(TypeError("Not an array")):new t(function(n,r){if("function"!=typeof n||"function"!=typeof r)throw TypeError("Not a function");u(t,e,function(e,t){n(t)},r)})}),l})})),T=new WeakMap,_=["autopause","autoplay","background","byline","color","height","id","loop","maxheight","maxwidth","muted","playsinline","portrait","responsive","speed","title","transparent","url","width"],j=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),M=new WeakMap,x=new WeakMap,Player=function(){function Player(e){var n=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(m(this,Player),window.jQuery&&e instanceof jQuery&&(e.length>1&&window.console&&console.warn&&console.warn("A jQuery object with multiple elements was passed, using the first element."),e=e[0]),"undefined"!=typeof document&&"string"==typeof e&&(e=document.getElementById(e)),!t(e))throw new TypeError("You must pass either a valid element or a valid id.");if("IFRAME"!==e.nodeName){var a=e.querySelector("iframe");a&&(e=a)}if("IFRAME"===e.nodeName&&!r(e.getAttribute("src")||""))throw new Error("The player element passed isn’t a Vimeo embed.");if(M.has(e))return M.get(e);this.element=e,this.origin="*";var u=new E(function(t,a){var u=function(e){if(r(e.origin)&&n.element.contentWindow===e.source){"*"===n.origin&&(n.origin=e.origin);var i=v(e.data),o="event"in i&&"ready"===i.event,a="method"in i&&"ping"===i.method;if(o||a)return n.element.setAttribute("data-ready","true"),void t();y(n,i)}};if(window.addEventListener?window.addEventListener("message",u,!1):window.attachEvent&&window.attachEvent("onmessage",u),"IFRAME"!==n.element.nodeName){var s=f(e,o);h(i(s),s).then(function(t){var r=d(t,e);return n.element=r,n._originalElement=e,l(e,r),M.set(n.element,n),t}).catch(function(e){return a(e)})}});return x.set(this,u),M.set(this.element,this),"IFRAME"===this.element.nodeName&&p(this,"ping"),this}return j(Player,[{key:"callMethod",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new E(function(r,i){return t.ready().then(function(){a(t,e,{resolve:r,reject:i}),p(t,e,n)}).catch(function(e){i(e)})})}},{key:"get",value:function(t){var n=this;return new E(function(r,i){return t=e(t,"get"),n.ready().then(function(){a(n,t,{resolve:r,reject:i}),p(n,t)})})}},{key:"set",value:function(t,n){var r=this;return E.resolve(n).then(function(n){if(t=e(t,"set"),void 0===n||null===n)throw new TypeError("There must be a value to set.");return r.ready().then(function(){return new E(function(e,i){a(r,t,{resolve:e,reject:i}),p(r,t,n)})})})}},{key:"on",value:function(e,t){if(!e)throw new TypeError("You must pass an event name.");if(!t)throw new TypeError("You must pass a callback function.");if("function"!=typeof t)throw new TypeError("The callback must be a function.");0===u(this,"event:"+e).length&&this.callMethod("addEventListener",e).catch(function(){}),a(this,"event:"+e,t)}},{key:"off",value:function(e,t){if(!e)throw new TypeError("You must pass an event name.");if(t&&"function"!=typeof t)throw new TypeError("The callback must be a function.");s(this,"event:"+e,t)&&this.callMethod("removeEventListener",e).catch(function(e){})}},{key:"loadVideo",value:function(e){return this.callMethod("loadVideo",e)}},{key:"ready",value:function(){var e=x.get(this)||new E(function(e,t){t("Unknown player. Probably unloaded.")});return E.resolve(e)}},{key:"addCuePoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.callMethod("addCuePoint",{time:e,data:t})}},{key:"removeCuePoint",value:function(e){return this.callMethod("removeCuePoint",e)}},{key:"enableTextTrack",value:function(e,t){if(!e)throw new TypeError("You must pass a language.");return this.callMethod("enableTextTrack",{language:e,kind:t})}},{key:"disableTextTrack",value:function(){return this.callMethod("disableTextTrack")}},{key:"pause",value:function(){return this.callMethod("pause")}},{key:"play",value:function(){return this.callMethod("play")}},{key:"unload",value:function(){return this.callMethod("unload")}},{key:"destroy",value:function(){var e=this;return new E(function(t){x.delete(e),M.delete(e.element),e._originalElement&&(M.delete(e._originalElement),e._originalElement.removeAttribute("data-vimeo-initialized")),e.element&&"IFRAME"===e.element.nodeName&&e.element.remove(),t()})}},{key:"getAutopause",value:function(){return this.get("autopause")}},{key:"setAutopause",value:function(e){return this.set("autopause",e)}},{key:"getColor",value:function(){return this.get("color")}},{key:"setColor",value:function(e){return this.set("color",e)}},{key:"getCuePoints",value:function(){return this.get("cuePoints")}},{key:"getCurrentTime",value:function(){return this.get("currentTime")}},{key:"setCurrentTime",value:function(e){return this.set("currentTime",e)}},{key:"getDuration",value:function(){return this.get("duration")}},{key:"getEnded",value:function(){return this.get("ended")}},{key:"getLoop",value:function(){return this.get("loop")}},{key:"setLoop",value:function(e){return this.set("loop",e)}},{key:"getPaused",value:function(){return this.get("paused")}},{key:"getPlaybackRate",value:function(){return this.get("playbackRate")}},{key:"setPlaybackRate",value:function(e){return this.set("playbackRate",e)}},{key:"getTextTracks",value:function(){return this.get("textTracks")}},{key:"getVideoEmbedCode",value:function(){return this.get("videoEmbedCode")}},{key:"getVideoId",value:function(){return this.get("videoId")}},{key:"getVideoTitle",value:function(){return this.get("videoTitle")}},{key:"getVideoWidth",value:function(){return this.get("videoWidth")}},{key:"getVideoHeight",value:function(){return this.get("videoHeight")}},{key:"getVideoUrl",value:function(){return this.get("videoUrl")}},{key:"getVolume",value:function(){return this.get("volume")}},{key:"setVolume",value:function(e){return this.set("volume",e)}}]),Player}();return g||!window.Vimeo||window.Vimeo.Player||(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=[].slice.call(e.querySelectorAll("[data-vimeo-id], [data-vimeo-url]")),n=function(e){"console"in window&&console.error&&console.error("There was an error creating an embed: "+e)};t.forEach(function(e){try{if(null!==e.getAttribute("data-vimeo-defer"))return;var t=f(e);h(i(t),t).then(function(t){return d(t,e)}).catch(n)}catch(e){n(e)}})}(),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=function(t){if(r(t.origin)&&t.data&&"spacechange"===t.data.event)for(var n=e.querySelectorAll("iframe"),i=0;i<n.length;i++)if(n[i].contentWindow===t.source){var o=n[i].parentElement;o.style.paddingBottom=t.data.data[0].bottom+"px";break}};window.addEventListener?window.addEventListener("message",t,!1):window.attachEvent&&window.attachEvent("onmessage",t)}()),Player});
|
1 |
+
/*! @vimeo/player v2.6.1 | (c) 2018 Vimeo | MIT License | https://github.com/vimeo/player.js */
|
2 |
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e.Vimeo=e.Vimeo||{},e.Vimeo.Player=t())}(this,function(){"use strict";function e(e,t){return 0===e.indexOf(t.toLowerCase())?e:""+t.toLowerCase()+e.substr(0,1).toUpperCase()+e.substr(1)}function t(e){return e instanceof window.HTMLElement}function n(e){return!isNaN(parseFloat(e))&&isFinite(e)&&Math.floor(e)==e}function r(e){return/^(https?:)?\/\/((player|www).)?vimeo.com(?=$|\/)/.test(e)}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.id,i=e.url,o=t||i;if(!o)throw new Error("An id or url must be passed, either in an options object or as a data-vimeo-id or data-vimeo-url attribute.");if(n(o))return"https://vimeo.com/"+o;if(r(o))return o.replace("http:","https:");if(t)throw new TypeError("“"+t+"” is not a valid video id.");throw new TypeError("“"+o+"” is not a vimeo.com url.")}function o(e,t){return t={exports:{}},e(t,t.exports),t.exports}function a(e,t,n){var r=T.get(e.element)||{};t in r||(r[t]=[]),r[t].push(n),T.set(e.element,r)}function u(e,t){return(T.get(e.element)||{})[t]||[]}function s(e,t,n){var r=T.get(e.element)||{};if(!r[t])return!0;if(!n)return r[t]=[],T.set(e.element,r),!0;var i=r[t].indexOf(n);return-1!==i&&r[t].splice(i,1),T.set(e.element,r),r[t]&&0===r[t].length}function c(e,t){var n=u(e,t);if(n.length<1)return!1;var r=n.shift();return s(e,t,r),r}function l(e,t){var n=T.get(e);T.set(t,n),T.delete(e)}function f(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return _.reduce(function(t,n){var r=e.getAttribute("data-vimeo-"+n);return(r||""===r)&&(t[n]=""===r?1:r),t},t)}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(n,i){if(!r(e))throw new TypeError("“"+e+"” is not a vimeo.com url.");var o="https://vimeo.com/api/oembed.json?url="+encodeURIComponent(e);for(var a in t)t.hasOwnProperty(a)&&(o+="&"+a+"="+encodeURIComponent(t[a]));var u="XDomainRequest"in window?new XDomainRequest:new XMLHttpRequest;u.open("GET",o,!0),u.onload=function(){if(404===u.status)return void i(new Error("“"+e+"” was not found."));if(403===u.status)return void i(new Error("“"+e+"” is not embeddable."));try{var t=JSON.parse(u.responseText);n(t)}catch(e){i(e)}},u.onerror=function(){var e=u.status?" ("+u.status+")":"";i(new Error("There was an error fetching the embed code from Vimeo"+e+"."))},u.send()})}function d(e,t){var n=e.html;if(!t)throw new TypeError("An element must be provided");if(null!==t.getAttribute("data-vimeo-initialized"))return t.querySelector("iframe");var r=document.createElement("div");return r.innerHTML=n,t.appendChild(r.firstChild),t.setAttribute("data-vimeo-initialized","true"),t.querySelector("iframe")}function v(e){return"string"==typeof e&&(e=JSON.parse(e)),e}function p(e,t,n){if(e.element.contentWindow&&e.element.contentWindow.postMessage){var r={method:t};void 0!==n&&(r.value=n);var i=parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/,"$1"));i>=8&&i<10&&(r=JSON.stringify(r)),e.element.contentWindow.postMessage(r,e.origin)}}function y(e,t){t=v(t);var n=[],r=void 0;if(t.event){if("error"===t.event){u(e,t.data.method).forEach(function(n){var r=new Error(t.data.message);r.name=t.data.name,n.reject(r),s(e,t.data.method,n)})}n=u(e,"event:"+t.event),r=t.data}else if(t.method){var i=c(e,t.method);i&&(n.push(i),r=t.value)}n.forEach(function(t){try{if("function"==typeof t)return void t.call(e,r);t.resolve(r)}catch(e){}})}function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var g="undefined"!=typeof global&&"[object global]"==={}.toString.call(global),w=void 0!==Array.prototype.indexOf,b="undefined"!=typeof window&&void 0!==window.postMessage;if(!(g||w&&b))throw new Error("Sorry, the Vimeo Player API is not available in this browser.");var k="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},E=(o(function(e,t){!function(e){function t(e,t){function r(e){if(!this||this.constructor!==r)return new r(e);this._keys=[],this._values=[],this._itp=[],this.objectOnly=t,e&&n.call(this,e)}return t||w(e,"size",{get:y}),e.constructor=r,r.prototype=e,r}function n(e){this.add?e.forEach(this.add,this):e.forEach(function(e){this.set(e[0],e[1])},this)}function r(e){return this.has(e)&&(this._keys.splice(g,1),this._values.splice(g,1),this._itp.forEach(function(e){g<e[0]&&e[0]--})),-1<g}function i(e){return this.has(e)?this._values[g]:void 0}function o(e,t){if(this.objectOnly&&t!==Object(t))throw new TypeError("Invalid value used as weak collection key");if(t!=t||0===t)for(g=e.length;g--&&!b(e[g],t););else g=e.indexOf(t);return-1<g}function a(e){return o.call(this,this._values,e)}function u(e){return o.call(this,this._keys,e)}function s(e,t){return this.has(e)?this._values[g]=t:this._values[this._keys.push(e)-1]=t,this}function c(e){return this.has(e)||this._values.push(e),this}function l(){(this._keys||0).length=this._values.length=0}function f(){return p(this._itp,this._keys)}function h(){return p(this._itp,this._values)}function d(){return p(this._itp,this._keys,this._values)}function v(){return p(this._itp,this._values,this._values)}function p(e,t,n){var r=[0],i=!1;return e.push(r),{next:function(){var o,a=r[0];return!i&&a<t.length?(o=n?[t[a],n[a]]:t[a],r[0]++):(i=!0,e.splice(e.indexOf(r),1)),{done:i,value:o}}}}function y(){return this._values.length}function m(e,t){for(var n=this.entries();;){var r=n.next();if(r.done)break;e.call(t,r.value[1],r.value[0],this)}}var g,w=Object.defineProperty,b=function(e,t){return e===t||e!==e&&t!==t};"undefined"==typeof WeakMap&&(e.WeakMap=t({delete:r,clear:l,get:i,has:u,set:s},!0)),"undefined"!=typeof Map&&"function"==typeof(new Map).values&&(new Map).values().next||(e.Map=t({delete:r,has:u,get:i,set:s,keys:f,values:h,entries:d,forEach:m,clear:l})),"undefined"!=typeof Set&&"function"==typeof(new Set).values&&(new Set).values().next||(e.Set=t({has:a,add:c,delete:r,clear:l,keys:h,values:h,entries:v,forEach:m})),"undefined"==typeof WeakSet&&(e.WeakSet=t({delete:r,add:c,clear:l,has:a},!0))}(void 0!==k?k:window)}),o(function(e){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(t,n,r){n[t]=n[t]||r(),e.exports&&(e.exports=n[t])}("Promise",k,function(){function e(e,t){d.add(e,t),h||(h=p(d.drain))}function n(e){var n,r=void 0===e?"undefined":t(e);return null==e||"object"!=r&&"function"!=r||(n=e.then),"function"==typeof n&&n}function r(){for(var e=0;e<this.chain.length;e++)i(this,1===this.state?this.chain[e].success:this.chain[e].failure,this.chain[e]);this.chain.length=0}function i(e,t,r){var i,o;try{!1===t?r.reject(e.msg):(i=!0===t?e.msg:t.call(void 0,e.msg),i===r.promise?r.reject(TypeError("Promise-chain cycle")):(o=n(i))?o.call(i,r.resolve,r.reject):r.resolve(i))}catch(e){r.reject(e)}}function o(t){var i,u=this;if(!u.triggered){u.triggered=!0,u.def&&(u=u.def);try{(i=n(t))?e(function(){var e=new s(u);try{i.call(t,function(){o.apply(e,arguments)},function(){a.apply(e,arguments)})}catch(t){a.call(e,t)}}):(u.msg=t,u.state=1,u.chain.length>0&&e(r,u))}catch(e){a.call(new s(u),e)}}}function a(t){var n=this;n.triggered||(n.triggered=!0,n.def&&(n=n.def),n.msg=t,n.state=2,n.chain.length>0&&e(r,n))}function u(e,t,n,r){for(var i=0;i<t.length;i++)!function(i){e.resolve(t[i]).then(function(e){n(i,e)},r)}(i)}function s(e){this.def=e,this.triggered=!1}function c(e){this.promise=e,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function l(t){if("function"!=typeof t)throw TypeError("Not a function");if(0!==this.__NPO__)throw TypeError("Not a promise");this.__NPO__=1;var n=new c(this);this.then=function(t,i){var o={success:"function"!=typeof t||t,failure:"function"==typeof i&&i};return o.promise=new this.constructor(function(e,t){if("function"!=typeof e||"function"!=typeof t)throw TypeError("Not a function");o.resolve=e,o.reject=t}),n.chain.push(o),0!==n.state&&e(r,n),o.promise},this.catch=function(e){return this.then(void 0,e)};try{t.call(void 0,function(e){o.call(n,e)},function(e){a.call(n,e)})}catch(e){a.call(n,e)}}var f,h,d,v=Object.prototype.toString,p="undefined"!=typeof setImmediate?function(e){return setImmediate(e)}:setTimeout;try{Object.defineProperty({},"x",{}),f=function(e,t,n,r){return Object.defineProperty(e,t,{value:n,writable:!0,configurable:!1!==r})}}catch(e){f=function(e,t,n){return e[t]=n,e}}d=function(){function e(e,t){this.fn=e,this.self=t,this.next=void 0}var t,n,r;return{add:function(i,o){r=new e(i,o),n?n.next=r:t=r,n=r,r=void 0},drain:function(){var e=t;for(t=n=h=void 0;e;)e.fn.call(e.self),e=e.next}}}();var y=f({},"constructor",l,!1);return l.prototype=y,f(y,"__NPO__",0,!1),f(l,"resolve",function(e){var n=this;return e&&"object"==(void 0===e?"undefined":t(e))&&1===e.__NPO__?e:new n(function(t,n){if("function"!=typeof t||"function"!=typeof n)throw TypeError("Not a function");t(e)})}),f(l,"reject",function(e){return new this(function(t,n){if("function"!=typeof t||"function"!=typeof n)throw TypeError("Not a function");n(e)})}),f(l,"all",function(e){var t=this;return"[object Array]"!=v.call(e)?t.reject(TypeError("Not an array")):0===e.length?t.resolve([]):new t(function(n,r){if("function"!=typeof n||"function"!=typeof r)throw TypeError("Not a function");var i=e.length,o=Array(i),a=0;u(t,e,function(e,t){o[e]=t,++a===i&&n(o)},r)})}),f(l,"race",function(e){var t=this;return"[object Array]"!=v.call(e)?t.reject(TypeError("Not an array")):new t(function(n,r){if("function"!=typeof n||"function"!=typeof r)throw TypeError("Not a function");u(t,e,function(e,t){n(t)},r)})}),l})})),T=new WeakMap,_=["autopause","autoplay","background","byline","color","height","id","loop","maxheight","maxwidth","muted","playsinline","portrait","responsive","speed","title","transparent","url","width"],j=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),M=new WeakMap,x=new WeakMap,Player=function(){function Player(e){var n=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(m(this,Player),window.jQuery&&e instanceof jQuery&&(e.length>1&&window.console&&console.warn&&console.warn("A jQuery object with multiple elements was passed, using the first element."),e=e[0]),"undefined"!=typeof document&&"string"==typeof e&&(e=document.getElementById(e)),!t(e))throw new TypeError("You must pass either a valid element or a valid id.");if("IFRAME"!==e.nodeName){var a=e.querySelector("iframe");a&&(e=a)}if("IFRAME"===e.nodeName&&!r(e.getAttribute("src")||""))throw new Error("The player element passed isn’t a Vimeo embed.");if(M.has(e))return M.get(e);this.element=e,this.origin="*";var u=new E(function(t,a){var u=function(e){if(r(e.origin)&&n.element.contentWindow===e.source){"*"===n.origin&&(n.origin=e.origin);var i=v(e.data),o="event"in i&&"ready"===i.event,a="method"in i&&"ping"===i.method;if(o||a)return n.element.setAttribute("data-ready","true"),void t();y(n,i)}};if(window.addEventListener?window.addEventListener("message",u,!1):window.attachEvent&&window.attachEvent("onmessage",u),"IFRAME"!==n.element.nodeName){var s=f(e,o);h(i(s),s).then(function(t){var r=d(t,e);return n.element=r,n._originalElement=e,l(e,r),M.set(n.element,n),t}).catch(function(e){return a(e)})}});return x.set(this,u),M.set(this.element,this),"IFRAME"===this.element.nodeName&&p(this,"ping"),this}return j(Player,[{key:"callMethod",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new E(function(r,i){return t.ready().then(function(){a(t,e,{resolve:r,reject:i}),p(t,e,n)}).catch(function(e){i(e)})})}},{key:"get",value:function(t){var n=this;return new E(function(r,i){return t=e(t,"get"),n.ready().then(function(){a(n,t,{resolve:r,reject:i}),p(n,t)})})}},{key:"set",value:function(t,n){var r=this;return E.resolve(n).then(function(n){if(t=e(t,"set"),void 0===n||null===n)throw new TypeError("There must be a value to set.");return r.ready().then(function(){return new E(function(e,i){a(r,t,{resolve:e,reject:i}),p(r,t,n)})})})}},{key:"on",value:function(e,t){if(!e)throw new TypeError("You must pass an event name.");if(!t)throw new TypeError("You must pass a callback function.");if("function"!=typeof t)throw new TypeError("The callback must be a function.");0===u(this,"event:"+e).length&&this.callMethod("addEventListener",e).catch(function(){}),a(this,"event:"+e,t)}},{key:"off",value:function(e,t){if(!e)throw new TypeError("You must pass an event name.");if(t&&"function"!=typeof t)throw new TypeError("The callback must be a function.");s(this,"event:"+e,t)&&this.callMethod("removeEventListener",e).catch(function(e){})}},{key:"loadVideo",value:function(e){return this.callMethod("loadVideo",e)}},{key:"ready",value:function(){var e=x.get(this)||new E(function(e,t){t("Unknown player. Probably unloaded.")});return E.resolve(e)}},{key:"addCuePoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.callMethod("addCuePoint",{time:e,data:t})}},{key:"removeCuePoint",value:function(e){return this.callMethod("removeCuePoint",e)}},{key:"enableTextTrack",value:function(e,t){if(!e)throw new TypeError("You must pass a language.");return this.callMethod("enableTextTrack",{language:e,kind:t})}},{key:"disableTextTrack",value:function(){return this.callMethod("disableTextTrack")}},{key:"pause",value:function(){return this.callMethod("pause")}},{key:"play",value:function(){return this.callMethod("play")}},{key:"unload",value:function(){return this.callMethod("unload")}},{key:"destroy",value:function(){var e=this;return new E(function(t){x.delete(e),M.delete(e.element),e._originalElement&&(M.delete(e._originalElement),e._originalElement.removeAttribute("data-vimeo-initialized")),e.element&&"IFRAME"===e.element.nodeName&&e.element.remove(),t()})}},{key:"getAutopause",value:function(){return this.get("autopause")}},{key:"setAutopause",value:function(e){return this.set("autopause",e)}},{key:"getColor",value:function(){return this.get("color")}},{key:"setColor",value:function(e){return this.set("color",e)}},{key:"getCuePoints",value:function(){return this.get("cuePoints")}},{key:"getCurrentTime",value:function(){return this.get("currentTime")}},{key:"setCurrentTime",value:function(e){return this.set("currentTime",e)}},{key:"getDuration",value:function(){return this.get("duration")}},{key:"getEnded",value:function(){return this.get("ended")}},{key:"getLoop",value:function(){return this.get("loop")}},{key:"setLoop",value:function(e){return this.set("loop",e)}},{key:"getPaused",value:function(){return this.get("paused")}},{key:"getPlaybackRate",value:function(){return this.get("playbackRate")}},{key:"setPlaybackRate",value:function(e){return this.set("playbackRate",e)}},{key:"getTextTracks",value:function(){return this.get("textTracks")}},{key:"getVideoEmbedCode",value:function(){return this.get("videoEmbedCode")}},{key:"getVideoId",value:function(){return this.get("videoId")}},{key:"getVideoTitle",value:function(){return this.get("videoTitle")}},{key:"getVideoWidth",value:function(){return this.get("videoWidth")}},{key:"getVideoHeight",value:function(){return this.get("videoHeight")}},{key:"getVideoUrl",value:function(){return this.get("videoUrl")}},{key:"getVolume",value:function(){return this.get("volume")}},{key:"setVolume",value:function(e){return this.set("volume",e)}}]),Player}();return g||!window.Vimeo||window.Vimeo.Player||(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=[].slice.call(e.querySelectorAll("[data-vimeo-id], [data-vimeo-url]")),n=function(e){"console"in window&&console.error&&console.error("There was an error creating an embed: "+e)};t.forEach(function(e){try{if(null!==e.getAttribute("data-vimeo-defer"))return;var t=f(e);h(i(t),t).then(function(t){return d(t,e)}).catch(n)}catch(e){n(e)}})}(),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=function(t){if(r(t.origin)&&t.data&&"spacechange"===t.data.event)for(var n=e.querySelectorAll("iframe"),i=0;i<n.length;i++)if(n[i].contentWindow===t.source){var o=n[i].parentElement;o.style.paddingBottom=t.data.data[0].bottom+"px";break}};window.addEventListener?window.addEventListener("message",t,!1):window.attachEvent&&window.attachEvent("onmessage",t)}()),Player});
|
assets/js/widget.js
CHANGED
@@ -1,113 +1,113 @@
|
|
1 |
-
/* jshint es3:false, esversion:6 */
|
2 |
-
/* jshint -W117 */
|
3 |
-
(function( $ ) {// jscs:ignore validateLineBreaks
|
4 |
-
'use strict';
|
5 |
-
$( document ).ready( function() {
|
6 |
-
|
7 |
-
/* Clonning of Logo Client Widgets */
|
8 |
-
$( document ).on( 'widget-added widget-updated', function( e, widget ) {
|
9 |
-
shapelySort();
|
10 |
-
shapelyCreateColorPicker();
|
11 |
-
let context = $( widget ).find( '.shapely-editor-container' );
|
12 |
-
$( context ).each( function() {
|
13 |
-
shapelyCompanion.textEditor.init( $( this ) );
|
14 |
-
} );
|
15 |
-
} );
|
16 |
-
|
17 |
-
shapelySort();
|
18 |
-
shapelyCreateColorPicker();
|
19 |
-
|
20 |
-
/* Client widget sorting and cloning*/
|
21 |
-
/* Font awsome selector */
|
22 |
-
$( 'select.shapely-icon' ).on('change', function() {
|
23 |
-
$( this ).siblings( 'span' ).removeClass().addClass( 'fa ' + $( this ).val() );
|
24 |
-
} );
|
25 |
-
|
26 |
-
/*
|
27 |
-
* Function for sorting
|
28 |
-
*/
|
29 |
-
function shapelySort() {
|
30 |
-
$( '.client-sortable' ).sortable( {
|
31 |
-
handle: '.logo_heading'
|
32 |
-
} ).bind( 'sortupdate', function() {
|
33 |
-
let index = 0, img;
|
34 |
-
let attrname = $( this ).find( 'input:first' ).attr( 'name' );
|
35 |
-
let attrbase = attrname.substring( 0, attrname.indexOf( '][' ) + 1 );
|
36 |
-
let attrid = $( this ).find( 'input:first' ).attr( 'id' );
|
37 |
-
let attrbaseid = attrid.substring( 0, attrid.indexOf( '-client_logo' ) + 13 );
|
38 |
-
|
39 |
-
$( this ).find( 'li' ).each( function() {
|
40 |
-
$( this ).find( '.count' ).html( index + 1 );
|
41 |
-
$( this ).find( '.image-id' ).attr( 'id', attrbaseid + index ).attr( 'name', attrbase + '[client_logo][img]' + '[' + index + ']' );
|
42 |
-
$( this ).find( '.shapely-media-control' ).attr( 'data-delegate-container', attrbaseid + index );
|
43 |
-
$( this ).find( 'img' ).attr( 'id', 'link-' + index ).attr( 'name', attrbase + '[client_logo][link]' + '[' + index + ']' ).trigger( 'change' );
|
44 |
-
index++;
|
45 |
-
} );
|
46 |
-
} );
|
47 |
-
|
48 |
-
/* Cloning */
|
49 |
-
$( '.clone-wrapper' ).cloneya().on( 'after_append.cloneya after_delete.cloneya', function( toClone, newClone ) {
|
50 |
-
let img = $( newClone ).next( 'li' ).find( 'img' );
|
51 |
-
$( '.client-sortable' ).trigger( 'sortupdate' );
|
52 |
-
img.attr( 'src', img.attr( 'data-default' ) );
|
53 |
-
} );
|
54 |
-
|
55 |
-
}
|
56 |
-
|
57 |
-
function shapelyCreateColorPicker() {
|
58 |
-
let context = $( '#widgets-right' );
|
59 |
-
let colorPickers = context.find( '.shapely-color-picker' );
|
60 |
-
if ( colorPickers.length > 0 ) {
|
61 |
-
$.each( colorPickers, function() {
|
62 |
-
if ( ! $( this ).hasClass( 'wp-color-picker' ) ) {
|
63 |
-
$( this ).wpColorPicker( {
|
64 |
-
change: function( $this, ui ) {
|
65 |
-
let color = $( $this.target ).wpColorPicker( 'color' );
|
66 |
-
$( $this.target ).val( color ).trigger( 'change' );
|
67 |
-
}
|
68 |
-
} );
|
69 |
-
}
|
70 |
-
} );
|
71 |
-
}
|
72 |
-
}
|
73 |
-
|
74 |
-
let shapelyCompanion = {};
|
75 |
-
shapelyCompanion.textEditor = {
|
76 |
-
init: function( selector ) {
|
77 |
-
let context = $( selector ),
|
78 |
-
editorId = $( context.find( 'textarea' ) ).attr( 'id' );
|
79 |
-
|
80 |
-
if ( tinymce.get( editorId ) ) {
|
81 |
-
wp.editor.remove( editorId );
|
82 |
-
}
|
83 |
-
|
84 |
-
wp.editor.initialize( editorId, {
|
85 |
-
tinymce: {
|
86 |
-
browser_spellcheck: true,
|
87 |
-
mediaButtons: false,
|
88 |
-
wp_autoresize_on: true,
|
89 |
-
toolbar1: 'bold,italic,link,strikethrough',
|
90 |
-
wpautop: true,
|
91 |
-
setup: function( editor ) {
|
92 |
-
editor.on( 'change', function() {
|
93 |
-
editor.save();
|
94 |
-
$( editor.getElement() ).trigger( 'change' );
|
95 |
-
} );
|
96 |
-
}
|
97 |
-
},
|
98 |
-
quicktags: true
|
99 |
-
} );
|
100 |
-
}
|
101 |
-
};
|
102 |
-
|
103 |
-
/**
|
104 |
-
* #widgets-right is absolutely needed to get this to actually work;
|
105 |
-
* The widgets panel is split into two (with cloned HTML): #widgets-right (clone of #widgets-left) or #widgets-left
|
106 |
-
*
|
107 |
-
* Without specifying the exact widget area you're looking to initialise, you're going to run into the risk of initialising TinyMCE twice
|
108 |
-
*/
|
109 |
-
$( '#widgets-right .shapely-editor-container' ).each( function() {
|
110 |
-
shapelyCompanion.textEditor.init( $( this ) );
|
111 |
-
} );
|
112 |
-
} );
|
113 |
-
})( jQuery );
|
1 |
+
/* jshint es3:false, esversion:6 */
|
2 |
+
/* jshint -W117 */
|
3 |
+
(function( $ ) {// jscs:ignore validateLineBreaks
|
4 |
+
'use strict';
|
5 |
+
$( document ).ready( function() {
|
6 |
+
|
7 |
+
/* Clonning of Logo Client Widgets */
|
8 |
+
$( document ).on( 'widget-added widget-updated', function( e, widget ) {
|
9 |
+
shapelySort();
|
10 |
+
shapelyCreateColorPicker();
|
11 |
+
let context = $( widget ).find( '.shapely-editor-container' );
|
12 |
+
$( context ).each( function() {
|
13 |
+
shapelyCompanion.textEditor.init( $( this ) );
|
14 |
+
} );
|
15 |
+
} );
|
16 |
+
|
17 |
+
shapelySort();
|
18 |
+
shapelyCreateColorPicker();
|
19 |
+
|
20 |
+
/* Client widget sorting and cloning*/
|
21 |
+
/* Font awsome selector */
|
22 |
+
$( 'select.shapely-icon' ).on('change', function() {
|
23 |
+
$( this ).siblings( 'span' ).removeClass().addClass( 'fa ' + $( this ).val() );
|
24 |
+
} );
|
25 |
+
|
26 |
+
/*
|
27 |
+
* Function for sorting
|
28 |
+
*/
|
29 |
+
function shapelySort() {
|
30 |
+
$( '.client-sortable' ).sortable( {
|
31 |
+
handle: '.logo_heading'
|
32 |
+
} ).bind( 'sortupdate', function() {
|
33 |
+
let index = 0, img;
|
34 |
+
let attrname = $( this ).find( 'input:first' ).attr( 'name' );
|
35 |
+
let attrbase = attrname.substring( 0, attrname.indexOf( '][' ) + 1 );
|
36 |
+
let attrid = $( this ).find( 'input:first' ).attr( 'id' );
|
37 |
+
let attrbaseid = attrid.substring( 0, attrid.indexOf( '-client_logo' ) + 13 );
|
38 |
+
|
39 |
+
$( this ).find( 'li' ).each( function() {
|
40 |
+
$( this ).find( '.count' ).html( index + 1 );
|
41 |
+
$( this ).find( '.image-id' ).attr( 'id', attrbaseid + index ).attr( 'name', attrbase + '[client_logo][img]' + '[' + index + ']' );
|
42 |
+
$( this ).find( '.shapely-media-control' ).attr( 'data-delegate-container', attrbaseid + index );
|
43 |
+
$( this ).find( 'img' ).attr( 'id', 'link-' + index ).attr( 'name', attrbase + '[client_logo][link]' + '[' + index + ']' ).trigger( 'change' );
|
44 |
+
index++;
|
45 |
+
} );
|
46 |
+
} );
|
47 |
+
|
48 |
+
/* Cloning */
|
49 |
+
$( '.clone-wrapper' ).cloneya().on( 'after_append.cloneya after_delete.cloneya', function( toClone, newClone ) {
|
50 |
+
let img = $( newClone ).next( 'li' ).find( 'img' );
|
51 |
+
$( '.client-sortable' ).trigger( 'sortupdate' );
|
52 |
+
img.attr( 'src', img.attr( 'data-default' ) );
|
53 |
+
} );
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
+
function shapelyCreateColorPicker() {
|
58 |
+
let context = $( '#widgets-right' );
|
59 |
+
let colorPickers = context.find( '.shapely-color-picker' );
|
60 |
+
if ( colorPickers.length > 0 ) {
|
61 |
+
$.each( colorPickers, function() {
|
62 |
+
if ( ! $( this ).hasClass( 'wp-color-picker' ) ) {
|
63 |
+
$( this ).wpColorPicker( {
|
64 |
+
change: function( $this, ui ) {
|
65 |
+
let color = $( $this.target ).wpColorPicker( 'color' );
|
66 |
+
$( $this.target ).val( color ).trigger( 'change' );
|
67 |
+
}
|
68 |
+
} );
|
69 |
+
}
|
70 |
+
} );
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
let shapelyCompanion = {};
|
75 |
+
shapelyCompanion.textEditor = {
|
76 |
+
init: function( selector ) {
|
77 |
+
let context = $( selector ),
|
78 |
+
editorId = $( context.find( 'textarea' ) ).attr( 'id' );
|
79 |
+
|
80 |
+
if ( tinymce.get( editorId ) ) {
|
81 |
+
wp.editor.remove( editorId );
|
82 |
+
}
|
83 |
+
|
84 |
+
wp.editor.initialize( editorId, {
|
85 |
+
tinymce: {
|
86 |
+
browser_spellcheck: true,
|
87 |
+
mediaButtons: false,
|
88 |
+
wp_autoresize_on: true,
|
89 |
+
toolbar1: 'bold,italic,link,strikethrough',
|
90 |
+
wpautop: true,
|
91 |
+
setup: function( editor ) {
|
92 |
+
editor.on( 'change', function() {
|
93 |
+
editor.save();
|
94 |
+
$( editor.getElement() ).trigger( 'change' );
|
95 |
+
} );
|
96 |
+
}
|
97 |
+
},
|
98 |
+
quicktags: true
|
99 |
+
} );
|
100 |
+
}
|
101 |
+
};
|
102 |
+
|
103 |
+
/**
|
104 |
+
* #widgets-right is absolutely needed to get this to actually work;
|
105 |
+
* The widgets panel is split into two (with cloned HTML): #widgets-right (clone of #widgets-left) or #widgets-left
|
106 |
+
*
|
107 |
+
* Without specifying the exact widget area you're looking to initialise, you're going to run into the risk of initialising TinyMCE twice
|
108 |
+
*/
|
109 |
+
$( '#widgets-right .shapely-editor-container' ).each( function() {
|
110 |
+
shapelyCompanion.textEditor.init( $( this ) );
|
111 |
+
} );
|
112 |
+
} );
|
113 |
+
})( jQuery );
|
inc/class-shapely-walker-nav-menu-edit.php
CHANGED
@@ -1,208 +1,210 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if ( ! class_exists( 'Walker_Nav_Menu ' ) ) {
|
4 |
-
return;
|
5 |
-
}
|
6 |
-
|
7 |
-
class Shapely_Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
|
8 |
-
|
9 |
-
public function start_lvl( &$output, $depth = 0, $args = array() ) {
|
10 |
-
}
|
11 |
-
|
12 |
-
public function end_lvl( &$output, $depth = 0, $args = array() ) {
|
13 |
-
}
|
14 |
-
|
15 |
-
public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
|
16 |
-
global $_wp_nav_menu_max_depth;
|
17 |
-
$_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth;
|
18 |
-
|
19 |
-
ob_start();
|
20 |
-
$item_id = absint( $item->ID );
|
21 |
-
$removed_args = array(
|
22 |
-
'action',
|
23 |
-
'customlink-tab',
|
24 |
-
'edit-menu-item',
|
25 |
-
'menu-item',
|
26 |
-
'page-tab',
|
27 |
-
'_wpnonce',
|
28 |
-
);
|
29 |
-
|
30 |
-
$original_title = false;
|
31 |
-
if ( 'taxonomy' == $item->type ) {
|
32 |
-
$original_title = get_term_field( 'name', $item->object_id, $item->object, 'raw' );
|
33 |
-
if ( is_wp_error( $original_title ) ) {
|
34 |
-
$original_title = false;
|
35 |
-
}
|
36 |
-
} elseif ( 'post_type' == $item->type ) {
|
37 |
-
$original_object = get_post( $item->object_id );
|
38 |
-
$original_title = get_the_title( $original_object->ID );
|
39 |
-
} elseif ( 'post_type_archive' == $item->type ) {
|
40 |
-
$original_object = get_post_type_object( $item->object );
|
41 |
-
if ( $original_object ) {
|
42 |
-
$original_title = $original_object->labels->archives;
|
43 |
-
}
|
44 |
-
}
|
45 |
-
|
46 |
-
$extra = get_post_meta( $item_id, '_menu_item_extra', true );
|
47 |
-
$widget = get_post_meta( $item_id, '_menu_item_widget', true );
|
48 |
-
|
49 |
-
if ( 'shapely-section' == $extra ) {
|
50 |
-
$item->type_label = __( 'Homepage Widget', 'shapely-companion' );
|
51 |
-
}
|
52 |
-
|
53 |
-
$classes = array(
|
54 |
-
'menu-item menu-item-depth-' . $depth,
|
55 |
-
'menu-item-' . esc_attr( $item->object ),
|
56 |
-
'menu-item-edit-' . ( ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? 'active' : 'inactive' ),
|
57 |
-
);
|
58 |
-
|
59 |
-
$title = $item->title;
|
60 |
-
|
61 |
-
if ( ! empty( $item->_invalid ) ) {
|
62 |
-
$classes[] = 'menu-item-invalid';
|
63 |
-
/* translators: %s: title of menu item which is invalid */
|
64 |
-
$title = sprintf( __( '%s (Invalid)', 'shapely-companion' ), $item->title );
|
65 |
-
} elseif ( isset( $item->post_status ) && 'draft' == $item->post_status ) {
|
66 |
-
$classes[] = 'pending';
|
67 |
-
/* translators: %s: title of menu item in draft status */
|
68 |
-
$title = sprintf( __( '%s (Pending)', 'shapely-companion' ), $item->title );
|
69 |
-
}
|
70 |
-
|
71 |
-
$title = ( ! isset( $item->label ) || '' == $item->label ) ? $title : $item->label;
|
72 |
-
|
73 |
-
$submenu_text = '';
|
74 |
-
if ( 0 == $depth ) {
|
75 |
-
$submenu_text = 'display: none;';
|
76 |
-
}
|
77 |
-
$move_up_url = wp_nonce_url( add_query_arg(
|
78 |
-
array(
|
79 |
-
'action' => 'move-up-menu-item',
|
80 |
-
'menu-item' => esc_attr( $item_id ),
|
81 |
-
),
|
82 |
-
remove_query_arg( $removed_args, admin_url( 'nav-menus.php' ) )
|
83 |
-
), 'move-menu_item' );
|
84 |
-
$move_down_url = wp_nonce_url( add_query_arg(
|
85 |
-
array(
|
86 |
-
'action' => 'move-down-menu-item',
|
87 |
-
'menu-item' => esc_attr( $item_id ),
|
88 |
-
),
|
89 |
-
remove_query_arg( $removed_args, admin_url( 'nav-menus.php' ) )
|
90 |
-
), 'move-menu_item' );
|
91 |
-
|
92 |
-
?>
|
93 |
-
<li id="menu-item-<?php echo esc_attr( $item_id ); ?>" class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>">
|
94 |
-
<div class="menu-item-bar">
|
95 |
-
<div class="menu-item-handle">
|
96 |
-
<span class="item-title">
|
97 |
-
<span class="menu-item-title">
|
98 |
-
<?php echo esc_html( $title ); ?>
|
99 |
-
</span>
|
100 |
-
<span class="is-submenu" style="<?php echo esc_attr( $submenu_text ); ?>"> <?php esc_html_e( 'sub item', 'shapely-companion' ); ?></span>
|
101 |
-
</span> <span class="item-controls">
|
102 |
-
<span class="item-type"><?php echo esc_html( $item->type_label ); ?></span>
|
103 |
-
<span class="item-order hide-if-js">
|
104 |
-
<a href="<?php echo esc_url( $move_up_url ); ?>" class="item-move-up" aria-label="<?php esc_attr_e( 'Move up', 'shapely-companion' ); ?>">↑</a>
|
105 |
-
|
|
106 |
-
<a href="<?php echo esc_url( $move_down_url ); ?>" class="item-move-down" aria-label="<?php esc_attr_e( 'Move down', 'shapely-companion' ); ?>">↓</a>
|
107 |
-
</span>
|
108 |
-
<a class="item-edit" id="edit-<?php echo esc_attr( $item_id ); ?>" href="<?php echo esc_url( ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? admin_url( 'nav-menus.php' ) : add_query_arg( 'edit-menu-item', $item_id, remove_query_arg( $removed_args, admin_url( 'nav-menus.php#menu-item-settings-' . $item_id ) ) ) ); ?>" aria-label="<?php esc_attr_e( 'Edit menu item', 'shapely-companion' ); ?>"><span class="screen-reader-text"><?php esc_html_e( 'Edit', 'shapely-companion' ); ?></span></a>
|
109 |
-
</span>
|
110 |
-
</div>
|
111 |
-
</div>
|
112 |
-
|
113 |
-
<div class="menu-item-settings wp-clearfix" id="menu-item-settings-<?php echo esc_attr( $item_id ); ?>">
|
114 |
-
<?php if ( 'custom' == $item->type ) : ?>
|
115 |
-
<p class="field-url description description-wide">
|
116 |
-
<label for="edit-menu-item-url-<?php echo esc_attr( $item_id ); ?>">
|
117 |
-
<?php esc_html_e( 'URL', 'shapely-companion' ); ?><br/>
|
118 |
-
<input type="text" id="edit-menu-item-url-<?php echo esc_attr( $item_id ); ?>" class="widefat code edit-menu-item-url" name="menu-item-url[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( $item->url ); ?>"/>
|
119 |
-
</label>
|
120 |
-
</p>
|
121 |
-
<?php endif; ?>
|
122 |
-
<p class="description description-wide">
|
123 |
-
<label for="edit-menu-item-title-<?php echo esc_attr( $item_id ); ?>">
|
124 |
-
<?php esc_html_e( 'Navigation Label', 'shapely-companion' ); ?><br/>
|
125 |
-
<input type="text" id="edit-menu-item-title-<?php echo esc_attr( $item_id ); ?>" class="widefat edit-menu-item-title" name="menu-item-title[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( $item->title ); ?>"/>
|
126 |
-
</label>
|
127 |
-
</p>
|
128 |
-
<p class="field-title-attribute field-attr-title description description-wide">
|
129 |
-
<label for="edit-menu-item-attr-title-<?php echo esc_attr( $item_id ); ?>">
|
130 |
-
<?php esc_html_e( 'Title Attribute', 'shapely-companion' ); ?><br/>
|
131 |
-
<input type="text" id="edit-menu-item-attr-title-<?php echo esc_attr( $item_id ); ?>" class="widefat edit-menu-item-attr-title" name="menu-item-attr-title[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( $item->post_excerpt ); ?>"/>
|
132 |
-
</label>
|
133 |
-
</p>
|
134 |
-
<p class="field-link-target description">
|
135 |
-
<label for="edit-menu-item-target-<?php echo esc_attr( $item_id ); ?>">
|
136 |
-
<input type="checkbox" id="edit-menu-item-target-<?php echo esc_attr( $item_id ); ?>" value="_blank" name="menu-item-target[<?php echo esc_attr( $item_id ); ?>]"<?php checked( $item->target, '_blank' ); ?> />
|
137 |
-
<?php esc_html_e( 'Open link in a new tab', 'shapely-companion' ); ?>
|
138 |
-
</label>
|
139 |
-
</p>
|
140 |
-
<p class="field-css-classes description description-thin">
|
141 |
-
<label for="edit-menu-item-classes-<?php echo esc_attr( $item_id ); ?>">
|
142 |
-
<?php esc_html_e( 'CSS Classes (optional)', 'shapely-companion' ); ?><br/>
|
143 |
-
<input type="text" id="edit-menu-item-classes-<?php echo esc_attr( $item_id ); ?>" class="widefat code edit-menu-item-classes" name="menu-item-classes[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( implode( ' ', $item->classes ) ); ?>"/>
|
144 |
-
</label>
|
145 |
-
</p>
|
146 |
-
<p class="field-xfn description description-thin">
|
147 |
-
<label for="edit-menu-item-xfn-<?php echo esc_attr( $item_id ); ?>">
|
148 |
-
<?php esc_html_e( 'Link Relationship (XFN)', 'shapely-companion' ); ?><br/>
|
149 |
-
<input type="text" id="edit-menu-item-xfn-<?php echo esc_attr( $item_id ); ?>" class="widefat code edit-menu-item-xfn" name="menu-item-xfn[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( $item->xfn ); ?>"/>
|
150 |
-
</label>
|
151 |
-
</p>
|
152 |
-
<p class="field-description description description-wide">
|
153 |
-
<label for="edit-menu-item-description-<?php echo esc_attr( $item_id ); ?>">
|
154 |
-
<?php esc_html_e( 'Description', 'shapely-companion' ); ?><br/>
|
155 |
-
<textarea id="edit-menu-item-description-<?php echo esc_attr( $item_id ); ?>" class="widefat edit-menu-item-description" rows="3" cols="20" name="menu-item-description[<?php echo esc_attr( $item_id ); ?>]"><?php echo esc_html( $item->description ); ?></textarea>
|
156 |
-
<span class="description"><?php esc_html_e( 'The description will be displayed in the menu if the current theme supports it.', 'shapely-companion' ); ?></span>
|
157 |
-
</label>
|
158 |
-
</p>
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
<
|
164 |
-
<button type="button" class="button-link menus-move menus-move-
|
165 |
-
<button type="button" class="button-link menus-move menus-move-
|
166 |
-
<button type="button" class="button-link menus-move menus-move-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
<?php
|
177 |
-
echo
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
<input class="menu-item-data-
|
199 |
-
<input class="menu-item-data-
|
200 |
-
<input class="menu-item-data-
|
201 |
-
<input class="menu-item-data-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
}
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! class_exists( 'Walker_Nav_Menu ' ) ) {
|
4 |
+
return;
|
5 |
+
}
|
6 |
+
|
7 |
+
class Shapely_Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
|
8 |
+
|
9 |
+
public function start_lvl( &$output, $depth = 0, $args = array() ) {
|
10 |
+
}
|
11 |
+
|
12 |
+
public function end_lvl( &$output, $depth = 0, $args = array() ) {
|
13 |
+
}
|
14 |
+
|
15 |
+
public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
|
16 |
+
global $_wp_nav_menu_max_depth;
|
17 |
+
$_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth;
|
18 |
+
|
19 |
+
ob_start();
|
20 |
+
$item_id = absint( $item->ID );
|
21 |
+
$removed_args = array(
|
22 |
+
'action',
|
23 |
+
'customlink-tab',
|
24 |
+
'edit-menu-item',
|
25 |
+
'menu-item',
|
26 |
+
'page-tab',
|
27 |
+
'_wpnonce',
|
28 |
+
);
|
29 |
+
|
30 |
+
$original_title = false;
|
31 |
+
if ( 'taxonomy' == $item->type ) {
|
32 |
+
$original_title = get_term_field( 'name', $item->object_id, $item->object, 'raw' );
|
33 |
+
if ( is_wp_error( $original_title ) ) {
|
34 |
+
$original_title = false;
|
35 |
+
}
|
36 |
+
} elseif ( 'post_type' == $item->type ) {
|
37 |
+
$original_object = get_post( $item->object_id );
|
38 |
+
$original_title = get_the_title( $original_object->ID );
|
39 |
+
} elseif ( 'post_type_archive' == $item->type ) {
|
40 |
+
$original_object = get_post_type_object( $item->object );
|
41 |
+
if ( $original_object ) {
|
42 |
+
$original_title = $original_object->labels->archives;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
$extra = get_post_meta( $item_id, '_menu_item_extra', true );
|
47 |
+
$widget = get_post_meta( $item_id, '_menu_item_widget', true );
|
48 |
+
|
49 |
+
if ( 'shapely-section' == $extra ) {
|
50 |
+
$item->type_label = __( 'Homepage Widget', 'shapely-companion' );
|
51 |
+
}
|
52 |
+
|
53 |
+
$classes = array(
|
54 |
+
'menu-item menu-item-depth-' . $depth,
|
55 |
+
'menu-item-' . esc_attr( $item->object ),
|
56 |
+
'menu-item-edit-' . ( ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? 'active' : 'inactive' ),
|
57 |
+
);
|
58 |
+
|
59 |
+
$title = $item->title;
|
60 |
+
|
61 |
+
if ( ! empty( $item->_invalid ) ) {
|
62 |
+
$classes[] = 'menu-item-invalid';
|
63 |
+
/* translators: %s: title of menu item which is invalid */
|
64 |
+
$title = sprintf( __( '%s (Invalid)', 'shapely-companion' ), $item->title );
|
65 |
+
} elseif ( isset( $item->post_status ) && 'draft' == $item->post_status ) {
|
66 |
+
$classes[] = 'pending';
|
67 |
+
/* translators: %s: title of menu item in draft status */
|
68 |
+
$title = sprintf( __( '%s (Pending)', 'shapely-companion' ), $item->title );
|
69 |
+
}
|
70 |
+
|
71 |
+
$title = ( ! isset( $item->label ) || '' == $item->label ) ? $title : $item->label;
|
72 |
+
|
73 |
+
$submenu_text = '';
|
74 |
+
if ( 0 == $depth ) {
|
75 |
+
$submenu_text = 'display: none;';
|
76 |
+
}
|
77 |
+
$move_up_url = wp_nonce_url( add_query_arg(
|
78 |
+
array(
|
79 |
+
'action' => 'move-up-menu-item',
|
80 |
+
'menu-item' => esc_attr( $item_id ),
|
81 |
+
),
|
82 |
+
remove_query_arg( $removed_args, admin_url( 'nav-menus.php' ) )
|
83 |
+
), 'move-menu_item' );
|
84 |
+
$move_down_url = wp_nonce_url( add_query_arg(
|
85 |
+
array(
|
86 |
+
'action' => 'move-down-menu-item',
|
87 |
+
'menu-item' => esc_attr( $item_id ),
|
88 |
+
),
|
89 |
+
remove_query_arg( $removed_args, admin_url( 'nav-menus.php' ) )
|
90 |
+
), 'move-menu_item' );
|
91 |
+
|
92 |
+
?>
|
93 |
+
<li id="menu-item-<?php echo esc_attr( $item_id ); ?>" class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>">
|
94 |
+
<div class="menu-item-bar">
|
95 |
+
<div class="menu-item-handle">
|
96 |
+
<span class="item-title">
|
97 |
+
<span class="menu-item-title">
|
98 |
+
<?php echo esc_html( $title ); ?>
|
99 |
+
</span>
|
100 |
+
<span class="is-submenu" style="<?php echo esc_attr( $submenu_text ); ?>"> <?php esc_html_e( 'sub item', 'shapely-companion' ); ?></span>
|
101 |
+
</span> <span class="item-controls">
|
102 |
+
<span class="item-type"><?php echo esc_html( $item->type_label ); ?></span>
|
103 |
+
<span class="item-order hide-if-js">
|
104 |
+
<a href="<?php echo esc_url( $move_up_url ); ?>" class="item-move-up" aria-label="<?php esc_attr_e( 'Move up', 'shapely-companion' ); ?>">↑</a>
|
105 |
+
|
|
106 |
+
<a href="<?php echo esc_url( $move_down_url ); ?>" class="item-move-down" aria-label="<?php esc_attr_e( 'Move down', 'shapely-companion' ); ?>">↓</a>
|
107 |
+
</span>
|
108 |
+
<a class="item-edit" id="edit-<?php echo esc_attr( $item_id ); ?>" href="<?php echo esc_url( ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? admin_url( 'nav-menus.php' ) : add_query_arg( 'edit-menu-item', $item_id, remove_query_arg( $removed_args, admin_url( 'nav-menus.php#menu-item-settings-' . $item_id ) ) ) ); ?>" aria-label="<?php esc_attr_e( 'Edit menu item', 'shapely-companion' ); ?>"><span class="screen-reader-text"><?php esc_html_e( 'Edit', 'shapely-companion' ); ?></span></a>
|
109 |
+
</span>
|
110 |
+
</div>
|
111 |
+
</div>
|
112 |
+
|
113 |
+
<div class="menu-item-settings wp-clearfix" id="menu-item-settings-<?php echo esc_attr( $item_id ); ?>">
|
114 |
+
<?php if ( 'custom' == $item->type ) : ?>
|
115 |
+
<p class="field-url description description-wide">
|
116 |
+
<label for="edit-menu-item-url-<?php echo esc_attr( $item_id ); ?>">
|
117 |
+
<?php esc_html_e( 'URL', 'shapely-companion' ); ?><br/>
|
118 |
+
<input type="text" id="edit-menu-item-url-<?php echo esc_attr( $item_id ); ?>" class="widefat code edit-menu-item-url" name="menu-item-url[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( $item->url ); ?>"/>
|
119 |
+
</label>
|
120 |
+
</p>
|
121 |
+
<?php endif; ?>
|
122 |
+
<p class="description description-wide">
|
123 |
+
<label for="edit-menu-item-title-<?php echo esc_attr( $item_id ); ?>">
|
124 |
+
<?php esc_html_e( 'Navigation Label', 'shapely-companion' ); ?><br/>
|
125 |
+
<input type="text" id="edit-menu-item-title-<?php echo esc_attr( $item_id ); ?>" class="widefat edit-menu-item-title" name="menu-item-title[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( $item->title ); ?>"/>
|
126 |
+
</label>
|
127 |
+
</p>
|
128 |
+
<p class="field-title-attribute field-attr-title description description-wide">
|
129 |
+
<label for="edit-menu-item-attr-title-<?php echo esc_attr( $item_id ); ?>">
|
130 |
+
<?php esc_html_e( 'Title Attribute', 'shapely-companion' ); ?><br/>
|
131 |
+
<input type="text" id="edit-menu-item-attr-title-<?php echo esc_attr( $item_id ); ?>" class="widefat edit-menu-item-attr-title" name="menu-item-attr-title[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( $item->post_excerpt ); ?>"/>
|
132 |
+
</label>
|
133 |
+
</p>
|
134 |
+
<p class="field-link-target description">
|
135 |
+
<label for="edit-menu-item-target-<?php echo esc_attr( $item_id ); ?>">
|
136 |
+
<input type="checkbox" id="edit-menu-item-target-<?php echo esc_attr( $item_id ); ?>" value="_blank" name="menu-item-target[<?php echo esc_attr( $item_id ); ?>]"<?php checked( $item->target, '_blank' ); ?> />
|
137 |
+
<?php esc_html_e( 'Open link in a new tab', 'shapely-companion' ); ?>
|
138 |
+
</label>
|
139 |
+
</p>
|
140 |
+
<p class="field-css-classes description description-thin">
|
141 |
+
<label for="edit-menu-item-classes-<?php echo esc_attr( $item_id ); ?>">
|
142 |
+
<?php esc_html_e( 'CSS Classes (optional)', 'shapely-companion' ); ?><br/>
|
143 |
+
<input type="text" id="edit-menu-item-classes-<?php echo esc_attr( $item_id ); ?>" class="widefat code edit-menu-item-classes" name="menu-item-classes[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( implode( ' ', $item->classes ) ); ?>"/>
|
144 |
+
</label>
|
145 |
+
</p>
|
146 |
+
<p class="field-xfn description description-thin">
|
147 |
+
<label for="edit-menu-item-xfn-<?php echo esc_attr( $item_id ); ?>">
|
148 |
+
<?php esc_html_e( 'Link Relationship (XFN)', 'shapely-companion' ); ?><br/>
|
149 |
+
<input type="text" id="edit-menu-item-xfn-<?php echo esc_attr( $item_id ); ?>" class="widefat code edit-menu-item-xfn" name="menu-item-xfn[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( $item->xfn ); ?>"/>
|
150 |
+
</label>
|
151 |
+
</p>
|
152 |
+
<p class="field-description description description-wide">
|
153 |
+
<label for="edit-menu-item-description-<?php echo esc_attr( $item_id ); ?>">
|
154 |
+
<?php esc_html_e( 'Description', 'shapely-companion' ); ?><br/>
|
155 |
+
<textarea id="edit-menu-item-description-<?php echo esc_attr( $item_id ); ?>" class="widefat edit-menu-item-description" rows="3" cols="20" name="menu-item-description[<?php echo esc_attr( $item_id ); ?>]"><?php echo esc_html( $item->description ); ?></textarea>
|
156 |
+
<span class="description"><?php esc_html_e( 'The description will be displayed in the menu if the current theme supports it.', 'shapely-companion' ); ?></span>
|
157 |
+
</label>
|
158 |
+
</p>
|
159 |
+
|
160 |
+
<?php do_action( 'wp_nav_menu_item_custom_fields', $item_id, $item, $depth, $args, $id ); ?>
|
161 |
+
|
162 |
+
<fieldset class="field-move hide-if-no-js description description-wide">
|
163 |
+
<span class="field-move-visual-label" aria-hidden="true"><?php esc_html_e( 'Move', 'shapely-companion' ); ?></span>
|
164 |
+
<button type="button" class="button-link menus-move menus-move-up" data-dir="up"><?php esc_html_e( 'Up one', 'shapely-companion' ); ?></button>
|
165 |
+
<button type="button" class="button-link menus-move menus-move-down" data-dir="down"><?php esc_html_e( 'Down one', 'shapely-companion' ); ?></button>
|
166 |
+
<button type="button" class="button-link menus-move menus-move-left" data-dir="left"></button>
|
167 |
+
<button type="button" class="button-link menus-move menus-move-right" data-dir="right"></button>
|
168 |
+
<button type="button" class="button-link menus-move menus-move-top" data-dir="top"><?php esc_html_e( 'To the top', 'shapely-companion' ); ?></button>
|
169 |
+
</fieldset>
|
170 |
+
|
171 |
+
<div class="menu-item-actions description-wide submitbox">
|
172 |
+
<?php if ( 'custom' != $item->type && false !== $original_title ) : ?>
|
173 |
+
<p class="link-to-original">
|
174 |
+
<?php printf( esc_html__( 'Original: %s', 'shapely-companion' ), '<a href="' . esc_attr( $item->url ) . '">' . esc_html( $original_title ) . '</a>' ); ?>
|
175 |
+
</p>
|
176 |
+
<?php endif; ?>
|
177 |
+
<a class="item-delete submitdelete deletion" id="delete-<?php echo esc_attr( $item_id ); ?>" href="
|
178 |
+
<?php
|
179 |
+
echo esc_url( wp_nonce_url( add_query_arg(
|
180 |
+
array(
|
181 |
+
'action' => 'delete-menu-item',
|
182 |
+
'menu-item' => esc_attr( $item_id ),
|
183 |
+
),
|
184 |
+
admin_url( 'nav-menus.php' )
|
185 |
+
), 'delete-menu_item_' . esc_attr( $item_id ) ) );
|
186 |
+
?>
|
187 |
+
"><?php esc_html_e( 'Remove', 'shapely-companion' ); ?></a> <span class="meta-sep hide-if-no-js"> | </span>
|
188 |
+
<a class="item-cancel submitcancel hide-if-no-js" id="cancel-<?php echo esc_attr( $item_id ); ?>" href="
|
189 |
+
<?php
|
190 |
+
echo esc_url( add_query_arg( array(
|
191 |
+
'edit-menu-item' => esc_attr( $item_id ),
|
192 |
+
'cancel' => time(),
|
193 |
+
), admin_url( 'nav-menus.php' ) ) );
|
194 |
+
?>
|
195 |
+
#menu-item-settings-<?php echo esc_attr( $item_id ); ?>"><?php esc_html_e( 'Cancel', 'shapely-companion' ); ?></a>
|
196 |
+
</div>
|
197 |
+
|
198 |
+
<input class="menu-item-data-db-id" type="hidden" name="menu-item-db-id[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( $item_id ); ?>"/>
|
199 |
+
<input class="menu-item-data-object-id" type="hidden" name="menu-item-object-id[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( $item->object_id ); ?>"/>
|
200 |
+
<input class="menu-item-data-object" type="hidden" name="menu-item-object[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( $item->object ); ?>"/>
|
201 |
+
<input class="menu-item-data-parent-id" type="hidden" name="menu-item-parent-id[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( $item->menu_item_parent ); ?>"/>
|
202 |
+
<input class="menu-item-data-position" type="hidden" name="menu-item-position[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( $item->menu_order ); ?>"/>
|
203 |
+
<input class="menu-item-data-type" type="hidden" name="menu-item-type[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( $item->type ); ?>"/>
|
204 |
+
</div><!-- .menu-item-settings-->
|
205 |
+
<ul class="menu-item-transport"></ul>
|
206 |
+
<?php
|
207 |
+
$output .= ob_get_clean();
|
208 |
+
}
|
209 |
+
|
210 |
+
} // Shapely_Walker_Nav_Menu_Edit
|
inc/epsilon-dashboard/class-epsilon-dashboard.php
CHANGED
@@ -1,224 +1,224 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
-
exit;
|
4 |
-
}
|
5 |
-
if ( ! class_exists( 'Epsilon_Dashboard' ) ) {
|
6 |
-
/**
|
7 |
-
* Dashboard Widget
|
8 |
-
*/
|
9 |
-
final class Epsilon_Dashboard {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* The script version
|
13 |
-
*
|
14 |
-
* @var string Script version
|
15 |
-
*/
|
16 |
-
public $script_version = '1.0.0';
|
17 |
-
/**
|
18 |
-
* The script url
|
19 |
-
*
|
20 |
-
* @var string The URL of the script
|
21 |
-
*/
|
22 |
-
public $script_url;
|
23 |
-
|
24 |
-
/**
|
25 |
-
* The class instance
|
26 |
-
*
|
27 |
-
* @var Epsilon_Dashboard The singleton instance of the class
|
28 |
-
*/
|
29 |
-
public static $instance;
|
30 |
-
|
31 |
-
/**
|
32 |
-
* The title of the widget
|
33 |
-
*
|
34 |
-
* @var string The dashboard widget title
|
35 |
-
*/
|
36 |
-
public $dashboard_name;
|
37 |
-
/**
|
38 |
-
* Array that holds the urls of the blog feeds
|
39 |
-
*
|
40 |
-
* @var array Feeds to fetch news from
|
41 |
-
*/
|
42 |
-
public $feeds;
|
43 |
-
/**
|
44 |
-
* The feed items array
|
45 |
-
*
|
46 |
-
* @var array The feeds items
|
47 |
-
*/
|
48 |
-
public $items;
|
49 |
-
|
50 |
-
/**
|
51 |
-
* The instance of the class
|
52 |
-
*
|
53 |
-
* @var Epsilon_Dashboard The singleton instance
|
54 |
-
*/
|
55 |
-
public static function instance( $args ) {
|
56 |
-
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Epsilon_Dashboard ) ) {
|
57 |
-
self::$instance = new Epsilon_Dashboard;
|
58 |
-
|
59 |
-
if ( isset( $args['feed_url'] ) ) {
|
60 |
-
self::$instance->setup_vars( $args );
|
61 |
-
self::$instance->load_hooks();
|
62 |
-
}
|
63 |
-
}
|
64 |
-
|
65 |
-
return self::$instance;
|
66 |
-
}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Load hooks to show the widget
|
70 |
-
*/
|
71 |
-
public function load_hooks() {
|
72 |
-
add_action( 'wp_dashboard_setup', array( &$this, 'add_widget' ) );
|
73 |
-
add_action( 'wp_network_dashboard_setup', array( &$this, 'add_widget' ) );
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Setup class variables
|
78 |
-
*/
|
79 |
-
public function setup_vars( $args ) {
|
80 |
-
if ( ! isset( $args['widget_title'] ) ) {
|
81 |
-
$args['widget_title'] = apply_filters( 'epsilon_dashboard_widget_name', esc_html__( 'WordPress Guides/Tutorials', 'shapely-companion' ) );
|
82 |
-
}
|
83 |
-
$this->dashboard_name = $args['widget_title'];
|
84 |
-
$this->feeds = (array) $args['feed_url'];
|
85 |
-
$abs = untrailingslashit( ( dirname( __FILE__ ) ) );
|
86 |
-
$parts = str_replace( untrailingslashit( ABSPATH ), '', $abs );
|
87 |
-
$parts = explode( DIRECTORY_SEPARATOR, $parts );
|
88 |
-
$parts = array_filter( $parts );
|
89 |
-
$this->script_url = site_url() . '/' . implode( '/', $parts );
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Add widget to the dashboard
|
94 |
-
*
|
95 |
-
* @return string|void
|
96 |
-
*/
|
97 |
-
function add_widget() {
|
98 |
-
global $wp_meta_boxes;
|
99 |
-
if ( isset( $wp_meta_boxes['dashboard']['normal']['core']['epsilon_dashboard'] ) ) {
|
100 |
-
return;
|
101 |
-
}
|
102 |
-
// Load SimplePie Instance
|
103 |
-
$feed = fetch_feed( $this->feeds );
|
104 |
-
// TODO report error when is an error loading the feed
|
105 |
-
if ( is_wp_error( $feed ) ) {
|
106 |
-
return '';
|
107 |
-
}
|
108 |
-
$feed->enable_cache( true );
|
109 |
-
$feed->enable_order_by_date( true );
|
110 |
-
$feed->set_cache_class( 'WP_Feed_Cache' );
|
111 |
-
$feed->set_file_class( 'WP_SimplePie_File' );
|
112 |
-
$feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 7200, $this->feeds ) );
|
113 |
-
do_action_ref_array( 'wp_feed_options', array( $feed, $this->feeds ) );
|
114 |
-
$feed->strip_comments( true );
|
115 |
-
$feed->strip_htmltags( array(
|
116 |
-
'base',
|
117 |
-
'blink',
|
118 |
-
'body',
|
119 |
-
'doctype',
|
120 |
-
'embed',
|
121 |
-
'font',
|
122 |
-
'form',
|
123 |
-
'frame',
|
124 |
-
'frameset',
|
125 |
-
'html',
|
126 |
-
'iframe',
|
127 |
-
'input',
|
128 |
-
'marquee',
|
129 |
-
'meta',
|
130 |
-
'noscript',
|
131 |
-
'object',
|
132 |
-
'param',
|
133 |
-
'script',
|
134 |
-
'style',
|
135 |
-
) );
|
136 |
-
$feed->init();
|
137 |
-
$feed->handle_content_type();
|
138 |
-
$items = $feed->get_items( 0, 5 );
|
139 |
-
$this->items = array();
|
140 |
-
foreach ( (array) $items as $item ) {
|
141 |
-
$this->items[] = array(
|
142 |
-
'title' => $item->get_title(),
|
143 |
-
'date' => $item->get_date( 'U' ),
|
144 |
-
'link' => $item->get_permalink(),
|
145 |
-
);
|
146 |
-
}
|
147 |
-
if ( ! empty( $this->items ) ) {
|
148 |
-
wp_add_dashboard_widget( 'epsilon_dashboard', $this->dashboard_name, array( &$this, 'render_dashboard_widget' ) );
|
149 |
-
}
|
150 |
-
}
|
151 |
-
|
152 |
-
/**
|
153 |
-
* Render widget content
|
154 |
-
*/
|
155 |
-
function render_dashboard_widget() {
|
156 |
-
?>
|
157 |
-
<style type="text/css">
|
158 |
-
|
159 |
-
.epsilon-dw-feed-item {
|
160 |
-
display: flex;
|
161 |
-
align-items: center;
|
162 |
-
}
|
163 |
-
|
164 |
-
.epsilon-dw-feed-item a {
|
165 |
-
float: left;
|
166 |
-
width: 89.9%;
|
167 |
-
}
|
168 |
-
|
169 |
-
.epsilon-dw-feed-item .epsilon-dw-day-container {
|
170 |
-
width: 100%;
|
171 |
-
letter-spacing: 3px;
|
172 |
-
display: block;
|
173 |
-
}
|
174 |
-
|
175 |
-
.epsilon-dw-feed-item .epsilon-dw-month-container {
|
176 |
-
|
177 |
-
width: 100%;
|
178 |
-
display: block;
|
179 |
-
font-weight: 600;
|
180 |
-
padding: 0px;
|
181 |
-
margin-top: -6px;
|
182 |
-
text-transform: uppercase;
|
183 |
-
font-size: 10px;
|
184 |
-
letter-spacing: 1px;
|
185 |
-
}
|
186 |
-
|
187 |
-
.epsilon-dw-feed-item .epsilon-dw-date-container {
|
188 |
-
float: left;
|
189 |
-
min-height: 30px;
|
190 |
-
margin-right: 0.1%;
|
191 |
-
width: 10%;
|
192 |
-
text-align: center;
|
193 |
-
}
|
194 |
-
|
195 |
-
</style>
|
196 |
-
<ul>
|
197 |
-
<?php
|
198 |
-
if ( ! empty( $this->items ) ) {
|
199 |
-
foreach ( $this->items as $item ) {
|
200 |
-
$query_args = array(
|
201 |
-
'utm_campaign' => 'feed',
|
202 |
-
'utm_medium' => 'dashboard_widget',
|
203 |
-
);
|
204 |
-
?>
|
205 |
-
<li class="epsilon-dw-feed-item">
|
206 |
-
<span class="epsilon-dw-date-container">
|
207 |
-
<span class="epsilon-dw-day-container"><?php echo esc_html( date( 'd', $item['date'] ) ); ?></span>
|
208 |
-
<span class="epsilon-dw-month-container"><?php echo esc_html( substr( date( 'M', $item['date'] ), 0, 3 ) ); ?></span>
|
209 |
-
</span>
|
210 |
-
<a href="<?php echo esc_url( add_query_arg( $query_args, $item['link'] ) ); ?>" target="_blank"><?php echo esc_html( $item['title'] ); ?></a>
|
211 |
-
<div class="clear"></div>
|
212 |
-
</li>
|
213 |
-
<?php
|
214 |
-
}
|
215 |
-
}
|
216 |
-
?>
|
217 |
-
</ul>
|
218 |
-
|
219 |
-
<?php
|
220 |
-
|
221 |
-
}
|
222 |
-
}
|
223 |
-
|
224 |
-
}// End if().
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit;
|
4 |
+
}
|
5 |
+
if ( ! class_exists( 'Epsilon_Dashboard' ) ) {
|
6 |
+
/**
|
7 |
+
* Dashboard Widget
|
8 |
+
*/
|
9 |
+
final class Epsilon_Dashboard {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* The script version
|
13 |
+
*
|
14 |
+
* @var string Script version
|
15 |
+
*/
|
16 |
+
public $script_version = '1.0.0';
|
17 |
+
/**
|
18 |
+
* The script url
|
19 |
+
*
|
20 |
+
* @var string The URL of the script
|
21 |
+
*/
|
22 |
+
public $script_url;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* The class instance
|
26 |
+
*
|
27 |
+
* @var Epsilon_Dashboard The singleton instance of the class
|
28 |
+
*/
|
29 |
+
public static $instance;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The title of the widget
|
33 |
+
*
|
34 |
+
* @var string The dashboard widget title
|
35 |
+
*/
|
36 |
+
public $dashboard_name;
|
37 |
+
/**
|
38 |
+
* Array that holds the urls of the blog feeds
|
39 |
+
*
|
40 |
+
* @var array Feeds to fetch news from
|
41 |
+
*/
|
42 |
+
public $feeds;
|
43 |
+
/**
|
44 |
+
* The feed items array
|
45 |
+
*
|
46 |
+
* @var array The feeds items
|
47 |
+
*/
|
48 |
+
public $items;
|
49 |
+
|
50 |
+
/**
|
51 |
+
* The instance of the class
|
52 |
+
*
|
53 |
+
* @var Epsilon_Dashboard The singleton instance
|
54 |
+
*/
|
55 |
+
public static function instance( $args ) {
|
56 |
+
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Epsilon_Dashboard ) ) {
|
57 |
+
self::$instance = new Epsilon_Dashboard;
|
58 |
+
|
59 |
+
if ( isset( $args['feed_url'] ) ) {
|
60 |
+
self::$instance->setup_vars( $args );
|
61 |
+
self::$instance->load_hooks();
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
return self::$instance;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Load hooks to show the widget
|
70 |
+
*/
|
71 |
+
public function load_hooks() {
|
72 |
+
add_action( 'wp_dashboard_setup', array( &$this, 'add_widget' ) );
|
73 |
+
add_action( 'wp_network_dashboard_setup', array( &$this, 'add_widget' ) );
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Setup class variables
|
78 |
+
*/
|
79 |
+
public function setup_vars( $args ) {
|
80 |
+
if ( ! isset( $args['widget_title'] ) ) {
|
81 |
+
$args['widget_title'] = apply_filters( 'epsilon_dashboard_widget_name', esc_html__( 'WordPress Guides/Tutorials', 'shapely-companion' ) );
|
82 |
+
}
|
83 |
+
$this->dashboard_name = $args['widget_title'];
|
84 |
+
$this->feeds = (array) $args['feed_url'];
|
85 |
+
$abs = untrailingslashit( ( dirname( __FILE__ ) ) );
|
86 |
+
$parts = str_replace( untrailingslashit( ABSPATH ), '', $abs );
|
87 |
+
$parts = explode( DIRECTORY_SEPARATOR, $parts );
|
88 |
+
$parts = array_filter( $parts );
|
89 |
+
$this->script_url = site_url() . '/' . implode( '/', $parts );
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Add widget to the dashboard
|
94 |
+
*
|
95 |
+
* @return string|void
|
96 |
+
*/
|
97 |
+
function add_widget() {
|
98 |
+
global $wp_meta_boxes;
|
99 |
+
if ( isset( $wp_meta_boxes['dashboard']['normal']['core']['epsilon_dashboard'] ) ) {
|
100 |
+
return;
|
101 |
+
}
|
102 |
+
// Load SimplePie Instance
|
103 |
+
$feed = fetch_feed( $this->feeds );
|
104 |
+
// TODO report error when is an error loading the feed
|
105 |
+
if ( is_wp_error( $feed ) ) {
|
106 |
+
return '';
|
107 |
+
}
|
108 |
+
$feed->enable_cache( true );
|
109 |
+
$feed->enable_order_by_date( true );
|
110 |
+
$feed->set_cache_class( 'WP_Feed_Cache' );
|
111 |
+
$feed->set_file_class( 'WP_SimplePie_File' );
|
112 |
+
$feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 7200, $this->feeds ) );
|
113 |
+
do_action_ref_array( 'wp_feed_options', array( $feed, $this->feeds ) );
|
114 |
+
$feed->strip_comments( true );
|
115 |
+
$feed->strip_htmltags( array(
|
116 |
+
'base',
|
117 |
+
'blink',
|
118 |
+
'body',
|
119 |
+
'doctype',
|
120 |
+
'embed',
|
121 |
+
'font',
|
122 |
+
'form',
|
123 |
+
'frame',
|
124 |
+
'frameset',
|
125 |
+
'html',
|
126 |
+
'iframe',
|
127 |
+
'input',
|
128 |
+
'marquee',
|
129 |
+
'meta',
|
130 |
+
'noscript',
|
131 |
+
'object',
|
132 |
+
'param',
|
133 |
+
'script',
|
134 |
+
'style',
|
135 |
+
) );
|
136 |
+
$feed->init();
|
137 |
+
$feed->handle_content_type();
|
138 |
+
$items = $feed->get_items( 0, 5 );
|
139 |
+
$this->items = array();
|
140 |
+
foreach ( (array) $items as $item ) {
|
141 |
+
$this->items[] = array(
|
142 |
+
'title' => $item->get_title(),
|
143 |
+
'date' => $item->get_date( 'U' ),
|
144 |
+
'link' => $item->get_permalink(),
|
145 |
+
);
|
146 |
+
}
|
147 |
+
if ( ! empty( $this->items ) ) {
|
148 |
+
wp_add_dashboard_widget( 'epsilon_dashboard', $this->dashboard_name, array( &$this, 'render_dashboard_widget' ) );
|
149 |
+
}
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Render widget content
|
154 |
+
*/
|
155 |
+
function render_dashboard_widget() {
|
156 |
+
?>
|
157 |
+
<style type="text/css">
|
158 |
+
|
159 |
+
.epsilon-dw-feed-item {
|
160 |
+
display: flex;
|
161 |
+
align-items: center;
|
162 |
+
}
|
163 |
+
|
164 |
+
.epsilon-dw-feed-item a {
|
165 |
+
float: left;
|
166 |
+
width: 89.9%;
|
167 |
+
}
|
168 |
+
|
169 |
+
.epsilon-dw-feed-item .epsilon-dw-day-container {
|
170 |
+
width: 100%;
|
171 |
+
letter-spacing: 3px;
|
172 |
+
display: block;
|
173 |
+
}
|
174 |
+
|
175 |
+
.epsilon-dw-feed-item .epsilon-dw-month-container {
|
176 |
+
|
177 |
+
width: 100%;
|
178 |
+
display: block;
|
179 |
+
font-weight: 600;
|
180 |
+
padding: 0px;
|
181 |
+
margin-top: -6px;
|
182 |
+
text-transform: uppercase;
|
183 |
+
font-size: 10px;
|
184 |
+
letter-spacing: 1px;
|
185 |
+
}
|
186 |
+
|
187 |
+
.epsilon-dw-feed-item .epsilon-dw-date-container {
|
188 |
+
float: left;
|
189 |
+
min-height: 30px;
|
190 |
+
margin-right: 0.1%;
|
191 |
+
width: 10%;
|
192 |
+
text-align: center;
|
193 |
+
}
|
194 |
+
|
195 |
+
</style>
|
196 |
+
<ul>
|
197 |
+
<?php
|
198 |
+
if ( ! empty( $this->items ) ) {
|
199 |
+
foreach ( $this->items as $item ) {
|
200 |
+
$query_args = array(
|
201 |
+
'utm_campaign' => 'feed',
|
202 |
+
'utm_medium' => 'dashboard_widget',
|
203 |
+
);
|
204 |
+
?>
|
205 |
+
<li class="epsilon-dw-feed-item">
|
206 |
+
<span class="epsilon-dw-date-container">
|
207 |
+
<span class="epsilon-dw-day-container"><?php echo esc_html( date( 'd', $item['date'] ) ); ?></span>
|
208 |
+
<span class="epsilon-dw-month-container"><?php echo esc_html( substr( date( 'M', $item['date'] ), 0, 3 ) ); ?></span>
|
209 |
+
</span>
|
210 |
+
<a href="<?php echo esc_url( add_query_arg( $query_args, $item['link'] ) ); ?>" target="_blank"><?php echo esc_html( $item['title'] ); ?></a>
|
211 |
+
<div class="clear"></div>
|
212 |
+
</li>
|
213 |
+
<?php
|
214 |
+
}
|
215 |
+
}
|
216 |
+
?>
|
217 |
+
</ul>
|
218 |
+
|
219 |
+
<?php
|
220 |
+
|
221 |
+
}
|
222 |
+
}
|
223 |
+
|
224 |
+
}// End if().
|
inc/shapely-demo-content.php
CHANGED
@@ -1,167 +1,167 @@
|
|
1 |
-
<?php
|
2 |
-
// If this file is called directly, abort.
|
3 |
-
if ( ! defined( 'WPINC' ) ) {
|
4 |
-
die;
|
5 |
-
}
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Function to import widgets based on a JSON config file
|
9 |
-
* JSON file is generated using plugin: Widget Importer / Exporter
|
10 |
-
*
|
11 |
-
* @link https://github.com/stevengliebe/widget-importer-exporter
|
12 |
-
*/
|
13 |
-
function shapely_companion_add_default_widgets() {
|
14 |
-
$json = '{"sidebar-1":{"search-2":{"title":""},"recent-posts-2":{"title":"","number":5},"categories-2":{"title":"","count":0,"hierarchical":0,"dropdown":0}},"sidebar-home":{"shapely_home_parallax-2":{"title":"We Change Everything WordPress","image_src":"http://demo.colorlib.com/wp-content/uploads/sites/59/2016/03/photo-1443527216320-7e744084f5a7-1.jpg","image_pos":"background-full","body_content":"This is the only WordPress theme you will ever want to use.","button1":"Read More","button2":"Download Now","button1_link":"#","button2_link":"#","border_bottom":""},"shapely_home_parallax-3":{"title":"SEO Friendly","image_src":"https://demo.colorlib.com/wp-content/uploads/sites/59/2016/03/macbook-preview-flexible.png","image_pos":"left","body_content":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam pulvinar luctus sem, eget porta orci. Maecenas molestie dui id diam feugiat, eu tincidunt mauris aliquam. Duis commodo vitae ligula et interdum. Maecenas faucibus mattis imperdiet. In rhoncus ac ligula id ultricies.","button1":"Read more","button2":"","button1_link":"#","button2_link":"","border_bottom":""},"shapely_home_parallax-4":{"title":"Portfolio Section","image_src":"https://demo.colorlib.com/wp-content/uploads/sites/59/2016/03/flexible-portfolio.png","image_pos":"right","body_content":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam pulvinar luctus sem, eget porta orci. Maecenas molestie dui id diam feugiat, eu tincidunt mauris aliquam. Duis commodo vitae ligula et interdum.","button1":"See it in action","button2":"","button1_link":"#","button2_link":"","border_bottom":""},"shapely_home_parallax-5":{"title":"Small Parallax Section","image_src":"http://demo.colorlib.com/wp-content/uploads/sites/59/2016/12/photo-1452723312111-3a7d0db0e024.jpg","image_pos":"background-small","body_content":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus imperdiet rhoncus porta. Ut quis sem quis purus lobortis dictum. Aliquam nec dignissim nisl. Vivamus cursus feugiat sapien, eget tincidunt leo ornare quis.","button1":"MORE INFO","button2":"","button1_link":"#","button2_link":"","border_bottom":""},"shapely_home_parallax-6":{"title":"Limitless Options","image_src":"https://demo.colorlib.com/wp-content/uploads/sites/59/2016/12/photo-1440557653082-e8e186733eeb-1.jpg","image_pos":"bottom","body_content":"Phasellus sed nisi ac dui interdum semper. Etiam consequat fermentum sollicitudin. Fusce vulputate porta faucibus. Vivamus nulla tellus, accumsan non efficitur id, pretium quis ante","button1":"Download Now","button2":"","button1_link":"#","button2_link":"","border_bottom":""},"shapely_home_portfolio-2":{"title":"Our Latest Projects","body_content":"Here is our latest projects. You'll love them!"},"shapely_home_testimonial-2":{"title":"What Our Customers Say","limit":5,"image_src":"https://demo.colorlib.com/wp-content/uploads/sites/59\/2016\/12\/photo-1451417379553-15d8e8f49cde.jpg"},"shapely_home_contact-2":{"title":"Contact us","image_src":"","body_content":"Mauris vestibulum, metus at semper efficitur, est ex tincidunt elit, vitae tincidunt sem sem in est. Sed eget enim nunc.","phone":"(650) 652-8500","address":"33 Farlane Street Keilor East VIC 3033, New York","email":"mail@mail.com","contactform":32,"socialicons":""},"shapely_home_clients-2":{"title":"Our Main Clients","client_logo":{"img":["https://demo.colorlib.com/wp-content/uploads/sites/59\/2016\/03\/colorlib-logo.png","https://demo.colorlib.com/wp-content/uploads/sites/59\/2016\/03\/js-logo.png","https://demo.colorlib.com/wp-content/uploads/sites/59\/2016\/03\/html5-logo.png","https://demo.colorlib.com/wp-content/uploads/sites/59\/2016\/03\/css-logo.png","https://demo.colorlib.com/wp-content/uploads/sites/59\/2016\/03\/less-logo.png","https://demo.colorlib.com/wp-content/uploads/sites/59\/2016\/03\/sass-logo.png","https://demo.colorlib.com/wp-content/uploads/sites/59\/2016\/03\/bootstrap-logo.jpg","https://demo.colorlib.com/wp-content/uploads/sites/59\/2016\/03\/adobe-logo.png","https://demo.colorlib.com/wp-content/uploads/sites/59\/2016\/03\/facebook-logo.png"],"link":["#","#","#","#","#","#","#","#","#"]}},"shapely_home_cfa-2":{"title":"Do you like this awesome WordPress theme?","button":"Download Now","button_link":"#"}}}';
|
15 |
-
$config = json_decode( $json );
|
16 |
-
$sidebars_widgets = get_option( 'sidebars_widgets' );
|
17 |
-
# Parse config
|
18 |
-
foreach ( $config as $sidebar => $elemements ) {
|
19 |
-
# verify if the sidebar doesn't have ny widgets
|
20 |
-
if ( false === strpos( $sidebar, 'orphaned_widgets' ) && ! is_active_sidebar( $sidebar ) ) {
|
21 |
-
# create an empty array for active widgets
|
22 |
-
$this_sidebar_active_widgets = array();
|
23 |
-
# parse all widgets for current sidebar
|
24 |
-
foreach ( $elemements as $id_widget => $args ) {
|
25 |
-
# add current widget to current sidebar
|
26 |
-
$this_sidebar_active_widgets[] = $id_widget;
|
27 |
-
# split widget name in order to get widget name and index
|
28 |
-
$id_widget_parts = explode( '-', $id_widget );
|
29 |
-
# get widget index
|
30 |
-
$index_widget = end( $id_widget_parts );
|
31 |
-
#remove widget index from array
|
32 |
-
array_pop( $id_widget_parts );
|
33 |
-
#generate widget name
|
34 |
-
$widget_name = implode( '-', $id_widget_parts );
|
35 |
-
#get all widgets who are like current widget
|
36 |
-
$widgets = get_option( 'widget_' . $widget_name );
|
37 |
-
#check if current index exist in array
|
38 |
-
if ( ! isset( $widgets[ $index_widget ] ) ) {
|
39 |
-
|
40 |
-
#check if a contact form 7 exist.
|
41 |
-
if ( false !== strpos( $id_widget, 'shapely_home_contact' ) ) {
|
42 |
-
$cf_args = array(
|
43 |
-
'post_type' => 'wpcf7_contact_form',
|
44 |
-
'post_status' => 'publish',
|
45 |
-
'fields' => 'ids',
|
46 |
-
);
|
47 |
-
$cf7 = get_posts( $cf_args );
|
48 |
-
if ( ! empty( $cf7 ) && isset( $cf7[0] ) ) {
|
49 |
-
$args->contactform = $cf7[0];
|
50 |
-
}
|
51 |
-
}
|
52 |
-
|
53 |
-
#add current widget with his index and args
|
54 |
-
$widgets[ $index_widget ] = get_object_vars( $args );
|
55 |
-
|
56 |
-
}
|
57 |
-
#update widgets who are like current widget
|
58 |
-
update_option( 'widget_' . $widget_name, $widgets );
|
59 |
-
}
|
60 |
-
$sidebars_widgets[ $sidebar ] = $this_sidebar_active_widgets;
|
61 |
-
}
|
62 |
-
}
|
63 |
-
update_option( 'sidebars_widgets', $sidebars_widgets );
|
64 |
-
}
|
65 |
-
|
66 |
-
add_action( 'wp_ajax_shapely_companion_import_content', 'shapely_companion_import_content' );
|
67 |
-
|
68 |
-
function shapely_companion_import_content() {
|
69 |
-
|
70 |
-
if( !isset( $_POST['nonce'] ) ) {
|
71 |
-
wp_send_json_error( 'no nonce' );
|
72 |
-
die();
|
73 |
-
}
|
74 |
-
|
75 |
-
if ( ! wp_verify_nonce( $_POST['nonce'], 'welcome_nonce' ) ) {//phpcs:ignore
|
76 |
-
wp_send_json_error();
|
77 |
-
die();
|
78 |
-
}
|
79 |
-
|
80 |
-
if ( ! current_user_can( 'manage_options' ) ) {
|
81 |
-
wp_send_json_error( 'user capabilities' );
|
82 |
-
die();
|
83 |
-
}
|
84 |
-
|
85 |
-
if ( isset( $_POST['import'] ) ) {
|
86 |
-
|
87 |
-
if ( 'import-all' == $_POST['import'] ) {
|
88 |
-
|
89 |
-
$frontpage_title = __( 'Front Page', 'shapely-companion' );
|
90 |
-
$blog_title = __( 'Blog', 'shapely-companion' );
|
91 |
-
|
92 |
-
$frontpage_id = wp_insert_post(
|
93 |
-
array(
|
94 |
-
'post_title' => $frontpage_title,
|
95 |
-
'post_status' => 'publish',
|
96 |
-
'post_type' => 'page',
|
97 |
-
)
|
98 |
-
);
|
99 |
-
$blog_id = wp_insert_post(
|
100 |
-
array(
|
101 |
-
'post_title' => $blog_title,
|
102 |
-
'post_status' => 'publish',
|
103 |
-
'post_type' => 'page',
|
104 |
-
)
|
105 |
-
);
|
106 |
-
|
107 |
-
if ( - 1 != $frontpage_id ) {
|
108 |
-
update_post_meta( $frontpage_id, '_wp_page_template', 'page-templates/template-home.php' );
|
109 |
-
} // End if().
|
110 |
-
|
111 |
-
update_option( 'show_on_front', 'page' );
|
112 |
-
update_option( 'page_on_front', $frontpage_id );
|
113 |
-
update_option( 'page_for_posts', $blog_id );
|
114 |
-
shapely_companion_add_default_widgets();
|
115 |
-
|
116 |
-
} elseif ( 'import-widgets' == $_POST['import'] ) {
|
117 |
-
shapely_companion_add_default_widgets();
|
118 |
-
} elseif ( 'set-frontpage' == $_POST['import'] ) {
|
119 |
-
|
120 |
-
$frontpage_title = __( 'Front Page', 'shapely-companion' );
|
121 |
-
$blog_title = __( 'Blog', 'shapely-companion' );
|
122 |
-
|
123 |
-
$frontpage_id = wp_insert_post(
|
124 |
-
array(
|
125 |
-
'post_title' => $frontpage_title,
|
126 |
-
'post_status' => 'publish',
|
127 |
-
'post_type' => 'page',
|
128 |
-
)
|
129 |
-
);
|
130 |
-
$blog_id = wp_insert_post(
|
131 |
-
array(
|
132 |
-
'post_title' => $blog_title,
|
133 |
-
'post_status' => 'publish',
|
134 |
-
'post_type' => 'page',
|
135 |
-
)
|
136 |
-
);
|
137 |
-
|
138 |
-
if ( - 1 != $frontpage_id ) {
|
139 |
-
update_post_meta( $frontpage_id, '_wp_page_template', 'page-templates/template-home.php' );
|
140 |
-
} // End if().
|
141 |
-
|
142 |
-
update_option( 'show_on_front', 'page' );
|
143 |
-
update_option( 'page_on_front', $frontpage_id );
|
144 |
-
update_option( 'page_for_posts', $blog_id );
|
145 |
-
|
146 |
-
}
|
147 |
-
|
148 |
-
update_option( 'shapely_imported_demo', true );
|
149 |
-
|
150 |
-
echo wp_json_encode(
|
151 |
-
array(
|
152 |
-
'status' => true,
|
153 |
-
'message' => 'ok',
|
154 |
-
)
|
155 |
-
);
|
156 |
-
} else {
|
157 |
-
echo wp_json_encode(
|
158 |
-
array(
|
159 |
-
'status' => false,
|
160 |
-
'message' => 'nok',
|
161 |
-
)
|
162 |
-
);
|
163 |
-
}// End if().
|
164 |
-
|
165 |
-
exit();
|
166 |
-
|
167 |
-
}
|
1 |
+
<?php
|
2 |
+
// If this file is called directly, abort.
|
3 |
+
if ( ! defined( 'WPINC' ) ) {
|
4 |
+
die;
|
5 |
+
}
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Function to import widgets based on a JSON config file
|
9 |
+
* JSON file is generated using plugin: Widget Importer / Exporter
|
10 |
+
*
|
11 |
+
* @link https://github.com/stevengliebe/widget-importer-exporter
|
12 |
+
*/
|
13 |
+
function shapely_companion_add_default_widgets() {
|
14 |
+
$json = '{"sidebar-1":{"search-2":{"title":""},"recent-posts-2":{"title":"","number":5},"categories-2":{"title":"","count":0,"hierarchical":0,"dropdown":0}},"sidebar-home":{"shapely_home_parallax-2":{"title":"We Change Everything WordPress","image_src":"http://demo.colorlib.com/wp-content/uploads/sites/59/2016/03/photo-1443527216320-7e744084f5a7-1.jpg","image_pos":"background-full","body_content":"This is the only WordPress theme you will ever want to use.","button1":"Read More","button2":"Download Now","button1_link":"#","button2_link":"#","border_bottom":""},"shapely_home_parallax-3":{"title":"SEO Friendly","image_src":"https://demo.colorlib.com/wp-content/uploads/sites/59/2016/03/macbook-preview-flexible.png","image_pos":"left","body_content":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam pulvinar luctus sem, eget porta orci. Maecenas molestie dui id diam feugiat, eu tincidunt mauris aliquam. Duis commodo vitae ligula et interdum. Maecenas faucibus mattis imperdiet. In rhoncus ac ligula id ultricies.","button1":"Read more","button2":"","button1_link":"#","button2_link":"","border_bottom":""},"shapely_home_parallax-4":{"title":"Portfolio Section","image_src":"https://demo.colorlib.com/wp-content/uploads/sites/59/2016/03/flexible-portfolio.png","image_pos":"right","body_content":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam pulvinar luctus sem, eget porta orci. Maecenas molestie dui id diam feugiat, eu tincidunt mauris aliquam. Duis commodo vitae ligula et interdum.","button1":"See it in action","button2":"","button1_link":"#","button2_link":"","border_bottom":""},"shapely_home_parallax-5":{"title":"Small Parallax Section","image_src":"http://demo.colorlib.com/wp-content/uploads/sites/59/2016/12/photo-1452723312111-3a7d0db0e024.jpg","image_pos":"background-small","body_content":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus imperdiet rhoncus porta. Ut quis sem quis purus lobortis dictum. Aliquam nec dignissim nisl. Vivamus cursus feugiat sapien, eget tincidunt leo ornare quis.","button1":"MORE INFO","button2":"","button1_link":"#","button2_link":"","border_bottom":""},"shapely_home_parallax-6":{"title":"Limitless Options","image_src":"https://demo.colorlib.com/wp-content/uploads/sites/59/2016/12/photo-1440557653082-e8e186733eeb-1.jpg","image_pos":"bottom","body_content":"Phasellus sed nisi ac dui interdum semper. Etiam consequat fermentum sollicitudin. Fusce vulputate porta faucibus. Vivamus nulla tellus, accumsan non efficitur id, pretium quis ante","button1":"Download Now","button2":"","button1_link":"#","button2_link":"","border_bottom":""},"shapely_home_portfolio-2":{"title":"Our Latest Projects","body_content":"Here is our latest projects. You'll love them!"},"shapely_home_testimonial-2":{"title":"What Our Customers Say","limit":5,"image_src":"https://demo.colorlib.com/wp-content/uploads/sites/59\/2016\/12\/photo-1451417379553-15d8e8f49cde.jpg"},"shapely_home_contact-2":{"title":"Contact us","image_src":"","body_content":"Mauris vestibulum, metus at semper efficitur, est ex tincidunt elit, vitae tincidunt sem sem in est. Sed eget enim nunc.","phone":"(650) 652-8500","address":"33 Farlane Street Keilor East VIC 3033, New York","email":"mail@mail.com","contactform":32,"socialicons":""},"shapely_home_clients-2":{"title":"Our Main Clients","client_logo":{"img":["https://demo.colorlib.com/wp-content/uploads/sites/59\/2016\/03\/colorlib-logo.png","https://demo.colorlib.com/wp-content/uploads/sites/59\/2016\/03\/js-logo.png","https://demo.colorlib.com/wp-content/uploads/sites/59\/2016\/03\/html5-logo.png","https://demo.colorlib.com/wp-content/uploads/sites/59\/2016\/03\/css-logo.png","https://demo.colorlib.com/wp-content/uploads/sites/59\/2016\/03\/less-logo.png","https://demo.colorlib.com/wp-content/uploads/sites/59\/2016\/03\/sass-logo.png","https://demo.colorlib.com/wp-content/uploads/sites/59\/2016\/03\/bootstrap-logo.jpg","https://demo.colorlib.com/wp-content/uploads/sites/59\/2016\/03\/adobe-logo.png","https://demo.colorlib.com/wp-content/uploads/sites/59\/2016\/03\/facebook-logo.png"],"link":["#","#","#","#","#","#","#","#","#"]}},"shapely_home_cfa-2":{"title":"Do you like this awesome WordPress theme?","button":"Download Now","button_link":"#"}}}';
|
15 |
+
$config = json_decode( $json );
|
16 |
+
$sidebars_widgets = get_option( 'sidebars_widgets' );
|
17 |
+
# Parse config
|
18 |
+
foreach ( $config as $sidebar => $elemements ) {
|
19 |
+
# verify if the sidebar doesn't have ny widgets
|
20 |
+
if ( false === strpos( $sidebar, 'orphaned_widgets' ) && ! is_active_sidebar( $sidebar ) ) {
|
21 |
+
# create an empty array for active widgets
|
22 |
+
$this_sidebar_active_widgets = array();
|
23 |
+
# parse all widgets for current sidebar
|
24 |
+
foreach ( $elemements as $id_widget => $args ) {
|
25 |
+
# add current widget to current sidebar
|
26 |
+
$this_sidebar_active_widgets[] = $id_widget;
|
27 |
+
# split widget name in order to get widget name and index
|
28 |
+
$id_widget_parts = explode( '-', $id_widget );
|
29 |
+
# get widget index
|
30 |
+
$index_widget = end( $id_widget_parts );
|
31 |
+
#remove widget index from array
|
32 |
+
array_pop( $id_widget_parts );
|
33 |
+
#generate widget name
|
34 |
+
$widget_name = implode( '-', $id_widget_parts );
|
35 |
+
#get all widgets who are like current widget
|
36 |
+
$widgets = get_option( 'widget_' . $widget_name );
|
37 |
+
#check if current index exist in array
|
38 |
+
if ( ! isset( $widgets[ $index_widget ] ) ) {
|
39 |
+
|
40 |
+
#check if a contact form 7 exist.
|
41 |
+
if ( false !== strpos( $id_widget, 'shapely_home_contact' ) ) {
|
42 |
+
$cf_args = array(
|
43 |
+
'post_type' => 'wpcf7_contact_form',
|
44 |
+
'post_status' => 'publish',
|
45 |
+
'fields' => 'ids',
|
46 |
+
);
|
47 |
+
$cf7 = get_posts( $cf_args );
|
48 |
+
if ( ! empty( $cf7 ) && isset( $cf7[0] ) ) {
|
49 |
+
$args->contactform = $cf7[0];
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
#add current widget with his index and args
|
54 |
+
$widgets[ $index_widget ] = get_object_vars( $args );
|
55 |
+
|
56 |
+
}
|
57 |
+
#update widgets who are like current widget
|
58 |
+
update_option( 'widget_' . $widget_name, $widgets );
|
59 |
+
}
|
60 |
+
$sidebars_widgets[ $sidebar ] = $this_sidebar_active_widgets;
|
61 |
+
}
|
62 |
+
}
|
63 |
+
update_option( 'sidebars_widgets', $sidebars_widgets );
|
64 |
+
}
|
65 |
+
|
66 |
+
add_action( 'wp_ajax_shapely_companion_import_content', 'shapely_companion_import_content' );
|
67 |
+
|
68 |
+
function shapely_companion_import_content() {
|
69 |
+
|
70 |
+
if( !isset( $_POST['nonce'] ) ) {
|
71 |
+
wp_send_json_error( 'no nonce' );
|
72 |
+
die();
|
73 |
+
}
|
74 |
+
|
75 |
+
if ( ! wp_verify_nonce( $_POST['nonce'], 'welcome_nonce' ) ) {//phpcs:ignore
|
76 |
+
wp_send_json_error();
|
77 |
+
die();
|
78 |
+
}
|
79 |
+
|
80 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
81 |
+
wp_send_json_error( 'user capabilities' );
|
82 |
+
die();
|
83 |
+
}
|
84 |
+
|
85 |
+
if ( isset( $_POST['import'] ) ) {
|
86 |
+
|
87 |
+
if ( 'import-all' == $_POST['import'] ) {
|
88 |
+
|
89 |
+
$frontpage_title = __( 'Front Page', 'shapely-companion' );
|
90 |
+
$blog_title = __( 'Blog', 'shapely-companion' );
|
91 |
+
|
92 |
+
$frontpage_id = wp_insert_post(
|
93 |
+
array(
|
94 |
+
'post_title' => $frontpage_title,
|
95 |
+
'post_status' => 'publish',
|
96 |
+
'post_type' => 'page',
|
97 |
+
)
|
98 |
+
);
|
99 |
+
$blog_id = wp_insert_post(
|
100 |
+
array(
|
101 |
+
'post_title' => $blog_title,
|
102 |
+
'post_status' => 'publish',
|
103 |
+
'post_type' => 'page',
|
104 |
+
)
|
105 |
+
);
|
106 |
+
|
107 |
+
if ( - 1 != $frontpage_id ) {
|
108 |
+
update_post_meta( $frontpage_id, '_wp_page_template', 'page-templates/template-home.php' );
|
109 |
+
} // End if().
|
110 |
+
|
111 |
+
update_option( 'show_on_front', 'page' );
|
112 |
+
update_option( 'page_on_front', $frontpage_id );
|
113 |
+
update_option( 'page_for_posts', $blog_id );
|
114 |
+
shapely_companion_add_default_widgets();
|
115 |
+
|
116 |
+
} elseif ( 'import-widgets' == $_POST['import'] ) {
|
117 |
+
shapely_companion_add_default_widgets();
|
118 |
+
} elseif ( 'set-frontpage' == $_POST['import'] ) {
|
119 |
+
|
120 |
+
$frontpage_title = __( 'Front Page', 'shapely-companion' );
|
121 |
+
$blog_title = __( 'Blog', 'shapely-companion' );
|
122 |
+
|
123 |
+
$frontpage_id = wp_insert_post(
|
124 |
+
array(
|
125 |
+
'post_title' => $frontpage_title,
|
126 |
+
'post_status' => 'publish',
|
127 |
+
'post_type' => 'page',
|
128 |
+
)
|
129 |
+
);
|
130 |
+
$blog_id = wp_insert_post(
|
131 |
+
array(
|
132 |
+
'post_title' => $blog_title,
|
133 |
+
'post_status' => 'publish',
|
134 |
+
'post_type' => 'page',
|
135 |
+
)
|
136 |
+
);
|
137 |
+
|
138 |
+
if ( - 1 != $frontpage_id ) {
|
139 |
+
update_post_meta( $frontpage_id, '_wp_page_template', 'page-templates/template-home.php' );
|
140 |
+
} // End if().
|
141 |
+
|
142 |
+
update_option( 'show_on_front', 'page' );
|
143 |
+
update_option( 'page_on_front', $frontpage_id );
|
144 |
+
update_option( 'page_for_posts', $blog_id );
|
145 |
+
|
146 |
+
}
|
147 |
+
|
148 |
+
update_option( 'shapely_imported_demo', true );
|
149 |
+
|
150 |
+
echo wp_json_encode(
|
151 |
+
array(
|
152 |
+
'status' => true,
|
153 |
+
'message' => 'ok',
|
154 |
+
)
|
155 |
+
);
|
156 |
+
} else {
|
157 |
+
echo wp_json_encode(
|
158 |
+
array(
|
159 |
+
'status' => false,
|
160 |
+
'message' => 'nok',
|
161 |
+
)
|
162 |
+
);
|
163 |
+
}// End if().
|
164 |
+
|
165 |
+
exit();
|
166 |
+
|
167 |
+
}
|
inc/shapely-enqueues.php
CHANGED
@@ -1,34 +1,34 @@
|
|
1 |
-
<?php
|
2 |
-
// If this file is called directly, abort.
|
3 |
-
if ( ! defined( 'WPINC' ) ) {
|
4 |
-
die;
|
5 |
-
}
|
6 |
-
add_action( 'admin_enqueue_scripts', 'shapely_companion_admin_scripts' );
|
7 |
-
function shapely_companion_admin_scripts( $hook ) {
|
8 |
-
wp_enqueue_style( 'shapely-companion-admin-css', plugins_url( 'assets/css/admin.css', dirname( __FILE__ ) ) );
|
9 |
-
wp_enqueue_script( 'shapely-companion-admin-js', plugins_url( 'assets/js/admin.js', dirname( __FILE__ ) ), array( 'jquery' ) );
|
10 |
-
wp_localize_script(
|
11 |
-
'shapely-companion-admin-js', 'shapelyCompanion', array(
|
12 |
-
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
13 |
-
'nonce' => wp_create_nonce( "welcome_nonce" ),
|
14 |
-
)
|
15 |
-
);
|
16 |
-
if ( 'widgets.php' == $hook || 'customize.php' == $hook ) {
|
17 |
-
wp_enqueue_media();
|
18 |
-
wp_enqueue_script( 'shapely_cloneya_js', plugins_url( 'assets/js/vendor/jquery-cloneya.min.js', dirname( __FILE__ ) ), array( 'jquery' ) );
|
19 |
-
wp_enqueue_style( 'wp-color-picker' );
|
20 |
-
wp_enqueue_script( 'widget-js', plugins_url( 'assets/js/widget.js', dirname( __FILE__ ) ), array( 'media-upload', 'wp-color-picker' ), '1.0', true );
|
21 |
-
// Add Font Awesome stylesheet
|
22 |
-
wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/assets/css/font-awesome.min.css' );
|
23 |
-
}
|
24 |
-
|
25 |
-
if ( 'nav-menus.php' == $hook ) {
|
26 |
-
wp_enqueue_script( 'shapley-nav-menu-js', plugins_url( 'assets/js/nav-menu.js', dirname( __FILE__ ) ), array( 'nav-menu' ), '1.0', true );
|
27 |
-
}
|
28 |
-
|
29 |
-
}
|
30 |
-
|
31 |
-
function shapely_companion_customizer_live_preview() {
|
32 |
-
wp_enqueue_script( 'shapely-companion-previewer', plugins_url( 'assets/js/previewer.js', dirname( __FILE__ ) ), array( 'jquery', 'customize-preview' ), '', true );
|
33 |
-
}
|
34 |
-
add_action( 'customize_preview_init', 'shapely_companion_customizer_live_preview' );
|
1 |
+
<?php
|
2 |
+
// If this file is called directly, abort.
|
3 |
+
if ( ! defined( 'WPINC' ) ) {
|
4 |
+
die;
|
5 |
+
}
|
6 |
+
add_action( 'admin_enqueue_scripts', 'shapely_companion_admin_scripts' );
|
7 |
+
function shapely_companion_admin_scripts( $hook ) {
|
8 |
+
wp_enqueue_style( 'shapely-companion-admin-css', plugins_url( 'assets/css/admin.css', dirname( __FILE__ ) ) );
|
9 |
+
wp_enqueue_script( 'shapely-companion-admin-js', plugins_url( 'assets/js/admin.js', dirname( __FILE__ ) ), array( 'jquery' ) );
|
10 |
+
wp_localize_script(
|
11 |
+
'shapely-companion-admin-js', 'shapelyCompanion', array(
|
12 |
+
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
13 |
+
'nonce' => wp_create_nonce( "welcome_nonce" ),
|
14 |
+
)
|
15 |
+
);
|
16 |
+
if ( 'widgets.php' == $hook || 'customize.php' == $hook ) {
|
17 |
+
wp_enqueue_media();
|
18 |
+
wp_enqueue_script( 'shapely_cloneya_js', plugins_url( 'assets/js/vendor/jquery-cloneya.min.js', dirname( __FILE__ ) ), array( 'jquery' ) );
|
19 |
+
wp_enqueue_style( 'wp-color-picker' );
|
20 |
+
wp_enqueue_script( 'widget-js', plugins_url( 'assets/js/widget.js', dirname( __FILE__ ) ), array( 'media-upload', 'wp-color-picker' ), '1.0', true );
|
21 |
+
// Add Font Awesome stylesheet
|
22 |
+
wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/assets/css/font-awesome.min.css' );
|
23 |
+
}
|
24 |
+
|
25 |
+
if ( 'nav-menus.php' == $hook ) {
|
26 |
+
wp_enqueue_script( 'shapley-nav-menu-js', plugins_url( 'assets/js/nav-menu.js', dirname( __FILE__ ) ), array( 'nav-menu' ), '1.0', true );
|
27 |
+
}
|
28 |
+
|
29 |
+
}
|
30 |
+
|
31 |
+
function shapely_companion_customizer_live_preview() {
|
32 |
+
wp_enqueue_script( 'shapely-companion-previewer', plugins_url( 'assets/js/previewer.js', dirname( __FILE__ ) ), array( 'jquery', 'customize-preview' ), '', true );
|
33 |
+
}
|
34 |
+
add_action( 'customize_preview_init', 'shapely_companion_customizer_live_preview' );
|
inc/shapely-helper.php
CHANGED
@@ -1,64 +1,64 @@
|
|
1 |
-
<?php
|
2 |
-
// If this file is called directly, abort.
|
3 |
-
if ( ! defined( 'WPINC' ) ) {
|
4 |
-
die;
|
5 |
-
}
|
6 |
-
|
7 |
-
function shapely_allow_skype_protocol( $protocols ) {
|
8 |
-
$protocols[] = 'skype';
|
9 |
-
|
10 |
-
return $protocols;
|
11 |
-
}
|
12 |
-
|
13 |
-
add_filter( 'kses_allowed_protocols', 'shapely_allow_skype_protocol' );
|
14 |
-
|
15 |
-
/* Social Fields in Author Profile */
|
16 |
-
function shapely_author_social_links( $contactmethods ) {
|
17 |
-
// Add Twitter
|
18 |
-
$contactmethods['twitter'] = 'Twitter';
|
19 |
-
//add Facebook
|
20 |
-
$contactmethods['facebook'] = 'Facebook';
|
21 |
-
//add Github
|
22 |
-
$contactmethods['github'] = 'Github';
|
23 |
-
//add Dribble
|
24 |
-
$contactmethods['dribble'] = 'Dribble';
|
25 |
-
//add Vimeo
|
26 |
-
$contactmethods['vimeo'] = 'Vimeo';
|
27 |
-
|
28 |
-
return $contactmethods;
|
29 |
-
}
|
30 |
-
add_filter( 'user_contactmethods', 'shapely_author_social_links', 10, 1 );
|
31 |
-
|
32 |
-
add_action( 'wp_ajax_shapely_get_attachment_image', 'shapely_get_attachment_image' );
|
33 |
-
add_action( 'wp_ajax_nopriv_shapely_get_attachment_image', 'shapely_get_attachment_image' );
|
34 |
-
|
35 |
-
function shapely_get_attachment_image() {
|
36 |
-
$id = isset( $_POST['attachment_id'] ) ? intval( $_POST['attachment_id'] ) : 0;
|
37 |
-
$src = wp_get_attachment_image_src( $id, 'full', false );
|
38 |
-
|
39 |
-
if ( ! empty( $src[0] ) ) {
|
40 |
-
echo esc_url( $src[0] );
|
41 |
-
}
|
42 |
-
|
43 |
-
die();
|
44 |
-
}
|
45 |
-
|
46 |
-
add_action( 'wp_ajax_shapely_get_attachment_media', 'shapely_get_attachment_media' );
|
47 |
-
add_action( 'wp_ajax_nopriv_shapely_get_attachment_media', 'shapely_get_attachment_media' );
|
48 |
-
|
49 |
-
function shapely_get_attachment_media() {
|
50 |
-
$id = isset( $_POST['attachment_id'] ) ? intval( $_POST['attachment_id'] ) : 0;
|
51 |
-
$src = wp_get_attachment_image_src( $id, 'full', false );
|
52 |
-
|
53 |
-
if ( ! empty( $src[0] ) ) {
|
54 |
-
echo esc_url( $src[0] );
|
55 |
-
die();
|
56 |
-
}
|
57 |
-
|
58 |
-
$src = wp_get_attachment_url( $id );
|
59 |
-
if ( ! empty( $src ) ) {
|
60 |
-
echo esc_url( $src );
|
61 |
-
}
|
62 |
-
|
63 |
-
die();
|
64 |
-
}
|
1 |
+
<?php
|
2 |
+
// If this file is called directly, abort.
|
3 |
+
if ( ! defined( 'WPINC' ) ) {
|
4 |
+
die;
|
5 |
+
}
|
6 |
+
|
7 |
+
function shapely_allow_skype_protocol( $protocols ) {
|
8 |
+
$protocols[] = 'skype';
|
9 |
+
|
10 |
+
return $protocols;
|
11 |
+
}
|
12 |
+
|
13 |
+
add_filter( 'kses_allowed_protocols', 'shapely_allow_skype_protocol' );
|
14 |
+
|
15 |
+
/* Social Fields in Author Profile */
|
16 |
+
function shapely_author_social_links( $contactmethods ) {
|
17 |
+
// Add Twitter
|
18 |
+
$contactmethods['twitter'] = 'Twitter';
|
19 |
+
//add Facebook
|
20 |
+
$contactmethods['facebook'] = 'Facebook';
|
21 |
+
//add Github
|
22 |
+
$contactmethods['github'] = 'Github';
|
23 |
+
//add Dribble
|
24 |
+
$contactmethods['dribble'] = 'Dribble';
|
25 |
+
//add Vimeo
|
26 |
+
$contactmethods['vimeo'] = 'Vimeo';
|
27 |
+
|
28 |
+
return $contactmethods;
|
29 |
+
}
|
30 |
+
add_filter( 'user_contactmethods', 'shapely_author_social_links', 10, 1 );
|
31 |
+
|
32 |
+
add_action( 'wp_ajax_shapely_get_attachment_image', 'shapely_get_attachment_image' );
|
33 |
+
add_action( 'wp_ajax_nopriv_shapely_get_attachment_image', 'shapely_get_attachment_image' );
|
34 |
+
|
35 |
+
function shapely_get_attachment_image() {
|
36 |
+
$id = isset( $_POST['attachment_id'] ) ? intval( $_POST['attachment_id'] ) : 0;
|
37 |
+
$src = wp_get_attachment_image_src( $id, 'full', false );
|
38 |
+
|
39 |
+
if ( ! empty( $src[0] ) ) {
|
40 |
+
echo esc_url( $src[0] );
|
41 |
+
}
|
42 |
+
|
43 |
+
die();
|
44 |
+
}
|
45 |
+
|
46 |
+
add_action( 'wp_ajax_shapely_get_attachment_media', 'shapely_get_attachment_media' );
|
47 |
+
add_action( 'wp_ajax_nopriv_shapely_get_attachment_media', 'shapely_get_attachment_media' );
|
48 |
+
|
49 |
+
function shapely_get_attachment_media() {
|
50 |
+
$id = isset( $_POST['attachment_id'] ) ? intval( $_POST['attachment_id'] ) : 0;
|
51 |
+
$src = wp_get_attachment_image_src( $id, 'full', false );
|
52 |
+
|
53 |
+
if ( ! empty( $src[0] ) ) {
|
54 |
+
echo esc_url( $src[0] );
|
55 |
+
die();
|
56 |
+
}
|
57 |
+
|
58 |
+
$src = wp_get_attachment_url( $id );
|
59 |
+
if ( ! empty( $src ) ) {
|
60 |
+
echo esc_url( $src );
|
61 |
+
}
|
62 |
+
|
63 |
+
die();
|
64 |
+
}
|
inc/shapely-metabox.php
CHANGED
@@ -1,84 +1,84 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
/* Fire our meta box setup function on the post editor screen. */
|
6 |
-
add_action( 'load-post.php', 'shapely_companion_post_meta_boxes_setup' );
|
7 |
-
add_action( 'load-post-new.php', 'shapely_companion_post_meta_boxes_setup' );
|
8 |
-
|
9 |
-
/* Meta box setup function. */
|
10 |
-
function shapely_companion_post_meta_boxes_setup() {
|
11 |
-
|
12 |
-
/* Add meta boxes on the 'add_meta_boxes' hook. */
|
13 |
-
add_action( 'add_meta_boxes', 'shapely_companion_add_post_meta_boxes' );
|
14 |
-
|
15 |
-
/* Save post meta on the 'save_post' hook. */
|
16 |
-
add_action( 'save_post', 'shapely_companion_save_post_class_meta', 10, 2 );
|
17 |
-
|
18 |
-
}
|
19 |
-
|
20 |
-
/* Create one or more meta boxes to be displayed on the post editor screen. */
|
21 |
-
function shapely_companion_add_post_meta_boxes() {
|
22 |
-
|
23 |
-
add_meta_box(
|
24 |
-
'shapely-companion-portfolio-link', // Unique ID
|
25 |
-
esc_html__( 'Custom Portfolio Link', 'shapely-companion' ), // Title
|
26 |
-
'shapely_companion_portfolio_link', // Callback function
|
27 |
-
'jetpack-portfolio', // Admin page (or post type)
|
28 |
-
'side', // Context
|
29 |
-
'high' // Priority
|
30 |
-
);
|
31 |
-
}
|
32 |
-
|
33 |
-
/* Display the post meta box. */
|
34 |
-
function shapely_companion_portfolio_link( $post ) {
|
35 |
-
?>
|
36 |
-
|
37 |
-
<?php wp_nonce_field( basename( __FILE__ ), 'shapely_companion_portfolio_link_nonce' ); ?>
|
38 |
-
|
39 |
-
<p>
|
40 |
-
<label for="shapely-companion-portfolio-link"><?php esc_html_e( "Use this if you'd like to link your custom portfolio/project works to external websites. Defaults to dedicated portfolio URL.", 'shapely-companion' ); ?></label>
|
41 |
-
<br />
|
42 |
-
<input class="widefat" type="text" name="shapely-companion-portfolio-link" id="shapely-companion-portfolio-link" value="<?php echo esc_url( get_post_meta( $post->ID, 'shapely_companion_portfolio_link', true ) ); ?>" size="30" />
|
43 |
-
</p>
|
44 |
-
<?php }
|
45 |
-
|
46 |
-
/* Save the meta box's post metadata. */
|
47 |
-
function shapely_companion_save_post_class_meta( $post_id, $post ) {
|
48 |
-
|
49 |
-
/* Verify the nonce before proceeding. */
|
50 |
-
if ( ! isset( $_POST['shapely_companion_portfolio_link_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['shapely_companion_portfolio_link_nonce'] ) ), basename( __FILE__ ) ) ) {
|
51 |
-
return $post_id;
|
52 |
-
}
|
53 |
-
|
54 |
-
/* Get the post type object. */
|
55 |
-
$post_type = get_post_type_object( $post->post_type );
|
56 |
-
|
57 |
-
/* Check if the current user has permission to edit the post. */
|
58 |
-
if ( ! current_user_can( $post_type->cap->edit_post, $post_id ) ) {
|
59 |
-
return $post_id;
|
60 |
-
}
|
61 |
-
|
62 |
-
/* Get the posted data and sanitize it for use as an HTML class. */
|
63 |
-
$new_meta_value = ( isset( $_POST['shapely-companion-portfolio-link'] ) ? sanitize_url( wp_unslash( ( $_POST['shapely-companion-portfolio-link'] ) ) ) : '' );
|
64 |
-
|
65 |
-
/* Get the meta key. */
|
66 |
-
$meta_key = 'shapely_companion_portfolio_link';
|
67 |
-
|
68 |
-
/* Get the meta value of the custom field key. */
|
69 |
-
$meta_value = get_post_meta( $post_id, $meta_key, true );
|
70 |
-
|
71 |
-
/* If a new meta value was added and there was no previous value, add it. */
|
72 |
-
if ( $new_meta_value && '' == $meta_value ) {
|
73 |
-
add_post_meta( $post_id, $meta_key, $new_meta_value, true );
|
74 |
-
} // End if().
|
75 |
-
|
76 |
-
elseif ( $new_meta_value && $new_meta_value != $meta_value ) {
|
77 |
-
update_post_meta( $post_id, $meta_key, $new_meta_value );
|
78 |
-
} /* If there is no new meta value but an old value exists, delete it. */
|
79 |
-
elseif ( '' == $new_meta_value && $meta_value ) {
|
80 |
-
delete_post_meta( $post_id, $meta_key, $meta_value );
|
81 |
-
}
|
82 |
-
}
|
83 |
-
|
84 |
-
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
|
5 |
+
/* Fire our meta box setup function on the post editor screen. */
|
6 |
+
add_action( 'load-post.php', 'shapely_companion_post_meta_boxes_setup' );
|
7 |
+
add_action( 'load-post-new.php', 'shapely_companion_post_meta_boxes_setup' );
|
8 |
+
|
9 |
+
/* Meta box setup function. */
|
10 |
+
function shapely_companion_post_meta_boxes_setup() {
|
11 |
+
|
12 |
+
/* Add meta boxes on the 'add_meta_boxes' hook. */
|
13 |
+
add_action( 'add_meta_boxes', 'shapely_companion_add_post_meta_boxes' );
|
14 |
+
|
15 |
+
/* Save post meta on the 'save_post' hook. */
|
16 |
+
add_action( 'save_post', 'shapely_companion_save_post_class_meta', 10, 2 );
|
17 |
+
|
18 |
+
}
|
19 |
+
|
20 |
+
/* Create one or more meta boxes to be displayed on the post editor screen. */
|
21 |
+
function shapely_companion_add_post_meta_boxes() {
|
22 |
+
|
23 |
+
add_meta_box(
|
24 |
+
'shapely-companion-portfolio-link', // Unique ID
|
25 |
+
esc_html__( 'Custom Portfolio Link', 'shapely-companion' ), // Title
|
26 |
+
'shapely_companion_portfolio_link', // Callback function
|
27 |
+
'jetpack-portfolio', // Admin page (or post type)
|
28 |
+
'side', // Context
|
29 |
+
'high' // Priority
|
30 |
+
);
|
31 |
+
}
|
32 |
+
|
33 |
+
/* Display the post meta box. */
|
34 |
+
function shapely_companion_portfolio_link( $post ) {
|
35 |
+
?>
|
36 |
+
|
37 |
+
<?php wp_nonce_field( basename( __FILE__ ), 'shapely_companion_portfolio_link_nonce' ); ?>
|
38 |
+
|
39 |
+
<p>
|
40 |
+
<label for="shapely-companion-portfolio-link"><?php esc_html_e( "Use this if you'd like to link your custom portfolio/project works to external websites. Defaults to dedicated portfolio URL.", 'shapely-companion' ); ?></label>
|
41 |
+
<br />
|
42 |
+
<input class="widefat" type="text" name="shapely-companion-portfolio-link" id="shapely-companion-portfolio-link" value="<?php echo esc_url( get_post_meta( $post->ID, 'shapely_companion_portfolio_link', true ) ); ?>" size="30" />
|
43 |
+
</p>
|
44 |
+
<?php }
|
45 |
+
|
46 |
+
/* Save the meta box's post metadata. */
|
47 |
+
function shapely_companion_save_post_class_meta( $post_id, $post ) {
|
48 |
+
|
49 |
+
/* Verify the nonce before proceeding. */
|
50 |
+
if ( ! isset( $_POST['shapely_companion_portfolio_link_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['shapely_companion_portfolio_link_nonce'] ) ), basename( __FILE__ ) ) ) {
|
51 |
+
return $post_id;
|
52 |
+
}
|
53 |
+
|
54 |
+
/* Get the post type object. */
|
55 |
+
$post_type = get_post_type_object( $post->post_type );
|
56 |
+
|
57 |
+
/* Check if the current user has permission to edit the post. */
|
58 |
+
if ( ! current_user_can( $post_type->cap->edit_post, $post_id ) ) {
|
59 |
+
return $post_id;
|
60 |
+
}
|
61 |
+
|
62 |
+
/* Get the posted data and sanitize it for use as an HTML class. */
|
63 |
+
$new_meta_value = ( isset( $_POST['shapely-companion-portfolio-link'] ) ? sanitize_url( wp_unslash( ( $_POST['shapely-companion-portfolio-link'] ) ) ) : '' );
|
64 |
+
|
65 |
+
/* Get the meta key. */
|
66 |
+
$meta_key = 'shapely_companion_portfolio_link';
|
67 |
+
|
68 |
+
/* Get the meta value of the custom field key. */
|
69 |
+
$meta_value = get_post_meta( $post_id, $meta_key, true );
|
70 |
+
|
71 |
+
/* If a new meta value was added and there was no previous value, add it. */
|
72 |
+
if ( $new_meta_value && '' == $meta_value ) {
|
73 |
+
add_post_meta( $post_id, $meta_key, $new_meta_value, true );
|
74 |
+
} // End if().
|
75 |
+
|
76 |
+
elseif ( $new_meta_value && $new_meta_value != $meta_value ) {
|
77 |
+
update_post_meta( $post_id, $meta_key, $new_meta_value );
|
78 |
+
} /* If there is no new meta value but an old value exists, delete it. */
|
79 |
+
elseif ( '' == $new_meta_value && $meta_value ) {
|
80 |
+
delete_post_meta( $post_id, $meta_key, $meta_value );
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
?>
|
inc/shapely-navmenu.php
CHANGED
@@ -1,95 +1,95 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Load the Nav Walker Edit
|
5 |
-
*/
|
6 |
-
require_once plugin_dir_path( __FILE__ ) . 'class-shapely-walker-nav-menu-edit.php';
|
7 |
-
add_filter( 'wp_edit_nav_menu_walker', 'shapely_walker_nav_menu_edit', 10 );
|
8 |
-
|
9 |
-
function shapely_walker_nav_menu_edit() {
|
10 |
-
return 'Shapely_Walker_Nav_Menu_Edit';
|
11 |
-
}
|
12 |
-
|
13 |
-
function shapely_nav_menu_setup() {
|
14 |
-
add_meta_box( 'shapely-homepage-sections', __( 'Homepage Sections', 'shapely-companion' ), 'shapely_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
|
15 |
-
}
|
16 |
-
|
17 |
-
add_action( 'admin_head-nav-menus.php', 'shapely_nav_menu_setup' );
|
18 |
-
|
19 |
-
function shapely_nav_menu_item_link_meta_box() {
|
20 |
-
global $_nav_menu_placeholder, $nav_menu_selected_id;
|
21 |
-
$_nav_menu_placeholder = 0 > $_nav_menu_placeholder ? $_nav_menu_placeholder - 1 : -1;
|
22 |
-
$widgets_name = array();
|
23 |
-
?>
|
24 |
-
<div class="customlinkdiv" id="shapelysectionsdiv">
|
25 |
-
<input type="hidden" value="custom" name="menu-item[<?php echo esc_attr( $_nav_menu_placeholder ); ?>][menu-item-type]" />
|
26 |
-
<p id="menu-item-url-wrap" class="wp-clearfix">
|
27 |
-
<label class="howto" for="custom-menu-item-url"><?php esc_html_e( 'Section', 'shapely-companion' ); ?></label>
|
28 |
-
<select id="shapely-section-item-widget" name="menu-item[<?php echo esc_attr( $_nav_menu_placeholder ); ?>][menu-item-url]" type="text" class="code menu-item-textbox">
|
29 |
-
<option value="0"><?php esc_html_e( 'Select a Section', 'shapely-companion' ); ?></option>
|
30 |
-
<?php
|
31 |
-
|
32 |
-
if ( is_active_sidebar( 'sidebar-home' ) ) {
|
33 |
-
$sidebars = wp_get_sidebars_widgets();
|
34 |
-
$widgets = $sidebars['sidebar-home'];
|
35 |
-
foreach ( $widgets as $widget ) {
|
36 |
-
$widget_id = _get_widget_id_base( $widget );
|
37 |
-
if ( ! isset( $widgets_name[ $widget_id ] ) ) {
|
38 |
-
$widgets_args = get_option( 'widget_' . $widget_id );
|
39 |
-
$widgets_name[ $widget_id ] = $widgets_args;
|
40 |
-
}
|
41 |
-
|
42 |
-
// current id
|
43 |
-
$current_id = str_replace( $widget_id . '-', '', $widget );
|
44 |
-
if ( isset( $widgets_name[ $widget_id ][ $current_id ] ) && isset( $widgets_name[ $widget_id ][ $current_id ]['title'] ) && '' != $widgets_name[ $widget_id ][ $current_id ]['title'] ) {
|
45 |
-
$title = $widgets_name[ $widget_id ][ $current_id ]['title'];
|
46 |
-
} else {
|
47 |
-
$title = $widget;
|
48 |
-
}
|
49 |
-
|
50 |
-
echo '<option value="' . esc_attr( $widget ) . '">' . esc_html( $title ) . '</option>';
|
51 |
-
}
|
52 |
-
}
|
53 |
-
|
54 |
-
?>
|
55 |
-
</select>
|
56 |
-
</p>
|
57 |
-
<p id="menu-item-name-wrap" class="wp-clearfix">
|
58 |
-
<label class="howto" for="custom-menu-item-name"><?php esc_html_e( 'URL', 'shapely-companion' ); ?></label>
|
59 |
-
<input id="shapely-section-item-url" name="menu-item[<?php echo esc_attr( $_nav_menu_placeholder ); ?>][menu-item-url]" type="text" class="regular-text menu-item-textbox" />
|
60 |
-
</p>
|
61 |
-
<p id="menu-item-name-wrap" class="wp-clearfix">
|
62 |
-
<label class="howto" for="custom-menu-item-name"><?php esc_html_e( 'Label', 'shapely-companion' ); ?></label>
|
63 |
-
<input id="shapely-section-item-name" name="menu-item[<?php echo esc_attr( $_nav_menu_placeholder ); ?>][menu-item-title]" type="text" class="regular-text menu-item-textbox" />
|
64 |
-
</p>
|
65 |
-
|
66 |
-
<p class="button-controls wp-clearfix">
|
67 |
-
<span class="add-to-menu">
|
68 |
-
<input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button submit-add-to-menu right" value="<?php esc_attr_e( 'Add to Menu', 'shapely-companion' ); ?>" name="add-shapely-section-menu-item" id="submit-shapelysection" />
|
69 |
-
<span class="spinner"></span>
|
70 |
-
</span>
|
71 |
-
</p>
|
72 |
-
|
73 |
-
</div><!-- /.customlinkdiv -->
|
74 |
-
<?php
|
75 |
-
}
|
76 |
-
|
77 |
-
add_action( 'wp_update_nav_menu_item', 'shapely_update_menu_item', 10, 3 );
|
78 |
-
|
79 |
-
function shapely_update_menu_item( $menu_id, $menu_item_db_id, $args ) {
|
80 |
-
|
81 |
-
if ( isset( $_POST['menu-item'] ) && count( $_POST['menu-item'] ) == 1 ) {
|
82 |
-
if ( isset( $_POST['menu-item']['-1'] ) ) {
|
83 |
-
$menu_item = array_map( 'sanitize_text_field', wp_unslash( $_POST['menu-item']['-1'] ) );
|
84 |
-
|
85 |
-
if ( isset( $menu_item['menu-item-extra'] ) && 'shapely-section' == $menu_item['menu-item-extra'] ) {
|
86 |
-
update_post_meta( $menu_item_db_id, '_menu_item_extra', 'shapely-section' );
|
87 |
-
}
|
88 |
-
|
89 |
-
if ( isset( $menu_item['menu-item-widget'] ) ) {
|
90 |
-
update_post_meta( $menu_item_db_id, '_menu_item_widget', $menu_item['menu-item-widget'] );
|
91 |
-
}
|
92 |
-
}
|
93 |
-
}
|
94 |
-
|
95 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Load the Nav Walker Edit
|
5 |
+
*/
|
6 |
+
require_once plugin_dir_path( __FILE__ ) . 'class-shapely-walker-nav-menu-edit.php';
|
7 |
+
add_filter( 'wp_edit_nav_menu_walker', 'shapely_walker_nav_menu_edit', 10 );
|
8 |
+
|
9 |
+
function shapely_walker_nav_menu_edit() {
|
10 |
+
return 'Shapely_Walker_Nav_Menu_Edit';
|
11 |
+
}
|
12 |
+
|
13 |
+
function shapely_nav_menu_setup() {
|
14 |
+
add_meta_box( 'shapely-homepage-sections', __( 'Homepage Sections', 'shapely-companion' ), 'shapely_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
|
15 |
+
}
|
16 |
+
|
17 |
+
add_action( 'admin_head-nav-menus.php', 'shapely_nav_menu_setup' );
|
18 |
+
|
19 |
+
function shapely_nav_menu_item_link_meta_box() {
|
20 |
+
global $_nav_menu_placeholder, $nav_menu_selected_id;
|
21 |
+
$_nav_menu_placeholder = 0 > $_nav_menu_placeholder ? $_nav_menu_placeholder - 1 : -1;
|
22 |
+
$widgets_name = array();
|
23 |
+
?>
|
24 |
+
<div class="customlinkdiv" id="shapelysectionsdiv">
|
25 |
+
<input type="hidden" value="custom" name="menu-item[<?php echo esc_attr( $_nav_menu_placeholder ); ?>][menu-item-type]" />
|
26 |
+
<p id="menu-item-url-wrap" class="wp-clearfix">
|
27 |
+
<label class="howto" for="custom-menu-item-url"><?php esc_html_e( 'Section', 'shapely-companion' ); ?></label>
|
28 |
+
<select id="shapely-section-item-widget" name="menu-item[<?php echo esc_attr( $_nav_menu_placeholder ); ?>][menu-item-url]" type="text" class="code menu-item-textbox">
|
29 |
+
<option value="0"><?php esc_html_e( 'Select a Section', 'shapely-companion' ); ?></option>
|
30 |
+
<?php
|
31 |
+
|
32 |
+
if ( is_active_sidebar( 'sidebar-home' ) ) {
|
33 |
+
$sidebars = wp_get_sidebars_widgets();
|
34 |
+
$widgets = $sidebars['sidebar-home'];
|
35 |
+
foreach ( $widgets as $widget ) {
|
36 |
+
$widget_id = _get_widget_id_base( $widget );
|
37 |
+
if ( ! isset( $widgets_name[ $widget_id ] ) ) {
|
38 |
+
$widgets_args = get_option( 'widget_' . $widget_id );
|
39 |
+
$widgets_name[ $widget_id ] = $widgets_args;
|
40 |
+
}
|
41 |
+
|
42 |
+
// current id
|
43 |
+
$current_id = str_replace( $widget_id . '-', '', $widget );
|
44 |
+
if ( isset( $widgets_name[ $widget_id ][ $current_id ] ) && isset( $widgets_name[ $widget_id ][ $current_id ]['title'] ) && '' != $widgets_name[ $widget_id ][ $current_id ]['title'] ) {
|
45 |
+
$title = $widgets_name[ $widget_id ][ $current_id ]['title'];
|
46 |
+
} else {
|
47 |
+
$title = $widget;
|
48 |
+
}
|
49 |
+
|
50 |
+
echo '<option value="' . esc_attr( $widget ) . '">' . esc_html( $title ) . '</option>';
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
?>
|
55 |
+
</select>
|
56 |
+
</p>
|
57 |
+
<p id="menu-item-name-wrap" class="wp-clearfix">
|
58 |
+
<label class="howto" for="custom-menu-item-name"><?php esc_html_e( 'URL', 'shapely-companion' ); ?></label>
|
59 |
+
<input id="shapely-section-item-url" name="menu-item[<?php echo esc_attr( $_nav_menu_placeholder ); ?>][menu-item-url]" type="text" class="regular-text menu-item-textbox" />
|
60 |
+
</p>
|
61 |
+
<p id="menu-item-name-wrap" class="wp-clearfix">
|
62 |
+
<label class="howto" for="custom-menu-item-name"><?php esc_html_e( 'Label', 'shapely-companion' ); ?></label>
|
63 |
+
<input id="shapely-section-item-name" name="menu-item[<?php echo esc_attr( $_nav_menu_placeholder ); ?>][menu-item-title]" type="text" class="regular-text menu-item-textbox" />
|
64 |
+
</p>
|
65 |
+
|
66 |
+
<p class="button-controls wp-clearfix">
|
67 |
+
<span class="add-to-menu">
|
68 |
+
<input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button submit-add-to-menu right" value="<?php esc_attr_e( 'Add to Menu', 'shapely-companion' ); ?>" name="add-shapely-section-menu-item" id="submit-shapelysection" />
|
69 |
+
<span class="spinner"></span>
|
70 |
+
</span>
|
71 |
+
</p>
|
72 |
+
|
73 |
+
</div><!-- /.customlinkdiv -->
|
74 |
+
<?php
|
75 |
+
}
|
76 |
+
|
77 |
+
add_action( 'wp_update_nav_menu_item', 'shapely_update_menu_item', 10, 3 );
|
78 |
+
|
79 |
+
function shapely_update_menu_item( $menu_id, $menu_item_db_id, $args ) {
|
80 |
+
|
81 |
+
if ( isset( $_POST['menu-item'] ) && count( $_POST['menu-item'] ) == 1 ) {
|
82 |
+
if ( isset( $_POST['menu-item']['-1'] ) ) {
|
83 |
+
$menu_item = array_map( 'sanitize_text_field', wp_unslash( $_POST['menu-item']['-1'] ) );
|
84 |
+
|
85 |
+
if ( isset( $menu_item['menu-item-extra'] ) && 'shapely-section' == $menu_item['menu-item-extra'] ) {
|
86 |
+
update_post_meta( $menu_item_db_id, '_menu_item_extra', 'shapely-section' );
|
87 |
+
}
|
88 |
+
|
89 |
+
if ( isset( $menu_item['menu-item-widget'] ) ) {
|
90 |
+
update_post_meta( $menu_item_db_id, '_menu_item_widget', $menu_item['menu-item-widget'] );
|
91 |
+
}
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
}
|
inc/shapely-widgets.php
CHANGED
@@ -1,53 +1,53 @@
|
|
1 |
-
<?php
|
2 |
-
// If this file is called directly, abort.
|
3 |
-
if ( ! defined( 'WPINC' ) ) {
|
4 |
-
die;
|
5 |
-
}
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Widgets
|
9 |
-
*/
|
10 |
-
add_action( 'widgets_init', 'shapely_companion_widgets_init' );
|
11 |
-
function shapely_companion_widgets_init() {
|
12 |
-
|
13 |
-
$widgets = array(
|
14 |
-
'categories',
|
15 |
-
'home-call-for-action',
|
16 |
-
'home-clients',
|
17 |
-
'home-features',
|
18 |
-
'home-parallax',
|
19 |
-
'home-contact',
|
20 |
-
'home-portfolio',
|
21 |
-
'home-testimonials',
|
22 |
-
'recent-posts',
|
23 |
-
'social',
|
24 |
-
'video',
|
25 |
-
'page-content',
|
26 |
-
'page-title',
|
27 |
-
);
|
28 |
-
|
29 |
-
foreach ( $widgets as $widget ) {
|
30 |
-
require_once plugin_dir_path( __FILE__ ) . '/widgets/class-shapely-' . $widget . '.php';
|
31 |
-
}
|
32 |
-
|
33 |
-
register_widget( 'Shapely_Recent_Posts' );
|
34 |
-
register_widget( 'Shapely_Categories' );
|
35 |
-
register_widget( 'Shapely_Home_Parallax' );
|
36 |
-
register_widget( 'Shapely_Home_Features' );
|
37 |
-
register_widget( 'Shapely_Home_Call_For_Action' );
|
38 |
-
register_widget( 'Shapely_Home_Clients' );
|
39 |
-
register_widget( 'Shapely_Video' );
|
40 |
-
register_widget( 'Shapely_Home_Contact' );
|
41 |
-
register_widget( 'Shapely_Social' );
|
42 |
-
register_widget( 'Shapely_Page_Title' );
|
43 |
-
register_widget( 'Shapely_Page_Content' );
|
44 |
-
|
45 |
-
if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'custom-content-types' ) ) {
|
46 |
-
if ( get_option( 'jetpack_portfolio' ) ) {
|
47 |
-
register_widget( 'Shapely_Home_Portfolio' );
|
48 |
-
}
|
49 |
-
if ( get_option( 'jetpack_testimonial' ) ) {
|
50 |
-
register_widget( 'Shapely_Home_Testimonials' );
|
51 |
-
}
|
52 |
-
}
|
53 |
-
}
|
1 |
+
<?php
|
2 |
+
// If this file is called directly, abort.
|
3 |
+
if ( ! defined( 'WPINC' ) ) {
|
4 |
+
die;
|
5 |
+
}
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Widgets
|
9 |
+
*/
|
10 |
+
add_action( 'widgets_init', 'shapely_companion_widgets_init' );
|
11 |
+
function shapely_companion_widgets_init() {
|
12 |
+
|
13 |
+
$widgets = array(
|
14 |
+
'categories',
|
15 |
+
'home-call-for-action',
|
16 |
+
'home-clients',
|
17 |
+
'home-features',
|
18 |
+
'home-parallax',
|
19 |
+
'home-contact',
|
20 |
+
'home-portfolio',
|
21 |
+
'home-testimonials',
|
22 |
+
'recent-posts',
|
23 |
+
'social',
|
24 |
+
'video',
|
25 |
+
'page-content',
|
26 |
+
'page-title',
|
27 |
+
);
|
28 |
+
|
29 |
+
foreach ( $widgets as $widget ) {
|
30 |
+
require_once plugin_dir_path( __FILE__ ) . '/widgets/class-shapely-' . $widget . '.php';
|
31 |
+
}
|
32 |
+
|
33 |
+
register_widget( 'Shapely_Recent_Posts' );
|
34 |
+
register_widget( 'Shapely_Categories' );
|
35 |
+
register_widget( 'Shapely_Home_Parallax' );
|
36 |
+
register_widget( 'Shapely_Home_Features' );
|
37 |
+
register_widget( 'Shapely_Home_Call_For_Action' );
|
38 |
+
register_widget( 'Shapely_Home_Clients' );
|
39 |
+
register_widget( 'Shapely_Video' );
|
40 |
+
register_widget( 'Shapely_Home_Contact' );
|
41 |
+
register_widget( 'Shapely_Social' );
|
42 |
+
register_widget( 'Shapely_Page_Title' );
|
43 |
+
register_widget( 'Shapely_Page_Content' );
|
44 |
+
|
45 |
+
if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'custom-content-types' ) ) {
|
46 |
+
if ( get_option( 'jetpack_portfolio' ) ) {
|
47 |
+
register_widget( 'Shapely_Home_Portfolio' );
|
48 |
+
}
|
49 |
+
if ( get_option( 'jetpack_testimonial' ) ) {
|
50 |
+
register_widget( 'Shapely_Home_Testimonials' );
|
51 |
+
}
|
52 |
+
}
|
53 |
+
}
|
inc/views/shapely-demo-content.php
CHANGED
@@ -1,33 +1,33 @@
|
|
1 |
-
<?php
|
2 |
-
// If this file is called directly, abort.
|
3 |
-
if ( ! defined( 'WPINC' ) ) {
|
4 |
-
die;
|
5 |
-
}
|
6 |
-
?>
|
7 |
-
<div id="demo_content">
|
8 |
-
|
9 |
-
<?php if ( ! Shapely_Notify_System::shapely_has_plugin( 'shapely-companion' ) || ! Shapely_Notify_System::shapely_has_plugin( 'jetpack' ) || ! Shapely_Notify_System::shapely_has_plugin( 'kali-forms' ) ) : ?>
|
10 |
-
<div>
|
11 |
-
<p><?php esc_html_e( 'In order to import the demo content you need to complete all the recommended actions from above.', 'shapely-companion' ); ?></p>
|
12 |
-
</div>
|
13 |
-
<?php else : ?>
|
14 |
-
<div class="import-full-content">
|
15 |
-
<p>
|
16 |
-
<a href="#" class="button button-primary"
|
17 |
-
data-action="import-all"><?php esc_html_e( 'I want my site to look like your demo', 'shapely-companion' ); ?></a>
|
18 |
-
<span class="spinner"></span>
|
19 |
-
</p>
|
20 |
-
<div class="updated-message"><p><?php esc_html_e( 'Content Imported', 'shapely-companion' ); ?></p></div>
|
21 |
-
</div>
|
22 |
-
<div>
|
23 |
-
<p><?php esc_html_e( 'I want only to import demo widgets', 'shapely-companion' ); ?></p>
|
24 |
-
<p>
|
25 |
-
<a href="#" class="button button-secondary"
|
26 |
-
data-action="import-widgets"><?php esc_html_e( 'Import Widgets', 'shapely-companion' ); ?></a>
|
27 |
-
<span class="spinner"></span>
|
28 |
-
</p>
|
29 |
-
<div class="updated-message"><p><?php esc_html_e( 'Content Imported', 'shapely-companion' ); ?></p></div>
|
30 |
-
</div>
|
31 |
-
<?php endif ?>
|
32 |
-
|
33 |
-
</div>
|
1 |
+
<?php
|
2 |
+
// If this file is called directly, abort.
|
3 |
+
if ( ! defined( 'WPINC' ) ) {
|
4 |
+
die;
|
5 |
+
}
|
6 |
+
?>
|
7 |
+
<div id="demo_content">
|
8 |
+
|
9 |
+
<?php if ( ! Shapely_Notify_System::shapely_has_plugin( 'shapely-companion' ) || ! Shapely_Notify_System::shapely_has_plugin( 'jetpack' ) || ! Shapely_Notify_System::shapely_has_plugin( 'kali-forms' ) ) : ?>
|
10 |
+
<div>
|
11 |
+
<p><?php esc_html_e( 'In order to import the demo content you need to complete all the recommended actions from above.', 'shapely-companion' ); ?></p>
|
12 |
+
</div>
|
13 |
+
<?php else : ?>
|
14 |
+
<div class="import-full-content">
|
15 |
+
<p>
|
16 |
+
<a href="#" class="button button-primary"
|
17 |
+
data-action="import-all"><?php esc_html_e( 'I want my site to look like your demo', 'shapely-companion' ); ?></a>
|
18 |
+
<span class="spinner"></span>
|
19 |
+
</p>
|
20 |
+
<div class="updated-message"><p><?php esc_html_e( 'Content Imported', 'shapely-companion' ); ?></p></div>
|
21 |
+
</div>
|
22 |
+
<div>
|
23 |
+
<p><?php esc_html_e( 'I want only to import demo widgets', 'shapely-companion' ); ?></p>
|
24 |
+
<p>
|
25 |
+
<a href="#" class="button button-secondary"
|
26 |
+
data-action="import-widgets"><?php esc_html_e( 'Import Widgets', 'shapely-companion' ); ?></a>
|
27 |
+
<span class="spinner"></span>
|
28 |
+
</p>
|
29 |
+
<div class="updated-message"><p><?php esc_html_e( 'Content Imported', 'shapely-companion' ); ?></p></div>
|
30 |
+
</div>
|
31 |
+
<?php endif ?>
|
32 |
+
|
33 |
+
</div>
|
inc/widgets/class-shapely-categories.php
CHANGED
@@ -1,148 +1,148 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* [Shapely] Categories Widget
|
5 |
-
* shapely Theme
|
6 |
-
*/
|
7 |
-
class Shapely_Categories extends WP_Widget {
|
8 |
-
|
9 |
-
|
10 |
-
private $defaults = array();
|
11 |
-
|
12 |
-
function __construct() {
|
13 |
-
add_action( 'admin_init', array( $this, 'enqueue' ) );
|
14 |
-
add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue' ) );
|
15 |
-
add_action( 'customize_preview_init', array( $this, 'enqueue' ) );
|
16 |
-
|
17 |
-
$widget_ops = array(
|
18 |
-
'classname' => 'shapely-cats',
|
19 |
-
'description' => esc_html__( 'Shapely Categories', 'shapely-companion' ),
|
20 |
-
'customize_selective_refresh' => true,
|
21 |
-
);
|
22 |
-
parent::__construct( 'shapely-cats', esc_html__( '[Shapely] Categories', 'shapely-companion' ), $widget_ops );
|
23 |
-
|
24 |
-
$this->defaults = array(
|
25 |
-
'title' => esc_html__( 'Categories', 'shapely-companion' ),
|
26 |
-
'enable_count' => '',
|
27 |
-
'limit' => 4,
|
28 |
-
);
|
29 |
-
}
|
30 |
-
|
31 |
-
public function enqueue() {
|
32 |
-
if ( is_admin() && ! is_customize_preview() ) {
|
33 |
-
wp_enqueue_style( 'epsilon-styles', get_template_directory_uri() . '/inc/libraries/epsilon-framework/assets/css/style.css' );
|
34 |
-
}
|
35 |
-
}
|
36 |
-
|
37 |
-
/**
|
38 |
-
* @param array $args
|
39 |
-
* @param array $instance
|
40 |
-
*/
|
41 |
-
function widget( $args, $instance ) {
|
42 |
-
|
43 |
-
$instance = wp_parse_args( $instance, $this->defaults );
|
44 |
-
|
45 |
-
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
46 |
-
echo $args['before_title']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
47 |
-
echo esc_html( $instance['title'] );
|
48 |
-
echo $args['after_title']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Widget Content
|
52 |
-
*/
|
53 |
-
?>
|
54 |
-
<div class="cats-widget nolist">
|
55 |
-
|
56 |
-
<ul class="category-list">
|
57 |
-
<?php
|
58 |
-
|
59 |
-
$categories_args = array(
|
60 |
-
'echo' => 0,
|
61 |
-
'show_count' => (int) $instance['limit'],
|
62 |
-
'title_li' => '',
|
63 |
-
'depth' => 1,
|
64 |
-
'orderby' => 'count',
|
65 |
-
'order' => 'DESC',
|
66 |
-
'number' => $instance['limit'],
|
67 |
-
);
|
68 |
-
|
69 |
-
$variable = wp_list_categories( $categories_args );
|
70 |
-
|
71 |
-
if ( 'on' == $instance['enable_count'] ) {
|
72 |
-
$variable = str_replace( '(', '<span>', $variable );
|
73 |
-
$variable = str_replace( ')', '</span>', $variable );
|
74 |
-
} else {
|
75 |
-
$pattern = '/\([0-9]+\)/';
|
76 |
-
$variable = preg_replace( $pattern, '', $variable );
|
77 |
-
}
|
78 |
-
|
79 |
-
echo wp_kses_post( $variable );
|
80 |
-
?>
|
81 |
-
</ul>
|
82 |
-
|
83 |
-
</div><!-- end widget content -->
|
84 |
-
|
85 |
-
<?php
|
86 |
-
|
87 |
-
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
88 |
-
}
|
89 |
-
|
90 |
-
|
91 |
-
/**
|
92 |
-
* @param array $instance
|
93 |
-
*
|
94 |
-
* @return string|void
|
95 |
-
*/
|
96 |
-
function form( $instance ) {
|
97 |
-
|
98 |
-
$instance = wp_parse_args( $instance, $this->defaults );
|
99 |
-
|
100 |
-
?>
|
101 |
-
|
102 |
-
<p>
|
103 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
|
104 |
-
<?php echo esc_html__( 'Title ', 'shapely-companion' ); ?>
|
105 |
-
</label>
|
106 |
-
<input type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" class="widefat"/>
|
107 |
-
</p>
|
108 |
-
|
109 |
-
<p>
|
110 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>">
|
111 |
-
<?php echo esc_html__( 'Limit Categories ', 'shapely-companion' ); ?>
|
112 |
-
</label>
|
113 |
-
<input type="text" value="<?php echo esc_attr( $instance['limit'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" class="widefat"/>
|
114 |
-
</p>
|
115 |
-
|
116 |
-
<div class="checkbox_switch wp-clearfix">
|
117 |
-
<span class="customize-control-title onoffswitch_label">
|
118 |
-
<?php esc_html_e( 'Enable Posts Count', 'shapely-companion' ); ?>
|
119 |
-
</span>
|
120 |
-
<div class="onoffswitch">
|
121 |
-
<input type="checkbox" id="<?php echo esc_attr( $this->get_field_name( 'enable_count' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'enable_count' ) ); ?>" class="onoffswitch-checkbox" value="on"
|
122 |
-
<?php checked( $instance['enable_count'], 'on' ); ?>>
|
123 |
-
<label class="onoffswitch-label" for="<?php echo esc_attr( $this->get_field_name( 'enable_count' ) ); ?>"></label>
|
124 |
-
</div>
|
125 |
-
</div>
|
126 |
-
|
127 |
-
<?php
|
128 |
-
}
|
129 |
-
|
130 |
-
/**
|
131 |
-
* Sanitize widget form values as they are saved.
|
132 |
-
*
|
133 |
-
* @see WP_Widget::update()
|
134 |
-
*
|
135 |
-
* @param array $new_instance Values just sent to be saved.
|
136 |
-
* @param array $old_instance Previously saved values from database.
|
137 |
-
*
|
138 |
-
* @return array Updated safe values to be saved.
|
139 |
-
*/
|
140 |
-
public function update( $new_instance, $old_instance ) {
|
141 |
-
$instance = array();
|
142 |
-
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? esc_html( $new_instance['title'] ) : '';
|
143 |
-
$instance['limit'] = ( ! empty( $new_instance['limit'] ) ) ? absint( $new_instance['limit'] ) : '';
|
144 |
-
$instance['enable_count'] = ( ! empty( $new_instance['enable_count'] ) ) ? esc_html( $new_instance['enable_count'] ) : '';
|
145 |
-
|
146 |
-
return $instance;
|
147 |
-
}
|
148 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* [Shapely] Categories Widget
|
5 |
+
* shapely Theme
|
6 |
+
*/
|
7 |
+
class Shapely_Categories extends WP_Widget {
|
8 |
+
|
9 |
+
|
10 |
+
private $defaults = array();
|
11 |
+
|
12 |
+
function __construct() {
|
13 |
+
add_action( 'admin_init', array( $this, 'enqueue' ) );
|
14 |
+
add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue' ) );
|
15 |
+
add_action( 'customize_preview_init', array( $this, 'enqueue' ) );
|
16 |
+
|
17 |
+
$widget_ops = array(
|
18 |
+
'classname' => 'shapely-cats',
|
19 |
+
'description' => esc_html__( 'Shapely Categories', 'shapely-companion' ),
|
20 |
+
'customize_selective_refresh' => true,
|
21 |
+
);
|
22 |
+
parent::__construct( 'shapely-cats', esc_html__( '[Shapely] Categories', 'shapely-companion' ), $widget_ops );
|
23 |
+
|
24 |
+
$this->defaults = array(
|
25 |
+
'title' => esc_html__( 'Categories', 'shapely-companion' ),
|
26 |
+
'enable_count' => '',
|
27 |
+
'limit' => 4,
|
28 |
+
);
|
29 |
+
}
|
30 |
+
|
31 |
+
public function enqueue() {
|
32 |
+
if ( is_admin() && ! is_customize_preview() ) {
|
33 |
+
wp_enqueue_style( 'epsilon-styles', get_template_directory_uri() . '/inc/libraries/epsilon-framework/assets/css/style.css' );
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @param array $args
|
39 |
+
* @param array $instance
|
40 |
+
*/
|
41 |
+
function widget( $args, $instance ) {
|
42 |
+
|
43 |
+
$instance = wp_parse_args( $instance, $this->defaults );
|
44 |
+
|
45 |
+
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
46 |
+
echo $args['before_title']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
47 |
+
echo esc_html( $instance['title'] );
|
48 |
+
echo $args['after_title']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Widget Content
|
52 |
+
*/
|
53 |
+
?>
|
54 |
+
<div class="cats-widget nolist">
|
55 |
+
|
56 |
+
<ul class="category-list">
|
57 |
+
<?php
|
58 |
+
|
59 |
+
$categories_args = array(
|
60 |
+
'echo' => 0,
|
61 |
+
'show_count' => (int) $instance['limit'],
|
62 |
+
'title_li' => '',
|
63 |
+
'depth' => 1,
|
64 |
+
'orderby' => 'count',
|
65 |
+
'order' => 'DESC',
|
66 |
+
'number' => $instance['limit'],
|
67 |
+
);
|
68 |
+
|
69 |
+
$variable = wp_list_categories( $categories_args );
|
70 |
+
|
71 |
+
if ( 'on' == $instance['enable_count'] ) {
|
72 |
+
$variable = str_replace( '(', '<span>', $variable );
|
73 |
+
$variable = str_replace( ')', '</span>', $variable );
|
74 |
+
} else {
|
75 |
+
$pattern = '/\([0-9]+\)/';
|
76 |
+
$variable = preg_replace( $pattern, '', $variable );
|
77 |
+
}
|
78 |
+
|
79 |
+
echo wp_kses_post( $variable );
|
80 |
+
?>
|
81 |
+
</ul>
|
82 |
+
|
83 |
+
</div><!-- end widget content -->
|
84 |
+
|
85 |
+
<?php
|
86 |
+
|
87 |
+
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
88 |
+
}
|
89 |
+
|
90 |
+
|
91 |
+
/**
|
92 |
+
* @param array $instance
|
93 |
+
*
|
94 |
+
* @return string|void
|
95 |
+
*/
|
96 |
+
function form( $instance ) {
|
97 |
+
|
98 |
+
$instance = wp_parse_args( $instance, $this->defaults );
|
99 |
+
|
100 |
+
?>
|
101 |
+
|
102 |
+
<p>
|
103 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
|
104 |
+
<?php echo esc_html__( 'Title ', 'shapely-companion' ); ?>
|
105 |
+
</label>
|
106 |
+
<input type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" class="widefat"/>
|
107 |
+
</p>
|
108 |
+
|
109 |
+
<p>
|
110 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>">
|
111 |
+
<?php echo esc_html__( 'Limit Categories ', 'shapely-companion' ); ?>
|
112 |
+
</label>
|
113 |
+
<input type="text" value="<?php echo esc_attr( $instance['limit'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" class="widefat"/>
|
114 |
+
</p>
|
115 |
+
|
116 |
+
<div class="checkbox_switch wp-clearfix">
|
117 |
+
<span class="customize-control-title onoffswitch_label">
|
118 |
+
<?php esc_html_e( 'Enable Posts Count', 'shapely-companion' ); ?>
|
119 |
+
</span>
|
120 |
+
<div class="onoffswitch">
|
121 |
+
<input type="checkbox" id="<?php echo esc_attr( $this->get_field_name( 'enable_count' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'enable_count' ) ); ?>" class="onoffswitch-checkbox" value="on"
|
122 |
+
<?php checked( $instance['enable_count'], 'on' ); ?>>
|
123 |
+
<label class="onoffswitch-label" for="<?php echo esc_attr( $this->get_field_name( 'enable_count' ) ); ?>"></label>
|
124 |
+
</div>
|
125 |
+
</div>
|
126 |
+
|
127 |
+
<?php
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Sanitize widget form values as they are saved.
|
132 |
+
*
|
133 |
+
* @see WP_Widget::update()
|
134 |
+
*
|
135 |
+
* @param array $new_instance Values just sent to be saved.
|
136 |
+
* @param array $old_instance Previously saved values from database.
|
137 |
+
*
|
138 |
+
* @return array Updated safe values to be saved.
|
139 |
+
*/
|
140 |
+
public function update( $new_instance, $old_instance ) {
|
141 |
+
$instance = array();
|
142 |
+
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? esc_html( $new_instance['title'] ) : '';
|
143 |
+
$instance['limit'] = ( ! empty( $new_instance['limit'] ) ) ? absint( $new_instance['limit'] ) : '';
|
144 |
+
$instance['enable_count'] = ( ! empty( $new_instance['enable_count'] ) ) ? esc_html( $new_instance['enable_count'] ) : '';
|
145 |
+
|
146 |
+
return $instance;
|
147 |
+
}
|
148 |
+
}
|
inc/widgets/class-shapely-home-call-for-action.php
CHANGED
@@ -1,122 +1,122 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Homepage Call for Action section Widget
|
5 |
-
* Shapely Theme
|
6 |
-
*/
|
7 |
-
class Shapely_Home_Call_For_Action extends WP_Widget {
|
8 |
-
|
9 |
-
private $defaults = array();
|
10 |
-
|
11 |
-
function __construct() {
|
12 |
-
|
13 |
-
$widget_ops = array(
|
14 |
-
'classname' => 'shapely_home_CFA',
|
15 |
-
'description' => esc_html__( '[Shapely] Call for Action Section', 'shapely-companion' ),
|
16 |
-
'customize_selective_refresh' => true,
|
17 |
-
);
|
18 |
-
parent::__construct( 'shapely_home_CFA', esc_html__( '[Shapely] Call for Action Section For FrontPage', 'shapely-companion' ), $widget_ops );
|
19 |
-
|
20 |
-
$this->defaults = array(
|
21 |
-
'title' => '',
|
22 |
-
'button' => '',
|
23 |
-
'button_link' => '',
|
24 |
-
);
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
* @param array $args
|
29 |
-
* @param array $instance
|
30 |
-
*/
|
31 |
-
function widget( $args, $instance ) {
|
32 |
-
|
33 |
-
$instance = wp_parse_args( $instance, $this->defaults );
|
34 |
-
|
35 |
-
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Widget Content
|
39 |
-
*/
|
40 |
-
?>
|
41 |
-
<?php if ( '' != $instance['title'] ) : ?>
|
42 |
-
<section class="cfa-section bg-secondary">
|
43 |
-
<div class="container">
|
44 |
-
<div class="row">
|
45 |
-
<div class="col-sm-12 text-center p0">
|
46 |
-
<div class="overflow-hidden">
|
47 |
-
<div class="col-sm-9">
|
48 |
-
<h3 class="cfa-text"><?php echo wp_kses_post( $instance['title'] ); ?></h3>
|
49 |
-
</div>
|
50 |
-
<div class="col-sm-3">
|
51 |
-
<a href="<?php echo esc_url_raw( $instance['button_link'] ); ?>" class="mb0 btn btn-lg btn-filled cfa-button"><?php echo esc_html( $instance['button'] ); ?></a>
|
52 |
-
</div>
|
53 |
-
</div>
|
54 |
-
</div>
|
55 |
-
</div>
|
56 |
-
<!--end of row-->
|
57 |
-
</div>
|
58 |
-
<!--end of container-->
|
59 |
-
</section>
|
60 |
-
<?php
|
61 |
-
endif;
|
62 |
-
|
63 |
-
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
64 |
-
}
|
65 |
-
|
66 |
-
|
67 |
-
/**
|
68 |
-
* @param array $instance
|
69 |
-
*
|
70 |
-
* @return string|void
|
71 |
-
*/
|
72 |
-
function form( $instance ) {
|
73 |
-
$instance = wp_parse_args( $instance, $this->defaults );
|
74 |
-
?>
|
75 |
-
|
76 |
-
<p class="shapely-editor-container">
|
77 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
|
78 |
-
<?php echo esc_html__( 'Callout Text ', 'shapely-companion' ); ?>
|
79 |
-
</label>
|
80 |
-
<textarea
|
81 |
-
name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
|
82 |
-
id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
|
83 |
-
class="widefat">
|
84 |
-
<?php echo wp_kses_post( nl2br( $instance['title'] ) ); ?>
|
85 |
-
</textarea>
|
86 |
-
</p>
|
87 |
-
|
88 |
-
<p>
|
89 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'button' ) ); ?>">
|
90 |
-
<?php echo esc_html__( 'Button Text ', 'shapely-companion' ); ?>
|
91 |
-
</label>
|
92 |
-
<input type="text" value="<?php echo esc_attr( $instance['button'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'button' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'button' ) ); ?>" class="widefat" />
|
93 |
-
</p>
|
94 |
-
|
95 |
-
<p>
|
96 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'button_link' ) ); ?>">
|
97 |
-
<?php echo esc_html__( 'Button Link ', 'shapely-companion' ); ?>
|
98 |
-
</label>
|
99 |
-
<input type="text" value="<?php echo esc_url( $instance['button_link'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'button_link' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'button_link' ) ); ?>" class="widefat" />
|
100 |
-
</p>
|
101 |
-
<?php
|
102 |
-
}
|
103 |
-
|
104 |
-
/**
|
105 |
-
* Sanitize widget form values as they are saved.
|
106 |
-
*
|
107 |
-
* @see WP_Widget::update()
|
108 |
-
*
|
109 |
-
* @param array $new_instance Values just sent to be saved.
|
110 |
-
* @param array $old_instance Previously saved values from database.
|
111 |
-
*
|
112 |
-
* @return array Updated safe values to be saved.
|
113 |
-
*/
|
114 |
-
public function update( $new_instance, $old_instance ) {
|
115 |
-
$instance = array();
|
116 |
-
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? wp_kses_post( $new_instance['title'] ) : '';
|
117 |
-
$instance['button'] = ( ! empty( $new_instance['button'] ) ) ? esc_html( $new_instance['button'] ) : '';
|
118 |
-
$instance['button_link'] = ( ! empty( $new_instance['button_link'] ) ) ? esc_url_raw( $new_instance['button_link'] ) : '';
|
119 |
-
|
120 |
-
return $instance;
|
121 |
-
}
|
122 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Homepage Call for Action section Widget
|
5 |
+
* Shapely Theme
|
6 |
+
*/
|
7 |
+
class Shapely_Home_Call_For_Action extends WP_Widget {
|
8 |
+
|
9 |
+
private $defaults = array();
|
10 |
+
|
11 |
+
function __construct() {
|
12 |
+
|
13 |
+
$widget_ops = array(
|
14 |
+
'classname' => 'shapely_home_CFA',
|
15 |
+
'description' => esc_html__( '[Shapely] Call for Action Section', 'shapely-companion' ),
|
16 |
+
'customize_selective_refresh' => true,
|
17 |
+
);
|
18 |
+
parent::__construct( 'shapely_home_CFA', esc_html__( '[Shapely] Call for Action Section For FrontPage', 'shapely-companion' ), $widget_ops );
|
19 |
+
|
20 |
+
$this->defaults = array(
|
21 |
+
'title' => '',
|
22 |
+
'button' => '',
|
23 |
+
'button_link' => '',
|
24 |
+
);
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @param array $args
|
29 |
+
* @param array $instance
|
30 |
+
*/
|
31 |
+
function widget( $args, $instance ) {
|
32 |
+
|
33 |
+
$instance = wp_parse_args( $instance, $this->defaults );
|
34 |
+
|
35 |
+
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Widget Content
|
39 |
+
*/
|
40 |
+
?>
|
41 |
+
<?php if ( '' != $instance['title'] ) : ?>
|
42 |
+
<section class="cfa-section bg-secondary">
|
43 |
+
<div class="container">
|
44 |
+
<div class="row">
|
45 |
+
<div class="col-sm-12 text-center p0">
|
46 |
+
<div class="overflow-hidden">
|
47 |
+
<div class="col-sm-9">
|
48 |
+
<h3 class="cfa-text"><?php echo wp_kses_post( $instance['title'] ); ?></h3>
|
49 |
+
</div>
|
50 |
+
<div class="col-sm-3">
|
51 |
+
<a href="<?php echo esc_url_raw( $instance['button_link'] ); ?>" class="mb0 btn btn-lg btn-filled cfa-button"><?php echo esc_html( $instance['button'] ); ?></a>
|
52 |
+
</div>
|
53 |
+
</div>
|
54 |
+
</div>
|
55 |
+
</div>
|
56 |
+
<!--end of row-->
|
57 |
+
</div>
|
58 |
+
<!--end of container-->
|
59 |
+
</section>
|
60 |
+
<?php
|
61 |
+
endif;
|
62 |
+
|
63 |
+
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
64 |
+
}
|
65 |
+
|
66 |
+
|
67 |
+
/**
|
68 |
+
* @param array $instance
|
69 |
+
*
|
70 |
+
* @return string|void
|
71 |
+
*/
|
72 |
+
function form( $instance ) {
|
73 |
+
$instance = wp_parse_args( $instance, $this->defaults );
|
74 |
+
?>
|
75 |
+
|
76 |
+
<p class="shapely-editor-container">
|
77 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
|
78 |
+
<?php echo esc_html__( 'Callout Text ', 'shapely-companion' ); ?>
|
79 |
+
</label>
|
80 |
+
<textarea
|
81 |
+
name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
|
82 |
+
id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
|
83 |
+
class="widefat">
|
84 |
+
<?php echo wp_kses_post( nl2br( $instance['title'] ) ); ?>
|
85 |
+
</textarea>
|
86 |
+
</p>
|
87 |
+
|
88 |
+
<p>
|
89 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'button' ) ); ?>">
|
90 |
+
<?php echo esc_html__( 'Button Text ', 'shapely-companion' ); ?>
|
91 |
+
</label>
|
92 |
+
<input type="text" value="<?php echo esc_attr( $instance['button'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'button' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'button' ) ); ?>" class="widefat" />
|
93 |
+
</p>
|
94 |
+
|
95 |
+
<p>
|
96 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'button_link' ) ); ?>">
|
97 |
+
<?php echo esc_html__( 'Button Link ', 'shapely-companion' ); ?>
|
98 |
+
</label>
|
99 |
+
<input type="text" value="<?php echo esc_url( $instance['button_link'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'button_link' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'button_link' ) ); ?>" class="widefat" />
|
100 |
+
</p>
|
101 |
+
<?php
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Sanitize widget form values as they are saved.
|
106 |
+
*
|
107 |
+
* @see WP_Widget::update()
|
108 |
+
*
|
109 |
+
* @param array $new_instance Values just sent to be saved.
|
110 |
+
* @param array $old_instance Previously saved values from database.
|
111 |
+
*
|
112 |
+
* @return array Updated safe values to be saved.
|
113 |
+
*/
|
114 |
+
public function update( $new_instance, $old_instance ) {
|
115 |
+
$instance = array();
|
116 |
+
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? wp_kses_post( $new_instance['title'] ) : '';
|
117 |
+
$instance['button'] = ( ! empty( $new_instance['button'] ) ) ? esc_html( $new_instance['button'] ) : '';
|
118 |
+
$instance['button_link'] = ( ! empty( $new_instance['button_link'] ) ) ? esc_url_raw( $new_instance['button_link'] ) : '';
|
119 |
+
|
120 |
+
return $instance;
|
121 |
+
}
|
122 |
+
}
|
inc/widgets/class-shapely-home-clients.php
CHANGED
@@ -1,177 +1,177 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Homepage parallax section Widget
|
5 |
-
* Shapely Theme
|
6 |
-
*/
|
7 |
-
class Shapely_Home_Clients extends WP_Widget {
|
8 |
-
|
9 |
-
private $defaults = array();
|
10 |
-
|
11 |
-
function __construct() {
|
12 |
-
|
13 |
-
$widget_ops = array(
|
14 |
-
'classname' => 'shapely_home_clients',
|
15 |
-
'description' => esc_html__( 'Shapely Client Section That Displays Logos In A Slider', 'shapely-companion' ),
|
16 |
-
'customize_selective_refresh' => true,
|
17 |
-
);
|
18 |
-
parent::__construct( 'shapely_home_clients', esc_html__( '[Shapely] Client Section For FrontPage', 'shapely-companion' ), $widget_ops );
|
19 |
-
|
20 |
-
$this->defaults = array(
|
21 |
-
'title' => __( 'Our Main Clients', 'shapely-companion' ),
|
22 |
-
'client_logo' => array(
|
23 |
-
'link' => array(),
|
24 |
-
'img' => array(),
|
25 |
-
),
|
26 |
-
);
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* @param array $args
|
31 |
-
* @param array $instance
|
32 |
-
*/
|
33 |
-
function widget( $args, $instance ) {
|
34 |
-
|
35 |
-
$instance = wp_parse_args( $instance, $this->defaults );
|
36 |
-
|
37 |
-
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
38 |
-
|
39 |
-
if ( gettype( $instance['client_logo'] ) == 'object' ) {
|
40 |
-
$instance['client_logo'] = get_object_vars( $instance['client_logo'] );
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Widget Content
|
45 |
-
*/
|
46 |
-
?>
|
47 |
-
<?php if ( isset( $instance['client_logo']['img'] ) && count( $instance['client_logo']['img'] ) > 0 ) { ?>
|
48 |
-
<section>
|
49 |
-
<div class="container">
|
50 |
-
<div class="row">
|
51 |
-
<div class="col-sm-12 text-center">
|
52 |
-
<h3 class="mb64 mb-xs-40"><?php echo wp_kses_post( $instance['title'] ); ?></h3>
|
53 |
-
</div>
|
54 |
-
</div>
|
55 |
-
<!--end of row-->
|
56 |
-
<div class="row">
|
57 |
-
<div class="logo-carousel">
|
58 |
-
<ul class="slides">
|
59 |
-
<?php
|
60 |
-
for ( $i = 0; $i < count( $instance['client_logo']['img'] ); $i ++ ) {
|
61 |
-
if ( '' != $instance['client_logo']['img'] && '' != $instance['client_logo']['link'] ) {
|
62 |
-
?>
|
63 |
-
<li>
|
64 |
-
<a href="<?php echo esc_url_raw( $instance['client_logo']['link'][ $i ] ); ?>">
|
65 |
-
<img alt="<?php esc_html_e( 'Logos', 'shapely-companion' ); ?>" src="<?php echo esc_url_raw( $instance['client_logo']['img'][ $i ] ); ?>" />
|
66 |
-
</a>
|
67 |
-
</li>
|
68 |
-
<?php
|
69 |
-
}
|
70 |
-
}
|
71 |
-
?>
|
72 |
-
</ul>
|
73 |
-
</div>
|
74 |
-
<!--end of logo slider-->
|
75 |
-
</div>
|
76 |
-
<!--end of row-->
|
77 |
-
</div>
|
78 |
-
<!--end of container-->
|
79 |
-
</section>
|
80 |
-
<?php } ?>
|
81 |
-
|
82 |
-
<?php
|
83 |
-
|
84 |
-
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
85 |
-
}
|
86 |
-
|
87 |
-
|
88 |
-
/**
|
89 |
-
* @param array $instance
|
90 |
-
*
|
91 |
-
* @return string|void
|
92 |
-
*/
|
93 |
-
function form( $instance ) {
|
94 |
-
|
95 |
-
$instance = wp_parse_args( $instance, $this->defaults );
|
96 |
-
|
97 |
-
if ( gettype( $instance['client_logo'] ) == 'object' ) {
|
98 |
-
$instance['client_logo'] = get_object_vars( $instance['client_logo'] );
|
99 |
-
}
|
100 |
-
|
101 |
-
?>
|
102 |
-
|
103 |
-
<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
|
104 |
-
<?php echo esc_html__( 'Title ', 'shapely-companion' ); ?>
|
105 |
-
</label>
|
106 |
-
<input type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" class="widefat" />
|
107 |
-
</p>
|
108 |
-
|
109 |
-
<ul class="client-sortable clone-wrapper">
|
110 |
-
<?php
|
111 |
-
|
112 |
-
$slider_count = ( isset( $instance['client_logo']['img'] ) && count( $instance['client_logo']['img'] ) > 0 ) ? count( $instance['client_logo']['img'] ) : 3;
|
113 |
-
$placeholder_url = plugins_url( 'shapely-companion/assets/img/placeholder_wide.jpg' );
|
114 |
-
|
115 |
-
for ( $i = 0; $i < $slider_count; $i ++ ) :
|
116 |
-
?>
|
117 |
-
<li class="toclone">
|
118 |
-
<br>
|
119 |
-
<p class="shapely-media-control" data-delegate-container="<?php echo esc_attr( $this->get_field_id( 'client_logo' ) . '-' . absint( $i ) ); ?>">
|
120 |
-
<label
|
121 |
-
class="logo_heading"
|
122 |
-
for="<?php echo esc_attr( $this->get_field_id( 'client_logo' ) . '-' . absint( $i ) ); ?>">
|
123 |
-
<?php
|
124 |
-
esc_html_e( 'Logo #', 'shapely-companion' );
|
125 |
-
?>
|
126 |
-
<span class="count"><?php echo absint( $i ) + 1; ?></span>:</label>
|
127 |
-
|
128 |
-
<img data-default="<?php echo esc_url_raw( $placeholder_url ); ?>" src="<?php if( isset( $instance['client_logo']['img'][ $i ] ) && '' != $instance['client_logo']['img'][ $i ] ) { echo esc_url( $instance['client_logo']['img'][ $i ] ); }else{ echo esc_url_raw( $placeholder_url );} ?>" />
|
129 |
-
|
130 |
-
<input type="hidden" name="<?php echo esc_attr( $this->get_field_name( 'client_logo' ) . '[img][' . $i . ']' ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'client_logo' ) . '-' . (int) $i ); ?>" value="<?php echo ( isset( $instance['client_logo']['img'][ $i ] ) ) ? esc_url_raw( $instance['client_logo']['img'][ $i ] ) : ''; ?>" class="image-id blazersix-media-control-target">
|
131 |
-
|
132 |
-
<button class="button upload-button"><?php esc_html_e( 'Choose Image', 'shapely-companion' ); ?></button>
|
133 |
-
</p>
|
134 |
-
|
135 |
-
<label for="link<?php echo esc_attr( '-' . absint( $i ) ); ?>">
|
136 |
-
<?php esc_html_e( 'Link:', 'shapely-companion' ); ?>
|
137 |
-
</label>
|
138 |
-
<input name="<?php echo esc_attr( $this->get_field_name( 'client_logo' ) . '[link][' . $i . ']' ); ?>" id="link<?php echo esc_attr( '-' . absint( $i ) ); ?>" class="widefat client-link" type="text" size="36" value="<?php echo ( isset( $instance['client_logo']['link'][ $i ] ) ) ? esc_url_raw( $instance['client_logo']['link'][ $i ] ) : ''; ?>" /><br><br>
|
139 |
-
|
140 |
-
<a href="#" class="clone button-primary"><?php esc_html_e( 'Add', 'shapely-companion' ); ?></a>
|
141 |
-
<a href="#" class="delete button"><?php esc_html_e( 'Delete', 'shapely-companion' ); ?></a>
|
142 |
-
</li>
|
143 |
-
<?php endfor; ?>
|
144 |
-
</ul>
|
145 |
-
<?php
|
146 |
-
|
147 |
-
}
|
148 |
-
|
149 |
-
/**
|
150 |
-
* Sanitize widget form values as they are saved.
|
151 |
-
*
|
152 |
-
* @see WP_Widget::update()
|
153 |
-
*
|
154 |
-
* @param array $new_instance Values just sent to be saved.
|
155 |
-
* @param array $old_instance Previously saved values from database.
|
156 |
-
*
|
157 |
-
* @return array Updated safe values to be saved.
|
158 |
-
*/
|
159 |
-
public function update( $new_instance, $old_instance ) {
|
160 |
-
$instance = array();
|
161 |
-
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? wp_kses_post( $new_instance['title'] ) : '';
|
162 |
-
|
163 |
-
if ( isset( $new_instance['client_logo']['img'] ) && count( $new_instance['client_logo']['img'] ) != 0 ) {
|
164 |
-
for ( $i = 0; $i < count( $new_instance['client_logo']['img'] ); $i ++ ) {
|
165 |
-
$instance['client_logo']['img'][ $i ] = ( ! empty( $new_instance['client_logo']['img'][ $i ] ) ) ? esc_url_raw( $new_instance['client_logo']['img'][ $i ] ) : '';
|
166 |
-
}
|
167 |
-
}
|
168 |
-
if ( isset( $new_instance['client_logo']['link'] ) && count( $new_instance['client_logo']['link'] ) != 0 ) {
|
169 |
-
for ( $i = 0; $i < count( $new_instance['client_logo']['link'] ); $i ++ ) {
|
170 |
-
$instance['client_logo']['link'][ $i ] = ( ! empty( $new_instance['client_logo']['link'][ $i ] ) ) ? esc_url_raw( $new_instance['client_logo']['link'][ $i ] ) : '';
|
171 |
-
}
|
172 |
-
}
|
173 |
-
|
174 |
-
return $instance;
|
175 |
-
}
|
176 |
-
|
177 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Homepage parallax section Widget
|
5 |
+
* Shapely Theme
|
6 |
+
*/
|
7 |
+
class Shapely_Home_Clients extends WP_Widget {
|
8 |
+
|
9 |
+
private $defaults = array();
|
10 |
+
|
11 |
+
function __construct() {
|
12 |
+
|
13 |
+
$widget_ops = array(
|
14 |
+
'classname' => 'shapely_home_clients',
|
15 |
+
'description' => esc_html__( 'Shapely Client Section That Displays Logos In A Slider', 'shapely-companion' ),
|
16 |
+
'customize_selective_refresh' => true,
|
17 |
+
);
|
18 |
+
parent::__construct( 'shapely_home_clients', esc_html__( '[Shapely] Client Section For FrontPage', 'shapely-companion' ), $widget_ops );
|
19 |
+
|
20 |
+
$this->defaults = array(
|
21 |
+
'title' => __( 'Our Main Clients', 'shapely-companion' ),
|
22 |
+
'client_logo' => array(
|
23 |
+
'link' => array(),
|
24 |
+
'img' => array(),
|
25 |
+
),
|
26 |
+
);
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @param array $args
|
31 |
+
* @param array $instance
|
32 |
+
*/
|
33 |
+
function widget( $args, $instance ) {
|
34 |
+
|
35 |
+
$instance = wp_parse_args( $instance, $this->defaults );
|
36 |
+
|
37 |
+
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
38 |
+
|
39 |
+
if ( gettype( $instance['client_logo'] ) == 'object' ) {
|
40 |
+
$instance['client_logo'] = get_object_vars( $instance['client_logo'] );
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Widget Content
|
45 |
+
*/
|
46 |
+
?>
|
47 |
+
<?php if ( isset( $instance['client_logo']['img'] ) && count( $instance['client_logo']['img'] ) > 0 ) { ?>
|
48 |
+
<section>
|
49 |
+
<div class="container">
|
50 |
+
<div class="row">
|
51 |
+
<div class="col-sm-12 text-center">
|
52 |
+
<h3 class="mb64 mb-xs-40"><?php echo wp_kses_post( $instance['title'] ); ?></h3>
|
53 |
+
</div>
|
54 |
+
</div>
|
55 |
+
<!--end of row-->
|
56 |
+
<div class="row">
|
57 |
+
<div class="logo-carousel">
|
58 |
+
<ul class="slides">
|
59 |
+
<?php
|
60 |
+
for ( $i = 0; $i < count( $instance['client_logo']['img'] ); $i ++ ) {
|
61 |
+
if ( '' != $instance['client_logo']['img'] && '' != $instance['client_logo']['link'] ) {
|
62 |
+
?>
|
63 |
+
<li>
|
64 |
+
<a href="<?php echo esc_url_raw( $instance['client_logo']['link'][ $i ] ); ?>">
|
65 |
+
<img alt="<?php esc_html_e( 'Logos', 'shapely-companion' ); ?>" src="<?php echo esc_url_raw( $instance['client_logo']['img'][ $i ] ); ?>" />
|
66 |
+
</a>
|
67 |
+
</li>
|
68 |
+
<?php
|
69 |
+
}
|
70 |
+
}
|
71 |
+
?>
|
72 |
+
</ul>
|
73 |
+
</div>
|
74 |
+
<!--end of logo slider-->
|
75 |
+
</div>
|
76 |
+
<!--end of row-->
|
77 |
+
</div>
|
78 |
+
<!--end of container-->
|
79 |
+
</section>
|
80 |
+
<?php } ?>
|
81 |
+
|
82 |
+
<?php
|
83 |
+
|
84 |
+
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
85 |
+
}
|
86 |
+
|
87 |
+
|
88 |
+
/**
|
89 |
+
* @param array $instance
|
90 |
+
*
|
91 |
+
* @return string|void
|
92 |
+
*/
|
93 |
+
function form( $instance ) {
|
94 |
+
|
95 |
+
$instance = wp_parse_args( $instance, $this->defaults );
|
96 |
+
|
97 |
+
if ( gettype( $instance['client_logo'] ) == 'object' ) {
|
98 |
+
$instance['client_logo'] = get_object_vars( $instance['client_logo'] );
|
99 |
+
}
|
100 |
+
|
101 |
+
?>
|
102 |
+
|
103 |
+
<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
|
104 |
+
<?php echo esc_html__( 'Title ', 'shapely-companion' ); ?>
|
105 |
+
</label>
|
106 |
+
<input type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" class="widefat" />
|
107 |
+
</p>
|
108 |
+
|
109 |
+
<ul class="client-sortable clone-wrapper">
|
110 |
+
<?php
|
111 |
+
|
112 |
+
$slider_count = ( isset( $instance['client_logo']['img'] ) && count( $instance['client_logo']['img'] ) > 0 ) ? count( $instance['client_logo']['img'] ) : 3;
|
113 |
+
$placeholder_url = plugins_url( 'shapely-companion/assets/img/placeholder_wide.jpg' );
|
114 |
+
|
115 |
+
for ( $i = 0; $i < $slider_count; $i ++ ) :
|
116 |
+
?>
|
117 |
+
<li class="toclone">
|
118 |
+
<br>
|
119 |
+
<p class="shapely-media-control" data-delegate-container="<?php echo esc_attr( $this->get_field_id( 'client_logo' ) . '-' . absint( $i ) ); ?>">
|
120 |
+
<label
|
121 |
+
class="logo_heading"
|
122 |
+
for="<?php echo esc_attr( $this->get_field_id( 'client_logo' ) . '-' . absint( $i ) ); ?>">
|
123 |
+
<?php
|
124 |
+
esc_html_e( 'Logo #', 'shapely-companion' );
|
125 |
+
?>
|
126 |
+
<span class="count"><?php echo absint( $i ) + 1; ?></span>:</label>
|
127 |
+
|
128 |
+
<img data-default="<?php echo esc_url_raw( $placeholder_url ); ?>" src="<?php if( isset( $instance['client_logo']['img'][ $i ] ) && '' != $instance['client_logo']['img'][ $i ] ) { echo esc_url( $instance['client_logo']['img'][ $i ] ); }else{ echo esc_url_raw( $placeholder_url );} ?>" />
|
129 |
+
|
130 |
+
<input type="hidden" name="<?php echo esc_attr( $this->get_field_name( 'client_logo' ) . '[img][' . $i . ']' ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'client_logo' ) . '-' . (int) $i ); ?>" value="<?php echo ( isset( $instance['client_logo']['img'][ $i ] ) ) ? esc_url_raw( $instance['client_logo']['img'][ $i ] ) : ''; ?>" class="image-id blazersix-media-control-target">
|
131 |
+
|
132 |
+
<button class="button upload-button"><?php esc_html_e( 'Choose Image', 'shapely-companion' ); ?></button>
|
133 |
+
</p>
|
134 |
+
|
135 |
+
<label for="link<?php echo esc_attr( '-' . absint( $i ) ); ?>">
|
136 |
+
<?php esc_html_e( 'Link:', 'shapely-companion' ); ?>
|
137 |
+
</label>
|
138 |
+
<input name="<?php echo esc_attr( $this->get_field_name( 'client_logo' ) . '[link][' . $i . ']' ); ?>" id="link<?php echo esc_attr( '-' . absint( $i ) ); ?>" class="widefat client-link" type="text" size="36" value="<?php echo ( isset( $instance['client_logo']['link'][ $i ] ) ) ? esc_url_raw( $instance['client_logo']['link'][ $i ] ) : ''; ?>" /><br><br>
|
139 |
+
|
140 |
+
<a href="#" class="clone button-primary"><?php esc_html_e( 'Add', 'shapely-companion' ); ?></a>
|
141 |
+
<a href="#" class="delete button"><?php esc_html_e( 'Delete', 'shapely-companion' ); ?></a>
|
142 |
+
</li>
|
143 |
+
<?php endfor; ?>
|
144 |
+
</ul>
|
145 |
+
<?php
|
146 |
+
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Sanitize widget form values as they are saved.
|
151 |
+
*
|
152 |
+
* @see WP_Widget::update()
|
153 |
+
*
|
154 |
+
* @param array $new_instance Values just sent to be saved.
|
155 |
+
* @param array $old_instance Previously saved values from database.
|
156 |
+
*
|
157 |
+
* @return array Updated safe values to be saved.
|
158 |
+
*/
|
159 |
+
public function update( $new_instance, $old_instance ) {
|
160 |
+
$instance = array();
|
161 |
+
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? wp_kses_post( $new_instance['title'] ) : '';
|
162 |
+
|
163 |
+
if ( isset( $new_instance['client_logo']['img'] ) && count( $new_instance['client_logo']['img'] ) != 0 ) {
|
164 |
+
for ( $i = 0; $i < count( $new_instance['client_logo']['img'] ); $i ++ ) {
|
165 |
+
$instance['client_logo']['img'][ $i ] = ( ! empty( $new_instance['client_logo']['img'][ $i ] ) ) ? esc_url_raw( $new_instance['client_logo']['img'][ $i ] ) : '';
|
166 |
+
}
|
167 |
+
}
|
168 |
+
if ( isset( $new_instance['client_logo']['link'] ) && count( $new_instance['client_logo']['link'] ) != 0 ) {
|
169 |
+
for ( $i = 0; $i < count( $new_instance['client_logo']['link'] ); $i ++ ) {
|
170 |
+
$instance['client_logo']['link'][ $i ] = ( ! empty( $new_instance['client_logo']['link'][ $i ] ) ) ? esc_url_raw( $new_instance['client_logo']['link'][ $i ] ) : '';
|
171 |
+
}
|
172 |
+
}
|
173 |
+
|
174 |
+
return $instance;
|
175 |
+
}
|
176 |
+
|
177 |
+
}
|
inc/widgets/class-shapely-home-contact.php
CHANGED
@@ -1,271 +1,271 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Homepage parallax section Widget
|
5 |
-
* Shapely Theme
|
6 |
-
*/
|
7 |
-
class Shapely_Home_Contact extends WP_Widget {
|
8 |
-
|
9 |
-
private $defaults = array();
|
10 |
-
|
11 |
-
function __construct() {
|
12 |
-
add_action( 'admin_init', array( $this, 'enqueue' ) );
|
13 |
-
add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue' ) );
|
14 |
-
add_action( 'customize_preview_init', array( $this, 'enqueue' ) );
|
15 |
-
|
16 |
-
$widget_ops = array(
|
17 |
-
'classname' => 'shapely_home_contact',
|
18 |
-
'description' => esc_html__( 'Shapely FrontPage Contact Section', 'shapely-companion' ),
|
19 |
-
'customize_selective_refresh' => true,
|
20 |
-
);
|
21 |
-
parent::__construct( 'shapely_home_contact', esc_html__( '[Shapely] Contact Section For FrontPage', 'shapely-companion' ), $widget_ops );
|
22 |
-
|
23 |
-
$this->defaults = array(
|
24 |
-
'title' => '',
|
25 |
-
'body_content' => '',
|
26 |
-
'image_src' => '',
|
27 |
-
'phone' => '',
|
28 |
-
'email' => '',
|
29 |
-
'address' => '',
|
30 |
-
'contactform' => '',
|
31 |
-
'socialicons' => '',
|
32 |
-
);
|
33 |
-
}
|
34 |
-
|
35 |
-
public function enqueue() {
|
36 |
-
|
37 |
-
if ( is_admin() && ! is_customize_preview() ) {
|
38 |
-
wp_enqueue_style( 'epsilon-styles', get_template_directory_uri() . '/inc/libraries/epsilon-framework/assets/css/style.css' );
|
39 |
-
}
|
40 |
-
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* @param array $args
|
45 |
-
* @param array $instance
|
46 |
-
*/
|
47 |
-
function widget( $args, $instance ) {
|
48 |
-
|
49 |
-
$instance = wp_parse_args( $instance, $this->defaults );
|
50 |
-
|
51 |
-
$title = $instance['title'];
|
52 |
-
$body_content = $instance['body_content'];
|
53 |
-
$image_src = $instance['image_src'];
|
54 |
-
$phone = $instance['phone'];
|
55 |
-
$email = $instance['email'];
|
56 |
-
$address = $instance['address'];
|
57 |
-
$contactform = $instance['contactform'];
|
58 |
-
$socialicons = $instance['socialicons'];
|
59 |
-
|
60 |
-
$atts = '';
|
61 |
-
$class = '';
|
62 |
-
if ( '' != $image_src ) {
|
63 |
-
$atts = 'data-parallax="scroll" data-image-src="' . esc_url( $image_src ) . '" class="parallax-window"';
|
64 |
-
$class = ' image-bg cover';
|
65 |
-
}
|
66 |
-
|
67 |
-
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
68 |
-
/**
|
69 |
-
* Widget Content
|
70 |
-
*/
|
71 |
-
?>
|
72 |
-
|
73 |
-
<section class="contact-section<?php echo esc_attr( $class ); ?>">
|
74 |
-
<div <?php echo $atts; ?>>
|
75 |
-
<div class="container">
|
76 |
-
<div class="text-center">
|
77 |
-
<?php
|
78 |
-
|
79 |
-
if ( '' != $title ) {
|
80 |
-
echo '<h1>' . wp_kses_post( $title ) . '</h1>';
|
81 |
-
}
|
82 |
-
|
83 |
-
if ( '' != $body_content ) {
|
84 |
-
echo '<p class="mb64">' . wp_kses_post( nl2br( $body_content ) ) . '</p>';
|
85 |
-
}
|
86 |
-
|
87 |
-
?>
|
88 |
-
</div>
|
89 |
-
<div class="row">
|
90 |
-
<div class="col-md-4">
|
91 |
-
<?php
|
92 |
-
|
93 |
-
if ( '' != $phone ) {
|
94 |
-
echo '<p class="mb0"><strong>' . esc_html__( 'Phone :', 'shapely-companion' ) . '</strong></p>';
|
95 |
-
echo '<p class="mb32"><a href="tel:' . esc_attr( $phone ) . '">' . esc_html( $phone ) . '</a></p>';
|
96 |
-
}
|
97 |
-
|
98 |
-
if ( '' != $email ) {
|
99 |
-
echo '<p class="mb0"><strong>' . esc_html__( 'Email :', 'shapely-companion' ) . '</strong></p>';
|
100 |
-
echo '<p class="mb32"><a href="mailto:' . esc_attr( $email ) . '">' . esc_html( antispambot( $email ) ) . '</a></p>';
|
101 |
-
}
|
102 |
-
|
103 |
-
if ( '' != $address ) {
|
104 |
-
echo '<p class="mb0"><strong>' . esc_html__( 'Address :', 'shapely-companion' ) . '</strong></p>';
|
105 |
-
echo '<p class="mb32">' . wp_kses_post( nl2br( $address ) ) . '</p>';
|
106 |
-
}
|
107 |
-
|
108 |
-
if ( 'on' == $socialicons ) {
|
109 |
-
echo '<div class="social-icons sticky-sidebar-social">';
|
110 |
-
shapely_social_icons();
|
111 |
-
echo '</div>';
|
112 |
-
}
|
113 |
-
|
114 |
-
?>
|
115 |
-
</div>
|
116 |
-
<div class="col-md-8">
|
117 |
-
<?php
|
118 |
-
if ( '' != $contactform && is_numeric( $contactform ) ) {
|
119 |
-
$post = get_post( $contactform );
|
120 |
-
if( 'kaliforms_forms' === $post->post_type ) {
|
121 |
-
echo do_shortcode( '[kaliform id="' . absint( $contactform ) . '"]' );
|
122 |
-
}
|
123 |
-
if( 'wpcf7_contact_form' === $post->post_type ) {
|
124 |
-
echo do_shortcode( '[contact-form-7 id="' . absint( $contactform ) . '"]' );
|
125 |
-
}
|
126 |
-
}
|
127 |
-
?>
|
128 |
-
</div>
|
129 |
-
</div>
|
130 |
-
</div>
|
131 |
-
</div>
|
132 |
-
</section>
|
133 |
-
|
134 |
-
<div class="clearfix"></div>
|
135 |
-
<?php
|
136 |
-
|
137 |
-
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
138 |
-
}
|
139 |
-
|
140 |
-
|
141 |
-
/**
|
142 |
-
* @param array $instance
|
143 |
-
*
|
144 |
-
* @return string|void
|
145 |
-
*/
|
146 |
-
function form( $instance ) {
|
147 |
-
|
148 |
-
parent::form( $instance );
|
149 |
-
|
150 |
-
$instance = wp_parse_args( $instance, $this->defaults );
|
151 |
-
$placeholder_url = plugins_url( 'shapely-companion/assets/img/placeholder-image.jpg' );
|
152 |
-
|
153 |
-
?>
|
154 |
-
|
155 |
-
<p>
|
156 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php echo esc_html__( 'Title ', 'shapely-companion' ); ?></label>
|
157 |
-
<input type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" class="widefat" />
|
158 |
-
</p>
|
159 |
-
|
160 |
-
<p class="shapely-editor-container">
|
161 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'body_content' ) ); ?>">
|
162 |
-
<?php echo esc_html__( 'Subtitle ', 'shapely-companion' ); ?>
|
163 |
-
</label>
|
164 |
-
<textarea name="<?php echo esc_attr( $this->get_field_name( 'body_content' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'body_content' ) ); ?>" class="widefat">
|
165 |
-
<?php echo wp_kses_post( $instance['body_content'] ); ?>
|
166 |
-
</textarea>
|
167 |
-
</p>
|
168 |
-
|
169 |
-
<p class="shapely-media-control" data-delegate-container="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>">
|
170 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>"><?php echo esc_html__( 'Background image', 'shapely-companion' ); ?>:</label>
|
171 |
-
|
172 |
-
<img data-default="<?php echo esc_url_raw( $placeholder_url ); ?>" src="<?php echo '' != $instance['image_src'] ? esc_url_raw( $instance['image_src'] ) : esc_url_raw( $placeholder_url ); ?>" />
|
173 |
-
|
174 |
-
<input type="hidden" name="<?php echo esc_attr( $this->get_field_name( 'image_src' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>" value="<?php echo esc_url( $instance['image_src'] ); ?>" class="image-id blazersix-media-control-target">
|
175 |
-
|
176 |
-
<button class="button upload-button"><?php echo esc_html__( 'Choose Image', 'shapely-companion' ); ?></button>
|
177 |
-
<button class="button remove-button"><?php echo esc_html__( 'Remove Image', 'shapely-companion' ); ?></button>
|
178 |
-
</p>
|
179 |
-
|
180 |
-
<p>
|
181 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'contactform' ) ); ?>">
|
182 |
-
<?php echo esc_html__( 'Contact Form ', 'shapely-companion' ); ?>
|
183 |
-
</label>
|
184 |
-
<?php
|
185 |
-
|
186 |
-
if ( ! defined( 'KALIFORMS_VERSION' ) ) {
|
187 |
-
echo '<br><span>' . esc_html__( 'Please install Kali Forms plugin', 'shapely-companion' ) . '</span>';
|
188 |
-
echo '<input type="hidden" id="' . esc_attr( $this->get_field_name( 'contactform' ) ) . '" name="' . esc_attr( $this->get_field_name( 'contactform' ) ) . '" value="0">';
|
189 |
-
} else {
|
190 |
-
echo '<select id="' . esc_attr( $this->get_field_name( 'contactform' ) ) . '" name="' . esc_attr( $this->get_field_name( 'contactform' ) ) . '" class="widefat">';
|
191 |
-
echo '<option value="0">' . esc_html__( 'Select a form ...', 'shapely-companion' ) . '</option>';
|
192 |
-
$forms_args = array(
|
193 |
-
'post_type' => 'kaliforms_forms',
|
194 |
-
'post_status' => 'publish',
|
195 |
-
'posts_per_page' => - 1,
|
196 |
-
);
|
197 |
-
|
198 |
-
$forms = get_posts( $forms_args );
|
199 |
-
foreach ( $forms as $form ) {
|
200 |
-
echo '<option value="' . esc_attr( $form->ID ) . '" ' . selected( $form->ID, $instance['contactform'], false ) . '>' . esc_html( $form->post_title ) . '</option>';
|
201 |
-
}
|
202 |
-
|
203 |
-
echo '</select>';
|
204 |
-
}
|
205 |
-
|
206 |
-
?>
|
207 |
-
</p>
|
208 |
-
|
209 |
-
<p>
|
210 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'phone' ) ); ?>">
|
211 |
-
<?php echo esc_html__( 'Phone number ', 'shapely-companion' ); ?>
|
212 |
-
</label>
|
213 |
-
<input type="text" value="<?php echo esc_attr( $instance['phone'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'phone' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'phone' ) ); ?>" class="widefat" />
|
214 |
-
</p>
|
215 |
-
|
216 |
-
<p>
|
217 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'email' ) ); ?>">
|
218 |
-
<?php echo esc_html__( 'Email ', 'shapely-companion' ); ?>
|
219 |
-
</label>
|
220 |
-
<input type="text" value="<?php echo esc_attr( $instance['email'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'email' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'email' ) ); ?>" class="widefat" />
|
221 |
-
</p>
|
222 |
-
|
223 |
-
<p class="shapely-editor-container">
|
224 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'address' ) ); ?>">
|
225 |
-
<?php echo esc_html__( 'Address ', 'shapely-companion' ); ?>
|
226 |
-
</label>
|
227 |
-
|
228 |
-
<textarea
|
229 |
-
name="<?php echo esc_attr( $this->get_field_name( 'address' ) ); ?>"
|
230 |
-
id="<?php echo esc_attr( $this->get_field_id( 'address' ) ); ?>">
|
231 |
-
<?php echo wp_kses_post( $instance['address'] ); ?>
|
232 |
-
</textarea>
|
233 |
-
</p>
|
234 |
-
<div class="checkbox_switch wp-clearfix">
|
235 |
-
<span class="customize-control-title onoffswitch_label">
|
236 |
-
<?php echo esc_html__( 'Show social icons', 'shapely-companion' ); ?>
|
237 |
-
</span>
|
238 |
-
<div class="onoffswitch">
|
239 |
-
<input type="checkbox" id="<?php echo esc_attr( $this->get_field_name( 'socialicons' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'socialicons' ) ); ?>" class="onoffswitch-checkbox" value="on"
|
240 |
-
<?php checked( $instance['socialicons'], 'on' ); ?>>
|
241 |
-
<label class="onoffswitch-label" for="<?php echo esc_attr( $this->get_field_name( 'socialicons' ) ); ?>"></label>
|
242 |
-
</div>
|
243 |
-
</div>
|
244 |
-
|
245 |
-
<?php
|
246 |
-
}
|
247 |
-
|
248 |
-
/**
|
249 |
-
* Sanitize widget form values as they are saved.
|
250 |
-
*
|
251 |
-
* @see WP_Widget::update()
|
252 |
-
*
|
253 |
-
* @param array $new_instance Values just sent to be saved.
|
254 |
-
* @param array $old_instance Previously saved values from database.
|
255 |
-
*
|
256 |
-
* @return array Updated safe values to be saved.
|
257 |
-
*/
|
258 |
-
public function update( $new_instance, $old_instance ) {
|
259 |
-
$instance = array();
|
260 |
-
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? wp_kses_post( $new_instance['title'] ) : '';
|
261 |
-
$instance['image_src'] = ( ! empty( $new_instance['image_src'] ) ) ? esc_url_raw( $new_instance['image_src'] ) : '';
|
262 |
-
$instance['body_content'] = ( ! empty( $new_instance['body_content'] ) ) ? wp_kses_post( $new_instance['body_content'] ) : '';
|
263 |
-
$instance['phone'] = ( ! empty( $new_instance['phone'] ) ) ? esc_html( $new_instance['phone'] ) : '';
|
264 |
-
$instance['address'] = ( ! empty( $new_instance['address'] ) ) ? wp_kses_post( $new_instance['address'] ) : '';
|
265 |
-
$instance['email'] = ( ! empty( $new_instance['email'] ) ) ? esc_html( $new_instance['email'] ) : '';
|
266 |
-
$instance['contactform'] = ( ! empty( $new_instance['contactform'] ) ) ? absint( $new_instance['contactform'] ) : '';
|
267 |
-
$instance['socialicons'] = ( ! empty( $new_instance['socialicons'] ) ) ? esc_html( $new_instance['socialicons'] ) : '';
|
268 |
-
|
269 |
-
return $instance;
|
270 |
-
}
|
271 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Homepage parallax section Widget
|
5 |
+
* Shapely Theme
|
6 |
+
*/
|
7 |
+
class Shapely_Home_Contact extends WP_Widget {
|
8 |
+
|
9 |
+
private $defaults = array();
|
10 |
+
|
11 |
+
function __construct() {
|
12 |
+
add_action( 'admin_init', array( $this, 'enqueue' ) );
|
13 |
+
add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue' ) );
|
14 |
+
add_action( 'customize_preview_init', array( $this, 'enqueue' ) );
|
15 |
+
|
16 |
+
$widget_ops = array(
|
17 |
+
'classname' => 'shapely_home_contact',
|
18 |
+
'description' => esc_html__( 'Shapely FrontPage Contact Section', 'shapely-companion' ),
|
19 |
+
'customize_selective_refresh' => true,
|
20 |
+
);
|
21 |
+
parent::__construct( 'shapely_home_contact', esc_html__( '[Shapely] Contact Section For FrontPage', 'shapely-companion' ), $widget_ops );
|
22 |
+
|
23 |
+
$this->defaults = array(
|
24 |
+
'title' => '',
|
25 |
+
'body_content' => '',
|
26 |
+
'image_src' => '',
|
27 |
+
'phone' => '',
|
28 |
+
'email' => '',
|
29 |
+
'address' => '',
|
30 |
+
'contactform' => '',
|
31 |
+
'socialicons' => '',
|
32 |
+
);
|
33 |
+
}
|
34 |
+
|
35 |
+
public function enqueue() {
|
36 |
+
|
37 |
+
if ( is_admin() && ! is_customize_preview() ) {
|
38 |
+
wp_enqueue_style( 'epsilon-styles', get_template_directory_uri() . '/inc/libraries/epsilon-framework/assets/css/style.css' );
|
39 |
+
}
|
40 |
+
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @param array $args
|
45 |
+
* @param array $instance
|
46 |
+
*/
|
47 |
+
function widget( $args, $instance ) {
|
48 |
+
|
49 |
+
$instance = wp_parse_args( $instance, $this->defaults );
|
50 |
+
|
51 |
+
$title = $instance['title'];
|
52 |
+
$body_content = $instance['body_content'];
|
53 |
+
$image_src = $instance['image_src'];
|
54 |
+
$phone = $instance['phone'];
|
55 |
+
$email = $instance['email'];
|
56 |
+
$address = $instance['address'];
|
57 |
+
$contactform = $instance['contactform'];
|
58 |
+
$socialicons = $instance['socialicons'];
|
59 |
+
|
60 |
+
$atts = '';
|
61 |
+
$class = '';
|
62 |
+
if ( '' != $image_src ) {
|
63 |
+
$atts = 'data-parallax="scroll" data-image-src="' . esc_url( $image_src ) . '" class="parallax-window"';
|
64 |
+
$class = ' image-bg cover';
|
65 |
+
}
|
66 |
+
|
67 |
+
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
68 |
+
/**
|
69 |
+
* Widget Content
|
70 |
+
*/
|
71 |
+
?>
|
72 |
+
|
73 |
+
<section class="contact-section<?php echo esc_attr( $class ); ?>">
|
74 |
+
<div <?php echo $atts; ?>>
|
75 |
+
<div class="container">
|
76 |
+
<div class="text-center">
|
77 |
+
<?php
|
78 |
+
|
79 |
+
if ( '' != $title ) {
|
80 |
+
echo '<h1>' . wp_kses_post( $title ) . '</h1>';
|
81 |
+
}
|
82 |
+
|
83 |
+
if ( '' != $body_content ) {
|
84 |
+
echo '<p class="mb64">' . wp_kses_post( nl2br( $body_content ) ) . '</p>';
|
85 |
+
}
|
86 |
+
|
87 |
+
?>
|
88 |
+
</div>
|
89 |
+
<div class="row">
|
90 |
+
<div class="col-md-4">
|
91 |
+
<?php
|
92 |
+
|
93 |
+
if ( '' != $phone ) {
|
94 |
+
echo '<p class="mb0"><strong>' . esc_html__( 'Phone :', 'shapely-companion' ) . '</strong></p>';
|
95 |
+
echo '<p class="mb32"><a href="tel:' . esc_attr( $phone ) . '">' . esc_html( $phone ) . '</a></p>';
|
96 |
+
}
|
97 |
+
|
98 |
+
if ( '' != $email ) {
|
99 |
+
echo '<p class="mb0"><strong>' . esc_html__( 'Email :', 'shapely-companion' ) . '</strong></p>';
|
100 |
+
echo '<p class="mb32"><a href="mailto:' . esc_attr( $email ) . '">' . esc_html( antispambot( $email ) ) . '</a></p>';
|
101 |
+
}
|
102 |
+
|
103 |
+
if ( '' != $address ) {
|
104 |
+
echo '<p class="mb0"><strong>' . esc_html__( 'Address :', 'shapely-companion' ) . '</strong></p>';
|
105 |
+
echo '<p class="mb32">' . wp_kses_post( nl2br( $address ) ) . '</p>';
|
106 |
+
}
|
107 |
+
|
108 |
+
if ( 'on' == $socialicons ) {
|
109 |
+
echo '<div class="social-icons sticky-sidebar-social">';
|
110 |
+
shapely_social_icons();
|
111 |
+
echo '</div>';
|
112 |
+
}
|
113 |
+
|
114 |
+
?>
|
115 |
+
</div>
|
116 |
+
<div class="col-md-8">
|
117 |
+
<?php
|
118 |
+
if ( '' != $contactform && is_numeric( $contactform ) ) {
|
119 |
+
$post = get_post( $contactform );
|
120 |
+
if( 'kaliforms_forms' === $post->post_type ) {
|
121 |
+
echo do_shortcode( '[kaliform id="' . absint( $contactform ) . '"]' );
|
122 |
+
}
|
123 |
+
if( 'wpcf7_contact_form' === $post->post_type ) {
|
124 |
+
echo do_shortcode( '[contact-form-7 id="' . absint( $contactform ) . '"]' );
|
125 |
+
}
|
126 |
+
}
|
127 |
+
?>
|
128 |
+
</div>
|
129 |
+
</div>
|
130 |
+
</div>
|
131 |
+
</div>
|
132 |
+
</section>
|
133 |
+
|
134 |
+
<div class="clearfix"></div>
|
135 |
+
<?php
|
136 |
+
|
137 |
+
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
138 |
+
}
|
139 |
+
|
140 |
+
|
141 |
+
/**
|
142 |
+
* @param array $instance
|
143 |
+
*
|
144 |
+
* @return string|void
|
145 |
+
*/
|
146 |
+
function form( $instance ) {
|
147 |
+
|
148 |
+
parent::form( $instance );
|
149 |
+
|
150 |
+
$instance = wp_parse_args( $instance, $this->defaults );
|
151 |
+
$placeholder_url = plugins_url( 'shapely-companion/assets/img/placeholder-image.jpg' );
|
152 |
+
|
153 |
+
?>
|
154 |
+
|
155 |
+
<p>
|
156 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php echo esc_html__( 'Title ', 'shapely-companion' ); ?></label>
|
157 |
+
<input type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" class="widefat" />
|
158 |
+
</p>
|
159 |
+
|
160 |
+
<p class="shapely-editor-container">
|
161 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'body_content' ) ); ?>">
|
162 |
+
<?php echo esc_html__( 'Subtitle ', 'shapely-companion' ); ?>
|
163 |
+
</label>
|
164 |
+
<textarea name="<?php echo esc_attr( $this->get_field_name( 'body_content' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'body_content' ) ); ?>" class="widefat">
|
165 |
+
<?php echo wp_kses_post( $instance['body_content'] ); ?>
|
166 |
+
</textarea>
|
167 |
+
</p>
|
168 |
+
|
169 |
+
<p class="shapely-media-control" data-delegate-container="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>">
|
170 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>"><?php echo esc_html__( 'Background image', 'shapely-companion' ); ?>:</label>
|
171 |
+
|
172 |
+
<img data-default="<?php echo esc_url_raw( $placeholder_url ); ?>" src="<?php echo '' != $instance['image_src'] ? esc_url_raw( $instance['image_src'] ) : esc_url_raw( $placeholder_url ); ?>" />
|
173 |
+
|
174 |
+
<input type="hidden" name="<?php echo esc_attr( $this->get_field_name( 'image_src' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>" value="<?php echo esc_url( $instance['image_src'] ); ?>" class="image-id blazersix-media-control-target">
|
175 |
+
|
176 |
+
<button class="button upload-button"><?php echo esc_html__( 'Choose Image', 'shapely-companion' ); ?></button>
|
177 |
+
<button class="button remove-button"><?php echo esc_html__( 'Remove Image', 'shapely-companion' ); ?></button>
|
178 |
+
</p>
|
179 |
+
|
180 |
+
<p>
|
181 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'contactform' ) ); ?>">
|
182 |
+
<?php echo esc_html__( 'Contact Form ', 'shapely-companion' ); ?>
|
183 |
+
</label>
|
184 |
+
<?php
|
185 |
+
|
186 |
+
if ( ! defined( 'KALIFORMS_VERSION' ) ) {
|
187 |
+
echo '<br><span>' . esc_html__( 'Please install Kali Forms plugin', 'shapely-companion' ) . '</span>';
|
188 |
+
echo '<input type="hidden" id="' . esc_attr( $this->get_field_name( 'contactform' ) ) . '" name="' . esc_attr( $this->get_field_name( 'contactform' ) ) . '" value="0">';
|
189 |
+
} else {
|
190 |
+
echo '<select id="' . esc_attr( $this->get_field_name( 'contactform' ) ) . '" name="' . esc_attr( $this->get_field_name( 'contactform' ) ) . '" class="widefat">';
|
191 |
+
echo '<option value="0">' . esc_html__( 'Select a form ...', 'shapely-companion' ) . '</option>';
|
192 |
+
$forms_args = array(
|
193 |
+
'post_type' => 'kaliforms_forms',
|
194 |
+
'post_status' => 'publish',
|
195 |
+
'posts_per_page' => - 1,
|
196 |
+
);
|
197 |
+
|
198 |
+
$forms = get_posts( $forms_args );
|
199 |
+
foreach ( $forms as $form ) {
|
200 |
+
echo '<option value="' . esc_attr( $form->ID ) . '" ' . selected( $form->ID, $instance['contactform'], false ) . '>' . esc_html( $form->post_title ) . '</option>';
|
201 |
+
}
|
202 |
+
|
203 |
+
echo '</select>';
|
204 |
+
}
|
205 |
+
|
206 |
+
?>
|
207 |
+
</p>
|
208 |
+
|
209 |
+
<p>
|
210 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'phone' ) ); ?>">
|
211 |
+
<?php echo esc_html__( 'Phone number ', 'shapely-companion' ); ?>
|
212 |
+
</label>
|
213 |
+
<input type="text" value="<?php echo esc_attr( $instance['phone'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'phone' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'phone' ) ); ?>" class="widefat" />
|
214 |
+
</p>
|
215 |
+
|
216 |
+
<p>
|
217 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'email' ) ); ?>">
|
218 |
+
<?php echo esc_html__( 'Email ', 'shapely-companion' ); ?>
|
219 |
+
</label>
|
220 |
+
<input type="text" value="<?php echo esc_attr( $instance['email'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'email' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'email' ) ); ?>" class="widefat" />
|
221 |
+
</p>
|
222 |
+
|
223 |
+
<p class="shapely-editor-container">
|
224 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'address' ) ); ?>">
|
225 |
+
<?php echo esc_html__( 'Address ', 'shapely-companion' ); ?>
|
226 |
+
</label>
|
227 |
+
|
228 |
+
<textarea
|
229 |
+
name="<?php echo esc_attr( $this->get_field_name( 'address' ) ); ?>"
|
230 |
+
id="<?php echo esc_attr( $this->get_field_id( 'address' ) ); ?>">
|
231 |
+
<?php echo wp_kses_post( $instance['address'] ); ?>
|
232 |
+
</textarea>
|
233 |
+
</p>
|
234 |
+
<div class="checkbox_switch wp-clearfix">
|
235 |
+
<span class="customize-control-title onoffswitch_label">
|
236 |
+
<?php echo esc_html__( 'Show social icons', 'shapely-companion' ); ?>
|
237 |
+
</span>
|
238 |
+
<div class="onoffswitch">
|
239 |
+
<input type="checkbox" id="<?php echo esc_attr( $this->get_field_name( 'socialicons' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'socialicons' ) ); ?>" class="onoffswitch-checkbox" value="on"
|
240 |
+
<?php checked( $instance['socialicons'], 'on' ); ?>>
|
241 |
+
<label class="onoffswitch-label" for="<?php echo esc_attr( $this->get_field_name( 'socialicons' ) ); ?>"></label>
|
242 |
+
</div>
|
243 |
+
</div>
|
244 |
+
|
245 |
+
<?php
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* Sanitize widget form values as they are saved.
|
250 |
+
*
|
251 |
+
* @see WP_Widget::update()
|
252 |
+
*
|
253 |
+
* @param array $new_instance Values just sent to be saved.
|
254 |
+
* @param array $old_instance Previously saved values from database.
|
255 |
+
*
|
256 |
+
* @return array Updated safe values to be saved.
|
257 |
+
*/
|
258 |
+
public function update( $new_instance, $old_instance ) {
|
259 |
+
$instance = array();
|
260 |
+
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? wp_kses_post( $new_instance['title'] ) : '';
|
261 |
+
$instance['image_src'] = ( ! empty( $new_instance['image_src'] ) ) ? esc_url_raw( $new_instance['image_src'] ) : '';
|
262 |
+
$instance['body_content'] = ( ! empty( $new_instance['body_content'] ) ) ? wp_kses_post( $new_instance['body_content'] ) : '';
|
263 |
+
$instance['phone'] = ( ! empty( $new_instance['phone'] ) ) ? esc_html( $new_instance['phone'] ) : '';
|
264 |
+
$instance['address'] = ( ! empty( $new_instance['address'] ) ) ? wp_kses_post( $new_instance['address'] ) : '';
|
265 |
+
$instance['email'] = ( ! empty( $new_instance['email'] ) ) ? esc_html( $new_instance['email'] ) : '';
|
266 |
+
$instance['contactform'] = ( ! empty( $new_instance['contactform'] ) ) ? absint( $new_instance['contactform'] ) : '';
|
267 |
+
$instance['socialicons'] = ( ! empty( $new_instance['socialicons'] ) ) ? esc_html( $new_instance['socialicons'] ) : '';
|
268 |
+
|
269 |
+
return $instance;
|
270 |
+
}
|
271 |
+
}
|
inc/widgets/class-shapely-home-features.php
CHANGED
@@ -1,752 +1,752 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Homepage features section Widget
|
5 |
-
* Shapely Theme
|
6 |
-
*/
|
7 |
-
class Shapely_Home_Features extends WP_Widget {
|
8 |
-
|
9 |
-
private $defaults = array();
|
10 |
-
private $all_icons = array();
|
11 |
-
private $icons = array();
|
12 |
-
|
13 |
-
function __construct() {
|
14 |
-
|
15 |
-
$widget_ops = array(
|
16 |
-
'classname' => 'shapely_home_features',
|
17 |
-
'description' => esc_html__( 'Widget to set Features in Home Section', 'shapely-companion' ),
|
18 |
-
'customize_selective_refresh' => true,
|
19 |
-
);
|
20 |
-
|
21 |
-
parent::__construct( 'shapely_home_features', esc_html__( '[Shapely] Features Section For FrontPage', 'shapely-companion' ), $widget_ops );
|
22 |
-
|
23 |
-
$this->defaults = array(
|
24 |
-
'title' => '',
|
25 |
-
'title1' => '',
|
26 |
-
'title2' => '',
|
27 |
-
'title3' => '',
|
28 |
-
'icon1' => 'fa fa-cogs',
|
29 |
-
'icon2' => 'fa fa-heartbeat',
|
30 |
-
'icon3' => 'fa fa-paper-plane-o',
|
31 |
-
'body_content' => '',
|
32 |
-
'body_content1' => '',
|
33 |
-
'body_content2' => '',
|
34 |
-
'body_content3' => '',
|
35 |
-
);
|
36 |
-
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* @param array $args
|
41 |
-
* @param array $instance
|
42 |
-
*/
|
43 |
-
function widget( $args, $instance ) {
|
44 |
-
|
45 |
-
$instance = wp_parse_args( $instance, $this->defaults );
|
46 |
-
|
47 |
-
$title[0] = $instance['title'];
|
48 |
-
$body_content[0] = $instance['body_content'];
|
49 |
-
|
50 |
-
$title[1] = $instance['title1'];
|
51 |
-
$title[2] = $instance['title2'];
|
52 |
-
$title[3] = $instance['title3'];
|
53 |
-
|
54 |
-
$icon[1] = $instance['icon1'];
|
55 |
-
$icon[2] = $instance['icon2'];
|
56 |
-
$icon[3] = $instance['icon3'];
|
57 |
-
|
58 |
-
$body_content[1] = $instance['body_content1'];
|
59 |
-
$body_content[2] = $instance['body_content2'];
|
60 |
-
$body_content[3] = $instance['body_content3'];
|
61 |
-
|
62 |
-
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Widget Content
|
66 |
-
*/
|
67 |
-
?>
|
68 |
-
<section>
|
69 |
-
<div class="container">
|
70 |
-
<div class="row">
|
71 |
-
<div class="col-sm-12 text-center">
|
72 |
-
<h3 class="mb16"><?php echo wp_kses_post( $title[0] ); ?></h3>
|
73 |
-
<p class="mb64"><?php echo wp_kses_post( $body_content[0] ); ?></p>
|
74 |
-
</div>
|
75 |
-
</div>
|
76 |
-
<!--end of row-->
|
77 |
-
<div class="row">
|
78 |
-
<?php
|
79 |
-
for ( $i = 1; $i < 4; $i ++ ) {
|
80 |
-
if ( '' != $title[ $i ] ) {
|
81 |
-
?>
|
82 |
-
<div class="col-sm-4">
|
83 |
-
<div class="feature feature-1">
|
84 |
-
<div class="text-center">
|
85 |
-
<i class="<?php echo esc_attr( $icon[ $i ] ); ?>"></i>
|
86 |
-
<h4><?php echo wp_kses_post( $title[ $i ] ); ?></h4>
|
87 |
-
</div>
|
88 |
-
<p><?php echo wp_kses_post( $body_content[ $i ] ); ?></p>
|
89 |
-
</div>
|
90 |
-
<!--end of feature-->
|
91 |
-
</div>
|
92 |
-
<?php
|
93 |
-
}
|
94 |
-
}
|
95 |
-
?>
|
96 |
-
</div>
|
97 |
-
<!--end of row-->
|
98 |
-
</div>
|
99 |
-
<!--end of container-->
|
100 |
-
</section>
|
101 |
-
|
102 |
-
<?php
|
103 |
-
|
104 |
-
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
105 |
-
}
|
106 |
-
|
107 |
-
|
108 |
-
/**
|
109 |
-
* @param array $instance
|
110 |
-
*
|
111 |
-
* @return string|void
|
112 |
-
*/
|
113 |
-
function form( $instance ) {
|
114 |
-
|
115 |
-
$instance = wp_parse_args( $instance, $this->defaults );
|
116 |
-
?>
|
117 |
-
|
118 |
-
<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
|
119 |
-
<?php echo esc_html__( 'Title ', 'shapely-companion' ); ?>
|
120 |
-
</label>
|
121 |
-
|
122 |
-
<input type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" class="widefat" />
|
123 |
-
</p>
|
124 |
-
|
125 |
-
<p class="shapely-editor-container">
|
126 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'body_content' ) ); ?>">
|
127 |
-
<?php echo esc_html__( 'Content ', 'shapely-companion' ); ?>
|
128 |
-
</label>
|
129 |
-
|
130 |
-
<textarea name="<?php echo esc_attr( $this->get_field_name( 'body_content' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'body_content' ) ); ?>" class="widefat">
|
131 |
-
<?php echo wp_kses_post( nl2br( $instance['body_content'] ) ); ?>
|
132 |
-
</textarea>
|
133 |
-
</p>
|
134 |
-
|
135 |
-
<?php for ( $i = 1; $i < 4; $i ++ ) { ?>
|
136 |
-
<br>
|
137 |
-
<b>
|
138 |
-
<?php
|
139 |
-
// Translators: Number of feature icons
|
140 |
-
echo sprintf( esc_html__( 'Feature %s', 'shapely-companion' ), esc_html( $i ) );
|
141 |
-
?>
|
142 |
-
</b>
|
143 |
-
|
144 |
-
<p>
|
145 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'title' . $i ) ); ?>">
|
146 |
-
<?php echo esc_html__( 'Title ', 'shapely-companion' ); ?>
|
147 |
-
</label>
|
148 |
-
<input type="text" value="<?php echo esc_attr( $instance[ 'title' . $i ] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' . $i ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'title' . $i ) ); ?>" class="widefat" />
|
149 |
-
</p>
|
150 |
-
|
151 |
-
<p>
|
152 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'icon' . $i ) ); ?>">
|
153 |
-
<?php echo esc_html__( 'Icon( Font Awsome ) ', 'shapely-companion' ); ?>
|
154 |
-
</label>
|
155 |
-
|
156 |
-
<?php
|
157 |
-
|
158 |
-
$fa_icons = $this->get_fontawesome_icons();
|
159 |
-
$icon = ( isset( $instance[ 'icon' . $i ] ) && '' != $instance[ 'icon' . $i ] ) ? esc_html( $instance[ 'icon' . $i ] ) : '';
|
160 |
-
?>
|
161 |
-
|
162 |
-
<select class="shapely-icon" id="<?php echo esc_attr( $this->get_field_id( 'icon' . $i ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'icon' . $i ) ); ?>">
|
163 |
-
<option value="">
|
164 |
-
<?php echo esc_html__( 'Select Icon', 'shapely-companion' ); ?>
|
165 |
-
</option>
|
166 |
-
<?php foreach ( $fa_icons as $key => $get_fontawesome_icon ) : ?>
|
167 |
-
<option value="fa <?php echo esc_attr( $key ); ?>" <?php selected( $icon, 'fa ' . $key ); ?>>
|
168 |
-
<?php echo esc_html( $get_fontawesome_icon ); ?>
|
169 |
-
</option>
|
170 |
-
<?php endforeach; ?>
|
171 |
-
</select>
|
172 |
-
<span class="<?php echo esc_attr( $icon ); ?>" style="font-size: 24px;vertical-align: middle;margin-left: 10px;"></span>
|
173 |
-
</p>
|
174 |
-
|
175 |
-
<p class="shapely-editor-container">
|
176 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'body_content' . $i ) ); ?>"><?php echo esc_html__( 'Content ', 'shapely-companion' ); ?></label>
|
177 |
-
|
178 |
-
<textarea name="<?php echo esc_attr( $this->get_field_name( 'body_content' . $i ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'body_content' . $i ) ); ?>" class="widefat">
|
179 |
-
<?php echo wp_kses_post( nl2br( $instance[ 'body_content' . $i ] ) ); ?>
|
180 |
-
</textarea>
|
181 |
-
</p>
|
182 |
-
<?php
|
183 |
-
}
|
184 |
-
}
|
185 |
-
|
186 |
-
/**
|
187 |
-
* Sanitize widget form values as they are saved.
|
188 |
-
*
|
189 |
-
* @see WP_Widget::update()
|
190 |
-
*
|
191 |
-
* @param array $new_instance Values just sent to be saved.
|
192 |
-
* @param array $old_instance Previously saved values from database.
|
193 |
-
*
|
194 |
-
* @return array Updated safe values to be saved.
|
195 |
-
*/
|
196 |
-
public function update( $new_instance, $old_instance ) {
|
197 |
-
$instance = array();
|
198 |
-
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? wp_kses_post( $new_instance['title'] ) : '';
|
199 |
-
$instance['body_content'] = ( ! empty( $new_instance['body_content'] ) ) ? wp_kses_post( $new_instance['body_content'] ) : '';
|
200 |
-
|
201 |
-
$instance['title1'] = ( ! empty( $new_instance['title1'] ) ) ? wp_kses_post( $new_instance['title1'] ) : '';
|
202 |
-
$instance['title2'] = ( ! empty( $new_instance['title2'] ) ) ? wp_kses_post( $new_instance['title2'] ) : '';
|
203 |
-
$instance['title3'] = ( ! empty( $new_instance['title3'] ) ) ? wp_kses_post( $new_instance['title3'] ) : '';
|
204 |
-
|
205 |
-
$instance['body_content1'] = ( ! empty( $new_instance['body_content1'] ) ) ? wp_kses_post( $new_instance['body_content1'] ) : '';
|
206 |
-
$instance['body_content2'] = ( ! empty( $new_instance['body_content2'] ) ) ? wp_kses_post( $new_instance['body_content2'] ) : '';
|
207 |
-
$instance['body_content3'] = ( ! empty( $new_instance['body_content3'] ) ) ? wp_kses_post( $new_instance['body_content3'] ) : '';
|
208 |
-
|
209 |
-
$instance['icon1'] = ( ! empty( $new_instance['icon1'] ) ) ? esc_html( $new_instance['icon1'] ) : '';
|
210 |
-
$instance['icon2'] = ( ! empty( $new_instance['icon2'] ) ) ? esc_html( $new_instance['icon2'] ) : '';
|
211 |
-
$instance['icon3'] = ( ! empty( $new_instance['icon3'] ) ) ? esc_html( $new_instance['icon3'] ) : '';
|
212 |
-
|
213 |
-
return $instance;
|
214 |
-
}
|
215 |
-
|
216 |
-
/**
|
217 |
-
* Function for font awseome list
|
218 |
-
*
|
219 |
-
* @return mixed
|
220 |
-
*/
|
221 |
-
private function get_fontawesome_icons() {
|
222 |
-
$this->icons = array(
|
223 |
-
'fa-adjust' => 'fa-adjust',
|
224 |
-
'fa-adn' => 'fa-adn',
|
225 |
-
'fa-align-center' => 'fa-align-center',
|
226 |
-
'fa-align-justify' => 'fa-align-justify',
|
227 |
-
'fa-align-left' => 'fa-align-left',
|
228 |
-
'fa-align-right' => 'fa-align-right',
|
229 |
-
'fa-ambulance' => 'fa-ambulance',
|
230 |
-
'fa-anchor' => 'fa-anchor',
|
231 |
-
'fa-android' => 'fa-android',
|
232 |
-
'fa-angellist' => 'fa-angellist',
|
233 |
-
'fa-angle-double-down' => 'fa-angle-double-down',
|
234 |
-
'fa-angle-double-left' => 'fa-angle-double-left',
|
235 |
-
'fa-angle-double-right' => 'fa-angle-double-right',
|
236 |
-
'fa-angle-double-up' => 'fa-angle-double-up',
|
237 |
-
'fa-angle-down' => 'fa-angle-down',
|
238 |
-
'fa-angle-left' => 'fa-angle-left',
|
239 |
-
'fa-angle-right' => 'fa-angle-right',
|
240 |
-
'fa-angle-up' => 'fa-angle-up',
|
241 |
-
'fa-apple' => 'fa-apple',
|
242 |
-
'fa-archive' => 'fa-archive',
|
243 |
-
'fa-area-chart' => 'fa-area-chart',
|
244 |
-
'fa-arrow-circle-down' => 'fa-arrow-circle-down',
|
245 |
-
'fa-arrow-circle-left' => 'fa-arrow-circle-left',
|
246 |
-
'fa-arrow-circle-o-down' => 'fa-arrow-circle-o-down',
|
247 |
-
'fa-arrow-circle-o-left' => 'fa-arrow-circle-o-left',
|
248 |
-
'fa-arrow-circle-o-right' => 'fa-arrow-circle-o-right',
|
249 |
-
'fa-arrow-circle-o-up' => 'fa-arrow-circle-o-up',
|
250 |
-
'fa-arrow-circle-right' => 'fa-arrow-circle-right',
|
251 |
-
'fa-arrow-circle-up' => 'fa-arrow-circle-up',
|
252 |
-
'fa-arrow-down' => 'fa-arrow-down',
|
253 |
-
'fa-arrow-left' => 'fa-arrow-left',
|
254 |
-
'fa-arrow-right' => 'fa-arrow-right',
|
255 |
-
'fa-arrow-up' => 'fa-arrow-up',
|
256 |
-
'fa-arrows' => 'fa-arrows',
|
257 |
-
'fa-arrows-alt' => 'fa-arrows-alt',
|
258 |
-
'fa-arrows-h' => 'fa-arrows-h',
|
259 |
-
'fa-arrows-v' => 'fa-arrows-v',
|
260 |
-
'fa-asterisk' => 'fa-asterisk',
|
261 |
-
'fa-at' => 'fa-at',
|
262 |
-
'fa-backward' => 'fa-backward',
|
263 |
-
'fa-ban' => 'fa-ban',
|
264 |
-
'fa-bar-chart' => 'fa-bar-chart',
|
265 |
-
'fa-barcode' => 'fa-barcode',
|
266 |
-
'fa-bars' => 'fa-bars',
|
267 |
-
'fa-bed' => 'fa-bed',
|
268 |
-
'fa-beer' => 'fa-beer',
|
269 |
-
'fa-behance' => 'fa-behance',
|
270 |
-
'fa-behance-square' => 'fa-behance-square',
|
271 |
-
'fa-bell' => 'fa-bell',
|
272 |
-
'fa-bell-o' => 'fa-bell-o',
|
273 |
-
'fa-bell-slash' => 'fa-bell-slash',
|
274 |
-
'fa-bell-slash-o' => 'fa-bell-slash-o',
|
275 |
-
'fa-bicycle' => 'fa-bicycle',
|
276 |
-
'fa-binoculars' => 'fa-binoculars',
|
277 |
-
'fa-birthday-cake' => 'fa-birthday-cake',
|
278 |
-
'fa-bitbucket' => 'fa-bitbucket',
|
279 |
-
'fa-bitbucket-square' => 'fa-bitbucket-square',
|
280 |
-
'fa-bold' => 'fa-bold',
|
281 |
-
'fa-bolt' => 'fa-bolt',
|
282 |
-
'fa-bomb' => 'fa-bomb',
|
283 |
-
'fa-book' => 'fa-book',
|
284 |
-
'fa-bookmark' => 'fa-bookmark',
|
285 |
-
'fa-bookmark-o' => 'fa-bookmark-o',
|
286 |
-
'fa-briefcase' => 'fa-briefcase',
|
287 |
-
'fa-btc' => 'fa-btc',
|
288 |
-
'fa-bug' => 'fa-bug',
|
289 |
-
'fa-building' => 'fa-building',
|
290 |
-
'fa-building-o' => 'fa-building-o',
|
291 |
-
'fa-bullhorn' => 'fa-bullhorn',
|
292 |
-
'fa-bullseye' => 'fa-bullseye',
|
293 |
-
'fa-bus' => 'fa-bus',
|
294 |
-
'fa-buysellads' => 'fa-buysellads',
|
295 |
-
'fa-calculator' => 'fa-calculator',
|
296 |
-
'fa-calendar' => 'fa-calendar',
|
297 |
-
'fa-calendar-o' => 'fa-calendar-o',
|
298 |
-
'fa-camera' => 'fa-camera',
|
299 |
-
'fa-camera-retro' => 'fa-camera-retro',
|
300 |
-
'fa-car' => 'fa-car',
|
301 |
-
'fa-caret-down' => 'fa-caret-down',
|
302 |
-
'fa-caret-left' => 'fa-caret-left',
|
303 |
-
'fa-caret-right' => 'fa-caret-right',
|
304 |
-
'fa-caret-square-o-down' => 'fa-caret-square-o-down',
|
305 |
-
'fa-caret-square-o-left' => 'fa-caret-square-o-left',
|
306 |
-
'fa-caret-square-o-right' => 'fa-caret-square-o-right',
|
307 |
-
'fa-caret-square-o-up' => 'fa-caret-square-o-up',
|
308 |
-
'fa-caret-up' => 'fa-caret-up',
|
309 |
-
'fa-cart-arrow-down' => 'fa-cart-arrow-down',
|
310 |
-
'fa-cart-plus' => 'fa-cart-plus',
|
311 |
-
'fa-cc' => 'fa-cc',
|
312 |
-
'fa-cc-amex' => 'fa-cc-amex',
|
313 |
-
'fa-cc-discover' => 'fa-cc-discover',
|
314 |
-
'fa-cc-mastercard' => 'fa-cc-mastercard',
|
315 |
-
'fa-cc-paypal' => 'fa-cc-paypal',
|
316 |
-
'fa-cc-stripe' => 'fa-cc-stripe',
|
317 |
-
'fa-cc-visa' => 'fa-cc-visa',
|
318 |
-
'fa-certificate' => 'fa-certificate',
|
319 |
-
'fa-chain-broken' => 'fa-chain-broken',
|
320 |
-
'fa-check' => 'fa-check',
|
321 |
-
'fa-check-circle' => 'fa-check-circle',
|
322 |
-
'fa-check-circle-o' => 'fa-check-circle-o',
|
323 |
-
'fa-check-square' => 'fa-check-square',
|
324 |
-
'fa-check-square-o' => 'fa-check-square-o',
|
325 |
-
'fa-chevron-circle-down' => 'fa-chevron-circle-down',
|
326 |
-
'fa-chevron-circle-left' => 'fa-chevron-circle-left',
|
327 |
-
'fa-chevron-circle-right' => 'fa-chevron-circle-right',
|
328 |
-
'fa-chevron-circle-up' => 'fa-chevron-circle-up',
|
329 |
-
'fa-chevron-down' => 'fa-chevron-down',
|
330 |
-
'fa-chevron-left' => 'fa-chevron-left',
|
331 |
-
'fa-chevron-right' => 'fa-chevron-right',
|
332 |
-
'fa-chevron-up' => 'fa-chevron-up',
|
333 |
-
'fa-child' => 'fa-child',
|
334 |
-
'fa-circle' => 'fa-circle',
|
335 |
-
'fa-circle-o' => 'fa-circle-o',
|
336 |
-
'fa-circle-o-notch' => 'fa-circle-o-notch',
|
337 |
-
'fa-circle-thin' => 'fa-circle-thin',
|
338 |
-
'fa-clipboard' => 'fa-clipboard',
|
339 |
-
'fa-clock-o' => 'fa-clock-o',
|
340 |
-
'fa-cloud' => 'fa-cloud',
|
341 |
-
'fa-cloud-download' => 'fa-cloud-download',
|
342 |
-
'fa-cloud-upload' => 'fa-cloud-upload',
|
343 |
-
'fa-code' => 'fa-code',
|
344 |
-
'fa-code-fork' => 'fa-code-fork',
|
345 |
-
'fa-codepen' => 'fa-codepen',
|
346 |
-
'fa-coffee' => 'fa-coffee',
|
347 |
-
'fa-cog' => 'fa-cog',
|
348 |
-
'fa-cogs' => 'fa-cogs',
|
349 |
-
'fa-columns' => 'fa-columns',
|
350 |
-
'fa-comment' => 'fa-comment',
|
351 |
-
'fa-comment-o' => 'fa-comment-o',
|
352 |
-
'fa-comments' => 'fa-comments',
|
353 |
-
'fa-comments-o' => 'fa-comments-o',
|
354 |
-
'fa-compass' => 'fa-compass',
|
355 |
-
'fa-compress' => 'fa-compress',
|
356 |
-
'fa-connectdevelop' => 'fa-connectdevelop',
|
357 |
-
'fa-copyright' => 'fa-copyright',
|
358 |
-
'fa-credit-card' => 'fa-credit-card',
|
359 |
-
'fa-crop' => 'fa-crop',
|
360 |
-
'fa-crosshairs' => 'fa-crosshairs',
|
361 |
-
'fa-css3' => 'fa-css3',
|
362 |
-
'fa-cube' => 'fa-cube',
|
363 |
-
'fa-cubes' => 'fa-cubes',
|
364 |
-
'fa-cutlery' => 'fa-cutlery',
|
365 |
-
'fa-dashcube' => 'fa-dashcube',
|
366 |
-
'fa-database' => 'fa-database',
|
367 |
-
'fa-delicious' => 'fa-delicious',
|
368 |
-
'fa-desktop' => 'fa-desktop',
|
369 |
-
'fa-deviantart' => 'fa-deviantart',
|
370 |
-
'fa-diamond' => 'fa-diamond',
|
371 |
-
'fa-digg' => 'fa-digg',
|
372 |
-
'fa-dot-circle-o' => 'fa-dot-circle-o',
|
373 |
-
'fa-download' => 'fa-download',
|
374 |
-
'fa-dribbble' => 'fa-dribbble',
|
375 |
-
'fa-dropbox' => 'fa-dropbox',
|
376 |
-
'fa-drupal' => 'fa-drupal',
|
377 |
-
'fa-eject' => 'fa-eject',
|
378 |
-
'fa-ellipsis-h' => 'fa-ellipsis-h',
|
379 |
-
'fa-ellipsis-v' => 'fa-ellipsis-v',
|
380 |
-
'fa-empire' => 'fa-empire',
|
381 |
-
'fa-envelope' => 'fa-envelope',
|
382 |
-
'fa-envelope-o' => 'fa-envelope-o',
|
383 |
-
'fa-envelope-square' => 'fa-envelope-square',
|
384 |
-
'fa-eraser' => 'fa-eraser',
|
385 |
-
'fa-eur' => 'fa-eur',
|
386 |
-
'fa-exchange' => 'fa-exchange',
|
387 |
-
'fa-exclamation' => 'fa-exclamation',
|
388 |
-
'fa-exclamation-circle' => 'fa-exclamation-circle',
|
389 |
-
'fa-exclamation-triangle' => 'fa-exclamation-triangle',
|
390 |
-
'fa-expand' => 'fa-expand',
|
391 |
-
'fa-external-link' => 'fa-external-link',
|
392 |
-
'fa-external-link-square' => 'fa-external-link-square',
|
393 |
-
'fa-eye' => 'fa-eye',
|
394 |
-
'fa-eye-slash' => 'fa-eye-slash',
|
395 |
-
'fa-eyedropper' => 'fa-eyedropper',
|
396 |
-
'fa-facebook' => 'fa-facebook',
|
397 |
-
'fa-facebook-official' => 'fa-facebook-official',
|
398 |
-
'fa-facebook-square' => 'fa-facebook-square',
|
399 |
-
'fa-fast-backward' => 'fa-fast-backward',
|
400 |
-
'fa-fast-forward' => 'fa-fast-forward',
|
401 |
-
'fa-fax' => 'fa-fax',
|
402 |
-
'fa-female' => 'fa-female',
|
403 |
-
'fa-fighter-jet' => 'fa-fighter-jet',
|
404 |
-
'fa-file' => 'fa-file',
|
405 |
-
'fa-file-archive-o' => 'fa-file-archive-o',
|
406 |
-
'fa-file-audio-o' => 'fa-file-audio-o',
|
407 |
-
'fa-file-code-o' => 'fa-file-code-o',
|
408 |
-
'fa-file-excel-o' => 'fa-file-excel-o',
|
409 |
-
'fa-file-image-o' => 'fa-file-image-o',
|
410 |
-
'fa-file-o' => 'fa-file-o',
|
411 |
-
'fa-file-pdf-o' => 'fa-file-pdf-o',
|
412 |
-
'fa-file-powerpoint-o' => 'fa-file-powerpoint-o',
|
413 |
-
'fa-file-text' => 'fa-file-text',
|
414 |
-
'fa-file-text-o' => 'fa-file-text-o',
|
415 |
-
'fa-file-video-o' => 'fa-file-video-o',
|
416 |
-
'fa-file-word-o' => 'fa-file-word-o',
|
417 |
-
'fa-files-o' => 'fa-files-o',
|
418 |
-
'fa-film' => 'fa-film',
|
419 |
-
'fa-filter' => 'fa-filter',
|
420 |
-
'fa-fire' => 'fa-fire',
|
421 |
-
'fa-fire-extinguisher' => 'fa-fire-extinguisher',
|
422 |
-
'fa-flag' => 'fa-flag',
|
423 |
-
'fa-flag-checkered' => 'fa-flag-checkered',
|
424 |
-
'fa-flag-o' => 'fa-flag-o',
|
425 |
-
'fa-flask' => 'fa-flask',
|
426 |
-
'fa-flickr' => 'fa-flickr',
|
427 |
-
'fa-floppy-o' => 'fa-floppy-o',
|
428 |
-
'fa-folder' => 'fa-folder',
|
429 |
-
'fa-folder-o' => 'fa-folder-o',
|
430 |
-
'fa-folder-open' => 'fa-folder-open',
|
431 |
-
'fa-folder-open-o' => 'fa-folder-open-o',
|
432 |
-
'fa-font' => 'fa-font',
|
433 |
-
'fa-forumbee' => 'fa-forumbee',
|
434 |
-
'fa-forward' => 'fa-forward',
|
435 |
-
'fa-foursquare' => 'fa-foursquare',
|
436 |
-
'fa-frown-o' => 'fa-frown-o',
|
437 |
-
'fa-futbol-o' => 'fa-futbol-o',
|
438 |
-
'fa-gamepad' => 'fa-gamepad',
|
439 |
-
'fa-gavel' => 'fa-gavel',
|
440 |
-
'fa-gbp' => 'fa-gbp',
|
441 |
-
'fa-gift' => 'fa-gift',
|
442 |
-
'fa-git' => 'fa-git',
|
443 |
-
'fa-git-square' => 'fa-git-square',
|
444 |
-
'fa-github' => 'fa-github',
|
445 |
-
'fa-github-alt' => 'fa-github-alt',
|
446 |
-
'fa-github-square' => 'fa-github-square',
|
447 |
-
'fa-glass' => 'fa-glass',
|
448 |
-
'fa-globe' => 'fa-globe',
|
449 |
-
'fa-google' => 'fa-google',
|
450 |
-
'fa-google-plus' => 'fa-google-plus',
|
451 |
-
'fa-google-plus-square' => 'fa-google-plus-square',
|
452 |
-
'fa-google-wallet' => 'fa-google-wallet',
|
453 |
-
'fa-graduation-cap' => 'fa-graduation-cap',
|
454 |
-
'fa-gratipay' => 'fa-gratipay',
|
455 |
-
'fa-h-square' => 'fa-h-square',
|
456 |
-
'fa-hacker-news' => 'fa-hacker-news',
|
457 |
-
'fa-hand-o-down' => 'fa-hand-o-down',
|
458 |
-
'fa-hand-o-left' => 'fa-hand-o-left',
|
459 |
-
'fa-hand-o-right' => 'fa-hand-o-right',
|
460 |
-
'fa-hand-o-up' => 'fa-hand-o-up',
|
461 |
-
'fa-hdd-o' => 'fa-hdd-o',
|
462 |
-
'fa-header' => 'fa-header',
|
463 |
-
'fa-headphones' => 'fa-headphones',
|
464 |
-
'fa-heart' => 'fa-heart',
|
465 |
-
'fa-heart-o' => 'fa-heart-o',
|
466 |
-
'fa-heartbeat' => 'fa-heartbeat',
|
467 |
-
'fa-history' => 'fa-history',
|
468 |
-
'fa-home' => 'fa-home',
|
469 |
-
'fa-hospital-o' => 'fa-hospital-o',
|
470 |
-
'fa-html5' => 'fa-html5',
|
471 |
-
'fa-ils' => 'fa-ils',
|
472 |
-
'fa-inbox' => 'fa-inbox',
|
473 |
-
'fa-indent' => 'fa-indent',
|
474 |
-
'fa-info' => 'fa-info',
|
475 |
-
'fa-info-circle' => 'fa-info-circle',
|
476 |
-
'fa-inr' => 'fa-inr',
|
477 |
-
'fa-instagram' => 'fa-instagram',
|
478 |
-
'fa-ioxhost' => 'fa-ioxhost',
|
479 |
-
'fa-italic' => 'fa-italic',
|
480 |
-
'fa-joomla' => 'fa-joomla',
|
481 |
-
'fa-jpy' => 'fa-jpy',
|
482 |
-
'fa-jsfiddle' => 'fa-jsfiddle',
|
483 |
-
'fa-key' => 'fa-key',
|
484 |
-
'fa-keyboard-o' => 'fa-keyboard-o',
|
485 |
-
'fa-krw' => 'fa-krw',
|
486 |
-
'fa-language' => 'fa-language',
|
487 |
-
'fa-laptop' => 'fa-laptop',
|
488 |
-
'fa-lastfm' => 'fa-lastfm',
|
489 |
-
'fa-lastfm-square' => 'fa-lastfm-square',
|
490 |
-
'fa-leaf' => 'fa-leaf',
|
491 |
-
'fa-leanpub' => 'fa-leanpub',
|
492 |
-
'fa-legal' => 'fa-legal',
|
493 |
-
'fa-lemon-o' => 'fa-lemon-o',
|
494 |
-
'fa-level-down' => 'fa-level-down',
|
495 |
-
'fa-level-up' => 'fa-level-up',
|
496 |
-
'fa-life-bouy' => 'fa-life-bouy',
|
497 |
-
'fa-life-ring' => 'fa-life-ring',
|
498 |
-
'fa-life-saver' => 'fa-life-saver',
|
499 |
-
'fa-lightbulb-o' => 'fa-lightbulb-o',
|
500 |
-
'fa-line-chart' => 'fa-line-chart',
|
501 |
-
'fa-link' => 'fa-link',
|
502 |
-
'fa-linkedin' => 'fa-linkedin',
|
503 |
-
'fa-linkedin-square' => 'fa-linkedin-square',
|
504 |
-
'fa-linux' => 'fa-linux',
|
505 |
-
'fa-list' => 'fa-list',
|
506 |
-
'fa-list-alt' => 'fa-list-alt',
|
507 |
-
'fa-list-ol' => 'fa-list-ol',
|
508 |
-
'fa-list-ul' => 'fa-list-ul',
|
509 |
-
'fa-location-arrow' => 'fa-location-arrow',
|
510 |
-
'fa-lock' => 'fa-lock',
|
511 |
-
'fa-long-arrow-down' => 'fa-long-arrow-down',
|
512 |
-
'fa-long-arrow-left' => 'fa-long-arrow-left',
|
513 |
-
'fa-long-arrow-right' => 'fa-long-arrow-right',
|
514 |
-
'fa-long-arrow-up' => 'fa-long-arrow-up',
|
515 |
-
'fa-magic' => 'fa-magic',
|
516 |
-
'fa-magnet' => 'fa-magnet',
|
517 |
-
'fa-male' => 'fa-male',
|
518 |
-
'fa-map-marker' => 'fa-map-marker',
|
519 |
-
'fa-mars' => 'fa-mars',
|
520 |
-
'fa-mars-double' => 'fa-mars-double',
|
521 |
-
'fa-mars-stroke' => 'fa-mars-stroke',
|
522 |
-
'fa-mars-stroke-h' => 'fa-mars-stroke-h',
|
523 |
-
'fa-mars-stroke-v' => 'fa-mars-stroke-v',
|
524 |
-
'fa-maxcdn' => 'fa-maxcdn',
|
525 |
-
'fa-meanpath' => 'fa-meanpath',
|
526 |
-
'fa-medium' => 'fa-medium',
|
527 |
-
'fa-medkit' => 'fa-medkit',
|
528 |
-
'fa-meh-o' => 'fa-meh-o',
|
529 |
-
'fa-mercury' => 'fa-mercury',
|
530 |
-
'fa-microphone' => 'fa-microphone',
|
531 |
-
'fa-microphone-slash' => 'fa-microphone-slash',
|
532 |
-
'fa-minus' => 'fa-minus',
|
533 |
-
'fa-minus-circle' => 'fa-minus-circle',
|
534 |
-
'fa-minus-square' => 'fa-minus-square',
|
535 |
-
'fa-minus-square-o' => 'fa-minus-square-o',
|
536 |
-
'fa-mobile' => 'fa-mobile',
|
537 |
-
'fa-money' => 'fa-money',
|
538 |
-
'fa-moon-o' => 'fa-moon-o',
|
539 |
-
'fa-motorcycle' => 'fa-motorcycle',
|
540 |
-
'fa-music' => 'fa-music',
|
541 |
-
'fa-neuter' => 'fa-neuter',
|
542 |
-
'fa-newspaper-o' => 'fa-newspaper-o',
|
543 |
-
'fa-openid' => 'fa-openid',
|
544 |
-
'fa-outdent' => 'fa-outdent',
|
545 |
-
'fa-pagelines' => 'fa-pagelines',
|
546 |
-
'fa-paint-brush' => 'fa-paint-brush',
|
547 |
-
'fa-paper-plane' => 'fa-paper-plane',
|
548 |
-
'fa-paper-plane-o' => 'fa-paper-plane-o',
|
549 |
-
'fa-paperclip' => 'fa-paperclip',
|
550 |
-
'fa-paragraph' => 'fa-paragraph',
|
551 |
-
'fa-pause' => 'fa-pause',
|
552 |
-
'fa-paw' => 'fa-paw',
|
553 |
-
'fa-paypal' => 'fa-paypal',
|
554 |
-
'fa-pencil' => 'fa-pencil',
|
555 |
-
'fa-pencil-square' => 'fa-pencil-square',
|
556 |
-
'fa-pencil-square-o' => 'fa-pencil-square-o',
|
557 |
-
'fa-phone' => 'fa-phone',
|
558 |
-
'fa-phone-square' => 'fa-phone-square',
|
559 |
-
'fa-picture-o' => 'fa-picture-o',
|
560 |
-
'fa-pie-chart' => 'fa-pie-chart',
|
561 |
-
'fa-pied-piper' => 'fa-pied-piper',
|
562 |
-
'fa-pied-piper-alt' => 'fa-pied-piper-alt',
|
563 |
-
'fa-pinterest' => 'fa-pinterest',
|
564 |
-
'fa-pinterest-p' => 'fa-pinterest-p',
|
565 |
-
'fa-pinterest-square' => 'fa-pinterest-square',
|
566 |
-
'fa-plane' => 'fa-plane',
|
567 |
-
'fa-play' => 'fa-play',
|
568 |
-
'fa-play-circle' => 'fa-play-circle',
|
569 |
-
'fa-play-circle-o' => 'fa-play-circle-o',
|
570 |
-
'fa-plug' => 'fa-plug',
|
571 |
-
'fa-plus' => 'fa-plus',
|
572 |
-
'fa-plus-circle' => 'fa-plus-circle',
|
573 |
-
'fa-plus-square' => 'fa-plus-square',
|
574 |
-
'fa-plus-square-o' => 'fa-plus-square-o',
|
575 |
-
'fa-power-off' => 'fa-power-off',
|
576 |
-
'fa-print' => 'fa-print',
|
577 |
-
'fa-puzzle-piece' => 'fa-puzzle-piece',
|
578 |
-
'fa-qq' => 'fa-qq',
|
579 |
-
'fa-qrcode' => 'fa-qrcode',
|
580 |
-
'fa-question' => 'fa-question',
|
581 |
-
'fa-question-circle' => 'fa-question-circle',
|
582 |
-
'fa-quote-left' => 'fa-quote-left',
|
583 |
-
'fa-quote-right' => 'fa-quote-right',
|
584 |
-
'fa-random' => 'fa-random',
|
585 |
-
'fa-rebel' => 'fa-rebel',
|
586 |
-
'fa-recycle' => 'fa-recycle',
|
587 |
-
'fa-reddit' => 'fa-reddit',
|
588 |
-
'fa-reddit-square' => 'fa-reddit-square',
|
589 |
-
'fa-refresh' => 'fa-refresh',
|
590 |
-
'fa-renren' => 'fa-renren',
|
591 |
-
'fa-repeat' => 'fa-repeat',
|
592 |
-
'fa-reply' => 'fa-reply',
|
593 |
-
'fa-reply-all' => 'fa-reply-all',
|
594 |
-
'fa-retweet' => 'fa-retweet',
|
595 |
-
'fa-road' => 'fa-road',
|
596 |
-
'fa-rocket' => 'fa-rocket',
|
597 |
-
'fa-rss' => 'fa-rss',
|
598 |
-
'fa-rss-square' => 'fa-rss-square',
|
599 |
-
'fa-rub' => 'fa-rub',
|
600 |
-
'fa-scissors' => 'fa-scissors',
|
601 |
-
'fa-search' => 'fa-search',
|
602 |
-
'fa-search-minus' => 'fa-search-minus',
|
603 |
-
'fa-search-plus' => 'fa-search-plus',
|
604 |
-
'fa-sellsy' => 'fa-sellsy',
|
605 |
-
'fa-server' => 'fa-server',
|
606 |
-
'fa-share' => 'fa-share',
|
607 |
-
'fa-share-alt' => 'fa-share-alt',
|
608 |
-
'fa-share-alt-square' => 'fa-share-alt-square',
|
609 |
-
'fa-share-square' => 'fa-share-square',
|
610 |
-
'fa-share-square-o' => 'fa-share-square-o',
|
611 |
-
'fa-shield' => 'fa-shield',
|
612 |
-
'fa-ship' => 'fa-ship',
|
613 |
-
'fa-shirtsinbulk' => 'fa-shirtsinbulk',
|
614 |
-
'fa-shopping-cart' => 'fa-shopping-cart',
|
615 |
-
'fa-sign-in' => 'fa-sign-in',
|
616 |
-
'fa-sign-out' => 'fa-sign-out',
|
617 |
-
'fa-signal' => 'fa-signal',
|
618 |
-
'fa-simplybuilt' => 'fa-simplybuilt',
|
619 |
-
'fa-sitemap' => 'fa-sitemap',
|
620 |
-
'fa-skyatlas' => 'fa-skyatlas',
|
621 |
-
'fa-skype' => 'fa-skype',
|
622 |
-
'fa-slack' => 'fa-slack',
|
623 |
-
'fa-sliders' => 'fa-sliders',
|
624 |
-
'fa-slideshare' => 'fa-slideshare',
|
625 |
-
'fa-smile-o' => 'fa-smile-o',
|
626 |
-
'fa-sort' => 'fa-sort',
|
627 |
-
'fa-sort-alpha-asc' => 'fa-sort-alpha-asc',
|
628 |
-
'fa-sort-alpha-desc' => 'fa-sort-alpha-desc',
|
629 |
-
'fa-sort-amount-asc' => 'fa-sort-amount-asc',
|
630 |
-
'fa-sort-amount-desc' => 'fa-sort-amount-desc',
|
631 |
-
'fa-sort-asc' => 'fa-sort-asc',
|
632 |
-
'fa-sort-desc' => 'fa-sort-desc',
|
633 |
-
'fa-sort-numeric-asc' => 'fa-sort-numeric-asc',
|
634 |
-
'fa-sort-numeric-desc' => 'fa-sort-numeric-desc',
|
635 |
-
'fa-soundcloud' => 'fa-soundcloud',
|
636 |
-
'fa-space-shuttle' => 'fa-space-shuttle',
|
637 |
-
'fa-spinner' => 'fa-spinner',
|
638 |
-
'fa-spoon' => 'fa-spoon',
|
639 |
-
'fa-spotify' => 'fa-spotify',
|
640 |
-
'fa-square' => 'fa-square',
|
641 |
-
'fa-square-o' => 'fa-square-o',
|
642 |
-
'fa-stack-exchange' => 'fa-stack-exchange',
|
643 |
-
'fa-stack-overflow' => 'fa-stack-overflow',
|
644 |
-
'fa-star' => 'fa-star',
|
645 |
-
'fa-star-half' => 'fa-star-half',
|
646 |
-
'fa-star-half-o' => 'fa-star-half-o',
|
647 |
-
'fa-star-o' => 'fa-star-o',
|
648 |
-
'fa-steam' => 'fa-steam',
|
649 |
-
'fa-steam-square' => 'fa-steam-square',
|
650 |
-
'fa-step-backward' => 'fa-step-backward',
|
651 |
-
'fa-step-forward' => 'fa-step-forward',
|
652 |
-
'fa-stethoscope' => 'fa-stethoscope',
|
653 |
-
'fa-stop' => 'fa-stop',
|
654 |
-
'fa-street-view' => 'fa-street-view',
|
655 |
-
'fa-strikethrough' => 'fa-strikethrough',
|
656 |
-
'fa-stumbleupon' => 'fa-stumbleupon',
|
657 |
-
'fa-stumbleupon-circle' => 'fa-stumbleupon-circle',
|
658 |
-
'fa-subscript' => 'fa-subscript',
|
659 |
-
'fa-subway' => 'fa-subway',
|
660 |
-
'fa-suitcase' => 'fa-suitcase',
|
661 |
-
'fa-sun-o' => 'fa-sun-o',
|
662 |
-
'fa-superscript' => 'fa-superscript',
|
663 |
-
'fa-table' => 'fa-table',
|
664 |
-
'fa-tablet' => 'fa-tablet',
|
665 |
-
'fa-tachometer' => 'fa-tachometer',
|
666 |
-
'fa-tag' => 'fa-tag',
|
667 |
-
'fa-tags' => 'fa-tags',
|
668 |
-
'fa-tasks' => 'fa-tasks',
|
669 |
-
'fa-taxi' => 'fa-taxi',
|
670 |
-
'fa-tencent-weibo' => 'fa-tencent-weibo',
|
671 |
-
'fa-terminal' => 'fa-terminal',
|
672 |
-
'fa-text-height' => 'fa-text-height',
|
673 |
-
'fa-text-width' => 'fa-text-width',
|
674 |
-
'fa-th' => 'fa-th',
|
675 |
-
'fa-th-large' => 'fa-th-large',
|
676 |
-
'fa-th-list' => 'fa-th-list',
|
677 |
-
'fa-thumb-tack' => 'fa-thumb-tack',
|
678 |
-
'fa-thumbs-down' => 'fa-thumbs-down',
|
679 |
-
'fa-thumbs-o-down' => 'fa-thumbs-o-down',
|
680 |
-
'fa-thumbs-o-up' => 'fa-thumbs-o-up',
|
681 |
-
'fa-thumbs-up' => 'fa-thumbs-up',
|
682 |
-
'fa-ticket' => 'fa-ticket',
|
683 |
-
'fa-times' => 'fa-times',
|
684 |
-
'fa-times-circle' => 'fa-times-circle',
|
685 |
-
'fa-times-circle-o' => 'fa-times-circle-o',
|
686 |
-
'fa-tint' => 'fa-tint',
|
687 |
-
'fa-toggle-off' => 'fa-toggle-off',
|
688 |
-
'fa-toggle-on' => 'fa-toggle-on',
|
689 |
-
'fa-train' => 'fa-train',
|
690 |
-
'fa-transgender' => 'fa-transgender',
|
691 |
-
'fa-transgender-alt' => 'fa-transgender-alt',
|
692 |
-
'fa-trash' => 'fa-trash',
|
693 |
-
'fa-trash-o' => 'fa-trash-o',
|
694 |
-
'fa-tree' => 'fa-tree',
|
695 |
-
'fa-trello' => 'fa-trello',
|
696 |
-
'fa-trophy' => 'fa-trophy',
|
697 |
-
'fa-truck' => 'fa-truck',
|
698 |
-
'fa-try' => 'fa-try',
|
699 |
-
'fa-tty' => 'fa-tty',
|
700 |
-
'fa-tumblr' => 'fa-tumblr',
|
701 |
-
'fa-tumblr-square' => 'fa-tumblr-square',
|
702 |
-
'fa-twitch' => 'fa-twitch',
|
703 |
-
'fa-twitter' => 'fa-twitter',
|
704 |
-
'fa-twitter-square' => 'fa-twitter-square',
|
705 |
-
'fa-umbrella' => 'fa-umbrella',
|
706 |
-
'fa-underline' => 'fa-underline',
|
707 |
-
'fa-undo' => 'fa-undo',
|
708 |
-
'fa-university' => 'fa-university',
|
709 |
-
'fa-unlock' => 'fa-unlock',
|
710 |
-
'fa-unlock-alt' => 'fa-unlock-alt',
|
711 |
-
'fa-upload' => 'fa-upload',
|
712 |
-
'fa-usd' => 'fa-usd',
|
713 |
-
'fa-user' => 'fa-user',
|
714 |
-
'fa-user-md' => 'fa-user-md',
|
715 |
-
'fa-user-plus' => 'fa-user-plus',
|
716 |
-
'fa-user-secret' => 'fa-user-secret',
|
717 |
-
'fa-user-times' => 'fa-user-times',
|
718 |
-
'fa-users' => 'fa-users',
|
719 |
-
'fa-venus' => 'fa-venus',
|
720 |
-
'fa-venus-double' => 'fa-venus-double',
|
721 |
-
'fa-venus-mars' => 'fa-venus-mars',
|
722 |
-
'fa-viacoin' => 'fa-viacoin',
|
723 |
-
'fa-video-camera' => 'fa-video-camera',
|
724 |
-
'fa-vimeo-square' => 'fa-vimeo-square',
|
725 |
-
'fa-vine' => 'fa-vine',
|
726 |
-
'fa-vk' => 'fa-vk',
|
727 |
-
'fa-volume-down' => 'fa-volume-down',
|
728 |
-
'fa-volume-off' => 'fa-volume-off',
|
729 |
-
'fa-volume-up' => 'fa-volume-up',
|
730 |
-
'fa-weibo' => 'fa-weibo',
|
731 |
-
'fa-weixin' => 'fa-weixin',
|
732 |
-
'fa-whatsapp' => 'fa-whatsapp',
|
733 |
-
'fa-wheelchair' => 'fa-wheelchair',
|
734 |
-
'fa-wifi' => 'fa-wifi',
|
735 |
-
'fa-windows' => 'fa-windows',
|
736 |
-
'fa-wordpress' => 'fa-wordpress',
|
737 |
-
'fa-wrench' => 'fa-wrench',
|
738 |
-
'fa-xing' => 'fa-xing',
|
739 |
-
'fa-xing-square' => 'fa-xing-square',
|
740 |
-
'fa-yahoo' => 'fa-yahoo',
|
741 |
-
'fa-yelp' => 'fa-yelp',
|
742 |
-
'fa-youtube' => 'fa-youtube',
|
743 |
-
'fa-youtube-play' => 'fa-youtube-play',
|
744 |
-
'fa-youtube-square' => 'fa-youtube-square',
|
745 |
-
);
|
746 |
-
foreach ( $this->icons as $icon ) {
|
747 |
-
$this->all_icons[ $icon ] = $icon;
|
748 |
-
}
|
749 |
-
|
750 |
-
return $this->all_icons;
|
751 |
-
}
|
752 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Homepage features section Widget
|
5 |
+
* Shapely Theme
|
6 |
+
*/
|
7 |
+
class Shapely_Home_Features extends WP_Widget {
|
8 |
+
|
9 |
+
private $defaults = array();
|
10 |
+
private $all_icons = array();
|
11 |
+
private $icons = array();
|
12 |
+
|
13 |
+
function __construct() {
|
14 |
+
|
15 |
+
$widget_ops = array(
|
16 |
+
'classname' => 'shapely_home_features',
|
17 |
+
'description' => esc_html__( 'Widget to set Features in Home Section', 'shapely-companion' ),
|
18 |
+
'customize_selective_refresh' => true,
|
19 |
+
);
|
20 |
+
|
21 |
+
parent::__construct( 'shapely_home_features', esc_html__( '[Shapely] Features Section For FrontPage', 'shapely-companion' ), $widget_ops );
|
22 |
+
|
23 |
+
$this->defaults = array(
|
24 |
+
'title' => '',
|
25 |
+
'title1' => '',
|
26 |
+
'title2' => '',
|
27 |
+
'title3' => '',
|
28 |
+
'icon1' => 'fa fa-cogs',
|
29 |
+
'icon2' => 'fa fa-heartbeat',
|
30 |
+
'icon3' => 'fa fa-paper-plane-o',
|
31 |
+
'body_content' => '',
|
32 |
+
'body_content1' => '',
|
33 |
+
'body_content2' => '',
|
34 |
+
'body_content3' => '',
|
35 |
+
);
|
36 |
+
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @param array $args
|
41 |
+
* @param array $instance
|
42 |
+
*/
|
43 |
+
function widget( $args, $instance ) {
|
44 |
+
|
45 |
+
$instance = wp_parse_args( $instance, $this->defaults );
|
46 |
+
|
47 |
+
$title[0] = $instance['title'];
|
48 |
+
$body_content[0] = $instance['body_content'];
|
49 |
+
|
50 |
+
$title[1] = $instance['title1'];
|
51 |
+
$title[2] = $instance['title2'];
|
52 |
+
$title[3] = $instance['title3'];
|
53 |
+
|
54 |
+
$icon[1] = $instance['icon1'];
|
55 |
+
$icon[2] = $instance['icon2'];
|
56 |
+
$icon[3] = $instance['icon3'];
|
57 |
+
|
58 |
+
$body_content[1] = $instance['body_content1'];
|
59 |
+
$body_content[2] = $instance['body_content2'];
|
60 |
+
$body_content[3] = $instance['body_content3'];
|
61 |
+
|
62 |
+
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Widget Content
|
66 |
+
*/
|
67 |
+
?>
|
68 |
+
<section>
|
69 |
+
<div class="container">
|
70 |
+
<div class="row">
|
71 |
+
<div class="col-sm-12 text-center">
|
72 |
+
<h3 class="mb16"><?php echo wp_kses_post( $title[0] ); ?></h3>
|
73 |
+
<p class="mb64"><?php echo wp_kses_post( $body_content[0] ); ?></p>
|
74 |
+
</div>
|
75 |
+
</div>
|
76 |
+
<!--end of row-->
|
77 |
+
<div class="row">
|
78 |
+
<?php
|
79 |
+
for ( $i = 1; $i < 4; $i ++ ) {
|
80 |
+
if ( '' != $title[ $i ] ) {
|
81 |
+
?>
|
82 |
+
<div class="col-sm-4">
|
83 |
+
<div class="feature feature-1">
|
84 |
+
<div class="text-center">
|
85 |
+
<i class="<?php echo esc_attr( $icon[ $i ] ); ?>"></i>
|
86 |
+
<h4><?php echo wp_kses_post( $title[ $i ] ); ?></h4>
|
87 |
+
</div>
|
88 |
+
<p><?php echo wp_kses_post( $body_content[ $i ] ); ?></p>
|
89 |
+
</div>
|
90 |
+
<!--end of feature-->
|
91 |
+
</div>
|
92 |
+
<?php
|
93 |
+
}
|
94 |
+
}
|
95 |
+
?>
|
96 |
+
</div>
|
97 |
+
<!--end of row-->
|
98 |
+
</div>
|
99 |
+
<!--end of container-->
|
100 |
+
</section>
|
101 |
+
|
102 |
+
<?php
|
103 |
+
|
104 |
+
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
105 |
+
}
|
106 |
+
|
107 |
+
|
108 |
+
/**
|
109 |
+
* @param array $instance
|
110 |
+
*
|
111 |
+
* @return string|void
|
112 |
+
*/
|
113 |
+
function form( $instance ) {
|
114 |
+
|
115 |
+
$instance = wp_parse_args( $instance, $this->defaults );
|
116 |
+
?>
|
117 |
+
|
118 |
+
<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
|
119 |
+
<?php echo esc_html__( 'Title ', 'shapely-companion' ); ?>
|
120 |
+
</label>
|
121 |
+
|
122 |
+
<input type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" class="widefat" />
|
123 |
+
</p>
|
124 |
+
|
125 |
+
<p class="shapely-editor-container">
|
126 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'body_content' ) ); ?>">
|
127 |
+
<?php echo esc_html__( 'Content ', 'shapely-companion' ); ?>
|
128 |
+
</label>
|
129 |
+
|
130 |
+
<textarea name="<?php echo esc_attr( $this->get_field_name( 'body_content' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'body_content' ) ); ?>" class="widefat">
|
131 |
+
<?php echo wp_kses_post( nl2br( $instance['body_content'] ) ); ?>
|
132 |
+
</textarea>
|
133 |
+
</p>
|
134 |
+
|
135 |
+
<?php for ( $i = 1; $i < 4; $i ++ ) { ?>
|
136 |
+
<br>
|
137 |
+
<b>
|
138 |
+
<?php
|
139 |
+
// Translators: Number of feature icons
|
140 |
+
echo sprintf( esc_html__( 'Feature %s', 'shapely-companion' ), esc_html( $i ) );
|
141 |
+
?>
|
142 |
+
</b>
|
143 |
+
|
144 |
+
<p>
|
145 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'title' . $i ) ); ?>">
|
146 |
+
<?php echo esc_html__( 'Title ', 'shapely-companion' ); ?>
|
147 |
+
</label>
|
148 |
+
<input type="text" value="<?php echo esc_attr( $instance[ 'title' . $i ] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' . $i ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'title' . $i ) ); ?>" class="widefat" />
|
149 |
+
</p>
|
150 |
+
|
151 |
+
<p>
|
152 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'icon' . $i ) ); ?>">
|
153 |
+
<?php echo esc_html__( 'Icon( Font Awsome ) ', 'shapely-companion' ); ?>
|
154 |
+
</label>
|
155 |
+
|
156 |
+
<?php
|
157 |
+
|
158 |
+
$fa_icons = $this->get_fontawesome_icons();
|
159 |
+
$icon = ( isset( $instance[ 'icon' . $i ] ) && '' != $instance[ 'icon' . $i ] ) ? esc_html( $instance[ 'icon' . $i ] ) : '';
|
160 |
+
?>
|
161 |
+
|
162 |
+
<select class="shapely-icon" id="<?php echo esc_attr( $this->get_field_id( 'icon' . $i ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'icon' . $i ) ); ?>">
|
163 |
+
<option value="">
|
164 |
+
<?php echo esc_html__( 'Select Icon', 'shapely-companion' ); ?>
|
165 |
+
</option>
|
166 |
+
<?php foreach ( $fa_icons as $key => $get_fontawesome_icon ) : ?>
|
167 |
+
<option value="fa <?php echo esc_attr( $key ); ?>" <?php selected( $icon, 'fa ' . $key ); ?>>
|
168 |
+
<?php echo esc_html( $get_fontawesome_icon ); ?>
|
169 |
+
</option>
|
170 |
+
<?php endforeach; ?>
|
171 |
+
</select>
|
172 |
+
<span class="<?php echo esc_attr( $icon ); ?>" style="font-size: 24px;vertical-align: middle;margin-left: 10px;"></span>
|
173 |
+
</p>
|
174 |
+
|
175 |
+
<p class="shapely-editor-container">
|
176 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'body_content' . $i ) ); ?>"><?php echo esc_html__( 'Content ', 'shapely-companion' ); ?></label>
|
177 |
+
|
178 |
+
<textarea name="<?php echo esc_attr( $this->get_field_name( 'body_content' . $i ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'body_content' . $i ) ); ?>" class="widefat">
|
179 |
+
<?php echo wp_kses_post( nl2br( $instance[ 'body_content' . $i ] ) ); ?>
|
180 |
+
</textarea>
|
181 |
+
</p>
|
182 |
+
<?php
|
183 |
+
}
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Sanitize widget form values as they are saved.
|
188 |
+
*
|
189 |
+
* @see WP_Widget::update()
|
190 |
+
*
|
191 |
+
* @param array $new_instance Values just sent to be saved.
|
192 |
+
* @param array $old_instance Previously saved values from database.
|
193 |
+
*
|
194 |
+
* @return array Updated safe values to be saved.
|
195 |
+
*/
|
196 |
+
public function update( $new_instance, $old_instance ) {
|
197 |
+
$instance = array();
|
198 |
+
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? wp_kses_post( $new_instance['title'] ) : '';
|
199 |
+
$instance['body_content'] = ( ! empty( $new_instance['body_content'] ) ) ? wp_kses_post( $new_instance['body_content'] ) : '';
|
200 |
+
|
201 |
+
$instance['title1'] = ( ! empty( $new_instance['title1'] ) ) ? wp_kses_post( $new_instance['title1'] ) : '';
|
202 |
+
$instance['title2'] = ( ! empty( $new_instance['title2'] ) ) ? wp_kses_post( $new_instance['title2'] ) : '';
|
203 |
+
$instance['title3'] = ( ! empty( $new_instance['title3'] ) ) ? wp_kses_post( $new_instance['title3'] ) : '';
|
204 |
+
|
205 |
+
$instance['body_content1'] = ( ! empty( $new_instance['body_content1'] ) ) ? wp_kses_post( $new_instance['body_content1'] ) : '';
|
206 |
+
$instance['body_content2'] = ( ! empty( $new_instance['body_content2'] ) ) ? wp_kses_post( $new_instance['body_content2'] ) : '';
|
207 |
+
$instance['body_content3'] = ( ! empty( $new_instance['body_content3'] ) ) ? wp_kses_post( $new_instance['body_content3'] ) : '';
|
208 |
+
|
209 |
+
$instance['icon1'] = ( ! empty( $new_instance['icon1'] ) ) ? esc_html( $new_instance['icon1'] ) : '';
|
210 |
+
$instance['icon2'] = ( ! empty( $new_instance['icon2'] ) ) ? esc_html( $new_instance['icon2'] ) : '';
|
211 |
+
$instance['icon3'] = ( ! empty( $new_instance['icon3'] ) ) ? esc_html( $new_instance['icon3'] ) : '';
|
212 |
+
|
213 |
+
return $instance;
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Function for font awseome list
|
218 |
+
*
|
219 |
+
* @return mixed
|
220 |
+
*/
|
221 |
+
private function get_fontawesome_icons() {
|
222 |
+
$this->icons = array(
|
223 |
+
'fa-adjust' => 'fa-adjust',
|
224 |
+
'fa-adn' => 'fa-adn',
|
225 |
+
'fa-align-center' => 'fa-align-center',
|
226 |
+
'fa-align-justify' => 'fa-align-justify',
|
227 |
+
'fa-align-left' => 'fa-align-left',
|
228 |
+
'fa-align-right' => 'fa-align-right',
|
229 |
+
'fa-ambulance' => 'fa-ambulance',
|
230 |
+
'fa-anchor' => 'fa-anchor',
|
231 |
+
'fa-android' => 'fa-android',
|
232 |
+
'fa-angellist' => 'fa-angellist',
|
233 |
+
'fa-angle-double-down' => 'fa-angle-double-down',
|
234 |
+
'fa-angle-double-left' => 'fa-angle-double-left',
|
235 |
+
'fa-angle-double-right' => 'fa-angle-double-right',
|
236 |
+
'fa-angle-double-up' => 'fa-angle-double-up',
|
237 |
+
'fa-angle-down' => 'fa-angle-down',
|
238 |
+
'fa-angle-left' => 'fa-angle-left',
|
239 |
+
'fa-angle-right' => 'fa-angle-right',
|
240 |
+
'fa-angle-up' => 'fa-angle-up',
|
241 |
+
'fa-apple' => 'fa-apple',
|
242 |
+
'fa-archive' => 'fa-archive',
|
243 |
+
'fa-area-chart' => 'fa-area-chart',
|
244 |
+
'fa-arrow-circle-down' => 'fa-arrow-circle-down',
|
245 |
+
'fa-arrow-circle-left' => 'fa-arrow-circle-left',
|
246 |
+
'fa-arrow-circle-o-down' => 'fa-arrow-circle-o-down',
|
247 |
+
'fa-arrow-circle-o-left' => 'fa-arrow-circle-o-left',
|
248 |
+
'fa-arrow-circle-o-right' => 'fa-arrow-circle-o-right',
|
249 |
+
'fa-arrow-circle-o-up' => 'fa-arrow-circle-o-up',
|
250 |
+
'fa-arrow-circle-right' => 'fa-arrow-circle-right',
|
251 |
+
'fa-arrow-circle-up' => 'fa-arrow-circle-up',
|
252 |
+
'fa-arrow-down' => 'fa-arrow-down',
|
253 |
+
'fa-arrow-left' => 'fa-arrow-left',
|
254 |
+
'fa-arrow-right' => 'fa-arrow-right',
|
255 |
+
'fa-arrow-up' => 'fa-arrow-up',
|
256 |
+
'fa-arrows' => 'fa-arrows',
|
257 |
+
'fa-arrows-alt' => 'fa-arrows-alt',
|
258 |
+
'fa-arrows-h' => 'fa-arrows-h',
|
259 |
+
'fa-arrows-v' => 'fa-arrows-v',
|
260 |
+
'fa-asterisk' => 'fa-asterisk',
|
261 |
+
'fa-at' => 'fa-at',
|
262 |
+
'fa-backward' => 'fa-backward',
|
263 |
+
'fa-ban' => 'fa-ban',
|
264 |
+
'fa-bar-chart' => 'fa-bar-chart',
|
265 |
+
'fa-barcode' => 'fa-barcode',
|
266 |
+
'fa-bars' => 'fa-bars',
|
267 |
+
'fa-bed' => 'fa-bed',
|
268 |
+
'fa-beer' => 'fa-beer',
|
269 |
+
'fa-behance' => 'fa-behance',
|
270 |
+
'fa-behance-square' => 'fa-behance-square',
|
271 |
+
'fa-bell' => 'fa-bell',
|
272 |
+
'fa-bell-o' => 'fa-bell-o',
|
273 |
+
'fa-bell-slash' => 'fa-bell-slash',
|
274 |
+
'fa-bell-slash-o' => 'fa-bell-slash-o',
|
275 |
+
'fa-bicycle' => 'fa-bicycle',
|
276 |
+
'fa-binoculars' => 'fa-binoculars',
|
277 |
+
'fa-birthday-cake' => 'fa-birthday-cake',
|
278 |
+
'fa-bitbucket' => 'fa-bitbucket',
|
279 |
+
'fa-bitbucket-square' => 'fa-bitbucket-square',
|
280 |
+
'fa-bold' => 'fa-bold',
|
281 |
+
'fa-bolt' => 'fa-bolt',
|
282 |
+
'fa-bomb' => 'fa-bomb',
|
283 |
+
'fa-book' => 'fa-book',
|
284 |
+
'fa-bookmark' => 'fa-bookmark',
|
285 |
+
'fa-bookmark-o' => 'fa-bookmark-o',
|
286 |
+
'fa-briefcase' => 'fa-briefcase',
|
287 |
+
'fa-btc' => 'fa-btc',
|
288 |
+
'fa-bug' => 'fa-bug',
|
289 |
+
'fa-building' => 'fa-building',
|
290 |
+
'fa-building-o' => 'fa-building-o',
|
291 |
+
'fa-bullhorn' => 'fa-bullhorn',
|
292 |
+
'fa-bullseye' => 'fa-bullseye',
|
293 |
+
'fa-bus' => 'fa-bus',
|
294 |
+
'fa-buysellads' => 'fa-buysellads',
|
295 |
+
'fa-calculator' => 'fa-calculator',
|
296 |
+
'fa-calendar' => 'fa-calendar',
|
297 |
+
'fa-calendar-o' => 'fa-calendar-o',
|
298 |
+
'fa-camera' => 'fa-camera',
|
299 |
+
'fa-camera-retro' => 'fa-camera-retro',
|
300 |
+
'fa-car' => 'fa-car',
|
301 |
+
'fa-caret-down' => 'fa-caret-down',
|
302 |
+
'fa-caret-left' => 'fa-caret-left',
|
303 |
+
'fa-caret-right' => 'fa-caret-right',
|
304 |
+
'fa-caret-square-o-down' => 'fa-caret-square-o-down',
|
305 |
+
'fa-caret-square-o-left' => 'fa-caret-square-o-left',
|
306 |
+
'fa-caret-square-o-right' => 'fa-caret-square-o-right',
|
307 |
+
'fa-caret-square-o-up' => 'fa-caret-square-o-up',
|
308 |
+
'fa-caret-up' => 'fa-caret-up',
|
309 |
+
'fa-cart-arrow-down' => 'fa-cart-arrow-down',
|
310 |
+
'fa-cart-plus' => 'fa-cart-plus',
|
311 |
+
'fa-cc' => 'fa-cc',
|
312 |
+
'fa-cc-amex' => 'fa-cc-amex',
|
313 |
+
'fa-cc-discover' => 'fa-cc-discover',
|
314 |
+
'fa-cc-mastercard' => 'fa-cc-mastercard',
|
315 |
+
'fa-cc-paypal' => 'fa-cc-paypal',
|
316 |
+
'fa-cc-stripe' => 'fa-cc-stripe',
|
317 |
+
'fa-cc-visa' => 'fa-cc-visa',
|
318 |
+
'fa-certificate' => 'fa-certificate',
|
319 |
+
'fa-chain-broken' => 'fa-chain-broken',
|
320 |
+
'fa-check' => 'fa-check',
|
321 |
+
'fa-check-circle' => 'fa-check-circle',
|
322 |
+
'fa-check-circle-o' => 'fa-check-circle-o',
|
323 |
+
'fa-check-square' => 'fa-check-square',
|
324 |
+
'fa-check-square-o' => 'fa-check-square-o',
|
325 |
+
'fa-chevron-circle-down' => 'fa-chevron-circle-down',
|
326 |
+
'fa-chevron-circle-left' => 'fa-chevron-circle-left',
|
327 |
+
'fa-chevron-circle-right' => 'fa-chevron-circle-right',
|
328 |
+
'fa-chevron-circle-up' => 'fa-chevron-circle-up',
|
329 |
+
'fa-chevron-down' => 'fa-chevron-down',
|
330 |
+
'fa-chevron-left' => 'fa-chevron-left',
|
331 |
+
'fa-chevron-right' => 'fa-chevron-right',
|
332 |
+
'fa-chevron-up' => 'fa-chevron-up',
|
333 |
+
'fa-child' => 'fa-child',
|
334 |
+
'fa-circle' => 'fa-circle',
|
335 |
+
'fa-circle-o' => 'fa-circle-o',
|
336 |
+
'fa-circle-o-notch' => 'fa-circle-o-notch',
|
337 |
+
'fa-circle-thin' => 'fa-circle-thin',
|
338 |
+
'fa-clipboard' => 'fa-clipboard',
|
339 |
+
'fa-clock-o' => 'fa-clock-o',
|
340 |
+
'fa-cloud' => 'fa-cloud',
|
341 |
+
'fa-cloud-download' => 'fa-cloud-download',
|
342 |
+
'fa-cloud-upload' => 'fa-cloud-upload',
|
343 |
+
'fa-code' => 'fa-code',
|
344 |
+
'fa-code-fork' => 'fa-code-fork',
|
345 |
+
'fa-codepen' => 'fa-codepen',
|
346 |
+
'fa-coffee' => 'fa-coffee',
|
347 |
+
'fa-cog' => 'fa-cog',
|
348 |
+
'fa-cogs' => 'fa-cogs',
|
349 |
+
'fa-columns' => 'fa-columns',
|
350 |
+
'fa-comment' => 'fa-comment',
|
351 |
+
'fa-comment-o' => 'fa-comment-o',
|
352 |
+
'fa-comments' => 'fa-comments',
|
353 |
+
'fa-comments-o' => 'fa-comments-o',
|
354 |
+
'fa-compass' => 'fa-compass',
|
355 |
+
'fa-compress' => 'fa-compress',
|
356 |
+
'fa-connectdevelop' => 'fa-connectdevelop',
|
357 |
+
'fa-copyright' => 'fa-copyright',
|
358 |
+
'fa-credit-card' => 'fa-credit-card',
|
359 |
+
'fa-crop' => 'fa-crop',
|
360 |
+
'fa-crosshairs' => 'fa-crosshairs',
|
361 |
+
'fa-css3' => 'fa-css3',
|
362 |
+
'fa-cube' => 'fa-cube',
|
363 |
+
'fa-cubes' => 'fa-cubes',
|
364 |
+
'fa-cutlery' => 'fa-cutlery',
|
365 |
+
'fa-dashcube' => 'fa-dashcube',
|
366 |
+
'fa-database' => 'fa-database',
|
367 |
+
'fa-delicious' => 'fa-delicious',
|
368 |
+
'fa-desktop' => 'fa-desktop',
|
369 |
+
'fa-deviantart' => 'fa-deviantart',
|
370 |
+
'fa-diamond' => 'fa-diamond',
|
371 |
+
'fa-digg' => 'fa-digg',
|
372 |
+
'fa-dot-circle-o' => 'fa-dot-circle-o',
|
373 |
+
'fa-download' => 'fa-download',
|
374 |
+
'fa-dribbble' => 'fa-dribbble',
|
375 |
+
'fa-dropbox' => 'fa-dropbox',
|
376 |
+
'fa-drupal' => 'fa-drupal',
|
377 |
+
'fa-eject' => 'fa-eject',
|
378 |
+
'fa-ellipsis-h' => 'fa-ellipsis-h',
|
379 |
+
'fa-ellipsis-v' => 'fa-ellipsis-v',
|
380 |
+
'fa-empire' => 'fa-empire',
|
381 |
+
'fa-envelope' => 'fa-envelope',
|
382 |
+
'fa-envelope-o' => 'fa-envelope-o',
|
383 |
+
'fa-envelope-square' => 'fa-envelope-square',
|
384 |
+
'fa-eraser' => 'fa-eraser',
|
385 |
+
'fa-eur' => 'fa-eur',
|
386 |
+
'fa-exchange' => 'fa-exchange',
|
387 |
+
'fa-exclamation' => 'fa-exclamation',
|
388 |
+
'fa-exclamation-circle' => 'fa-exclamation-circle',
|
389 |
+
'fa-exclamation-triangle' => 'fa-exclamation-triangle',
|
390 |
+
'fa-expand' => 'fa-expand',
|
391 |
+
'fa-external-link' => 'fa-external-link',
|
392 |
+
'fa-external-link-square' => 'fa-external-link-square',
|
393 |
+
'fa-eye' => 'fa-eye',
|
394 |
+
'fa-eye-slash' => 'fa-eye-slash',
|
395 |
+
'fa-eyedropper' => 'fa-eyedropper',
|
396 |
+
'fa-facebook' => 'fa-facebook',
|
397 |
+
'fa-facebook-official' => 'fa-facebook-official',
|
398 |
+
'fa-facebook-square' => 'fa-facebook-square',
|
399 |
+
'fa-fast-backward' => 'fa-fast-backward',
|
400 |
+
'fa-fast-forward' => 'fa-fast-forward',
|
401 |
+
'fa-fax' => 'fa-fax',
|
402 |
+
'fa-female' => 'fa-female',
|
403 |
+
'fa-fighter-jet' => 'fa-fighter-jet',
|
404 |
+
'fa-file' => 'fa-file',
|
405 |
+
'fa-file-archive-o' => 'fa-file-archive-o',
|
406 |
+
'fa-file-audio-o' => 'fa-file-audio-o',
|
407 |
+
'fa-file-code-o' => 'fa-file-code-o',
|
408 |
+
'fa-file-excel-o' => 'fa-file-excel-o',
|
409 |
+
'fa-file-image-o' => 'fa-file-image-o',
|
410 |
+
'fa-file-o' => 'fa-file-o',
|
411 |
+
'fa-file-pdf-o' => 'fa-file-pdf-o',
|
412 |
+
'fa-file-powerpoint-o' => 'fa-file-powerpoint-o',
|
413 |
+
'fa-file-text' => 'fa-file-text',
|
414 |
+
'fa-file-text-o' => 'fa-file-text-o',
|
415 |
+
'fa-file-video-o' => 'fa-file-video-o',
|
416 |
+
'fa-file-word-o' => 'fa-file-word-o',
|
417 |
+
'fa-files-o' => 'fa-files-o',
|
418 |
+
'fa-film' => 'fa-film',
|
419 |
+
'fa-filter' => 'fa-filter',
|
420 |
+
'fa-fire' => 'fa-fire',
|
421 |
+
'fa-fire-extinguisher' => 'fa-fire-extinguisher',
|
422 |
+
'fa-flag' => 'fa-flag',
|
423 |
+
'fa-flag-checkered' => 'fa-flag-checkered',
|
424 |
+
'fa-flag-o' => 'fa-flag-o',
|
425 |
+
'fa-flask' => 'fa-flask',
|
426 |
+
'fa-flickr' => 'fa-flickr',
|
427 |
+
'fa-floppy-o' => 'fa-floppy-o',
|
428 |
+
'fa-folder' => 'fa-folder',
|
429 |
+
'fa-folder-o' => 'fa-folder-o',
|
430 |
+
'fa-folder-open' => 'fa-folder-open',
|
431 |
+
'fa-folder-open-o' => 'fa-folder-open-o',
|
432 |
+
'fa-font' => 'fa-font',
|
433 |
+
'fa-forumbee' => 'fa-forumbee',
|
434 |
+
'fa-forward' => 'fa-forward',
|
435 |
+
'fa-foursquare' => 'fa-foursquare',
|
436 |
+
'fa-frown-o' => 'fa-frown-o',
|
437 |
+
'fa-futbol-o' => 'fa-futbol-o',
|
438 |
+
'fa-gamepad' => 'fa-gamepad',
|
439 |
+
'fa-gavel' => 'fa-gavel',
|
440 |
+
'fa-gbp' => 'fa-gbp',
|
441 |
+
'fa-gift' => 'fa-gift',
|
442 |
+
'fa-git' => 'fa-git',
|
443 |
+
'fa-git-square' => 'fa-git-square',
|
444 |
+
'fa-github' => 'fa-github',
|
445 |
+
'fa-github-alt' => 'fa-github-alt',
|
446 |
+
'fa-github-square' => 'fa-github-square',
|
447 |
+
'fa-glass' => 'fa-glass',
|
448 |
+
'fa-globe' => 'fa-globe',
|
449 |
+
'fa-google' => 'fa-google',
|
450 |
+
'fa-google-plus' => 'fa-google-plus',
|
451 |
+
'fa-google-plus-square' => 'fa-google-plus-square',
|
452 |
+
'fa-google-wallet' => 'fa-google-wallet',
|
453 |
+
'fa-graduation-cap' => 'fa-graduation-cap',
|
454 |
+
'fa-gratipay' => 'fa-gratipay',
|
455 |
+
'fa-h-square' => 'fa-h-square',
|
456 |
+
'fa-hacker-news' => 'fa-hacker-news',
|
457 |
+
'fa-hand-o-down' => 'fa-hand-o-down',
|
458 |
+
'fa-hand-o-left' => 'fa-hand-o-left',
|
459 |
+
'fa-hand-o-right' => 'fa-hand-o-right',
|
460 |
+
'fa-hand-o-up' => 'fa-hand-o-up',
|
461 |
+
'fa-hdd-o' => 'fa-hdd-o',
|
462 |
+
'fa-header' => 'fa-header',
|
463 |
+
'fa-headphones' => 'fa-headphones',
|
464 |
+
'fa-heart' => 'fa-heart',
|
465 |
+
'fa-heart-o' => 'fa-heart-o',
|
466 |
+
'fa-heartbeat' => 'fa-heartbeat',
|
467 |
+
'fa-history' => 'fa-history',
|
468 |
+
'fa-home' => 'fa-home',
|
469 |
+
'fa-hospital-o' => 'fa-hospital-o',
|
470 |
+
'fa-html5' => 'fa-html5',
|
471 |
+
'fa-ils' => 'fa-ils',
|
472 |
+
'fa-inbox' => 'fa-inbox',
|
473 |
+
'fa-indent' => 'fa-indent',
|
474 |
+
'fa-info' => 'fa-info',
|
475 |
+
'fa-info-circle' => 'fa-info-circle',
|
476 |
+
'fa-inr' => 'fa-inr',
|
477 |
+
'fa-instagram' => 'fa-instagram',
|
478 |
+
'fa-ioxhost' => 'fa-ioxhost',
|
479 |
+
'fa-italic' => 'fa-italic',
|
480 |
+
'fa-joomla' => 'fa-joomla',
|
481 |
+
'fa-jpy' => 'fa-jpy',
|
482 |
+
'fa-jsfiddle' => 'fa-jsfiddle',
|
483 |
+
'fa-key' => 'fa-key',
|
484 |
+
'fa-keyboard-o' => 'fa-keyboard-o',
|
485 |
+
'fa-krw' => 'fa-krw',
|
486 |
+
'fa-language' => 'fa-language',
|
487 |
+
'fa-laptop' => 'fa-laptop',
|
488 |
+
'fa-lastfm' => 'fa-lastfm',
|
489 |
+
'fa-lastfm-square' => 'fa-lastfm-square',
|
490 |
+
'fa-leaf' => 'fa-leaf',
|
491 |
+
'fa-leanpub' => 'fa-leanpub',
|
492 |
+
'fa-legal' => 'fa-legal',
|
493 |
+
'fa-lemon-o' => 'fa-lemon-o',
|
494 |
+
'fa-level-down' => 'fa-level-down',
|
495 |
+
'fa-level-up' => 'fa-level-up',
|
496 |
+
'fa-life-bouy' => 'fa-life-bouy',
|
497 |
+
'fa-life-ring' => 'fa-life-ring',
|
498 |
+
'fa-life-saver' => 'fa-life-saver',
|
499 |
+
'fa-lightbulb-o' => 'fa-lightbulb-o',
|
500 |
+
'fa-line-chart' => 'fa-line-chart',
|
501 |
+
'fa-link' => 'fa-link',
|
502 |
+
'fa-linkedin' => 'fa-linkedin',
|
503 |
+
'fa-linkedin-square' => 'fa-linkedin-square',
|
504 |
+
'fa-linux' => 'fa-linux',
|
505 |
+
'fa-list' => 'fa-list',
|
506 |
+
'fa-list-alt' => 'fa-list-alt',
|
507 |
+
'fa-list-ol' => 'fa-list-ol',
|
508 |
+
'fa-list-ul' => 'fa-list-ul',
|
509 |
+
'fa-location-arrow' => 'fa-location-arrow',
|
510 |
+
'fa-lock' => 'fa-lock',
|
511 |
+
'fa-long-arrow-down' => 'fa-long-arrow-down',
|
512 |
+
'fa-long-arrow-left' => 'fa-long-arrow-left',
|
513 |
+
'fa-long-arrow-right' => 'fa-long-arrow-right',
|
514 |
+
'fa-long-arrow-up' => 'fa-long-arrow-up',
|
515 |
+
'fa-magic' => 'fa-magic',
|
516 |
+
'fa-magnet' => 'fa-magnet',
|
517 |
+
'fa-male' => 'fa-male',
|
518 |
+
'fa-map-marker' => 'fa-map-marker',
|
519 |
+
'fa-mars' => 'fa-mars',
|
520 |
+
'fa-mars-double' => 'fa-mars-double',
|
521 |
+
'fa-mars-stroke' => 'fa-mars-stroke',
|
522 |
+
'fa-mars-stroke-h' => 'fa-mars-stroke-h',
|
523 |
+
'fa-mars-stroke-v' => 'fa-mars-stroke-v',
|
524 |
+
'fa-maxcdn' => 'fa-maxcdn',
|
525 |
+
'fa-meanpath' => 'fa-meanpath',
|
526 |
+
'fa-medium' => 'fa-medium',
|
527 |
+
'fa-medkit' => 'fa-medkit',
|
528 |
+
'fa-meh-o' => 'fa-meh-o',
|
529 |
+
'fa-mercury' => 'fa-mercury',
|
530 |
+
'fa-microphone' => 'fa-microphone',
|
531 |
+
'fa-microphone-slash' => 'fa-microphone-slash',
|
532 |
+
'fa-minus' => 'fa-minus',
|
533 |
+
'fa-minus-circle' => 'fa-minus-circle',
|
534 |
+
'fa-minus-square' => 'fa-minus-square',
|
535 |
+
'fa-minus-square-o' => 'fa-minus-square-o',
|
536 |
+
'fa-mobile' => 'fa-mobile',
|
537 |
+
'fa-money' => 'fa-money',
|
538 |
+
'fa-moon-o' => 'fa-moon-o',
|
539 |
+
'fa-motorcycle' => 'fa-motorcycle',
|
540 |
+
'fa-music' => 'fa-music',
|
541 |
+
'fa-neuter' => 'fa-neuter',
|
542 |
+
'fa-newspaper-o' => 'fa-newspaper-o',
|
543 |
+
'fa-openid' => 'fa-openid',
|
544 |
+
'fa-outdent' => 'fa-outdent',
|
545 |
+
'fa-pagelines' => 'fa-pagelines',
|
546 |
+
'fa-paint-brush' => 'fa-paint-brush',
|
547 |
+
'fa-paper-plane' => 'fa-paper-plane',
|
548 |
+
'fa-paper-plane-o' => 'fa-paper-plane-o',
|
549 |
+
'fa-paperclip' => 'fa-paperclip',
|
550 |
+
'fa-paragraph' => 'fa-paragraph',
|
551 |
+
'fa-pause' => 'fa-pause',
|
552 |
+
'fa-paw' => 'fa-paw',
|
553 |
+
'fa-paypal' => 'fa-paypal',
|
554 |
+
'fa-pencil' => 'fa-pencil',
|
555 |
+
'fa-pencil-square' => 'fa-pencil-square',
|
556 |
+
'fa-pencil-square-o' => 'fa-pencil-square-o',
|
557 |
+
'fa-phone' => 'fa-phone',
|
558 |
+
'fa-phone-square' => 'fa-phone-square',
|
559 |
+
'fa-picture-o' => 'fa-picture-o',
|
560 |
+
'fa-pie-chart' => 'fa-pie-chart',
|
561 |
+
'fa-pied-piper' => 'fa-pied-piper',
|
562 |
+
'fa-pied-piper-alt' => 'fa-pied-piper-alt',
|
563 |
+
'fa-pinterest' => 'fa-pinterest',
|
564 |
+
'fa-pinterest-p' => 'fa-pinterest-p',
|
565 |
+
'fa-pinterest-square' => 'fa-pinterest-square',
|
566 |
+
'fa-plane' => 'fa-plane',
|
567 |
+
'fa-play' => 'fa-play',
|
568 |
+
'fa-play-circle' => 'fa-play-circle',
|
569 |
+
'fa-play-circle-o' => 'fa-play-circle-o',
|
570 |
+
'fa-plug' => 'fa-plug',
|
571 |
+
'fa-plus' => 'fa-plus',
|
572 |
+
'fa-plus-circle' => 'fa-plus-circle',
|
573 |
+
'fa-plus-square' => 'fa-plus-square',
|
574 |
+
'fa-plus-square-o' => 'fa-plus-square-o',
|
575 |
+
'fa-power-off' => 'fa-power-off',
|
576 |
+
'fa-print' => 'fa-print',
|
577 |
+
'fa-puzzle-piece' => 'fa-puzzle-piece',
|
578 |
+
'fa-qq' => 'fa-qq',
|
579 |
+
'fa-qrcode' => 'fa-qrcode',
|
580 |
+
'fa-question' => 'fa-question',
|
581 |
+
'fa-question-circle' => 'fa-question-circle',
|
582 |
+
'fa-quote-left' => 'fa-quote-left',
|
583 |
+
'fa-quote-right' => 'fa-quote-right',
|
584 |
+
'fa-random' => 'fa-random',
|
585 |
+
'fa-rebel' => 'fa-rebel',
|
586 |
+
'fa-recycle' => 'fa-recycle',
|
587 |
+
'fa-reddit' => 'fa-reddit',
|
588 |
+
'fa-reddit-square' => 'fa-reddit-square',
|
589 |
+
'fa-refresh' => 'fa-refresh',
|
590 |
+
'fa-renren' => 'fa-renren',
|
591 |
+
'fa-repeat' => 'fa-repeat',
|
592 |
+
'fa-reply' => 'fa-reply',
|
593 |
+
'fa-reply-all' => 'fa-reply-all',
|
594 |
+
'fa-retweet' => 'fa-retweet',
|
595 |
+
'fa-road' => 'fa-road',
|
596 |
+
'fa-rocket' => 'fa-rocket',
|
597 |
+
'fa-rss' => 'fa-rss',
|
598 |
+
'fa-rss-square' => 'fa-rss-square',
|
599 |
+
'fa-rub' => 'fa-rub',
|
600 |
+
'fa-scissors' => 'fa-scissors',
|
601 |
+
'fa-search' => 'fa-search',
|
602 |
+
'fa-search-minus' => 'fa-search-minus',
|
603 |
+
'fa-search-plus' => 'fa-search-plus',
|
604 |
+
'fa-sellsy' => 'fa-sellsy',
|
605 |
+
'fa-server' => 'fa-server',
|
606 |
+
'fa-share' => 'fa-share',
|
607 |
+
'fa-share-alt' => 'fa-share-alt',
|
608 |
+
'fa-share-alt-square' => 'fa-share-alt-square',
|
609 |
+
'fa-share-square' => 'fa-share-square',
|
610 |
+
'fa-share-square-o' => 'fa-share-square-o',
|
611 |
+
'fa-shield' => 'fa-shield',
|
612 |
+
'fa-ship' => 'fa-ship',
|
613 |
+
'fa-shirtsinbulk' => 'fa-shirtsinbulk',
|
614 |
+
'fa-shopping-cart' => 'fa-shopping-cart',
|
615 |
+
'fa-sign-in' => 'fa-sign-in',
|
616 |
+
'fa-sign-out' => 'fa-sign-out',
|
617 |
+
'fa-signal' => 'fa-signal',
|
618 |
+
'fa-simplybuilt' => 'fa-simplybuilt',
|
619 |
+
'fa-sitemap' => 'fa-sitemap',
|
620 |
+
'fa-skyatlas' => 'fa-skyatlas',
|
621 |
+
'fa-skype' => 'fa-skype',
|
622 |
+
'fa-slack' => 'fa-slack',
|
623 |
+
'fa-sliders' => 'fa-sliders',
|
624 |
+
'fa-slideshare' => 'fa-slideshare',
|
625 |
+
'fa-smile-o' => 'fa-smile-o',
|
626 |
+
'fa-sort' => 'fa-sort',
|
627 |
+
'fa-sort-alpha-asc' => 'fa-sort-alpha-asc',
|
628 |
+
'fa-sort-alpha-desc' => 'fa-sort-alpha-desc',
|
629 |
+
'fa-sort-amount-asc' => 'fa-sort-amount-asc',
|
630 |
+
'fa-sort-amount-desc' => 'fa-sort-amount-desc',
|
631 |
+
'fa-sort-asc' => 'fa-sort-asc',
|
632 |
+
'fa-sort-desc' => 'fa-sort-desc',
|
633 |
+
'fa-sort-numeric-asc' => 'fa-sort-numeric-asc',
|
634 |
+
'fa-sort-numeric-desc' => 'fa-sort-numeric-desc',
|
635 |
+
'fa-soundcloud' => 'fa-soundcloud',
|
636 |
+
'fa-space-shuttle' => 'fa-space-shuttle',
|
637 |
+
'fa-spinner' => 'fa-spinner',
|
638 |
+
'fa-spoon' => 'fa-spoon',
|
639 |
+
'fa-spotify' => 'fa-spotify',
|
640 |
+
'fa-square' => 'fa-square',
|
641 |
+
'fa-square-o' => 'fa-square-o',
|
642 |
+
'fa-stack-exchange' => 'fa-stack-exchange',
|
643 |
+
'fa-stack-overflow' => 'fa-stack-overflow',
|
644 |
+
'fa-star' => 'fa-star',
|
645 |
+
'fa-star-half' => 'fa-star-half',
|
646 |
+
'fa-star-half-o' => 'fa-star-half-o',
|
647 |
+
'fa-star-o' => 'fa-star-o',
|
648 |
+
'fa-steam' => 'fa-steam',
|
649 |
+
'fa-steam-square' => 'fa-steam-square',
|
650 |
+
'fa-step-backward' => 'fa-step-backward',
|
651 |
+
'fa-step-forward' => 'fa-step-forward',
|
652 |
+
'fa-stethoscope' => 'fa-stethoscope',
|
653 |
+
'fa-stop' => 'fa-stop',
|
654 |
+
'fa-street-view' => 'fa-street-view',
|
655 |
+
'fa-strikethrough' => 'fa-strikethrough',
|
656 |
+
'fa-stumbleupon' => 'fa-stumbleupon',
|
657 |
+
'fa-stumbleupon-circle' => 'fa-stumbleupon-circle',
|
658 |
+
'fa-subscript' => 'fa-subscript',
|
659 |
+
'fa-subway' => 'fa-subway',
|
660 |
+
'fa-suitcase' => 'fa-suitcase',
|
661 |
+
'fa-sun-o' => 'fa-sun-o',
|
662 |
+
'fa-superscript' => 'fa-superscript',
|
663 |
+
'fa-table' => 'fa-table',
|
664 |
+
'fa-tablet' => 'fa-tablet',
|
665 |
+
'fa-tachometer' => 'fa-tachometer',
|
666 |
+
'fa-tag' => 'fa-tag',
|
667 |
+
'fa-tags' => 'fa-tags',
|
668 |
+
'fa-tasks' => 'fa-tasks',
|
669 |
+
'fa-taxi' => 'fa-taxi',
|
670 |
+
'fa-tencent-weibo' => 'fa-tencent-weibo',
|
671 |
+
'fa-terminal' => 'fa-terminal',
|
672 |
+
'fa-text-height' => 'fa-text-height',
|
673 |
+
'fa-text-width' => 'fa-text-width',
|
674 |
+
'fa-th' => 'fa-th',
|
675 |
+
'fa-th-large' => 'fa-th-large',
|
676 |
+
'fa-th-list' => 'fa-th-list',
|
677 |
+
'fa-thumb-tack' => 'fa-thumb-tack',
|
678 |
+
'fa-thumbs-down' => 'fa-thumbs-down',
|
679 |
+
'fa-thumbs-o-down' => 'fa-thumbs-o-down',
|
680 |
+
'fa-thumbs-o-up' => 'fa-thumbs-o-up',
|
681 |
+
'fa-thumbs-up' => 'fa-thumbs-up',
|
682 |
+
'fa-ticket' => 'fa-ticket',
|
683 |
+
'fa-times' => 'fa-times',
|
684 |
+
'fa-times-circle' => 'fa-times-circle',
|
685 |
+
'fa-times-circle-o' => 'fa-times-circle-o',
|
686 |
+
'fa-tint' => 'fa-tint',
|
687 |
+
'fa-toggle-off' => 'fa-toggle-off',
|
688 |
+
'fa-toggle-on' => 'fa-toggle-on',
|
689 |
+
'fa-train' => 'fa-train',
|
690 |
+
'fa-transgender' => 'fa-transgender',
|
691 |
+
'fa-transgender-alt' => 'fa-transgender-alt',
|
692 |
+
'fa-trash' => 'fa-trash',
|
693 |
+
'fa-trash-o' => 'fa-trash-o',
|
694 |
+
'fa-tree' => 'fa-tree',
|
695 |
+
'fa-trello' => 'fa-trello',
|
696 |
+
'fa-trophy' => 'fa-trophy',
|
697 |
+
'fa-truck' => 'fa-truck',
|
698 |
+
'fa-try' => 'fa-try',
|
699 |
+
'fa-tty' => 'fa-tty',
|
700 |
+
'fa-tumblr' => 'fa-tumblr',
|
701 |
+
'fa-tumblr-square' => 'fa-tumblr-square',
|
702 |
+
'fa-twitch' => 'fa-twitch',
|
703 |
+
'fa-twitter' => 'fa-twitter',
|
704 |
+
'fa-twitter-square' => 'fa-twitter-square',
|
705 |
+
'fa-umbrella' => 'fa-umbrella',
|
706 |
+
'fa-underline' => 'fa-underline',
|
707 |
+
'fa-undo' => 'fa-undo',
|
708 |
+
'fa-university' => 'fa-university',
|
709 |
+
'fa-unlock' => 'fa-unlock',
|
710 |
+
'fa-unlock-alt' => 'fa-unlock-alt',
|
711 |
+
'fa-upload' => 'fa-upload',
|
712 |
+
'fa-usd' => 'fa-usd',
|
713 |
+
'fa-user' => 'fa-user',
|
714 |
+
'fa-user-md' => 'fa-user-md',
|
715 |
+
'fa-user-plus' => 'fa-user-plus',
|
716 |
+
'fa-user-secret' => 'fa-user-secret',
|
717 |
+
'fa-user-times' => 'fa-user-times',
|
718 |
+
'fa-users' => 'fa-users',
|
719 |
+
'fa-venus' => 'fa-venus',
|
720 |
+
'fa-venus-double' => 'fa-venus-double',
|
721 |
+
'fa-venus-mars' => 'fa-venus-mars',
|
722 |
+
'fa-viacoin' => 'fa-viacoin',
|
723 |
+
'fa-video-camera' => 'fa-video-camera',
|
724 |
+
'fa-vimeo-square' => 'fa-vimeo-square',
|
725 |
+
'fa-vine' => 'fa-vine',
|
726 |
+
'fa-vk' => 'fa-vk',
|
727 |
+
'fa-volume-down' => 'fa-volume-down',
|
728 |
+
'fa-volume-off' => 'fa-volume-off',
|
729 |
+
'fa-volume-up' => 'fa-volume-up',
|
730 |
+
'fa-weibo' => 'fa-weibo',
|
731 |
+
'fa-weixin' => 'fa-weixin',
|
732 |
+
'fa-whatsapp' => 'fa-whatsapp',
|
733 |
+
'fa-wheelchair' => 'fa-wheelchair',
|
734 |
+
'fa-wifi' => 'fa-wifi',
|
735 |
+
'fa-windows' => 'fa-windows',
|
736 |
+
'fa-wordpress' => 'fa-wordpress',
|
737 |
+
'fa-wrench' => 'fa-wrench',
|
738 |
+
'fa-xing' => 'fa-xing',
|
739 |
+
'fa-xing-square' => 'fa-xing-square',
|
740 |
+
'fa-yahoo' => 'fa-yahoo',
|
741 |
+
'fa-yelp' => 'fa-yelp',
|
742 |
+
'fa-youtube' => 'fa-youtube',
|
743 |
+
'fa-youtube-play' => 'fa-youtube-play',
|
744 |
+
'fa-youtube-square' => 'fa-youtube-square',
|
745 |
+
);
|
746 |
+
foreach ( $this->icons as $icon ) {
|
747 |
+
$this->all_icons[ $icon ] = $icon;
|
748 |
+
}
|
749 |
+
|
750 |
+
return $this->all_icons;
|
751 |
+
}
|
752 |
+
}
|
inc/widgets/class-shapely-home-parallax.php
CHANGED
@@ -1,284 +1,284 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Homepage parallax section Widget
|
5 |
-
* Shapely Theme
|
6 |
-
*/
|
7 |
-
class Shapely_Home_Parallax extends WP_Widget {
|
8 |
-
|
9 |
-
private $defaults = array();
|
10 |
-
|
11 |
-
function __construct() {
|
12 |
-
add_action( 'admin_init', array( $this, 'enqueue' ) );
|
13 |
-
add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue' ) );
|
14 |
-
add_action( 'customize_preview_init', array( $this, 'enqueue' ) );
|
15 |
-
|
16 |
-
$widget_ops = array(
|
17 |
-
'classname' => 'shapely_home_parallax',
|
18 |
-
'description' => esc_html__( 'Shapely FrontPage Parallax Section', 'shapely-companion' ),
|
19 |
-
'customize_selective_refresh' => true,
|
20 |
-
);
|
21 |
-
parent::__construct( 'shapely_home_parallax', esc_html__( '[Shapely] Parallax Section For FrontPage', 'shapely-companion' ), $widget_ops );
|
22 |
-
|
23 |
-
$this->defaults = array(
|
24 |
-
'title' => '',
|
25 |
-
'image_src' => '',
|
26 |
-
'image_pos' => esc_html__( 'left', 'shapely-companion' ),
|
27 |
-
'body_content' => '',
|
28 |
-
'button1' => '',
|
29 |
-
'button2' => '',
|
30 |
-
'button1_link' => '',
|
31 |
-
'button2_link' => '',
|
32 |
-
'border_bottom' => '',
|
33 |
-
);
|
34 |
-
}
|
35 |
-
|
36 |
-
public function enqueue() {
|
37 |
-
|
38 |
-
if ( is_admin() && ! is_customize_preview() ) {
|
39 |
-
wp_enqueue_style( 'epsilon-styles', get_template_directory_uri() . '/inc/libraries/epsilon-framework/assets/css/style.css' );
|
40 |
-
}
|
41 |
-
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* @param array $args
|
46 |
-
* @param array $instance
|
47 |
-
*/
|
48 |
-
function widget( $args, $instance ) {
|
49 |
-
$allowed_tags = wp_kses_allowed_html( 'post' );
|
50 |
-
$allowed_tags['iframe'] = array(
|
51 |
-
'width' => array(),
|
52 |
-
'height' => array(),
|
53 |
-
'src' => array(),
|
54 |
-
'frameborder' => array(),
|
55 |
-
'allowfullscreen' => array(),
|
56 |
-
);
|
57 |
-
|
58 |
-
$instance = wp_parse_args( $instance, $this->defaults );
|
59 |
-
|
60 |
-
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
61 |
-
|
62 |
-
/* Classes */
|
63 |
-
$class1 = ( 'background-full' == $instance['image_pos'] ) ? 'cover fullscreen image-bg' : ( ( 'background-small' == $instance['image_pos'] ) ? 'small-screen image-bg p0' : ( ( 'right' == $instance['image_pos'] ) ? 'bg-secondary' : ( ( 'bottom' == $instance['image_pos'] ) ? 'bg-secondary pb0' : '' ) ) );
|
64 |
-
$class2 = ( ( 'background-full' == $instance['image_pos'] ) || ( 'background-small' == $instance['image_pos'] ) ) ? 'top-parallax-section' : ( ( 'right' == $instance['image_pos'] ) ? 'col-md-4 col-sm-5 mb-xs-24' : ( ( 'left' == $instance['image_pos'] ) ? 'col-md-4 col-md-offset-1 col-sm-5 col-sm-offset-1' : ( ( 'bottom' == $instance['image_pos'] ) ? 'col-sm-10 col-sm-offset-1 text-center' : ( ( 'top' == $instance['image_pos'] ) ? 'col-sm-10 col-sm-offset-1 text-center mt30' : '' ) ) ) );
|
65 |
-
$class3 = ( ( 'background-full' == $instance['image_pos'] ) || ( 'background-small' == $instance['image_pos'] ) ) ? 'col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1 text-center' : '';
|
66 |
-
$class4 = ( 'left' == $instance['image_pos'] || 'right' == $instance['image_pos'] ) ? 'row align-children' : 'row';
|
67 |
-
$class5 = ( 'right' == $instance['image_pos'] ) ? 'col-md-7 col-md-offset-1 col-sm-6 col-sm-offset-1 text-center' : '';
|
68 |
-
$class6 = ( 'left' == $instance['image_pos'] ) ? 'col-md-7 col-sm-6 text-center mb-xs-24' : '';
|
69 |
-
$class7 = ( 'background-full' == $instance['image_pos'] ) ? 'fullscreen' : '';
|
70 |
-
|
71 |
-
if ( 'on' == $instance['border_bottom'] ) {
|
72 |
-
$class1 .= ' border-bottom';
|
73 |
-
}
|
74 |
-
/**
|
75 |
-
* Widget Content
|
76 |
-
*/
|
77 |
-
?>
|
78 |
-
<section class="<?php echo esc_attr( $class1 ); ?>">
|
79 |
-
<?php
|
80 |
-
if ( ( 'background-full' == $instance['image_pos'] || 'background-small' == $instance['image_pos'] ) && '' != $instance['image_src'] ) {
|
81 |
-
?>
|
82 |
-
<div class="parallax-window <?php echo esc_attr( $class7 ); ?>" data-parallax="scroll" data-image-src="<?php echo esc_url( $instance['image_src'] ); ?>" data-ios-fix="true" data-over-scroll-fix="true" data-android-fix="true">
|
83 |
-
<div class="<?php echo ( 'background-full' == $instance['image_pos'] ) ? 'align-transform' : ''; ?>">
|
84 |
-
<?php } else { ?>
|
85 |
-
<div class="container">
|
86 |
-
<?php } ?>
|
87 |
-
|
88 |
-
<div class="<?php echo esc_attr( $class4 ); ?>">
|
89 |
-
|
90 |
-
<?php
|
91 |
-
if ( ( 'left' == $instance['image_pos'] || 'top' == $instance['image_pos'] ) && '' != $instance['image_src'] ) {
|
92 |
-
?>
|
93 |
-
<div class="<?php echo esc_attr( $class6 ); ?>">
|
94 |
-
<img class="img-responsive" alt="<?php echo esc_attr( $instance['title'] ); ?>" src="<?php echo esc_url( $instance['image_src'] ); ?>">
|
95 |
-
</div>
|
96 |
-
<?php
|
97 |
-
}
|
98 |
-
?>
|
99 |
-
|
100 |
-
<div class="<?php echo esc_attr( $class2 ); ?>">
|
101 |
-
<div class="<?php echo esc_attr( $class3 ); ?>">
|
102 |
-
<?php
|
103 |
-
echo ( '' != $instance['title'] ) ? ( ( 'background-full' == $instance['image_pos'] ) || ( 'background-small' == $instance['image_pos'] ) ) ? '<h1>' . wp_kses_post( $instance['title'] ) . '</h1>' : '<h3>' . wp_kses_post( $instance['title'] ) . '</h3>' : '';
|
104 |
-
if ( '' != $instance['body_content'] ) {
|
105 |
-
echo '<div class="mb32">';
|
106 |
-
echo apply_filters( 'the_content', wp_kses( $instance['body_content'], $allowed_tags ) );
|
107 |
-
echo '</div>';
|
108 |
-
}
|
109 |
-
echo ( '' != $instance['button1'] && '' != $instance['button1_link'] ) ? '<a class="btn btn-lg btn-filled" href="' . esc_url( $instance['button1_link'] ) . '">' . wp_kses_post( $instance['button1'] ) . '</a>' : '';
|
110 |
-
echo ( '' != $instance['button2'] && '' != $instance['button2_link'] ) ? '<a class="btn btn-lg btn-white" href="' . esc_url( $instance['button2_link'] ) . '">' . wp_kses_post( $instance['button2'] ) . '</a>' : '';
|
111 |
-
?>
|
112 |
-
</div>
|
113 |
-
</div>
|
114 |
-
<!--end of row-->
|
115 |
-
<?php
|
116 |
-
if ( ( 'right' == $instance['image_pos'] || 'bottom' == $instance['image_pos'] ) && '' != $instance['image_src'] ) {
|
117 |
-
?>
|
118 |
-
<div class="<?php echo esc_attr( $class5 ); ?>">
|
119 |
-
<img class="img-responsive" alt="<?php echo esc_attr( $instance['title'] ); ?>" src="<?php echo esc_url( $instance['image_src'] ); ?>">
|
120 |
-
</div>
|
121 |
-
<?php
|
122 |
-
}
|
123 |
-
?>
|
124 |
-
</div>
|
125 |
-
</div>
|
126 |
-
<?php if ( 'background-full' == $instance['image_pos'] || 'background-small' == $instance['image_pos'] ) { ?>
|
127 |
-
</div>
|
128 |
-
<?php } ?>
|
129 |
-
</section>
|
130 |
-
<div class="clearfix"></div>
|
131 |
-
<?php
|
132 |
-
|
133 |
-
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
134 |
-
}
|
135 |
-
|
136 |
-
|
137 |
-
/**
|
138 |
-
* @param array $instance
|
139 |
-
*
|
140 |
-
* @return string|void
|
141 |
-
*/
|
142 |
-
function form( $instance ) {
|
143 |
-
$allowed_tags = wp_kses_allowed_html( 'post' );
|
144 |
-
$allowed_tags['iframe'] = array(
|
145 |
-
'width' => array(),
|
146 |
-
'height' => array(),
|
147 |
-
'src' => array(),
|
148 |
-
'frameborder' => array(),
|
149 |
-
'allowfullscreen' => array(),
|
150 |
-
);
|
151 |
-
|
152 |
-
$instance = wp_parse_args( $instance, $this->defaults );
|
153 |
-
|
154 |
-
$placeholder_url = plugins_url( 'shapely-companion/assets/img/placeholder-image.jpg' );
|
155 |
-
|
156 |
-
?>
|
157 |
-
|
158 |
-
<p>
|
159 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
|
160 |
-
<?php echo esc_html__( 'Title ', 'shapely-companion' ); ?>
|
161 |
-
</label>
|
162 |
-
|
163 |
-
<input type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" class="widefat" />
|
164 |
-
</p>
|
165 |
-
|
166 |
-
<p class="shapely-media-control" data-delegate-container="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>">
|
167 |
-
<label
|
168 |
-
for="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>">
|
169 |
-
<?php
|
170 |
-
echo esc_html__( 'Image', 'shapely-companion' );
|
171 |
-
?>
|
172 |
-
:</label>
|
173 |
-
|
174 |
-
<img data-default="<?php echo esc_url( $placeholder_url ); ?>" src="<?php echo '' != $instance['image_src'] ? esc_url( $instance['image_src'] ) : esc_url( $placeholder_url ); ?>" />
|
175 |
-
|
176 |
-
<input type="hidden" name="<?php echo esc_attr( $this->get_field_name( 'image_src' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>" value="<?php echo esc_url( $instance['image_src'] ); ?>" class="image-id blazersix-media-control-target">
|
177 |
-
|
178 |
-
<button type="button" class="button upload-button"><?php echo esc_html__( 'Choose Image', 'shapely-companion' ); ?></button>
|
179 |
-
<button type="button" class="button remove-button"><?php echo esc_html__( 'Remove Image', 'shapely-companion' ); ?></button>
|
180 |
-
</p>
|
181 |
-
|
182 |
-
<p class="shapely-editor-container">
|
183 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'body_content' ) ); ?>">
|
184 |
-
<?php echo esc_html__( 'Content ', 'shapely-companion' ); ?>
|
185 |
-
</label>
|
186 |
-
|
187 |
-
<textarea name="<?php echo esc_attr( $this->get_field_name( 'body_content' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'body_content' ) ); ?>" class="widefat">
|
188 |
-
<?php echo wp_kses( nl2br( $instance['body_content'] ), $allowed_tags ); ?>
|
189 |
-
</textarea>
|
190 |
-
</p>
|
191 |
-
|
192 |
-
<p>
|
193 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'image_pos' ) ); ?>">
|
194 |
-
<?php echo esc_html__( 'Image Position ', 'shapely-companion' ); ?>
|
195 |
-
</label>
|
196 |
-
|
197 |
-
<select name="<?php echo esc_attr( $this->get_field_name( 'image_pos' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'image_pos' ) ); ?>" class="widefat">
|
198 |
-
<option value="left" <?php selected( $instance['image_pos'], 'left' ); ?>><?php echo esc_html__( 'Left', 'shapely-companion' ); ?></option>
|
199 |
-
<option value="right" <?php selected( $instance['image_pos'], 'right' ); ?>><?php echo esc_html__( 'Right', 'shapely-companion' ); ?></option>
|
200 |
-
<option value="top" <?php selected( $instance['image_pos'], 'top' ); ?>><?php echo esc_html__( 'Top', 'shapely-companion' ); ?></option>
|
201 |
-
<option value="bottom" <?php selected( $instance['image_pos'], 'bottom' ); ?>><?php echo esc_html__( 'Bottom', 'shapely-companion' ); ?></option>
|
202 |
-
<option value="background-full" <?php selected( $instance['image_pos'], 'background-full' ); ?>><?php echo esc_html__( 'Background Full', 'shapely-companion' ); ?></option>
|
203 |
-
<option value="background-small" <?php selected( $instance['image_pos'], 'background-small' ); ?>><?php echo esc_html__( 'Background Small', 'shapely-companion' ); ?></option>
|
204 |
-
</select>
|
205 |
-
</p>
|
206 |
-
|
207 |
-
<p>
|
208 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'button1' ) ); ?>">
|
209 |
-
<?php echo esc_html__( 'Button 1 Text ', 'shapely-companion' ); ?>
|
210 |
-
</label>
|
211 |
-
|
212 |
-
<input type="text" value="<?php echo esc_attr( $instance['button1'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'button1' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'button1' ) ); ?>" class="widefat" />
|
213 |
-
</p>
|
214 |
-
|
215 |
-
<p>
|
216 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'button1_link' ) ); ?>">
|
217 |
-
<?php echo esc_html__( 'Button 1 Link ', 'shapely-companion' ); ?>
|
218 |
-
</label>
|
219 |
-
|
220 |
-
<input type="text" value="<?php echo esc_url( $instance['button1_link'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'button1_link' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'button1_link' ) ); ?>" class="widefat" />
|
221 |
-
</p>
|
222 |
-
|
223 |
-
<p>
|
224 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'button2' ) ); ?>">
|
225 |
-
<?php echo esc_html__( 'Button 2 Text ', 'shapely-companion' ); ?>
|
226 |
-
</label>
|
227 |
-
|
228 |
-
<input type="text" value="<?php echo esc_attr( $instance['button2'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'button2' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'button2' ) ); ?>" class="widefat" />
|
229 |
-
</p>
|
230 |
-
|
231 |
-
<p>
|
232 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'button2_link' ) ); ?>">
|
233 |
-
<?php echo esc_html__( 'Button 2 Link ', 'shapely-companion' ); ?>
|
234 |
-
</label>
|
235 |
-
|
236 |
-
<input type="text" value="<?php echo esc_url( $instance['button2_link'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'button2_link' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'button2_link' ) ); ?>" class="widefat" />
|
237 |
-
</p>
|
238 |
-
|
239 |
-
<div class="checkbox_switch wp-clearfix">
|
240 |
-
<span class="customize-control-title onoffswitch_label">
|
241 |
-
<?php echo esc_html__( 'Border bottom', 'shapely-companion' ); ?>
|
242 |
-
</span>
|
243 |
-
<div class="onoffswitch">
|
244 |
-
<input type="checkbox" id="<?php echo esc_attr( $this->get_field_name( 'border_bottom' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'border_bottom' ) ); ?>" class="onoffswitch-checkbox" value="on"
|
245 |
-
<?php checked( $instance['border_bottom'], 'on' ); ?>>
|
246 |
-
<label class="onoffswitch-label" for="<?php echo esc_attr( $this->get_field_name( 'border_bottom' ) ); ?>"></label>
|
247 |
-
</div>
|
248 |
-
</div>
|
249 |
-
<?php
|
250 |
-
}
|
251 |
-
|
252 |
-
/**
|
253 |
-
* Sanitize widget form values as they are saved.
|
254 |
-
*
|
255 |
-
* @see WP_Widget::update()
|
256 |
-
*
|
257 |
-
* @param array $new_instance Values just sent to be saved.
|
258 |
-
* @param array $old_instance Previously saved values from database.
|
259 |
-
*
|
260 |
-
* @return array Updated safe values to be saved.
|
261 |
-
*/
|
262 |
-
public function update( $new_instance, $old_instance ) {
|
263 |
-
$instance = array();
|
264 |
-
$allowed_tags = wp_kses_allowed_html( 'post' );
|
265 |
-
$allowed_tags['iframe'] = array(
|
266 |
-
'width' => array(),
|
267 |
-
'height' => array(),
|
268 |
-
'src' => array(),
|
269 |
-
'frameborder' => array(),
|
270 |
-
'allowfullscreen' => array(),
|
271 |
-
);
|
272 |
-
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? wp_kses_post( $new_instance['title'] ) : '';
|
273 |
-
$instance['image_src'] = ( ! empty( $new_instance['image_src'] ) ) ? esc_url_raw( $new_instance['image_src'] ) : '';
|
274 |
-
$instance['image_pos'] = ( ! empty( $new_instance['image_pos'] ) ) ? esc_html( $new_instance['image_pos'] ) : '';
|
275 |
-
$instance['body_content'] = ( ! empty( $new_instance['body_content'] ) ) ? wp_kses( $new_instance['body_content'], $allowed_tags ) : '';
|
276 |
-
$instance['button1'] = ( ! empty( $new_instance['button1'] ) ) ? esc_html( $new_instance['button1'] ) : '';
|
277 |
-
$instance['button2'] = ( ! empty( $new_instance['button2'] ) ) ? esc_html( $new_instance['button2'] ) : '';
|
278 |
-
$instance['button1_link'] = ( ! empty( $new_instance['button1_link'] ) ) ? esc_url_raw( $new_instance['button1_link'] ) : '';
|
279 |
-
$instance['button2_link'] = ( ! empty( $new_instance['button2_link'] ) ) ? esc_url_raw( $new_instance['button2_link'] ) : '';
|
280 |
-
$instance['border_bottom'] = ( ! empty( $new_instance['border_bottom'] ) ) ? esc_html( $new_instance['border_bottom'] ) : '';
|
281 |
-
|
282 |
-
return $instance;
|
283 |
-
}
|
284 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Homepage parallax section Widget
|
5 |
+
* Shapely Theme
|
6 |
+
*/
|
7 |
+
class Shapely_Home_Parallax extends WP_Widget {
|
8 |
+
|
9 |
+
private $defaults = array();
|
10 |
+
|
11 |
+
function __construct() {
|
12 |
+
add_action( 'admin_init', array( $this, 'enqueue' ) );
|
13 |
+
add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue' ) );
|
14 |
+
add_action( 'customize_preview_init', array( $this, 'enqueue' ) );
|
15 |
+
|
16 |
+
$widget_ops = array(
|
17 |
+
'classname' => 'shapely_home_parallax',
|
18 |
+
'description' => esc_html__( 'Shapely FrontPage Parallax Section', 'shapely-companion' ),
|
19 |
+
'customize_selective_refresh' => true,
|
20 |
+
);
|
21 |
+
parent::__construct( 'shapely_home_parallax', esc_html__( '[Shapely] Parallax Section For FrontPage', 'shapely-companion' ), $widget_ops );
|
22 |
+
|
23 |
+
$this->defaults = array(
|
24 |
+
'title' => '',
|
25 |
+
'image_src' => '',
|
26 |
+
'image_pos' => esc_html__( 'left', 'shapely-companion' ),
|
27 |
+
'body_content' => '',
|
28 |
+
'button1' => '',
|
29 |
+
'button2' => '',
|
30 |
+
'button1_link' => '',
|
31 |
+
'button2_link' => '',
|
32 |
+
'border_bottom' => '',
|
33 |
+
);
|
34 |
+
}
|
35 |
+
|
36 |
+
public function enqueue() {
|
37 |
+
|
38 |
+
if ( is_admin() && ! is_customize_preview() ) {
|
39 |
+
wp_enqueue_style( 'epsilon-styles', get_template_directory_uri() . '/inc/libraries/epsilon-framework/assets/css/style.css' );
|
40 |
+
}
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* @param array $args
|
46 |
+
* @param array $instance
|
47 |
+
*/
|
48 |
+
function widget( $args, $instance ) {
|
49 |
+
$allowed_tags = wp_kses_allowed_html( 'post' );
|
50 |
+
$allowed_tags['iframe'] = array(
|
51 |
+
'width' => array(),
|
52 |
+
'height' => array(),
|
53 |
+
'src' => array(),
|
54 |
+
'frameborder' => array(),
|
55 |
+
'allowfullscreen' => array(),
|
56 |
+
);
|
57 |
+
|
58 |
+
$instance = wp_parse_args( $instance, $this->defaults );
|
59 |
+
|
60 |
+
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
61 |
+
|
62 |
+
/* Classes */
|
63 |
+
$class1 = ( 'background-full' == $instance['image_pos'] ) ? 'cover fullscreen image-bg' : ( ( 'background-small' == $instance['image_pos'] ) ? 'small-screen image-bg p0' : ( ( 'right' == $instance['image_pos'] ) ? 'bg-secondary' : ( ( 'bottom' == $instance['image_pos'] ) ? 'bg-secondary pb0' : '' ) ) );
|
64 |
+
$class2 = ( ( 'background-full' == $instance['image_pos'] ) || ( 'background-small' == $instance['image_pos'] ) ) ? 'top-parallax-section' : ( ( 'right' == $instance['image_pos'] ) ? 'col-md-4 col-sm-5 mb-xs-24' : ( ( 'left' == $instance['image_pos'] ) ? 'col-md-4 col-md-offset-1 col-sm-5 col-sm-offset-1' : ( ( 'bottom' == $instance['image_pos'] ) ? 'col-sm-10 col-sm-offset-1 text-center' : ( ( 'top' == $instance['image_pos'] ) ? 'col-sm-10 col-sm-offset-1 text-center mt30' : '' ) ) ) );
|
65 |
+
$class3 = ( ( 'background-full' == $instance['image_pos'] ) || ( 'background-small' == $instance['image_pos'] ) ) ? 'col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1 text-center' : '';
|
66 |
+
$class4 = ( 'left' == $instance['image_pos'] || 'right' == $instance['image_pos'] ) ? 'row align-children' : 'row';
|
67 |
+
$class5 = ( 'right' == $instance['image_pos'] ) ? 'col-md-7 col-md-offset-1 col-sm-6 col-sm-offset-1 text-center' : '';
|
68 |
+
$class6 = ( 'left' == $instance['image_pos'] ) ? 'col-md-7 col-sm-6 text-center mb-xs-24' : '';
|
69 |
+
$class7 = ( 'background-full' == $instance['image_pos'] ) ? 'fullscreen' : '';
|
70 |
+
|
71 |
+
if ( 'on' == $instance['border_bottom'] ) {
|
72 |
+
$class1 .= ' border-bottom';
|
73 |
+
}
|
74 |
+
/**
|
75 |
+
* Widget Content
|
76 |
+
*/
|
77 |
+
?>
|
78 |
+
<section class="<?php echo esc_attr( $class1 ); ?>">
|
79 |
+
<?php
|
80 |
+
if ( ( 'background-full' == $instance['image_pos'] || 'background-small' == $instance['image_pos'] ) && '' != $instance['image_src'] ) {
|
81 |
+
?>
|
82 |
+
<div class="parallax-window <?php echo esc_attr( $class7 ); ?>" data-parallax="scroll" data-image-src="<?php echo esc_url( $instance['image_src'] ); ?>" data-ios-fix="true" data-over-scroll-fix="true" data-android-fix="true">
|
83 |
+
<div class="<?php echo ( 'background-full' == $instance['image_pos'] ) ? 'align-transform' : ''; ?>">
|
84 |
+
<?php } else { ?>
|
85 |
+
<div class="container">
|
86 |
+
<?php } ?>
|
87 |
+
|
88 |
+
<div class="<?php echo esc_attr( $class4 ); ?>">
|
89 |
+
|
90 |
+
<?php
|
91 |
+
if ( ( 'left' == $instance['image_pos'] || 'top' == $instance['image_pos'] ) && '' != $instance['image_src'] ) {
|
92 |
+
?>
|
93 |
+
<div class="<?php echo esc_attr( $class6 ); ?>">
|
94 |
+
<img class="img-responsive" alt="<?php echo esc_attr( $instance['title'] ); ?>" src="<?php echo esc_url( $instance['image_src'] ); ?>">
|
95 |
+
</div>
|
96 |
+
<?php
|
97 |
+
}
|
98 |
+
?>
|
99 |
+
|
100 |
+
<div class="<?php echo esc_attr( $class2 ); ?>">
|
101 |
+
<div class="<?php echo esc_attr( $class3 ); ?>">
|
102 |
+
<?php
|
103 |
+
echo ( '' != $instance['title'] ) ? ( ( 'background-full' == $instance['image_pos'] ) || ( 'background-small' == $instance['image_pos'] ) ) ? '<h1>' . wp_kses_post( $instance['title'] ) . '</h1>' : '<h3>' . wp_kses_post( $instance['title'] ) . '</h3>' : '';
|
104 |
+
if ( '' != $instance['body_content'] ) {
|
105 |
+
echo '<div class="mb32">';
|
106 |
+
echo apply_filters( 'the_content', wp_kses( $instance['body_content'], $allowed_tags ) );
|
107 |
+
echo '</div>';
|
108 |
+
}
|
109 |
+
echo ( '' != $instance['button1'] && '' != $instance['button1_link'] ) ? '<a class="btn btn-lg btn-filled" href="' . esc_url( $instance['button1_link'] ) . '">' . wp_kses_post( $instance['button1'] ) . '</a>' : '';
|
110 |
+
echo ( '' != $instance['button2'] && '' != $instance['button2_link'] ) ? '<a class="btn btn-lg btn-white" href="' . esc_url( $instance['button2_link'] ) . '">' . wp_kses_post( $instance['button2'] ) . '</a>' : '';
|
111 |
+
?>
|
112 |
+
</div>
|
113 |
+
</div>
|
114 |
+
<!--end of row-->
|
115 |
+
<?php
|
116 |
+
if ( ( 'right' == $instance['image_pos'] || 'bottom' == $instance['image_pos'] ) && '' != $instance['image_src'] ) {
|
117 |
+
?>
|
118 |
+
<div class="<?php echo esc_attr( $class5 ); ?>">
|
119 |
+
<img class="img-responsive" alt="<?php echo esc_attr( $instance['title'] ); ?>" src="<?php echo esc_url( $instance['image_src'] ); ?>">
|
120 |
+
</div>
|
121 |
+
<?php
|
122 |
+
}
|
123 |
+
?>
|
124 |
+
</div>
|
125 |
+
</div>
|
126 |
+
<?php if ( 'background-full' == $instance['image_pos'] || 'background-small' == $instance['image_pos'] ) { ?>
|
127 |
+
</div>
|
128 |
+
<?php } ?>
|
129 |
+
</section>
|
130 |
+
<div class="clearfix"></div>
|
131 |
+
<?php
|
132 |
+
|
133 |
+
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
134 |
+
}
|
135 |
+
|
136 |
+
|
137 |
+
/**
|
138 |
+
* @param array $instance
|
139 |
+
*
|
140 |
+
* @return string|void
|
141 |
+
*/
|
142 |
+
function form( $instance ) {
|
143 |
+
$allowed_tags = wp_kses_allowed_html( 'post' );
|
144 |
+
$allowed_tags['iframe'] = array(
|
145 |
+
'width' => array(),
|
146 |
+
'height' => array(),
|
147 |
+
'src' => array(),
|
148 |
+
'frameborder' => array(),
|
149 |
+
'allowfullscreen' => array(),
|
150 |
+
);
|
151 |
+
|
152 |
+
$instance = wp_parse_args( $instance, $this->defaults );
|
153 |
+
|
154 |
+
$placeholder_url = plugins_url( 'shapely-companion/assets/img/placeholder-image.jpg' );
|
155 |
+
|
156 |
+
?>
|
157 |
+
|
158 |
+
<p>
|
159 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
|
160 |
+
<?php echo esc_html__( 'Title ', 'shapely-companion' ); ?>
|
161 |
+
</label>
|
162 |
+
|
163 |
+
<input type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" class="widefat" />
|
164 |
+
</p>
|
165 |
+
|
166 |
+
<p class="shapely-media-control" data-delegate-container="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>">
|
167 |
+
<label
|
168 |
+
for="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>">
|
169 |
+
<?php
|
170 |
+
echo esc_html__( 'Image', 'shapely-companion' );
|
171 |
+
?>
|
172 |
+
:</label>
|
173 |
+
|
174 |
+
<img data-default="<?php echo esc_url( $placeholder_url ); ?>" src="<?php echo '' != $instance['image_src'] ? esc_url( $instance['image_src'] ) : esc_url( $placeholder_url ); ?>" />
|
175 |
+
|
176 |
+
<input type="hidden" name="<?php echo esc_attr( $this->get_field_name( 'image_src' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>" value="<?php echo esc_url( $instance['image_src'] ); ?>" class="image-id blazersix-media-control-target">
|
177 |
+
|
178 |
+
<button type="button" class="button upload-button"><?php echo esc_html__( 'Choose Image', 'shapely-companion' ); ?></button>
|
179 |
+
<button type="button" class="button remove-button"><?php echo esc_html__( 'Remove Image', 'shapely-companion' ); ?></button>
|
180 |
+
</p>
|
181 |
+
|
182 |
+
<p class="shapely-editor-container">
|
183 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'body_content' ) ); ?>">
|
184 |
+
<?php echo esc_html__( 'Content ', 'shapely-companion' ); ?>
|
185 |
+
</label>
|
186 |
+
|
187 |
+
<textarea name="<?php echo esc_attr( $this->get_field_name( 'body_content' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'body_content' ) ); ?>" class="widefat">
|
188 |
+
<?php echo wp_kses( nl2br( $instance['body_content'] ), $allowed_tags ); ?>
|
189 |
+
</textarea>
|
190 |
+
</p>
|
191 |
+
|
192 |
+
<p>
|
193 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'image_pos' ) ); ?>">
|
194 |
+
<?php echo esc_html__( 'Image Position ', 'shapely-companion' ); ?>
|
195 |
+
</label>
|
196 |
+
|
197 |
+
<select name="<?php echo esc_attr( $this->get_field_name( 'image_pos' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'image_pos' ) ); ?>" class="widefat">
|
198 |
+
<option value="left" <?php selected( $instance['image_pos'], 'left' ); ?>><?php echo esc_html__( 'Left', 'shapely-companion' ); ?></option>
|
199 |
+
<option value="right" <?php selected( $instance['image_pos'], 'right' ); ?>><?php echo esc_html__( 'Right', 'shapely-companion' ); ?></option>
|
200 |
+
<option value="top" <?php selected( $instance['image_pos'], 'top' ); ?>><?php echo esc_html__( 'Top', 'shapely-companion' ); ?></option>
|
201 |
+
<option value="bottom" <?php selected( $instance['image_pos'], 'bottom' ); ?>><?php echo esc_html__( 'Bottom', 'shapely-companion' ); ?></option>
|
202 |
+
<option value="background-full" <?php selected( $instance['image_pos'], 'background-full' ); ?>><?php echo esc_html__( 'Background Full', 'shapely-companion' ); ?></option>
|
203 |
+
<option value="background-small" <?php selected( $instance['image_pos'], 'background-small' ); ?>><?php echo esc_html__( 'Background Small', 'shapely-companion' ); ?></option>
|
204 |
+
</select>
|
205 |
+
</p>
|
206 |
+
|
207 |
+
<p>
|
208 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'button1' ) ); ?>">
|
209 |
+
<?php echo esc_html__( 'Button 1 Text ', 'shapely-companion' ); ?>
|
210 |
+
</label>
|
211 |
+
|
212 |
+
<input type="text" value="<?php echo esc_attr( $instance['button1'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'button1' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'button1' ) ); ?>" class="widefat" />
|
213 |
+
</p>
|
214 |
+
|
215 |
+
<p>
|
216 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'button1_link' ) ); ?>">
|
217 |
+
<?php echo esc_html__( 'Button 1 Link ', 'shapely-companion' ); ?>
|
218 |
+
</label>
|
219 |
+
|
220 |
+
<input type="text" value="<?php echo esc_url( $instance['button1_link'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'button1_link' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'button1_link' ) ); ?>" class="widefat" />
|
221 |
+
</p>
|
222 |
+
|
223 |
+
<p>
|
224 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'button2' ) ); ?>">
|
225 |
+
<?php echo esc_html__( 'Button 2 Text ', 'shapely-companion' ); ?>
|
226 |
+
</label>
|
227 |
+
|
228 |
+
<input type="text" value="<?php echo esc_attr( $instance['button2'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'button2' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'button2' ) ); ?>" class="widefat" />
|
229 |
+
</p>
|
230 |
+
|
231 |
+
<p>
|
232 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'button2_link' ) ); ?>">
|
233 |
+
<?php echo esc_html__( 'Button 2 Link ', 'shapely-companion' ); ?>
|
234 |
+
</label>
|
235 |
+
|
236 |
+
<input type="text" value="<?php echo esc_url( $instance['button2_link'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'button2_link' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'button2_link' ) ); ?>" class="widefat" />
|
237 |
+
</p>
|
238 |
+
|
239 |
+
<div class="checkbox_switch wp-clearfix">
|
240 |
+
<span class="customize-control-title onoffswitch_label">
|
241 |
+
<?php echo esc_html__( 'Border bottom', 'shapely-companion' ); ?>
|
242 |
+
</span>
|
243 |
+
<div class="onoffswitch">
|
244 |
+
<input type="checkbox" id="<?php echo esc_attr( $this->get_field_name( 'border_bottom' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'border_bottom' ) ); ?>" class="onoffswitch-checkbox" value="on"
|
245 |
+
<?php checked( $instance['border_bottom'], 'on' ); ?>>
|
246 |
+
<label class="onoffswitch-label" for="<?php echo esc_attr( $this->get_field_name( 'border_bottom' ) ); ?>"></label>
|
247 |
+
</div>
|
248 |
+
</div>
|
249 |
+
<?php
|
250 |
+
}
|
251 |
+
|
252 |
+
/**
|
253 |
+
* Sanitize widget form values as they are saved.
|
254 |
+
*
|
255 |
+
* @see WP_Widget::update()
|
256 |
+
*
|
257 |
+
* @param array $new_instance Values just sent to be saved.
|
258 |
+
* @param array $old_instance Previously saved values from database.
|
259 |
+
*
|
260 |
+
* @return array Updated safe values to be saved.
|
261 |
+
*/
|
262 |
+
public function update( $new_instance, $old_instance ) {
|
263 |
+
$instance = array();
|
264 |
+
$allowed_tags = wp_kses_allowed_html( 'post' );
|
265 |
+
$allowed_tags['iframe'] = array(
|
266 |
+
'width' => array(),
|
267 |
+
'height' => array(),
|
268 |
+
'src' => array(),
|
269 |
+
'frameborder' => array(),
|
270 |
+
'allowfullscreen' => array(),
|
271 |
+
);
|
272 |
+
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? wp_kses_post( $new_instance['title'] ) : '';
|
273 |
+
$instance['image_src'] = ( ! empty( $new_instance['image_src'] ) ) ? esc_url_raw( $new_instance['image_src'] ) : '';
|
274 |
+
$instance['image_pos'] = ( ! empty( $new_instance['image_pos'] ) ) ? esc_html( $new_instance['image_pos'] ) : '';
|
275 |
+
$instance['body_content'] = ( ! empty( $new_instance['body_content'] ) ) ? wp_kses( $new_instance['body_content'], $allowed_tags ) : '';
|
276 |
+
$instance['button1'] = ( ! empty( $new_instance['button1'] ) ) ? esc_html( $new_instance['button1'] ) : '';
|
277 |
+
$instance['button2'] = ( ! empty( $new_instance['button2'] ) ) ? esc_html( $new_instance['button2'] ) : '';
|
278 |
+
$instance['button1_link'] = ( ! empty( $new_instance['button1_link'] ) ) ? esc_url_raw( $new_instance['button1_link'] ) : '';
|
279 |
+
$instance['button2_link'] = ( ! empty( $new_instance['button2_link'] ) ) ? esc_url_raw( $new_instance['button2_link'] ) : '';
|
280 |
+
$instance['border_bottom'] = ( ! empty( $new_instance['border_bottom'] ) ) ? esc_html( $new_instance['border_bottom'] ) : '';
|
281 |
+
|
282 |
+
return $instance;
|
283 |
+
}
|
284 |
+
}
|
inc/widgets/class-shapely-home-portfolio.php
CHANGED
@@ -1,254 +1,254 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Homepage parallax section Widget
|
5 |
-
* Shapely Theme
|
6 |
-
*/
|
7 |
-
class Shapely_Home_Portfolio extends WP_Widget {
|
8 |
-
|
9 |
-
private $defaults = array();
|
10 |
-
|
11 |
-
function __construct() {
|
12 |
-
|
13 |
-
$widget_ops = array(
|
14 |
-
'classname' => 'shapely_home_portfolio',
|
15 |
-
'description' => esc_html__( 'Shapely Porfolio for Home Widget Section', 'shapely-companion' ),
|
16 |
-
'customize_selective_refresh' => true,
|
17 |
-
);
|
18 |
-
parent::__construct( 'shapely_home_portfolio', esc_html__( '[Shapely] Porfolio for Home Widget Section', 'shapely-companion' ), $widget_ops );
|
19 |
-
|
20 |
-
$this->defaults = array(
|
21 |
-
'title' => '',
|
22 |
-
'body_content' => '',
|
23 |
-
'fullwidth' => '1',
|
24 |
-
'mansonry' => '1',
|
25 |
-
'backgroundcolor' => '#0e1015',
|
26 |
-
'textcolor' => '#ffffff',
|
27 |
-
'postsnumber' => 10,
|
28 |
-
'category' => 0,
|
29 |
-
);
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* @param array $args
|
34 |
-
* @param array $instance
|
35 |
-
*/
|
36 |
-
function widget( $args, $instance ) {
|
37 |
-
|
38 |
-
$instance = wp_parse_args( $instance, $this->defaults );
|
39 |
-
|
40 |
-
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Widget Content
|
44 |
-
*/
|
45 |
-
?>
|
46 |
-
<section class="projects pb0" style="background-color:<?php echo esc_attr( $instance['backgroundcolor'] ); ?>">
|
47 |
-
<div class="container">
|
48 |
-
<div class="col-sm-12 text-center">
|
49 |
-
<h3 class="mb32" style="color:<?php echo esc_attr( $instance['textcolor'] ); ?>"><?php echo wp_kses_post( nl2br( $instance['title'] ) ); ?></h3>
|
50 |
-
<p class="mb40" style="color:<?php echo esc_attr( $instance['textcolor'] ); ?>"><?php echo wp_kses_post( nl2br( $instance['body_content'] ) ); ?></p>
|
51 |
-
</div>
|
52 |
-
</div>
|
53 |
-
<?php
|
54 |
-
|
55 |
-
$portfolio_args = array(
|
56 |
-
'post_type' => 'jetpack-portfolio',
|
57 |
-
'posts_per_page' => absint( $instance['postsnumber'] ),
|
58 |
-
'ignore_sticky_posts' => 1,
|
59 |
-
);
|
60 |
-
|
61 |
-
if ( 0 != $instance['category'] ) {
|
62 |
-
$portfolio_args['tax_query'] = array(
|
63 |
-
array(
|
64 |
-
'taxonomy' => 'jetpack-portfolio-type',
|
65 |
-
'field' => 'term_id',
|
66 |
-
'terms' => absint( $instance['category'] ),
|
67 |
-
),
|
68 |
-
);
|
69 |
-
}
|
70 |
-
|
71 |
-
$portfolio_query = new WP_Query( $portfolio_args );
|
72 |
-
|
73 |
-
if ( $portfolio_query->have_posts() ) :
|
74 |
-
?>
|
75 |
-
|
76 |
-
<div class="row masonry-loader fixed-center fadeOut">
|
77 |
-
<div class="col-sm-12 text-center">
|
78 |
-
<div class="spinner"></div>
|
79 |
-
</div>
|
80 |
-
</div>
|
81 |
-
<?php if ( '1' != $instance['fullwidth'] ) : ?>
|
82 |
-
<div class="container">
|
83 |
-
<?php endif ?>
|
84 |
-
<div class="row fadeIn<?php echo $instance['mansonry'] ? ' masonry masonryFlyIn' : ''; ?>">
|
85 |
-
<?php
|
86 |
-
|
87 |
-
while ( $portfolio_query->have_posts() ) :
|
88 |
-
$portfolio_query->the_post();
|
89 |
-
|
90 |
-
if ( has_post_thumbnail() ) {
|
91 |
-
|
92 |
-
$permalink = get_the_permalink();
|
93 |
-
$thumbnail_url = get_the_post_thumbnail_url( get_the_ID(), 'full' );
|
94 |
-
$item_style = '';
|
95 |
-
if ( ! $instance['mansonry'] ) {
|
96 |
-
$item_style = 'background-image: url(' . esc_url( $thumbnail_url ) . ')';
|
97 |
-
}
|
98 |
-
|
99 |
-
$url = get_post_meta( get_the_ID(), 'shapely_companion_portfolio_link', true );
|
100 |
-
if ( $url ) {
|
101 |
-
$permalink = $url;
|
102 |
-
}
|
103 |
-
|
104 |
-
$args_projects = array(
|
105 |
-
'fields' => 'names',
|
106 |
-
);
|
107 |
-
$project_types = wp_get_post_terms( get_the_ID(), 'jetpack-portfolio-type', $args_projects );
|
108 |
-
|
109 |
-
?>
|
110 |
-
<div class="col-md-3 col-sm-6 project fadeIn<?php echo $instance['mansonry'] ? ' masonry-item' : ''; ?>">
|
111 |
-
<div class="image-tile inner-title hover-reveal text-center" style="<?php echo esc_attr( $item_style ); ?>">
|
112 |
-
<a href="<?php echo esc_url( $permalink ); ?>" title="<?php the_title_attribute(); ?>">
|
113 |
-
<?php
|
114 |
-
if ( $instance['mansonry'] ) {
|
115 |
-
the_post_thumbnail( 'full' );
|
116 |
-
}
|
117 |
-
?>
|
118 |
-
<div class="title">
|
119 |
-
<?php
|
120 |
-
the_title( '<h5 class="mb0">', '</h5>' );
|
121 |
-
if ( ! empty( $project_types ) ) {
|
122 |
-
echo '<span>' . wp_kses_post( implode( ' / ', $project_types ) ) . '</span>';
|
123 |
-
}
|
124 |
-
?>
|
125 |
-
</div>
|
126 |
-
</a>
|
127 |
-
</div>
|
128 |
-
</div>
|
129 |
-
<?php
|
130 |
-
}
|
131 |
-
endwhile;
|
132 |
-
?>
|
133 |
-
</div>
|
134 |
-
<?php if ( '1' != $instance['fullwidth'] ) : ?>
|
135 |
-
</div>
|
136 |
-
<?php endif ?>
|
137 |
-
<?php
|
138 |
-
endif;
|
139 |
-
wp_reset_postdata();
|
140 |
-
?>
|
141 |
-
</section>
|
142 |
-
|
143 |
-
<?php
|
144 |
-
|
145 |
-
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
146 |
-
}
|
147 |
-
|
148 |
-
|
149 |
-
/**
|
150 |
-
* @param array $instance
|
151 |
-
*
|
152 |
-
* @return string|void
|
153 |
-
*/
|
154 |
-
function form( $instance ) {
|
155 |
-
$instance = wp_parse_args( $instance, $this->defaults );
|
156 |
-
$categories = get_terms(
|
157 |
-
array(
|
158 |
-
'taxonomy' => 'jetpack-portfolio-type',
|
159 |
-
'fields' => 'id=>name',
|
160 |
-
)
|
161 |
-
);
|
162 |
-
?>
|
163 |
-
|
164 |
-
<p>
|
165 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php echo esc_html__( 'Title ', 'shapely-companion' ); ?></label>
|
166 |
-
<input type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" class="widefat"/>
|
167 |
-
</p>
|
168 |
-
|
169 |
-
<p class="shapely-editor-container">
|
170 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'body_content' ) ); ?>"><?php echo esc_html__( 'Content ', 'shapely-companion' ); ?></label>
|
171 |
-
<textarea name="<?php echo esc_attr( $this->get_field_name( 'body_content' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'body_content' ) ); ?>" class="widefat">
|
172 |
-
<?php echo wp_kses_post( nl2br( $instance['body_content'] ) ); ?>
|
173 |
-
</textarea>
|
174 |
-
</p>
|
175 |
-
|
176 |
-
<p>
|
177 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'category' ) ); ?>"><?php echo esc_html__( 'Portfolio Types ', 'shapely-companion' ); ?></label>
|
178 |
-
<select name="<?php echo esc_attr( $this->get_field_name( 'category' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'category' ) ); ?>" class="widefat">
|
179 |
-
<option value="0"><?php echo esc_html__( 'All Types ', 'shapely-companion' ); ?></option>
|
180 |
-
<?php
|
181 |
-
|
182 |
-
foreach ( $categories as $id => $category ) {
|
183 |
-
echo '<option value="' . esc_attr( $id ) . '" ' . selected( $instance['category'], $id ) . '>' . esc_html( $category ) . '</option>';
|
184 |
-
}
|
185 |
-
|
186 |
-
?>
|
187 |
-
</select>
|
188 |
-
</p>
|
189 |
-
|
190 |
-
<p>
|
191 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'postsnumber' ) ); ?>"><?php echo esc_html__( 'Number of Projects ', 'shapely-companion' ); ?></label>
|
192 |
-
<input id="<?php echo esc_attr( $this->get_field_id( 'postsnumber' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['postsnumber'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'postsnumber' ) ); ?>" class="widefat"/>
|
193 |
-
</p>
|
194 |
-
|
195 |
-
<div class="checkbox_switch wp-clearfix">
|
196 |
-
<span class="customize-control-title onoffswitch_label">
|
197 |
-
<?php echo esc_html__( 'Full Width Container', 'shapely-companion' ); ?>
|
198 |
-
</span>
|
199 |
-
<div class="onoffswitch">
|
200 |
-
<input type="checkbox" id="<?php echo esc_attr( $this->get_field_name( 'fullwidth' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'fullwidth' ) ); ?>" class="onoffswitch-checkbox" value="1"
|
201 |
-
<?php checked( $instance['fullwidth'], '1' ); ?>>
|
202 |
-
<label class="onoffswitch-label" for="<?php echo esc_attr( $this->get_field_name( 'fullwidth' ) ); ?>"></label>
|
203 |
-
</div>
|
204 |
-
</div>
|
205 |
-
|
206 |
-
<div class="checkbox_switch wp-clearfix">
|
207 |
-
<span class="customize-control-title onoffswitch_label">
|
208 |
-
<?php echo esc_html__( 'Mansonry Layout', 'shapely-companion' ); ?>
|
209 |
-
</span>
|
210 |
-
<div class="onoffswitch">
|
211 |
-
<input type="checkbox" id="<?php echo esc_attr( $this->get_field_name( 'mansonry' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'mansonry' ) ); ?>" class="onoffswitch-checkbox" value="1"
|
212 |
-
<?php checked( $instance['mansonry'], '1' ); ?>>
|
213 |
-
<label class="onoffswitch-label" for="<?php echo esc_attr( $this->get_field_name( 'mansonry' ) ); ?>"></label>
|
214 |
-
</div>
|
215 |
-
</div>
|
216 |
-
|
217 |
-
<p>
|
218 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'backgroundcolor' ) ); ?>"><?php echo esc_html__( 'Background Color ', 'shapely-companion' ); ?></label><br>
|
219 |
-
<input type="text" value="<?php echo esc_attr( $instance['backgroundcolor'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'backgroundcolor' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'backgroundcolor' ) ); ?>" class="widefat shapely-color-picker"/>
|
220 |
-
</p>
|
221 |
-
|
222 |
-
<p>
|
223 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'textcolor' ) ); ?>"><?php echo esc_html__( 'Text Color ', 'shapely-companion' ); ?></label><br>
|
224 |
-
<input type="text" value="<?php echo esc_attr( $instance['textcolor'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'textcolor' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'textcolor' ) ); ?>" class="widefat shapely-color-picker"/>
|
225 |
-
</p>
|
226 |
-
|
227 |
-
<?php
|
228 |
-
}
|
229 |
-
|
230 |
-
/**
|
231 |
-
* Sanitize widget form values as they are saved.
|
232 |
-
*
|
233 |
-
* @see WP_Widget::update()
|
234 |
-
*
|
235 |
-
* @param array $new_instance Values just sent to be saved.
|
236 |
-
* @param array $old_instance Previously saved values from database.
|
237 |
-
*
|
238 |
-
* @return array Updated safe values to be saved.
|
239 |
-
*/
|
240 |
-
public function update( $new_instance, $old_instance ) {
|
241 |
-
$instance = array();
|
242 |
-
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? wp_kses_post( $new_instance['title'] ) : '';
|
243 |
-
$instance['postsnumber'] = ( ! empty( $new_instance['postsnumber'] ) ) ? absint( $new_instance['postsnumber'] ) : '10';
|
244 |
-
$instance['body_content'] = ( ! empty( $new_instance['body_content'] ) ) ? wp_kses_post( $new_instance['body_content'] ) : '';
|
245 |
-
$instance['fullwidth'] = ( ! empty( $new_instance['fullwidth'] ) ) ? absint( $new_instance['fullwidth'] ) : 0;
|
246 |
-
$instance['mansonry'] = ( ! empty( $new_instance['mansonry'] ) ) ? absint( $new_instance['mansonry'] ) : 0;
|
247 |
-
$instance['category'] = ( ! empty( $new_instance['category'] ) ) ? absint( $new_instance['category'] ) : 0;
|
248 |
-
$instance['backgroundcolor'] = ( ! empty( $new_instance['backgroundcolor'] ) ) ? sanitize_hex_color( $new_instance['backgroundcolor'] ) : '#0e1015';
|
249 |
-
$instance['textcolor'] = ( ! empty( $new_instance['textcolor'] ) ) ? sanitize_hex_color( $new_instance['textcolor'] ) : '#ffffff';
|
250 |
-
|
251 |
-
return $instance;
|
252 |
-
}
|
253 |
-
|
254 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Homepage parallax section Widget
|
5 |
+
* Shapely Theme
|
6 |
+
*/
|
7 |
+
class Shapely_Home_Portfolio extends WP_Widget {
|
8 |
+
|
9 |
+
private $defaults = array();
|
10 |
+
|
11 |
+
function __construct() {
|
12 |
+
|
13 |
+
$widget_ops = array(
|
14 |
+
'classname' => 'shapely_home_portfolio',
|
15 |
+
'description' => esc_html__( 'Shapely Porfolio for Home Widget Section', 'shapely-companion' ),
|
16 |
+
'customize_selective_refresh' => true,
|
17 |
+
);
|
18 |
+
parent::__construct( 'shapely_home_portfolio', esc_html__( '[Shapely] Porfolio for Home Widget Section', 'shapely-companion' ), $widget_ops );
|
19 |
+
|
20 |
+
$this->defaults = array(
|
21 |
+
'title' => '',
|
22 |
+
'body_content' => '',
|
23 |
+
'fullwidth' => '1',
|
24 |
+
'mansonry' => '1',
|
25 |
+
'backgroundcolor' => '#0e1015',
|
26 |
+
'textcolor' => '#ffffff',
|
27 |
+
'postsnumber' => 10,
|
28 |
+
'category' => 0,
|
29 |
+
);
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @param array $args
|
34 |
+
* @param array $instance
|
35 |
+
*/
|
36 |
+
function widget( $args, $instance ) {
|
37 |
+
|
38 |
+
$instance = wp_parse_args( $instance, $this->defaults );
|
39 |
+
|
40 |
+
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Widget Content
|
44 |
+
*/
|
45 |
+
?>
|
46 |
+
<section class="projects pb0" style="background-color:<?php echo esc_attr( $instance['backgroundcolor'] ); ?>">
|
47 |
+
<div class="container">
|
48 |
+
<div class="col-sm-12 text-center">
|
49 |
+
<h3 class="mb32" style="color:<?php echo esc_attr( $instance['textcolor'] ); ?>"><?php echo wp_kses_post( nl2br( $instance['title'] ) ); ?></h3>
|
50 |
+
<p class="mb40" style="color:<?php echo esc_attr( $instance['textcolor'] ); ?>"><?php echo wp_kses_post( nl2br( $instance['body_content'] ) ); ?></p>
|
51 |
+
</div>
|
52 |
+
</div>
|
53 |
+
<?php
|
54 |
+
|
55 |
+
$portfolio_args = array(
|
56 |
+
'post_type' => 'jetpack-portfolio',
|
57 |
+
'posts_per_page' => absint( $instance['postsnumber'] ),
|
58 |
+
'ignore_sticky_posts' => 1,
|
59 |
+
);
|
60 |
+
|
61 |
+
if ( 0 != $instance['category'] ) {
|
62 |
+
$portfolio_args['tax_query'] = array(
|
63 |
+
array(
|
64 |
+
'taxonomy' => 'jetpack-portfolio-type',
|
65 |
+
'field' => 'term_id',
|
66 |
+
'terms' => absint( $instance['category'] ),
|
67 |
+
),
|
68 |
+
);
|
69 |
+
}
|
70 |
+
|
71 |
+
$portfolio_query = new WP_Query( $portfolio_args );
|
72 |
+
|
73 |
+
if ( $portfolio_query->have_posts() ) :
|
74 |
+
?>
|
75 |
+
|
76 |
+
<div class="row masonry-loader fixed-center fadeOut">
|
77 |
+
<div class="col-sm-12 text-center">
|
78 |
+
<div class="spinner"></div>
|
79 |
+
</div>
|
80 |
+
</div>
|
81 |
+
<?php if ( '1' != $instance['fullwidth'] ) : ?>
|
82 |
+
<div class="container">
|
83 |
+
<?php endif ?>
|
84 |
+
<div class="row fadeIn<?php echo $instance['mansonry'] ? ' masonry masonryFlyIn' : ''; ?>">
|
85 |
+
<?php
|
86 |
+
|
87 |
+
while ( $portfolio_query->have_posts() ) :
|
88 |
+
$portfolio_query->the_post();
|
89 |
+
|
90 |
+
if ( has_post_thumbnail() ) {
|
91 |
+
|
92 |
+
$permalink = get_the_permalink();
|
93 |
+
$thumbnail_url = get_the_post_thumbnail_url( get_the_ID(), 'full' );
|
94 |
+
$item_style = '';
|
95 |
+
if ( ! $instance['mansonry'] ) {
|
96 |
+
$item_style = 'background-image: url(' . esc_url( $thumbnail_url ) . ')';
|
97 |
+
}
|
98 |
+
|
99 |
+
$url = get_post_meta( get_the_ID(), 'shapely_companion_portfolio_link', true );
|
100 |
+
if ( $url ) {
|
101 |
+
$permalink = $url;
|
102 |
+
}
|
103 |
+
|
104 |
+
$args_projects = array(
|
105 |
+
'fields' => 'names',
|
106 |
+
);
|
107 |
+
$project_types = wp_get_post_terms( get_the_ID(), 'jetpack-portfolio-type', $args_projects );
|
108 |
+
|
109 |
+
?>
|
110 |
+
<div class="col-md-3 col-sm-6 project fadeIn<?php echo $instance['mansonry'] ? ' masonry-item' : ''; ?>">
|
111 |
+
<div class="image-tile inner-title hover-reveal text-center" style="<?php echo esc_attr( $item_style ); ?>">
|
112 |
+
<a href="<?php echo esc_url( $permalink ); ?>" title="<?php the_title_attribute(); ?>">
|
113 |
+
<?php
|
114 |
+
if ( $instance['mansonry'] ) {
|
115 |
+
the_post_thumbnail( 'full' );
|
116 |
+
}
|
117 |
+
?>
|
118 |
+
<div class="title">
|
119 |
+
<?php
|
120 |
+
the_title( '<h5 class="mb0">', '</h5>' );
|
121 |
+
if ( ! empty( $project_types ) ) {
|
122 |
+
echo '<span>' . wp_kses_post( implode( ' / ', $project_types ) ) . '</span>';
|
123 |
+
}
|
124 |
+
?>
|
125 |
+
</div>
|
126 |
+
</a>
|
127 |
+
</div>
|
128 |
+
</div>
|
129 |
+
<?php
|
130 |
+
}
|
131 |
+
endwhile;
|
132 |
+
?>
|
133 |
+
</div>
|
134 |
+
<?php if ( '1' != $instance['fullwidth'] ) : ?>
|
135 |
+
</div>
|
136 |
+
<?php endif ?>
|
137 |
+
<?php
|
138 |
+
endif;
|
139 |
+
wp_reset_postdata();
|
140 |
+
?>
|
141 |
+
</section>
|
142 |
+
|
143 |
+
<?php
|
144 |
+
|
145 |
+
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
146 |
+
}
|
147 |
+
|
148 |
+
|
149 |
+
/**
|
150 |
+
* @param array $instance
|
151 |
+
*
|
152 |
+
* @return string|void
|
153 |
+
*/
|
154 |
+
function form( $instance ) {
|
155 |
+
$instance = wp_parse_args( $instance, $this->defaults );
|
156 |
+
$categories = get_terms(
|
157 |
+
array(
|
158 |
+
'taxonomy' => 'jetpack-portfolio-type',
|
159 |
+
'fields' => 'id=>name',
|
160 |
+
)
|
161 |
+
);
|
162 |
+
?>
|
163 |
+
|
164 |
+
<p>
|
165 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php echo esc_html__( 'Title ', 'shapely-companion' ); ?></label>
|
166 |
+
<input type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" class="widefat"/>
|
167 |
+
</p>
|
168 |
+
|
169 |
+
<p class="shapely-editor-container">
|
170 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'body_content' ) ); ?>"><?php echo esc_html__( 'Content ', 'shapely-companion' ); ?></label>
|
171 |
+
<textarea name="<?php echo esc_attr( $this->get_field_name( 'body_content' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'body_content' ) ); ?>" class="widefat">
|
172 |
+
<?php echo wp_kses_post( nl2br( $instance['body_content'] ) ); ?>
|
173 |
+
</textarea>
|
174 |
+
</p>
|
175 |
+
|
176 |
+
<p>
|
177 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'category' ) ); ?>"><?php echo esc_html__( 'Portfolio Types ', 'shapely-companion' ); ?></label>
|
178 |
+
<select name="<?php echo esc_attr( $this->get_field_name( 'category' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'category' ) ); ?>" class="widefat">
|
179 |
+
<option value="0"><?php echo esc_html__( 'All Types ', 'shapely-companion' ); ?></option>
|
180 |
+
<?php
|
181 |
+
|
182 |
+
foreach ( $categories as $id => $category ) {
|
183 |
+
echo '<option value="' . esc_attr( $id ) . '" ' . selected( $instance['category'], $id ) . '>' . esc_html( $category ) . '</option>';
|
184 |
+
}
|
185 |
+
|
186 |
+
?>
|
187 |
+
</select>
|
188 |
+
</p>
|
189 |
+
|
190 |
+
<p>
|
191 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'postsnumber' ) ); ?>"><?php echo esc_html__( 'Number of Projects ', 'shapely-companion' ); ?></label>
|
192 |
+
<input id="<?php echo esc_attr( $this->get_field_id( 'postsnumber' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['postsnumber'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'postsnumber' ) ); ?>" class="widefat"/>
|
193 |
+
</p>
|
194 |
+
|
195 |
+
<div class="checkbox_switch wp-clearfix">
|
196 |
+
<span class="customize-control-title onoffswitch_label">
|
197 |
+
<?php echo esc_html__( 'Full Width Container', 'shapely-companion' ); ?>
|
198 |
+
</span>
|
199 |
+
<div class="onoffswitch">
|
200 |
+
<input type="checkbox" id="<?php echo esc_attr( $this->get_field_name( 'fullwidth' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'fullwidth' ) ); ?>" class="onoffswitch-checkbox" value="1"
|
201 |
+
<?php checked( $instance['fullwidth'], '1' ); ?>>
|
202 |
+
<label class="onoffswitch-label" for="<?php echo esc_attr( $this->get_field_name( 'fullwidth' ) ); ?>"></label>
|
203 |
+
</div>
|
204 |
+
</div>
|
205 |
+
|
206 |
+
<div class="checkbox_switch wp-clearfix">
|
207 |
+
<span class="customize-control-title onoffswitch_label">
|
208 |
+
<?php echo esc_html__( 'Mansonry Layout', 'shapely-companion' ); ?>
|
209 |
+
</span>
|
210 |
+
<div class="onoffswitch">
|
211 |
+
<input type="checkbox" id="<?php echo esc_attr( $this->get_field_name( 'mansonry' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'mansonry' ) ); ?>" class="onoffswitch-checkbox" value="1"
|
212 |
+
<?php checked( $instance['mansonry'], '1' ); ?>>
|
213 |
+
<label class="onoffswitch-label" for="<?php echo esc_attr( $this->get_field_name( 'mansonry' ) ); ?>"></label>
|
214 |
+
</div>
|
215 |
+
</div>
|
216 |
+
|
217 |
+
<p>
|
218 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'backgroundcolor' ) ); ?>"><?php echo esc_html__( 'Background Color ', 'shapely-companion' ); ?></label><br>
|
219 |
+
<input type="text" value="<?php echo esc_attr( $instance['backgroundcolor'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'backgroundcolor' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'backgroundcolor' ) ); ?>" class="widefat shapely-color-picker"/>
|
220 |
+
</p>
|
221 |
+
|
222 |
+
<p>
|
223 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'textcolor' ) ); ?>"><?php echo esc_html__( 'Text Color ', 'shapely-companion' ); ?></label><br>
|
224 |
+
<input type="text" value="<?php echo esc_attr( $instance['textcolor'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'textcolor' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'textcolor' ) ); ?>" class="widefat shapely-color-picker"/>
|
225 |
+
</p>
|
226 |
+
|
227 |
+
<?php
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Sanitize widget form values as they are saved.
|
232 |
+
*
|
233 |
+
* @see WP_Widget::update()
|
234 |
+
*
|
235 |
+
* @param array $new_instance Values just sent to be saved.
|
236 |
+
* @param array $old_instance Previously saved values from database.
|
237 |
+
*
|
238 |
+
* @return array Updated safe values to be saved.
|
239 |
+
*/
|
240 |
+
public function update( $new_instance, $old_instance ) {
|
241 |
+
$instance = array();
|
242 |
+
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? wp_kses_post( $new_instance['title'] ) : '';
|
243 |
+
$instance['postsnumber'] = ( ! empty( $new_instance['postsnumber'] ) ) ? absint( $new_instance['postsnumber'] ) : '10';
|
244 |
+
$instance['body_content'] = ( ! empty( $new_instance['body_content'] ) ) ? wp_kses_post( $new_instance['body_content'] ) : '';
|
245 |
+
$instance['fullwidth'] = ( ! empty( $new_instance['fullwidth'] ) ) ? absint( $new_instance['fullwidth'] ) : 0;
|
246 |
+
$instance['mansonry'] = ( ! empty( $new_instance['mansonry'] ) ) ? absint( $new_instance['mansonry'] ) : 0;
|
247 |
+
$instance['category'] = ( ! empty( $new_instance['category'] ) ) ? absint( $new_instance['category'] ) : 0;
|
248 |
+
$instance['backgroundcolor'] = ( ! empty( $new_instance['backgroundcolor'] ) ) ? sanitize_hex_color( $new_instance['backgroundcolor'] ) : '#0e1015';
|
249 |
+
$instance['textcolor'] = ( ! empty( $new_instance['textcolor'] ) ) ? sanitize_hex_color( $new_instance['textcolor'] ) : '#ffffff';
|
250 |
+
|
251 |
+
return $instance;
|
252 |
+
}
|
253 |
+
|
254 |
+
}
|
inc/widgets/class-shapely-home-testimonials.php
CHANGED
@@ -1,170 +1,170 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Homepage parallax section Widget
|
5 |
-
* Shapely Theme
|
6 |
-
*/
|
7 |
-
class Shapely_Home_Testimonials extends WP_Widget {
|
8 |
-
|
9 |
-
private $defaults = array();
|
10 |
-
|
11 |
-
function __construct() {
|
12 |
-
|
13 |
-
$widget_ops = array(
|
14 |
-
'classname' => 'shapely_home_testimonial',
|
15 |
-
'description' => esc_html__( 'Shapely Testimonial Widget Section', 'shapely-companion' ),
|
16 |
-
'customize_selective_refresh' => true,
|
17 |
-
);
|
18 |
-
parent::__construct( 'shapely_home_testimonial', esc_html__( '[Shapely] Testimonial Section For FrontPage', 'shapely-companion' ), $widget_ops );
|
19 |
-
|
20 |
-
$this->defaults = array(
|
21 |
-
'title' => esc_html__( 'People just like you are already loving Colorlib', 'shapely-companion' ),
|
22 |
-
'limit' => 5,
|
23 |
-
'image_src' => '',
|
24 |
-
);
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
* @param array $args
|
29 |
-
* @param array $instance
|
30 |
-
*/
|
31 |
-
function widget( $args, $instance ) {
|
32 |
-
|
33 |
-
$instance = wp_parse_args( $instance, $this->defaults );
|
34 |
-
|
35 |
-
$title = $instance['title'];
|
36 |
-
$limit = $instance['limit'];
|
37 |
-
$image_src = $instance['image_src'];
|
38 |
-
|
39 |
-
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Widget Content
|
43 |
-
*/
|
44 |
-
?>
|
45 |
-
|
46 |
-
<?php
|
47 |
-
$testimonial_args = array(
|
48 |
-
'post_type' => 'jetpack-testimonial',
|
49 |
-
'posts_per_page' => $limit,
|
50 |
-
'ignore_sticky_posts' => 1,
|
51 |
-
);
|
52 |
-
|
53 |
-
$testimonial_query = new WP_Query( $testimonial_args );
|
54 |
-
|
55 |
-
if ( $testimonial_query->have_posts() ) :
|
56 |
-
?>
|
57 |
-
<section class="parallax-section testimonial-section">
|
58 |
-
<div class="parallax-window" data-parallax="scroll" data-image-src="<?php echo esc_url( $image_src ); ?>" style="height: 500px;">
|
59 |
-
<div class="container align-transform">
|
60 |
-
<div class="parallax-text image-bg testimonial">
|
61 |
-
<div class="row">
|
62 |
-
<div class="col-sm-12 text-center">
|
63 |
-
<h3><?php echo wp_kses_post( $title ); ?></h3>
|
64 |
-
</div>
|
65 |
-
</div>
|
66 |
-
<!--end of row-->
|
67 |
-
<div class="row">
|
68 |
-
<div class="col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1">
|
69 |
-
<div class="text-slider slider-arrow-controls text-center relative">
|
70 |
-
<ul class="slides" style="overflow: hidden;">
|
71 |
-
<?php
|
72 |
-
while ( $testimonial_query->have_posts() ) :
|
73 |
-
$testimonial_query->the_post();
|
74 |
-
?>
|
75 |
-
<?php if ( get_the_title() != '' ) : ?>
|
76 |
-
<li>
|
77 |
-
<p><?php the_content(); ?></p>
|
78 |
-
<div class="testimonial-author-section">
|
79 |
-
<?php
|
80 |
-
the_post_thumbnail( 'thumbnail', array( 'class' => 'testimonial-img' ) );
|
81 |
-
?>
|
82 |
-
|
83 |
-
<div class="testimonial-author">
|
84 |
-
<strong><?php echo esc_html( get_the_title() ); ?></strong>
|
85 |
-
</div>
|
86 |
-
</div>
|
87 |
-
</li>
|
88 |
-
<?php endif; ?>
|
89 |
-
|
90 |
-
<?php endwhile; ?>
|
91 |
-
</ul>
|
92 |
-
</div>
|
93 |
-
</div>
|
94 |
-
</div>
|
95 |
-
<!--end of row-->
|
96 |
-
</div>
|
97 |
-
</div>
|
98 |
-
<!--end of container-->
|
99 |
-
</div>
|
100 |
-
</section>
|
101 |
-
<?php
|
102 |
-
endif;
|
103 |
-
wp_reset_postdata();
|
104 |
-
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
105 |
-
|
106 |
-
}
|
107 |
-
|
108 |
-
|
109 |
-
/**
|
110 |
-
* @param array $instance
|
111 |
-
*
|
112 |
-
* @return string|void
|
113 |
-
*/
|
114 |
-
function form( $instance ) {
|
115 |
-
|
116 |
-
$instance = wp_parse_args( $instance, $this->defaults );
|
117 |
-
|
118 |
-
$placeholder_url = plugins_url( 'shapely-companion/assets/img/placeholder-image.jpg' );
|
119 |
-
|
120 |
-
?>
|
121 |
-
|
122 |
-
<p>
|
123 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
|
124 |
-
<?php esc_html_e( 'Title ', 'shapely-companion' ); ?>
|
125 |
-
</label>
|
126 |
-
<input type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" class="widefat"/>
|
127 |
-
</p>
|
128 |
-
|
129 |
-
<p>
|
130 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>">
|
131 |
-
<?php esc_html_e( 'Limit ', 'shapely-companion' ); ?>
|
132 |
-
</label>
|
133 |
-
<input type="text" value="<?php echo esc_attr( $instance['limit'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" class="widefat"/>
|
134 |
-
</p>
|
135 |
-
|
136 |
-
<p class="shapely-media-control" data-delegate-container="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>">
|
137 |
-
|
138 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>">
|
139 |
-
<?php echo esc_html__( 'Background Parallax Image:', 'shapely-companion' ); ?>
|
140 |
-
</label>
|
141 |
-
|
142 |
-
<img data-default="<?php echo esc_url( $placeholder_url ); ?>" src="<?php echo '' != $instance['image_src'] ? esc_url( $instance['image_src'] ) : esc_url( $placeholder_url ); ?>"/>
|
143 |
-
|
144 |
-
<input type="hidden" name="<?php echo esc_attr( $this->get_field_name( 'image_src' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>" value="<?php echo esc_url( $instance['image_src'] ); ?>" class="image-id blazersix-media-control-target">
|
145 |
-
|
146 |
-
<button class="button upload-button"><?php echo esc_html__( 'Choose Image', 'shapely-companion' ); ?></button>
|
147 |
-
</p>
|
148 |
-
|
149 |
-
<?php
|
150 |
-
}
|
151 |
-
|
152 |
-
/**
|
153 |
-
* Sanitize widget form values as they are saved.
|
154 |
-
*
|
155 |
-
* @see WP_Widget::update()
|
156 |
-
*
|
157 |
-
* @param array $new_instance Values just sent to be saved.
|
158 |
-
* @param array $old_instance Previously saved values from database.
|
159 |
-
*
|
160 |
-
* @return array Updated safe values to be saved.
|
161 |
-
*/
|
162 |
-
public function update( $new_instance, $old_instance ) {
|
163 |
-
$instance = array();
|
164 |
-
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? wp_kses_post( $new_instance['title'] ) : '';
|
165 |
-
$instance['limit'] = ( ! empty( $new_instance['limit'] ) && is_numeric( $new_instance['limit'] ) ) ? absint( $new_instance['limit'] ) : '';
|
166 |
-
$instance['image_src'] = ( ! empty( $new_instance['image_src'] ) ) ? esc_url_raw( $new_instance['image_src'] ) : '';
|
167 |
-
|
168 |
-
return $instance;
|
169 |
-
}
|
170 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Homepage parallax section Widget
|
5 |
+
* Shapely Theme
|
6 |
+
*/
|
7 |
+
class Shapely_Home_Testimonials extends WP_Widget {
|
8 |
+
|
9 |
+
private $defaults = array();
|
10 |
+
|
11 |
+
function __construct() {
|
12 |
+
|
13 |
+
$widget_ops = array(
|
14 |
+
'classname' => 'shapely_home_testimonial',
|
15 |
+
'description' => esc_html__( 'Shapely Testimonial Widget Section', 'shapely-companion' ),
|
16 |
+
'customize_selective_refresh' => true,
|
17 |
+
);
|
18 |
+
parent::__construct( 'shapely_home_testimonial', esc_html__( '[Shapely] Testimonial Section For FrontPage', 'shapely-companion' ), $widget_ops );
|
19 |
+
|
20 |
+
$this->defaults = array(
|
21 |
+
'title' => esc_html__( 'People just like you are already loving Colorlib', 'shapely-companion' ),
|
22 |
+
'limit' => 5,
|
23 |
+
'image_src' => '',
|
24 |
+
);
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @param array $args
|
29 |
+
* @param array $instance
|
30 |
+
*/
|
31 |
+
function widget( $args, $instance ) {
|
32 |
+
|
33 |
+
$instance = wp_parse_args( $instance, $this->defaults );
|
34 |
+
|
35 |
+
$title = $instance['title'];
|
36 |
+
$limit = $instance['limit'];
|
37 |
+
$image_src = $instance['image_src'];
|
38 |
+
|
39 |
+
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Widget Content
|
43 |
+
*/
|
44 |
+
?>
|
45 |
+
|
46 |
+
<?php
|
47 |
+
$testimonial_args = array(
|
48 |
+
'post_type' => 'jetpack-testimonial',
|
49 |
+
'posts_per_page' => $limit,
|
50 |
+
'ignore_sticky_posts' => 1,
|
51 |
+
);
|
52 |
+
|
53 |
+
$testimonial_query = new WP_Query( $testimonial_args );
|
54 |
+
|
55 |
+
if ( $testimonial_query->have_posts() ) :
|
56 |
+
?>
|
57 |
+
<section class="parallax-section testimonial-section">
|
58 |
+
<div class="parallax-window" data-parallax="scroll" data-image-src="<?php echo esc_url( $image_src ); ?>" style="height: 500px;">
|
59 |
+
<div class="container align-transform">
|
60 |
+
<div class="parallax-text image-bg testimonial">
|
61 |
+
<div class="row">
|
62 |
+
<div class="col-sm-12 text-center">
|
63 |
+
<h3><?php echo wp_kses_post( $title ); ?></h3>
|
64 |
+
</div>
|
65 |
+
</div>
|
66 |
+
<!--end of row-->
|
67 |
+
<div class="row">
|
68 |
+
<div class="col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1">
|
69 |
+
<div class="text-slider slider-arrow-controls text-center relative">
|
70 |
+
<ul class="slides" style="overflow: hidden;">
|
71 |
+
<?php
|
72 |
+
while ( $testimonial_query->have_posts() ) :
|
73 |
+
$testimonial_query->the_post();
|
74 |
+
?>
|
75 |
+
<?php if ( get_the_title() != '' ) : ?>
|
76 |
+
<li>
|
77 |
+
<p><?php the_content(); ?></p>
|
78 |
+
<div class="testimonial-author-section">
|
79 |
+
<?php
|
80 |
+
the_post_thumbnail( 'thumbnail', array( 'class' => 'testimonial-img' ) );
|
81 |
+
?>
|
82 |
+
|
83 |
+
<div class="testimonial-author">
|
84 |
+
<strong><?php echo esc_html( get_the_title() ); ?></strong>
|
85 |
+
</div>
|
86 |
+
</div>
|
87 |
+
</li>
|
88 |
+
<?php endif; ?>
|
89 |
+
|
90 |
+
<?php endwhile; ?>
|
91 |
+
</ul>
|
92 |
+
</div>
|
93 |
+
</div>
|
94 |
+
</div>
|
95 |
+
<!--end of row-->
|
96 |
+
</div>
|
97 |
+
</div>
|
98 |
+
<!--end of container-->
|
99 |
+
</div>
|
100 |
+
</section>
|
101 |
+
<?php
|
102 |
+
endif;
|
103 |
+
wp_reset_postdata();
|
104 |
+
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
105 |
+
|
106 |
+
}
|
107 |
+
|
108 |
+
|
109 |
+
/**
|
110 |
+
* @param array $instance
|
111 |
+
*
|
112 |
+
* @return string|void
|
113 |
+
*/
|
114 |
+
function form( $instance ) {
|
115 |
+
|
116 |
+
$instance = wp_parse_args( $instance, $this->defaults );
|
117 |
+
|
118 |
+
$placeholder_url = plugins_url( 'shapely-companion/assets/img/placeholder-image.jpg' );
|
119 |
+
|
120 |
+
?>
|
121 |
+
|
122 |
+
<p>
|
123 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
|
124 |
+
<?php esc_html_e( 'Title ', 'shapely-companion' ); ?>
|
125 |
+
</label>
|
126 |
+
<input type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" class="widefat"/>
|
127 |
+
</p>
|
128 |
+
|
129 |
+
<p>
|
130 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>">
|
131 |
+
<?php esc_html_e( 'Limit ', 'shapely-companion' ); ?>
|
132 |
+
</label>
|
133 |
+
<input type="text" value="<?php echo esc_attr( $instance['limit'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" class="widefat"/>
|
134 |
+
</p>
|
135 |
+
|
136 |
+
<p class="shapely-media-control" data-delegate-container="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>">
|
137 |
+
|
138 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>">
|
139 |
+
<?php echo esc_html__( 'Background Parallax Image:', 'shapely-companion' ); ?>
|
140 |
+
</label>
|
141 |
+
|
142 |
+
<img data-default="<?php echo esc_url( $placeholder_url ); ?>" src="<?php echo '' != $instance['image_src'] ? esc_url( $instance['image_src'] ) : esc_url( $placeholder_url ); ?>"/>
|
143 |
+
|
144 |
+
<input type="hidden" name="<?php echo esc_attr( $this->get_field_name( 'image_src' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>" value="<?php echo esc_url( $instance['image_src'] ); ?>" class="image-id blazersix-media-control-target">
|
145 |
+
|
146 |
+
<button class="button upload-button"><?php echo esc_html__( 'Choose Image', 'shapely-companion' ); ?></button>
|
147 |
+
</p>
|
148 |
+
|
149 |
+
<?php
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Sanitize widget form values as they are saved.
|
154 |
+
*
|
155 |
+
* @see WP_Widget::update()
|
156 |
+
*
|
157 |
+
* @param array $new_instance Values just sent to be saved.
|
158 |
+
* @param array $old_instance Previously saved values from database.
|
159 |
+
*
|
160 |
+
* @return array Updated safe values to be saved.
|
161 |
+
*/
|
162 |
+
public function update( $new_instance, $old_instance ) {
|
163 |
+
$instance = array();
|
164 |
+
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? wp_kses_post( $new_instance['title'] ) : '';
|
165 |
+
$instance['limit'] = ( ! empty( $new_instance['limit'] ) && is_numeric( $new_instance['limit'] ) ) ? absint( $new_instance['limit'] ) : '';
|
166 |
+
$instance['image_src'] = ( ! empty( $new_instance['image_src'] ) ) ? esc_url_raw( $new_instance['image_src'] ) : '';
|
167 |
+
|
168 |
+
return $instance;
|
169 |
+
}
|
170 |
+
}
|
inc/widgets/class-shapely-page-content.php
CHANGED
@@ -1,70 +1,70 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Page Content Widget
|
5 |
-
* shapely Theme
|
6 |
-
*/
|
7 |
-
class Shapely_Page_Content extends WP_Widget {
|
8 |
-
|
9 |
-
function __construct() {
|
10 |
-
|
11 |
-
$widget_ops = array(
|
12 |
-
'classname' => 'shapely-page-content',
|
13 |
-
'description' => esc_html__( 'This widget is used only in pages with Template Widget', 'shapely-companion' ),
|
14 |
-
'customize_selective_refresh' => true,
|
15 |
-
);
|
16 |
-
parent::__construct( 'shapely-page-content', esc_html__( '[Shapely] Page Content', 'shapely-companion' ), $widget_ops );
|
17 |
-
}
|
18 |
-
|
19 |
-
/**
|
20 |
-
* @param array $args
|
21 |
-
* @param array $instance
|
22 |
-
*/
|
23 |
-
function widget( $args, $instance ) {
|
24 |
-
|
25 |
-
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
26 |
-
|
27 |
-
?>
|
28 |
-
|
29 |
-
<div class="container">
|
30 |
-
<div class="row">
|
31 |
-
<div id="primary" class="col-md-12 mb-xs-24 full-width">
|
32 |
-
<div class="entry-content">
|
33 |
-
<div class="shapely-content">
|
34 |
-
<?php
|
35 |
-
the_content();
|
36 |
-
|
37 |
-
wp_link_pages(
|
38 |
-
array(
|
39 |
-
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'shapely-companion' ),
|
40 |
-
'after' => '</div>',
|
41 |
-
)
|
42 |
-
);
|
43 |
-
?>
|
44 |
-
</div>
|
45 |
-
</div>
|
46 |
-
</div>
|
47 |
-
</div>
|
48 |
-
</div>
|
49 |
-
|
50 |
-
<?php
|
51 |
-
|
52 |
-
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
53 |
-
}
|
54 |
-
|
55 |
-
|
56 |
-
/**
|
57 |
-
* @param array $instance
|
58 |
-
*
|
59 |
-
* @return string|void
|
60 |
-
*/
|
61 |
-
function form( $instance ) {
|
62 |
-
}
|
63 |
-
|
64 |
-
public function update( $new_instance, $old_instance ) {
|
65 |
-
|
66 |
-
$instance = $new_instance;
|
67 |
-
|
68 |
-
return $instance;
|
69 |
-
}
|
70 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Page Content Widget
|
5 |
+
* shapely Theme
|
6 |
+
*/
|
7 |
+
class Shapely_Page_Content extends WP_Widget {
|
8 |
+
|
9 |
+
function __construct() {
|
10 |
+
|
11 |
+
$widget_ops = array(
|
12 |
+
'classname' => 'shapely-page-content',
|
13 |
+
'description' => esc_html__( 'This widget is used only in pages with Template Widget', 'shapely-companion' ),
|
14 |
+
'customize_selective_refresh' => true,
|
15 |
+
);
|
16 |
+
parent::__construct( 'shapely-page-content', esc_html__( '[Shapely] Page Content', 'shapely-companion' ), $widget_ops );
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @param array $args
|
21 |
+
* @param array $instance
|
22 |
+
*/
|
23 |
+
function widget( $args, $instance ) {
|
24 |
+
|
25 |
+
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
26 |
+
|
27 |
+
?>
|
28 |
+
|
29 |
+
<div class="container">
|
30 |
+
<div class="row">
|
31 |
+
<div id="primary" class="col-md-12 mb-xs-24 full-width">
|
32 |
+
<div class="entry-content">
|
33 |
+
<div class="shapely-content">
|
34 |
+
<?php
|
35 |
+
the_content();
|
36 |
+
|
37 |
+
wp_link_pages(
|
38 |
+
array(
|
39 |
+
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'shapely-companion' ),
|
40 |
+
'after' => '</div>',
|
41 |
+
)
|
42 |
+
);
|
43 |
+
?>
|
44 |
+
</div>
|
45 |
+
</div>
|
46 |
+
</div>
|
47 |
+
</div>
|
48 |
+
</div>
|
49 |
+
|
50 |
+
<?php
|
51 |
+
|
52 |
+
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
53 |
+
}
|
54 |
+
|
55 |
+
|
56 |
+
/**
|
57 |
+
* @param array $instance
|
58 |
+
*
|
59 |
+
* @return string|void
|
60 |
+
*/
|
61 |
+
function form( $instance ) {
|
62 |
+
}
|
63 |
+
|
64 |
+
public function update( $new_instance, $old_instance ) {
|
65 |
+
|
66 |
+
$instance = $new_instance;
|
67 |
+
|
68 |
+
return $instance;
|
69 |
+
}
|
70 |
+
}
|
inc/widgets/class-shapely-page-title.php
CHANGED
@@ -1,48 +1,48 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Page Title Widget
|
5 |
-
* shapely Theme
|
6 |
-
*/
|
7 |
-
class Shapely_Page_Title extends WP_Widget {
|
8 |
-
|
9 |
-
function __construct() {
|
10 |
-
|
11 |
-
$widget_ops = array(
|
12 |
-
'classname' => 'shapely-page-title',
|
13 |
-
'description' => esc_html__( 'This widget is used only in pages with Template Widget', 'shapely-companion' ),
|
14 |
-
'customize_selective_refresh' => true,
|
15 |
-
);
|
16 |
-
parent::__construct( 'shapely-page-title', esc_html__( '[Shapely] Page Title', 'shapely-companion' ), $widget_ops );
|
17 |
-
}
|
18 |
-
|
19 |
-
function widget( $args, $instance ) {
|
20 |
-
|
21 |
-
if ( ! function_exists( 'shapely_top_callout' ) ) {
|
22 |
-
echo esc_html__( 'This widget works only with Shapely theme. Please install and activate it first.', 'shapely-companion' );
|
23 |
-
}
|
24 |
-
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
25 |
-
|
26 |
-
?>
|
27 |
-
|
28 |
-
<div class="header-callout">
|
29 |
-
<?php shapely_top_callout(); ?>
|
30 |
-
</div>
|
31 |
-
|
32 |
-
<?php
|
33 |
-
|
34 |
-
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
35 |
-
}
|
36 |
-
|
37 |
-
|
38 |
-
function form( $instance ) {
|
39 |
-
}
|
40 |
-
|
41 |
-
public function update( $new_instance, $old_instance ) {
|
42 |
-
|
43 |
-
$instance = $new_instance;
|
44 |
-
|
45 |
-
return $instance;
|
46 |
-
}
|
47 |
-
|
48 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Page Title Widget
|
5 |
+
* shapely Theme
|
6 |
+
*/
|
7 |
+
class Shapely_Page_Title extends WP_Widget {
|
8 |
+
|
9 |
+
function __construct() {
|
10 |
+
|
11 |
+
$widget_ops = array(
|
12 |
+
'classname' => 'shapely-page-title',
|
13 |
+
'description' => esc_html__( 'This widget is used only in pages with Template Widget', 'shapely-companion' ),
|
14 |
+
'customize_selective_refresh' => true,
|
15 |
+
);
|
16 |
+
parent::__construct( 'shapely-page-title', esc_html__( '[Shapely] Page Title', 'shapely-companion' ), $widget_ops );
|
17 |
+
}
|
18 |
+
|
19 |
+
function widget( $args, $instance ) {
|
20 |
+
|
21 |
+
if ( ! function_exists( 'shapely_top_callout' ) ) {
|
22 |
+
echo esc_html__( 'This widget works only with Shapely theme. Please install and activate it first.', 'shapely-companion' );
|
23 |
+
}
|
24 |
+
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
25 |
+
|
26 |
+
?>
|
27 |
+
|
28 |
+
<div class="header-callout">
|
29 |
+
<?php shapely_top_callout(); ?>
|
30 |
+
</div>
|
31 |
+
|
32 |
+
<?php
|
33 |
+
|
34 |
+
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
35 |
+
}
|
36 |
+
|
37 |
+
|
38 |
+
function form( $instance ) {
|
39 |
+
}
|
40 |
+
|
41 |
+
public function update( $new_instance, $old_instance ) {
|
42 |
+
|
43 |
+
$instance = $new_instance;
|
44 |
+
|
45 |
+
return $instance;
|
46 |
+
}
|
47 |
+
|
48 |
+
}
|
inc/widgets/class-shapely-recent-posts.php
CHANGED
@@ -1,164 +1,164 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Shapely Top Posts Widget
|
5 |
-
* Shapely Theme
|
6 |
-
*/
|
7 |
-
class Shapely_Recent_Posts extends WP_Widget {
|
8 |
-
|
9 |
-
private $defaults = array();
|
10 |
-
|
11 |
-
function __construct() {
|
12 |
-
|
13 |
-
$widget_ops = array(
|
14 |
-
'classname' => 'shapely-recent-posts text-center',
|
15 |
-
'description' => esc_html__( 'Widget to show recent posts with thumbnails', 'shapely-companion' ),
|
16 |
-
'customize_selective_refresh' => true,
|
17 |
-
);
|
18 |
-
parent::__construct( 'shapely_recent_posts', esc_html__( '[Shapely] Recent Posts', 'shapely-companion' ), $widget_ops );
|
19 |
-
|
20 |
-
$this->defaults = array(
|
21 |
-
'title' => esc_html__( 'Recent Posts', 'shapely-companion' ),
|
22 |
-
'limit' => 5,
|
23 |
-
'excerpt' => 0,
|
24 |
-
);
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
* @param array $args
|
29 |
-
* @param array $instance
|
30 |
-
*/
|
31 |
-
function widget( $args, $instance ) {
|
32 |
-
|
33 |
-
$instance = wp_parse_args( $instance, $this->defaults );
|
34 |
-
|
35 |
-
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
36 |
-
?>
|
37 |
-
<section>
|
38 |
-
<?php
|
39 |
-
echo $args['before_title']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
40 |
-
echo '<h3 class="mb32">' . wp_kses_post( $instance['title'] ) . '</h3>';
|
41 |
-
echo $args['after_title']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Widget Content
|
45 |
-
*/
|
46 |
-
?>
|
47 |
-
|
48 |
-
<!-- recent posts -->
|
49 |
-
<div class="recent-posts-wrapper nolist">
|
50 |
-
|
51 |
-
<?php
|
52 |
-
$featured_args = array(
|
53 |
-
'posts_per_page' => $instance['limit'],
|
54 |
-
'post_type' => 'post',
|
55 |
-
'ignore_sticky_posts' => 1,
|
56 |
-
);
|
57 |
-
|
58 |
-
$featured_query = new WP_Query( $featured_args );
|
59 |
-
$bootstrap_col_width = floor( 12 / $featured_query->post_count );
|
60 |
-
if ( $featured_query->have_posts() ) :
|
61 |
-
?>
|
62 |
-
|
63 |
-
<ul class="link-list recent-posts">
|
64 |
-
<?php
|
65 |
-
|
66 |
-
while ( $featured_query->have_posts() ) :
|
67 |
-
$featured_query->the_post();
|
68 |
-
?>
|
69 |
-
|
70 |
-
<?php if ( get_the_content() != '' ) : ?>
|
71 |
-
|
72 |
-
<!-- content -->
|
73 |
-
<li class="post-content col-sm-<?php echo esc_attr( $bootstrap_col_width ); ?>">
|
74 |
-
<a class="widget-post-thumbnail" href="<?php echo esc_url( get_permalink() ); ?>">
|
75 |
-
<?php
|
76 |
-
if ( has_post_thumbnail() ) {
|
77 |
-
the_post_thumbnail();
|
78 |
-
}
|
79 |
-
?>
|
80 |
-
</a>
|
81 |
-
<h4 class="widget-post-title">
|
82 |
-
<a href="<?php echo esc_url( get_permalink() ); ?>">
|
83 |
-
<?php echo esc_html( get_the_title() ); ?>
|
84 |
-
</a>
|
85 |
-
</h4>
|
86 |
-
<span class="date"><?php echo esc_html( get_the_date( 'd M , Y' ) ); ?></span>
|
87 |
-
|
88 |
-
<?php if ( $instance['excerpt'] ) : ?>
|
89 |
-
<div class="widget-post-excerpt"><?php the_excerpt(); ?></div>
|
90 |
-
<?php endif ?>
|
91 |
-
|
92 |
-
</li> <!-- end content -->
|
93 |
-
|
94 |
-
<?php endif; ?>
|
95 |
-
|
96 |
-
<?php endwhile; ?>
|
97 |
-
</ul>
|
98 |
-
<?php
|
99 |
-
|
100 |
-
endif;
|
101 |
-
wp_reset_query();
|
102 |
-
?>
|
103 |
-
|
104 |
-
</div> <!-- end posts wrapper -->
|
105 |
-
</section>
|
106 |
-
<?php
|
107 |
-
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
108 |
-
}
|
109 |
-
|
110 |
-
/**
|
111 |
-
* @param array $instance
|
112 |
-
*
|
113 |
-
* @return string|void
|
114 |
-
*/
|
115 |
-
function form( $instance ) {
|
116 |
-
|
117 |
-
$instance = wp_parse_args( $instance, $this->defaults );
|
118 |
-
|
119 |
-
?>
|
120 |
-
|
121 |
-
<p>
|
122 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
|
123 |
-
<?php echo esc_html__( 'Title', 'shapely-companion' ); ?>
|
124 |
-
</label>
|
125 |
-
<input type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" class="widefat"/>
|
126 |
-
</p>
|
127 |
-
|
128 |
-
<p>
|
129 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'excerpt' ) ); ?>">
|
130 |
-
<?php echo esc_html__( 'Show Excerpt', 'shapely-companion' ); ?>
|
131 |
-
</label>
|
132 |
-
<input type="checkbox" value="1" name="<?php echo esc_attr( $this->get_field_name( 'excerpt' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'excerpt' ) ); ?>" <?php checked( 1, $instance['excerpt'] ); ?> class="widefat"/>
|
133 |
-
</p>
|
134 |
-
|
135 |
-
<p>
|
136 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>">
|
137 |
-
<?php echo esc_html__( 'Limit Posts Number', 'shapely-companion' ); ?>
|
138 |
-
</label>
|
139 |
-
<input type="text" value="<?php echo esc_attr( $instance['limit'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" class="widefat"/>
|
140 |
-
</p>
|
141 |
-
|
142 |
-
<?php
|
143 |
-
}
|
144 |
-
|
145 |
-
/**
|
146 |
-
* Sanitize widget form values as they are saved.
|
147 |
-
*
|
148 |
-
* @see WP_Widget::update()
|
149 |
-
*
|
150 |
-
* @param array $new_instance Values just sent to be saved.
|
151 |
-
* @param array $old_instance Previously saved values from database.
|
152 |
-
*
|
153 |
-
* @return array Updated safe values to be saved.
|
154 |
-
*/
|
155 |
-
public function update( $new_instance, $old_instance ) {
|
156 |
-
$instance = array();
|
157 |
-
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? wp_kses_post( $new_instance['title'] ) : '';
|
158 |
-
$instance['limit'] = ( ! empty( $new_instance['limit'] ) && is_numeric( $new_instance['limit'] ) ) ? absint( $new_instance['limit'] ) : '';
|
159 |
-
$instance['excerpt'] = empty( $new_instance['excerpt'] ) ? 0 : 1;
|
160 |
-
|
161 |
-
return $instance;
|
162 |
-
}
|
163 |
-
|
164 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Shapely Top Posts Widget
|
5 |
+
* Shapely Theme
|
6 |
+
*/
|
7 |
+
class Shapely_Recent_Posts extends WP_Widget {
|
8 |
+
|
9 |
+
private $defaults = array();
|
10 |
+
|
11 |
+
function __construct() {
|
12 |
+
|
13 |
+
$widget_ops = array(
|
14 |
+
'classname' => 'shapely-recent-posts text-center',
|
15 |
+
'description' => esc_html__( 'Widget to show recent posts with thumbnails', 'shapely-companion' ),
|
16 |
+
'customize_selective_refresh' => true,
|
17 |
+
);
|
18 |
+
parent::__construct( 'shapely_recent_posts', esc_html__( '[Shapely] Recent Posts', 'shapely-companion' ), $widget_ops );
|
19 |
+
|
20 |
+
$this->defaults = array(
|
21 |
+
'title' => esc_html__( 'Recent Posts', 'shapely-companion' ),
|
22 |
+
'limit' => 5,
|
23 |
+
'excerpt' => 0,
|
24 |
+
);
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @param array $args
|
29 |
+
* @param array $instance
|
30 |
+
*/
|
31 |
+
function widget( $args, $instance ) {
|
32 |
+
|
33 |
+
$instance = wp_parse_args( $instance, $this->defaults );
|
34 |
+
|
35 |
+
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
36 |
+
?>
|
37 |
+
<section>
|
38 |
+
<?php
|
39 |
+
echo $args['before_title']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
40 |
+
echo '<h3 class="mb32">' . wp_kses_post( $instance['title'] ) . '</h3>';
|
41 |
+
echo $args['after_title']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Widget Content
|
45 |
+
*/
|
46 |
+
?>
|
47 |
+
|
48 |
+
<!-- recent posts -->
|
49 |
+
<div class="recent-posts-wrapper nolist">
|
50 |
+
|
51 |
+
<?php
|
52 |
+
$featured_args = array(
|
53 |
+
'posts_per_page' => $instance['limit'],
|
54 |
+
'post_type' => 'post',
|
55 |
+
'ignore_sticky_posts' => 1,
|
56 |
+
);
|
57 |
+
|
58 |
+
$featured_query = new WP_Query( $featured_args );
|
59 |
+
$bootstrap_col_width = floor( 12 / $featured_query->post_count );
|
60 |
+
if ( $featured_query->have_posts() ) :
|
61 |
+
?>
|
62 |
+
|
63 |
+
<ul class="link-list recent-posts">
|
64 |
+
<?php
|
65 |
+
|
66 |
+
while ( $featured_query->have_posts() ) :
|
67 |
+
$featured_query->the_post();
|
68 |
+
?>
|
69 |
+
|
70 |
+
<?php if ( get_the_content() != '' ) : ?>
|
71 |
+
|
72 |
+
<!-- content -->
|
73 |
+
<li class="post-content col-sm-<?php echo esc_attr( $bootstrap_col_width ); ?>">
|
74 |
+
<a class="widget-post-thumbnail" href="<?php echo esc_url( get_permalink() ); ?>">
|
75 |
+
<?php
|
76 |
+
if ( has_post_thumbnail() ) {
|
77 |
+
the_post_thumbnail();
|
78 |
+
}
|
79 |
+
?>
|
80 |
+
</a>
|
81 |
+
<h4 class="widget-post-title">
|
82 |
+
<a href="<?php echo esc_url( get_permalink() ); ?>">
|
83 |
+
<?php echo esc_html( get_the_title() ); ?>
|
84 |
+
</a>
|
85 |
+
</h4>
|
86 |
+
<span class="date"><?php echo esc_html( get_the_date( 'd M , Y' ) ); ?></span>
|
87 |
+
|
88 |
+
<?php if ( $instance['excerpt'] ) : ?>
|
89 |
+
<div class="widget-post-excerpt"><?php the_excerpt(); ?></div>
|
90 |
+
<?php endif ?>
|
91 |
+
|
92 |
+
</li> <!-- end content -->
|
93 |
+
|
94 |
+
<?php endif; ?>
|
95 |
+
|
96 |
+
<?php endwhile; ?>
|
97 |
+
</ul>
|
98 |
+
<?php
|
99 |
+
|
100 |
+
endif;
|
101 |
+
wp_reset_query();
|
102 |
+
?>
|
103 |
+
|
104 |
+
</div> <!-- end posts wrapper -->
|
105 |
+
</section>
|
106 |
+
<?php
|
107 |
+
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* @param array $instance
|
112 |
+
*
|
113 |
+
* @return string|void
|
114 |
+
*/
|
115 |
+
function form( $instance ) {
|
116 |
+
|
117 |
+
$instance = wp_parse_args( $instance, $this->defaults );
|
118 |
+
|
119 |
+
?>
|
120 |
+
|
121 |
+
<p>
|
122 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
|
123 |
+
<?php echo esc_html__( 'Title', 'shapely-companion' ); ?>
|
124 |
+
</label>
|
125 |
+
<input type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" class="widefat"/>
|
126 |
+
</p>
|
127 |
+
|
128 |
+
<p>
|
129 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'excerpt' ) ); ?>">
|
130 |
+
<?php echo esc_html__( 'Show Excerpt', 'shapely-companion' ); ?>
|
131 |
+
</label>
|
132 |
+
<input type="checkbox" value="1" name="<?php echo esc_attr( $this->get_field_name( 'excerpt' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'excerpt' ) ); ?>" <?php checked( 1, $instance['excerpt'] ); ?> class="widefat"/>
|
133 |
+
</p>
|
134 |
+
|
135 |
+
<p>
|
136 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>">
|
137 |
+
<?php echo esc_html__( 'Limit Posts Number', 'shapely-companion' ); ?>
|
138 |
+
</label>
|
139 |
+
<input type="text" value="<?php echo esc_attr( $instance['limit'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" class="widefat"/>
|
140 |
+
</p>
|
141 |
+
|
142 |
+
<?php
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Sanitize widget form values as they are saved.
|
147 |
+
*
|
148 |
+
* @see WP_Widget::update()
|
149 |
+
*
|
150 |
+
* @param array $new_instance Values just sent to be saved.
|
151 |
+
* @param array $old_instance Previously saved values from database.
|
152 |
+
*
|
153 |
+
* @return array Updated safe values to be saved.
|
154 |
+
*/
|
155 |
+
public function update( $new_instance, $old_instance ) {
|
156 |
+
$instance = array();
|
157 |
+
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? wp_kses_post( $new_instance['title'] ) : '';
|
158 |
+
$instance['limit'] = ( ! empty( $new_instance['limit'] ) && is_numeric( $new_instance['limit'] ) ) ? absint( $new_instance['limit'] ) : '';
|
159 |
+
$instance['excerpt'] = empty( $new_instance['excerpt'] ) ? 0 : 1;
|
160 |
+
|
161 |
+
return $instance;
|
162 |
+
}
|
163 |
+
|
164 |
+
}
|
inc/widgets/class-shapely-social.php
CHANGED
@@ -1,115 +1,115 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Social Widget
|
5 |
-
* shapely Theme
|
6 |
-
*/
|
7 |
-
class Shapely_Social extends WP_Widget {
|
8 |
-
|
9 |
-
private $defaults;
|
10 |
-
|
11 |
-
function __construct() {
|
12 |
-
$widget_ops = array(
|
13 |
-
'classname' => 'widget-shapely-social',
|
14 |
-
'description' => esc_html__( 'Shapely Social Widget', 'shapely-companion' ),
|
15 |
-
'customize_selective_refresh' => true,
|
16 |
-
);
|
17 |
-
parent::__construct( 'shapely-social', esc_html__( '[Shapely] Social Widget', 'shapely-companion' ), $widget_ops );
|
18 |
-
|
19 |
-
$this->defaults = array(
|
20 |
-
'title' => esc_html__( 'Follow us', 'shapely-companion' ),
|
21 |
-
);
|
22 |
-
}
|
23 |
-
|
24 |
-
function widget( $args, $instance ) {
|
25 |
-
|
26 |
-
$defaults = array(
|
27 |
-
'title' => __( 'We are social', 'shapely-companion' ),
|
28 |
-
'nav_menu' => 0,
|
29 |
-
'alignment' => 'text-center',
|
30 |
-
);
|
31 |
-
$instance = wp_parse_args( (array) $instance, $defaults );
|
32 |
-
|
33 |
-
$title = apply_filters( 'widget_title', $instance['title'] );
|
34 |
-
|
35 |
-
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
36 |
-
echo '<section class="shapely-social-links ' . esc_attr( $instance['alignment'] ) . '">';
|
37 |
-
if ( '' != $title ) {
|
38 |
-
echo '<h3 class="cfa-text">' . esc_html( $title ) . '</h3>';
|
39 |
-
}
|
40 |
-
|
41 |
-
wp_nav_menu(
|
42 |
-
array(
|
43 |
-
'menu' => absint($instance['nav_menu']),
|
44 |
-
'container' => 'nav',
|
45 |
-
'container_id' => 'social',
|
46 |
-
'container_class' => 'social-icons',
|
47 |
-
'menu_id' => 'menu-social-items',
|
48 |
-
'menu_class' => 'list-inline social-list',
|
49 |
-
'depth' => 1,
|
50 |
-
'fallback_cb' => '',
|
51 |
-
'link_before' => '<i class="social_icon fa"><span>',
|
52 |
-
'link_after' => '</span></i>',
|
53 |
-
)
|
54 |
-
);
|
55 |
-
echo '</section>';
|
56 |
-
|
57 |
-
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
58 |
-
}
|
59 |
-
|
60 |
-
|
61 |
-
function update( $new_instance, $old_instance ) {
|
62 |
-
$instance = $old_instance;
|
63 |
-
$instance['title'] = sanitize_text_field( $new_instance['title'] );
|
64 |
-
$instance['nav_menu'] = absint( $new_instance['nav_menu'] );
|
65 |
-
$instance['alignment'] = sanitize_text_field( $new_instance['alignment'] );
|
66 |
-
|
67 |
-
return $instance;
|
68 |
-
}
|
69 |
-
|
70 |
-
function form( $instance ) {
|
71 |
-
|
72 |
-
$defaults = array(
|
73 |
-
'title' => __( 'We are social', 'shapely-companion' ),
|
74 |
-
'nav_menu' => 0,
|
75 |
-
'alignment' => 'text-center',
|
76 |
-
);
|
77 |
-
$menus = wp_get_nav_menus();
|
78 |
-
$instance = wp_parse_args( (array) $instance, $defaults );
|
79 |
-
|
80 |
-
?>
|
81 |
-
<p>
|
82 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title', 'shapely-companion' ); ?></label>
|
83 |
-
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
|
84 |
-
</p>
|
85 |
-
|
86 |
-
<p>
|
87 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'nav_menu' ) ); ?>"><?php esc_html_e( 'Select Menu:', 'shapely-companion' ); ?></label>
|
88 |
-
<select id="<?php echo esc_attr( $this->get_field_id( 'nav_menu' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'nav_menu' ) ); ?>">
|
89 |
-
<option value="0"><?php esc_html_e( '— Select —', 'shapely-companion' ); ?></option>
|
90 |
-
<?php foreach ( $menus as $menu ) : ?>
|
91 |
-
<option value="<?php echo esc_attr( $menu->term_id ); ?>" <?php selected( $instance['nav_menu'], $menu->term_id ); ?>>
|
92 |
-
<?php echo esc_html( $menu->name ); ?>
|
93 |
-
</option>
|
94 |
-
<?php endforeach; ?>
|
95 |
-
</select>
|
96 |
-
</p>
|
97 |
-
<p>
|
98 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'alignment' ) ); ?>"><?php esc_html_e( 'Alignment:', 'shapely-companion' ); ?></label>
|
99 |
-
<select id="<?php echo esc_attr( $this->get_field_id( 'alignment' ) ); ?>" name="<?php echo esc_attr( $this->get_field_id( 'alignment' ) ); ?>">
|
100 |
-
<option value="text-left" <?php selected( $instance['alignment'], 'text-left' ); ?>>
|
101 |
-
<?php esc_html_e( 'Left', 'shapely-companion' ); ?>
|
102 |
-
</option>
|
103 |
-
<option value="text-center" <?php selected( $instance['alignment'], 'text-center' ); ?>>
|
104 |
-
<?php esc_html_e( 'Center', 'shapely-companion' ); ?>
|
105 |
-
</option>
|
106 |
-
<option value="text-right" <?php selected( $instance['alignment'], 'text-right' ); ?>>
|
107 |
-
<?php esc_html_e( 'Right', 'shapely-companion' ); ?>
|
108 |
-
</option>
|
109 |
-
</select>
|
110 |
-
</p>
|
111 |
-
|
112 |
-
<?php
|
113 |
-
}
|
114 |
-
|
115 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Social Widget
|
5 |
+
* shapely Theme
|
6 |
+
*/
|
7 |
+
class Shapely_Social extends WP_Widget {
|
8 |
+
|
9 |
+
private $defaults;
|
10 |
+
|
11 |
+
function __construct() {
|
12 |
+
$widget_ops = array(
|
13 |
+
'classname' => 'widget-shapely-social',
|
14 |
+
'description' => esc_html__( 'Shapely Social Widget', 'shapely-companion' ),
|
15 |
+
'customize_selective_refresh' => true,
|
16 |
+
);
|
17 |
+
parent::__construct( 'shapely-social', esc_html__( '[Shapely] Social Widget', 'shapely-companion' ), $widget_ops );
|
18 |
+
|
19 |
+
$this->defaults = array(
|
20 |
+
'title' => esc_html__( 'Follow us', 'shapely-companion' ),
|
21 |
+
);
|
22 |
+
}
|
23 |
+
|
24 |
+
function widget( $args, $instance ) {
|
25 |
+
|
26 |
+
$defaults = array(
|
27 |
+
'title' => __( 'We are social', 'shapely-companion' ),
|
28 |
+
'nav_menu' => 0,
|
29 |
+
'alignment' => 'text-center',
|
30 |
+
);
|
31 |
+
$instance = wp_parse_args( (array) $instance, $defaults );
|
32 |
+
|
33 |
+
$title = apply_filters( 'widget_title', $instance['title'] );
|
34 |
+
|
35 |
+
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
36 |
+
echo '<section class="shapely-social-links ' . esc_attr( $instance['alignment'] ) . '">';
|
37 |
+
if ( '' != $title ) {
|
38 |
+
echo '<h3 class="cfa-text">' . esc_html( $title ) . '</h3>';
|
39 |
+
}
|
40 |
+
|
41 |
+
wp_nav_menu(
|
42 |
+
array(
|
43 |
+
'menu' => absint($instance['nav_menu']),
|
44 |
+
'container' => 'nav',
|
45 |
+
'container_id' => 'social',
|
46 |
+
'container_class' => 'social-icons',
|
47 |
+
'menu_id' => 'menu-social-items',
|
48 |
+
'menu_class' => 'list-inline social-list',
|
49 |
+
'depth' => 1,
|
50 |
+
'fallback_cb' => '',
|
51 |
+
'link_before' => '<i class="social_icon fa"><span>',
|
52 |
+
'link_after' => '</span></i>',
|
53 |
+
)
|
54 |
+
);
|
55 |
+
echo '</section>';
|
56 |
+
|
57 |
+
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
58 |
+
}
|
59 |
+
|
60 |
+
|
61 |
+
function update( $new_instance, $old_instance ) {
|
62 |
+
$instance = $old_instance;
|
63 |
+
$instance['title'] = sanitize_text_field( $new_instance['title'] );
|
64 |
+
$instance['nav_menu'] = absint( $new_instance['nav_menu'] );
|
65 |
+
$instance['alignment'] = sanitize_text_field( $new_instance['alignment'] );
|
66 |
+
|
67 |
+
return $instance;
|
68 |
+
}
|
69 |
+
|
70 |
+
function form( $instance ) {
|
71 |
+
|
72 |
+
$defaults = array(
|
73 |
+
'title' => __( 'We are social', 'shapely-companion' ),
|
74 |
+
'nav_menu' => 0,
|
75 |
+
'alignment' => 'text-center',
|
76 |
+
);
|
77 |
+
$menus = wp_get_nav_menus();
|
78 |
+
$instance = wp_parse_args( (array) $instance, $defaults );
|
79 |
+
|
80 |
+
?>
|
81 |
+
<p>
|
82 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title', 'shapely-companion' ); ?></label>
|
83 |
+
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
|
84 |
+
</p>
|
85 |
+
|
86 |
+
<p>
|
87 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'nav_menu' ) ); ?>"><?php esc_html_e( 'Select Menu:', 'shapely-companion' ); ?></label>
|
88 |
+
<select id="<?php echo esc_attr( $this->get_field_id( 'nav_menu' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'nav_menu' ) ); ?>">
|
89 |
+
<option value="0"><?php esc_html_e( '— Select —', 'shapely-companion' ); ?></option>
|
90 |
+
<?php foreach ( $menus as $menu ) : ?>
|
91 |
+
<option value="<?php echo esc_attr( $menu->term_id ); ?>" <?php selected( $instance['nav_menu'], $menu->term_id ); ?>>
|
92 |
+
<?php echo esc_html( $menu->name ); ?>
|
93 |
+
</option>
|
94 |
+
<?php endforeach; ?>
|
95 |
+
</select>
|
96 |
+
</p>
|
97 |
+
<p>
|
98 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'alignment' ) ); ?>"><?php esc_html_e( 'Alignment:', 'shapely-companion' ); ?></label>
|
99 |
+
<select id="<?php echo esc_attr( $this->get_field_id( 'alignment' ) ); ?>" name="<?php echo esc_attr( $this->get_field_id( 'alignment' ) ); ?>">
|
100 |
+
<option value="text-left" <?php selected( $instance['alignment'], 'text-left' ); ?>>
|
101 |
+
<?php esc_html_e( 'Left', 'shapely-companion' ); ?>
|
102 |
+
</option>
|
103 |
+
<option value="text-center" <?php selected( $instance['alignment'], 'text-center' ); ?>>
|
104 |
+
<?php esc_html_e( 'Center', 'shapely-companion' ); ?>
|
105 |
+
</option>
|
106 |
+
<option value="text-right" <?php selected( $instance['alignment'], 'text-right' ); ?>>
|
107 |
+
<?php esc_html_e( 'Right', 'shapely-companion' ); ?>
|
108 |
+
</option>
|
109 |
+
</select>
|
110 |
+
</p>
|
111 |
+
|
112 |
+
<?php
|
113 |
+
}
|
114 |
+
|
115 |
+
}
|
inc/widgets/class-shapely-video.php
CHANGED
@@ -1,250 +1,250 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class Shapely_Video
|
5 |
-
*/
|
6 |
-
class Shapely_Video extends WP_Widget {
|
7 |
-
|
8 |
-
private $defaults = array();
|
9 |
-
|
10 |
-
function __construct() {
|
11 |
-
add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue' ) );
|
12 |
-
add_action( 'customize_preview_init', array( $this, 'enqueue' ) );
|
13 |
-
|
14 |
-
$widget_ops = array(
|
15 |
-
'classname' => 'shapely_video_widget',
|
16 |
-
'description' => esc_html__( 'Shapely Video Section', 'shapely-companion' ),
|
17 |
-
);
|
18 |
-
parent::__construct( 'shapely_video_widget', esc_html__( '[Shapely] Video Section', 'shapely-companion' ), $widget_ops );
|
19 |
-
|
20 |
-
$this->defaults = array(
|
21 |
-
'autoplay' => 'on',
|
22 |
-
'mute' => 'on',
|
23 |
-
'video_id' => '',
|
24 |
-
'vimeo_id' => '',
|
25 |
-
'video_type' => 'youtube',
|
26 |
-
'youtube_id' => '',
|
27 |
-
'image_src' => '',
|
28 |
-
'video_height' => '',
|
29 |
-
'full_height' => 'on',
|
30 |
-
);
|
31 |
-
}
|
32 |
-
|
33 |
-
public function enqueue() {
|
34 |
-
if ( is_admin() && ! is_customize_preview() ) {
|
35 |
-
wp_enqueue_style( 'epsilon-styles', get_template_directory_uri() . '/inc/libraries/epsilon-framework/assets/css/style.css' );
|
36 |
-
}
|
37 |
-
}
|
38 |
-
|
39 |
-
function widget( $args, $instance ) {
|
40 |
-
|
41 |
-
$terminate = false;
|
42 |
-
if ( empty( $instance['video_type'] ) ) {
|
43 |
-
$instance['video_type'] = 'youtube';
|
44 |
-
}
|
45 |
-
switch ( $instance['video_type'] ) {
|
46 |
-
case 'youtube':
|
47 |
-
if ( empty( $instance['youtube_id'] ) ) {
|
48 |
-
$terminate = true;
|
49 |
-
}
|
50 |
-
wp_enqueue_script( 'ytbackground', plugins_url( 'assets/js/vendor/jquery.youtubebackground.js', dirname( dirname( __FILE__ ) ) ), array( 'jquery' ) );
|
51 |
-
break;
|
52 |
-
case 'vimeo':
|
53 |
-
if ( empty( $instance['vimeo_id'] ) ) {
|
54 |
-
$terminate = true;
|
55 |
-
}
|
56 |
-
wp_enqueue_script( 'vimeo-player', plugins_url( 'assets/js/vendor/player.min.js', dirname( dirname( __FILE__ ) ) ), array( 'jquery' ) );
|
57 |
-
break;
|
58 |
-
case 'upload':
|
59 |
-
if ( empty( $instance['video_id'] ) ) {
|
60 |
-
$terminate = true;
|
61 |
-
}
|
62 |
-
wp_enqueue_script( 'vide', plugins_url( 'assets/js/vendor/jquery.vide.min.js', dirname( dirname( __FILE__ ) ) ), array( 'jquery' ) );
|
63 |
-
break;
|
64 |
-
}
|
65 |
-
|
66 |
-
if ( $terminate ) {
|
67 |
-
return false;
|
68 |
-
}
|
69 |
-
|
70 |
-
if ( empty( $instance['image_src'] ) ) {
|
71 |
-
$instance['image_src'] = plugin_dir_url( dirname( dirname( __FILE__ ) ) ) . '/assets/img/placeholder.jpg';
|
72 |
-
}
|
73 |
-
|
74 |
-
?>
|
75 |
-
|
76 |
-
<?php if ( 'upload' == $instance['video_type'] ) : ?>
|
77 |
-
<div class="video-widget col-xs-12 upload"
|
78 |
-
<?php echo ( ! empty( $instance['video_height'] ) && empty( $instance['full_height'] ) ) ? 'style="height:' . esc_attr( $instance['video_height'] ) . 'px"' : ''; ?> data-vide-bg="mp4:<?php echo ! empty( $instance['video_id'] ) ? esc_attr( $instance['video_id'] ) : ''; ?>, poster:<?php echo esc_url( $instance['image_src'] ); ?>" data-vide-options="loop: false, position: 0% 0% <?php echo ! empty( $instance['autoplay'] ) ? ',autoplay: true' : ',autoplay:false'; ?><?php echo ! empty( $instance['mute'] ) ? ',muted: true' : ',muted:false'; ?>">
|
79 |
-
<span class="video-controls">
|
80 |
-
<button class="play-button"><icon class="fa fa-play"></icon></button>
|
81 |
-
<button class="pause-button"><icon class="fa fa-pause"></icon></button>
|
82 |
-
</span>
|
83 |
-
</div>
|
84 |
-
<?php elseif ( 'youtube' == $instance['video_type'] ) : ?>
|
85 |
-
<div <?php echo ! empty( $instance['youtube_id'] ) ? 'data-video-id="' . esc_attr( $instance['youtube_id'] ) . '"' : ''; ?>
|
86 |
-
data-autoplay="<?php echo ! empty( $instance['autoplay'] ) ? '1' : '0'; ?>" data-mute="<?php echo ! empty( $instance['mute'] ) ? '1' : '0'; ?>" class="video-widget youtube"
|
87 |
-
<?php echo ( ! empty( $instance['video_height'] ) && empty( $instance['full_height'] ) ) ? 'style="height:' . esc_attr( $instance['video_height'] ) . 'px"' : ''; ?>>
|
88 |
-
<span class="video-controls">
|
89 |
-
<button class="play-button"><icon class="fa fa-play"></icon></button>
|
90 |
-
<button class="pause-button"><icon class="fa fa-pause"></icon></button>
|
91 |
-
</span>
|
92 |
-
</div>
|
93 |
-
<?php elseif ( 'vimeo' == $instance['video_type'] ) : ?>
|
94 |
-
<div <?php echo ! empty( $instance['vimeo_id'] ) ? 'data-video-id="' . esc_attr( $instance['vimeo_id'] ) . '"' : ''; ?>
|
95 |
-
data-autoplay="<?php echo ! empty( $instance['autoplay'] ) ? '1' : '0'; ?>" data-mute="<?php echo ! empty( $instance['mute'] ) ? '1' : '0'; ?>" class="video-widget vimeo"
|
96 |
-
<?php echo ( ! empty( $instance['video_height'] ) && empty( $instance['full_height'] ) ) ? 'style="height:' . esc_attr( $instance['video_height'] ) . 'px"' : ''; ?>>
|
97 |
-
<div id="shapely-<?php echo absint( rand( 1000, 9999 ) ); ?>" class="vimeo-holder"></div>
|
98 |
-
<span class="video-controls">
|
99 |
-
<button class="play-button"><icon class="fa fa-play"></icon></button>
|
100 |
-
<button class="pause-button"><icon class="fa fa-pause"></icon></button>
|
101 |
-
</span>
|
102 |
-
</div>
|
103 |
-
<?php
|
104 |
-
endif;
|
105 |
-
}
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Back-end widget form.
|
109 |
-
*
|
110 |
-
* @see WP_Widget::form()
|
111 |
-
*
|
112 |
-
* @param array $instance Previously saved values from database.
|
113 |
-
*
|
114 |
-
* @return string;
|
115 |
-
*/
|
116 |
-
public function form( $instance ) {
|
117 |
-
|
118 |
-
// Merge the user-selected arguments with the defaults.
|
119 |
-
$instance = wp_parse_args( (array) $instance, $this->defaults );
|
120 |
-
$placeholder_url = plugins_url( 'shapely-companion/assets/img/placeholder.jpg' );
|
121 |
-
|
122 |
-
// Loads the widget form.
|
123 |
-
?>
|
124 |
-
|
125 |
-
<h4><?php echo esc_html__( 'General Controls', 'shapely-companion' ); ?></h4>
|
126 |
-
<hr/>
|
127 |
-
<p>
|
128 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'video_type' ) ); ?>">
|
129 |
-
<?php echo esc_html__( 'Video Type ', 'shapely-companion' ); ?>
|
130 |
-
</label>
|
131 |
-
<select name="<?php echo esc_attr( $this->get_field_name( 'video_type' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'video_type' ) ); ?>" class="video-type widefat">
|
132 |
-
<option value="youtube" <?php selected( $instance['video_type'], 'youtube' ); ?>><?php echo esc_html__( 'YouTube', 'shapely-companion' ); ?></option>
|
133 |
-
<option value="vimeo" <?php selected( $instance['video_type'], 'vimeo' ); ?>><?php echo esc_html__( 'Vimeo', 'shapely-companion' ); ?></option>
|
134 |
-
<option value="upload" <?php selected( $instance['video_type'], 'upload' ); ?>><?php echo esc_html__( 'Upload', 'shapely-companion' ); ?></option>
|
135 |
-
</select>
|
136 |
-
</p>
|
137 |
-
|
138 |
-
<div class="checkbox_switch wp-clearfix">
|
139 |
-
<span class="customize-control-title onoffswitch_label">
|
140 |
-
<?php echo esc_html__( 'Autoplay', 'shapely-companion' ); ?>
|
141 |
-
</span>
|
142 |
-
|
143 |
-
<div class="onoffswitch">
|
144 |
-
<input type="checkbox" id="<?php echo esc_attr( $this->get_field_name( 'autoplay' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'autoplay' ) ); ?>" class="onoffswitch-checkbox" value="on"
|
145 |
-
<?php checked( $instance['autoplay'], 'on' ); ?>>
|
146 |
-
<label class="onoffswitch-label" for="<?php echo esc_attr( $this->get_field_name( 'autoplay' ) ); ?>"></label>
|
147 |
-
</div>
|
148 |
-
</div>
|
149 |
-
|
150 |
-
<div class="checkbox_switch wp-clearfix">
|
151 |
-
<span class="customize-control-title onoffswitch_label">
|
152 |
-
<?php echo esc_html__( 'Mute', 'shapely-companion' ); ?>
|
153 |
-
</span>
|
154 |
-
<div class="onoffswitch">
|
155 |
-
<input type="checkbox" id="<?php echo esc_attr( $this->get_field_name( 'mute' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'mute' ) ); ?>" class="onoffswitch-checkbox" value="on"
|
156 |
-
<?php checked( $instance['mute'], 'on' ); ?>>
|
157 |
-
<label class="onoffswitch-label" for="<?php echo esc_attr( $this->get_field_name( 'mute' ) ); ?>"></label>
|
158 |
-
</div>
|
159 |
-
</div>
|
160 |
-
|
161 |
-
<div class="checkbox_switch wp-clearfix">
|
162 |
-
<span class="customize-control-title onoffswitch_label">
|
163 |
-
<?php echo esc_html__( 'Full height', 'shapely-companion' ); ?>
|
164 |
-
</span>
|
165 |
-
<div class="onoffswitch">
|
166 |
-
<input type="checkbox" id="<?php echo esc_attr( $this->get_field_name( 'full_height' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'full_height' ) ); ?>" class="onoffswitch-checkbox" value="on"
|
167 |
-
<?php checked( $instance['full_height'], 'on' ); ?>>
|
168 |
-
<label class="onoffswitch-label" for="<?php echo esc_attr( $this->get_field_name( 'full_height' ) ); ?>"></label>
|
169 |
-
</div>
|
170 |
-
</div>
|
171 |
-
|
172 |
-
<p>
|
173 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'video_height' ) ); ?>">
|
174 |
-
<?php echo esc_html__( 'Video Height (in pixels): ', 'shapely-companion' ); ?>
|
175 |
-
</label>
|
176 |
-
<input type="text" value="<?php echo esc_attr( $instance['video_height'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'video_height' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'video_height' ) ); ?>" class="widefat"/>
|
177 |
-
</p>
|
178 |
-
|
179 |
-
<h4><?php echo esc_html__( 'YouTube Controls', 'shapely-companion' ); ?></h4>
|
180 |
-
|
181 |
-
<hr/> <p class="youtube-controls">
|
182 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'youtube_id' ) ); ?>">
|
183 |
-
<?php echo esc_html__( 'YouTube ID: ', 'shapely-companion' ); ?>
|
184 |
-
</label>
|
185 |
-
<input type="text" value="<?php echo esc_attr( $instance['youtube_id'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'youtube_id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'youtube_id' ) ); ?>" class="widefat"/>
|
186 |
-
</p>
|
187 |
-
|
188 |
-
<h4><?php echo esc_html__( 'Vimeo Controls', 'shapely-companion' ); ?></h4>
|
189 |
-
|
190 |
-
<hr/> <p class="youtube-controls">
|
191 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'vimeo_id' ) ); ?>">
|
192 |
-
<?php echo esc_html__( 'Vimeo ID: ', 'shapely-companion' ); ?>
|
193 |
-
</label>
|
194 |
-
|
195 |
-
<input type="text" value="<?php echo esc_attr( $instance['vimeo_id'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'vimeo_id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'vimeo_id' ) ); ?>" class="widefat"/>
|
196 |
-
</p>
|
197 |
-
|
198 |
-
<h4><?php echo esc_html__( 'Video Upload Controls', 'shapely-companion' ); ?></h4>
|
199 |
-
|
200 |
-
<hr/>
|
201 |
-
<p class="upload-controls shapely-media-control" data-delegate-container="<?php echo esc_attr( $this->get_field_id( 'video_id' ) ); ?>">
|
202 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'video_id' ) ); ?>">
|
203 |
-
<?php echo esc_html__( 'Video URL: ', 'shapely-companion' ); ?>
|
204 |
-
</label>
|
205 |
-
|
206 |
-
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'video_id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'video_id' ) ); ?>" value="<?php echo esc_url( $instance['video_id'] ); ?>" class="image-id widefat blazersix-media-control-target">
|
207 |
-
<button class="button upload-button"><?php echo esc_html__( 'Choose Video', 'shapely-companion' ); ?></button>
|
208 |
-
<button class="button remove-button"><?php echo esc_html__( 'Remove Video', 'shapely-companion' ); ?></button>
|
209 |
-
</p>
|
210 |
-
|
211 |
-
<p class="upload-controls shapely-media-control" data-delegate-container="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>">
|
212 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>"><?php echo esc_html__( 'Placeholder: ', 'shapely-companion' ); ?>
|
213 |
-
</label>
|
214 |
-
|
215 |
-
<img data-default="<?php echo esc_url( $placeholder_url ); ?>" style="display:block; width:100%" src="<?php echo '' != $instance['image_src'] ? esc_url( $instance['image_src'] ) : esc_url( $placeholder_url ); ?>"/>
|
216 |
-
<input type="hidden" name="<?php echo esc_attr( $this->get_field_name( 'image_src' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>" value="<?php echo esc_url( $instance['image_src'] ); ?>" class="image-id blazersix-media-control-target">
|
217 |
-
|
218 |
-
<button class="button upload-button"><?php echo esc_html__( 'Choose Image', 'shapely-companion' ); ?></button>
|
219 |
-
<button class="button remove-button"><?php echo esc_html__( 'Remove Image', 'shapely-companion' ); ?></button>
|
220 |
-
</p>
|
221 |
-
|
222 |
-
<?php
|
223 |
-
}
|
224 |
-
|
225 |
-
/**
|
226 |
-
* Sanitize widget form values as they are saved.
|
227 |
-
*
|
228 |
-
* @see WP_Widget::update()
|
229 |
-
*
|
230 |
-
* @param array $new_instance Values just sent to be saved.
|
231 |
-
* @param array $old_instance Previously saved values from database.
|
232 |
-
*
|
233 |
-
* @return array Updated safe values to be saved.
|
234 |
-
*/
|
235 |
-
public function update( $new_instance, $old_instance ) {
|
236 |
-
$instance = array();
|
237 |
-
|
238 |
-
$instance['youtube_id'] = ( ! empty( $new_instance['youtube_id'] ) ) ? strip_tags( $new_instance['youtube_id'] ) : '';
|
239 |
-
$instance['vimeo_id'] = ( ! empty( $new_instance['vimeo_id'] ) ) ? absint( $new_instance['vimeo_id'] ) : '';
|
240 |
-
$instance['video_id'] = ( ! empty( $new_instance['video_id'] ) ) ? esc_url_raw( $new_instance['video_id'] ) : '';
|
241 |
-
$instance['image_src'] = ( ! empty( $new_instance['image_src'] ) ) ? esc_url_raw( $new_instance['image_src'] ) : '';
|
242 |
-
$instance['video_height'] = ( ! empty( $new_instance['video_height'] ) ) ? absint( $new_instance['video_height'] ) : '';
|
243 |
-
$instance['autoplay'] = ( ! empty( $new_instance['autoplay'] ) ) ? strip_tags( $new_instance['autoplay'] ) : '';
|
244 |
-
$instance['mute'] = ( ! empty( $new_instance['mute'] ) ) ? strip_tags( $new_instance['mute'] ) : '';
|
245 |
-
$instance['video_type'] = ( ! empty( $new_instance['video_type'] ) ) ? strip_tags( $new_instance['video_type'] ) : '';
|
246 |
-
$instance['full_height'] = ( ! empty( $new_instance['full_height'] ) ) ? strip_tags( $new_instance['full_height'] ) : '';
|
247 |
-
|
248 |
-
return $instance;
|
249 |
-
}
|
250 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class Shapely_Video
|
5 |
+
*/
|
6 |
+
class Shapely_Video extends WP_Widget {
|
7 |
+
|
8 |
+
private $defaults = array();
|
9 |
+
|
10 |
+
function __construct() {
|
11 |
+
add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue' ) );
|
12 |
+
add_action( 'customize_preview_init', array( $this, 'enqueue' ) );
|
13 |
+
|
14 |
+
$widget_ops = array(
|
15 |
+
'classname' => 'shapely_video_widget',
|
16 |
+
'description' => esc_html__( 'Shapely Video Section', 'shapely-companion' ),
|
17 |
+
);
|
18 |
+
parent::__construct( 'shapely_video_widget', esc_html__( '[Shapely] Video Section', 'shapely-companion' ), $widget_ops );
|
19 |
+
|
20 |
+
$this->defaults = array(
|
21 |
+
'autoplay' => 'on',
|
22 |
+
'mute' => 'on',
|
23 |
+
'video_id' => '',
|
24 |
+
'vimeo_id' => '',
|
25 |
+
'video_type' => 'youtube',
|
26 |
+
'youtube_id' => '',
|
27 |
+
'image_src' => '',
|
28 |
+
'video_height' => '',
|
29 |
+
'full_height' => 'on',
|
30 |
+
);
|
31 |
+
}
|
32 |
+
|
33 |
+
public function enqueue() {
|
34 |
+
if ( is_admin() && ! is_customize_preview() ) {
|
35 |
+
wp_enqueue_style( 'epsilon-styles', get_template_directory_uri() . '/inc/libraries/epsilon-framework/assets/css/style.css' );
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
function widget( $args, $instance ) {
|
40 |
+
|
41 |
+
$terminate = false;
|
42 |
+
if ( empty( $instance['video_type'] ) ) {
|
43 |
+
$instance['video_type'] = 'youtube';
|
44 |
+
}
|
45 |
+
switch ( $instance['video_type'] ) {
|
46 |
+
case 'youtube':
|
47 |
+
if ( empty( $instance['youtube_id'] ) ) {
|
48 |
+
$terminate = true;
|
49 |
+
}
|
50 |
+
wp_enqueue_script( 'ytbackground', plugins_url( 'assets/js/vendor/jquery.youtubebackground.js', dirname( dirname( __FILE__ ) ) ), array( 'jquery' ) );
|
51 |
+
break;
|
52 |
+
case 'vimeo':
|
53 |
+
if ( empty( $instance['vimeo_id'] ) ) {
|
54 |
+
$terminate = true;
|
55 |
+
}
|
56 |
+
wp_enqueue_script( 'vimeo-player', plugins_url( 'assets/js/vendor/player.min.js', dirname( dirname( __FILE__ ) ) ), array( 'jquery' ) );
|
57 |
+
break;
|
58 |
+
case 'upload':
|
59 |
+
if ( empty( $instance['video_id'] ) ) {
|
60 |
+
$terminate = true;
|
61 |
+
}
|
62 |
+
wp_enqueue_script( 'vide', plugins_url( 'assets/js/vendor/jquery.vide.min.js', dirname( dirname( __FILE__ ) ) ), array( 'jquery' ) );
|
63 |
+
break;
|
64 |
+
}
|
65 |
+
|
66 |
+
if ( $terminate ) {
|
67 |
+
return false;
|
68 |
+
}
|
69 |
+
|
70 |
+
if ( empty( $instance['image_src'] ) ) {
|
71 |
+
$instance['image_src'] = plugin_dir_url( dirname( dirname( __FILE__ ) ) ) . '/assets/img/placeholder.jpg';
|
72 |
+
}
|
73 |
+
|
74 |
+
?>
|
75 |
+
|
76 |
+
<?php if ( 'upload' == $instance['video_type'] ) : ?>
|
77 |
+
<div class="video-widget col-xs-12 upload"
|
78 |
+
<?php echo ( ! empty( $instance['video_height'] ) && empty( $instance['full_height'] ) ) ? 'style="height:' . esc_attr( $instance['video_height'] ) . 'px"' : ''; ?> data-vide-bg="mp4:<?php echo ! empty( $instance['video_id'] ) ? esc_attr( $instance['video_id'] ) : ''; ?>, poster:<?php echo esc_url( $instance['image_src'] ); ?>" data-vide-options="loop: false, position: 0% 0% <?php echo ! empty( $instance['autoplay'] ) ? ',autoplay: true' : ',autoplay:false'; ?><?php echo ! empty( $instance['mute'] ) ? ',muted: true' : ',muted:false'; ?>">
|
79 |
+
<span class="video-controls">
|
80 |
+
<button class="play-button"><icon class="fa fa-play"></icon></button>
|
81 |
+
<button class="pause-button"><icon class="fa fa-pause"></icon></button>
|
82 |
+
</span>
|
83 |
+
</div>
|
84 |
+
<?php elseif ( 'youtube' == $instance['video_type'] ) : ?>
|
85 |
+
<div <?php echo ! empty( $instance['youtube_id'] ) ? 'data-video-id="' . esc_attr( $instance['youtube_id'] ) . '"' : ''; ?>
|
86 |
+
data-autoplay="<?php echo ! empty( $instance['autoplay'] ) ? '1' : '0'; ?>" data-mute="<?php echo ! empty( $instance['mute'] ) ? '1' : '0'; ?>" class="video-widget youtube"
|
87 |
+
<?php echo ( ! empty( $instance['video_height'] ) && empty( $instance['full_height'] ) ) ? 'style="height:' . esc_attr( $instance['video_height'] ) . 'px"' : ''; ?>>
|
88 |
+
<span class="video-controls">
|
89 |
+
<button class="play-button"><icon class="fa fa-play"></icon></button>
|
90 |
+
<button class="pause-button"><icon class="fa fa-pause"></icon></button>
|
91 |
+
</span>
|
92 |
+
</div>
|
93 |
+
<?php elseif ( 'vimeo' == $instance['video_type'] ) : ?>
|
94 |
+
<div <?php echo ! empty( $instance['vimeo_id'] ) ? 'data-video-id="' . esc_attr( $instance['vimeo_id'] ) . '"' : ''; ?>
|
95 |
+
data-autoplay="<?php echo ! empty( $instance['autoplay'] ) ? '1' : '0'; ?>" data-mute="<?php echo ! empty( $instance['mute'] ) ? '1' : '0'; ?>" class="video-widget vimeo"
|
96 |
+
<?php echo ( ! empty( $instance['video_height'] ) && empty( $instance['full_height'] ) ) ? 'style="height:' . esc_attr( $instance['video_height'] ) . 'px"' : ''; ?>>
|
97 |
+
<div id="shapely-<?php echo absint( rand( 1000, 9999 ) ); ?>" class="vimeo-holder"></div>
|
98 |
+
<span class="video-controls">
|
99 |
+
<button class="play-button"><icon class="fa fa-play"></icon></button>
|
100 |
+
<button class="pause-button"><icon class="fa fa-pause"></icon></button>
|
101 |
+
</span>
|
102 |
+
</div>
|
103 |
+
<?php
|
104 |
+
endif;
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Back-end widget form.
|
109 |
+
*
|
110 |
+
* @see WP_Widget::form()
|
111 |
+
*
|
112 |
+
* @param array $instance Previously saved values from database.
|
113 |
+
*
|
114 |
+
* @return string;
|
115 |
+
*/
|
116 |
+
public function form( $instance ) {
|
117 |
+
|
118 |
+
// Merge the user-selected arguments with the defaults.
|
119 |
+
$instance = wp_parse_args( (array) $instance, $this->defaults );
|
120 |
+
$placeholder_url = plugins_url( 'shapely-companion/assets/img/placeholder.jpg' );
|
121 |
+
|
122 |
+
// Loads the widget form.
|
123 |
+
?>
|
124 |
+
|
125 |
+
<h4><?php echo esc_html__( 'General Controls', 'shapely-companion' ); ?></h4>
|
126 |
+
<hr/>
|
127 |
+
<p>
|
128 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'video_type' ) ); ?>">
|
129 |
+
<?php echo esc_html__( 'Video Type ', 'shapely-companion' ); ?>
|
130 |
+
</label>
|
131 |
+
<select name="<?php echo esc_attr( $this->get_field_name( 'video_type' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'video_type' ) ); ?>" class="video-type widefat">
|
132 |
+
<option value="youtube" <?php selected( $instance['video_type'], 'youtube' ); ?>><?php echo esc_html__( 'YouTube', 'shapely-companion' ); ?></option>
|
133 |
+
<option value="vimeo" <?php selected( $instance['video_type'], 'vimeo' ); ?>><?php echo esc_html__( 'Vimeo', 'shapely-companion' ); ?></option>
|
134 |
+
<option value="upload" <?php selected( $instance['video_type'], 'upload' ); ?>><?php echo esc_html__( 'Upload', 'shapely-companion' ); ?></option>
|
135 |
+
</select>
|
136 |
+
</p>
|
137 |
+
|
138 |
+
<div class="checkbox_switch wp-clearfix">
|
139 |
+
<span class="customize-control-title onoffswitch_label">
|
140 |
+
<?php echo esc_html__( 'Autoplay', 'shapely-companion' ); ?>
|
141 |
+
</span>
|
142 |
+
|
143 |
+
<div class="onoffswitch">
|
144 |
+
<input type="checkbox" id="<?php echo esc_attr( $this->get_field_name( 'autoplay' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'autoplay' ) ); ?>" class="onoffswitch-checkbox" value="on"
|
145 |
+
<?php checked( $instance['autoplay'], 'on' ); ?>>
|
146 |
+
<label class="onoffswitch-label" for="<?php echo esc_attr( $this->get_field_name( 'autoplay' ) ); ?>"></label>
|
147 |
+
</div>
|
148 |
+
</div>
|
149 |
+
|
150 |
+
<div class="checkbox_switch wp-clearfix">
|
151 |
+
<span class="customize-control-title onoffswitch_label">
|
152 |
+
<?php echo esc_html__( 'Mute', 'shapely-companion' ); ?>
|
153 |
+
</span>
|
154 |
+
<div class="onoffswitch">
|
155 |
+
<input type="checkbox" id="<?php echo esc_attr( $this->get_field_name( 'mute' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'mute' ) ); ?>" class="onoffswitch-checkbox" value="on"
|
156 |
+
<?php checked( $instance['mute'], 'on' ); ?>>
|
157 |
+
<label class="onoffswitch-label" for="<?php echo esc_attr( $this->get_field_name( 'mute' ) ); ?>"></label>
|
158 |
+
</div>
|
159 |
+
</div>
|
160 |
+
|
161 |
+
<div class="checkbox_switch wp-clearfix">
|
162 |
+
<span class="customize-control-title onoffswitch_label">
|
163 |
+
<?php echo esc_html__( 'Full height', 'shapely-companion' ); ?>
|
164 |
+
</span>
|
165 |
+
<div class="onoffswitch">
|
166 |
+
<input type="checkbox" id="<?php echo esc_attr( $this->get_field_name( 'full_height' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'full_height' ) ); ?>" class="onoffswitch-checkbox" value="on"
|
167 |
+
<?php checked( $instance['full_height'], 'on' ); ?>>
|
168 |
+
<label class="onoffswitch-label" for="<?php echo esc_attr( $this->get_field_name( 'full_height' ) ); ?>"></label>
|
169 |
+
</div>
|
170 |
+
</div>
|
171 |
+
|
172 |
+
<p>
|
173 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'video_height' ) ); ?>">
|
174 |
+
<?php echo esc_html__( 'Video Height (in pixels): ', 'shapely-companion' ); ?>
|
175 |
+
</label>
|
176 |
+
<input type="text" value="<?php echo esc_attr( $instance['video_height'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'video_height' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'video_height' ) ); ?>" class="widefat"/>
|
177 |
+
</p>
|
178 |
+
|
179 |
+
<h4><?php echo esc_html__( 'YouTube Controls', 'shapely-companion' ); ?></h4>
|
180 |
+
|
181 |
+
<hr/> <p class="youtube-controls">
|
182 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'youtube_id' ) ); ?>">
|
183 |
+
<?php echo esc_html__( 'YouTube ID: ', 'shapely-companion' ); ?>
|
184 |
+
</label>
|
185 |
+
<input type="text" value="<?php echo esc_attr( $instance['youtube_id'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'youtube_id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'youtube_id' ) ); ?>" class="widefat"/>
|
186 |
+
</p>
|
187 |
+
|
188 |
+
<h4><?php echo esc_html__( 'Vimeo Controls', 'shapely-companion' ); ?></h4>
|
189 |
+
|
190 |
+
<hr/> <p class="youtube-controls">
|
191 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'vimeo_id' ) ); ?>">
|
192 |
+
<?php echo esc_html__( 'Vimeo ID: ', 'shapely-companion' ); ?>
|
193 |
+
</label>
|
194 |
+
|
195 |
+
<input type="text" value="<?php echo esc_attr( $instance['vimeo_id'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'vimeo_id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'vimeo_id' ) ); ?>" class="widefat"/>
|
196 |
+
</p>
|
197 |
+
|
198 |
+
<h4><?php echo esc_html__( 'Video Upload Controls', 'shapely-companion' ); ?></h4>
|
199 |
+
|
200 |
+
<hr/>
|
201 |
+
<p class="upload-controls shapely-media-control" data-delegate-container="<?php echo esc_attr( $this->get_field_id( 'video_id' ) ); ?>">
|
202 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'video_id' ) ); ?>">
|
203 |
+
<?php echo esc_html__( 'Video URL: ', 'shapely-companion' ); ?>
|
204 |
+
</label>
|
205 |
+
|
206 |
+
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'video_id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'video_id' ) ); ?>" value="<?php echo esc_url( $instance['video_id'] ); ?>" class="image-id widefat blazersix-media-control-target">
|
207 |
+
<button class="button upload-button"><?php echo esc_html__( 'Choose Video', 'shapely-companion' ); ?></button>
|
208 |
+
<button class="button remove-button"><?php echo esc_html__( 'Remove Video', 'shapely-companion' ); ?></button>
|
209 |
+
</p>
|
210 |
+
|
211 |
+
<p class="upload-controls shapely-media-control" data-delegate-container="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>">
|
212 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>"><?php echo esc_html__( 'Placeholder: ', 'shapely-companion' ); ?>
|
213 |
+
</label>
|
214 |
+
|
215 |
+
<img data-default="<?php echo esc_url( $placeholder_url ); ?>" style="display:block; width:100%" src="<?php echo '' != $instance['image_src'] ? esc_url( $instance['image_src'] ) : esc_url( $placeholder_url ); ?>"/>
|
216 |
+
<input type="hidden" name="<?php echo esc_attr( $this->get_field_name( 'image_src' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'image_src' ) ); ?>" value="<?php echo esc_url( $instance['image_src'] ); ?>" class="image-id blazersix-media-control-target">
|
217 |
+
|
218 |
+
<button class="button upload-button"><?php echo esc_html__( 'Choose Image', 'shapely-companion' ); ?></button>
|
219 |
+
<button class="button remove-button"><?php echo esc_html__( 'Remove Image', 'shapely-companion' ); ?></button>
|
220 |
+
</p>
|
221 |
+
|
222 |
+
<?php
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Sanitize widget form values as they are saved.
|
227 |
+
*
|
228 |
+
* @see WP_Widget::update()
|
229 |
+
*
|
230 |
+
* @param array $new_instance Values just sent to be saved.
|
231 |
+
* @param array $old_instance Previously saved values from database.
|
232 |
+
*
|
233 |
+
* @return array Updated safe values to be saved.
|
234 |
+
*/
|
235 |
+
public function update( $new_instance, $old_instance ) {
|
236 |
+
$instance = array();
|
237 |
+
|
238 |
+
$instance['youtube_id'] = ( ! empty( $new_instance['youtube_id'] ) ) ? strip_tags( $new_instance['youtube_id'] ) : '';
|
239 |
+
$instance['vimeo_id'] = ( ! empty( $new_instance['vimeo_id'] ) ) ? absint( $new_instance['vimeo_id'] ) : '';
|
240 |
+
$instance['video_id'] = ( ! empty( $new_instance['video_id'] ) ) ? esc_url_raw( $new_instance['video_id'] ) : '';
|
241 |
+
$instance['image_src'] = ( ! empty( $new_instance['image_src'] ) ) ? esc_url_raw( $new_instance['image_src'] ) : '';
|
242 |
+
$instance['video_height'] = ( ! empty( $new_instance['video_height'] ) ) ? absint( $new_instance['video_height'] ) : '';
|
243 |
+
$instance['autoplay'] = ( ! empty( $new_instance['autoplay'] ) ) ? strip_tags( $new_instance['autoplay'] ) : '';
|
244 |
+
$instance['mute'] = ( ! empty( $new_instance['mute'] ) ) ? strip_tags( $new_instance['mute'] ) : '';
|
245 |
+
$instance['video_type'] = ( ! empty( $new_instance['video_type'] ) ) ? strip_tags( $new_instance['video_type'] ) : '';
|
246 |
+
$instance['full_height'] = ( ! empty( $new_instance['full_height'] ) ) ? strip_tags( $new_instance['full_height'] ) : '';
|
247 |
+
|
248 |
+
return $instance;
|
249 |
+
}
|
250 |
+
}
|
languages/shapely.pot
CHANGED
@@ -1,426 +1,426 @@
|
|
1 |
-
# Copyright (C) 2016
|
2 |
-
# This file is distributed under the same license as the package.
|
3 |
-
msgid ""
|
4 |
-
msgstr ""
|
5 |
-
"Project-Id-Version: \n"
|
6 |
-
"Report-Msgid-Bugs-To: https://www.colorlib.com/\n"
|
7 |
-
"POT-Creation-Date: 2016-12-14 14:44:03+00:00\n"
|
8 |
-
"MIME-Version: 1.0\n"
|
9 |
-
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
-
"Content-Transfer-Encoding: 8bit\n"
|
11 |
-
"PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
|
12 |
-
"Last-Translator: Colorlib <office@colorlib.com>\n"
|
13 |
-
"Language-Team: Colorlib <office@colorlib.com>\n"
|
14 |
-
"X-Generator: grunt-wp-i18n 0.5.4\n"
|
15 |
-
"X-Poedit-KeywordsList: "
|
16 |
-
"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
|
17 |
-
"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
|
18 |
-
"Language: en\n"
|
19 |
-
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
20 |
-
"X-Poedit-Country: United States\n"
|
21 |
-
"X-Poedit-SourceCharset: UTF-8\n"
|
22 |
-
"X-Poedit-Basepath: ../\n"
|
23 |
-
"X-Poedit-SearchPath-0: .\n"
|
24 |
-
"X-Poedit-Bookmarks: \n"
|
25 |
-
"X-Textdomain-Support: yes\n"
|
26 |
-
|
27 |
-
#: inc/class-epsilon-color-scheme.php:52
|
28 |
-
msgid "Accent Color"
|
29 |
-
msgstr ""
|
30 |
-
|
31 |
-
#: inc/class-epsilon-color-scheme.php:53
|
32 |
-
msgid "The main color used for links, buttons, and more."
|
33 |
-
msgstr ""
|
34 |
-
|
35 |
-
#: inc/class-epsilon-color-scheme.php:58
|
36 |
-
msgid "Text Color"
|
37 |
-
msgstr ""
|
38 |
-
|
39 |
-
#: inc/class-epsilon-color-scheme.php:59
|
40 |
-
msgid "The color used for paragraphs."
|
41 |
-
msgstr ""
|
42 |
-
|
43 |
-
#: inc/class-epsilon-color-scheme.php:65
|
44 |
-
msgid "Content Widget Title Color"
|
45 |
-
msgstr ""
|
46 |
-
|
47 |
-
#: inc/class-epsilon-color-scheme.php:66
|
48 |
-
msgid "The color used for content widgets title."
|
49 |
-
msgstr ""
|
50 |
-
|
51 |
-
#: inc/class-epsilon-color-scheme.php:72
|
52 |
-
msgid "Footer Background Color"
|
53 |
-
msgstr ""
|
54 |
-
|
55 |
-
#: inc/class-epsilon-color-scheme.php:73
|
56 |
-
msgid "The color used for the footer background."
|
57 |
-
msgstr ""
|
58 |
-
|
59 |
-
#: inc/class-epsilon-color-scheme.php:79
|
60 |
-
msgid "Footer Widget Title Color"
|
61 |
-
msgstr ""
|
62 |
-
|
63 |
-
#: inc/class-epsilon-color-scheme.php:80
|
64 |
-
msgid "The color used for the footer widgets title."
|
65 |
-
msgstr ""
|
66 |
-
|
67 |
-
#: inc/class-epsilon-color-scheme.php:86
|
68 |
-
msgid "Footer Links Color"
|
69 |
-
msgstr ""
|
70 |
-
|
71 |
-
#: inc/class-epsilon-color-scheme.php:87
|
72 |
-
msgid "The color used for the footer links."
|
73 |
-
msgstr ""
|
74 |
-
|
75 |
-
#: inc/shapely-demo-content.php:61
|
76 |
-
msgid "Front Page"
|
77 |
-
msgstr ""
|
78 |
-
|
79 |
-
#: inc/shapely-demo-content.php:62
|
80 |
-
msgid "Blog"
|
81 |
-
msgstr ""
|
82 |
-
|
83 |
-
#: inc/shapely-woo-setup.php:101
|
84 |
-
msgid "View your shopping cart"
|
85 |
-
msgstr ""
|
86 |
-
|
87 |
-
#: inc/shapely-woo-setup.php:102
|
88 |
-
msgid "Start shopping"
|
89 |
-
msgstr ""
|
90 |
-
|
91 |
-
#: inc/shapely-woo-setup.php:106
|
92 |
-
msgid "%d item"
|
93 |
-
msgid_plural "%d items"
|
94 |
-
msgstr[0] ""
|
95 |
-
msgstr[1] ""
|
96 |
-
|
97 |
-
#: inc/views/shapely-demo-content.php:11
|
98 |
-
msgid "I want my site to look like your demo"
|
99 |
-
msgstr ""
|
100 |
-
|
101 |
-
#: inc/views/shapely-demo-content.php:14 inc/views/shapely-demo-content.php:23
|
102 |
-
msgid "Content Imported"
|
103 |
-
msgstr ""
|
104 |
-
|
105 |
-
#: inc/views/shapely-demo-content.php:17
|
106 |
-
msgid "I want only to import demo widgets"
|
107 |
-
msgstr ""
|
108 |
-
|
109 |
-
#: inc/views/shapely-demo-content.php:20
|
110 |
-
msgid "Import Widgets"
|
111 |
-
msgstr ""
|
112 |
-
|
113 |
-
#: inc/widgets/widget-categories.php:15
|
114 |
-
msgid "Shapely Categories"
|
115 |
-
msgstr ""
|
116 |
-
|
117 |
-
#: inc/widgets/widget-categories.php:18
|
118 |
-
msgid "[Shapely] Categories"
|
119 |
-
msgstr ""
|
120 |
-
|
121 |
-
#: inc/widgets/widget-categories.php:28 inc/widgets/widget-categories.php:78
|
122 |
-
msgid "Categories"
|
123 |
-
msgstr ""
|
124 |
-
|
125 |
-
#: inc/widgets/widget-categories.php:90 inc/widgets/widget-home-clients.php:92
|
126 |
-
#: inc/widgets/widget-home-features.php:120
|
127 |
-
#: inc/widgets/widget-home-features.php:142
|
128 |
-
#: inc/widgets/widget-home-parallax.php:136
|
129 |
-
#: inc/widgets/widget-home-portfolio.php:99
|
130 |
-
#: inc/widgets/widget-home-testimonials.php:103
|
131 |
-
#: inc/widgets/widget-social.php:57
|
132 |
-
msgid "Title "
|
133 |
-
msgstr ""
|
134 |
-
|
135 |
-
#: inc/widgets/widget-categories.php:99
|
136 |
-
msgid "Limit Categories "
|
137 |
-
msgstr ""
|
138 |
-
|
139 |
-
#: inc/widgets/widget-categories.php:110
|
140 |
-
msgid "Enable Posts Count"
|
141 |
-
msgstr ""
|
142 |
-
|
143 |
-
#: inc/widgets/widget-home-call-for-action.php:12
|
144 |
-
msgid "[Shapely] Call for Action Section"
|
145 |
-
msgstr ""
|
146 |
-
|
147 |
-
#: inc/widgets/widget-home-call-for-action.php:15
|
148 |
-
msgid "[Shapely] Call for Action Section For FrontPage"
|
149 |
-
msgstr ""
|
150 |
-
|
151 |
-
#: inc/widgets/widget-home-call-for-action.php:70
|
152 |
-
msgid "Callout Text "
|
153 |
-
msgstr ""
|
154 |
-
|
155 |
-
#: inc/widgets/widget-home-call-for-action.php:79
|
156 |
-
msgid "Button Text "
|
157 |
-
msgstr ""
|
158 |
-
|
159 |
-
#: inc/widgets/widget-home-call-for-action.php:88
|
160 |
-
msgid "Button Link "
|
161 |
-
msgstr ""
|
162 |
-
|
163 |
-
#: inc/widgets/widget-home-clients.php:12
|
164 |
-
msgid "Shapely Client Section That Displays Logos In A Slider"
|
165 |
-
msgstr ""
|
166 |
-
|
167 |
-
#: inc/widgets/widget-home-clients.php:15
|
168 |
-
msgid "[Shapely] Client Section For FrontPage"
|
169 |
-
msgstr ""
|
170 |
-
|
171 |
-
#: inc/widgets/widget-home-clients.php:20
|
172 |
-
msgid "Our Main Clients"
|
173 |
-
msgstr ""
|
174 |
-
|
175 |
-
#: inc/widgets/widget-home-clients.php:48
|
176 |
-
msgid "Logos"
|
177 |
-
msgstr ""
|
178 |
-
|
179 |
-
#: inc/widgets/widget-home-clients.php:112
|
180 |
-
msgid "Logo #"
|
181 |
-
msgstr ""
|
182 |
-
|
183 |
-
#: inc/widgets/widget-home-clients.php:124
|
184 |
-
#: inc/widgets/widget-home-parallax.php:158
|
185 |
-
#: inc/widgets/widget-home-testimonials.php:134
|
186 |
-
#: inc/widgets/widget-video.php:198
|
187 |
-
msgid "Choose Image"
|
188 |
-
msgstr ""
|
189 |
-
|
190 |
-
#: inc/widgets/widget-home-clients.php:127
|
191 |
-
msgid "Link:"
|
192 |
-
msgstr ""
|
193 |
-
|
194 |
-
#: inc/widgets/widget-home-clients.php:133
|
195 |
-
msgid "Add"
|
196 |
-
msgstr ""
|
197 |
-
|
198 |
-
#: inc/widgets/widget-home-clients.php:134
|
199 |
-
msgid "Delete"
|
200 |
-
msgstr ""
|
201 |
-
|
202 |
-
#: inc/widgets/widget-home-features.php:12
|
203 |
-
msgid "Widget to set Features in Home Section"
|
204 |
-
msgstr ""
|
205 |
-
|
206 |
-
#: inc/widgets/widget-home-features.php:16
|
207 |
-
msgid "[Shapely] Features Section For FrontPage"
|
208 |
-
msgstr ""
|
209 |
-
|
210 |
-
#: inc/widgets/widget-home-features.php:129
|
211 |
-
#: inc/widgets/widget-home-features.php:169
|
212 |
-
#: inc/widgets/widget-home-parallax.php:163
|
213 |
-
#: inc/widgets/widget-home-portfolio.php:108
|
214 |
-
msgid "Content "
|
215 |
-
msgstr ""
|
216 |
-
|
217 |
-
#: inc/widgets/widget-home-features.php:139
|
218 |
-
msgid "Feature %s"
|
219 |
-
msgstr ""
|
220 |
-
|
221 |
-
#: inc/widgets/widget-home-features.php:151
|
222 |
-
msgid "Icon( Font Awsome ) "
|
223 |
-
msgstr ""
|
224 |
-
|
225 |
-
#: inc/widgets/widget-home-features.php:158
|
226 |
-
msgid "Select Icon"
|
227 |
-
msgstr ""
|
228 |
-
|
229 |
-
#: inc/widgets/widget-home-parallax.php:16
|
230 |
-
msgid "Shapely FrontPage Parallax Section"
|
231 |
-
msgstr ""
|
232 |
-
|
233 |
-
#: inc/widgets/widget-home-parallax.php:19
|
234 |
-
msgid "[Shapely] Parralax Section For FrontPage"
|
235 |
-
msgstr ""
|
236 |
-
|
237 |
-
#: inc/widgets/widget-home-parallax.php:31
|
238 |
-
msgid "left"
|
239 |
-
msgstr ""
|
240 |
-
|
241 |
-
#: inc/widgets/widget-home-parallax.php:147
|
242 |
-
msgid "Image"
|
243 |
-
msgstr ""
|
244 |
-
|
245 |
-
#: inc/widgets/widget-home-parallax.php:159 inc/widgets/widget-video.php:199
|
246 |
-
msgid "Remove Image"
|
247 |
-
msgstr ""
|
248 |
-
|
249 |
-
#: inc/widgets/widget-home-parallax.php:171
|
250 |
-
msgid "Image Position "
|
251 |
-
msgstr ""
|
252 |
-
|
253 |
-
#: inc/widgets/widget-home-parallax.php:175
|
254 |
-
msgid "Left"
|
255 |
-
msgstr ""
|
256 |
-
|
257 |
-
#: inc/widgets/widget-home-parallax.php:177
|
258 |
-
msgid "Right"
|
259 |
-
msgstr ""
|
260 |
-
|
261 |
-
#: inc/widgets/widget-home-parallax.php:179
|
262 |
-
msgid "Top"
|
263 |
-
msgstr ""
|
264 |
-
|
265 |
-
#: inc/widgets/widget-home-parallax.php:181
|
266 |
-
msgid "Bottom"
|
267 |
-
msgstr ""
|
268 |
-
|
269 |
-
#: inc/widgets/widget-home-parallax.php:183
|
270 |
-
msgid "Background Full"
|
271 |
-
msgstr ""
|
272 |
-
|
273 |
-
#: inc/widgets/widget-home-parallax.php:185
|
274 |
-
msgid "Background Small"
|
275 |
-
msgstr ""
|
276 |
-
|
277 |
-
#: inc/widgets/widget-home-parallax.php:190
|
278 |
-
msgid "Button 1 Text "
|
279 |
-
msgstr ""
|
280 |
-
|
281 |
-
#: inc/widgets/widget-home-parallax.php:199
|
282 |
-
msgid "Button 1 Link "
|
283 |
-
msgstr ""
|
284 |
-
|
285 |
-
#: inc/widgets/widget-home-parallax.php:208
|
286 |
-
msgid "Button 2 Text "
|
287 |
-
msgstr ""
|
288 |
-
|
289 |
-
#: inc/widgets/widget-home-parallax.php:217
|
290 |
-
msgid "Button 2 Link "
|
291 |
-
msgstr ""
|
292 |
-
|
293 |
-
#: inc/widgets/widget-home-parallax.php:227
|
294 |
-
msgid "Border bottom"
|
295 |
-
msgstr ""
|
296 |
-
|
297 |
-
#: inc/widgets/widget-home-portfolio.php:12
|
298 |
-
msgid "Shapely Porfolio for Home Widget Section"
|
299 |
-
msgstr ""
|
300 |
-
|
301 |
-
#: inc/widgets/widget-home-portfolio.php:15
|
302 |
-
msgid "[Shapely] Porfolio for Home Widget Section"
|
303 |
-
msgstr ""
|
304 |
-
|
305 |
-
#: inc/widgets/widget-home-testimonials.php:12
|
306 |
-
msgid "Shapely Testimonial Widget Section"
|
307 |
-
msgstr ""
|
308 |
-
|
309 |
-
#: inc/widgets/widget-home-testimonials.php:15
|
310 |
-
msgid "[Shapely] Testimonial Section For FrontPage"
|
311 |
-
msgstr ""
|
312 |
-
|
313 |
-
#: inc/widgets/widget-home-testimonials.php:20
|
314 |
-
msgid "People just like you are already loving Colorlib"
|
315 |
-
msgstr ""
|
316 |
-
|
317 |
-
#: inc/widgets/widget-home-testimonials.php:112
|
318 |
-
msgid "Limit "
|
319 |
-
msgstr ""
|
320 |
-
|
321 |
-
#: inc/widgets/widget-home-testimonials.php:123
|
322 |
-
msgid "Background Parallax Image:"
|
323 |
-
msgstr ""
|
324 |
-
|
325 |
-
#: inc/widgets/widget-recent-posts.php:13
|
326 |
-
msgid "Widget to show recent posts with thumbnails"
|
327 |
-
msgstr ""
|
328 |
-
|
329 |
-
#: inc/widgets/widget-recent-posts.php:16
|
330 |
-
msgid "[Shapely] Recent Posts"
|
331 |
-
msgstr ""
|
332 |
-
|
333 |
-
#: inc/widgets/widget-recent-posts.php:21
|
334 |
-
#: inc/widgets/widget-recent-posts.php:87
|
335 |
-
msgid "recent Posts"
|
336 |
-
msgstr ""
|
337 |
-
|
338 |
-
#: inc/widgets/widget-recent-posts.php:95
|
339 |
-
msgid "Title"
|
340 |
-
msgstr ""
|
341 |
-
|
342 |
-
#: inc/widgets/widget-recent-posts.php:104
|
343 |
-
msgid "Limit Posts Number"
|
344 |
-
msgstr ""
|
345 |
-
|
346 |
-
#: inc/widgets/widget-social.php:12
|
347 |
-
msgid "shapely Social Widget"
|
348 |
-
msgstr ""
|
349 |
-
|
350 |
-
#: inc/widgets/widget-social.php:15
|
351 |
-
msgid "[Shapely] Social Widget"
|
352 |
-
msgstr ""
|
353 |
-
|
354 |
-
#: inc/widgets/widget-social.php:20 inc/widgets/widget-social.php:53
|
355 |
-
msgid "Follow us"
|
356 |
-
msgstr ""
|
357 |
-
|
358 |
-
#: inc/widgets/widget-social.php:23
|
359 |
-
msgid ""
|
360 |
-
"This widget works only with Shapely theme. Please install and activate it "
|
361 |
-
"first."
|
362 |
-
msgstr ""
|
363 |
-
|
364 |
-
#: inc/widgets/widget-video.php:11
|
365 |
-
msgid "Shapely Video Section"
|
366 |
-
msgstr ""
|
367 |
-
|
368 |
-
#: inc/widgets/widget-video.php:13
|
369 |
-
msgid "[Shapely] Video Section"
|
370 |
-
msgstr ""
|
371 |
-
|
372 |
-
#: inc/widgets/widget-video.php:101
|
373 |
-
msgid "General Controls"
|
374 |
-
msgstr ""
|
375 |
-
|
376 |
-
#: inc/widgets/widget-video.php:104
|
377 |
-
msgid "Video Type "
|
378 |
-
msgstr ""
|
379 |
-
|
380 |
-
#: inc/widgets/widget-video.php:108
|
381 |
-
msgid "YouTube"
|
382 |
-
msgstr ""
|
383 |
-
|
384 |
-
#: inc/widgets/widget-video.php:110
|
385 |
-
msgid "Upload"
|
386 |
-
msgstr ""
|
387 |
-
|
388 |
-
#: inc/widgets/widget-video.php:116
|
389 |
-
msgid "Autoplay"
|
390 |
-
msgstr ""
|
391 |
-
|
392 |
-
#: inc/widgets/widget-video.php:131
|
393 |
-
msgid "Full height"
|
394 |
-
msgstr ""
|
395 |
-
|
396 |
-
#: inc/widgets/widget-video.php:145
|
397 |
-
msgid "Video Height (in pixels): "
|
398 |
-
msgstr ""
|
399 |
-
|
400 |
-
#: inc/widgets/widget-video.php:153
|
401 |
-
msgid "YouTube Controls"
|
402 |
-
msgstr ""
|
403 |
-
|
404 |
-
#: inc/widgets/widget-video.php:157
|
405 |
-
msgid "YouTube ID: "
|
406 |
-
msgstr ""
|
407 |
-
|
408 |
-
#: inc/widgets/widget-video.php:165
|
409 |
-
msgid "Video Upload Controls"
|
410 |
-
msgstr ""
|
411 |
-
|
412 |
-
#: inc/widgets/widget-video.php:170
|
413 |
-
msgid "Video URL: "
|
414 |
-
msgstr ""
|
415 |
-
|
416 |
-
#: inc/widgets/widget-video.php:182
|
417 |
-
msgid "Choose Video"
|
418 |
-
msgstr ""
|
419 |
-
|
420 |
-
#: inc/widgets/widget-video.php:183
|
421 |
-
msgid "Remove Video"
|
422 |
-
msgstr ""
|
423 |
-
|
424 |
-
#: inc/widgets/widget-video.php:188
|
425 |
-
msgid "Placeholder: "
|
426 |
msgstr ""
|
1 |
+
# Copyright (C) 2016
|
2 |
+
# This file is distributed under the same license as the package.
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"Project-Id-Version: \n"
|
6 |
+
"Report-Msgid-Bugs-To: https://www.colorlib.com/\n"
|
7 |
+
"POT-Creation-Date: 2016-12-14 14:44:03+00:00\n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: Colorlib <office@colorlib.com>\n"
|
13 |
+
"Language-Team: Colorlib <office@colorlib.com>\n"
|
14 |
+
"X-Generator: grunt-wp-i18n 0.5.4\n"
|
15 |
+
"X-Poedit-KeywordsList: "
|
16 |
+
"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
|
17 |
+
"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
|
18 |
+
"Language: en\n"
|
19 |
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
20 |
+
"X-Poedit-Country: United States\n"
|
21 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
22 |
+
"X-Poedit-Basepath: ../\n"
|
23 |
+
"X-Poedit-SearchPath-0: .\n"
|
24 |
+
"X-Poedit-Bookmarks: \n"
|
25 |
+
"X-Textdomain-Support: yes\n"
|
26 |
+
|
27 |
+
#: inc/class-epsilon-color-scheme.php:52
|
28 |
+
msgid "Accent Color"
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: inc/class-epsilon-color-scheme.php:53
|
32 |
+
msgid "The main color used for links, buttons, and more."
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
#: inc/class-epsilon-color-scheme.php:58
|
36 |
+
msgid "Text Color"
|
37 |
+
msgstr ""
|
38 |
+
|
39 |
+
#: inc/class-epsilon-color-scheme.php:59
|
40 |
+
msgid "The color used for paragraphs."
|
41 |
+
msgstr ""
|
42 |
+
|
43 |
+
#: inc/class-epsilon-color-scheme.php:65
|
44 |
+
msgid "Content Widget Title Color"
|
45 |
+
msgstr ""
|
46 |
+
|
47 |
+
#: inc/class-epsilon-color-scheme.php:66
|
48 |
+
msgid "The color used for content widgets title."
|
49 |
+
msgstr ""
|
50 |
+
|
51 |
+
#: inc/class-epsilon-color-scheme.php:72
|
52 |
+
msgid "Footer Background Color"
|
53 |
+
msgstr ""
|
54 |
+
|
55 |
+
#: inc/class-epsilon-color-scheme.php:73
|
56 |
+
msgid "The color used for the footer background."
|
57 |
+
msgstr ""
|
58 |
+
|
59 |
+
#: inc/class-epsilon-color-scheme.php:79
|
60 |
+
msgid "Footer Widget Title Color"
|
61 |
+
msgstr ""
|
62 |
+
|
63 |
+
#: inc/class-epsilon-color-scheme.php:80
|
64 |
+
msgid "The color used for the footer widgets title."
|
65 |
+
msgstr ""
|
66 |
+
|
67 |
+
#: inc/class-epsilon-color-scheme.php:86
|
68 |
+
msgid "Footer Links Color"
|
69 |
+
msgstr ""
|
70 |
+
|
71 |
+
#: inc/class-epsilon-color-scheme.php:87
|
72 |
+
msgid "The color used for the footer links."
|
73 |
+
msgstr ""
|
74 |
+
|
75 |
+
#: inc/shapely-demo-content.php:61
|
76 |
+
msgid "Front Page"
|
77 |
+
msgstr ""
|
78 |
+
|
79 |
+
#: inc/shapely-demo-content.php:62
|
80 |
+
msgid "Blog"
|
81 |
+
msgstr ""
|
82 |
+
|
83 |
+
#: inc/shapely-woo-setup.php:101
|
84 |
+
msgid "View your shopping cart"
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: inc/shapely-woo-setup.php:102
|
88 |
+
msgid "Start shopping"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: inc/shapely-woo-setup.php:106
|
92 |
+
msgid "%d item"
|
93 |
+
msgid_plural "%d items"
|
94 |
+
msgstr[0] ""
|
95 |
+
msgstr[1] ""
|
96 |
+
|
97 |
+
#: inc/views/shapely-demo-content.php:11
|
98 |
+
msgid "I want my site to look like your demo"
|
99 |
+
msgstr ""
|
100 |
+
|
101 |
+
#: inc/views/shapely-demo-content.php:14 inc/views/shapely-demo-content.php:23
|
102 |
+
msgid "Content Imported"
|
103 |
+
msgstr ""
|
104 |
+
|
105 |
+
#: inc/views/shapely-demo-content.php:17
|
106 |
+
msgid "I want only to import demo widgets"
|
107 |
+
msgstr ""
|
108 |
+
|
109 |
+
#: inc/views/shapely-demo-content.php:20
|
110 |
+
msgid "Import Widgets"
|
111 |
+
msgstr ""
|
112 |
+
|
113 |
+
#: inc/widgets/widget-categories.php:15
|
114 |
+
msgid "Shapely Categories"
|
115 |
+
msgstr ""
|
116 |
+
|
117 |
+
#: inc/widgets/widget-categories.php:18
|
118 |
+
msgid "[Shapely] Categories"
|
119 |
+
msgstr ""
|
120 |
+
|
121 |
+
#: inc/widgets/widget-categories.php:28 inc/widgets/widget-categories.php:78
|
122 |
+
msgid "Categories"
|
123 |
+
msgstr ""
|
124 |
+
|
125 |
+
#: inc/widgets/widget-categories.php:90 inc/widgets/widget-home-clients.php:92
|
126 |
+
#: inc/widgets/widget-home-features.php:120
|
127 |
+
#: inc/widgets/widget-home-features.php:142
|
128 |
+
#: inc/widgets/widget-home-parallax.php:136
|
129 |
+
#: inc/widgets/widget-home-portfolio.php:99
|
130 |
+
#: inc/widgets/widget-home-testimonials.php:103
|
131 |
+
#: inc/widgets/widget-social.php:57
|
132 |
+
msgid "Title "
|
133 |
+
msgstr ""
|
134 |
+
|
135 |
+
#: inc/widgets/widget-categories.php:99
|
136 |
+
msgid "Limit Categories "
|
137 |
+
msgstr ""
|
138 |
+
|
139 |
+
#: inc/widgets/widget-categories.php:110
|
140 |
+
msgid "Enable Posts Count"
|
141 |
+
msgstr ""
|
142 |
+
|
143 |
+
#: inc/widgets/widget-home-call-for-action.php:12
|
144 |
+
msgid "[Shapely] Call for Action Section"
|
145 |
+
msgstr ""
|
146 |
+
|
147 |
+
#: inc/widgets/widget-home-call-for-action.php:15
|
148 |
+
msgid "[Shapely] Call for Action Section For FrontPage"
|
149 |
+
msgstr ""
|
150 |
+
|
151 |
+
#: inc/widgets/widget-home-call-for-action.php:70
|
152 |
+
msgid "Callout Text "
|
153 |
+
msgstr ""
|
154 |
+
|
155 |
+
#: inc/widgets/widget-home-call-for-action.php:79
|
156 |
+
msgid "Button Text "
|
157 |
+
msgstr ""
|
158 |
+
|
159 |
+
#: inc/widgets/widget-home-call-for-action.php:88
|
160 |
+
msgid "Button Link "
|
161 |
+
msgstr ""
|
162 |
+
|
163 |
+
#: inc/widgets/widget-home-clients.php:12
|
164 |
+
msgid "Shapely Client Section That Displays Logos In A Slider"
|
165 |
+
msgstr ""
|
166 |
+
|
167 |
+
#: inc/widgets/widget-home-clients.php:15
|
168 |
+
msgid "[Shapely] Client Section For FrontPage"
|
169 |
+
msgstr ""
|
170 |
+
|
171 |
+
#: inc/widgets/widget-home-clients.php:20
|
172 |
+
msgid "Our Main Clients"
|
173 |
+
msgstr ""
|
174 |
+
|
175 |
+
#: inc/widgets/widget-home-clients.php:48
|
176 |
+
msgid "Logos"
|
177 |
+
msgstr ""
|
178 |
+
|
179 |
+
#: inc/widgets/widget-home-clients.php:112
|
180 |
+
msgid "Logo #"
|
181 |
+
msgstr ""
|
182 |
+
|
183 |
+
#: inc/widgets/widget-home-clients.php:124
|
184 |
+
#: inc/widgets/widget-home-parallax.php:158
|
185 |
+
#: inc/widgets/widget-home-testimonials.php:134
|
186 |
+
#: inc/widgets/widget-video.php:198
|
187 |
+
msgid "Choose Image"
|
188 |
+
msgstr ""
|
189 |
+
|
190 |
+
#: inc/widgets/widget-home-clients.php:127
|
191 |
+
msgid "Link:"
|
192 |
+
msgstr ""
|
193 |
+
|
194 |
+
#: inc/widgets/widget-home-clients.php:133
|
195 |
+
msgid "Add"
|
196 |
+
msgstr ""
|
197 |
+
|
198 |
+
#: inc/widgets/widget-home-clients.php:134
|
199 |
+
msgid "Delete"
|
200 |
+
msgstr ""
|
201 |
+
|
202 |
+
#: inc/widgets/widget-home-features.php:12
|
203 |
+
msgid "Widget to set Features in Home Section"
|
204 |
+
msgstr ""
|
205 |
+
|
206 |
+
#: inc/widgets/widget-home-features.php:16
|
207 |
+
msgid "[Shapely] Features Section For FrontPage"
|
208 |
+
msgstr ""
|
209 |
+
|
210 |
+
#: inc/widgets/widget-home-features.php:129
|
211 |
+
#: inc/widgets/widget-home-features.php:169
|
212 |
+
#: inc/widgets/widget-home-parallax.php:163
|
213 |
+
#: inc/widgets/widget-home-portfolio.php:108
|
214 |
+
msgid "Content "
|
215 |
+
msgstr ""
|
216 |
+
|
217 |
+
#: inc/widgets/widget-home-features.php:139
|
218 |
+
msgid "Feature %s"
|
219 |
+
msgstr ""
|
220 |
+
|
221 |
+
#: inc/widgets/widget-home-features.php:151
|
222 |
+
msgid "Icon( Font Awsome ) "
|
223 |
+
msgstr ""
|
224 |
+
|
225 |
+
#: inc/widgets/widget-home-features.php:158
|
226 |
+
msgid "Select Icon"
|
227 |
+
msgstr ""
|
228 |
+
|
229 |
+
#: inc/widgets/widget-home-parallax.php:16
|
230 |
+
msgid "Shapely FrontPage Parallax Section"
|
231 |
+
msgstr ""
|
232 |
+
|
233 |
+
#: inc/widgets/widget-home-parallax.php:19
|
234 |
+
msgid "[Shapely] Parralax Section For FrontPage"
|
235 |
+
msgstr ""
|
236 |
+
|
237 |
+
#: inc/widgets/widget-home-parallax.php:31
|
238 |
+
msgid "left"
|
239 |
+
msgstr ""
|
240 |
+
|
241 |
+
#: inc/widgets/widget-home-parallax.php:147
|
242 |
+
msgid "Image"
|
243 |
+
msgstr ""
|
244 |
+
|
245 |
+
#: inc/widgets/widget-home-parallax.php:159 inc/widgets/widget-video.php:199
|
246 |
+
msgid "Remove Image"
|
247 |
+
msgstr ""
|
248 |
+
|
249 |
+
#: inc/widgets/widget-home-parallax.php:171
|
250 |
+
msgid "Image Position "
|
251 |
+
msgstr ""
|
252 |
+
|
253 |
+
#: inc/widgets/widget-home-parallax.php:175
|
254 |
+
msgid "Left"
|
255 |
+
msgstr ""
|
256 |
+
|
257 |
+
#: inc/widgets/widget-home-parallax.php:177
|
258 |
+
msgid "Right"
|
259 |
+
msgstr ""
|
260 |
+
|
261 |
+
#: inc/widgets/widget-home-parallax.php:179
|
262 |
+
msgid "Top"
|
263 |
+
msgstr ""
|
264 |
+
|
265 |
+
#: inc/widgets/widget-home-parallax.php:181
|
266 |
+
msgid "Bottom"
|
267 |
+
msgstr ""
|
268 |
+
|
269 |
+
#: inc/widgets/widget-home-parallax.php:183
|
270 |
+
msgid "Background Full"
|
271 |
+
msgstr ""
|
272 |
+
|
273 |
+
#: inc/widgets/widget-home-parallax.php:185
|
274 |
+
msgid "Background Small"
|
275 |
+
msgstr ""
|
276 |
+
|
277 |
+
#: inc/widgets/widget-home-parallax.php:190
|
278 |
+
msgid "Button 1 Text "
|
279 |
+
msgstr ""
|
280 |
+
|
281 |
+
#: inc/widgets/widget-home-parallax.php:199
|
282 |
+
msgid "Button 1 Link "
|
283 |
+
msgstr ""
|
284 |
+
|
285 |
+
#: inc/widgets/widget-home-parallax.php:208
|
286 |
+
msgid "Button 2 Text "
|
287 |
+
msgstr ""
|
288 |
+
|
289 |
+
#: inc/widgets/widget-home-parallax.php:217
|
290 |
+
msgid "Button 2 Link "
|
291 |
+
msgstr ""
|
292 |
+
|
293 |
+
#: inc/widgets/widget-home-parallax.php:227
|
294 |
+
msgid "Border bottom"
|
295 |
+
msgstr ""
|
296 |
+
|
297 |
+
#: inc/widgets/widget-home-portfolio.php:12
|
298 |
+
msgid "Shapely Porfolio for Home Widget Section"
|
299 |
+
msgstr ""
|
300 |
+
|
301 |
+
#: inc/widgets/widget-home-portfolio.php:15
|
302 |
+
msgid "[Shapely] Porfolio for Home Widget Section"
|
303 |
+
msgstr ""
|
304 |
+
|
305 |
+
#: inc/widgets/widget-home-testimonials.php:12
|
306 |
+
msgid "Shapely Testimonial Widget Section"
|
307 |
+
msgstr ""
|
308 |
+
|
309 |
+
#: inc/widgets/widget-home-testimonials.php:15
|
310 |
+
msgid "[Shapely] Testimonial Section For FrontPage"
|
311 |
+
msgstr ""
|
312 |
+
|
313 |
+
#: inc/widgets/widget-home-testimonials.php:20
|
314 |
+
msgid "People just like you are already loving Colorlib"
|
315 |
+
msgstr ""
|
316 |
+
|
317 |
+
#: inc/widgets/widget-home-testimonials.php:112
|
318 |
+
msgid "Limit "
|
319 |
+
msgstr ""
|
320 |
+
|
321 |
+
#: inc/widgets/widget-home-testimonials.php:123
|
322 |
+
msgid "Background Parallax Image:"
|
323 |
+
msgstr ""
|
324 |
+
|
325 |
+
#: inc/widgets/widget-recent-posts.php:13
|
326 |
+
msgid "Widget to show recent posts with thumbnails"
|
327 |
+
msgstr ""
|
328 |
+
|
329 |
+
#: inc/widgets/widget-recent-posts.php:16
|
330 |
+
msgid "[Shapely] Recent Posts"
|
331 |
+
msgstr ""
|
332 |
+
|
333 |
+
#: inc/widgets/widget-recent-posts.php:21
|
334 |
+
#: inc/widgets/widget-recent-posts.php:87
|
335 |
+
msgid "recent Posts"
|
336 |
+
msgstr ""
|
337 |
+
|
338 |
+
#: inc/widgets/widget-recent-posts.php:95
|
339 |
+
msgid "Title"
|
340 |
+
msgstr ""
|
341 |
+
|
342 |
+
#: inc/widgets/widget-recent-posts.php:104
|
343 |
+
msgid "Limit Posts Number"
|
344 |
+
msgstr ""
|
345 |
+
|
346 |
+
#: inc/widgets/widget-social.php:12
|
347 |
+
msgid "shapely Social Widget"
|
348 |
+
msgstr ""
|
349 |
+
|
350 |
+
#: inc/widgets/widget-social.php:15
|
351 |
+
msgid "[Shapely] Social Widget"
|
352 |
+
msgstr ""
|
353 |
+
|
354 |
+
#: inc/widgets/widget-social.php:20 inc/widgets/widget-social.php:53
|
355 |
+
msgid "Follow us"
|
356 |
+
msgstr ""
|
357 |
+
|
358 |
+
#: inc/widgets/widget-social.php:23
|
359 |
+
msgid ""
|
360 |
+
"This widget works only with Shapely theme. Please install and activate it "
|
361 |
+
"first."
|
362 |
+
msgstr ""
|
363 |
+
|
364 |
+
#: inc/widgets/widget-video.php:11
|
365 |
+
msgid "Shapely Video Section"
|
366 |
+
msgstr ""
|
367 |
+
|
368 |
+
#: inc/widgets/widget-video.php:13
|
369 |
+
msgid "[Shapely] Video Section"
|
370 |
+
msgstr ""
|
371 |
+
|
372 |
+
#: inc/widgets/widget-video.php:101
|
373 |
+
msgid "General Controls"
|
374 |
+
msgstr ""
|
375 |
+
|
376 |
+
#: inc/widgets/widget-video.php:104
|
377 |
+
msgid "Video Type "
|
378 |
+
msgstr ""
|
379 |
+
|
380 |
+
#: inc/widgets/widget-video.php:108
|
381 |
+
msgid "YouTube"
|
382 |
+
msgstr ""
|
383 |
+
|
384 |
+
#: inc/widgets/widget-video.php:110
|
385 |
+
msgid "Upload"
|
386 |
+
msgstr ""
|
387 |
+
|
388 |
+
#: inc/widgets/widget-video.php:116
|
389 |
+
msgid "Autoplay"
|
390 |
+
msgstr ""
|
391 |
+
|
392 |
+
#: inc/widgets/widget-video.php:131
|
393 |
+
msgid "Full height"
|
394 |
+
msgstr ""
|
395 |
+
|
396 |
+
#: inc/widgets/widget-video.php:145
|
397 |
+
msgid "Video Height (in pixels): "
|
398 |
+
msgstr ""
|
399 |
+
|
400 |
+
#: inc/widgets/widget-video.php:153
|
401 |
+
msgid "YouTube Controls"
|
402 |
+
msgstr ""
|
403 |
+
|
404 |
+
#: inc/widgets/widget-video.php:157
|
405 |
+
msgid "YouTube ID: "
|
406 |
+
msgstr ""
|
407 |
+
|
408 |
+
#: inc/widgets/widget-video.php:165
|
409 |
+
msgid "Video Upload Controls"
|
410 |
+
msgstr ""
|
411 |
+
|
412 |
+
#: inc/widgets/widget-video.php:170
|
413 |
+
msgid "Video URL: "
|
414 |
+
msgstr ""
|
415 |
+
|
416 |
+
#: inc/widgets/widget-video.php:182
|
417 |
+
msgid "Choose Video"
|
418 |
+
msgstr ""
|
419 |
+
|
420 |
+
#: inc/widgets/widget-video.php:183
|
421 |
+
msgid "Remove Video"
|
422 |
+
msgstr ""
|
423 |
+
|
424 |
+
#: inc/widgets/widget-video.php:188
|
425 |
+
msgid "Placeholder: "
|
426 |
msgstr ""
|
license.txt
CHANGED
@@ -1,674 +1,674 @@
|
|
1 |
-
GNU GENERAL PUBLIC LICENSE
|
2 |
-
Version 3, 29 June 2007
|
3 |
-
|
4 |
-
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5 |
-
Everyone is permitted to copy and distribute verbatim copies
|
6 |
-
of this license document, but changing it is not allowed.
|
7 |
-
|
8 |
-
Preamble
|
9 |
-
|
10 |
-
The GNU General Public License is a free, copyleft license for
|
11 |
-
software and other kinds of works.
|
12 |
-
|
13 |
-
The licenses for most software and other practical works are designed
|
14 |
-
to take away your freedom to share and change the works. By contrast,
|
15 |
-
the GNU General Public License is intended to guarantee your freedom to
|
16 |
-
share and change all versions of a program--to make sure it remains free
|
17 |
-
software for all its users. We, the Free Software Foundation, use the
|
18 |
-
GNU General Public License for most of our software; it applies also to
|
19 |
-
any other work released this way by its authors. You can apply it to
|
20 |
-
your programs, too.
|
21 |
-
|
22 |
-
When we speak of free software, we are referring to freedom, not
|
23 |
-
price. Our General Public Licenses are designed to make sure that you
|
24 |
-
have the freedom to distribute copies of free software (and charge for
|
25 |
-
them if you wish), that you receive source code or can get it if you
|
26 |
-
want it, that you can change the software or use pieces of it in new
|
27 |
-
free programs, and that you know you can do these things.
|
28 |
-
|
29 |
-
To protect your rights, we need to prevent others from denying you
|
30 |
-
these rights or asking you to surrender the rights. Therefore, you have
|
31 |
-
certain responsibilities if you distribute copies of the software, or if
|
32 |
-
you modify it: responsibilities to respect the freedom of others.
|
33 |
-
|
34 |
-
For example, if you distribute copies of such a program, whether
|
35 |
-
gratis or for a fee, you must pass on to the recipients the same
|
36 |
-
freedoms that you received. You must make sure that they, too, receive
|
37 |
-
or can get the source code. And you must show them these terms so they
|
38 |
-
know their rights.
|
39 |
-
|
40 |
-
Developers that use the GNU GPL protect your rights with two steps:
|
41 |
-
(1) assert copyright on the software, and (2) offer you this License
|
42 |
-
giving you legal permission to copy, distribute and/or modify it.
|
43 |
-
|
44 |
-
For the developers' and authors' protection, the GPL clearly explains
|
45 |
-
that there is no warranty for this free software. For both users' and
|
46 |
-
authors' sake, the GPL requires that modified versions be marked as
|
47 |
-
changed, so that their problems will not be attributed erroneously to
|
48 |
-
authors of previous versions.
|
49 |
-
|
50 |
-
Some devices are designed to deny users access to install or run
|
51 |
-
modified versions of the software inside them, although the manufacturer
|
52 |
-
can do so. This is fundamentally incompatible with the aim of
|
53 |
-
protecting users' freedom to change the software. The systematic
|
54 |
-
pattern of such abuse occurs in the area of products for individuals to
|
55 |
-
use, which is precisely where it is most unacceptable. Therefore, we
|
56 |
-
have designed this version of the GPL to prohibit the practice for those
|
57 |
-
products. If such problems arise substantially in other domains, we
|
58 |
-
stand ready to extend this provision to those domains in future versions
|
59 |
-
of the GPL, as needed to protect the freedom of users.
|
60 |
-
|
61 |
-
Finally, every program is threatened constantly by software patents.
|
62 |
-
States should not allow patents to restrict development and use of
|
63 |
-
software on general-purpose computers, but in those that do, we wish to
|
64 |
-
avoid the special danger that patents applied to a free program could
|
65 |
-
make it effectively proprietary. To prevent this, the GPL assures that
|
66 |
-
patents cannot be used to render the program non-free.
|
67 |
-
|
68 |
-
The precise terms and conditions for copying, distribution and
|
69 |
-
modification follow.
|
70 |
-
|
71 |
-
TERMS AND CONDITIONS
|
72 |
-
|
73 |
-
0. Definitions.
|
74 |
-
|
75 |
-
"This License" refers to version 3 of the GNU General Public License.
|
76 |
-
|
77 |
-
"Copyright" also means copyright-like laws that apply to other kinds of
|
78 |
-
works, such as semiconductor masks.
|
79 |
-
|
80 |
-
"The Program" refers to any copyrightable work licensed under this
|
81 |
-
License. Each licensee is addressed as "you". "Licensees" and
|
82 |
-
"recipients" may be individuals or organizations.
|
83 |
-
|
84 |
-
To "modify" a work means to copy from or adapt all or part of the work
|
85 |
-
in a fashion requiring copyright permission, other than the making of an
|
86 |
-
exact copy. The resulting work is called a "modified version" of the
|
87 |
-
earlier work or a work "based on" the earlier work.
|
88 |
-
|
89 |
-
A "covered work" means either the unmodified Program or a work based
|
90 |
-
on the Program.
|
91 |
-
|
92 |
-
To "propagate" a work means to do anything with it that, without
|
93 |
-
permission, would make you directly or secondarily liable for
|
94 |
-
infringement under applicable copyright law, except executing it on a
|
95 |
-
computer or modifying a private copy. Propagation includes copying,
|
96 |
-
distribution (with or without modification), making available to the
|
97 |
-
public, and in some countries other activities as well.
|
98 |
-
|
99 |
-
To "convey" a work means any kind of propagation that enables other
|
100 |
-
parties to make or receive copies. Mere interaction with a user through
|
101 |
-
a computer network, with no transfer of a copy, is not conveying.
|
102 |
-
|
103 |
-
An interactive user interface displays "Appropriate Legal Notices"
|
104 |
-
to the extent that it includes a convenient and prominently visible
|
105 |
-
feature that (1) displays an appropriate copyright notice, and (2)
|
106 |
-
tells the user that there is no warranty for the work (except to the
|
107 |
-
extent that warranties are provided), that licensees may convey the
|
108 |
-
work under this License, and how to view a copy of this License. If
|
109 |
-
the interface presents a list of user commands or options, such as a
|
110 |
-
menu, a prominent item in the list meets this criterion.
|
111 |
-
|
112 |
-
1. Source Code.
|
113 |
-
|
114 |
-
The "source code" for a work means the preferred form of the work
|
115 |
-
for making modifications to it. "Object code" means any non-source
|
116 |
-
form of a work.
|
117 |
-
|
118 |
-
A "Standard Interface" means an interface that either is an official
|
119 |
-
standard defined by a recognized standards body, or, in the case of
|
120 |
-
interfaces specified for a particular programming language, one that
|
121 |
-
is widely used among developers working in that language.
|
122 |
-
|
123 |
-
The "System Libraries" of an executable work include anything, other
|
124 |
-
than the work as a whole, that (a) is included in the normal form of
|
125 |
-
packaging a Major Component, but which is not part of that Major
|
126 |
-
Component, and (b) serves only to enable use of the work with that
|
127 |
-
Major Component, or to implement a Standard Interface for which an
|
128 |
-
implementation is available to the public in source code form. A
|
129 |
-
"Major Component", in this context, means a major essential component
|
130 |
-
(kernel, window system, and so on) of the specific operating system
|
131 |
-
(if any) on which the executable work runs, or a compiler used to
|
132 |
-
produce the work, or an object code interpreter used to run it.
|
133 |
-
|
134 |
-
The "Corresponding Source" for a work in object code form means all
|
135 |
-
the source code needed to generate, install, and (for an executable
|
136 |
-
work) run the object code and to modify the work, including scripts to
|
137 |
-
control those activities. However, it does not include the work's
|
138 |
-
System Libraries, or general-purpose tools or generally available free
|
139 |
-
programs which are used unmodified in performing those activities but
|
140 |
-
which are not part of the work. For example, Corresponding Source
|
141 |
-
includes interface definition files associated with source files for
|
142 |
-
the work, and the source code for shared libraries and dynamically
|
143 |
-
linked subprograms that the work is specifically designed to require,
|
144 |
-
such as by intimate data communication or control flow between those
|
145 |
-
subprograms and other parts of the work.
|
146 |
-
|
147 |
-
The Corresponding Source need not include anything that users
|
148 |
-
can regenerate automatically from other parts of the Corresponding
|
149 |
-
Source.
|
150 |
-
|
151 |
-
The Corresponding Source for a work in source code form is that
|
152 |
-
same work.
|
153 |
-
|
154 |
-
2. Basic Permissions.
|
155 |
-
|
156 |
-
All rights granted under this License are granted for the term of
|
157 |
-
copyright on the Program, and are irrevocable provided the stated
|
158 |
-
conditions are met. This License explicitly affirms your unlimited
|
159 |
-
permission to run the unmodified Program. The output from running a
|
160 |
-
covered work is covered by this License only if the output, given its
|
161 |
-
content, constitutes a covered work. This License acknowledges your
|
162 |
-
rights of fair use or other equivalent, as provided by copyright law.
|
163 |
-
|
164 |
-
You may make, run and propagate covered works that you do not
|
165 |
-
convey, without conditions so long as your license otherwise remains
|
166 |
-
in force. You may convey covered works to others for the sole purpose
|
167 |
-
of having them make modifications exclusively for you, or provide you
|
168 |
-
with facilities for running those works, provided that you comply with
|
169 |
-
the terms of this License in conveying all material for which you do
|
170 |
-
not control copyright. Those thus making or running the covered works
|
171 |
-
for you must do so exclusively on your behalf, under your direction
|
172 |
-
and control, on terms that prohibit them from making any copies of
|
173 |
-
your copyrighted material outside their relationship with you.
|
174 |
-
|
175 |
-
Conveying under any other circumstances is permitted solely under
|
176 |
-
the conditions stated below. Sublicensing is not allowed; section 10
|
177 |
-
makes it unnecessary.
|
178 |
-
|
179 |
-
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
180 |
-
|
181 |
-
No covered work shall be deemed part of an effective technological
|
182 |
-
measure under any applicable law fulfilling obligations under article
|
183 |
-
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
184 |
-
similar laws prohibiting or restricting circumvention of such
|
185 |
-
measures.
|
186 |
-
|
187 |
-
When you convey a covered work, you waive any legal power to forbid
|
188 |
-
circumvention of technological measures to the extent such circumvention
|
189 |
-
is effected by exercising rights under this License with respect to
|
190 |
-
the covered work, and you disclaim any intention to limit operation or
|
191 |
-
modification of the work as a means of enforcing, against the work's
|
192 |
-
users, your or third parties' legal rights to forbid circumvention of
|
193 |
-
technological measures.
|
194 |
-
|
195 |
-
4. Conveying Verbatim Copies.
|
196 |
-
|
197 |
-
You may convey verbatim copies of the Program's source code as you
|
198 |
-
receive it, in any medium, provided that you conspicuously and
|
199 |
-
appropriately publish on each copy an appropriate copyright notice;
|
200 |
-
keep intact all notices stating that this License and any
|
201 |
-
non-permissive terms added in accord with section 7 apply to the code;
|
202 |
-
keep intact all notices of the absence of any warranty; and give all
|
203 |
-
recipients a copy of this License along with the Program.
|
204 |
-
|
205 |
-
You may charge any price or no price for each copy that you convey,
|
206 |
-
and you may offer support or warranty protection for a fee.
|
207 |
-
|
208 |
-
5. Conveying Modified Source Versions.
|
209 |
-
|
210 |
-
You may convey a work based on the Program, or the modifications to
|
211 |
-
produce it from the Program, in the form of source code under the
|
212 |
-
terms of section 4, provided that you also meet all of these conditions:
|
213 |
-
|
214 |
-
a) The work must carry prominent notices stating that you modified
|
215 |
-
it, and giving a relevant date.
|
216 |
-
|
217 |
-
b) The work must carry prominent notices stating that it is
|
218 |
-
released under this License and any conditions added under section
|
219 |
-
7. This requirement modifies the requirement in section 4 to
|
220 |
-
"keep intact all notices".
|
221 |
-
|
222 |
-
c) You must license the entire work, as a whole, under this
|
223 |
-
License to anyone who comes into possession of a copy. This
|
224 |
-
License will therefore apply, along with any applicable section 7
|
225 |
-
additional terms, to the whole of the work, and all its parts,
|
226 |
-
regardless of how they are packaged. This License gives no
|
227 |
-
permission to license the work in any other way, but it does not
|
228 |
-
invalidate such permission if you have separately received it.
|
229 |
-
|
230 |
-
d) If the work has interactive user interfaces, each must display
|
231 |
-
Appropriate Legal Notices; however, if the Program has interactive
|
232 |
-
interfaces that do not display Appropriate Legal Notices, your
|
233 |
-
work need not make them do so.
|
234 |
-
|
235 |
-
A compilation of a covered work with other separate and independent
|
236 |
-
works, which are not by their nature extensions of the covered work,
|
237 |
-
and which are not combined with it such as to form a larger program,
|
238 |
-
in or on a volume of a storage or distribution medium, is called an
|
239 |
-
"aggregate" if the compilation and its resulting copyright are not
|
240 |
-
used to limit the access or legal rights of the compilation's users
|
241 |
-
beyond what the individual works permit. Inclusion of a covered work
|
242 |
-
in an aggregate does not cause this License to apply to the other
|
243 |
-
parts of the aggregate.
|
244 |
-
|
245 |
-
6. Conveying Non-Source Forms.
|
246 |
-
|
247 |
-
You may convey a covered work in object code form under the terms
|
248 |
-
of sections 4 and 5, provided that you also convey the
|
249 |
-
machine-readable Corresponding Source under the terms of this License,
|
250 |
-
in one of these ways:
|
251 |
-
|
252 |
-
a) Convey the object code in, or embodied in, a physical product
|
253 |
-
(including a physical distribution medium), accompanied by the
|
254 |
-
Corresponding Source fixed on a durable physical medium
|
255 |
-
customarily used for software interchange.
|
256 |
-
|
257 |
-
b) Convey the object code in, or embodied in, a physical product
|
258 |
-
(including a physical distribution medium), accompanied by a
|
259 |
-
written offer, valid for at least three years and valid for as
|
260 |
-
long as you offer spare parts or customer support for that product
|
261 |
-
model, to give anyone who possesses the object code either (1) a
|
262 |
-
copy of the Corresponding Source for all the software in the
|
263 |
-
product that is covered by this License, on a durable physical
|
264 |
-
medium customarily used for software interchange, for a price no
|
265 |
-
more than your reasonable cost of physically performing this
|
266 |
-
conveying of source, or (2) access to copy the
|
267 |
-
Corresponding Source from a network server at no charge.
|
268 |
-
|
269 |
-
c) Convey individual copies of the object code with a copy of the
|
270 |
-
written offer to provide the Corresponding Source. This
|
271 |
-
alternative is allowed only occasionally and noncommercially, and
|
272 |
-
only if you received the object code with such an offer, in accord
|
273 |
-
with subsection 6b.
|
274 |
-
|
275 |
-
d) Convey the object code by offering access from a designated
|
276 |
-
place (gratis or for a charge), and offer equivalent access to the
|
277 |
-
Corresponding Source in the same way through the same place at no
|
278 |
-
further charge. You need not require recipients to copy the
|
279 |
-
Corresponding Source along with the object code. If the place to
|
280 |
-
copy the object code is a network server, the Corresponding Source
|
281 |
-
may be on a different server (operated by you or a third party)
|
282 |
-
that supports equivalent copying facilities, provided you maintain
|
283 |
-
clear directions next to the object code saying where to find the
|
284 |
-
Corresponding Source. Regardless of what server hosts the
|
285 |
-
Corresponding Source, you remain obligated to ensure that it is
|
286 |
-
available for as long as needed to satisfy these requirements.
|
287 |
-
|
288 |
-
e) Convey the object code using peer-to-peer transmission, provided
|
289 |
-
you inform other peers where the object code and Corresponding
|
290 |
-
Source of the work are being offered to the general public at no
|
291 |
-
charge under subsection 6d.
|
292 |
-
|
293 |
-
A separable portion of the object code, whose source code is excluded
|
294 |
-
from the Corresponding Source as a System Library, need not be
|
295 |
-
included in conveying the object code work.
|
296 |
-
|
297 |
-
A "User Product" is either (1) a "consumer product", which means any
|
298 |
-
tangible personal property which is normally used for personal, family,
|
299 |
-
or household purposes, or (2) anything designed or sold for incorporation
|
300 |
-
into a dwelling. In determining whether a product is a consumer product,
|
301 |
-
doubtful cases shall be resolved in favor of coverage. For a particular
|
302 |
-
product received by a particular user, "normally used" refers to a
|
303 |
-
typical or common use of that class of product, regardless of the status
|
304 |
-
of the particular user or of the way in which the particular user
|
305 |
-
actually uses, or expects or is expected to use, the product. A product
|
306 |
-
is a consumer product regardless of whether the product has substantial
|
307 |
-
commercial, industrial or non-consumer uses, unless such uses represent
|
308 |
-
the only significant mode of use of the product.
|
309 |
-
|
310 |
-
"Installation Information" for a User Product means any methods,
|
311 |
-
procedures, authorization keys, or other information required to install
|
312 |
-
and execute modified versions of a covered work in that User Product from
|
313 |
-
a modified version of its Corresponding Source. The information must
|
314 |
-
suffice to ensure that the continued functioning of the modified object
|
315 |
-
code is in no case prevented or interfered with solely because
|
316 |
-
modification has been made.
|
317 |
-
|
318 |
-
If you convey an object code work under this section in, or with, or
|
319 |
-
specifically for use in, a User Product, and the conveying occurs as
|
320 |
-
part of a transaction in which the right of possession and use of the
|
321 |
-
User Product is transferred to the recipient in perpetuity or for a
|
322 |
-
fixed term (regardless of how the transaction is characterized), the
|
323 |
-
Corresponding Source conveyed under this section must be accompanied
|
324 |
-
by the Installation Information. But this requirement does not apply
|
325 |
-
if neither you nor any third party retains the ability to install
|
326 |
-
modified object code on the User Product (for example, the work has
|
327 |
-
been installed in ROM).
|
328 |
-
|
329 |
-
The requirement to provide Installation Information does not include a
|
330 |
-
requirement to continue to provide support service, warranty, or updates
|
331 |
-
for a work that has been modified or installed by the recipient, or for
|
332 |
-
the User Product in which it has been modified or installed. Access to a
|
333 |
-
network may be denied when the modification itself materially and
|
334 |
-
adversely affects the operation of the network or violates the rules and
|
335 |
-
protocols for communication across the network.
|
336 |
-
|
337 |
-
Corresponding Source conveyed, and Installation Information provided,
|
338 |
-
in accord with this section must be in a format that is publicly
|
339 |
-
documented (and with an implementation available to the public in
|
340 |
-
source code form), and must require no special password or key for
|
341 |
-
unpacking, reading or copying.
|
342 |
-
|
343 |
-
7. Additional Terms.
|
344 |
-
|
345 |
-
"Additional permissions" are terms that supplement the terms of this
|
346 |
-
License by making exceptions from one or more of its conditions.
|
347 |
-
Additional permissions that are applicable to the entire Program shall
|
348 |
-
be treated as though they were included in this License, to the extent
|
349 |
-
that they are valid under applicable law. If additional permissions
|
350 |
-
apply only to part of the Program, that part may be used separately
|
351 |
-
under those permissions, but the entire Program remains governed by
|
352 |
-
this License without regard to the additional permissions.
|
353 |
-
|
354 |
-
When you convey a copy of a covered work, you may at your option
|
355 |
-
remove any additional permissions from that copy, or from any part of
|
356 |
-
it. (Additional permissions may be written to require their own
|
357 |
-
removal in certain cases when you modify the work.) You may place
|
358 |
-
additional permissions on material, added by you to a covered work,
|
359 |
-
for which you have or can give appropriate copyright permission.
|
360 |
-
|
361 |
-
Notwithstanding any other provision of this License, for material you
|
362 |
-
add to a covered work, you may (if authorized by the copyright holders of
|
363 |
-
that material) supplement the terms of this License with terms:
|
364 |
-
|
365 |
-
a) Disclaiming warranty or limiting liability differently from the
|
366 |
-
terms of sections 15 and 16 of this License; or
|
367 |
-
|
368 |
-
b) Requiring preservation of specified reasonable legal notices or
|
369 |
-
author attributions in that material or in the Appropriate Legal
|
370 |
-
Notices displayed by works containing it; or
|
371 |
-
|
372 |
-
c) Prohibiting misrepresentation of the origin of that material, or
|
373 |
-
requiring that modified versions of such material be marked in
|
374 |
-
reasonable ways as different from the original version; or
|
375 |
-
|
376 |
-
d) Limiting the use for publicity purposes of names of licensors or
|
377 |
-
authors of the material; or
|
378 |
-
|
379 |
-
e) Declining to grant rights under trademark law for use of some
|
380 |
-
trade names, trademarks, or service marks; or
|
381 |
-
|
382 |
-
f) Requiring indemnification of licensors and authors of that
|
383 |
-
material by anyone who conveys the material (or modified versions of
|
384 |
-
it) with contractual assumptions of liability to the recipient, for
|
385 |
-
any liability that these contractual assumptions directly impose on
|
386 |
-
those licensors and authors.
|
387 |
-
|
388 |
-
All other non-permissive additional terms are considered "further
|
389 |
-
restrictions" within the meaning of section 10. If the Program as you
|
390 |
-
received it, or any part of it, contains a notice stating that it is
|
391 |
-
governed by this License along with a term that is a further
|
392 |
-
restriction, you may remove that term. If a license document contains
|
393 |
-
a further restriction but permits relicensing or conveying under this
|
394 |
-
License, you may add to a covered work material governed by the terms
|
395 |
-
of that license document, provided that the further restriction does
|
396 |
-
not survive such relicensing or conveying.
|
397 |
-
|
398 |
-
If you add terms to a covered work in accord with this section, you
|
399 |
-
must place, in the relevant source files, a statement of the
|
400 |
-
additional terms that apply to those files, or a notice indicating
|
401 |
-
where to find the applicable terms.
|
402 |
-
|
403 |
-
Additional terms, permissive or non-permissive, may be stated in the
|
404 |
-
form of a separately written license, or stated as exceptions;
|
405 |
-
the above requirements apply either way.
|
406 |
-
|
407 |
-
8. Termination.
|
408 |
-
|
409 |
-
You may not propagate or modify a covered work except as expressly
|
410 |
-
provided under this License. Any attempt otherwise to propagate or
|
411 |
-
modify it is void, and will automatically terminate your rights under
|
412 |
-
this License (including any patent licenses granted under the third
|
413 |
-
paragraph of section 11).
|
414 |
-
|
415 |
-
However, if you cease all violation of this License, then your
|
416 |
-
license from a particular copyright holder is reinstated (a)
|
417 |
-
provisionally, unless and until the copyright holder explicitly and
|
418 |
-
finally terminates your license, and (b) permanently, if the copyright
|
419 |
-
holder fails to notify you of the violation by some reasonable means
|
420 |
-
prior to 60 days after the cessation.
|
421 |
-
|
422 |
-
Moreover, your license from a particular copyright holder is
|
423 |
-
reinstated permanently if the copyright holder notifies you of the
|
424 |
-
violation by some reasonable means, this is the first time you have
|
425 |
-
received notice of violation of this License (for any work) from that
|
426 |
-
copyright holder, and you cure the violation prior to 30 days after
|
427 |
-
your receipt of the notice.
|
428 |
-
|
429 |
-
Termination of your rights under this section does not terminate the
|
430 |
-
licenses of parties who have received copies or rights from you under
|
431 |
-
this License. If your rights have been terminated and not permanently
|
432 |
-
reinstated, you do not qualify to receive new licenses for the same
|
433 |
-
material under section 10.
|
434 |
-
|
435 |
-
9. Acceptance Not Required for Having Copies.
|
436 |
-
|
437 |
-
You are not required to accept this License in order to receive or
|
438 |
-
run a copy of the Program. Ancillary propagation of a covered work
|
439 |
-
occurring solely as a consequence of using peer-to-peer transmission
|
440 |
-
to receive a copy likewise does not require acceptance. However,
|
441 |
-
nothing other than this License grants you permission to propagate or
|
442 |
-
modify any covered work. These actions infringe copyright if you do
|
443 |
-
not accept this License. Therefore, by modifying or propagating a
|
444 |
-
covered work, you indicate your acceptance of this License to do so.
|
445 |
-
|
446 |
-
10. Automatic Licensing of Downstream Recipients.
|
447 |
-
|
448 |
-
Each time you convey a covered work, the recipient automatically
|
449 |
-
receives a license from the original licensors, to run, modify and
|
450 |
-
propagate that work, subject to this License. You are not responsible
|
451 |
-
for enforcing compliance by third parties with this License.
|
452 |
-
|
453 |
-
An "entity transaction" is a transaction transferring control of an
|
454 |
-
organization, or substantially all assets of one, or subdividing an
|
455 |
-
organization, or merging organizations. If propagation of a covered
|
456 |
-
work results from an entity transaction, each party to that
|
457 |
-
transaction who receives a copy of the work also receives whatever
|
458 |
-
licenses to the work the party's predecessor in interest had or could
|
459 |
-
give under the previous paragraph, plus a right to possession of the
|
460 |
-
Corresponding Source of the work from the predecessor in interest, if
|
461 |
-
the predecessor has it or can get it with reasonable efforts.
|
462 |
-
|
463 |
-
You may not impose any further restrictions on the exercise of the
|
464 |
-
rights granted or affirmed under this License. For example, you may
|
465 |
-
not impose a license fee, royalty, or other charge for exercise of
|
466 |
-
rights granted under this License, and you may not initiate litigation
|
467 |
-
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
468 |
-
any patent claim is infringed by making, using, selling, offering for
|
469 |
-
sale, or importing the Program or any portion of it.
|
470 |
-
|
471 |
-
11. Patents.
|
472 |
-
|
473 |
-
A "contributor" is a copyright holder who authorizes use under this
|
474 |
-
License of the Program or a work on which the Program is based. The
|
475 |
-
work thus licensed is called the contributor's "contributor version".
|
476 |
-
|
477 |
-
A contributor's "essential patent claims" are all patent claims
|
478 |
-
owned or controlled by the contributor, whether already acquired or
|
479 |
-
hereafter acquired, that would be infringed by some manner, permitted
|
480 |
-
by this License, of making, using, or selling its contributor version,
|
481 |
-
but do not include claims that would be infringed only as a
|
482 |
-
consequence of further modification of the contributor version. For
|
483 |
-
purposes of this definition, "control" includes the right to grant
|
484 |
-
patent sublicenses in a manner consistent with the requirements of
|
485 |
-
this License.
|
486 |
-
|
487 |
-
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
488 |
-
patent license under the contributor's essential patent claims, to
|
489 |
-
make, use, sell, offer for sale, import and otherwise run, modify and
|
490 |
-
propagate the contents of its contributor version.
|
491 |
-
|
492 |
-
In the following three paragraphs, a "patent license" is any express
|
493 |
-
agreement or commitment, however denominated, not to enforce a patent
|
494 |
-
(such as an express permission to practice a patent or covenant not to
|
495 |
-
sue for patent infringement). To "grant" such a patent license to a
|
496 |
-
party means to make such an agreement or commitment not to enforce a
|
497 |
-
patent against the party.
|
498 |
-
|
499 |
-
If you convey a covered work, knowingly relying on a patent license,
|
500 |
-
and the Corresponding Source of the work is not available for anyone
|
501 |
-
to copy, free of charge and under the terms of this License, through a
|
502 |
-
publicly available network server or other readily accessible means,
|
503 |
-
then you must either (1) cause the Corresponding Source to be so
|
504 |
-
available, or (2) arrange to deprive yourself of the benefit of the
|
505 |
-
patent license for this particular work, or (3) arrange, in a manner
|
506 |
-
consistent with the requirements of this License, to extend the patent
|
507 |
-
license to downstream recipients. "Knowingly relying" means you have
|
508 |
-
actual knowledge that, but for the patent license, your conveying the
|
509 |
-
covered work in a country, or your recipient's use of the covered work
|
510 |
-
in a country, would infringe one or more identifiable patents in that
|
511 |
-
country that you have reason to believe are valid.
|
512 |
-
|
513 |
-
If, pursuant to or in connection with a single transaction or
|
514 |
-
arrangement, you convey, or propagate by procuring conveyance of, a
|
515 |
-
covered work, and grant a patent license to some of the parties
|
516 |
-
receiving the covered work authorizing them to use, propagate, modify
|
517 |
-
or convey a specific copy of the covered work, then the patent license
|
518 |
-
you grant is automatically extended to all recipients of the covered
|
519 |
-
work and works based on it.
|
520 |
-
|
521 |
-
A patent license is "discriminatory" if it does not include within
|
522 |
-
the scope of its coverage, prohibits the exercise of, or is
|
523 |
-
conditioned on the non-exercise of one or more of the rights that are
|
524 |
-
specifically granted under this License. You may not convey a covered
|
525 |
-
work if you are a party to an arrangement with a third party that is
|
526 |
-
in the business of distributing software, under which you make payment
|
527 |
-
to the third party based on the extent of your activity of conveying
|
528 |
-
the work, and under which the third party grants, to any of the
|
529 |
-
parties who would receive the covered work from you, a discriminatory
|
530 |
-
patent license (a) in connection with copies of the covered work
|
531 |
-
conveyed by you (or copies made from those copies), or (b) primarily
|
532 |
-
for and in connection with specific products or compilations that
|
533 |
-
contain the covered work, unless you entered into that arrangement,
|
534 |
-
or that patent license was granted, prior to 28 March 2007.
|
535 |
-
|
536 |
-
Nothing in this License shall be construed as excluding or limiting
|
537 |
-
any implied license or other defenses to infringement that may
|
538 |
-
otherwise be available to you under applicable patent law.
|
539 |
-
|
540 |
-
12. No Surrender of Others' Freedom.
|
541 |
-
|
542 |
-
If conditions are imposed on you (whether by court order, agreement or
|
543 |
-
otherwise) that contradict the conditions of this License, they do not
|
544 |
-
excuse you from the conditions of this License. If you cannot convey a
|
545 |
-
covered work so as to satisfy simultaneously your obligations under this
|
546 |
-
License and any other pertinent obligations, then as a consequence you may
|
547 |
-
not convey it at all. For example, if you agree to terms that obligate you
|
548 |
-
to collect a royalty for further conveying from those to whom you convey
|
549 |
-
the Program, the only way you could satisfy both those terms and this
|
550 |
-
License would be to refrain entirely from conveying the Program.
|
551 |
-
|
552 |
-
13. Use with the GNU Affero General Public License.
|
553 |
-
|
554 |
-
Notwithstanding any other provision of this License, you have
|
555 |
-
permission to link or combine any covered work with a work licensed
|
556 |
-
under version 3 of the GNU Affero General Public License into a single
|
557 |
-
combined work, and to convey the resulting work. The terms of this
|
558 |
-
License will continue to apply to the part which is the covered work,
|
559 |
-
but the special requirements of the GNU Affero General Public License,
|
560 |
-
section 13, concerning interaction through a network will apply to the
|
561 |
-
combination as such.
|
562 |
-
|
563 |
-
14. Revised Versions of this License.
|
564 |
-
|
565 |
-
The Free Software Foundation may publish revised and/or new versions of
|
566 |
-
the GNU General Public License from time to time. Such new versions will
|
567 |
-
be similar in spirit to the present version, but may differ in detail to
|
568 |
-
address new problems or concerns.
|
569 |
-
|
570 |
-
Each version is given a distinguishing version number. If the
|
571 |
-
Program specifies that a certain numbered version of the GNU General
|
572 |
-
Public License "or any later version" applies to it, you have the
|
573 |
-
option of following the terms and conditions either of that numbered
|
574 |
-
version or of any later version published by the Free Software
|
575 |
-
Foundation. If the Program does not specify a version number of the
|
576 |
-
GNU General Public License, you may choose any version ever published
|
577 |
-
by the Free Software Foundation.
|
578 |
-
|
579 |
-
If the Program specifies that a proxy can decide which future
|
580 |
-
versions of the GNU General Public License can be used, that proxy's
|
581 |
-
public statement of acceptance of a version permanently authorizes you
|
582 |
-
to choose that version for the Program.
|
583 |
-
|
584 |
-
Later license versions may give you additional or different
|
585 |
-
permissions. However, no additional obligations are imposed on any
|
586 |
-
author or copyright holder as a result of your choosing to follow a
|
587 |
-
later version.
|
588 |
-
|
589 |
-
15. Disclaimer of Warranty.
|
590 |
-
|
591 |
-
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
592 |
-
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
593 |
-
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
594 |
-
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
595 |
-
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
596 |
-
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
597 |
-
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
598 |
-
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
599 |
-
|
600 |
-
16. Limitation of Liability.
|
601 |
-
|
602 |
-
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
603 |
-
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
604 |
-
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
605 |
-
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
606 |
-
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
607 |
-
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
608 |
-
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
609 |
-
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
610 |
-
SUCH DAMAGES.
|
611 |
-
|
612 |
-
17. Interpretation of Sections 15 and 16.
|
613 |
-
|
614 |
-
If the disclaimer of warranty and limitation of liability provided
|
615 |
-
above cannot be given local legal effect according to their terms,
|
616 |
-
reviewing courts shall apply local law that most closely approximates
|
617 |
-
an absolute waiver of all civil liability in connection with the
|
618 |
-
Program, unless a warranty or assumption of liability accompanies a
|
619 |
-
copy of the Program in return for a fee.
|
620 |
-
|
621 |
-
END OF TERMS AND CONDITIONS
|
622 |
-
|
623 |
-
How to Apply These Terms to Your New Programs
|
624 |
-
|
625 |
-
If you develop a new program, and you want it to be of the greatest
|
626 |
-
possible use to the public, the best way to achieve this is to make it
|
627 |
-
free software which everyone can redistribute and change under these terms.
|
628 |
-
|
629 |
-
To do so, attach the following notices to the program. It is safest
|
630 |
-
to attach them to the start of each source file to most effectively
|
631 |
-
state the exclusion of warranty; and each file should have at least
|
632 |
-
the "copyright" line and a pointer to where the full notice is found.
|
633 |
-
|
634 |
-
{one line to give the program's name and a brief idea of what it does.}
|
635 |
-
Copyright (C) {year} {name of author}
|
636 |
-
|
637 |
-
This program is free software: you can redistribute it and/or modify
|
638 |
-
it under the terms of the GNU General Public License as published by
|
639 |
-
the Free Software Foundation, either version 3 of the License, or
|
640 |
-
(at your option) any later version.
|
641 |
-
|
642 |
-
This program is distributed in the hope that it will be useful,
|
643 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
644 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
645 |
-
GNU General Public License for more details.
|
646 |
-
|
647 |
-
You should have received a copy of the GNU General Public License
|
648 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
649 |
-
|
650 |
-
Also add information on how to contact you by electronic and paper mail.
|
651 |
-
|
652 |
-
If the program does terminal interaction, make it output a short
|
653 |
-
notice like this when it starts in an interactive mode:
|
654 |
-
|
655 |
-
{project} Copyright (C) {year} {fullname}
|
656 |
-
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
657 |
-
This is free software, and you are welcome to redistribute it
|
658 |
-
under certain conditions; type `show c' for details.
|
659 |
-
|
660 |
-
The hypothetical commands `show w' and `show c' should show the appropriate
|
661 |
-
parts of the General Public License. Of course, your program's commands
|
662 |
-
might be different; for a GUI interface, you would use an "about box".
|
663 |
-
|
664 |
-
You should also get your employer (if you work as a programmer) or school,
|
665 |
-
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
666 |
-
For more information on this, and how to apply and follow the GNU GPL, see
|
667 |
-
<http://www.gnu.org/licenses/>.
|
668 |
-
|
669 |
-
The GNU General Public License does not permit incorporating your program
|
670 |
-
into proprietary programs. If your program is a subroutine library, you
|
671 |
-
may consider it more useful to permit linking proprietary applications with
|
672 |
-
the library. If this is what you want to do, use the GNU Lesser General
|
673 |
-
Public License instead of this License. But first, please read
|
674 |
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 3, 29 June 2007
|
3 |
+
|
4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
6 |
+
of this license document, but changing it is not allowed.
|
7 |
+
|
8 |
+
Preamble
|
9 |
+
|
10 |
+
The GNU General Public License is a free, copyleft license for
|
11 |
+
software and other kinds of works.
|
12 |
+
|
13 |
+
The licenses for most software and other practical works are designed
|
14 |
+
to take away your freedom to share and change the works. By contrast,
|
15 |
+
the GNU General Public License is intended to guarantee your freedom to
|
16 |
+
share and change all versions of a program--to make sure it remains free
|
17 |
+
software for all its users. We, the Free Software Foundation, use the
|
18 |
+
GNU General Public License for most of our software; it applies also to
|
19 |
+
any other work released this way by its authors. You can apply it to
|
20 |
+
your programs, too.
|
21 |
+
|
22 |
+
When we speak of free software, we are referring to freedom, not
|
23 |
+
price. Our General Public Licenses are designed to make sure that you
|
24 |
+
have the freedom to distribute copies of free software (and charge for
|
25 |
+
them if you wish), that you receive source code or can get it if you
|
26 |
+
want it, that you can change the software or use pieces of it in new
|
27 |
+
free programs, and that you know you can do these things.
|
28 |
+
|
29 |
+
To protect your rights, we need to prevent others from denying you
|
30 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
31 |
+
certain responsibilities if you distribute copies of the software, or if
|
32 |
+
you modify it: responsibilities to respect the freedom of others.
|
33 |
+
|
34 |
+
For example, if you distribute copies of such a program, whether
|
35 |
+
gratis or for a fee, you must pass on to the recipients the same
|
36 |
+
freedoms that you received. You must make sure that they, too, receive
|
37 |
+
or can get the source code. And you must show them these terms so they
|
38 |
+
know their rights.
|
39 |
+
|
40 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
41 |
+
(1) assert copyright on the software, and (2) offer you this License
|
42 |
+
giving you legal permission to copy, distribute and/or modify it.
|
43 |
+
|
44 |
+
For the developers' and authors' protection, the GPL clearly explains
|
45 |
+
that there is no warranty for this free software. For both users' and
|
46 |
+
authors' sake, the GPL requires that modified versions be marked as
|
47 |
+
changed, so that their problems will not be attributed erroneously to
|
48 |
+
authors of previous versions.
|
49 |
+
|
50 |
+
Some devices are designed to deny users access to install or run
|
51 |
+
modified versions of the software inside them, although the manufacturer
|
52 |
+
can do so. This is fundamentally incompatible with the aim of
|
53 |
+
protecting users' freedom to change the software. The systematic
|
54 |
+
pattern of such abuse occurs in the area of products for individuals to
|
55 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
56 |
+
have designed this version of the GPL to prohibit the practice for those
|
57 |
+
products. If such problems arise substantially in other domains, we
|
58 |
+
stand ready to extend this provision to those domains in future versions
|
59 |
+
of the GPL, as needed to protect the freedom of users.
|
60 |
+
|
61 |
+
Finally, every program is threatened constantly by software patents.
|
62 |
+
States should not allow patents to restrict development and use of
|
63 |
+
software on general-purpose computers, but in those that do, we wish to
|
64 |
+
avoid the special danger that patents applied to a free program could
|
65 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
66 |
+
patents cannot be used to render the program non-free.
|
67 |
+
|
68 |
+
The precise terms and conditions for copying, distribution and
|
69 |
+
modification follow.
|
70 |
+
|
71 |
+
TERMS AND CONDITIONS
|
72 |
+
|
73 |
+
0. Definitions.
|
74 |
+
|
75 |
+
"This License" refers to version 3 of the GNU General Public License.
|
76 |
+
|
77 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
78 |
+
works, such as semiconductor masks.
|
79 |
+
|
80 |
+
"The Program" refers to any copyrightable work licensed under this
|
81 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
82 |
+
"recipients" may be individuals or organizations.
|
83 |
+
|
84 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
85 |
+
in a fashion requiring copyright permission, other than the making of an
|
86 |
+
exact copy. The resulting work is called a "modified version" of the
|
87 |
+
earlier work or a work "based on" the earlier work.
|
88 |
+
|
89 |
+
A "covered work" means either the unmodified Program or a work based
|
90 |
+
on the Program.
|
91 |
+
|
92 |
+
To "propagate" a work means to do anything with it that, without
|
93 |
+
permission, would make you directly or secondarily liable for
|
94 |
+
infringement under applicable copyright law, except executing it on a
|
95 |
+
computer or modifying a private copy. Propagation includes copying,
|
96 |
+
distribution (with or without modification), making available to the
|
97 |
+
public, and in some countries other activities as well.
|
98 |
+
|
99 |
+
To "convey" a work means any kind of propagation that enables other
|
100 |
+
parties to make or receive copies. Mere interaction with a user through
|
101 |
+
a computer network, with no transfer of a copy, is not conveying.
|
102 |
+
|
103 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
104 |
+
to the extent that it includes a convenient and prominently visible
|
105 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
106 |
+
tells the user that there is no warranty for the work (except to the
|
107 |
+
extent that warranties are provided), that licensees may convey the
|
108 |
+
work under this License, and how to view a copy of this License. If
|
109 |
+
the interface presents a list of user commands or options, such as a
|
110 |
+
menu, a prominent item in the list meets this criterion.
|
111 |
+
|
112 |
+
1. Source Code.
|
113 |
+
|
114 |
+
The "source code" for a work means the preferred form of the work
|
115 |
+
for making modifications to it. "Object code" means any non-source
|
116 |
+
form of a work.
|
117 |
+
|
118 |
+
A "Standard Interface" means an interface that either is an official
|
119 |
+
standard defined by a recognized standards body, or, in the case of
|
120 |
+
interfaces specified for a particular programming language, one that
|
121 |
+
is widely used among developers working in that language.
|
122 |
+
|
123 |
+
The "System Libraries" of an executable work include anything, other
|
124 |
+
than the work as a whole, that (a) is included in the normal form of
|
125 |
+
packaging a Major Component, but which is not part of that Major
|
126 |
+
Component, and (b) serves only to enable use of the work with that
|
127 |
+
Major Component, or to implement a Standard Interface for which an
|
128 |
+
implementation is available to the public in source code form. A
|
129 |
+
"Major Component", in this context, means a major essential component
|
130 |
+
(kernel, window system, and so on) of the specific operating system
|
131 |
+
(if any) on which the executable work runs, or a compiler used to
|
132 |
+
produce the work, or an object code interpreter used to run it.
|
133 |
+
|
134 |
+
The "Corresponding Source" for a work in object code form means all
|
135 |
+
the source code needed to generate, install, and (for an executable
|
136 |
+
work) run the object code and to modify the work, including scripts to
|
137 |
+
control those activities. However, it does not include the work's
|
138 |
+
System Libraries, or general-purpose tools or generally available free
|
139 |
+
programs which are used unmodified in performing those activities but
|
140 |
+
which are not part of the work. For example, Corresponding Source
|
141 |
+
includes interface definition files associated with source files for
|
142 |
+
the work, and the source code for shared libraries and dynamically
|
143 |
+
linked subprograms that the work is specifically designed to require,
|
144 |
+
such as by intimate data communication or control flow between those
|
145 |
+
subprograms and other parts of the work.
|
146 |
+
|
147 |
+
The Corresponding Source need not include anything that users
|
148 |
+
can regenerate automatically from other parts of the Corresponding
|
149 |
+
Source.
|
150 |
+
|
151 |
+
The Corresponding Source for a work in source code form is that
|
152 |
+
same work.
|
153 |
+
|
154 |
+
2. Basic Permissions.
|
155 |
+
|
156 |
+
All rights granted under this License are granted for the term of
|
157 |
+
copyright on the Program, and are irrevocable provided the stated
|
158 |
+
conditions are met. This License explicitly affirms your unlimited
|
159 |
+
permission to run the unmodified Program. The output from running a
|
160 |
+
covered work is covered by this License only if the output, given its
|
161 |
+
content, constitutes a covered work. This License acknowledges your
|
162 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
163 |
+
|
164 |
+
You may make, run and propagate covered works that you do not
|
165 |
+
convey, without conditions so long as your license otherwise remains
|
166 |
+
in force. You may convey covered works to others for the sole purpose
|
167 |
+
of having them make modifications exclusively for you, or provide you
|
168 |
+
with facilities for running those works, provided that you comply with
|
169 |
+
the terms of this License in conveying all material for which you do
|
170 |
+
not control copyright. Those thus making or running the covered works
|
171 |
+
for you must do so exclusively on your behalf, under your direction
|
172 |
+
and control, on terms that prohibit them from making any copies of
|
173 |
+
your copyrighted material outside their relationship with you.
|
174 |
+
|
175 |
+
Conveying under any other circumstances is permitted solely under
|
176 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
177 |
+
makes it unnecessary.
|
178 |
+
|
179 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
180 |
+
|
181 |
+
No covered work shall be deemed part of an effective technological
|
182 |
+
measure under any applicable law fulfilling obligations under article
|
183 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
184 |
+
similar laws prohibiting or restricting circumvention of such
|
185 |
+
measures.
|
186 |
+
|
187 |
+
When you convey a covered work, you waive any legal power to forbid
|
188 |
+
circumvention of technological measures to the extent such circumvention
|
189 |
+
is effected by exercising rights under this License with respect to
|
190 |
+
the covered work, and you disclaim any intention to limit operation or
|
191 |
+
modification of the work as a means of enforcing, against the work's
|
192 |
+
users, your or third parties' legal rights to forbid circumvention of
|
193 |
+
technological measures.
|
194 |
+
|
195 |
+
4. Conveying Verbatim Copies.
|
196 |
+
|
197 |
+
You may convey verbatim copies of the Program's source code as you
|
198 |
+
receive it, in any medium, provided that you conspicuously and
|
199 |
+
appropriately publish on each copy an appropriate copyright notice;
|
200 |
+
keep intact all notices stating that this License and any
|
201 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
202 |
+
keep intact all notices of the absence of any warranty; and give all
|
203 |
+
recipients a copy of this License along with the Program.
|
204 |
+
|
205 |
+
You may charge any price or no price for each copy that you convey,
|
206 |
+
and you may offer support or warranty protection for a fee.
|
207 |
+
|
208 |
+
5. Conveying Modified Source Versions.
|
209 |
+
|
210 |
+
You may convey a work based on the Program, or the modifications to
|
211 |
+
produce it from the Program, in the form of source code under the
|
212 |
+
terms of section 4, provided that you also meet all of these conditions:
|
213 |
+
|
214 |
+
a) The work must carry prominent notices stating that you modified
|
215 |
+
it, and giving a relevant date.
|
216 |
+
|
217 |
+
b) The work must carry prominent notices stating that it is
|
218 |
+
released under this License and any conditions added under section
|
219 |
+
7. This requirement modifies the requirement in section 4 to
|
220 |
+
"keep intact all notices".
|
221 |
+
|
222 |
+
c) You must license the entire work, as a whole, under this
|
223 |
+
License to anyone who comes into possession of a copy. This
|
224 |
+
License will therefore apply, along with any applicable section 7
|
225 |
+
additional terms, to the whole of the work, and all its parts,
|
226 |
+
regardless of how they are packaged. This License gives no
|
227 |
+
permission to license the work in any other way, but it does not
|
228 |
+
invalidate such permission if you have separately received it.
|
229 |
+
|
230 |
+
d) If the work has interactive user interfaces, each must display
|
231 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
232 |
+
interfaces that do not display Appropriate Legal Notices, your
|
233 |
+
work need not make them do so.
|
234 |
+
|
235 |
+
A compilation of a covered work with other separate and independent
|
236 |
+
works, which are not by their nature extensions of the covered work,
|
237 |
+
and which are not combined with it such as to form a larger program,
|
238 |
+
in or on a volume of a storage or distribution medium, is called an
|
239 |
+
"aggregate" if the compilation and its resulting copyright are not
|
240 |
+
used to limit the access or legal rights of the compilation's users
|
241 |
+
beyond what the individual works permit. Inclusion of a covered work
|
242 |
+
in an aggregate does not cause this License to apply to the other
|
243 |
+
parts of the aggregate.
|
244 |
+
|
245 |
+
6. Conveying Non-Source Forms.
|
246 |
+
|
247 |
+
You may convey a covered work in object code form under the terms
|
248 |
+
of sections 4 and 5, provided that you also convey the
|
249 |
+
machine-readable Corresponding Source under the terms of this License,
|
250 |
+
in one of these ways:
|
251 |
+
|
252 |
+
a) Convey the object code in, or embodied in, a physical product
|
253 |
+
(including a physical distribution medium), accompanied by the
|
254 |
+
Corresponding Source fixed on a durable physical medium
|
255 |
+
customarily used for software interchange.
|
256 |
+
|
257 |
+
b) Convey the object code in, or embodied in, a physical product
|
258 |
+
(including a physical distribution medium), accompanied by a
|
259 |
+
written offer, valid for at least three years and valid for as
|
260 |
+
long as you offer spare parts or customer support for that product
|
261 |
+
model, to give anyone who possesses the object code either (1) a
|
262 |
+
copy of the Corresponding Source for all the software in the
|
263 |
+
product that is covered by this License, on a durable physical
|
264 |
+
medium customarily used for software interchange, for a price no
|
265 |
+
more than your reasonable cost of physically performing this
|
266 |
+
conveying of source, or (2) access to copy the
|
267 |
+
Corresponding Source from a network server at no charge.
|
268 |
+
|
269 |
+
c) Convey individual copies of the object code with a copy of the
|
270 |
+
written offer to provide the Corresponding Source. This
|
271 |
+
alternative is allowed only occasionally and noncommercially, and
|
272 |
+
only if you received the object code with such an offer, in accord
|
273 |
+
with subsection 6b.
|
274 |
+
|
275 |
+
d) Convey the object code by offering access from a designated
|
276 |
+
place (gratis or for a charge), and offer equivalent access to the
|
277 |
+
Corresponding Source in the same way through the same place at no
|
278 |
+
further charge. You need not require recipients to copy the
|
279 |
+
Corresponding Source along with the object code. If the place to
|
280 |
+
copy the object code is a network server, the Corresponding Source
|
281 |
+
may be on a different server (operated by you or a third party)
|
282 |
+
that supports equivalent copying facilities, provided you maintain
|
283 |
+
clear directions next to the object code saying where to find the
|
284 |
+
Corresponding Source. Regardless of what server hosts the
|
285 |
+
Corresponding Source, you remain obligated to ensure that it is
|
286 |
+
available for as long as needed to satisfy these requirements.
|
287 |
+
|
288 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
289 |
+
you inform other peers where the object code and Corresponding
|
290 |
+
Source of the work are being offered to the general public at no
|
291 |
+
charge under subsection 6d.
|
292 |
+
|
293 |
+
A separable portion of the object code, whose source code is excluded
|
294 |
+
from the Corresponding Source as a System Library, need not be
|
295 |
+
included in conveying the object code work.
|
296 |
+
|
297 |
+
A "User Product" is either (1) a "consumer product", which means any
|
298 |
+
tangible personal property which is normally used for personal, family,
|
299 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
300 |
+
into a dwelling. In determining whether a product is a consumer product,
|
301 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
302 |
+
product received by a particular user, "normally used" refers to a
|
303 |
+
typical or common use of that class of product, regardless of the status
|
304 |
+
of the particular user or of the way in which the particular user
|
305 |
+
actually uses, or expects or is expected to use, the product. A product
|
306 |
+
is a consumer product regardless of whether the product has substantial
|
307 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
308 |
+
the only significant mode of use of the product.
|
309 |
+
|
310 |
+
"Installation Information" for a User Product means any methods,
|
311 |
+
procedures, authorization keys, or other information required to install
|
312 |
+
and execute modified versions of a covered work in that User Product from
|
313 |
+
a modified version of its Corresponding Source. The information must
|
314 |
+
suffice to ensure that the continued functioning of the modified object
|
315 |
+
code is in no case prevented or interfered with solely because
|
316 |
+
modification has been made.
|
317 |
+
|
318 |
+
If you convey an object code work under this section in, or with, or
|
319 |
+
specifically for use in, a User Product, and the conveying occurs as
|
320 |
+
part of a transaction in which the right of possession and use of the
|
321 |
+
User Product is transferred to the recipient in perpetuity or for a
|
322 |
+
fixed term (regardless of how the transaction is characterized), the
|
323 |
+
Corresponding Source conveyed under this section must be accompanied
|
324 |
+
by the Installation Information. But this requirement does not apply
|
325 |
+
if neither you nor any third party retains the ability to install
|
326 |
+
modified object code on the User Product (for example, the work has
|
327 |
+
been installed in ROM).
|
328 |
+
|
329 |
+
The requirement to provide Installation Information does not include a
|
330 |
+
requirement to continue to provide support service, warranty, or updates
|
331 |
+
for a work that has been modified or installed by the recipient, or for
|
332 |
+
the User Product in which it has been modified or installed. Access to a
|
333 |
+
network may be denied when the modification itself materially and
|
334 |
+
adversely affects the operation of the network or violates the rules and
|
335 |
+
protocols for communication across the network.
|
336 |
+
|
337 |
+
Corresponding Source conveyed, and Installation Information provided,
|
338 |
+
in accord with this section must be in a format that is publicly
|
339 |
+
documented (and with an implementation available to the public in
|
340 |
+
source code form), and must require no special password or key for
|
341 |
+
unpacking, reading or copying.
|
342 |
+
|
343 |
+
7. Additional Terms.
|
344 |
+
|
345 |
+
"Additional permissions" are terms that supplement the terms of this
|
346 |
+
License by making exceptions from one or more of its conditions.
|
347 |
+
Additional permissions that are applicable to the entire Program shall
|
348 |
+
be treated as though they were included in this License, to the extent
|
349 |
+
that they are valid under applicable law. If additional permissions
|
350 |
+
apply only to part of the Program, that part may be used separately
|
351 |
+
under those permissions, but the entire Program remains governed by
|
352 |
+
this License without regard to the additional permissions.
|
353 |
+
|
354 |
+
When you convey a copy of a covered work, you may at your option
|
355 |
+
remove any additional permissions from that copy, or from any part of
|
356 |
+
it. (Additional permissions may be written to require their own
|
357 |
+
removal in certain cases when you modify the work.) You may place
|
358 |
+
additional permissions on material, added by you to a covered work,
|
359 |
+
for which you have or can give appropriate copyright permission.
|
360 |
+
|
361 |
+
Notwithstanding any other provision of this License, for material you
|
362 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
363 |
+
that material) supplement the terms of this License with terms:
|
364 |
+
|
365 |
+
a) Disclaiming warranty or limiting liability differently from the
|
366 |
+
terms of sections 15 and 16 of this License; or
|
367 |
+
|
368 |
+
b) Requiring preservation of specified reasonable legal notices or
|
369 |
+
author attributions in that material or in the Appropriate Legal
|
370 |
+
Notices displayed by works containing it; or
|
371 |
+
|
372 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
373 |
+
requiring that modified versions of such material be marked in
|
374 |
+
reasonable ways as different from the original version; or
|
375 |
+
|
376 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
377 |
+
authors of the material; or
|
378 |
+
|
379 |
+
e) Declining to grant rights under trademark law for use of some
|
380 |
+
trade names, trademarks, or service marks; or
|
381 |
+
|
382 |
+
f) Requiring indemnification of licensors and authors of that
|
383 |
+
material by anyone who conveys the material (or modified versions of
|
384 |
+
it) with contractual assumptions of liability to the recipient, for
|
385 |
+
any liability that these contractual assumptions directly impose on
|
386 |
+
those licensors and authors.
|
387 |
+
|
388 |
+
All other non-permissive additional terms are considered "further
|
389 |
+
restrictions" within the meaning of section 10. If the Program as you
|
390 |
+
received it, or any part of it, contains a notice stating that it is
|
391 |
+
governed by this License along with a term that is a further
|
392 |
+
restriction, you may remove that term. If a license document contains
|
393 |
+
a further restriction but permits relicensing or conveying under this
|
394 |
+
License, you may add to a covered work material governed by the terms
|
395 |
+
of that license document, provided that the further restriction does
|
396 |
+
not survive such relicensing or conveying.
|
397 |
+
|
398 |
+
If you add terms to a covered work in accord with this section, you
|
399 |
+
must place, in the relevant source files, a statement of the
|
400 |
+
additional terms that apply to those files, or a notice indicating
|
401 |
+
where to find the applicable terms.
|
402 |
+
|
403 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
404 |
+
form of a separately written license, or stated as exceptions;
|
405 |
+
the above requirements apply either way.
|
406 |
+
|
407 |
+
8. Termination.
|
408 |
+
|
409 |
+
You may not propagate or modify a covered work except as expressly
|
410 |
+
provided under this License. Any attempt otherwise to propagate or
|
411 |
+
modify it is void, and will automatically terminate your rights under
|
412 |
+
this License (including any patent licenses granted under the third
|
413 |
+
paragraph of section 11).
|
414 |
+
|
415 |
+
However, if you cease all violation of this License, then your
|
416 |
+
license from a particular copyright holder is reinstated (a)
|
417 |
+
provisionally, unless and until the copyright holder explicitly and
|
418 |
+
finally terminates your license, and (b) permanently, if the copyright
|
419 |
+
holder fails to notify you of the violation by some reasonable means
|
420 |
+
prior to 60 days after the cessation.
|
421 |
+
|
422 |
+
Moreover, your license from a particular copyright holder is
|
423 |
+
reinstated permanently if the copyright holder notifies you of the
|
424 |
+
violation by some reasonable means, this is the first time you have
|
425 |
+
received notice of violation of this License (for any work) from that
|
426 |
+
copyright holder, and you cure the violation prior to 30 days after
|
427 |
+
your receipt of the notice.
|
428 |
+
|
429 |
+
Termination of your rights under this section does not terminate the
|
430 |
+
licenses of parties who have received copies or rights from you under
|
431 |
+
this License. If your rights have been terminated and not permanently
|
432 |
+
reinstated, you do not qualify to receive new licenses for the same
|
433 |
+
material under section 10.
|
434 |
+
|
435 |
+
9. Acceptance Not Required for Having Copies.
|
436 |
+
|
437 |
+
You are not required to accept this License in order to receive or
|
438 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
439 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
440 |
+
to receive a copy likewise does not require acceptance. However,
|
441 |
+
nothing other than this License grants you permission to propagate or
|
442 |
+
modify any covered work. These actions infringe copyright if you do
|
443 |
+
not accept this License. Therefore, by modifying or propagating a
|
444 |
+
covered work, you indicate your acceptance of this License to do so.
|
445 |
+
|
446 |
+
10. Automatic Licensing of Downstream Recipients.
|
447 |
+
|
448 |
+
Each time you convey a covered work, the recipient automatically
|
449 |
+
receives a license from the original licensors, to run, modify and
|
450 |
+
propagate that work, subject to this License. You are not responsible
|
451 |
+
for enforcing compliance by third parties with this License.
|
452 |
+
|
453 |
+
An "entity transaction" is a transaction transferring control of an
|
454 |
+
organization, or substantially all assets of one, or subdividing an
|
455 |
+
organization, or merging organizations. If propagation of a covered
|
456 |
+
work results from an entity transaction, each party to that
|
457 |
+
transaction who receives a copy of the work also receives whatever
|
458 |
+
licenses to the work the party's predecessor in interest had or could
|
459 |
+
give under the previous paragraph, plus a right to possession of the
|
460 |
+
Corresponding Source of the work from the predecessor in interest, if
|
461 |
+
the predecessor has it or can get it with reasonable efforts.
|
462 |
+
|
463 |
+
You may not impose any further restrictions on the exercise of the
|
464 |
+
rights granted or affirmed under this License. For example, you may
|
465 |
+
not impose a license fee, royalty, or other charge for exercise of
|
466 |
+
rights granted under this License, and you may not initiate litigation
|
467 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
468 |
+
any patent claim is infringed by making, using, selling, offering for
|
469 |
+
sale, or importing the Program or any portion of it.
|
470 |
+
|
471 |
+
11. Patents.
|
472 |
+
|
473 |
+
A "contributor" is a copyright holder who authorizes use under this
|
474 |
+
License of the Program or a work on which the Program is based. The
|
475 |
+
work thus licensed is called the contributor's "contributor version".
|
476 |
+
|
477 |
+
A contributor's "essential patent claims" are all patent claims
|
478 |
+
owned or controlled by the contributor, whether already acquired or
|
479 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
480 |
+
by this License, of making, using, or selling its contributor version,
|
481 |
+
but do not include claims that would be infringed only as a
|
482 |
+
consequence of further modification of the contributor version. For
|
483 |
+
purposes of this definition, "control" includes the right to grant
|
484 |
+
patent sublicenses in a manner consistent with the requirements of
|
485 |
+
this License.
|
486 |
+
|
487 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
488 |
+
patent license under the contributor's essential patent claims, to
|
489 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
490 |
+
propagate the contents of its contributor version.
|
491 |
+
|
492 |
+
In the following three paragraphs, a "patent license" is any express
|
493 |
+
agreement or commitment, however denominated, not to enforce a patent
|
494 |
+
(such as an express permission to practice a patent or covenant not to
|
495 |
+
sue for patent infringement). To "grant" such a patent license to a
|
496 |
+
party means to make such an agreement or commitment not to enforce a
|
497 |
+
patent against the party.
|
498 |
+
|
499 |
+
If you convey a covered work, knowingly relying on a patent license,
|
500 |
+
and the Corresponding Source of the work is not available for anyone
|
501 |
+
to copy, free of charge and under the terms of this License, through a
|
502 |
+
publicly available network server or other readily accessible means,
|
503 |
+
then you must either (1) cause the Corresponding Source to be so
|
504 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
505 |
+
patent license for this particular work, or (3) arrange, in a manner
|
506 |
+
consistent with the requirements of this License, to extend the patent
|
507 |
+
license to downstream recipients. "Knowingly relying" means you have
|
508 |
+
actual knowledge that, but for the patent license, your conveying the
|
509 |
+
covered work in a country, or your recipient's use of the covered work
|
510 |
+
in a country, would infringe one or more identifiable patents in that
|
511 |
+
country that you have reason to believe are valid.
|
512 |
+
|
513 |
+
If, pursuant to or in connection with a single transaction or
|
514 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
515 |
+
covered work, and grant a patent license to some of the parties
|
516 |
+
receiving the covered work authorizing them to use, propagate, modify
|
517 |
+
or convey a specific copy of the covered work, then the patent license
|
518 |
+
you grant is automatically extended to all recipients of the covered
|
519 |
+
work and works based on it.
|
520 |
+
|
521 |
+
A patent license is "discriminatory" if it does not include within
|
522 |
+
the scope of its coverage, prohibits the exercise of, or is
|
523 |
+
conditioned on the non-exercise of one or more of the rights that are
|
524 |
+
specifically granted under this License. You may not convey a covered
|
525 |
+
work if you are a party to an arrangement with a third party that is
|
526 |
+
in the business of distributing software, under which you make payment
|
527 |
+
to the third party based on the extent of your activity of conveying
|
528 |
+
the work, and under which the third party grants, to any of the
|
529 |
+
parties who would receive the covered work from you, a discriminatory
|
530 |
+
patent license (a) in connection with copies of the covered work
|
531 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
532 |
+
for and in connection with specific products or compilations that
|
533 |
+
contain the covered work, unless you entered into that arrangement,
|
534 |
+
or that patent license was granted, prior to 28 March 2007.
|
535 |
+
|
536 |
+
Nothing in this License shall be construed as excluding or limiting
|
537 |
+
any implied license or other defenses to infringement that may
|
538 |
+
otherwise be available to you under applicable patent law.
|
539 |
+
|
540 |
+
12. No Surrender of Others' Freedom.
|
541 |
+
|
542 |
+
If conditions are imposed on you (whether by court order, agreement or
|
543 |
+
otherwise) that contradict the conditions of this License, they do not
|
544 |
+
excuse you from the conditions of this License. If you cannot convey a
|
545 |
+
covered work so as to satisfy simultaneously your obligations under this
|
546 |
+
License and any other pertinent obligations, then as a consequence you may
|
547 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
548 |
+
to collect a royalty for further conveying from those to whom you convey
|
549 |
+
the Program, the only way you could satisfy both those terms and this
|
550 |
+
License would be to refrain entirely from conveying the Program.
|
551 |
+
|
552 |
+
13. Use with the GNU Affero General Public License.
|
553 |
+
|
554 |
+
Notwithstanding any other provision of this License, you have
|
555 |
+
permission to link or combine any covered work with a work licensed
|
556 |
+
under version 3 of the GNU Affero General Public License into a single
|
557 |
+
combined work, and to convey the resulting work. The terms of this
|
558 |
+
License will continue to apply to the part which is the covered work,
|
559 |
+
but the special requirements of the GNU Affero General Public License,
|
560 |
+
section 13, concerning interaction through a network will apply to the
|
561 |
+
combination as such.
|
562 |
+
|
563 |
+
14. Revised Versions of this License.
|
564 |
+
|
565 |
+
The Free Software Foundation may publish revised and/or new versions of
|
566 |
+
the GNU General Public License from time to time. Such new versions will
|
567 |
+
be similar in spirit to the present version, but may differ in detail to
|
568 |
+
address new problems or concerns.
|
569 |
+
|
570 |
+
Each version is given a distinguishing version number. If the
|
571 |
+
Program specifies that a certain numbered version of the GNU General
|
572 |
+
Public License "or any later version" applies to it, you have the
|
573 |
+
option of following the terms and conditions either of that numbered
|
574 |
+
version or of any later version published by the Free Software
|
575 |
+
Foundation. If the Program does not specify a version number of the
|
576 |
+
GNU General Public License, you may choose any version ever published
|
577 |
+
by the Free Software Foundation.
|
578 |
+
|
579 |
+
If the Program specifies that a proxy can decide which future
|
580 |
+
versions of the GNU General Public License can be used, that proxy's
|
581 |
+
public statement of acceptance of a version permanently authorizes you
|
582 |
+
to choose that version for the Program.
|
583 |
+
|
584 |
+
Later license versions may give you additional or different
|
585 |
+
permissions. However, no additional obligations are imposed on any
|
586 |
+
author or copyright holder as a result of your choosing to follow a
|
587 |
+
later version.
|
588 |
+
|
589 |
+
15. Disclaimer of Warranty.
|
590 |
+
|
591 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
592 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
593 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
594 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
595 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
596 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
597 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
598 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
599 |
+
|
600 |
+
16. Limitation of Liability.
|
601 |
+
|
602 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
603 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
604 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
605 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
606 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
607 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
608 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
609 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
610 |
+
SUCH DAMAGES.
|
611 |
+
|
612 |
+
17. Interpretation of Sections 15 and 16.
|
613 |
+
|
614 |
+
If the disclaimer of warranty and limitation of liability provided
|
615 |
+
above cannot be given local legal effect according to their terms,
|
616 |
+
reviewing courts shall apply local law that most closely approximates
|
617 |
+
an absolute waiver of all civil liability in connection with the
|
618 |
+
Program, unless a warranty or assumption of liability accompanies a
|
619 |
+
copy of the Program in return for a fee.
|
620 |
+
|
621 |
+
END OF TERMS AND CONDITIONS
|
622 |
+
|
623 |
+
How to Apply These Terms to Your New Programs
|
624 |
+
|
625 |
+
If you develop a new program, and you want it to be of the greatest
|
626 |
+
possible use to the public, the best way to achieve this is to make it
|
627 |
+
free software which everyone can redistribute and change under these terms.
|
628 |
+
|
629 |
+
To do so, attach the following notices to the program. It is safest
|
630 |
+
to attach them to the start of each source file to most effectively
|
631 |
+
state the exclusion of warranty; and each file should have at least
|
632 |
+
the "copyright" line and a pointer to where the full notice is found.
|
633 |
+
|
634 |
+
{one line to give the program's name and a brief idea of what it does.}
|
635 |
+
Copyright (C) {year} {name of author}
|
636 |
+
|
637 |
+
This program is free software: you can redistribute it and/or modify
|
638 |
+
it under the terms of the GNU General Public License as published by
|
639 |
+
the Free Software Foundation, either version 3 of the License, or
|
640 |
+
(at your option) any later version.
|
641 |
+
|
642 |
+
This program is distributed in the hope that it will be useful,
|
643 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
644 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
645 |
+
GNU General Public License for more details.
|
646 |
+
|
647 |
+
You should have received a copy of the GNU General Public License
|
648 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
649 |
+
|
650 |
+
Also add information on how to contact you by electronic and paper mail.
|
651 |
+
|
652 |
+
If the program does terminal interaction, make it output a short
|
653 |
+
notice like this when it starts in an interactive mode:
|
654 |
+
|
655 |
+
{project} Copyright (C) {year} {fullname}
|
656 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
657 |
+
This is free software, and you are welcome to redistribute it
|
658 |
+
under certain conditions; type `show c' for details.
|
659 |
+
|
660 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
661 |
+
parts of the General Public License. Of course, your program's commands
|
662 |
+
might be different; for a GUI interface, you would use an "about box".
|
663 |
+
|
664 |
+
You should also get your employer (if you work as a programmer) or school,
|
665 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
666 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
667 |
+
<http://www.gnu.org/licenses/>.
|
668 |
+
|
669 |
+
The GNU General Public License does not permit incorporating your program
|
670 |
+
into proprietary programs. If your program is a subroutine library, you
|
671 |
+
may consider it more useful to permit linking proprietary applications with
|
672 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
673 |
+
Public License instead of this License. But first, please read
|
674 |
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
readme.txt
CHANGED
@@ -1,101 +1,101 @@
|
|
1 |
-
=== Plugin Name ===
|
2 |
-
Contributors: colorlibplugins, silkalns
|
3 |
-
Tags: woocommerce, widgets, plugin, demo, companion, home page, one page, parallax, social, portfolio, projects
|
4 |
-
Requires at least: 3.8
|
5 |
-
Tested up to: 6.0
|
6 |
-
Stable tag: 1.2.7
|
7 |
-
License: GPLv3 or later
|
8 |
-
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
-
|
10 |
-
Shapely Companion is a companion plugin for Shapely WordPress theme by Colorlib.com.
|
11 |
-
== Description ==
|
12 |
-
|
13 |
-
Shapely Companion is a companion for Shapely One Page WordPress theme by Colorlib.com. This plugin won't do anything for other free or premium WordPress themes and you need to download and install <a href="https://colorlib.com/wp/themes/shapely/" target="_blank">Shapely</a>. If you are having problems with Shapely theme or its companion plugin the fastest way to receive help is via our theme <a href="https://colorlib.com/wp/forums" target="_blank">support forum</a>.
|
14 |
-
|
15 |
-
This plugin will add necessary WordPress widgets and allow to import demo content which will help you to with website setup.
|
16 |
-
|
17 |
-
While Shapely is a great one page WordPress theme it might not be for everyone therefore you might want to check other free <a href="https://colorlib.com/wp/themes/" target="_blank">WordPress themes</a> that are created by Colorlib.
|
18 |
-
|
19 |
-
= Plugin Options =
|
20 |
-
|
21 |
-
* Creates required WordPress widgets to be used in theme
|
22 |
-
* Creates demo(dummy) content for widgets to make them easier to use and understand how they work
|
23 |
-
* Provides an option to import demo(dummy) content.
|
24 |
-
|
25 |
-
= About Colorlib =
|
26 |
-
|
27 |
-
Colorlib is the best and by far the most popular source for free and premium WordPress themes. Our themes has been downloaded over 1,5 million times and are used by developers, webmasters and regular users all over the world. We believe in open source and that's why we have made our themes free to use for private and commercial use.
|
28 |
-
|
29 |
-
= Further Reading =
|
30 |
-
|
31 |
-
If you are new to WordPress but are dedicated to <a href="https://colorlib.com/wp/how-to-make-a-website/" target="_blank" >make a website</a> on your own Colorlib is the right place to start. Usually the trickiest part is to choose the right hosting because all hosting providers are not equal. We have outlined the best <a href="https://colorlib.com/wp/wordpress-hosting/" target="_blank"> WordPress hosting</a> providers and we hope you'll find them useful.
|
32 |
-
|
33 |
-
|
34 |
-
== Installation ==
|
35 |
-
|
36 |
-
This section describes how to install the plugin and get it working.
|
37 |
-
|
38 |
-
1. Upload the whole contents of the folder `shapely-companion` to the `/wp-content/plugins/` directory
|
39 |
-
2. Activate the plugin through the 'Plugins' menu in WordPress dashboard
|
40 |
-
3. Enjoy using it :)
|
41 |
-
|
42 |
-
|
43 |
-
== Frequently Asked Questions ==
|
44 |
-
|
45 |
-
= What themes this plugin supports? =
|
46 |
-
|
47 |
-
Currently it works only with Shapely theme.
|
48 |
-
|
49 |
-
= Am I obligated to use it? =
|
50 |
-
|
51 |
-
You can still use Shapely theme without this plugin but you won't be able to import demo content and use theme specific widgets that you see on front page of theme demo.
|
52 |
-
|
53 |
-
== Changelog ==
|
54 |
-
|
55 |
-
= 1.2.7 =
|
56 |
-
* Fixed: Sanitizations & Security
|
57 |
-
|
58 |
-
= 1.2.6 =
|
59 |
-
* Fixed demo images
|
60 |
-
* compatibility with jQuery 3.0
|
61 |
-
|
62 |
-
= 1.2.5 =
|
63 |
-
|
64 |
-
* Improved compatibility with Kali Forms plugin.
|
65 |
-
|
66 |
-
= 1.2.4 =
|
67 |
-
|
68 |
-
* Implemented milestone https://github.com/puikinsh/shapely/milestone/8?closed=1
|
69 |
-
|
70 |
-
= 1.2.2 =
|
71 |
-
|
72 |
-
* Implemented milestone https://github.com/puikinsh/shapely/milestone/6?closed=1
|
73 |
-
* Updated player.js Vimeo library
|
74 |
-
* Improved checks for JetPack exists
|
75 |
-
|
76 |
-
= 1.2.1 =
|
77 |
-
|
78 |
-
* Implemented milestone https://github.com/puikinsh/shapely/milestone/5
|
79 |
-
|
80 |
-
= 1.2.0 =
|
81 |
-
|
82 |
-
* Implemented milestone https://github.com/puikinsh/shapely/milestone/4
|
83 |
-
|
84 |
-
= 1.0.6 =
|
85 |
-
* Added Vimeo for Video Widget
|
86 |
-
* Changed images' path from demo importer.
|
87 |
-
* Fixed PHP error that occurs with lower PHP Versions.
|
88 |
-
* Integrated with Travis
|
89 |
-
|
90 |
-
= 1.0.5 =
|
91 |
-
* Updated demo content importer
|
92 |
-
* Allow html on title,description,buttons of Shapely Parallax Widget
|
93 |
-
|
94 |
-
= 1.0.3 =
|
95 |
-
* Updated escape functions to allow users to enter minimal HTML in textareas
|
96 |
-
|
97 |
-
= 1.0.2 =
|
98 |
-
* Various bug fixes.
|
99 |
-
|
100 |
-
= 1.0.0 =
|
101 |
-
* Initial release.
|
1 |
+
=== Plugin Name ===
|
2 |
+
Contributors: colorlibplugins, silkalns
|
3 |
+
Tags: woocommerce, widgets, plugin, demo, companion, home page, one page, parallax, social, portfolio, projects
|
4 |
+
Requires at least: 3.8
|
5 |
+
Tested up to: 6.0
|
6 |
+
Stable tag: 1.2.7
|
7 |
+
License: GPLv3 or later
|
8 |
+
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
|
10 |
+
Shapely Companion is a companion plugin for Shapely WordPress theme by Colorlib.com.
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
Shapely Companion is a companion for Shapely One Page WordPress theme by Colorlib.com. This plugin won't do anything for other free or premium WordPress themes and you need to download and install <a href="https://colorlib.com/wp/themes/shapely/" target="_blank">Shapely</a>. If you are having problems with Shapely theme or its companion plugin the fastest way to receive help is via our theme <a href="https://colorlib.com/wp/forums" target="_blank">support forum</a>.
|
14 |
+
|
15 |
+
This plugin will add necessary WordPress widgets and allow to import demo content which will help you to with website setup.
|
16 |
+
|
17 |
+
While Shapely is a great one page WordPress theme it might not be for everyone therefore you might want to check other free <a href="https://colorlib.com/wp/themes/" target="_blank">WordPress themes</a> that are created by Colorlib.
|
18 |
+
|
19 |
+
= Plugin Options =
|
20 |
+
|
21 |
+
* Creates required WordPress widgets to be used in theme
|
22 |
+
* Creates demo(dummy) content for widgets to make them easier to use and understand how they work
|
23 |
+
* Provides an option to import demo(dummy) content.
|
24 |
+
|
25 |
+
= About Colorlib =
|
26 |
+
|
27 |
+
Colorlib is the best and by far the most popular source for free and premium WordPress themes. Our themes has been downloaded over 1,5 million times and are used by developers, webmasters and regular users all over the world. We believe in open source and that's why we have made our themes free to use for private and commercial use.
|
28 |
+
|
29 |
+
= Further Reading =
|
30 |
+
|
31 |
+
If you are new to WordPress but are dedicated to <a href="https://colorlib.com/wp/how-to-make-a-website/" target="_blank" >make a website</a> on your own Colorlib is the right place to start. Usually the trickiest part is to choose the right hosting because all hosting providers are not equal. We have outlined the best <a href="https://colorlib.com/wp/wordpress-hosting/" target="_blank"> WordPress hosting</a> providers and we hope you'll find them useful.
|
32 |
+
|
33 |
+
|
34 |
+
== Installation ==
|
35 |
+
|
36 |
+
This section describes how to install the plugin and get it working.
|
37 |
+
|
38 |
+
1. Upload the whole contents of the folder `shapely-companion` to the `/wp-content/plugins/` directory
|
39 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress dashboard
|
40 |
+
3. Enjoy using it :)
|
41 |
+
|
42 |
+
|
43 |
+
== Frequently Asked Questions ==
|
44 |
+
|
45 |
+
= What themes this plugin supports? =
|
46 |
+
|
47 |
+
Currently it works only with Shapely theme.
|
48 |
+
|
49 |
+
= Am I obligated to use it? =
|
50 |
+
|
51 |
+
You can still use Shapely theme without this plugin but you won't be able to import demo content and use theme specific widgets that you see on front page of theme demo.
|
52 |
+
|
53 |
+
== Changelog ==
|
54 |
+
|
55 |
+
= 1.2.7 =
|
56 |
+
* Fixed: Sanitizations & Security
|
57 |
+
|
58 |
+
= 1.2.6 =
|
59 |
+
* Fixed demo images
|
60 |
+
* compatibility with jQuery 3.0
|
61 |
+
|
62 |
+
= 1.2.5 =
|
63 |
+
|
64 |
+
* Improved compatibility with Kali Forms plugin.
|
65 |
+
|
66 |
+
= 1.2.4 =
|
67 |
+
|
68 |
+
* Implemented milestone https://github.com/puikinsh/shapely/milestone/8?closed=1
|
69 |
+
|
70 |
+
= 1.2.2 =
|
71 |
+
|
72 |
+
* Implemented milestone https://github.com/puikinsh/shapely/milestone/6?closed=1
|
73 |
+
* Updated player.js Vimeo library
|
74 |
+
* Improved checks for JetPack exists
|
75 |
+
|
76 |
+
= 1.2.1 =
|
77 |
+
|
78 |
+
* Implemented milestone https://github.com/puikinsh/shapely/milestone/5
|
79 |
+
|
80 |
+
= 1.2.0 =
|
81 |
+
|
82 |
+
* Implemented milestone https://github.com/puikinsh/shapely/milestone/4
|
83 |
+
|
84 |
+
= 1.0.6 =
|
85 |
+
* Added Vimeo for Video Widget
|
86 |
+
* Changed images' path from demo importer.
|
87 |
+
* Fixed PHP error that occurs with lower PHP Versions.
|
88 |
+
* Integrated with Travis
|
89 |
+
|
90 |
+
= 1.0.5 =
|
91 |
+
* Updated demo content importer
|
92 |
+
* Allow html on title,description,buttons of Shapely Parallax Widget
|
93 |
+
|
94 |
+
= 1.0.3 =
|
95 |
+
* Updated escape functions to allow users to enter minimal HTML in textareas
|
96 |
+
|
97 |
+
= 1.0.2 =
|
98 |
+
* Various bug fixes.
|
99 |
+
|
100 |
+
= 1.0.0 =
|
101 |
+
* Initial release.
|
shapely-companion.php
CHANGED
@@ -1,92 +1,92 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Plugin Name: Shapely Companion
|
4 |
-
* Plugin URI: https://colorlib.com/wp/themes/shapely/
|
5 |
-
* Description: Shapely Companion is a companion plugin for Shapely theme.
|
6 |
-
* Version: 1.2.7
|
7 |
-
* Author: Colorlib
|
8 |
-
* Author URI: https://colorlib.com
|
9 |
-
* License: GPL-2.0+
|
10 |
-
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
11 |
-
* Text Domain: shapely-companion
|
12 |
-
* Domain Path: /languages
|
13 |
-
*/
|
14 |
-
|
15 |
-
if ( ! defined( 'WPINC' ) ) {
|
16 |
-
die;
|
17 |
-
}
|
18 |
-
|
19 |
-
define( 'SHAPELY_COMPANION', '1.2.7' );
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Load the Dashboard Widget
|
23 |
-
*/
|
24 |
-
require_once plugin_dir_path( __FILE__ ) . 'inc/epsilon-dashboard/class-epsilon-dashboard.php';
|
25 |
-
|
26 |
-
/**
|
27 |
-
* The helper method to run the class
|
28 |
-
*
|
29 |
-
* @return Epsilon_Dashboard
|
30 |
-
*/
|
31 |
-
function shapely_companion_dashboard_widget() {
|
32 |
-
$epsilon_dashboard_args = array(
|
33 |
-
'widget_title' => esc_html__( 'From our blog', 'shapely-companion' ),
|
34 |
-
'feed_url' => array( 'https://colorlib.com/wp/feed/' ),
|
35 |
-
);
|
36 |
-
return Epsilon_Dashboard::instance( $epsilon_dashboard_args );
|
37 |
-
}
|
38 |
-
|
39 |
-
shapely_companion_dashboard_widget();
|
40 |
-
|
41 |
-
$current_theme = wp_get_theme();
|
42 |
-
$current_parent = $current_theme->parent();
|
43 |
-
|
44 |
-
if ( 'Shapely' == $current_theme->get( 'Name' ) || ( $current_parent && 'Shapely' == $current_parent->get( 'Name' ) ) ) {
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Load the Widgets
|
48 |
-
*/
|
49 |
-
require_once plugin_dir_path( __FILE__ ) . 'inc/shapely-widgets.php';
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Load Enqueues
|
53 |
-
*/
|
54 |
-
require_once plugin_dir_path( __FILE__ ) . '/inc/shapely-enqueues.php';
|
55 |
-
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Load Helper
|
59 |
-
*/
|
60 |
-
require_once plugin_dir_path( __FILE__ ) . '/inc/shapely-helper.php';
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Load Import Demo Content Functionality
|
64 |
-
*/
|
65 |
-
require_once plugin_dir_path( __FILE__ ) . '/inc/shapely-demo-content.php';
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Load Nav Menu Functionality
|
69 |
-
*/
|
70 |
-
require_once plugin_dir_path( __FILE__ ) . '/inc/shapely-navmenu.php';
|
71 |
-
|
72 |
-
/**
|
73 |
-
* Load Metabox for Portfolio
|
74 |
-
*/
|
75 |
-
if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'custom-content-types' ) ) {
|
76 |
-
$jetpack_portfolio = get_option( 'jetpack_portfolio' );
|
77 |
-
if ( $jetpack_portfolio ) {
|
78 |
-
require_once plugin_dir_path( __FILE__ ) . '/inc/shapely-metabox.php';
|
79 |
-
}
|
80 |
-
}
|
81 |
-
} else {
|
82 |
-
add_action( 'admin_notices', 'shapely_companion_admin_notice', 99 );
|
83 |
-
function shapely_companion_admin_notice() {
|
84 |
-
?>
|
85 |
-
<div class="notice-warning notice">
|
86 |
-
<p><?php printf( wp_kses_post( __( 'In order to use the <strong>Shapely Companion</strong> plugin you have to also install the %1$sShapely Theme%2$s', 'shapely-companion' ) ), '<a href="https://wordpress.org/themes/shapely/" target="_blank">', '</a>' ); ?></p>
|
87 |
-
</div>
|
88 |
-
<?php
|
89 |
-
}
|
90 |
-
}
|
91 |
-
|
92 |
-
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Plugin Name: Shapely Companion
|
4 |
+
* Plugin URI: https://colorlib.com/wp/themes/shapely/
|
5 |
+
* Description: Shapely Companion is a companion plugin for Shapely theme.
|
6 |
+
* Version: 1.2.7
|
7 |
+
* Author: Colorlib
|
8 |
+
* Author URI: https://colorlib.com
|
9 |
+
* License: GPL-2.0+
|
10 |
+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
11 |
+
* Text Domain: shapely-companion
|
12 |
+
* Domain Path: /languages
|
13 |
+
*/
|
14 |
+
|
15 |
+
if ( ! defined( 'WPINC' ) ) {
|
16 |
+
die;
|
17 |
+
}
|
18 |
+
|
19 |
+
define( 'SHAPELY_COMPANION', '1.2.7' );
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Load the Dashboard Widget
|
23 |
+
*/
|
24 |
+
require_once plugin_dir_path( __FILE__ ) . 'inc/epsilon-dashboard/class-epsilon-dashboard.php';
|
25 |
+
|
26 |
+
/**
|
27 |
+
* The helper method to run the class
|
28 |
+
*
|
29 |
+
* @return Epsilon_Dashboard
|
30 |
+
*/
|
31 |
+
function shapely_companion_dashboard_widget() {
|
32 |
+
$epsilon_dashboard_args = array(
|
33 |
+
'widget_title' => esc_html__( 'From our blog', 'shapely-companion' ),
|
34 |
+
'feed_url' => array( 'https://colorlib.com/wp/feed/' ),
|
35 |
+
);
|
36 |
+
return Epsilon_Dashboard::instance( $epsilon_dashboard_args );
|
37 |
+
}
|
38 |
+
|
39 |
+
shapely_companion_dashboard_widget();
|
40 |
+
|
41 |
+
$current_theme = wp_get_theme();
|
42 |
+
$current_parent = $current_theme->parent();
|
43 |
+
|
44 |
+
if ( 'Shapely' == $current_theme->get( 'Name' ) || ( $current_parent && 'Shapely' == $current_parent->get( 'Name' ) ) ) {
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Load the Widgets
|
48 |
+
*/
|
49 |
+
require_once plugin_dir_path( __FILE__ ) . 'inc/shapely-widgets.php';
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Load Enqueues
|
53 |
+
*/
|
54 |
+
require_once plugin_dir_path( __FILE__ ) . '/inc/shapely-enqueues.php';
|
55 |
+
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Load Helper
|
59 |
+
*/
|
60 |
+
require_once plugin_dir_path( __FILE__ ) . '/inc/shapely-helper.php';
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Load Import Demo Content Functionality
|
64 |
+
*/
|
65 |
+
require_once plugin_dir_path( __FILE__ ) . '/inc/shapely-demo-content.php';
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Load Nav Menu Functionality
|
69 |
+
*/
|
70 |
+
require_once plugin_dir_path( __FILE__ ) . '/inc/shapely-navmenu.php';
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Load Metabox for Portfolio
|
74 |
+
*/
|
75 |
+
if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'custom-content-types' ) ) {
|
76 |
+
$jetpack_portfolio = get_option( 'jetpack_portfolio' );
|
77 |
+
if ( $jetpack_portfolio ) {
|
78 |
+
require_once plugin_dir_path( __FILE__ ) . '/inc/shapely-metabox.php';
|
79 |
+
}
|
80 |
+
}
|
81 |
+
} else {
|
82 |
+
add_action( 'admin_notices', 'shapely_companion_admin_notice', 99 );
|
83 |
+
function shapely_companion_admin_notice() {
|
84 |
+
?>
|
85 |
+
<div class="notice-warning notice">
|
86 |
+
<p><?php printf( wp_kses_post( __( 'In order to use the <strong>Shapely Companion</strong> plugin you have to also install the %1$sShapely Theme%2$s', 'shapely-companion' ) ), '<a href="https://wordpress.org/themes/shapely/" target="_blank">', '</a>' ); ?></p>
|
87 |
+
</div>
|
88 |
+
<?php
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
|