' ).appendTo( object.find( '.featherlight-content' ) );
124 | $captionElm[0].innerHTML = caption.html();
125 | }
126 | };
127 | }
128 |
129 | /**
130 | * Fires all of our helper methods to load featherlight.
131 | *
132 | * @since 0.1.0
133 | * @return void
134 | */
135 | function wpFeatherlightInit() {
136 | $.featherlight.defaults.closeIcon = '';
137 | findImages();
138 | findGalleries();
139 | if ( $body.hasClass( 'wp-featherlight-captions' ) ) {
140 | addCaptions();
141 | }
142 | }
143 |
144 | $( document ).ready(function() {
145 | wpFeatherlightInit();
146 | });
147 | })( this, jQuery );
148 |
--------------------------------------------------------------------------------
/.jscsrc:
--------------------------------------------------------------------------------
1 | {
2 | "requireSpacesInConditionalExpression": {
3 | "afterTest": true,
4 | "beforeConsequent": true,
5 | "afterConsequent": true,
6 | "beforeAlternate": true
7 | },
8 | "requireSpacesInFunction": {
9 | "beforeOpeningCurlyBrace": true
10 | },
11 | "disallowSpacesInAnonymousFunctionExpression": {
12 | "beforeOpeningRoundBrace": true
13 | },
14 | "requireMultipleVarDecl": false,
15 | "requireSpacesInsideObjectBrackets": "all",
16 | "disallowSpaceAfterObjectKeys": true,
17 | "requireSpaceAfterBinaryOperators": [
18 | "=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=",
19 | "&=", "|=", "^=", "+=",
20 |
21 | "+", "-", "*", "/", "%", "<<", ">>", ">>>", "&",
22 | "|", "^", "&&", "||", "===", "==", ">=",
23 | "<=", "<", ">", "!=", "!=="
24 | ],
25 | "requireSpaceBeforeBinaryOperators": [
26 | "=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=",
27 | "&=", "|=", "^=", "+=",
28 |
29 | "+", "-", "*", "/", "%", "<<", ">>", ">>>", "&",
30 | "|", "^", "&&", "||", "===", "==", ">=",
31 | "<=", "<", ">", "!=", "!=="
32 | ],
33 | "disallowKeywords": ["with"],
34 | "disallowMultipleLineBreaks": true,
35 | "validateLineBreaks": "LF",
36 | "disallowMixedSpacesAndTabs": "smart",
37 | "disallowTrailingWhitespace": true,
38 | "requireCurlyBraces": [
39 | "if",
40 | "else",
41 | "for",
42 | "while",
43 | "do",
44 | "try",
45 | "catch"
46 | ],
47 | "requireSpaceBeforeBlockStatements": true,
48 | "requireParenthesesAroundIIFE": true,
49 | "requireBlocksOnNewline": true,
50 | "requireOperatorBeforeLineBreak": [
51 | "?",
52 | "=",
53 | "+",
54 | "-",
55 | "/",
56 | "*",
57 | "==",
58 | "===",
59 | "!=",
60 | "!==",
61 | ">",
62 | ">=",
63 | "<",
64 | "<="
65 | ],
66 | "requireSpaceBeforeBinaryOperators": [
67 | "?",
68 | "=",
69 | "+",
70 | "-",
71 | "/",
72 | "*",
73 | "==",
74 | "===",
75 | "!=",
76 | "!==",
77 | ">",
78 | ">=",
79 | "<",
80 | "<="
81 | ],
82 | "requireSpaceAfterBinaryOperators": [
83 | "?",
84 | "=",
85 | "+",
86 | "/",
87 | "*",
88 | ":",
89 | "==",
90 | "===",
91 | "!=",
92 | "!==",
93 | ">",
94 | ">=",
95 | "<",
96 | "<="
97 | ],
98 | "disallowSpaceBeforeBinaryOperators": [","],
99 | "disallowSpaceAfterBinaryOperators": [],
100 | "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~"],
101 | "requireSpaceAfterPrefixUnaryOperators": ["!"],
102 | "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
103 | "requireCamelCaseOrUpperCaseIdentifiers": true,
104 | "disallowMultipleLineStrings": true,
105 | "validateQuoteMarks": "'",
106 | "validateIndentation": "\t",
107 | "requireLineFeedAtFileEnd": true,
108 | "requireDotNotation": true,
109 | "disallowNewlineBeforeBlockStatements": true,
110 | "requireSpaceAfterKeywords": [
111 | "do",
112 | "for",
113 | "if",
114 | "else",
115 | "switch",
116 | "case",
117 | "try",
118 | "catch",
119 | "void",
120 | "while",
121 | "with",
122 | "return",
123 | "typeof"
124 | ],
125 | "requireSpaceAfterLineComment": true,
126 | "requireSpaceBeforeKeywords": [
127 | "else",
128 | "while",
129 | "catch"
130 | ],
131 | "requireSpaceBeforeObjectValues": true,
132 | "requireSpaceBetweenArguments": true,
133 | "requireSpacesInAnonymousFunctionExpression": {
134 | "beforeOpeningCurlyBrace": true
135 | },
136 | "requireSpacesInForStatement": true,
137 | "requireSpacesInsideArrayBrackets": "all",
138 | "requireSpacesInsideParentheses": {
139 | "all": true,
140 | "except": [
141 | "{",
142 | "}",
143 | "[",
144 | "]",
145 | "function"
146 | ]
147 | },
148 | "requireYodaConditions": true,
149 | "validateParameterSeparator": ", ",
150 |
151 | "disallowTrailingComma": true,
152 | "disallowPaddingNewlinesInBlocks": true,
153 | "disallowEmptyBlocks": true,
154 | "disallowQuotedKeysInObjects": "allButReserved",
155 | "disallowDanglingUnderscores": true,
156 | "requireCommaBeforeLineBreak": true,
157 | "disallowKeywordsOnNewLine": ["else"],
158 | "requireCapitalizedConstructors": true,
159 | "safeContextKeyword": [ "that" ],
160 | "jsDoc": {
161 | "checkParamNames": true,
162 | "checkRedundantParams": true,
163 | "requireParamTypes": true
164 | }
165 | }
166 |
--------------------------------------------------------------------------------
/assets/plugin/.scss-lint.yml:
--------------------------------------------------------------------------------
1 | # This file follows the WordPress CSS standards as closely as possible. For any
2 | # linters that aren't listed in this file, we're accepting the default settings.
3 |
4 | # https://make.wordpress.org/core/handbook/best-practices/coding-standards/css/
5 | # Linter documentation: http://git.io/vG7gu
6 | # See also: http://sass-guidelin.es/
7 |
8 | linters:
9 | BangFormat:
10 | enabled: true
11 | space_before_bang: true
12 | space_after_bang: false
13 |
14 | BorderZero:
15 | enabled: true
16 | convention: zero # or `none`
17 |
18 | ColorKeyword:
19 | enabled: true
20 |
21 | ColorVariable:
22 | enabled: true
23 |
24 | Comment:
25 | enabled: false
26 |
27 | DebugStatement:
28 | enabled: true
29 |
30 | DeclarationOrder:
31 | enabled: true
32 |
33 | DuplicateProperty:
34 | enabled: true
35 |
36 | ElsePlacement:
37 | enabled: true
38 | style: same_line # or 'new_line'
39 |
40 | EmptyLineBetweenBlocks:
41 | enabled: true
42 | ignore_single_line_blocks: true
43 |
44 | EmptyRule:
45 | enabled: true
46 |
47 | FinalNewline:
48 | enabled: true
49 | present: true
50 |
51 | HexLength:
52 | enabled: true
53 | style: short # or 'long'
54 |
55 | HexNotation:
56 | enabled: true
57 | style: lowercase # or 'uppercase'
58 |
59 | HexValidation:
60 | enabled: true
61 |
62 | IdSelector:
63 | enabled: false
64 |
65 | ImportantRule:
66 | enabled: true
67 |
68 | ImportPath:
69 | enabled: true
70 | leading_underscore: false
71 | filename_extension: false
72 |
73 | Indentation:
74 | enabled: true
75 | allow_non_nested_indentation: false
76 | character: tab # or 'space'
77 | width: 1
78 |
79 | LeadingZero:
80 | enabled: true
81 | style: include_zero # or 'include_zero'
82 |
83 | MergeableSelector:
84 | enabled: false
85 | force_nesting: true
86 |
87 | NameFormat:
88 | enabled: true
89 | allow_leading_underscore: true
90 | convention: hyphenated_lowercase # or 'BEM', or a regex pattern
91 |
92 | NestingDepth:
93 | enabled: true
94 | max_depth: 5
95 |
96 | PlaceholderInExtend:
97 | enabled: true
98 |
99 | PropertyCount:
100 | enabled: false
101 | include_nested: false
102 | max_properties: 10
103 |
104 | PropertySortOrder:
105 | enabled: true
106 | ignore_unspecified: false
107 | separate_groups: false
108 |
109 | PropertySpelling:
110 | enabled: true
111 | extra_properties: []
112 |
113 | QualifyingElement:
114 | enabled: false
115 | allow_element_with_attribute: false
116 | allow_element_with_class: false
117 | allow_element_with_id: false
118 |
119 | SelectorDepth:
120 | enabled: true
121 | max_depth: 5
122 |
123 | SelectorFormat:
124 | enabled: true
125 | convention: hyphenated_lowercase # or 'BEM', or 'hyphenated_BEM', or 'snake_case', or 'camel_case', or a regex pattern
126 |
127 | Shorthand:
128 | enabled: true
129 |
130 | SingleLinePerProperty:
131 | enabled: true
132 | allow_single_line_rule_sets: true
133 |
134 | SingleLinePerSelector:
135 | enabled: true
136 |
137 | SpaceAfterComma:
138 | enabled: true
139 |
140 | SpaceAfterPropertyColon:
141 | enabled: true
142 | style: one_space # or 'no_space', or 'at_least_one_space', or 'aligned'
143 |
144 | SpaceAfterPropertyName:
145 | enabled: true
146 |
147 | SpaceBeforeBrace:
148 | enabled: true
149 | style: space # or 'new_line'
150 | allow_single_line_padding: false
151 |
152 | SpaceBetweenParens:
153 | enabled: true
154 | spaces: 1
155 |
156 | StringQuotes:
157 | enabled: true
158 | style: double_quotes
159 |
160 | TrailingSemicolon:
161 | enabled: true
162 |
163 | TrailingZero:
164 | enabled: false
165 |
166 | UnnecessaryMantissa:
167 | enabled: true
168 |
169 | UnnecessaryParentReference:
170 | enabled: true
171 |
172 | UrlFormat:
173 | enabled: true
174 |
175 | UrlQuotes:
176 | enabled: true
177 |
178 | VariableForProperty:
179 | enabled: false
180 | properties: []
181 |
182 | VendorPrefix:
183 | enabled: true
184 | identifier_list: base
185 | additional_identifiers: []
186 | excluded_identifiers: []
187 |
188 | ZeroUnit:
189 | enabled: true
190 |
191 | Compass::*:
192 | enabled: false
193 |
--------------------------------------------------------------------------------
/composer.lock:
--------------------------------------------------------------------------------
1 | {
2 | "_readme": [
3 | "This file locks the dependencies of your project to a known state",
4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5 | "This file is @generated automatically"
6 | ],
7 | "hash": "0d1186212214fbaa4e5f713507762659",
8 | "content-hash": "8a47a178f1790ace539a756ea2130794",
9 | "packages": [
10 | {
11 | "name": "composer/installers",
12 | "version": "v1.2.0",
13 | "source": {
14 | "type": "git",
15 | "url": "https://github.com/composer/installers.git",
16 | "reference": "d78064c68299743e0161004f2de3a0204e33b804"
17 | },
18 | "dist": {
19 | "type": "zip",
20 | "url": "https://api.github.com/repos/composer/installers/zipball/d78064c68299743e0161004f2de3a0204e33b804",
21 | "reference": "d78064c68299743e0161004f2de3a0204e33b804",
22 | "shasum": ""
23 | },
24 | "require": {
25 | "composer-plugin-api": "^1.0"
26 | },
27 | "replace": {
28 | "roundcube/plugin-installer": "*",
29 | "shama/baton": "*"
30 | },
31 | "require-dev": {
32 | "composer/composer": "1.0.*@dev",
33 | "phpunit/phpunit": "4.1.*"
34 | },
35 | "type": "composer-plugin",
36 | "extra": {
37 | "class": "Composer\\Installers\\Plugin",
38 | "branch-alias": {
39 | "dev-master": "1.0-dev"
40 | }
41 | },
42 | "autoload": {
43 | "psr-4": {
44 | "Composer\\Installers\\": "src/Composer/Installers"
45 | }
46 | },
47 | "notification-url": "https://packagist.org/downloads/",
48 | "license": [
49 | "MIT"
50 | ],
51 | "authors": [
52 | {
53 | "name": "Kyle Robinson Young",
54 | "email": "kyle@dontkry.com",
55 | "homepage": "https://github.com/shama"
56 | }
57 | ],
58 | "description": "A multi-framework Composer library installer",
59 | "homepage": "https://composer.github.io/installers/",
60 | "keywords": [
61 | "Craft",
62 | "Dolibarr",
63 | "Hurad",
64 | "ImageCMS",
65 | "MODX Evo",
66 | "Mautic",
67 | "OXID",
68 | "Plentymarkets",
69 | "RadPHP",
70 | "SMF",
71 | "Thelia",
72 | "WolfCMS",
73 | "agl",
74 | "aimeos",
75 | "annotatecms",
76 | "attogram",
77 | "bitrix",
78 | "cakephp",
79 | "chef",
80 | "cockpit",
81 | "codeigniter",
82 | "concrete5",
83 | "croogo",
84 | "dokuwiki",
85 | "drupal",
86 | "elgg",
87 | "expressionengine",
88 | "fuelphp",
89 | "grav",
90 | "installer",
91 | "joomla",
92 | "kohana",
93 | "laravel",
94 | "lithium",
95 | "magento",
96 | "mako",
97 | "mediawiki",
98 | "modulework",
99 | "moodle",
100 | "phpbb",
101 | "piwik",
102 | "ppi",
103 | "puppet",
104 | "reindex",
105 | "roundcube",
106 | "shopware",
107 | "silverstripe",
108 | "symfony",
109 | "typo3",
110 | "wordpress",
111 | "yawik",
112 | "zend",
113 | "zikula"
114 | ],
115 | "time": "2016-08-13 20:53:52"
116 | }
117 | ],
118 | "packages-dev": [],
119 | "aliases": [],
120 | "minimum-stability": "stable",
121 | "stability-flags": [],
122 | "prefer-stable": false,
123 | "prefer-lowest": false,
124 | "platform": [],
125 | "platform-dev": []
126 | }
127 |
--------------------------------------------------------------------------------
/css/wp-featherlight.min.css:
--------------------------------------------------------------------------------
1 | .featherlight{background:0 0;bottom:0;cursor:-webkit-zoom-out;cursor:-moz-zoom-out;cursor:zoom-out;display:none;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;left:0;position:fixed;right:0;text-align:center;top:0;white-space:nowrap;z-index:2147483647}.featherlight *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.featherlight:last-of-type{background:rgba(0,0,0,.9)}.featherlight::before{content:"";display:inline-block;height:100%;margin-right:-.25em;vertical-align:middle}.featherlight .featherlight-content{-webkit-animation:fadein .5s;animation:fadein .5s;background:#000;border:0;cursor:auto;display:inline-block;max-height:80%;max-width:90%;min-width:inherit;overflow:visible;padding:0;position:relative;text-align:left;vertical-align:middle;white-space:normal}@media screen and (min-width:980px){.featherlight .featherlight-content{max-height:90%}}.featherlight .featherlight-content .caption{color:#fff;font-size:16px;font-weight:lighter;line-height:1.25;max-width:100%;overflow:hidden;position:absolute;text-align:left;text-overflow:ellipsis;white-space:nowrap}.featherlight .featherlight-content .caption:focus,.featherlight .featherlight-content .caption:hover{overflow:visible;white-space:normal}.featherlight .featherlight-content a{color:#fff;text-decoration:underline}.featherlight .featherlight-content a:focus,.featherlight .featherlight-content a:hover{text-decoration:none}.featherlight .featherlight-inner{-webkit-animation:fadein .5s;animation:fadein .5s;display:block}.featherlight button{-webkit-appearance:button;font-family:sans-serif;font-size:100%;line-height:1.15;margin:0;overflow:visible;text-transform:none}.featherlight button::-moz-focus-inner{border-style:none;padding:0}.featherlight .featherlight-close-icon{background-color:transparent;background-image:url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%0A%09%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M21%204.41L19.59%203%2012%2010.59%204.41%203%203%204.41%2010.59%2012%203%2019.59%204.41%2021%2012%2013.41%2019.59%2021%2021%2019.59%2013.41%2012%2021%204.41z%22/%3E%0A%3C/svg%3E);background-position:center;background-repeat:no-repeat;-webkit-background-size:100% auto;background-size:100% auto;border:0;cursor:pointer;display:block;height:30px;opacity:.6;overflow:hidden;padding:0;position:fixed;right:25px;text-align:center;text-indent:100%;top:25px;white-space:nowrap;width:30px;z-index:9999}.featherlight .featherlight-close-icon:focus,.featherlight .featherlight-close-icon:hover{opacity:1}.featherlight .featherlight-image{max-width:100%}.featherlight iframe{border:0}[data-featherlight] img{cursor:-webkit-zoom-in;cursor:-moz-zoom-in;cursor:zoom-in}.featherlight-iframe .featherlight-content{border-bottom:0;-webkit-overflow-scrolling:touch;overflow-y:scroll;padding:0}@-webkit-keyframes featherlightLoader{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes featherlightLoader{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes fadein{from{opacity:0}to{opacity:1}}@keyframes fadein{from{opacity:0}to{opacity:1}}.featherlight-loading .featherlight-content{-webkit-animation:featherlightLoader 1s infinite linear;animation:featherlightLoader 1s infinite linear;background:0 0;border:8px solid #909090;border-left-color:#fff;font-size:10px}.featherlight-loading .featherlight-content,.featherlight-loading .featherlight-content::after{-webkit-border-radius:50%;border-radius:50%;height:10em;width:10em}.featherlight-loading .featherlight-close,.featherlight-loading .featherlight-inner{display:none}.featherlight-next,.featherlight-previous{background-color:transparent;background-repeat:no-repeat;-webkit-background-size:100% auto;background-size:100% auto;cursor:pointer;display:block;height:60px;margin-top:-30px;opacity:.4;overflow:hidden;position:fixed;text-indent:100%;top:50%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap;width:60px}.featherlight-next span,.featherlight-previous span{display:none}.featherlight-next:focus,.featherlight-next:hover,.featherlight-previous:focus,.featherlight-previous:hover{opacity:1}.featherlight-next{background-image:url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%0A%09%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M8.59%2016.59L13.17%2012%208.59%207.41%2010%206l6%206-6%206-1.41-1.41z%22/%3E%0A%3C/svg%3E);background-position:0 0;right:10px}.featherlight-previous{background-image:url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%0A%09%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M15.41%207.41L10.83%2012l4.58%204.59L14%2018l-6-6%206-6%201.41%201.41z%22/%3E%0A%3C/svg%3E);background-position:-5px 0;left:10px}.featherlight-loading .featherlight-next,.featherlight-loading .featherlight-previous{display:none}
--------------------------------------------------------------------------------
/css/wp-featherlight-rtl.min.css:
--------------------------------------------------------------------------------
1 | .featherlight{background:0 0;bottom:0;cursor:-webkit-zoom-out;cursor:-moz-zoom-out;cursor:zoom-out;display:none;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;right:0;position:fixed;left:0;text-align:center;top:0;white-space:nowrap;z-index:2147483647}.featherlight *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.featherlight:last-of-type{background:rgba(0,0,0,.9)}.featherlight::before{content:"";display:inline-block;height:100%;margin-left:-.25em;vertical-align:middle}.featherlight .featherlight-content{-webkit-animation:fadein .5s;animation:fadein .5s;background:#000;border:0;cursor:auto;display:inline-block;max-height:80%;max-width:90%;min-width:inherit;overflow:visible;padding:0;position:relative;text-align:right;vertical-align:middle;white-space:normal}@media screen and (min-width:980px){.featherlight .featherlight-content{max-height:90%}}.featherlight .featherlight-content .caption{color:#fff;font-size:16px;font-weight:lighter;line-height:1.25;max-width:100%;overflow:hidden;position:absolute;text-align:right;text-overflow:ellipsis;white-space:nowrap}.featherlight .featherlight-content .caption:focus,.featherlight .featherlight-content .caption:hover{overflow:visible;white-space:normal}.featherlight .featherlight-content a{color:#fff;text-decoration:underline}.featherlight .featherlight-content a:focus,.featherlight .featherlight-content a:hover{text-decoration:none}.featherlight .featherlight-inner{-webkit-animation:fadein .5s;animation:fadein .5s;display:block}.featherlight button{-webkit-appearance:button;font-family:sans-serif;font-size:100%;line-height:1.15;margin:0;overflow:visible;text-transform:none}.featherlight button::-moz-focus-inner{border-style:none;padding:0}.featherlight .featherlight-close-icon{background-color:transparent;background-image:url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%0A%09%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M21%204.41L19.59%203%2012%2010.59%204.41%203%203%204.41%2010.59%2012%203%2019.59%204.41%2021%2012%2013.41%2019.59%2021%2021%2019.59%2013.41%2012%2021%204.41z%22/%3E%0A%3C/svg%3E);background-position:center;background-repeat:no-repeat;-webkit-background-size:100% auto;background-size:100% auto;border:0;cursor:pointer;display:block;height:30px;opacity:.6;overflow:hidden;padding:0;position:fixed;left:25px;text-align:center;text-indent:100%;top:25px;white-space:nowrap;width:30px;z-index:9999}.featherlight .featherlight-close-icon:focus,.featherlight .featherlight-close-icon:hover{opacity:1}.featherlight .featherlight-image{max-width:100%}.featherlight iframe{border:0}[data-featherlight] img{cursor:-webkit-zoom-in;cursor:-moz-zoom-in;cursor:zoom-in}.featherlight-iframe .featherlight-content{border-bottom:0;-webkit-overflow-scrolling:touch;overflow-y:scroll;padding:0}@-webkit-keyframes featherlightLoader{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(-360deg);transform:rotate(-360deg)}}@keyframes featherlightLoader{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(-360deg);transform:rotate(-360deg)}}@-webkit-keyframes fadein{from{opacity:0}to{opacity:1}}@keyframes fadein{from{opacity:0}to{opacity:1}}.featherlight-loading .featherlight-content{-webkit-animation:featherlightLoader 1s infinite linear;animation:featherlightLoader 1s infinite linear;background:0 0;border:8px solid #909090;border-right-color:#fff;font-size:10px}.featherlight-loading .featherlight-content,.featherlight-loading .featherlight-content::after{-webkit-border-radius:50%;border-radius:50%;height:10em;width:10em}.featherlight-loading .featherlight-close,.featherlight-loading .featherlight-inner{display:none}.featherlight-next,.featherlight-previous{background-color:transparent;background-repeat:no-repeat;-webkit-background-size:100% auto;background-size:100% auto;cursor:pointer;display:block;height:60px;margin-top:-30px;opacity:.4;overflow:hidden;position:fixed;text-indent:100%;top:50%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap;width:60px}.featherlight-next span,.featherlight-previous span{display:none}.featherlight-next:focus,.featherlight-next:hover,.featherlight-previous:focus,.featherlight-previous:hover{opacity:1}.featherlight-next{background-image:url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%0A%09%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M8.59%2016.59L13.17%2012%208.59%207.41%2010%206l6%206-6%206-1.41-1.41z%22/%3E%0A%3C/svg%3E);background-position:0 0;right:10px}.featherlight-previous{background-image:url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%0A%09%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M15.41%207.41L10.83%2012l4.58%204.59L14%2018l-6-6%206-6%201.41%201.41z%22/%3E%0A%3C/svg%3E);background-position:-5px 0;left:10px}.featherlight-loading .featherlight-next,.featherlight-loading .featherlight-previous{display:none}
--------------------------------------------------------------------------------
/admin/class-meta.php:
--------------------------------------------------------------------------------
1 | nonce_name ] ) ) { // Input var okay.
61 | return false;
62 | }
63 |
64 | if ( ! wp_verify_nonce( sanitize_key( $_POST[ $this->nonce_name ] ), $this->nonce_action ) ) { // Input var okay.
65 | return false;
66 | }
67 |
68 | // @link http://make.marketpress.com/multilingualpress/2014/10/how-to-disable-broken-save_post-callbacks/
69 | if ( is_multisite() && ms_is_switched() ) {
70 | return false;
71 | }
72 |
73 | return wp_unslash( $_POST ); // Input var okay.
74 | }
75 |
76 | /**
77 | * Output the content of our metabox.
78 | *
79 | * @since 1.0.0
80 | * @access public
81 | *
82 | * @param object $post Post object.
83 | * @return void
84 | */
85 | public function meta_box_view( $post ) {
86 | if ( empty( $post ) ) {
87 | $post = get_post();
88 | }
89 |
90 | if ( ! is_object( $post ) || ! isset( $post->post_type ) ) {
91 | return;
92 | }
93 |
94 | $type = get_post_type_object( $post->post_type );
95 |
96 | if ( ! is_object( $type ) ) {
97 | return;
98 | }
99 |
100 | if ( current_user_can( $type->cap->edit_post, $post->ID ) && $type->public ) {
101 | $disable = get_post_meta( $post->ID, 'wp_featherlight_disable', true );
102 | $checked = empty( $disable ) ? '' : $disable;
103 |
104 | require_once wp_featherlight()->get_dir() . 'admin/views/meta-box.php';
105 | }
106 | }
107 |
108 | /**
109 | * Callback function for saving our meta box data.
110 | *
111 | * @since 1.0.0
112 | * @access public
113 | * @param int $post_id Post ID.
114 | * @return bool Whether or not data has been saved.
115 | */
116 | public function save_meta_boxes( $post_id ) {
117 | if ( ! $valid_request = $this->validate_request( $post_id ) ) {
118 | return false;
119 | }
120 |
121 | $value = isset( $valid_request['wp_featherlight_disable'] ) ? 'yes' : '';
122 |
123 | return (bool) update_post_meta( $post_id, 'wp_featherlight_disable', $value );
124 | }
125 |
126 | /**
127 | * Add a metabox to control featherlight display options.
128 | *
129 | * @since 0.1.0
130 | * @access public
131 | * @param string $post_type the current post type.
132 | * @return void
133 | */
134 | public function add_meta_boxes( $post_type ) {
135 | $type = get_post_type_object( $post_type );
136 | if ( is_object( $type ) && $type->public ) {
137 | add_meta_box(
138 | 'wp_featherlight_options',
139 | __( 'WP Featherlight', 'wp-featherlight' ),
140 | array( $this, 'options_callback' ),
141 | null,
142 | 'side'
143 | );
144 | }
145 | }
146 |
147 | /**
148 | * Output the content of our metabox.
149 | *
150 | * @deprecated 1.0.0
151 | * @access public
152 | *
153 | * @param WP_Post $post Post object.
154 | * @return void
155 | */
156 | public function options_callback( WP_Post $post ) {
157 | wp_featherlight()->i18n->load();
158 | $disable = get_post_meta( $post->ID, 'wp_featherlight_disable', true );
159 | $checked = empty( $disable ) ? '' : $disable;
160 | require_once wp_featherlight()->get_dir() . 'admin/views/meta-box.php';
161 | }
162 |
163 | /**
164 | * Hook into WordPress.
165 | *
166 | * @since 1.3.1
167 | * @access protected
168 | * @return void
169 | */
170 | protected function wp_hooks() {
171 | add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
172 |
173 | if ( 'POST' === $_SERVER['REQUEST_METHOD'] ) {
174 | $this->user_data = $_POST;
175 | add_action( 'save_post', array( $this, 'save_meta_boxes' ) );
176 | }
177 | }
178 |
179 | /**
180 | * Get the class running!
181 | *
182 | * @since 0.1.0
183 | * @deprecated 1.0.0
184 | * @access public
185 | * @return void
186 | */
187 | public function run() {
188 | $this->wp_hooks();
189 | }
190 | }
191 |
--------------------------------------------------------------------------------
/js/vendor/featherlight.gallery.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Featherlight Gallery – an extension for the ultra slim jQuery lightbox
3 | * Version 1.7.13 - http://noelboss.github.io/featherlight/
4 | *
5 | * Copyright 2018, Noël Raoul Bossart (http://www.noelboss.com)
6 | * MIT Licensed.
7 | **/
8 | (function($) {
9 | "use strict";
10 |
11 | var warn = function(m) {
12 | if(window.console && window.console.warn) {
13 | window.console.warn('FeatherlightGallery: ' + m);
14 | }
15 | };
16 |
17 | if('undefined' === typeof $) {
18 | return warn('Too much lightness, Featherlight needs jQuery.');
19 | } else if(!$.featherlight) {
20 | return warn('Load the featherlight plugin before the gallery plugin');
21 | }
22 |
23 | var isTouchAware = ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch,
24 | jQueryConstructor = $.event && $.event.special.swipeleft && $,
25 | hammerConstructor = window.Hammer && function($el){
26 | var mc = new window.Hammer.Manager($el[0]);
27 | mc.add(new window.Hammer.Swipe());
28 | return mc;
29 | },
30 | swipeAwareConstructor = isTouchAware && (jQueryConstructor || hammerConstructor);
31 | if(isTouchAware && !swipeAwareConstructor) {
32 | warn('No compatible swipe library detected; one must be included before featherlightGallery for swipe motions to navigate the galleries.');
33 | }
34 |
35 | var callbackChain = {
36 | afterClose: function(_super, event) {
37 | var self = this;
38 | self.$instance.off('next.'+self.namespace+' previous.'+self.namespace);
39 | if (self._swiper) {
40 | self._swiper
41 | .off('swipeleft', self._swipeleft) /* See http://stackoverflow.com/questions/17367198/hammer-js-cant-remove-event-listener */
42 | .off('swiperight', self._swiperight);
43 | self._swiper = null;
44 | }
45 | return _super(event);
46 | },
47 | beforeOpen: function(_super, event){
48 | var self = this;
49 |
50 | self.$instance.on('next.'+self.namespace+' previous.'+self.namespace, function(event){
51 | var offset = event.type === 'next' ? +1 : -1;
52 | self.navigateTo(self.currentNavigation() + offset);
53 | });
54 |
55 | if (swipeAwareConstructor) {
56 | self._swiper = swipeAwareConstructor(self.$instance)
57 | .on('swipeleft', self._swipeleft = function() { self.$instance.trigger('next'); })
58 | .on('swiperight', self._swiperight = function() { self.$instance.trigger('previous'); });
59 |
60 | self.$instance
61 | .addClass(this.namespace+'-swipe-aware', swipeAwareConstructor);
62 | }
63 |
64 | self.$instance.find('.'+self.namespace+'-content')
65 | .append(self.createNavigation('previous'))
66 | .append(self.createNavigation('next'));
67 |
68 | return _super(event);
69 | },
70 | beforeContent: function(_super, event) {
71 | var index = this.currentNavigation();
72 | var len = this.slides().length;
73 | this.$instance
74 | .toggleClass(this.namespace+'-first-slide', index === 0)
75 | .toggleClass(this.namespace+'-last-slide', index === len - 1);
76 | return _super(event);
77 | },
78 | onKeyUp: function(_super, event){
79 | var dir = {
80 | 37: 'previous', /* Left arrow */
81 | 39: 'next' /* Rigth arrow */
82 | }[event.keyCode];
83 | if(dir) {
84 | this.$instance.trigger(dir);
85 | return false;
86 | } else {
87 | return _super(event);
88 | }
89 | }
90 | };
91 |
92 | function FeatherlightGallery($source, config) {
93 | if(this instanceof FeatherlightGallery) { /* called with new */
94 | $.featherlight.apply(this, arguments);
95 | this.chainCallbacks(callbackChain);
96 | } else {
97 | var flg = new FeatherlightGallery($.extend({$source: $source, $currentTarget: $source.first()}, config));
98 | flg.open();
99 | return flg;
100 | }
101 | }
102 |
103 | $.featherlight.extend(FeatherlightGallery, {
104 | autoBind: '[data-featherlight-gallery]'
105 | });
106 |
107 | $.extend(FeatherlightGallery.prototype, {
108 | /** Additional settings for Gallery **/
109 | previousIcon: '◀', /* Code that is used as previous icon */
110 | nextIcon: '▶', /* Code that is used as next icon */
111 | galleryFadeIn: 100, /* fadeIn speed when image is loaded */
112 | galleryFadeOut: 300, /* fadeOut speed before image is loaded */
113 |
114 | slides: function() {
115 | if (this.filter) {
116 | return this.$source.find(this.filter);
117 | }
118 | return this.$source;
119 | },
120 |
121 | images: function() {
122 | warn('images is deprecated, please use slides instead');
123 | return this.slides();
124 | },
125 |
126 | currentNavigation: function() {
127 | return this.slides().index(this.$currentTarget);
128 | },
129 |
130 | navigateTo: function(index) {
131 | var self = this,
132 | source = self.slides(),
133 | len = source.length,
134 | $inner = self.$instance.find('.' + self.namespace + '-inner');
135 | index = ((index % len) + len) % len; /* pin index to [0, len[ */
136 |
137 | self.$currentTarget = source.eq(index);
138 | self.beforeContent();
139 | return $.when(
140 | self.getContent(),
141 | $inner.fadeTo(self.galleryFadeOut,0.2)
142 | ).always(function($newContent) {
143 | self.setContent($newContent);
144 | self.afterContent();
145 | $newContent.fadeTo(self.galleryFadeIn,1);
146 | });
147 | },
148 |
149 | createNavigation: function(target) {
150 | var self = this;
151 | return $(''+this[target+'Icon']+'').click(function(evt){
152 | $(this).trigger(target+'.'+self.namespace);
153 | evt.preventDefault();
154 | });
155 | }
156 | });
157 |
158 | $.featherlightGallery = FeatherlightGallery;
159 |
160 | /* extend jQuery with selector featherlight method $(elm).featherlight(config, elm); */
161 | $.fn.featherlightGallery = function(config) {
162 | FeatherlightGallery.attach(this, config);
163 | return this;
164 | };
165 |
166 | /* bind featherlight on ready if config autoBind is set */
167 | $(document).ready(function(){ FeatherlightGallery._onReady(); });
168 |
169 | }(jQuery));
170 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 1.3.4
2 | This is a maintenance release.
3 |
4 | Here's a full list of what's changed since the last release:
5 | - Updated plugin URL
6 |
7 | ## 1.3.3
8 | This is primarily a maintenance release.
9 |
10 | Here's a full list of what's changed since the last release:
11 | - Tweak: Change metabox title
12 |
13 | ## 1.3.2
14 | Release to downgrade Featherlight verison until all bugs are worked out.
15 |
16 | - Dev: Updated [Featherlight](https://github.com/noelboss/featherlight/) to `1.7.13`
17 |
18 | ## 1.3.1
19 | This is primarily a maintenance release, but one new feature has been added. Display the option to disable the lightbox in Gutenberg!
20 |
21 | Here's a full list of what's changed since the last release:
22 |
23 | - Feature: Add back metabox in sidebar
24 | - Dev: Updated [Featherlight](https://github.com/noelboss/featherlight/) to `1.7.14`
25 |
26 | ## 1.3.0
27 | While primarily a maintenance release, one new feature has been added. WP Featherlight now supports Gutenberg galleries.
28 |
29 | Here's a full list of what's changed since the last release:
30 |
31 | - Feature: Gutenberg support
32 | - Tweak: General code cleanup in plugin
33 | - Dev: Updated [Featherlight](https://github.com/noelboss/featherlight/) to `1.7.13`
34 | - Change of ownership
35 |
36 | ## 1.2.0
37 | This is primarily a maintenance release, but one new feature has been added. HTML in captions is now supported!
38 |
39 | Here's a full list of what's changed since the last release:
40 |
41 | - Feature: Allowed HTML to be displayed in lightbox image captions
42 | - Dev: Updated [Featherlight](https://github.com/noelboss/featherlight/) to `1.7.9`
43 | - Dev: Updated [jQuery Detect Swipe](http://github.com/marcandre/detect_swipe) to `2.1.4`
44 |
45 | ## 1.1.0
46 | Thanks to some changes implemented in the core featherlight script, the accessibility of WP Featherlight is now significantly improved. Lightboxed elements now have more appropriate focus management for screen readers and the close button is more accessible.
47 |
48 | This update also fixes a potential plugin compatibly problem in the WordPress admin. In version 1.0, it was possible under unusual circumstances for the plugin to throw a fatal error when attempting to add the disable checkbox to the publish metabox.
49 |
50 | - Tweak: Improved accessibility (accessible close button, better focus management)
51 | - Fix: Prevented a fatal error that could happen when another plugin unsets the WP_Post object on the publish metabox.
52 | - Dev: Updated [Featherlight](https://github.com/noelboss/featherlight/) to `1.7.0`
53 |
54 | ## 1.0.0
55 | Even though this is a major version change, this is primarily a maintenance release. The reason for the jump to 1.0.0 is because we've changed some code which could break backwards compatibility with custom extensions and integrations.
56 |
57 | If you're just using the plugin on your site and haven't customized it or paid anyone to customize it for you, you should be able to update without any issues.
58 |
59 | If you're a developer and have written custom code extending the PHP side of WP Featherlight, be sure to test your code before updating.
60 |
61 | Under the hood, we've [deprecated some internal methods](https://github.com/cipherdevgroup/wp-featherlight/search?utf8=%E2%9C%93&q=_deprecated_function) which could potentially break custom code which extends WP Featherlight. The changes are primarily limited to class initialization, so unless you were doing something specific to that, it's unlikely that you'll run into issues.
62 |
63 | - Tweak: Improved transition between images within galleries
64 | - Tweak: Moved our disable lightbox checkbox into the publish meta box to streamline the admin
65 | - Tweak: Made styles more aggressive to ensure elements look consistent across different themes by default
66 | - Fix: Reduced false positives for URLs that use image extensions but don't actually link to an image
67 | - Dev: Updated [Featherlight](https://github.com/noelboss/featherlight/) to `1.5.1`
68 | - Dev: Updated [jQuery Detect Swipe](http://github.com/marcandre/detect_swipe) to `2.1.3`
69 | - Dev: Deprecated some internal methods
70 | - Dev: Reorganized how classes are instantiated and plugin actions are fired
71 |
72 | ## 0.3.0
73 |
74 | There are quite a few internal changes in the plugin for this release, plus some nice new features and improvements on the front-end. We've streamlined everything as much as possible and also added support for some languages other than English! Here's a breakdown of everything that's changed:
75 |
76 | ### New Features
77 | - Automatic captioning for WordPress images and gallery items (Including Jetpack Galleries)
78 | - Spanish language translation
79 |
80 | ### Enhancements
81 | - Updated [Featherlight](https://github.com/noelboss/featherlight/) to `1.3.3`
82 | - Improved gallery styles on desktop and mobile devices
83 | - Streamlined overall styles
84 | - Added SVG icons for more visual consistency across various platforms
85 | - Simplified the text used in the admin metabox to ease translations (props @toscho)
86 |
87 | ### Bug Fixes
88 | - Improved handling of images when certain caching plugins are enabled
89 | - Prevented gallery arrows from being hijacked by WP Emoji
90 | - Fixed a bug which allowed multiple light boxes to be opened using keyboard commands
91 |
92 | ### Developer Stuff
93 | - Reduced overhead by loading language files only when needed (props @toscho)
94 | - Improved the save routine for our admin metabox (props @toscho)
95 | - Added a `wp_featherlight_captions` filter to control auto-captioning. Filter it to false to disable captions.
96 | - Re-structured the plugin's internal code base and deprecated plugin constants
97 | - Added Grunt and Bower the plugin to allow easier updates and releases in the future
98 |
99 | ### Added Language Support
100 | - German
101 | - Spanish
102 | - French
103 | - Portuguese (Brazil)
104 | - Spanish (Peru)
105 |
106 | ## 0.2.0
107 |
108 | The primary feature in this release is the addition of a visual loader and the automatic lightboxing of external images. In prior versions, only images from the WordPress host domain were lightboxed automatically. This caused some problems with people using a CDN as the URLs were treated as external.
109 |
110 | There have also been a handful of code improvements under the hood including:
111 |
112 | - Added gallery support for Jetpack Tiled Galleries
113 | - Improved URL handling to match more image instances automatically
114 | - Fixed a mistake in the textdomain path
115 | - Improved admin metabox markup (props @GaryJones)
116 | - Fixed a typo in the main stylesheet's script handle (props @GaryJones)
117 |
118 | ## 0.1.1
119 |
120 | Fixed a bug that caused all WordPress galleries to open in a light box. Now only galleries which have been set to link to the media attachment are opened using Featherlight.
121 |
122 | ## 0.1.0
123 |
124 | Initial release!
125 |
--------------------------------------------------------------------------------
/includes/class-scripts.php:
--------------------------------------------------------------------------------
1 | suffix = $this->get_suffix();
52 | $this->url = $url;
53 | $this->version = $version;
54 | }
55 |
56 | /**
57 | * Helper function for getting the script `.min` suffix for minified files.
58 | *
59 | * @since 0.1.0
60 | * @access public
61 | * @return string
62 | */
63 | public function get_suffix() {
64 | static $suffix;
65 |
66 | if ( null === $suffix ) {
67 | $debug = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG;
68 | $enabled = (bool) apply_filters( 'wp_featherlight_enable_suffix', ! $debug );
69 | $suffix = $enabled ? '.min' : '';
70 | }
71 |
72 | return $suffix;
73 | }
74 |
75 | /**
76 | * Load all required CSS files on the front end.
77 | *
78 | * Developers can disable our CSS by filtering wp_featherlight_load_css to
79 | * false within their theme or plugin.
80 | *
81 | * @since 0.1.0
82 | * @access public
83 | * @return void
84 | */
85 | public function load_css() {
86 | if ( ! apply_filters( 'wp_featherlight_load_css', true ) ) {
87 | return;
88 | }
89 |
90 | wp_enqueue_style(
91 | 'wp-featherlight',
92 | "{$this->url}css/wp-featherlight{$this->suffix}.css",
93 | array(),
94 | $this->version
95 | );
96 |
97 | wp_style_add_data( 'wp-featherlight', 'rtl', 'replace' );
98 |
99 | wp_style_add_data( 'wp-featherlight', 'suffix', $this->suffix );
100 | }
101 |
102 | /**
103 | * Helper function to determine whether or not to load a packed version of
104 | * our JavaScript libraries on the front end.
105 | *
106 | * Developers can filter wp_featherlight_enable_packed_js to false if they
107 | * are loading any of the following libraries in their theme or plugin:
108 | *
109 | * http://noelboss.github.io/featherlight/
110 | * http://noelboss.github.io/featherlight/gallery.html
111 | * https://github.com/marcandre/detect_swipe
112 | *
113 | * @since 0.1.0
114 | * @access protected
115 | * @return bool
116 | */
117 | protected function enable_packed_js() {
118 | if ( empty( $this->suffix ) ) {
119 | return false;
120 | }
121 |
122 | return apply_filters( 'wp_featherlight_enable_packed_js', true );
123 | }
124 |
125 | /**
126 | * Load all required JavaScript files on the front end.
127 | *
128 | * Developers can disable our JS by filtering wp_featherlight_load_js to
129 | * false within their theme or plugin.
130 | *
131 | * @since 0.1.0
132 | * @access public
133 | * @return void
134 | */
135 | public function load_js() {
136 | if ( ! apply_filters( 'wp_featherlight_load_js', true ) ) {
137 | return;
138 | }
139 | if ( $this->enable_packed_js() ) {
140 | $this->load_packed_js();
141 | } else {
142 | $this->load_unpacked_js();
143 | }
144 | }
145 |
146 | /**
147 | * Load the packed and minified version of our JavaScript files. This is the
148 | * preferred loading method as it saves us from adding a bunch of http
149 | * requests, but it could create conflicts with some plugins and themes.
150 | *
151 | * @since 0.1.0
152 | * @access public
153 | * @return void
154 | */
155 | public function load_packed_js() {
156 | wp_enqueue_script(
157 | 'wp-featherlight',
158 | "{$this->url}js/wpFeatherlight.pkgd{$this->suffix}.js",
159 | array( 'jquery' ),
160 | $this->version,
161 | true
162 | );
163 | }
164 |
165 | /**
166 | * Load all of our JS files individually to for maximum compatibility.
167 | *
168 | * @since 0.1.0
169 | * @access public
170 | * @return void
171 | */
172 | public function load_unpacked_js() {
173 | wp_enqueue_script(
174 | 'jquery-detect-swipe',
175 | "{$this->url}js/vendor/jquery.detect_swipe{$this->suffix}.js",
176 | array( 'jquery' ),
177 | '2.1.4',
178 | true
179 | );
180 |
181 | wp_enqueue_script(
182 | 'featherlight',
183 | "{$this->url}js/vendor/featherlight{$this->suffix}.js",
184 | array( 'jquery-detect-swipe' ),
185 | '1.7.9',
186 | true
187 | );
188 |
189 | wp_enqueue_script(
190 | 'featherlight-gallery',
191 | "{$this->url}js/vendor/featherlight.gallery{$this->suffix}.js",
192 | array( 'featherlight' ),
193 | '1.7.9',
194 | true
195 | );
196 |
197 | wp_enqueue_script(
198 | 'wp-featherlight',
199 | "{$this->url}js/wpFeatherlight{$this->suffix}.js",
200 | array( 'featherlight-gallery' ),
201 | $this->version,
202 | true
203 | );
204 | }
205 |
206 | /**
207 | * Remove all required scripts and styles on entries where the user has
208 | * checked the admin option to disable the lightbox.
209 | *
210 | * @since 0.1.0
211 | * @access public
212 | * @return void
213 | */
214 | public function maybe_disable() {
215 | if ( get_post_meta( get_the_ID(), 'wp_featherlight_disable', true ) ) {
216 | add_filter( 'wp_featherlight_load_css', '__return_false' );
217 | add_filter( 'wp_featherlight_load_js', '__return_false' );
218 | }
219 | }
220 |
221 | /**
222 | * Add custom body classes to help our script enable and disable features
223 | * without creating true plugin database options.
224 | *
225 | * @since 0.3.0
226 | * @access public
227 | * @param array $classes the existing body classes.
228 | * @return array $classes the amended body classes.
229 | */
230 | public function script_helpers( $classes ) {
231 | if ( apply_filters( 'wp_featherlight_captions', true ) ) {
232 | $classes[] = 'wp-featherlight-captions';
233 | }
234 |
235 | return $classes;
236 | }
237 |
238 | /**
239 | * Get the class running!
240 | *
241 | * @since 0.1.0
242 | * @access public
243 | * @return void
244 | */
245 | public function run() {
246 | _deprecated_function( __METHOD__, '1.0.0' );
247 | }
248 |
249 | /**
250 | * Hook into WordPress.
251 | *
252 | * @since 0.1.0
253 | * @access protected
254 | * @return void
255 | */
256 | protected function wp_hooks() {
257 | _deprecated_function( __METHOD__, '1.0.0' );
258 | }
259 | }
260 |
--------------------------------------------------------------------------------
/readme.txt:
--------------------------------------------------------------------------------
1 | === WP Featherlight - A Simple jQuery Lightbox ===
2 |
3 | Contributors: fatmedia, cipherdevgroup, ozzyr
4 | Tags: lightbox, jquery lightbox, jquery, gallery, image, lightbox images, image lightbox, lightbox gallery, lightbox image, lightbox popup, featherlight, photo gallery, popup image, popup images, popup lightbox, responsive lightbox, swipe, wordpress image lightbox, wordpress lightbox, wordpress slideshow lightbox, photography, images, minimal, responsive, photo, photos
5 | Requires at least: 4.0
6 | Tested up to: 5.5.0
7 | Stable tag: 1.3.4
8 | License: GPL-2.0+
9 |
10 | An ultra lightweight jQuery lightbox for WordPress images and galleries.
11 |
12 | == Description ==
13 |
14 | WP Featherlight is a WordPress lightbox plugin for adding a minimal, high-performance, responsive jQuery lightbox to your WordPress website. At its core, WP Featherlight is a WordPress plugin wrapper for the Featherlight jQuery lightbox plugin. When installed, the plugin will automatically display all standard WordPress images and galleries in a simple, minimalistic lightbox popup.
15 |
16 | In order for WordPress images and galleries to be lightboxed, you need to select the "Media File" option when choosing where the thumbnails should link. You can also select the "Custom Link" option if you make sure to link directly to an image file. This should work for any image file, even if it's hosted on another website.
17 |
18 | It's also possible to lightbox videos, iframes, and ajax content with WP Featherlight by adding data attributes to your content. For more details on custom content loading, check out the [featherlight documentation](https://github.com/noelboss/featherlight/#usage).
19 |
20 | There are no settings for WP Featherlight, so you should be able to install it without needing to configure anything. In the event you don't want a lightbox on certain pages or posts, there is an option to disable it from within the post editor screen.
21 |
22 | If you find a display problem, it may be related to your theme but please [open an support request](https://wordpress.org/support/plugin/wp-featherlight) about it so we can look into it. For more information about the Featherlight script itself, check out their [GitHub plugin page](http://noelboss.github.io/featherlight/).
23 |
24 | = Developer Notes =
25 |
26 | While there are no options in the plugin, there are some handy filters to modify the default behavior. As of `0.3.0` all images which use the default WordPress captions will also include a caption when the image is lightboxed. To disable this behavior, filter `wp_featherlight_captions` to false.
27 |
28 | You can also disable inclusion of the CSS and JavaScript conditionally using filters which can be found in the `/includes/class-scripts.php` file. If you have questions about how any part of the plugin works, please don't hesitate to [open an issue on GitHub](https://github.com/cipherdevgroup/wp-featherlight/issues).
29 |
30 | = Contributing =
31 |
32 | If you'd like to submit code patches or contribute in any other way, please [fork the plugin on GitHub](https://github.com/cipherdevgroup/wp-featherlight).
33 |
34 | == Screenshots ==
35 |
36 | 1. A view of the jQuery lightbox in action.
37 |
38 | == Changelog ==
39 |
40 | = 1.3.3 =
41 | This is primarily a maintenance release, but one tweak was made.
42 |
43 | - Tweak: Changed name of meta box title
44 |
45 | = 1.3.2 =
46 | Release to downgrade Featherlight verison until all bugs are worked out.
47 |
48 | - Dev: Updated [Featherlight](https://github.com/noelboss/featherlight/) to `1.7.13`
49 |
50 | = 1.3.1 =
51 | This is primarily a maintenance release, but one new feature has been added. Display the option to disable the lightbox in Gutenberg!
52 |
53 | Here's a full list of what's changed since the last release:
54 |
55 | - Feature: Add back metabox in sidebar
56 | - Dev: Updated [Featherlight](https://github.com/noelboss/featherlight/) to `1.7.14`
57 |
58 | = 1.3.0 =
59 | While primarily a maintenance release, one new feature has been added. WP Featherlight now supports Gutenberg galleries.
60 |
61 | Here's a full list of what's changed since the last release:
62 |
63 | - Feature: Gutenberg support
64 | - Tweak: General code cleanup in plugin
65 | - Dev: Updated [Featherlight](https://github.com/noelboss/featherlight/) to `1.7.13`
66 | - Change of ownership
67 |
68 | = 1.2.0 =
69 | This is primarily a maintenance release, but one new feature has been added. HTML in captions is now supported!
70 |
71 | Here's a full list of what's changed since the last release:
72 |
73 | - Feature: Allowed HTML to be displayed in lightbox image captions
74 | - Dev: Updated [Featherlight](https://github.com/noelboss/featherlight/) to `1.7.9`
75 | - Dev: Updated [jQuery Detect Swipe](http://github.com/marcandre/detect_swipe) to `2.1.4`
76 |
77 | = 1.1.0 =
78 | Thanks to some changes implemented in the core featherlight script, the accessibility of WP Featherlight is now significantly improved. Lightboxed elements now have more appropriate focus management for screen readers and the close button is more accessible.
79 |
80 | This update also fixes a potential plugin compatibly problem in the WordPress admin. In version 1.0, it was possible under unusual circumstances for the plugin to throw a fatal error when attempting to add the disable checkbox to the publish metabox.
81 |
82 | - Tweak: Improved accessibility (accessible close button, better focus management)
83 | - Fix: Prevented a fatal error that could happen when another plugin unsets the WP_Post object on the publish metabox.
84 | - Dev: Updated [Featherlight](https://github.com/noelboss/featherlight/) to `1.7.0`
85 |
86 | = 1.0.0 =
87 | Even though this is a major version change, this is primarily a maintenance release. The reason for the jump to 1.0.0 is because we've changed some code which could break backwards compatibility with custom extensions and integrations.
88 |
89 | If you're just using the plugin on your site and haven't customized it or paid anyone to customize it for you, you should be able to update without any issues.
90 |
91 | If you're a developer and have written custom code extending the PHP side of WP Featherlight, be sure to test your code before updating.
92 |
93 | Under the hood, we've [deprecated some internal methods](https://github.com/cipherdevgroup/wp-featherlight/search?utf8=%E2%9C%93&q=_deprecated_function) which could potentially break custom code which extends WP Featherlight. The changes are primarily limited to class initialization, so unless you were doing something specific to that, it's unlikely that you'll run into issues.
94 |
95 | - Tweak: Improved transition between images within galleries
96 | - Tweak: Moved our disable lightbox checkbox into the publish meta box to streamline the admin
97 | - Tweak: Made styles more aggressive to ensure elements look consistent across different themes by default
98 | - Fix: Reduced false positives for URLs that use image extensions but don't actually link to an image
99 | - Dev: Updated [Featherlight](https://github.com/noelboss/featherlight/) to `1.5.1`
100 | - Dev: Updated [jQuery Detect Swipe](http://github.com/marcandre/detect_swipe) to `2.1.3`
101 | - Dev: Deprecated some internal methods
102 | - Dev: Reorganized how classes are instantiated and plugin actions are fired
103 |
104 | [View the full changelog on GitHub](https://github.com/cipherdevgroup/wp-featherlight/blob/release/CHANGELOG.md)
105 |
--------------------------------------------------------------------------------
/includes/class-plugin.php:
--------------------------------------------------------------------------------
1 | file = $args['file'];
85 | $this->dir = plugin_dir_path( $this->file );
86 | $this->url = plugin_dir_url( $this->file );
87 | }
88 |
89 | /**
90 | * Retrieve the plugin version number.
91 | *
92 | * @since 0.3.0
93 | * @access public
94 | * @return string
95 | */
96 | public function get_version() {
97 | return self::VERSION;
98 | }
99 |
100 | /**
101 | * Retrieve a trailing slashed path to the plugin directory.
102 | *
103 | * @since 0.3.0
104 | * @access public
105 | * @return string
106 | */
107 | public function get_file() {
108 | return $this->file;
109 | }
110 |
111 | /**
112 | * Retrieve a trailing slashed path to the plugin directory.
113 | *
114 | * @since 0.3.0
115 | * @access public
116 | * @return string
117 | */
118 | public function get_dir() {
119 | return $this->dir;
120 | }
121 |
122 | /**
123 | * Retrieve a trailing slashed URL to the plugin directory.
124 | *
125 | * @since 0.3.0
126 | * @access public
127 | * @return string
128 | */
129 | public function get_url() {
130 | return $this->url;
131 | }
132 |
133 | /**
134 | * Require all global plugin files.
135 | *
136 | * @since 0.1.0
137 | * @access protected
138 | * @return void
139 | */
140 | protected function includes() {
141 | require_once $this->dir . 'includes/class-scripts.php';
142 | }
143 |
144 | /**
145 | * Require all admin plugin files.
146 | *
147 | * @since 0.1.0
148 | * @access protected
149 | * @return void
150 | */
151 | protected function admin_includes() {
152 | require_once $this->dir . 'includes/class-i18n.php';
153 | require_once $this->dir . 'admin/class-meta.php';
154 | }
155 |
156 | /**
157 | * Load all required files and get all of our classes running.
158 | *
159 | * @since 0.1.0
160 | * @access protected
161 | * @return void
162 | */
163 | protected function instantiate() {
164 | $this->scripts = new WP_Featherlight_Scripts( $this->url, self::VERSION );
165 | }
166 |
167 | /**
168 | * Load all required files and get all of our classes running.
169 | *
170 | * @since 0.1.0
171 | * @access protected
172 | * @return void
173 | */
174 | protected function admin_instantiate() {
175 | $this->i18n = new WP_Featherlight_Language_Loader( 'wp-featherlight', $this->file );
176 | $this->meta = new WP_Featherlight_Admin_Meta;
177 | $this->meta->run();
178 | }
179 |
180 | /**
181 | * Run all global WordPress hooks.
182 | *
183 | * @since 1.0.0
184 | * @return void
185 | */
186 | protected function wp_hooks() {
187 | /**
188 | * Callback defined in includes/class-scripts.php
189 | *
190 | * @see WP_Featherlight_Scripts::load_css
191 | */
192 | add_action( 'wp_enqueue_scripts', array( $this->scripts, 'load_css' ), 20 );
193 |
194 | /**
195 | * Callback defined in includes/class-scripts.php
196 | *
197 | * @see WP_Featherlight_Scripts::load_js
198 | */
199 | add_action( 'wp_enqueue_scripts', array( $this->scripts, 'load_js' ), 20 );
200 |
201 | /**
202 | * Callback defined in includes/class-scripts.php
203 | *
204 | * @see WP_Featherlight_Scripts::maybe_disable
205 | */
206 | add_action( 'wp_enqueue_scripts', array( $this->scripts, 'maybe_disable' ), 10 );
207 |
208 | /**
209 | * Callback defined in includes/class-scripts.php
210 | *
211 | * @see WP_Featherlight_Scripts::script_helpers
212 | */
213 | add_action( 'body_class', array( $this->scripts, 'script_helpers' ), 10 );
214 | }
215 |
216 | /**
217 | * Run all admin WordPress hooks.
218 | *
219 | * @since 1.0.0
220 | * @return void
221 | */
222 | protected function admin_wp_hooks() {
223 | /**
224 | * Callback defined in includes/class-i18n.php
225 | *
226 | * @see WP_Featherlight_Language_Loader::load
227 | */
228 | add_action( 'admin_head-plugins.php', array( $this->i18n, 'load' ), 10 );
229 |
230 | /**
231 | * Callback defined in includes/class-i18n.php
232 | *
233 | * @see WP_Featherlight_Language_Loader::load
234 | */
235 | add_action( 'post_submitbox_misc_actions', array( $this->i18n, 'load' ), 5 );
236 |
237 | /**
238 | * Callback defined in admin/class-meta.php
239 | *
240 | * @see WP_Featherlight_Admin_Meta::meta_box_view
241 | */
242 | add_action( 'post_submitbox_misc_actions', array( $this->meta, 'meta_box_view' ), 10 );
243 |
244 | /**
245 | * Callback defined in admin/class-meta.php
246 | *
247 | * @see WP_Featherlight_Admin_Meta::save_meta_boxes
248 | */
249 | add_action( 'save_post', array( $this->meta, 'save_meta_boxes' ), 10 );
250 | }
251 |
252 | /**
253 | * Initialize all global functionality.
254 | *
255 | * @since 1.0.0
256 | * @return void
257 | */
258 | public function init() {
259 | /**
260 | * Provide reliable access to the plugin's functions and methods before
261 | * the plugin's global actions, filters, and functionality are initialized.
262 | *
263 | * @since 1.0.0
264 | * @access public
265 | */
266 | do_action( 'wp_featherlight_before_init' );
267 |
268 | $this->includes();
269 | $this->instantiate();
270 | $this->wp_hooks();
271 |
272 | /**
273 | * Provide reliable access to the plugin's functions and methods after
274 | * the plugin's global actions, filters, and functionality are initialized.
275 | *
276 | * @since 1.0.0
277 | * @access public
278 | */
279 | do_action( 'wp_featherlight_after_init' );
280 | }
281 |
282 | /**
283 | * Initialize all admin functionality.
284 | *
285 | * @since 1.0.0
286 | * @return void
287 | */
288 | public function admin_init() {
289 | /**
290 | * Provide reliable access to the plugin's functions and methods before
291 | * the plugin's admin actions, filters, and functionality are initialized.
292 | *
293 | * @since 1.0.0
294 | * @access public
295 | */
296 | do_action( 'wp_featherlight_admin_before_init' );
297 |
298 | $this->admin_includes();
299 | $this->admin_instantiate();
300 | $this->admin_wp_hooks();
301 |
302 | /**
303 | * Provide reliable access to the plugin's functions and methods after
304 | * the plugin's admin actions, filters, and functionality are initialized.
305 | *
306 | * @since 1.0.0
307 | * @access public
308 | */
309 | do_action( 'wp_featherlight_admin_after_init' );
310 | }
311 |
312 | /**
313 | * Initialize the plugin.
314 | *
315 | * @since 0.1.0
316 | * @return void
317 | */
318 | public function run() {
319 | $this->init();
320 | if ( is_admin() ) {
321 | $this->admin_init();
322 | }
323 | }
324 |
325 | /**
326 | * Runs on plugin activation to set a default admin content label for all
327 | * existing posts using the post title.
328 | *
329 | * @since 0.1.0
330 | * @access public
331 | * @return void
332 | */
333 | public function activate() {
334 | // Nothing yet.
335 | }
336 | }
337 |
--------------------------------------------------------------------------------
/js/vendor/featherlight.min.js:
--------------------------------------------------------------------------------
1 | !function(u){"use strict";if(void 0!==u)if(u.fn.jquery.match(/-ajax/))"console"in window&&window.console.info("Featherlight needs regular jQuery, not the slim version.");else{var r=[],i=function(t){return r=u.grep(r,function(e){return e!==t&&0','
','",'
'+n.loading+"
","
","
"].join("")),o="."+n.namespace+"-close"+(n.otherClose?","+n.otherClose:"");return n.$instance=i.clone().addClass(n.variant),n.$instance.on(n.closeTrigger+"."+n.namespace,function(e){if(!e.isDefaultPrevented()){var t=u(e.target);("background"===n.closeOnClick&&t.is("."+n.namespace)||"anywhere"===n.closeOnClick||t.closest(o).length)&&(n.close(e),e.preventDefault())}}),this},getContent:function(){if(!1!==this.persist&&this.$content)return this.$content;var t=this,e=this.constructor.contentFilters,n=function(e){return t.$currentTarget&&t.$currentTarget.attr(e)},r=n(t.targetAttr),i=t.target||r||"",o=e[t.type];if(!o&&i in e&&(o=e[i],i=t.target&&r),i=i||n("href")||"",!o)for(var a in e)t[a]&&(o=e[a],i=t[a]);if(!o){var s=i;if(i=null,u.each(t.contentFilters,function(){return(o=e[this]).test&&(i=o.test(s)),!i&&o.regex&&s.match&&s.match(o.regex)&&(i=s),!i}),!i)return"console"in window&&window.console.error("Featherlight: no content filter found "+(s?' for "'+s+'"':" (no target specified)")),!1}return o.process.call(t,i)},setContent:function(e){return this.$instance.removeClass(this.namespace+"-loading"),this.$instance.toggleClass(this.namespace+"-iframe",e.is("iframe")),this.$instance.find("."+this.namespace+"-inner").not(e).slice(1).remove().end().replaceWith(u.contains(this.$instance[0],e[0])?"":e),this.$content=e.addClass(this.namespace+"-inner"),this},open:function(t){var n=this;if(n.$instance.hide().appendTo(n.root),!(t&&t.isDefaultPrevented()||!1===n.beforeOpen(t))){t&&t.preventDefault();var e=n.getContent();if(e)return r.push(n),s(!0),n.$instance.fadeIn(n.openSpeed),n.beforeContent(t),u.when(e).always(function(e){n.setContent(e),n.afterContent(t)}).then(n.$instance.promise()).done(function(){n.afterOpen(t)})}return n.$instance.detach(),u.Deferred().reject().promise()},close:function(e){var t=this,n=u.Deferred();return!1===t.beforeClose(e)?n.reject():(0===i(t).length&&s(!1),t.$instance.fadeOut(t.closeSpeed,function(){t.$instance.detach(),t.afterClose(e),n.resolve()})),n.promise()},resize:function(e,t){if(e&&t){this.$content.css("width","").css("height","");var n=Math.max(e/(this.$content.parent().width()-1),t/(this.$content.parent().height()-1));1');return n.onload=function(){r.naturalWidth=n.width,r.naturalHeight=n.height,t.resolve(r)},n.onerror=function(){t.reject(r)},n.src=e,t.promise()}},html:{regex:/^\s*<[\w!][^<]*>/,process:function(e){return u(e)}},ajax:{regex:/./,process:function(e){var n=u.Deferred(),r=u("").load(e,function(e,t){"error"!==t&&n.resolve(r.contents()),n.fail()});return n.promise()}},iframe:{process:function(e){var t=new u.Deferred,n=u(""),r=function(e,t){var n={},r=new RegExp("^"+t+"([A-Z])(.*)");for(var i in e){var o=i.match(r);o&&(n[(o[1]+o[2].replace(/([A-Z])/g,"-$1")).toLowerCase()]=e[i])}return n}(this,"iframe"),i=function(e,t){var n={};for(var r in e)r in t&&(n[r]=e[r],delete e[r]);return n}(r,o);return n.hide().attr("src",e).attr(i).css(r).on("load",function(){t.resolve(n.show())}).appendTo(this.$instance.find("."+this.namespace+"-content")),t.promise()}},text:{process:function(e){return u("
"].join("")),a="."+n.namespace+"-close"+(n.otherClose?","+n.otherClose:"");return n.$instance=r.clone().addClass(n.variant),n.$instance.on(n.closeTrigger+"."+n.namespace,function(e){if(!e.isDefaultPrevented()){var t=u(e.target);("background"===n.closeOnClick&&t.is("."+n.namespace)||"anywhere"===n.closeOnClick||t.closest(a).length)&&(n.close(e),e.preventDefault())}}),this},getContent:function(){if(!1!==this.persist&&this.$content)return this.$content;var t=this,e=this.constructor.contentFilters,n=function(e){return t.$currentTarget&&t.$currentTarget.attr(e)},i=n(t.targetAttr),r=t.target||i||"",a=e[t.type];if(!a&&r in e&&(a=e[r],r=t.target&&i),r=r||n("href")||"",!a)for(var o in e)t[o]&&(a=e[o],r=t[o]);if(!a){var s=r;if(r=null,u.each(t.contentFilters,function(){return(a=e[this]).test&&(r=a.test(s)),!r&&a.regex&&s.match&&s.match(a.regex)&&(r=s),!r}),!r)return"console"in window&&window.console.error("Featherlight: no content filter found "+(s?' for "'+s+'"':" (no target specified)")),!1}return a.process.call(t,r)},setContent:function(e){return this.$instance.removeClass(this.namespace+"-loading"),this.$instance.toggleClass(this.namespace+"-iframe",e.is("iframe")),this.$instance.find("."+this.namespace+"-inner").not(e).slice(1).remove().end().replaceWith(u.contains(this.$instance[0],e[0])?"":e),this.$content=e.addClass(this.namespace+"-inner"),this},open:function(t){var n=this;if(n.$instance.hide().appendTo(n.root),!(t&&t.isDefaultPrevented()||!1===n.beforeOpen(t))){t&&t.preventDefault();var e=n.getContent();if(e)return i.push(n),s(!0),n.$instance.fadeIn(n.openSpeed),n.beforeContent(t),u.when(e).always(function(e){n.setContent(e),n.afterContent(t)}).then(n.$instance.promise()).done(function(){n.afterOpen(t)})}return n.$instance.detach(),u.Deferred().reject().promise()},close:function(e){var t=this,n=u.Deferred();return!1===t.beforeClose(e)?n.reject():(0===r(t).length&&s(!1),t.$instance.fadeOut(t.closeSpeed,function(){t.$instance.detach(),t.afterClose(e),n.resolve()})),n.promise()},resize:function(e,t){if(e&&t){this.$content.css("width","").css("height","");var n=Math.max(e/(this.$content.parent().width()-1),t/(this.$content.parent().height()-1));1');return n.onload=function(){i.naturalWidth=n.width,i.naturalHeight=n.height,t.resolve(i)},n.onerror=function(){t.reject(i)},n.src=e,t.promise()}},html:{regex:/^\s*<[\w!][^<]*>/,process:function(e){return u(e)}},ajax:{regex:/./,process:function(e){var n=u.Deferred(),i=u("").load(e,function(e,t){"error"!==t&&n.resolve(i.contents()),n.fail()});return n.promise()}},iframe:{process:function(e){var t=new u.Deferred,n=u(""),i=function(e,t){var n={},i=new RegExp("^"+t+"([A-Z])(.*)");for(var r in e){var a=r.match(i);a&&(n[(a[1]+a[2].replace(/([A-Z])/g,"-$1")).toLowerCase()]=e[r])}return n}(this,"iframe"),r=function(e,t){var n={};for(var i in e)i in t&&(n[i]=e[i],delete e[i]);return n}(i,a);return n.hide().attr("src",e).attr(r).css(i).on("load",function(){t.resolve(n.show())}).appendTo(this.$instance.find("."+this.namespace+"-content")),t.promise()}},text:{process:function(e){return u("