WP Featherlight – A Simple jQuery Lightbox - Version 0.1.1

Version Description

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.

Download this release

Release Info

Developer wpsitecare
Plugin Icon wp plugin WP Featherlight – A Simple jQuery Lightbox
Version 0.1.1
Comparing to
See all releases

Version 0.1.1

Files changed (105) hide show
  1. composer.json +23 -0
  2. composer.lock +113 -0
  3. css/src/.scss-lint.yml +49 -0
  4. css/src/_featherlight.scss +18 -0
  5. css/src/parts/_base.scss +81 -0
  6. css/src/parts/_gallery.scss +75 -0
  7. css/wp-featherlight.css +198 -0
  8. css/wp-featherlight.min.css +1 -0
  9. includes/classes/admin/meta.php +124 -0
  10. includes/classes/scripts.php +188 -0
  11. includes/plugin.php +106 -0
  12. includes/vendor/autoload.php +7 -0
  13. includes/vendor/composer/ClassLoader.php +413 -0
  14. includes/vendor/composer/autoload_classmap.php +9 -0
  15. includes/vendor/composer/autoload_namespaces.php +10 -0
  16. includes/vendor/composer/autoload_psr4.php +9 -0
  17. includes/vendor/composer/autoload_real.php +50 -0
  18. includes/vendor/composer/installed.json +99 -0
  19. includes/vendor/composer/installers/.editorconfig +10 -0
  20. includes/vendor/composer/installers/.gitignore +3 -0
  21. includes/vendor/composer/installers/.travis.yml +14 -0
  22. includes/vendor/composer/installers/LICENSE +19 -0
  23. includes/vendor/composer/installers/README.md +191 -0
  24. includes/vendor/composer/installers/composer.json +77 -0
  25. includes/vendor/composer/installers/phpunit.xml.dist +25 -0
  26. includes/vendor/composer/installers/src/Composer/Installers/AglInstaller.php +21 -0
  27. includes/vendor/composer/installers/src/Composer/Installers/AimeosInstaller.php +9 -0
  28. includes/vendor/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php +11 -0
  29. includes/vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php +45 -0
  30. includes/vendor/composer/installers/src/Composer/Installers/BaseInstaller.php +131 -0
  31. includes/vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php +11 -0
  32. includes/vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php +78 -0
  33. includes/vendor/composer/installers/src/Composer/Installers/ChefInstaller.php +11 -0
  34. includes/vendor/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php +10 -0
  35. includes/vendor/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php +11 -0
  36. includes/vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php +12 -0
  37. includes/vendor/composer/installers/src/Composer/Installers/CraftInstaller.php +9 -0
  38. includes/vendor/composer/installers/src/Composer/Installers/CroogoInstaller.php +21 -0
  39. includes/vendor/composer/installers/src/Composer/Installers/DokuWikiInstaller.php +50 -0
  40. includes/vendor/composer/installers/src/Composer/Installers/DolibarrInstaller.php +16 -0
  41. includes/vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php +14 -0
  42. includes/vendor/composer/installers/src/Composer/Installers/ElggInstaller.php +9 -0
  43. includes/vendor/composer/installers/src/Composer/Installers/FuelInstaller.php +11 -0
  44. includes/vendor/composer/installers/src/Composer/Installers/FuelphpInstaller.php +9 -0
  45. includes/vendor/composer/installers/src/Composer/Installers/GravInstaller.php +30 -0
  46. includes/vendor/composer/installers/src/Composer/Installers/HuradInstaller.php +25 -0
  47. includes/vendor/composer/installers/src/Composer/Installers/Installer.php +163 -0
  48. includes/vendor/composer/installers/src/Composer/Installers/JoomlaInstaller.php +15 -0
  49. includes/vendor/composer/installers/src/Composer/Installers/KirbyInstaller.php +9 -0
  50. includes/vendor/composer/installers/src/Composer/Installers/KohanaInstaller.php +9 -0
  51. includes/vendor/composer/installers/src/Composer/Installers/LaravelInstaller.php +9 -0
  52. includes/vendor/composer/installers/src/Composer/Installers/LithiumInstaller.php +10 -0
  53. includes/vendor/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php +9 -0
  54. includes/vendor/composer/installers/src/Composer/Installers/MODXEvoInstaller.php +16 -0
  55. includes/vendor/composer/installers/src/Composer/Installers/MagentoInstaller.php +11 -0
  56. includes/vendor/composer/installers/src/Composer/Installers/MakoInstaller.php +9 -0
  57. includes/vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php +50 -0
  58. includes/vendor/composer/installers/src/Composer/Installers/MicroweberInstaller.php +111 -0
  59. includes/vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php +47 -0
  60. includes/vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php +46 -0
  61. includes/vendor/composer/installers/src/Composer/Installers/OxidInstaller.php +11 -0
  62. includes/vendor/composer/installers/src/Composer/Installers/PPIInstaller.php +9 -0
  63. includes/vendor/composer/installers/src/Composer/Installers/PhpBBInstaller.php +11 -0
  64. includes/vendor/composer/installers/src/Composer/Installers/PimcoreInstaller.php +21 -0
  65. includes/vendor/composer/installers/src/Composer/Installers/PiwikInstaller.php +32 -0
  66. includes/vendor/composer/installers/src/Composer/Installers/PrestashopInstaller.php +10 -0
  67. includes/vendor/composer/installers/src/Composer/Installers/PuppetInstaller.php +11 -0
  68. includes/vendor/composer/installers/src/Composer/Installers/RedaxoInstaller.php +10 -0
  69. includes/vendor/composer/installers/src/Composer/Installers/RoundcubeInstaller.php +22 -0
  70. includes/vendor/composer/installers/src/Composer/Installers/SMFInstaller.php +10 -0
  71. includes/vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php +58 -0
  72. includes/vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php +36 -0
  73. includes/vendor/composer/installers/src/Composer/Installers/Symfony1Installer.php +26 -0
  74. includes/vendor/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php +14 -0
  75. includes/vendor/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php +38 -0
  76. includes/vendor/composer/installers/src/Composer/Installers/TheliaInstaller.php +12 -0
  77. includes/vendor/composer/installers/src/Composer/Installers/TuskInstaller.php +14 -0
  78. includes/vendor/composer/installers/src/Composer/Installers/WHMCSInstaller.php +10 -0
  79. includes/vendor/composer/installers/src/Composer/Installers/WolfCMSInstaller.php +9 -0
  80. includes/vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php +11 -0
  81. includes/vendor/composer/installers/src/Composer/Installers/ZendInstaller.php +11 -0
  82. includes/vendor/composer/installers/src/Composer/Installers/ZikulaInstaller.php +10 -0
  83. includes/vendor/composer/installers/src/bootstrap.php +13 -0
  84. includes/vendor/composer/installers/tests/Composer/Installers/Test/AsgardInstallerTest.php +61 -0
  85. includes/vendor/composer/installers/tests/Composer/Installers/Test/CakePHPInstallerTest.php +115 -0
  86. includes/vendor/composer/installers/tests/Composer/Installers/Test/DokuWikiInstallerTest.php +89 -0
  87. includes/vendor/composer/installers/tests/Composer/Installers/Test/GravInstallerTest.php +63 -0
  88. includes/vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php +422 -0
  89. includes/vendor/composer/installers/tests/Composer/Installers/Test/MediaWikiInstallerTest.php +66 -0
  90. includes/vendor/composer/installers/tests/Composer/Installers/Test/OctoberInstallerTest.php +66 -0
  91. includes/vendor/composer/installers/tests/Composer/Installers/Test/PimcoreInstallerTest.php +44 -0
  92. includes/vendor/composer/installers/tests/Composer/Installers/Test/PiwikInstallerTest.php +63 -0
  93. includes/vendor/composer/installers/tests/Composer/Installers/Test/TestCase.php +64 -0
  94. includes/vendor/composer/installers/tests/bootstrap.php +4 -0
  95. js/.jscsrc +113 -0
  96. js/.jshintrc +24 -0
  97. js/dist/wpFeatherlight.pkgd.js +846 -0
  98. js/dist/wpFeatherlight.pkgd.min.js +1 -0
  99. js/src/vendor/featherlight.gallery.js +150 -0
  100. js/src/vendor/featherlight.js +530 -0
  101. js/src/vendor/jquery.detect_swipe.js +72 -0
  102. js/src/wpFeatherlight.js +88 -0
  103. readme.txt +34 -0
  104. templates/admin/metabox-sidebar.php +18 -0
  105. wp-featherlight.php +72 -0
composer.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "wpsitecare/wp-featherlight",
3
+ "description": "An ultra lightweight jQuery lightbox for WordPress images and galleries.",
4
+ "type": "wordpress-plugin",
5
+ "homepage" : "http://www.wpsitecare.com",
6
+ "license" : "GPL-2.0+",
7
+ "authors" : [
8
+ {
9
+ "name" : "Robert Neu",
10
+ "email" : "rob@wpsitecare.com",
11
+ "homepage" : "http://www.wpsitecare.com"
12
+ }
13
+ ],
14
+ "support" : {
15
+ "issues" : "https://github.com/wpsitecare/wp-featherlight/issues"
16
+ },
17
+ "config": {
18
+ "vendor-dir": "includes/vendor"
19
+ },
20
+ "require": {
21
+ "composer/installers": "~1.0"
22
+ }
23
+ }
composer.lock ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_readme": [
3
+ "This file locks the dependencies of your project to a known state",
4
+ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5
+ "This file is @generated automatically"
6
+ ],
7
+ "hash": "0d1186212214fbaa4e5f713507762659",
8
+ "packages": [
9
+ {
10
+ "name": "composer/installers",
11
+ "version": "v1.0.21",
12
+ "source": {
13
+ "type": "git",
14
+ "url": "https://github.com/composer/installers.git",
15
+ "reference": "d64e23fce42a4063d63262b19b8e7c0f3b5e4c45"
16
+ },
17
+ "dist": {
18
+ "type": "zip",
19
+ "url": "https://api.github.com/repos/composer/installers/zipball/d64e23fce42a4063d63262b19b8e7c0f3b5e4c45",
20
+ "reference": "d64e23fce42a4063d63262b19b8e7c0f3b5e4c45",
21
+ "shasum": ""
22
+ },
23
+ "replace": {
24
+ "roundcube/plugin-installer": "*",
25
+ "shama/baton": "*"
26
+ },
27
+ "require-dev": {
28
+ "composer/composer": "1.0.*@dev",
29
+ "phpunit/phpunit": "4.1.*"
30
+ },
31
+ "type": "composer-installer",
32
+ "extra": {
33
+ "class": "Composer\\Installers\\Installer",
34
+ "branch-alias": {
35
+ "dev-master": "1.0-dev"
36
+ }
37
+ },
38
+ "autoload": {
39
+ "psr-0": {
40
+ "Composer\\Installers\\": "src/"
41
+ }
42
+ },
43
+ "notification-url": "https://packagist.org/downloads/",
44
+ "license": [
45
+ "MIT"
46
+ ],
47
+ "authors": [
48
+ {
49
+ "name": "Kyle Robinson Young",
50
+ "email": "kyle@dontkry.com",
51
+ "homepage": "https://github.com/shama"
52
+ }
53
+ ],
54
+ "description": "A multi-framework Composer library installer",
55
+ "homepage": "http://composer.github.com/installers/",
56
+ "keywords": [
57
+ "Craft",
58
+ "Dolibarr",
59
+ "Hurad",
60
+ "MODX Evo",
61
+ "OXID",
62
+ "SMF",
63
+ "Thelia",
64
+ "WolfCMS",
65
+ "agl",
66
+ "aimeos",
67
+ "annotatecms",
68
+ "bitrix",
69
+ "cakephp",
70
+ "chef",
71
+ "codeigniter",
72
+ "concrete5",
73
+ "croogo",
74
+ "dokuwiki",
75
+ "drupal",
76
+ "elgg",
77
+ "fuelphp",
78
+ "grav",
79
+ "installer",
80
+ "joomla",
81
+ "kohana",
82
+ "laravel",
83
+ "lithium",
84
+ "magento",
85
+ "mako",
86
+ "mediawiki",
87
+ "modulework",
88
+ "moodle",
89
+ "phpbb",
90
+ "piwik",
91
+ "ppi",
92
+ "puppet",
93
+ "roundcube",
94
+ "shopware",
95
+ "silverstripe",
96
+ "symfony",
97
+ "typo3",
98
+ "wordpress",
99
+ "zend",
100
+ "zikula"
101
+ ],
102
+ "time": "2015-02-18 17:17:01"
103
+ }
104
+ ],
105
+ "packages-dev": [],
106
+ "aliases": [],
107
+ "minimum-stability": "stable",
108
+ "stability-flags": [],
109
+ "prefer-stable": false,
110
+ "prefer-lowest": false,
111
+ "platform": [],
112
+ "platform-dev": []
113
+ }
css/src/.scss-lint.yml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Default application configuration that all configurations inherit from:
2
+ # https://github.com/causes/scss-lint/blob/master/config/default.yml
3
+
4
+ linters:
5
+ Comment:
6
+ enabled: false # False since style.dev.css should also contain heading comments
7
+
8
+ IdSelector:
9
+ exclude: # These files have ID selectors because of WordPress or plugins.
10
+ - 'scss/partials/_common-classes.scss'
11
+ - 'scss/partials/_jetpack.scss'
12
+
13
+ Indentation:
14
+ character: tab
15
+ width: 1 # Set to one, as tabs are used, not spaces.
16
+
17
+ LeadingZero:
18
+ style: include_zero
19
+
20
+ PropertySortOrder:
21
+ enabled: false # To be handled with CSSComb
22
+
23
+ QualifyingElement:
24
+ allow_element_with_attribute: true
25
+ exclude: # These files currently have qualifying elements
26
+ - 'scss/partials/_common-classes.scss'
27
+ - 'scss/partials/_plugins.scss'
28
+ - 'scss/partials/_jetpack.scss'
29
+ - 'scss/partials/_reset.scss'
30
+
31
+ SelectorDepth:
32
+ enabled: false
33
+
34
+ SelectorFormat:
35
+ exclude: # These files have underscore selectors because of WordPress or plugins.
36
+ - 'scss/partials/_plugins.scss'
37
+ - 'scss/partials/_jetpack.scss'
38
+ - 'scss/partials/_sidebars.scss'
39
+ - 'scss/partials/_theme-icons.scss'
40
+ - 'scss/partials/_widgets.scss'
41
+
42
+ SingleLinePerProperty:
43
+ allow_single_line_rule_sets: false
44
+
45
+ StringQuotes:
46
+ style: double_quotes
47
+
48
+ UrlQuotes:
49
+ enabled: false
css/src/_featherlight.scss ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Featherlight - ultra slim jQuery lightbox
3
+ * Version 1.2.3 - http://noelboss.github.io/featherlight/
4
+ *
5
+ * Copyright 2015, Noel Raoul Bossart (http://www.noelboss.com)
6
+ * MIT Licensed.
7
+ */
8
+ @import "parts/base";
9
+
10
+
11
+ /**
12
+ * Featherlight Gallery - an extension for the ultra slim jQuery lightbox
13
+ * Version 1.2.3 - http://noelboss.github.io/featherlight/
14
+ *
15
+ * Copyright 2015, Noel Raoul Bossart (http://www.noelboss.com)
16
+ * MIT Licensed.
17
+ */
18
+ @import "parts/gallery";
css/src/parts/_base.scss ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .featherlight {
2
+ display: none;
3
+ position: fixed;
4
+ top: 0;
5
+ right: 0;
6
+ bottom: 0;
7
+ left: 0;
8
+ z-index: 2147483647;
9
+ text-align: center;
10
+ white-space: nowrap;
11
+ cursor: pointer;
12
+ background: rgba(0, 0, 0, 0);
13
+
14
+ * {
15
+ box-sizing: border-box;
16
+ }
17
+
18
+ &:last-of-type {
19
+ background: rgba(0, 0, 0, 0.8);
20
+ }
21
+
22
+ &:before {
23
+ content: "";
24
+ display: inline-block;
25
+ height: 100%;
26
+ vertical-align: middle;
27
+ margin-right: -0.25em;
28
+ }
29
+
30
+ .featherlight-content {
31
+ background: #fff;
32
+ position: relative;
33
+ text-align: left;
34
+ vertical-align: middle;
35
+ display: inline-block;
36
+ overflow: auto;
37
+ padding: 0;
38
+ border: 0;
39
+ min-width: inherit;
40
+ max-height: 95%;
41
+ max-width: 90%;
42
+ cursor: auto;
43
+ white-space: normal;
44
+ }
45
+
46
+ .featherlight-inner {
47
+ display: block;
48
+ }
49
+
50
+ .featherlight-close-icon {
51
+ position: absolute;
52
+ z-index: 9999;
53
+ top: 0;
54
+ right: 0;
55
+ line-height: 25px;
56
+ width: 20px;
57
+ cursor: pointer;
58
+ text-align: center;
59
+ font: Arial, sans-serif;
60
+ background: rgba(255, 255, 255, 0.3);
61
+ color: #000;
62
+ }
63
+
64
+ .featherlight-image {
65
+ max-width: 100%;
66
+ border: 20px solid #fff;
67
+
68
+ @media only screen and (max-width: 1024px) {
69
+ border: 10px solid #fff;
70
+ }
71
+ }
72
+
73
+ iframe {
74
+ border: 0;
75
+ }
76
+ }
77
+
78
+ .featherlight-iframe .featherlight-content {
79
+ border-bottom: 0;
80
+ padding: 0;
81
+ }
css/src/parts/_gallery.scss ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .featherlight-next,
2
+ .featherlight-previous {
3
+ background: rgba(0, 0, 0, 0); // IE9 hack to fix navigation display
4
+ display: block;
5
+ position: absolute;
6
+ top: 20px;
7
+ right: 20px;
8
+ bottom: 0;
9
+ left: 80%;
10
+ cursor: pointer;
11
+ user-select: none;
12
+
13
+ @media only screen and (max-width: 1024px) {
14
+ top: 10px;
15
+ right: 10px;
16
+ left: 85%;
17
+ }
18
+
19
+ &:hover,
20
+ &:focus {
21
+ background: rgba(255, 255, 255, 0.25);
22
+
23
+ @media only screen and (max-width: 1024px) {
24
+ background: none;
25
+ }
26
+
27
+ span {
28
+ display: inline-block;
29
+ }
30
+ }
31
+
32
+ span {
33
+ display: none;
34
+ position: absolute;
35
+ top: 50%;
36
+ left: 5%;
37
+ width: 82%;
38
+ text-align: center;
39
+ font-size: 80px;
40
+ line-height: 80px;
41
+ margin-top: -40px;
42
+ text-shadow: 0 0 5px #fff;
43
+ color: #fff;
44
+ font-style: normal;
45
+ font-weight: normal;
46
+
47
+ @media only screen and (max-width: 1024px) {
48
+ display: block;
49
+ margin-top: -30px;
50
+ font-size: 40px;
51
+ }
52
+ }
53
+ }
54
+
55
+ .featherlight-previous {
56
+ left: 20px;
57
+ right: 80%;
58
+
59
+ @media only screen and (max-width: 1024px) {
60
+ left: 10px;
61
+ right: 85%;
62
+ }
63
+ }
64
+
65
+ .featherlight-next span {
66
+ right: 5%;
67
+ left: auto;
68
+ }
69
+
70
+ .featherlight-loading {
71
+ .featherlight-previous,
72
+ .featherlight-next {
73
+ display: none;
74
+ }
75
+ }
css/wp-featherlight.css ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Featherlight - ultra slim jQuery lightbox
3
+ * Version 1.2.3 - http://noelboss.github.io/featherlight/
4
+ *
5
+ * Copyright 2015, Noel Raoul Bossart (http://www.noelboss.com)
6
+ * MIT Licensed.
7
+ */
8
+
9
+ .featherlight {
10
+ background: transparent;
11
+ cursor: pointer;
12
+ display: none;
13
+ position: fixed;
14
+ top: 0;
15
+ right: 0;
16
+ bottom: 0;
17
+ left: 0;
18
+ text-align: center;
19
+ white-space: nowrap;
20
+ z-index: 2147483647;
21
+ }
22
+
23
+ .featherlight * {
24
+ -moz-box-sizing: border-box;
25
+ -webkit-box-sizing: border-box;
26
+ box-sizing: border-box;
27
+ }
28
+
29
+ .featherlight:last-of-type {
30
+ background: rgba(0, 0, 0, 0.8);
31
+ }
32
+
33
+ .featherlight:before {
34
+ content: "";
35
+ display: inline-block;
36
+ height: 100%;
37
+ margin-right: -0.25em;
38
+ vertical-align: middle;
39
+ }
40
+
41
+ .featherlight .featherlight-content {
42
+ background: #fff;
43
+ border: 0;
44
+ cursor: auto;
45
+ display: inline-block;
46
+ max-height: 95%;
47
+ max-width: 90%;
48
+ min-width: inherit;
49
+ overflow: auto;
50
+ padding: 0;
51
+ position: relative;
52
+ text-align: left;
53
+ vertical-align: middle;
54
+ white-space: normal;
55
+ }
56
+
57
+ .featherlight .featherlight-inner {
58
+ display: block;
59
+ }
60
+
61
+ .featherlight .featherlight-close-icon {
62
+ background: rgba(255, 255, 255, 0.3);
63
+ color: #000;
64
+ cursor: pointer;
65
+ font: Arial, sans-serif;
66
+ line-height: 25px;
67
+ position: absolute;
68
+ top: 0;
69
+ right: 0;
70
+ text-align: center;
71
+ width: 20px;
72
+ z-index: 9999;
73
+ }
74
+
75
+ .featherlight .featherlight-image {
76
+ border: 20px solid #fff;
77
+ max-width: 100%;
78
+ }
79
+
80
+ @media only screen and (max-width: 1024px) {
81
+ .featherlight .featherlight-image {
82
+ border: 10px solid #fff;
83
+ }
84
+ }
85
+
86
+ .featherlight iframe {
87
+ border: 0;
88
+ }
89
+
90
+ .featherlight-iframe .featherlight-content {
91
+ border-bottom: 0;
92
+ padding: 0;
93
+ }
94
+
95
+
96
+ /**
97
+ * Featherlight Gallery - an extension for the ultra slim jQuery lightbox
98
+ * Version 1.2.3 - http://noelboss.github.io/featherlight/
99
+ *
100
+ * Copyright 2015, Noel Raoul Bossart (http://www.noelboss.com)
101
+ * MIT Licensed.
102
+ */
103
+
104
+ .featherlight-next,
105
+ .featherlight-previous {
106
+ background: transparent;
107
+ cursor: pointer;
108
+ display: block;
109
+ position: absolute;
110
+ top: 20px;
111
+ right: 20px;
112
+ bottom: 0;
113
+ left: 80%;
114
+ -moz-user-select: none;
115
+ -ms-user-select: none;
116
+ -webkit-user-select: none;
117
+ user-select: none;
118
+ }
119
+
120
+ @media only screen and (max-width: 1024px) {
121
+ .featherlight-next,
122
+ .featherlight-previous {
123
+ top: 10px;
124
+ right: 10px;
125
+ left: 85%;
126
+ }
127
+ }
128
+
129
+ .featherlight-next:hover,
130
+ .featherlight-next:focus,
131
+ .featherlight-previous:hover,
132
+ .featherlight-previous:focus {
133
+ background: rgba(255, 255, 255, 0.25);
134
+ }
135
+
136
+ @media only screen and (max-width: 1024px) {
137
+ .featherlight-next:hover,
138
+ .featherlight-next:focus,
139
+ .featherlight-previous:hover,
140
+ .featherlight-previous:focus {
141
+ background: none;
142
+ }
143
+ }
144
+
145
+ .featherlight-next:hover span,
146
+ .featherlight-next:focus span,
147
+ .featherlight-previous:hover span,
148
+ .featherlight-previous:focus span {
149
+ display: inline-block;
150
+ }
151
+
152
+ .featherlight-next span,
153
+ .featherlight-previous span {
154
+ color: #fff;
155
+ display: none;
156
+ font-size: 80px;
157
+ font-style: normal;
158
+ font-weight: normal;
159
+ line-height: 80px;
160
+ margin-top: -40px;
161
+ position: absolute;
162
+ top: 50%;
163
+ left: 5%;
164
+ text-align: center;
165
+ text-shadow: 0 0 5px #fff;
166
+ width: 82%;
167
+ }
168
+
169
+ @media only screen and (max-width: 1024px) {
170
+ .featherlight-next span,
171
+ .featherlight-previous span {
172
+ display: block;
173
+ font-size: 40px;
174
+ margin-top: -30px;
175
+ }
176
+ }
177
+
178
+ .featherlight-previous {
179
+ right: 80%;
180
+ left: 20px;
181
+ }
182
+
183
+ @media only screen and (max-width: 1024px) {
184
+ .featherlight-previous {
185
+ right: 85%;
186
+ left: 10px;
187
+ }
188
+ }
189
+
190
+ .featherlight-next span {
191
+ right: 5%;
192
+ left: auto;
193
+ }
194
+
195
+ .featherlight-loading .featherlight-previous,
196
+ .featherlight-loading .featherlight-next {
197
+ display: none;
198
+ }
css/wp-featherlight.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .featherlight{background:transparent;cursor:pointer;display:none;position:fixed;top:0;right:0;bottom:0;left:0;text-align:center;white-space:nowrap;z-index:2147483647}.featherlight *{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.featherlight:last-of-type{background:rgba(0,0,0,0.8)}.featherlight:before{content:"";display:inline-block;height:100%;margin-right:-0.25em;vertical-align:middle}.featherlight .featherlight-content{background:#fff;border:0;cursor:auto;display:inline-block;max-height:95%;max-width:90%;min-width:inherit;overflow:auto;padding:0;position:relative;text-align:left;vertical-align:middle;white-space:normal}.featherlight .featherlight-inner{display:block}.featherlight .featherlight-close-icon{background:rgba(255,255,255,0.3);color:#000;cursor:pointer;font:Arial,sans-serif;line-height:25px;position:absolute;top:0;right:0;text-align:center;width:20px;z-index:9999}.featherlight .featherlight-image{border:20px solid #fff;max-width:100%}@media only screen and (max-width:1024px){.featherlight .featherlight-image{border:10px solid #fff}}.featherlight iframe{border:0}.featherlight-iframe .featherlight-content{border-bottom:0;padding:0}.featherlight-next,.featherlight-previous{background:transparent;cursor:pointer;display:block;position:absolute;top:20px;right:20px;bottom:0;left:80%;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;user-select:none}@media only screen and (max-width:1024px){.featherlight-next,.featherlight-previous{top:10px;right:10px;left:85%}}.featherlight-next:hover,.featherlight-next:focus,.featherlight-previous:hover,.featherlight-previous:focus{background:rgba(255,255,255,0.25)}@media only screen and (max-width:1024px){.featherlight-next:hover,.featherlight-next:focus,.featherlight-previous:hover,.featherlight-previous:focus{background:0}}.featherlight-next:hover span,.featherlight-next:focus span,.featherlight-previous:hover span,.featherlight-previous:focus span{display:inline-block}.featherlight-next span,.featherlight-previous span{color:#fff;display:none;font-size:80px;font-style:normal;font-weight:normal;line-height:80px;margin-top:-40px;position:absolute;top:50%;left:5%;text-align:center;text-shadow:0 0 5px #fff;width:82%}@media only screen and (max-width:1024px){.featherlight-next span,.featherlight-previous span{display:block;font-size:40px;margin-top:-30px}}.featherlight-previous{right:80%;left:20px}@media only screen and (max-width:1024px){.featherlight-previous{right:85%;left:10px}}.featherlight-next span{right:5%;left:auto}.featherlight-loading .featherlight-previous,.featherlight-loading .featherlight-next{display:none}
includes/classes/admin/meta.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Methods used for adding and saving meta data for WP Featherlight.
4
+ *
5
+ * @package WPFeatherlight
6
+ * @author Robert Neu
7
+ * @copyright Copyright (c) 2015, Robert Neu
8
+ * @license GPL-2.0+
9
+ * @since 0.1.0
10
+ */
11
+
12
+ // Prevent direct access.
13
+ defined( 'ABSPATH' ) || exit;
14
+
15
+ class WP_Featherlight_Admin_Meta {
16
+
17
+ /**
18
+ * Get the class running!
19
+ *
20
+ * @since 0.1.0
21
+ * @access public
22
+ * @return void
23
+ */
24
+ public function run() {
25
+ self::wp_hooks();
26
+ }
27
+
28
+ /**
29
+ * Hook into WordPress.
30
+ *
31
+ * @since 0.1.0
32
+ * @access protected
33
+ * @return void
34
+ */
35
+ protected function wp_hooks() {
36
+ add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
37
+ add_action( 'save_post', array( $this, 'save_meta_boxes' ) );
38
+ }
39
+
40
+ /**
41
+ * Helper function to determine if an automated task which should prevent
42
+ * saving meta box data is running.
43
+ *
44
+ * @since 0.1.0
45
+ * @access protected
46
+ * @return void
47
+ */
48
+ protected function stop_save() {
49
+ $stops = array(
50
+ defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE,
51
+ defined( 'DOING_AJAX' ) && DOING_AJAX,
52
+ defined( 'DOING_CRON' ) && DOING_CRON,
53
+ );
54
+ return in_array( true, $stops );
55
+ }
56
+
57
+ /**
58
+ * Adds a simple metabox to disable the after entry widget areas.
59
+ *
60
+ * @since 1.0.0
61
+ * @access public
62
+ * @return void
63
+ */
64
+ public function add_meta_boxes( $post_type ) {
65
+ add_meta_box(
66
+ 'wp_featherlight_options',
67
+ __( 'WP Featherlight Options', 'wp-featherlight' ),
68
+ array( $this, 'options_callback' ),
69
+ null,
70
+ 'side'
71
+ );
72
+ }
73
+
74
+ /**
75
+ * Outputs the content of our disable after-entry metabox.
76
+ *
77
+ * @since 1.0.0
78
+ * @access public
79
+ * @return void
80
+ */
81
+ public function options_callback( $post ) {
82
+ if ( ! is_object( $post ) ) {
83
+ return;
84
+ }
85
+ $type = get_post_type_object( $post->post_type );
86
+ $name = $type->labels->singular_name;
87
+ $disable = get_post_meta( $post->ID, 'wp_featherlight_disable', true );
88
+ $checked = '';
89
+ if ( ! empty( $disable ) ) {
90
+ $checked = $disable;
91
+ }
92
+ require_once WP_FEATHERLIGHT_DIR . 'templates/admin/metabox-sidebar.php';
93
+ }
94
+
95
+ /**
96
+ * Callback function for saving our testimonial details meta box data.
97
+ * Handles data validation and sanitization for our content label.
98
+ *
99
+ * @since 0.1.0
100
+ * @access public
101
+ * @return void
102
+ */
103
+ public function save_meta_boxes( $post_id ) {
104
+ // Bail if something is in progress.
105
+ if ( $this->stop_save() ) {
106
+ return;
107
+ }
108
+
109
+ $nonce = '';
110
+ if ( isset( $_POST['wp_featherlight_nonce'] ) ) {
111
+ $nonce = $_POST['wp_featherlight_nonce'];
112
+ }
113
+
114
+ // Bail if we can't verify the nonce.
115
+ if ( ! wp_verify_nonce( $nonce, plugin_basename( WP_FEATHERLIGHT_FILE ) ) ) {
116
+ return;
117
+ }
118
+
119
+ $disable = isset( $_POST['wp_featherlight_disable'] ) ? 'yes' : '';
120
+
121
+ update_post_meta( $post_id, 'wp_featherlight_disable', $disable );
122
+ }
123
+
124
+ }
includes/classes/scripts.php ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Methods used for filtering and displaying WP Featherlight images.
4
+ *
5
+ * @package WPFeatherlight
6
+ * @author Robert Neu
7
+ * @copyright Copyright (c) 2015, Robert Neu
8
+ * @license GPL-2.0+
9
+ * @since 0.1.0
10
+ */
11
+
12
+ // Prevent direct access.
13
+ defined( 'ABSPATH' ) || exit;
14
+
15
+ class WP_Featherlight_Scripts {
16
+
17
+ protected $suffix;
18
+
19
+ /**
20
+ * Get the class running!
21
+ *
22
+ * @since 0.1.0
23
+ * @access public
24
+ * @return void
25
+ */
26
+ public function run() {
27
+ $this->suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
28
+ self::wp_hooks();
29
+ }
30
+
31
+ /**
32
+ * Hook into WordPress.
33
+ *
34
+ * @since 0.1.0
35
+ * @access public
36
+ * @return void
37
+ */
38
+ protected function wp_hooks() {
39
+ add_action( 'wp_enqueue_scripts', array( $this, 'load_css' ), 20 );
40
+ add_action( 'wp_enqueue_scripts', array( $this, 'load_js' ), 20 );
41
+ add_action( 'wp_enqueue_scripts', array( $this, 'maybe_disable' ) );
42
+ }
43
+
44
+ /**
45
+ * Load all required CSS files on the front end.
46
+ *
47
+ * Developers can disable our CSS by filtering wp_featherlight_load_css to
48
+ * false within their theme or plugin.
49
+ *
50
+ * @since 0.1.0
51
+ * @access public
52
+ * @return void
53
+ */
54
+ public function load_css() {
55
+ if ( ! apply_filters( 'wp_featherlight_load_css', true ) ) {
56
+ return;
57
+ }
58
+ wp_enqueue_style(
59
+ 'wp-feahterlight',
60
+ WP_FEATHERLIGHT_URL . "css/wp-featherlight{$this->suffix}.css",
61
+ array(),
62
+ WP_FEATHERLIGHT_VERSION
63
+ );
64
+ }
65
+
66
+ /**
67
+ * Load all required JavaScript files on the front end.
68
+ *
69
+ * Developers can disable our JS by filtering wp_featherlight_load_js to
70
+ * false within their theme or plugin.
71
+ *
72
+ * @since 0.1.0
73
+ * @access public
74
+ * @return void
75
+ */
76
+ public function load_js() {
77
+ if ( ! apply_filters( 'wp_featherlight_load_js', true ) ) {
78
+ return;
79
+ }
80
+ $this->load_packed_js();
81
+ $this->load_unpacked_js();
82
+ }
83
+
84
+ /**
85
+ * Helper function to determine whether or not to load a packed version of
86
+ * our JavaScript libraries on the front end.
87
+ *
88
+ * Developers can filter wp_featherlight_enable_packed_js to false if they
89
+ * are loading any of the following libraries in their theme or plugin:
90
+ *
91
+ * http://noelboss.github.io/featherlight/
92
+ * http://noelboss.github.io/featherlight/gallery.html
93
+ * https://github.com/marcandre/detect_swipe
94
+ *
95
+ * @since 0.1.0
96
+ * @access protected
97
+ * @return bool
98
+ */
99
+ protected function enable_packed_js() {
100
+ // Never pack JS files if SCRIPT_DEBUG is enabled.
101
+ if ( empty( $this->suffix ) ) {
102
+ return false;
103
+ }
104
+ return apply_filters( 'wp_featherlight_enable_packed_js', true );
105
+ }
106
+
107
+ /**
108
+ * Load the packed and minified version of our JavaScript files. This is the
109
+ * preferred loading method as it saves us from adding a bunch of http
110
+ * requests, but it could create conflicts with some plugins and themes.
111
+ *
112
+ * @since 0.1.0
113
+ * @access public
114
+ * @return void
115
+ */
116
+ public function load_packed_js() {
117
+ if ( ! $this->enable_packed_js() ) {
118
+ return;
119
+ }
120
+ wp_enqueue_script(
121
+ 'wp-featherlight',
122
+ WP_FEATHERLIGHT_URL . "js/dist/wpFeatherlight.pkgd{$this->suffix}.js",
123
+ array( 'jquery' ),
124
+ WP_FEATHERLIGHT_VERSION,
125
+ true
126
+ );
127
+ }
128
+
129
+ /**
130
+ * Load all of our JS files individually to for maximum compatibility.
131
+ *
132
+ * @todo Add logic to use minified versions of scripts when not debugging.
133
+ *
134
+ * @since 0.1.0
135
+ * @access public
136
+ * @return void
137
+ */
138
+ public function load_unpacked_js() {
139
+ if ( $this->enable_packed_js() ) {
140
+ return;
141
+ }
142
+ $url = WP_FEATHERLIGHT_URL . 'js/src/';
143
+ wp_enqueue_script(
144
+ 'jquery-detect-swipe',
145
+ $url . 'vendor/jquery.detect_swipe.js',
146
+ array( 'jquery' ),
147
+ '2.0.4',
148
+ true
149
+ );
150
+ wp_enqueue_script(
151
+ 'featherlight',
152
+ $url . 'vendor/featherlight.js',
153
+ array( 'jquery-detect-swipe' ),
154
+ '1.2.3',
155
+ true
156
+ );
157
+ wp_enqueue_script(
158
+ 'featherlight-gallery',
159
+ $url . 'vendor/featherlight.gallery.js',
160
+ array( 'featherlight' ),
161
+ '1.2.3',
162
+ true
163
+ );
164
+ wp_enqueue_script(
165
+ 'wp-featherlight',
166
+ $url . 'wpFeatherlight.js',
167
+ array( 'featherlight-gallery' ),
168
+ WP_FEATHERLIGHT_VERSION,
169
+ true
170
+ );
171
+ }
172
+
173
+ /**
174
+ * Remove all required scripts and styles on entries where the user has
175
+ * checked the admin option to disable the lightbox.
176
+ *
177
+ * @since 0.1.0
178
+ * @access public
179
+ * @return void
180
+ */
181
+ public function maybe_disable() {
182
+ if ( get_post_meta( get_the_ID(), 'wp_featherlight_disable', true ) ) {
183
+ add_filter( 'wp_featherlight_load_css', '__return_false' );
184
+ add_filter( 'wp_featherlight_load_js', '__return_false' );
185
+ }
186
+ }
187
+
188
+ }
includes/plugin.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Enhanced User Profiles main plugin class.
4
+ *
5
+ * @package WPFeatherlight
6
+ * @author Robert Neu
7
+ * @copyright Copyright (c) 2015, Robert Neu
8
+ * @license GPL-2.0+
9
+ * @since 0.1.0
10
+ */
11
+
12
+ // Prevent direct access.
13
+ defined( 'ABSPATH' ) || exit;
14
+
15
+ /**
16
+ * Main plugin class.
17
+ */
18
+ class WP_Featherlight {
19
+
20
+ /**
21
+ * An empty placeholder for referencing the scripts class.
22
+ *
23
+ * @since 0.1.0
24
+ * @var object
25
+ */
26
+ public $scripts;
27
+
28
+ /**
29
+ * An empty placeholder for referencing the meta class.
30
+ *
31
+ * @since 0.1.0
32
+ * @var object
33
+ */
34
+ public $meta;
35
+
36
+ /**
37
+ * Method to initialize the plugin.
38
+ *
39
+ * @since 0.1.0
40
+ * @return void
41
+ */
42
+ public function run() {
43
+ self::load_textdomain();
44
+ self::includes();
45
+ self::instantiate();
46
+ }
47
+
48
+ /**
49
+ * Loads the plugin language files
50
+ *
51
+ * @since 0.1.0
52
+ * @access public
53
+ * @return void
54
+ */
55
+ public function load_textdomain() {
56
+ load_plugin_textdomain(
57
+ 'wp-featherlight',
58
+ false,
59
+ apply_filters( 'wp_featherlight_lang_directory', WP_FEATHERLIGHT_DIR . 'languages/' )
60
+ );
61
+ }
62
+
63
+ /**
64
+ * Require all plugin files.
65
+ *
66
+ * @since 0.1.0
67
+ * @access private
68
+ * @return void
69
+ */
70
+ private function includes() {
71
+ $includes_dir = WP_FEATHERLIGHT_DIR . 'includes/';
72
+ require_once $includes_dir . 'classes/scripts.php';
73
+ require_once $includes_dir . 'classes/admin/meta.php';
74
+ }
75
+
76
+ /**
77
+ * Load all required files and get all of our classes running.
78
+ *
79
+ * @since 0.1.0
80
+ * @access public
81
+ * @return void
82
+ */
83
+ private function instantiate() {
84
+ $this->scripts = new WP_Featherlight_Scripts;
85
+ $this->scripts->run();
86
+ if ( ! is_admin() ) {
87
+ return;
88
+ }
89
+ $this->meta = new WP_Featherlight_Admin_Meta;
90
+ $this->meta->run();
91
+ }
92
+
93
+ /**
94
+ * Runs on plugin activation to set a default admin content label for all
95
+ * existing posts using the post title.
96
+ *
97
+ * @since 0.1.0
98
+ * @access public
99
+ * @global $wpdb
100
+ * @return void
101
+ */
102
+ public function activate() {
103
+ // Nothing yet.
104
+ }
105
+
106
+ }
includes/vendor/autoload.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload.php @generated by Composer
4
+
5
+ require_once __DIR__ . '/composer' . '/autoload_real.php';
6
+
7
+ return ComposerAutoloaderInit3bb75807e81292dee13fe8a3526e0777::getLoader();
includes/vendor/composer/ClassLoader.php ADDED
@@ -0,0 +1,413 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Composer.
5
+ *
6
+ * (c) Nils Adermann <naderman@naderman.de>
7
+ * Jordi Boggiano <j.boggiano@seld.be>
8
+ *
9
+ * For the full copyright and license information, please view the LICENSE
10
+ * file that was distributed with this source code.
11
+ */
12
+
13
+ namespace Composer\Autoload;
14
+
15
+ /**
16
+ * ClassLoader implements a PSR-0 class loader
17
+ *
18
+ * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
19
+ *
20
+ * $loader = new \Composer\Autoload\ClassLoader();
21
+ *
22
+ * // register classes with namespaces
23
+ * $loader->add('Symfony\Component', __DIR__.'/component');
24
+ * $loader->add('Symfony', __DIR__.'/framework');
25
+ *
26
+ * // activate the autoloader
27
+ * $loader->register();
28
+ *
29
+ * // to enable searching the include path (eg. for PEAR packages)
30
+ * $loader->setUseIncludePath(true);
31
+ *
32
+ * In this example, if you try to use a class in the Symfony\Component
33
+ * namespace or one of its children (Symfony\Component\Console for instance),
34
+ * the autoloader will first look for the class under the component/
35
+ * directory, and it will then fallback to the framework/ directory if not
36
+ * found before giving up.
37
+ *
38
+ * This class is loosely based on the Symfony UniversalClassLoader.
39
+ *
40
+ * @author Fabien Potencier <fabien@symfony.com>
41
+ * @author Jordi Boggiano <j.boggiano@seld.be>
42
+ */
43
+ class ClassLoader
44
+ {
45
+ // PSR-4
46
+ private $prefixLengthsPsr4 = array();
47
+ private $prefixDirsPsr4 = array();
48
+ private $fallbackDirsPsr4 = array();
49
+
50
+ // PSR-0
51
+ private $prefixesPsr0 = array();
52
+ private $fallbackDirsPsr0 = array();
53
+
54
+ private $useIncludePath = false;
55
+ private $classMap = array();
56
+
57
+ private $classMapAuthoritative = false;
58
+
59
+ public function getPrefixes()
60
+ {
61
+ if (!empty($this->prefixesPsr0)) {
62
+ return call_user_func_array('array_merge', $this->prefixesPsr0);
63
+ }
64
+
65
+ return array();
66
+ }
67
+
68
+ public function getPrefixesPsr4()
69
+ {
70
+ return $this->prefixDirsPsr4;
71
+ }
72
+
73
+ public function getFallbackDirs()
74
+ {
75
+ return $this->fallbackDirsPsr0;
76
+ }
77
+
78
+ public function getFallbackDirsPsr4()
79
+ {
80
+ return $this->fallbackDirsPsr4;
81
+ }
82
+
83
+ public function getClassMap()
84
+ {
85
+ return $this->classMap;
86
+ }
87
+
88
+ /**
89
+ * @param array $classMap Class to filename map
90
+ */
91
+ public function addClassMap(array $classMap)
92
+ {
93
+ if ($this->classMap) {
94
+ $this->classMap = array_merge($this->classMap, $classMap);
95
+ } else {
96
+ $this->classMap = $classMap;
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Registers a set of PSR-0 directories for a given prefix, either
102
+ * appending or prepending to the ones previously set for this prefix.
103
+ *
104
+ * @param string $prefix The prefix
105
+ * @param array|string $paths The PSR-0 root directories
106
+ * @param bool $prepend Whether to prepend the directories
107
+ */
108
+ public function add($prefix, $paths, $prepend = false)
109
+ {
110
+ if (!$prefix) {
111
+ if ($prepend) {
112
+ $this->fallbackDirsPsr0 = array_merge(
113
+ (array) $paths,
114
+ $this->fallbackDirsPsr0
115
+ );
116
+ } else {
117
+ $this->fallbackDirsPsr0 = array_merge(
118
+ $this->fallbackDirsPsr0,
119
+ (array) $paths
120
+ );
121
+ }
122
+
123
+ return;
124
+ }
125
+
126
+ $first = $prefix[0];
127
+ if (!isset($this->prefixesPsr0[$first][$prefix])) {
128
+ $this->prefixesPsr0[$first][$prefix] = (array) $paths;
129
+
130
+ return;
131
+ }
132
+ if ($prepend) {
133
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
134
+ (array) $paths,
135
+ $this->prefixesPsr0[$first][$prefix]
136
+ );
137
+ } else {
138
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
139
+ $this->prefixesPsr0[$first][$prefix],
140
+ (array) $paths
141
+ );
142
+ }
143
+ }
144
+
145
+ /**
146
+ * Registers a set of PSR-4 directories for a given namespace, either
147
+ * appending or prepending to the ones previously set for this namespace.
148
+ *
149
+ * @param string $prefix The prefix/namespace, with trailing '\\'
150
+ * @param array|string $paths The PSR-0 base directories
151
+ * @param bool $prepend Whether to prepend the directories
152
+ *
153
+ * @throws \InvalidArgumentException
154
+ */
155
+ public function addPsr4($prefix, $paths, $prepend = false)
156
+ {
157
+ if (!$prefix) {
158
+ // Register directories for the root namespace.
159
+ if ($prepend) {
160
+ $this->fallbackDirsPsr4 = array_merge(
161
+ (array) $paths,
162
+ $this->fallbackDirsPsr4
163
+ );
164
+ } else {
165
+ $this->fallbackDirsPsr4 = array_merge(
166
+ $this->fallbackDirsPsr4,
167
+ (array) $paths
168
+ );
169
+ }
170
+ } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
171
+ // Register directories for a new namespace.
172
+ $length = strlen($prefix);
173
+ if ('\\' !== $prefix[$length - 1]) {
174
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
175
+ }
176
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
177
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
178
+ } elseif ($prepend) {
179
+ // Prepend directories for an already registered namespace.
180
+ $this->prefixDirsPsr4[$prefix] = array_merge(
181
+ (array) $paths,
182
+ $this->prefixDirsPsr4[$prefix]
183
+ );
184
+ } else {
185
+ // Append directories for an already registered namespace.
186
+ $this->prefixDirsPsr4[$prefix] = array_merge(
187
+ $this->prefixDirsPsr4[$prefix],
188
+ (array) $paths
189
+ );
190
+ }
191
+ }
192
+
193
+ /**
194
+ * Registers a set of PSR-0 directories for a given prefix,
195
+ * replacing any others previously set for this prefix.
196
+ *
197
+ * @param string $prefix The prefix
198
+ * @param array|string $paths The PSR-0 base directories
199
+ */
200
+ public function set($prefix, $paths)
201
+ {
202
+ if (!$prefix) {
203
+ $this->fallbackDirsPsr0 = (array) $paths;
204
+ } else {
205
+ $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
206
+ }
207
+ }
208
+
209
+ /**
210
+ * Registers a set of PSR-4 directories for a given namespace,
211
+ * replacing any others previously set for this namespace.
212
+ *
213
+ * @param string $prefix The prefix/namespace, with trailing '\\'
214
+ * @param array|string $paths The PSR-4 base directories
215
+ *
216
+ * @throws \InvalidArgumentException
217
+ */
218
+ public function setPsr4($prefix, $paths)
219
+ {
220
+ if (!$prefix) {
221
+ $this->fallbackDirsPsr4 = (array) $paths;
222
+ } else {
223
+ $length = strlen($prefix);
224
+ if ('\\' !== $prefix[$length - 1]) {
225
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
226
+ }
227
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
228
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
229
+ }
230
+ }
231
+
232
+ /**
233
+ * Turns on searching the include path for class files.
234
+ *
235
+ * @param bool $useIncludePath
236
+ */
237
+ public function setUseIncludePath($useIncludePath)
238
+ {
239
+ $this->useIncludePath = $useIncludePath;
240
+ }
241
+
242
+ /**
243
+ * Can be used to check if the autoloader uses the include path to check
244
+ * for classes.
245
+ *
246
+ * @return bool
247
+ */
248
+ public function getUseIncludePath()
249
+ {
250
+ return $this->useIncludePath;
251
+ }
252
+
253
+ /**
254
+ * Turns off searching the prefix and fallback directories for classes
255
+ * that have not been registered with the class map.
256
+ *
257
+ * @param bool $classMapAuthoritative
258
+ */
259
+ public function setClassMapAuthoritative($classMapAuthoritative)
260
+ {
261
+ $this->classMapAuthoritative = $classMapAuthoritative;
262
+ }
263
+
264
+ /**
265
+ * Should class lookup fail if not found in the current class map?
266
+ *
267
+ * @return bool
268
+ */
269
+ public function isClassMapAuthoritative()
270
+ {
271
+ return $this->classMapAuthoritative;
272
+ }
273
+
274
+ /**
275
+ * Registers this instance as an autoloader.
276
+ *
277
+ * @param bool $prepend Whether to prepend the autoloader or not
278
+ */
279
+ public function register($prepend = false)
280
+ {
281
+ spl_autoload_register(array($this, 'loadClass'), true, $prepend);
282
+ }
283
+
284
+ /**
285
+ * Unregisters this instance as an autoloader.
286
+ */
287
+ public function unregister()
288
+ {
289
+ spl_autoload_unregister(array($this, 'loadClass'));
290
+ }
291
+
292
+ /**
293
+ * Loads the given class or interface.
294
+ *
295
+ * @param string $class The name of the class
296
+ * @return bool|null True if loaded, null otherwise
297
+ */
298
+ public function loadClass($class)
299
+ {
300
+ if ($file = $this->findFile($class)) {
301
+ includeFile($file);
302
+
303
+ return true;
304
+ }
305
+ }
306
+
307
+ /**
308
+ * Finds the path to the file where the class is defined.
309
+ *
310
+ * @param string $class The name of the class
311
+ *
312
+ * @return string|false The path if found, false otherwise
313
+ */
314
+ public function findFile($class)
315
+ {
316
+ // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
317
+ if ('\\' == $class[0]) {
318
+ $class = substr($class, 1);
319
+ }
320
+
321
+ // class map lookup
322
+ if (isset($this->classMap[$class])) {
323
+ return $this->classMap[$class];
324
+ }
325
+ if ($this->classMapAuthoritative) {
326
+ return false;
327
+ }
328
+
329
+ $file = $this->findFileWithExtension($class, '.php');
330
+
331
+ // Search for Hack files if we are running on HHVM
332
+ if ($file === null && defined('HHVM_VERSION')) {
333
+ $file = $this->findFileWithExtension($class, '.hh');
334
+ }
335
+
336
+ if ($file === null) {
337
+ // Remember that this class does not exist.
338
+ return $this->classMap[$class] = false;
339
+ }
340
+
341
+ return $file;
342
+ }
343
+
344
+ private function findFileWithExtension($class, $ext)
345
+ {
346
+ // PSR-4 lookup
347
+ $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
348
+
349
+ $first = $class[0];
350
+ if (isset($this->prefixLengthsPsr4[$first])) {
351
+ foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
352
+ if (0 === strpos($class, $prefix)) {
353
+ foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
354
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
355
+ return $file;
356
+ }
357
+ }
358
+ }
359
+ }
360
+ }
361
+
362
+ // PSR-4 fallback dirs
363
+ foreach ($this->fallbackDirsPsr4 as $dir) {
364
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
365
+ return $file;
366
+ }
367
+ }
368
+
369
+ // PSR-0 lookup
370
+ if (false !== $pos = strrpos($class, '\\')) {
371
+ // namespaced class name
372
+ $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
373
+ . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
374
+ } else {
375
+ // PEAR-like class name
376
+ $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
377
+ }
378
+
379
+ if (isset($this->prefixesPsr0[$first])) {
380
+ foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
381
+ if (0 === strpos($class, $prefix)) {
382
+ foreach ($dirs as $dir) {
383
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
384
+ return $file;
385
+ }
386
+ }
387
+ }
388
+ }
389
+ }
390
+
391
+ // PSR-0 fallback dirs
392
+ foreach ($this->fallbackDirsPsr0 as $dir) {
393
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
394
+ return $file;
395
+ }
396
+ }
397
+
398
+ // PSR-0 include paths.
399
+ if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
400
+ return $file;
401
+ }
402
+ }
403
+ }
404
+
405
+ /**
406
+ * Scope isolated include.
407
+ *
408
+ * Prevents access to $this/self from included files.
409
+ */
410
+ function includeFile($file)
411
+ {
412
+ include $file;
413
+ }
includes/vendor/composer/autoload_classmap.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_classmap.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname(dirname($vendorDir));
7
+
8
+ return array(
9
+ );
includes/vendor/composer/autoload_namespaces.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_namespaces.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname(dirname($vendorDir));
7
+
8
+ return array(
9
+ 'Composer\\Installers\\' => array($vendorDir . '/composer/installers/src'),
10
+ );
includes/vendor/composer/autoload_psr4.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_psr4.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname(dirname($vendorDir));
7
+
8
+ return array(
9
+ );
includes/vendor/composer/autoload_real.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_real.php @generated by Composer
4
+
5
+ class ComposerAutoloaderInit3bb75807e81292dee13fe8a3526e0777
6
+ {
7
+ private static $loader;
8
+
9
+ public static function loadClassLoader($class)
10
+ {
11
+ if ('Composer\Autoload\ClassLoader' === $class) {
12
+ require __DIR__ . '/ClassLoader.php';
13
+ }
14
+ }
15
+
16
+ public static function getLoader()
17
+ {
18
+ if (null !== self::$loader) {
19
+ return self::$loader;
20
+ }
21
+
22
+ spl_autoload_register(array('ComposerAutoloaderInit3bb75807e81292dee13fe8a3526e0777', 'loadClassLoader'), true, true);
23
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit3bb75807e81292dee13fe8a3526e0777', 'loadClassLoader'));
25
+
26
+ $map = require __DIR__ . '/autoload_namespaces.php';
27
+ foreach ($map as $namespace => $path) {
28
+ $loader->set($namespace, $path);
29
+ }
30
+
31
+ $map = require __DIR__ . '/autoload_psr4.php';
32
+ foreach ($map as $namespace => $path) {
33
+ $loader->setPsr4($namespace, $path);
34
+ }
35
+
36
+ $classMap = require __DIR__ . '/autoload_classmap.php';
37
+ if ($classMap) {
38
+ $loader->addClassMap($classMap);
39
+ }
40
+
41
+ $loader->register(true);
42
+
43
+ return $loader;
44
+ }
45
+ }
46
+
47
+ function composerRequire3bb75807e81292dee13fe8a3526e0777($file)
48
+ {
49
+ require $file;
50
+ }
includes/vendor/composer/installed.json ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "name": "composer/installers",
4
+ "version": "v1.0.21",
5
+ "version_normalized": "1.0.21.0",
6
+ "source": {
7
+ "type": "git",
8
+ "url": "https://github.com/composer/installers.git",
9
+ "reference": "d64e23fce42a4063d63262b19b8e7c0f3b5e4c45"
10
+ },
11
+ "dist": {
12
+ "type": "zip",
13
+ "url": "https://api.github.com/repos/composer/installers/zipball/d64e23fce42a4063d63262b19b8e7c0f3b5e4c45",
14
+ "reference": "d64e23fce42a4063d63262b19b8e7c0f3b5e4c45",
15
+ "shasum": ""
16
+ },
17
+ "replace": {
18
+ "roundcube/plugin-installer": "*",
19
+ "shama/baton": "*"
20
+ },
21
+ "require-dev": {
22
+ "composer/composer": "1.0.*@dev",
23
+ "phpunit/phpunit": "4.1.*"
24
+ },
25
+ "time": "2015-02-18 17:17:01",
26
+ "type": "composer-installer",
27
+ "extra": {
28
+ "class": "Composer\\Installers\\Installer",
29
+ "branch-alias": {
30
+ "dev-master": "1.0-dev"
31
+ }
32
+ },
33
+ "installation-source": "dist",
34
+ "autoload": {
35
+ "psr-0": {
36
+ "Composer\\Installers\\": "src/"
37
+ }
38
+ },
39
+ "notification-url": "https://packagist.org/downloads/",
40
+ "license": [
41
+ "MIT"
42
+ ],
43
+ "authors": [
44
+ {
45
+ "name": "Kyle Robinson Young",
46
+ "email": "kyle@dontkry.com",
47
+ "homepage": "https://github.com/shama"
48
+ }
49
+ ],
50
+ "description": "A multi-framework Composer library installer",
51
+ "homepage": "http://composer.github.com/installers/",
52
+ "keywords": [
53
+ "Craft",
54
+ "Dolibarr",
55
+ "Hurad",
56
+ "MODX Evo",
57
+ "OXID",
58
+ "SMF",
59
+ "Thelia",
60
+ "WolfCMS",
61
+ "agl",
62
+ "aimeos",
63
+ "annotatecms",
64
+ "bitrix",
65
+ "cakephp",
66
+ "chef",
67
+ "codeigniter",
68
+ "concrete5",
69
+ "croogo",
70
+ "dokuwiki",
71
+ "drupal",
72
+ "elgg",
73
+ "fuelphp",
74
+ "grav",
75
+ "installer",
76
+ "joomla",
77
+ "kohana",
78
+ "laravel",
79
+ "lithium",
80
+ "magento",
81
+ "mako",
82
+ "mediawiki",
83
+ "modulework",
84
+ "moodle",
85
+ "phpbb",
86
+ "piwik",
87
+ "ppi",
88
+ "puppet",
89
+ "roundcube",
90
+ "shopware",
91
+ "silverstripe",
92
+ "symfony",
93
+ "typo3",
94
+ "wordpress",
95
+ "zend",
96
+ "zikula"
97
+ ]
98
+ }
99
+ ]
includes/vendor/composer/installers/.editorconfig ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ ; top-most EditorConfig file
2
+ root = true
3
+
4
+ ; Unix-style newlines
5
+ [*]
6
+ end_of_line = LF
7
+
8
+ [*.php]
9
+ indent_style = space
10
+ indent_size = 4
includes/vendor/composer/installers/.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ vendor/
2
+ composer.lock
3
+ .idea/
includes/vendor/composer/installers/.travis.yml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ language: php
2
+
3
+ php:
4
+ - 5.3
5
+ - 5.4
6
+ - 5.5
7
+ - 5.6
8
+ - hhvm
9
+
10
+ before_script:
11
+ - curl -s http://getcomposer.org/installer | php -- --quiet
12
+ - php composer.phar install --dev
13
+
14
+ script: phpunit
includes/vendor/composer/installers/LICENSE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2012 Kyle Robinson Young
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is furnished
8
+ to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
includes/vendor/composer/installers/README.md ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A Multi-Framework [Composer](http://getcomposer.org) Library Installer
2
+
3
+ [![Build Status](http://img.shields.io/travis/composer/installers.svg)](http://travis-ci.org/composer/installers)
4
+
5
+ This is for PHP package authors to require in their `composer.json`. It will
6
+ install their package to the correct location based on the specified package
7
+ type.
8
+
9
+ The goal of `installers` is to be a simple package type to install path map.
10
+ Users can also customize the install path per package and package authors can
11
+ modify the package name upon installing.
12
+
13
+ `installers` isn't intended on replacing all custom installers. If your
14
+ package requires special installation handling then by all means, create a
15
+ custom installer to handle it.
16
+
17
+ **Natively Supported Frameworks**:
18
+
19
+ The following frameworks natively work with Composer and will be
20
+ installed to the default `vendor` directory. `composer/installers`
21
+ is not needed to install packages with these frameworks:
22
+
23
+ * Aura
24
+ * Symfony2
25
+ * Yii
26
+ * Yii2
27
+
28
+ **Current Supported Package Types**:
29
+
30
+ > Stable types are marked as **bold**, this means that installation paths
31
+ > for those type will not be changed. Any adjustment for those types would
32
+ > require creation of brand new type that will cover required changes.
33
+
34
+ | Framework | Types
35
+ | --------- | -----
36
+ | Aimeos | `aimeos-extension`
37
+ | Asgard | `asgard-module`<br>`asgard-theme`
38
+ | AGL | `agl-module`
39
+ | AnnotateCms | `annotatecms-module`<br>`annotatecms-component`<br>`annotatecms-service`
40
+ | Bitrix | `bitrix-module`<br>`bitrix-component`<br>`bitrix-theme`
41
+ | CakePHP 2+ | **`cakephp-plugin`**
42
+ | Chef | `chef-cookbook`<br>`chef-role`
43
+ | CCFramework | `ccframework-ship`<br>`ccframework-theme`
44
+ | CodeIgniter | `codeigniter-library`<br>`codeigniter-third-party`<br>`codeigniter-module`
45
+ | concrete5 | `concrete5-block`<br>`concrete5-package`<br>`concrete5-theme`<br>`concrete5-update`
46
+ | Craft | `craft-plugin`
47
+ | Croogo | `croogo-plugin`<br>`croogo-theme`
48
+ | DokuWiki | `dokuwiki-plugin`<br>`dokuwiki-template`
49
+ | Dolibarr | `dolibarr-module`
50
+ | Drupal | <b>`drupal-module`<br>`drupal-theme`</b><br>`drupal-library`<br>`drupal-profile`<br>`drupal-drush`
51
+ | Elgg | `elgg-plugin`
52
+ | FuelPHP v1.x | `fuel-module`<br>`fuel-package`<br/>`fuel-theme`
53
+ | FuelPHP v2.x | `fuelphp-component`
54
+ | Grav | `grav-plugin`<br>`grav-theme`
55
+ | Hurad | `hurad-plugin`<br>`hurad-theme`
56
+ | Joomla | `joomla-component`<br>`joomla-module`<br>`joomla-template`<br>`joomla-plugin`<br>`joomla-library`
57
+ | Kirby | **`kirby-plugin`**
58
+ | Kohana | **`kohana-module`**
59
+ | Laravel | `laravel-library`
60
+ | Lithium | **`lithium-library`<br>`lithium-source`**
61
+ | Magento | `magento-library`<br>`magento-skin`<br>`magento-theme`
62
+ | Mako | `mako-package`
63
+ | MODX Evo | `modxevo-snippet`<br>`modxevo-plugin`<br>`modxevo-module`<br>`modxevo-template`<br>`modxevo-lib`
64
+ | MediaWiki | `mediawiki-extension`
65
+ | October | **`october-module`<br>`october-plugin`<br>`october-theme`**
66
+ | OXID | `oxid-module`<br>`oxid-theme`<br>`oxid-out`
67
+ | MODULEWork | `modulework-module`
68
+ | Moodle | `moodle-*` (Please [check source](https://raw.githubusercontent.com/composer/installers/master/src/Composer/Installers/MoodleInstaller.php) for all supported types)
69
+ | Piwik | `piwik-plugin`
70
+ | phpBB | `phpbb-extension`<br>`phpbb-style`<br>`phpbb-language`
71
+ | Pimcore | `pimcore-plugin`
72
+ | PPI | **`ppi-module`**
73
+ | Puppet | `puppet-module`
74
+ | REDAXO | `redaxo-addon`
75
+ | Roundcube | `roundcube-plugin`
76
+ | shopware | `shopware-backend-plugin`<br/>`shopware-core-plugin`<br/>`shopware-frontend-plugin`<br/>`shopware-theme`
77
+ | SilverStripe | `silverstripe-module`<br>`silverstripe-theme`
78
+ | SMF | `smf-module`<br>`smf-theme`
79
+ | symfony1 | **`symfony1-plugin`**
80
+ | Tusk | `tusk-task`<br>`tusk-command`<br>`tusk-asset`
81
+ | TYPO3 Flow | `typo3-flow-package`<br>`typo3-flow-framework`<br>`typo3-flow-plugin`<br>`typo3-flow-site`<br>`typo3-flow-boilerplate`<br>`typo3-flow-build`
82
+ | TYPO3 CMS | `typo3-cms-extension`
83
+ | Wolf CMS | `wolfcms-plugin`
84
+ | WordPress | <b>`wordpress-plugin`<br>`wordpress-theme`</b><br>`wordpress-muplugin`
85
+ | Zend | `zend-library`<br>`zend-extra`<br>`zend-module`
86
+ | Zikula | `zikula-module`<br>`zikula-theme`
87
+ | Prestashop | `prestashop-module`<br>`prestashop-theme`
88
+
89
+ ## Example `composer.json` File
90
+
91
+ This is an example for a CakePHP plugin. The only important parts to set in your
92
+ composer.json file are `"type": "cakephp-plugin"` which describes what your
93
+ package is and `"require": { "composer/installers": "~1.0" }` which tells composer
94
+ to load the custom installers.
95
+
96
+ ```json
97
+ {
98
+ "name": "you/ftp",
99
+ "type": "cakephp-plugin",
100
+ "require": {
101
+ "composer/installers": "~1.0"
102
+ }
103
+ }
104
+ ```
105
+
106
+ This would install your package to the `Plugin/Ftp/` folder of a CakePHP app
107
+ when a user runs `php composer.phar install`.
108
+
109
+ So submit your packages to [packagist.org](http://packagist.org)!
110
+
111
+ ## Custom Install Paths
112
+
113
+ If you are consuming a package that uses the `composer/installers` you can
114
+ override the install path with the following extra in your `composer.json`:
115
+
116
+ ```json
117
+ {
118
+ "extra": {
119
+ "installer-paths": {
120
+ "your/custom/path/{$name}/": ["shama/ftp", "vendor/package"]
121
+ }
122
+ }
123
+ }
124
+ ```
125
+
126
+ A package type can have a custom installation path with a `type:` prefix.
127
+
128
+ ``` json
129
+ {
130
+ "extra": {
131
+ "installer-paths": {
132
+ "your/custom/path/{$name}/": ["type:wordpress-plugin"]
133
+ }
134
+ }
135
+ }
136
+ ```
137
+
138
+ This would use your custom path for each of the listed packages. The available
139
+ variables to use in your paths are: `{$name}`, `{$vendor}`, `{$type}`.
140
+
141
+ ## Custom Install Names
142
+
143
+ If you're a package author and need your package to be named differently when
144
+ installed consider using the `installer-name` extra.
145
+
146
+ For example you have a package named `shama/cakephp-ftp` with the type
147
+ `cakephp-plugin`. Installing with `composer/installers` would install to the
148
+ path `Plugin/CakephpFtp`. Due to the strict naming conventions, you as a
149
+ package author actually need the package to be named and installed to
150
+ `Plugin/Ftp`. Using the following config within your **package** `composer.json`
151
+ will allow this:
152
+
153
+ ```json
154
+ {
155
+ "name": "shama/cakephp-ftp",
156
+ "type": "cakephp-plugin",
157
+ "extra": {
158
+ "installer-name": "Ftp"
159
+ }
160
+ }
161
+ ```
162
+
163
+ Please note the name entered into `installer-name` will be the final and will
164
+ not be inflected.
165
+
166
+ ## Contribute!
167
+
168
+ * [Fork and clone](https://help.github.com/articles/fork-a-repo).
169
+ * Run the command `php composer.phar install --dev` to install the dev
170
+ dependencies. See [Composer](https://github.com/composer/composer#installation--usage).
171
+ * Use the command `phpunit` to run the tests. See [PHPUnit](http://phpunit.de).
172
+ * Create a branch, commit, push and send us a
173
+ [pull request](https://help.github.com/articles/using-pull-requests).
174
+
175
+ To ensure a consistent code base, you should make sure the code follows the
176
+ [Coding Standards](http://symfony.com/doc/2.0/contributing/code/standards.html)
177
+ which we borrowed from Symfony.
178
+
179
+ If you would like to help, please take a look at the list of
180
+ [issues](https://github.com/composer/installers/issues).
181
+
182
+ ### Should we allow dynamic package types or paths? No.
183
+ What are they? The ability for a package author to determine where a package
184
+ will be installed either through setting the path directly in their
185
+ `composer.json` or through a dynamic package type: `"type":
186
+ "framework-install-here"`.
187
+
188
+ It has been proposed many times. Even implemented once early on and then
189
+ removed. `installers` won't do this because it would allow a single package
190
+ author to wipe out entire folders without the user's consent. That user would
191
+ then come here to yell at us.
includes/vendor/composer/installers/composer.json ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "composer/installers",
3
+ "type": "composer-installer",
4
+ "license": "MIT",
5
+ "description": "A multi-framework Composer library installer",
6
+ "keywords": [
7
+ "installer",
8
+ "Aimeos",
9
+ "AGL",
10
+ "AnnotateCms",
11
+ "Bitrix",
12
+ "CakePHP",
13
+ "Chef",
14
+ "CodeIgniter",
15
+ "concrete5",
16
+ "Craft",
17
+ "Croogo",
18
+ "DokuWiki",
19
+ "Dolibarr",
20
+ "Drupal",
21
+ "Elgg",
22
+ "FuelPHP",
23
+ "Grav",
24
+ "Hurad",
25
+ "Joomla",
26
+ "Kohana",
27
+ "Laravel",
28
+ "Lithium",
29
+ "Magento",
30
+ "Mako",
31
+ "MODX Evo",
32
+ "MediaWiki",
33
+ "OXID",
34
+ "MODULEWork",
35
+ "Moodle",
36
+ "Piwik",
37
+ "phpBB",
38
+ "PPI",
39
+ "Puppet",
40
+ "Roundcube",
41
+ "shopware",
42
+ "SilverStripe",
43
+ "SMF",
44
+ "symfony",
45
+ "Thelia",
46
+ "TYPO3",
47
+ "WolfCMS",
48
+ "WordPress",
49
+ "Zend",
50
+ "Zikula"
51
+ ],
52
+ "homepage": "http://composer.github.com/installers/",
53
+ "authors": [
54
+ {
55
+ "name": "Kyle Robinson Young",
56
+ "email": "kyle@dontkry.com",
57
+ "homepage": "https://github.com/shama"
58
+ }
59
+ ],
60
+ "autoload": {
61
+ "psr-0": { "Composer\\Installers\\": "src/" }
62
+ },
63
+ "extra": {
64
+ "class": "Composer\\Installers\\Installer",
65
+ "branch-alias": {
66
+ "dev-master": "1.0-dev"
67
+ }
68
+ },
69
+ "replace": {
70
+ "shama/baton": "*",
71
+ "roundcube/plugin-installer": "*"
72
+ },
73
+ "require-dev": {
74
+ "composer/composer": "1.0.*@dev",
75
+ "phpunit/phpunit": "4.1.*"
76
+ }
77
+ }
includes/vendor/composer/installers/phpunit.xml.dist ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <phpunit backupGlobals="false"
4
+ backupStaticAttributes="false"
5
+ colors="true"
6
+ convertErrorsToExceptions="true"
7
+ convertNoticesToExceptions="true"
8
+ convertWarningsToExceptions="true"
9
+ processIsolation="false"
10
+ stopOnFailure="false"
11
+ syntaxCheck="false"
12
+ bootstrap="tests/bootstrap.php"
13
+ >
14
+ <testsuites>
15
+ <testsuite name="Installers Test Suite">
16
+ <directory>tests/Composer/Installers</directory>
17
+ </testsuite>
18
+ </testsuites>
19
+
20
+ <filter>
21
+ <whitelist>
22
+ <directory>src/Composer/Installers</directory>
23
+ </whitelist>
24
+ </filter>
25
+ </phpunit>
includes/vendor/composer/installers/src/Composer/Installers/AglInstaller.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class AglInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'More/{$name}/',
8
+ );
9
+
10
+ /**
11
+ * Format package name to CamelCase
12
+ */
13
+ public function inflectPackageVars($vars)
14
+ {
15
+ $vars['name'] = preg_replace_callback('/(?:^|_|-)(.?)/', function ($matches) {
16
+ return strtoupper($matches[1]);
17
+ }, $vars['name']);
18
+
19
+ return $vars;
20
+ }
21
+ }
includes/vendor/composer/installers/src/Composer/Installers/AimeosInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class AimeosInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'extension' => 'ext/{$name}/',
8
+ );
9
+ }
includes/vendor/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class AnnotateCmsInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'addons/modules/{$name}/',
8
+ 'component' => 'addons/components/{$name}/',
9
+ 'service' => 'addons/services/{$name}/',
10
+ );
11
+ }
includes/vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class AsgardInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'Modules/{$name}/',
8
+ 'theme' => 'Themes/{$name}/'
9
+ );
10
+
11
+ /**
12
+ * Format package name.
13
+ *
14
+ * For package type asgard-module, cut off a trailing '-plugin' if present.
15
+ *
16
+ * For package type asgard-theme, cut off a trailing '-theme' if present.
17
+ *
18
+ */
19
+ public function inflectPackageVars($vars)
20
+ {
21
+ if ($vars['type'] === 'asgard-module') {
22
+ return $this->inflectPluginVars($vars);
23
+ }
24
+
25
+ if ($vars['type'] === 'asgard-theme') {
26
+ return $this->inflectThemeVars($vars);
27
+ }
28
+
29
+ return $vars;
30
+ }
31
+
32
+ protected function inflectPluginVars($vars)
33
+ {
34
+ $vars['name'] = ucfirst(preg_replace('/-module/', '', $vars['name']));
35
+
36
+ return $vars;
37
+ }
38
+
39
+ protected function inflectThemeVars($vars)
40
+ {
41
+ $vars['name'] = ucfirst(preg_replace('/-theme$/', '', $vars['name']));
42
+
43
+ return $vars;
44
+ }
45
+ }
includes/vendor/composer/installers/src/Composer/Installers/BaseInstaller.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ use Composer\Composer;
5
+ use Composer\Package\PackageInterface;
6
+
7
+ abstract class BaseInstaller
8
+ {
9
+ protected $locations = array();
10
+ protected $composer;
11
+ protected $package;
12
+
13
+ /**
14
+ * Initializes base installer.
15
+ *
16
+ * @param PackageInterface $package
17
+ * @param Composer $composer
18
+ */
19
+ public function __construct(PackageInterface $package = null, Composer $composer = null)
20
+ {
21
+ $this->composer = $composer;
22
+ $this->package = $package;
23
+ }
24
+
25
+ /**
26
+ * Return the install path based on package type.
27
+ *
28
+ * @param PackageInterface $package
29
+ * @param string $frameworkType
30
+ * @return string
31
+ */
32
+ public function getInstallPath(PackageInterface $package, $frameworkType = '')
33
+ {
34
+ $type = $this->package->getType();
35
+
36
+ $prettyName = $this->package->getPrettyName();
37
+ if (strpos($prettyName, '/') !== false) {
38
+ list($vendor, $name) = explode('/', $prettyName);
39
+ } else {
40
+ $vendor = '';
41
+ $name = $prettyName;
42
+ }
43
+
44
+ $availableVars = $this->inflectPackageVars(compact('name', 'vendor', 'type'));
45
+
46
+ $extra = $package->getExtra();
47
+ if (!empty($extra['installer-name'])) {
48
+ $availableVars['name'] = $extra['installer-name'];
49
+ }
50
+
51
+ if ($this->composer->getPackage()) {
52
+ $extra = $this->composer->getPackage()->getExtra();
53
+ if (!empty($extra['installer-paths'])) {
54
+ $customPath = $this->mapCustomInstallPaths($extra['installer-paths'], $prettyName, $type);
55
+ if ($customPath !== false) {
56
+ return $this->templatePath($customPath, $availableVars);
57
+ }
58
+ }
59
+ }
60
+
61
+ $packageType = substr($type, strlen($frameworkType) + 1);
62
+ $locations = $this->getLocations();
63
+ if (!isset($locations[$packageType])) {
64
+ throw new \InvalidArgumentException(sprintf('Package type "%s" is not supported', $type));
65
+ }
66
+
67
+ return $this->templatePath($locations[$packageType], $availableVars);
68
+ }
69
+
70
+ /**
71
+ * For an installer to override to modify the vars per installer.
72
+ *
73
+ * @param array $vars
74
+ * @return array
75
+ */
76
+ public function inflectPackageVars($vars)
77
+ {
78
+ return $vars;
79
+ }
80
+
81
+ /**
82
+ * Gets the installer's locations
83
+ *
84
+ * @return array
85
+ */
86
+ public function getLocations()
87
+ {
88
+ return $this->locations;
89
+ }
90
+
91
+ /**
92
+ * Replace vars in a path
93
+ *
94
+ * @param string $path
95
+ * @param array $vars
96
+ * @return string
97
+ */
98
+ protected function templatePath($path, array $vars = array())
99
+ {
100
+ if (strpos($path, '{') !== false) {
101
+ extract($vars);
102
+ preg_match_all('@\{\$([A-Za-z0-9_]*)\}@i', $path, $matches);
103
+ if (!empty($matches[1])) {
104
+ foreach ($matches[1] as $var) {
105
+ $path = str_replace('{$' . $var . '}', $$var, $path);
106
+ }
107
+ }
108
+ }
109
+
110
+ return $path;
111
+ }
112
+
113
+ /**
114
+ * Search through a passed paths array for a custom install path.
115
+ *
116
+ * @param array $paths
117
+ * @param string $name
118
+ * @param string $type
119
+ * @return string
120
+ */
121
+ protected function mapCustomInstallPaths(array $paths, $name, $type)
122
+ {
123
+ foreach ($paths as $path => $names) {
124
+ if (in_array($name, $names) || in_array('type:' . $type, $names)) {
125
+ return $path;
126
+ }
127
+ }
128
+
129
+ return false;
130
+ }
131
+ }
includes/vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class BitrixInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'local/modules/{$name}/',
8
+ 'component' => 'local/components/{$name}/',
9
+ 'theme' => 'local/templates/{$name}/'
10
+ );
11
+ }
includes/vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ use Composer\DependencyResolver\Pool;
5
+ use Composer\Package\PackageInterface;
6
+ use Composer\Package\LinkConstraint\MultiConstraint;
7
+ use Composer\Package\LinkConstraint\VersionConstraint;
8
+
9
+ class CakePHPInstaller extends BaseInstaller
10
+ {
11
+ protected $locations = array(
12
+ 'plugin' => 'Plugin/{$name}/',
13
+ );
14
+
15
+ /**
16
+ * Format package name to CamelCase
17
+ */
18
+ public function inflectPackageVars($vars)
19
+ {
20
+ if ($this->matchesCakeVersion('>=', '3.0.0')) {
21
+ return $vars;
22
+ }
23
+
24
+ $nameParts = explode('/', $vars['name']);
25
+ foreach ($nameParts as &$value) {
26
+ $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
27
+ $value = str_replace(array('-', '_'), ' ', $value);
28
+ $value = str_replace(' ', '', ucwords($value));
29
+ }
30
+ $vars['name'] = implode('/', $nameParts);
31
+
32
+ return $vars;
33
+ }
34
+
35
+ /**
36
+ * Change the default plugin location when cakephp >= 3.0
37
+ */
38
+ public function getLocations()
39
+ {
40
+ if ($this->matchesCakeVersion('>=', '3.0.0')) {
41
+ $this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/';
42
+ }
43
+ return $this->locations;
44
+ }
45
+
46
+ /**
47
+ * Check if CakePHP version matches against a version
48
+ *
49
+ * @param string $matcher
50
+ * @param string $version
51
+ * @return bool
52
+ */
53
+ protected function matchesCakeVersion($matcher, $version)
54
+ {
55
+ $repositoryManager = $this->composer->getRepositoryManager();
56
+ if ($repositoryManager) {
57
+ $repos = $repositoryManager->getLocalRepository();
58
+ if (!$repos) {
59
+ return false;
60
+ }
61
+ $cake3 = new MultiConstraint(array(
62
+ new VersionConstraint($matcher, $version),
63
+ new VersionConstraint('!=', '9999999-dev'),
64
+ ));
65
+ $pool = new Pool('dev');
66
+ $pool->addRepository($repos);
67
+ $packages = $pool->whatProvides('cakephp/cakephp');
68
+ foreach ($packages as $package) {
69
+ $installed = new VersionConstraint('=', $package->getVersion());
70
+ if ($cake3->matches($installed)) {
71
+ return true;
72
+ break;
73
+ }
74
+ }
75
+ }
76
+ return false;
77
+ }
78
+ }
includes/vendor/composer/installers/src/Composer/Installers/ChefInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class ChefInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'cookbook' => 'Chef/{$vendor}/{$name}/',
8
+ 'role' => 'Chef/roles/{$name}/',
9
+ );
10
+ }
11
+
includes/vendor/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class ClanCatsFrameworkInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'ship' => 'CCF/orbit/{$name}/',
8
+ 'theme' => 'CCF/app/themes/{$name}/',
9
+ );
10
+ }
includes/vendor/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class CodeIgniterInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'library' => 'application/libraries/{$name}/',
8
+ 'third-party' => 'application/third_party/{$name}/',
9
+ 'module' => 'application/modules/{$name}/',
10
+ );
11
+ }
includes/vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class Concrete5Installer extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'block' => 'blocks/{$name}/',
8
+ 'package' => 'packages/{$name}/',
9
+ 'theme' => 'themes/{$name}/',
10
+ 'update' => 'updates/{$name}/',
11
+ );
12
+ }
includes/vendor/composer/installers/src/Composer/Installers/CraftInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class CraftInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'craft/plugins/{$name}/',
8
+ );
9
+ }
includes/vendor/composer/installers/src/Composer/Installers/CroogoInstaller.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class CroogoInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'Plugin/{$name}/',
8
+ 'theme' => 'View/Themed/{$name}/',
9
+ );
10
+
11
+ /**
12
+ * Format package name to CamelCase
13
+ */
14
+ public function inflectPackageVars($vars)
15
+ {
16
+ $vars['name'] = strtolower(str_replace(array('-', '_'), ' ', $vars['name']));
17
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
18
+
19
+ return $vars;
20
+ }
21
+ }
includes/vendor/composer/installers/src/Composer/Installers/DokuWikiInstaller.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class DokuWikiInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'lib/plugins/{$name}/',
8
+ 'template' => 'lib/tpl/{$name}/',
9
+ );
10
+
11
+ /**
12
+ * Format package name.
13
+ *
14
+ * For package type dokuwiki-plugin, cut off a trailing '-plugin',
15
+ * or leading dokuwiki_ if present.
16
+ *
17
+ * For package type dokuwiki-template, cut off a trailing '-template' if present.
18
+ *
19
+ */
20
+ public function inflectPackageVars($vars)
21
+ {
22
+
23
+ if ($vars['type'] === 'dokuwiki-plugin') {
24
+ return $this->inflectPluginVars($vars);
25
+ }
26
+
27
+ if ($vars['type'] === 'dokuwiki-template') {
28
+ return $this->inflectTemplateVars($vars);
29
+ }
30
+
31
+ return $vars;
32
+ }
33
+
34
+ protected function inflectPluginVars($vars)
35
+ {
36
+ $vars['name'] = preg_replace('/-plugin$/', '', $vars['name']);
37
+ $vars['name'] = preg_replace('/^dokuwiki_?-?/', '', $vars['name']);
38
+
39
+ return $vars;
40
+ }
41
+
42
+ protected function inflectTemplateVars($vars)
43
+ {
44
+ $vars['name'] = preg_replace('/-template$/', '', $vars['name']);
45
+ $vars['name'] = preg_replace('/^dokuwiki_?-?/', '', $vars['name']);
46
+
47
+ return $vars;
48
+ }
49
+
50
+ }
includes/vendor/composer/installers/src/Composer/Installers/DolibarrInstaller.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * Class DolibarrInstaller
6
+ *
7
+ * @package Composer\Installers
8
+ * @author Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
9
+ */
10
+ class DolibarrInstaller extends BaseInstaller
11
+ {
12
+ //TODO: Add support for scripts and themes
13
+ protected $locations = array(
14
+ 'module' => 'htdocs/custom/{$name}/',
15
+ );
16
+ }
includes/vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class DrupalInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'core' => 'core/',
8
+ 'module' => 'modules/{$name}/',
9
+ 'theme' => 'themes/{$name}/',
10
+ 'library' => 'libraries/{$name}/',
11
+ 'profile' => 'profiles/{$name}/',
12
+ 'drush' => 'drush/{$name}/',
13
+ );
14
+ }
includes/vendor/composer/installers/src/Composer/Installers/ElggInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class ElggInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'mod/{$name}/',
8
+ );
9
+ }
includes/vendor/composer/installers/src/Composer/Installers/FuelInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class FuelInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'fuel/app/modules/{$name}/',
8
+ 'package' => 'fuel/packages/{$name}/',
9
+ 'theme' => 'fuel/app/themes/{$name}/',
10
+ );
11
+ }
includes/vendor/composer/installers/src/Composer/Installers/FuelphpInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class FuelphpInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'component' => 'components/{$name}/',
8
+ );
9
+ }
includes/vendor/composer/installers/src/Composer/Installers/GravInstaller.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class GravInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'user/plugins/{$name}/',
8
+ 'theme' => 'user/themes/{$name}/',
9
+ );
10
+
11
+ /**
12
+ * Format package name
13
+ *
14
+ * @param array $vars
15
+ *
16
+ * @return array
17
+ */
18
+ public function inflectPackageVars($vars)
19
+ {
20
+ $restrictedWords = implode('|', array_keys($this->locations));
21
+
22
+ $vars['name'] = strtolower($vars['name']);
23
+ $vars['name'] = preg_replace('/^(?:grav-)?(?:(?:'.$restrictedWords.')-)?(.*?)(?:-(?:'.$restrictedWords.'))?$/ui',
24
+ '$1',
25
+ $vars['name']
26
+ );
27
+
28
+ return $vars;
29
+ }
30
+ }
includes/vendor/composer/installers/src/Composer/Installers/HuradInstaller.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class HuradInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'plugins/{$name}/',
8
+ 'theme' => 'plugins/{$name}/',
9
+ );
10
+
11
+ /**
12
+ * Format package name to CamelCase
13
+ */
14
+ public function inflectPackageVars($vars)
15
+ {
16
+ $nameParts = explode('/', $vars['name']);
17
+ foreach ($nameParts as &$value) {
18
+ $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
19
+ $value = str_replace(array('-', '_'), ' ', $value);
20
+ $value = str_replace(' ', '', ucwords($value));
21
+ }
22
+ $vars['name'] = implode('/', $nameParts);
23
+ return $vars;
24
+ }
25
+ }
includes/vendor/composer/installers/src/Composer/Installers/Installer.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ use Composer\Installer\LibraryInstaller;
5
+ use Composer\Package\PackageInterface;
6
+ use Composer\Repository\InstalledRepositoryInterface;
7
+
8
+ class Installer extends LibraryInstaller
9
+ {
10
+ /**
11
+ * Package types to installer class map
12
+ *
13
+ * @var array
14
+ */
15
+ private $supportedTypes = array(
16
+ 'aimeos' => 'AimeosInstaller',
17
+ 'asgard' => 'AsgardInstaller',
18
+ 'agl' => 'AglInstaller',
19
+ 'annotatecms' => 'AnnotateCmsInstaller',
20
+ 'bitrix' => 'BitrixInstaller',
21
+ 'cakephp' => 'CakePHPInstaller',
22
+ 'chef' => 'ChefInstaller',
23
+ 'ccframework' => 'ClanCatsFrameworkInstaller',
24
+ 'codeigniter' => 'CodeIgniterInstaller',
25
+ 'concrete5' => 'Concrete5Installer',
26
+ 'craft' => 'CraftInstaller',
27
+ 'croogo' => 'CroogoInstaller',
28
+ 'dokuwiki' => 'DokuWikiInstaller',
29
+ 'dolibarr' => 'DolibarrInstaller',
30
+ 'drupal' => 'DrupalInstaller',
31
+ 'elgg' => 'ElggInstaller',
32
+ 'fuel' => 'FuelInstaller',
33
+ 'fuelphp' => 'FuelphpInstaller',
34
+ 'grav' => 'GravInstaller',
35
+ 'hurad' => 'HuradInstaller',
36
+ 'joomla' => 'JoomlaInstaller',
37
+ 'kirby' => 'KirbyInstaller',
38
+ 'kohana' => 'KohanaInstaller',
39
+ 'laravel' => 'LaravelInstaller',
40
+ 'lithium' => 'LithiumInstaller',
41
+ 'magento' => 'MagentoInstaller',
42
+ 'mako' => 'MakoInstaller',
43
+ 'mediawiki' => 'MediaWikiInstaller',
44
+ 'microweber' => 'MicroweberInstaller',
45
+ 'modulework' => 'MODULEWorkInstaller',
46
+ 'modxevo' => 'MODXEvoInstaller',
47
+ 'moodle' => 'MoodleInstaller',
48
+ 'october' => 'OctoberInstaller',
49
+ 'oxid' => 'OxidInstaller',
50
+ 'phpbb' => 'PhpBBInstaller',
51
+ 'pimcore' => 'PimcoreInstaller',
52
+ 'piwik' => 'PiwikInstaller',
53
+ 'ppi' => 'PPIInstaller',
54
+ 'puppet' => 'PuppetInstaller',
55
+ 'redaxo' => 'RedaxoInstaller',
56
+ 'roundcube' => 'RoundcubeInstaller',
57
+ 'shopware' => 'ShopwareInstaller',
58
+ 'silverstripe' => 'SilverStripeInstaller',
59
+ 'smf' => 'SMFInstaller',
60
+ 'symfony1' => 'Symfony1Installer',
61
+ 'thelia' => 'TheliaInstaller',
62
+ 'tusk' => 'TuskInstaller',
63
+ 'typo3-cms' => 'TYPO3CmsInstaller',
64
+ 'typo3-flow' => 'TYPO3FlowInstaller',
65
+ 'whmcs' => 'WHMCSInstaller',
66
+ 'wolfcms' => 'WolfCMSInstaller',
67
+ 'wordpress' => 'WordPressInstaller',
68
+ 'zend' => 'ZendInstaller',
69
+ 'zikula' => 'ZikulaInstaller',
70
+ 'prestashop' => 'PrestashopInstaller',
71
+ );
72
+
73
+ /**
74
+ * {@inheritDoc}
75
+ */
76
+ public function getInstallPath(PackageInterface $package)
77
+ {
78
+ $type = $package->getType();
79
+ $frameworkType = $this->findFrameworkType($type);
80
+
81
+ if ($frameworkType === false) {
82
+ throw new \InvalidArgumentException(
83
+ 'Sorry the package type of this package is not yet supported.'
84
+ );
85
+ }
86
+
87
+ $class = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType];
88
+ $installer = new $class($package, $this->composer);
89
+
90
+ return $installer->getInstallPath($package, $frameworkType);
91
+ }
92
+
93
+ public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
94
+ {
95
+ if (!$repo->hasPackage($package)) {
96
+ throw new \InvalidArgumentException('Package is not installed: '.$package);
97
+ }
98
+
99
+ $repo->removePackage($package);
100
+
101
+ $installPath = $this->getInstallPath($package);
102
+ $this->io->write(sprintf('Deleting %s - %s', $installPath, $this->filesystem->removeDirectory($installPath) ? '<comment>deleted</comment>' : '<error>not deleted</error>'));
103
+ }
104
+
105
+ /**
106
+ * {@inheritDoc}
107
+ */
108
+ public function supports($packageType)
109
+ {
110
+ $frameworkType = $this->findFrameworkType($packageType);
111
+
112
+ if ($frameworkType === false) {
113
+ return false;
114
+ }
115
+
116
+ $locationPattern = $this->getLocationPattern($frameworkType);
117
+
118
+ return preg_match('#' . $frameworkType . '-' . $locationPattern . '#', $packageType, $matches) === 1;
119
+ }
120
+
121
+ /**
122
+ * Finds a supported framework type if it exists and returns it
123
+ *
124
+ * @param string $type
125
+ * @return string
126
+ */
127
+ protected function findFrameworkType($type)
128
+ {
129
+ $frameworkType = false;
130
+
131
+ krsort($this->supportedTypes);
132
+
133
+ foreach ($this->supportedTypes as $key => $val) {
134
+ if ($key === substr($type, 0, strlen($key))) {
135
+ $frameworkType = substr($type, 0, strlen($key));
136
+ break;
137
+ }
138
+ }
139
+
140
+ return $frameworkType;
141
+ }
142
+
143
+ /**
144
+ * Get the second part of the regular expression to check for support of a
145
+ * package type
146
+ *
147
+ * @param string $frameworkType
148
+ * @return string
149
+ */
150
+ protected function getLocationPattern($frameworkType)
151
+ {
152
+ $pattern = false;
153
+ if (!empty($this->supportedTypes[$frameworkType])) {
154
+ $frameworkClass = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType];
155
+ /** @var BaseInstaller $framework */
156
+ $framework = new $frameworkClass(null, $this->composer);
157
+ $locations = array_keys($framework->getLocations());
158
+ $pattern = $locations ? '(' . implode('|', $locations) . ')' : false;
159
+ }
160
+
161
+ return $pattern ? : '(\w+)';
162
+ }
163
+ }
includes/vendor/composer/installers/src/Composer/Installers/JoomlaInstaller.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class JoomlaInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'component' => 'components/{$name}/',
8
+ 'module' => 'modules/{$name}/',
9
+ 'template' => 'templates/{$name}/',
10
+ 'plugin' => 'plugins/{$name}/',
11
+ 'library' => 'libraries/{$name}/',
12
+ );
13
+
14
+ // TODO: Add inflector for mod_ and com_ names
15
+ }
includes/vendor/composer/installers/src/Composer/Installers/KirbyInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class KirbyInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'site/plugins/{$name}/',
8
+ );
9
+ }
includes/vendor/composer/installers/src/Composer/Installers/KohanaInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class KohanaInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'modules/{$name}/',
8
+ );
9
+ }
includes/vendor/composer/installers/src/Composer/Installers/LaravelInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class LaravelInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'library' => 'libraries/{$name}/',
8
+ );
9
+ }
includes/vendor/composer/installers/src/Composer/Installers/LithiumInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class LithiumInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'library' => 'libraries/{$name}/',
8
+ 'source' => 'libraries/_source/{$name}/',
9
+ );
10
+ }
includes/vendor/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class MODULEWorkInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'modules/{$name}/',
8
+ );
9
+ }
includes/vendor/composer/installers/src/Composer/Installers/MODXEvoInstaller.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * An installer to handle MODX Evolution specifics when installing packages.
6
+ */
7
+ class MODXEvoInstaller extends BaseInstaller
8
+ {
9
+ protected $locations = array(
10
+ 'snippet' => 'assets/snippets/{$name}/',
11
+ 'plugin' => 'assets/plugins/{$name}/',
12
+ 'module' => 'assets/modules/{$name}/',
13
+ 'template' => 'assets/templates/{$name}/',
14
+ 'lib' => 'assets/lib/{$name}/'
15
+ );
16
+ }
includes/vendor/composer/installers/src/Composer/Installers/MagentoInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class MagentoInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'theme' => 'app/design/frontend/{$name}/',
8
+ 'skin' => 'skin/frontend/default/{$name}/',
9
+ 'library' => 'lib/{$name}/',
10
+ );
11
+ }
includes/vendor/composer/installers/src/Composer/Installers/MakoInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class MakoInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'package' => 'app/packages/{$name}/',
8
+ );
9
+ }
includes/vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class MediaWikiInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'extension' => 'extensions/{$name}/',
8
+ 'skin' => 'skins/{$name}/',
9
+ );
10
+
11
+ /**
12
+ * Format package name.
13
+ *
14
+ * For package type mediawiki-extension, cut off a trailing '-extension' if present and transform
15
+ * to CamelCase keeping existing uppercase chars.
16
+ *
17
+ * For package type mediawiki-skin, cut off a trailing '-skin' if present.
18
+ *
19
+ */
20
+ public function inflectPackageVars($vars)
21
+ {
22
+
23
+ if ($vars['type'] === 'mediawiki-extension') {
24
+ return $this->inflectExtensionVars($vars);
25
+ }
26
+
27
+ if ($vars['type'] === 'mediawiki-skin') {
28
+ return $this->inflectSkinVars($vars);
29
+ }
30
+
31
+ return $vars;
32
+ }
33
+
34
+ protected function inflectExtensionVars($vars)
35
+ {
36
+ $vars['name'] = preg_replace('/-extension$/', '', $vars['name']);
37
+ $vars['name'] = str_replace('-', ' ', $vars['name']);
38
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
39
+
40
+ return $vars;
41
+ }
42
+
43
+ protected function inflectSkinVars($vars)
44
+ {
45
+ $vars['name'] = preg_replace('/-skin$/', '', $vars['name']);
46
+
47
+ return $vars;
48
+ }
49
+
50
+ }
includes/vendor/composer/installers/src/Composer/Installers/MicroweberInstaller.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class MicroweberInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'userfiles/modules/{$name}/',
8
+ 'module-skin' => 'userfiles/modules/{$name}/templates/',
9
+ 'template' => 'userfiles/templates/{$name}/',
10
+ 'element' => 'userfiles/elements/{$name}/',
11
+ 'vendor' => 'vendor/{$name}/',
12
+ 'components' => 'components/{$name}/'
13
+ );
14
+
15
+ /**
16
+ * Format package name.
17
+ *
18
+ * For package type microweber-module, cut off a trailing '-module' if present
19
+ *
20
+ * For package type microweber-template, cut off a trailing '-template' if present.
21
+ *
22
+ */
23
+ public function inflectPackageVars($vars)
24
+ {
25
+ if ($vars['type'] === 'microweber-template') {
26
+ return $this->inflectTemplateVars($vars);
27
+ }
28
+ if ($vars['type'] === 'microweber-templates') {
29
+ return $this->inflectTemplatesVars($vars);
30
+ }
31
+ if ($vars['type'] === 'microweber-core') {
32
+ return $this->inflectCoreVars($vars);
33
+ }
34
+ if ($vars['type'] === 'microweber-adapter') {
35
+ return $this->inflectCoreVars($vars);
36
+ }
37
+ if ($vars['type'] === 'microweber-module') {
38
+ return $this->inflectModuleVars($vars);
39
+ }
40
+ if ($vars['type'] === 'microweber-modules') {
41
+ return $this->inflectModulesVars($vars);
42
+ }
43
+ if ($vars['type'] === 'microweber-skin') {
44
+ return $this->inflectSkinVars($vars);
45
+ }
46
+ if ($vars['type'] === 'microweber-element' or $vars['type'] === 'microweber-elements') {
47
+ return $this->inflectElementVars($vars);
48
+ }
49
+
50
+ return $vars;
51
+ }
52
+
53
+ protected function inflectTemplateVars($vars)
54
+ {
55
+ $vars['name'] = preg_replace('/-template$/', '', $vars['name']);
56
+ $vars['name'] = preg_replace('/template-$/', '', $vars['name']);
57
+
58
+ return $vars;
59
+ }
60
+
61
+ protected function inflectTemplatesVars($vars)
62
+ {
63
+ $vars['name'] = preg_replace('/-templates$/', '', $vars['name']);
64
+ $vars['name'] = preg_replace('/templates-$/', '', $vars['name']);
65
+
66
+ return $vars;
67
+ }
68
+
69
+ protected function inflectCoreVars($vars)
70
+ {
71
+ $vars['name'] = preg_replace('/-providers$/', '', $vars['name']);
72
+ $vars['name'] = preg_replace('/-provider$/', '', $vars['name']);
73
+ $vars['name'] = preg_replace('/-adapter$/', '', $vars['name']);
74
+
75
+ return $vars;
76
+ }
77
+
78
+ protected function inflectModuleVars($vars)
79
+ {
80
+ $vars['name'] = preg_replace('/-module$/', '', $vars['name']);
81
+ $vars['name'] = preg_replace('/module-$/', '', $vars['name']);
82
+
83
+ return $vars;
84
+ }
85
+
86
+ protected function inflectModulesVars($vars)
87
+ {
88
+ $vars['name'] = preg_replace('/-modules$/', '', $vars['name']);
89
+ $vars['name'] = preg_replace('/modules-$/', '', $vars['name']);
90
+
91
+ return $vars;
92
+ }
93
+
94
+ protected function inflectSkinVars($vars)
95
+ {
96
+ $vars['name'] = preg_replace('/-skin$/', '', $vars['name']);
97
+ $vars['name'] = preg_replace('/skin-$/', '', $vars['name']);
98
+
99
+ return $vars;
100
+ }
101
+
102
+ protected function inflectElementVars($vars)
103
+ {
104
+ $vars['name'] = preg_replace('/-elements$/', '', $vars['name']);
105
+ $vars['name'] = preg_replace('/elements-$/', '', $vars['name']);
106
+ $vars['name'] = preg_replace('/-element$/', '', $vars['name']);
107
+ $vars['name'] = preg_replace('/element-$/', '', $vars['name']);
108
+
109
+ return $vars;
110
+ }
111
+ }
includes/vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class MoodleInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'mod' => 'mod/{$name}/',
8
+ 'admin_report' => 'admin/report/{$name}/',
9
+ 'tool' => 'admin/tool/{$name}/',
10
+ 'assignment' => 'mod/assignment/type/{$name}/',
11
+ 'assignsubmission' => 'mod/assign/submission/{$name}/',
12
+ 'assignfeedback' => 'mod/assign/feedback/{$name}/',
13
+ 'auth' => 'auth/{$name}/',
14
+ 'availability' => 'availability/condition/{$name}/',
15
+ 'block' => 'blocks/{$name}/',
16
+ 'calendartype' => 'calendar/type/{$name}/',
17
+ 'format' => 'course/format/{$name}/',
18
+ 'coursereport' => 'course/report/{$name}/',
19
+ 'datafield' => 'mod/data/field/{$name}/',
20
+ 'datapreset' => 'mod/data/preset/{$name}/',
21
+ 'editor' => 'lib/editor/{$name}/',
22
+ 'enrol' => 'enrol/{$name}/',
23
+ 'filter' => 'filter/{$name}/',
24
+ 'gradeexport' => 'grade/export/{$name}/',
25
+ 'gradeimport' => 'grade/import/{$name}/',
26
+ 'gradereport' => 'grade/report/{$name}/',
27
+ 'gradingform' => 'grade/grading/form/{$name}/',
28
+ 'local' => 'local/{$name}/',
29
+ 'message' => 'message/output/{$name}/',
30
+ 'plagiarism' => 'plagiarism/{$name}/',
31
+ 'portfolio' => 'portfolio/{$name}/',
32
+ 'qbehaviour' => 'question/behaviour/{$name}/',
33
+ 'qformat' => 'question/format/{$name}/',
34
+ 'qtype' => 'question/type/{$name}/',
35
+ 'quizaccess' => 'mod/quiz/accessrule/{$name}/',
36
+ 'quiz' => 'mod/quiz/report/{$name}/',
37
+ 'report' => 'report/{$name}/',
38
+ 'repository' => 'repository/{$name}/',
39
+ 'scormreport' => 'mod/scorm/report/{$name}/',
40
+ 'theme' => 'theme/{$name}/',
41
+ 'profilefield' => 'user/profile/field/{$name}/',
42
+ 'webservice' => 'webservice/{$name}/',
43
+ 'workshopallocation' => 'mod/workshop/allocation/{$name}/',
44
+ 'workshopeval' => 'mod/workshop/eval/{$name}/',
45
+ 'workshopform' => 'mod/workshop/form/{$name}/'
46
+ );
47
+ }
includes/vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class OctoberInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'modules/{$name}/',
8
+ 'plugin' => 'plugins/{$vendor}/{$name}/',
9
+ 'theme' => 'themes/{$name}/'
10
+ );
11
+
12
+ /**
13
+ * Format package name.
14
+ *
15
+ * For package type october-plugin, cut off a trailing '-plugin' if present.
16
+ *
17
+ * For package type october-theme, cut off a trailing '-theme' if present.
18
+ *
19
+ */
20
+ public function inflectPackageVars($vars)
21
+ {
22
+ if ($vars['type'] === 'october-plugin') {
23
+ return $this->inflectPluginVars($vars);
24
+ }
25
+
26
+ if ($vars['type'] === 'october-theme') {
27
+ return $this->inflectThemeVars($vars);
28
+ }
29
+
30
+ return $vars;
31
+ }
32
+
33
+ protected function inflectPluginVars($vars)
34
+ {
35
+ $vars['name'] = preg_replace('/-plugin$/', '', $vars['name']);
36
+
37
+ return $vars;
38
+ }
39
+
40
+ protected function inflectThemeVars($vars)
41
+ {
42
+ $vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
43
+
44
+ return $vars;
45
+ }
46
+ }
includes/vendor/composer/installers/src/Composer/Installers/OxidInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class OxidInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'modules/{$name}/',
8
+ 'theme' => 'application/views/{$name}/',
9
+ 'out' => 'out/{$name}/',
10
+ );
11
+ }
includes/vendor/composer/installers/src/Composer/Installers/PPIInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class PPIInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'modules/{$name}/',
8
+ );
9
+ }
includes/vendor/composer/installers/src/Composer/Installers/PhpBBInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class PhpBBInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'extension' => 'ext/{$vendor}/{$name}/',
8
+ 'language' => 'language/{$name}/',
9
+ 'style' => 'styles/{$name}/',
10
+ );
11
+ }
includes/vendor/composer/installers/src/Composer/Installers/PimcoreInstaller.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class PimcoreInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'plugins/{$name}/',
8
+ );
9
+
10
+ /**
11
+ * Format package name to CamelCase
12
+ */
13
+ public function inflectPackageVars($vars)
14
+ {
15
+ $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
16
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
17
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
18
+
19
+ return $vars;
20
+ }
21
+ }
includes/vendor/composer/installers/src/Composer/Installers/PiwikInstaller.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * Class PiwikInstaller
6
+ *
7
+ * @package Composer\Installers
8
+ */
9
+ class PiwikInstaller extends BaseInstaller
10
+ {
11
+ /**
12
+ * @var array
13
+ */
14
+ protected $locations = array(
15
+ 'plugin' => 'plugins/{$name}/',
16
+ );
17
+
18
+ /**
19
+ * Format package name to CamelCase
20
+ * @param array $vars
21
+ *
22
+ * @return array
23
+ */
24
+ public function inflectPackageVars($vars)
25
+ {
26
+ $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
27
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
28
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
29
+
30
+ return $vars;
31
+ }
32
+ }
includes/vendor/composer/installers/src/Composer/Installers/PrestashopInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class PrestashopInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'modules/{$name}/',
8
+ 'theme' => 'themes/{$name}/',
9
+ );
10
+ }
includes/vendor/composer/installers/src/Composer/Installers/PuppetInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Composer\Installers;
4
+
5
+ class PuppetInstaller extends BaseInstaller
6
+ {
7
+
8
+ protected $locations = array(
9
+ 'module' => 'modules/{$name}/',
10
+ );
11
+ }
includes/vendor/composer/installers/src/Composer/Installers/RedaxoInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class RedaxoInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'addon' => 'redaxo/include/addons/{$name}/',
8
+ 'bestyle-plugin' => 'redaxo/include/addons/be_style/plugins/{$name}/'
9
+ );
10
+ }
includes/vendor/composer/installers/src/Composer/Installers/RoundcubeInstaller.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class RoundcubeInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'plugins/{$name}/',
8
+ );
9
+
10
+ /**
11
+ * Lowercase name and changes the name to a underscores
12
+ *
13
+ * @param array $vars
14
+ * @return array
15
+ */
16
+ public function inflectPackageVars($vars)
17
+ {
18
+ $vars['name'] = strtolower(str_replace('-', '_', $vars['name']));
19
+
20
+ return $vars;
21
+ }
22
+ }
includes/vendor/composer/installers/src/Composer/Installers/SMFInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class SMFInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'Sources/{$name}/',
8
+ 'theme' => 'Themes/{$name}/',
9
+ );
10
+ }
includes/vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * Plugin/theme installer for shopware
6
+ * @author Benjamin Boit
7
+ */
8
+ class ShopwareInstaller extends BaseInstaller
9
+ {
10
+ protected $locations = array(
11
+ 'backend-plugin' => 'engine/Shopware/Plugins/Local/Backend/{$name}/',
12
+ 'core-plugin' => 'engine/Shopware/Plugins/Local/Core/{$name}/',
13
+ 'frontend-plugin' => 'engine/Shopware/Plugins/Local/Frontend/{$name}/',
14
+ 'theme' => 'templates/{$name}/'
15
+ );
16
+
17
+ /**
18
+ * Transforms the names
19
+ * @param array $vars
20
+ * @return array
21
+ */
22
+ public function inflectPackageVars($vars)
23
+ {
24
+ if ($vars['type'] === 'shopware-theme') {
25
+ return $this->correctThemeName($vars);
26
+ } else {
27
+ return $this->correctPluginName($vars);
28
+ }
29
+ }
30
+
31
+ /**
32
+ * Changes the name to a camelcased combination of vendor and name
33
+ * @param array $vars
34
+ * @return array
35
+ */
36
+ private function correctPluginName($vars)
37
+ {
38
+ $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
39
+ return strtoupper($matches[0][1]);
40
+ }, $vars['name']);
41
+
42
+ $vars['name'] = ucfirst($vars['vendor']) . ucfirst($camelCasedName);
43
+
44
+ return $vars;
45
+ }
46
+
47
+ /**
48
+ * Changes the name to a underscore separated name
49
+ * @param array $vars
50
+ * @return array
51
+ */
52
+ private function correctThemeName($vars)
53
+ {
54
+ $vars['name'] = str_replace('-', '_', $vars['name']);
55
+
56
+ return $vars;
57
+ }
58
+ }
includes/vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ use Composer\Package\PackageInterface;
5
+
6
+ class SilverStripeInstaller extends BaseInstaller
7
+ {
8
+ protected $locations = array(
9
+ 'module' => '{$name}/',
10
+ 'theme' => 'themes/{$name}/',
11
+ );
12
+
13
+ /**
14
+ * Return the install path based on package type.
15
+ *
16
+ * Relies on built-in BaseInstaller behaviour with one exception: silverstripe/framework
17
+ * must be installed to 'sapphire' and not 'framework' if the version is <3.0.0
18
+ *
19
+ * @param PackageInterface $package
20
+ * @param string $frameworkType
21
+ * @return string
22
+ */
23
+ public function getInstallPath(PackageInterface $package, $frameworkType = '')
24
+ {
25
+ if (
26
+ $package->getName() == 'silverstripe/framework'
27
+ && preg_match('/^\d+\.\d+\.\d+/', $package->getVersion())
28
+ && version_compare($package->getVersion(), '2.999.999') < 0
29
+ ) {
30
+ return $this->templatePath($this->locations['module'], array('name' => 'sapphire'));
31
+ } else {
32
+ return parent::getInstallPath($package, $frameworkType);
33
+ }
34
+
35
+ }
36
+ }
includes/vendor/composer/installers/src/Composer/Installers/Symfony1Installer.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * Plugin installer for symfony 1.x
6
+ *
7
+ * @author Jérôme Tamarelle <jerome@tamarelle.net>
8
+ */
9
+ class Symfony1Installer extends BaseInstaller
10
+ {
11
+ protected $locations = array(
12
+ 'plugin' => 'plugins/{$name}/',
13
+ );
14
+
15
+ /**
16
+ * Format package name to CamelCase
17
+ */
18
+ public function inflectPackageVars($vars)
19
+ {
20
+ $vars['name'] = preg_replace_callback('/(-[a-z])/', function ($matches) {
21
+ return strtoupper($matches[0][1]);
22
+ }, $vars['name']);
23
+
24
+ return $vars;
25
+ }
26
+ }
includes/vendor/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * Extension installer for TYPO3 CMS
6
+ *
7
+ * @author Sascha Egerer <sascha.egerer@dkd.de>
8
+ */
9
+ class TYPO3CmsInstaller extends BaseInstaller
10
+ {
11
+ protected $locations = array(
12
+ 'extension' => 'typo3conf/ext/{$name}/',
13
+ );
14
+ }
includes/vendor/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * An installer to handle TYPO3 Flow specifics when installing packages.
6
+ */
7
+ class TYPO3FlowInstaller extends BaseInstaller
8
+ {
9
+ protected $locations = array(
10
+ 'package' => 'Packages/Application/{$name}/',
11
+ 'framework' => 'Packages/Framework/{$name}/',
12
+ 'plugin' => 'Packages/Plugins/{$name}/',
13
+ 'site' => 'Packages/Sites/{$name}/',
14
+ 'boilerplate' => 'Packages/Boilerplates/{$name}/',
15
+ 'build' => 'Build/{$name}/',
16
+ );
17
+
18
+ /**
19
+ * Modify the package name to be a TYPO3 Flow style key.
20
+ *
21
+ * @param array $vars
22
+ * @return array
23
+ */
24
+ public function inflectPackageVars($vars)
25
+ {
26
+ $autoload = $this->package->getAutoload();
27
+ if (isset($autoload['psr-0']) && is_array($autoload['psr-0'])) {
28
+ $namespace = key($autoload['psr-0']);
29
+ $vars['name'] = str_replace('\\', '.', $namespace);
30
+ }
31
+ if (isset($autoload['psr-4']) && is_array($autoload['psr-4'])) {
32
+ $namespace = key($autoload['psr-4']);
33
+ $vars['name'] = rtrim(str_replace('\\', '.', $namespace), '.');
34
+ }
35
+
36
+ return $vars;
37
+ }
38
+ }
includes/vendor/composer/installers/src/Composer/Installers/TheliaInstaller.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class TheliaInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'local/modules/{$name}/',
8
+ 'frontoffice-template' => 'templates/frontOffice/{$name}/',
9
+ 'backoffice-template' => 'templates/backOffice/{$name}/',
10
+ 'email-template' => 'templates/email/{$name}/',
11
+ );
12
+ }
includes/vendor/composer/installers/src/Composer/Installers/TuskInstaller.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+ /**
4
+ * Composer installer for 3rd party Tusk utilities
5
+ * @author Drew Ewing <drew@phenocode.com>
6
+ */
7
+ class TuskInstaller extends BaseInstaller
8
+ {
9
+ protected $locations = array(
10
+ 'task' => '.tusk/tasks/{$name}/',
11
+ 'command' => '.tusk/commands/{$name}/',
12
+ 'asset' => 'assets/tusk/{$name}/',
13
+ );
14
+ }
includes/vendor/composer/installers/src/Composer/Installers/WHMCSInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Composer\Installers;
4
+
5
+ class WHMCSInstaller extends BaseInstaller
6
+ {
7
+ protected $locations = array(
8
+ 'gateway' => 'modules/gateways/{$name}/',
9
+ );
10
+ }
includes/vendor/composer/installers/src/Composer/Installers/WolfCMSInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class WolfCMSInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'wolf/plugins/{$name}/',
8
+ );
9
+ }
includes/vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class WordPressInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'wp-content/plugins/{$name}/',
8
+ 'theme' => 'wp-content/themes/{$name}/',
9
+ 'muplugin' => 'wp-content/mu-plugins/{$name}/',
10
+ );
11
+ }
includes/vendor/composer/installers/src/Composer/Installers/ZendInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class ZendInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'library' => 'library/{$name}/',
8
+ 'extra' => 'extras/library/{$name}/',
9
+ 'module' => 'module/{$name}/',
10
+ );
11
+ }
includes/vendor/composer/installers/src/Composer/Installers/ZikulaInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class ZikulaInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'modules/{$vendor}-{$name}/',
8
+ 'theme' => 'themes/{$vendor}-{$name}/'
9
+ );
10
+ }
includes/vendor/composer/installers/src/bootstrap.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function includeIfExists($file)
3
+ {
4
+ if (file_exists($file)) {
5
+ return include $file;
6
+ }
7
+ }
8
+ if ((!$loader = includeIfExists(__DIR__ . '/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__ . '/../../../autoload.php'))) {
9
+ die('You must set up the project dependencies, run the following commands:'.PHP_EOL.
10
+ 'curl -s http://getcomposer.org/installer | php'.PHP_EOL.
11
+ 'php composer.phar install'.PHP_EOL);
12
+ }
13
+ return $loader;
includes/vendor/composer/installers/tests/Composer/Installers/Test/AsgardInstallerTest.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers\Test;
3
+
4
+ use Composer\Installers\AsgardInstaller;
5
+ use Composer\Package\Package;
6
+ use Composer\Composer;
7
+
8
+ class AsgardInstallerTest extends \PHPUnit_Framework_TestCase
9
+ {
10
+ /**
11
+ * @var OctoberInstaller
12
+ */
13
+ private $installer;
14
+
15
+ public function setUp()
16
+ {
17
+ $this->installer = new AsgardInstaller(
18
+ new Package('NyanCat', '4.2', '4.2'),
19
+ new Composer()
20
+ );
21
+ }
22
+
23
+ /**
24
+ * @dataProvider packageNameInflectionProvider
25
+ */
26
+ public function testInflectPackageVars($type, $name, $expected)
27
+ {
28
+ $this->assertEquals(
29
+ $this->installer->inflectPackageVars(array('name' => $name, 'type' => $type)),
30
+ array('name' => $expected, 'type' => $type)
31
+ );
32
+ }
33
+
34
+ public function packageNameInflectionProvider()
35
+ {
36
+ return array(
37
+ array(
38
+ 'asgard-module',
39
+ 'asgard-module',
40
+ 'Asgard'
41
+ ),
42
+ array(
43
+ 'asgard-module',
44
+ 'blog',
45
+ 'Blog'
46
+ ),
47
+ // tests that exactly one '-theme' is cut off
48
+ array(
49
+ 'asgard-theme',
50
+ 'some-theme-theme',
51
+ 'Some-theme',
52
+ ),
53
+ // tests that names without '-theme' suffix stay valid
54
+ array(
55
+ 'asgard-theme',
56
+ 'someothertheme',
57
+ 'Someothertheme',
58
+ ),
59
+ );
60
+ }
61
+ }
includes/vendor/composer/installers/tests/Composer/Installers/Test/CakePHPInstallerTest.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers\Test;
3
+
4
+ use Composer\Installers\CakePHPInstaller;
5
+ use Composer\Repository\RepositoryManager;
6
+ use Composer\Repository\InstalledArrayRepository;
7
+ use Composer\Package\Package;
8
+ use Composer\Package\RootPackage;
9
+ use Composer\Package\Link;
10
+ use Composer\Package\Version\VersionParser;
11
+ use Composer\Composer;
12
+ use Composer\Config;
13
+
14
+ class CakePHPInstallerTest extends TestCase
15
+ {
16
+ private $composer;
17
+ private $io;
18
+
19
+ /**
20
+ * setUp
21
+ *
22
+ * @return void
23
+ */
24
+ public function setUp()
25
+ {
26
+ $this->package = new Package('CamelCased', '1.0', '1.0');
27
+ $this->io = $this->getMock('Composer\IO\PackageInterface');
28
+ $this->composer = new Composer();
29
+ $this->composer->setConfig(new Config(false));
30
+ }
31
+
32
+ /**
33
+ * testInflectPackageVars
34
+ *
35
+ * @return void
36
+ */
37
+ public function testInflectPackageVars()
38
+ {
39
+ $installer = new CakePHPInstaller($this->package, $this->composer);
40
+ $result = $installer->inflectPackageVars(array('name' => 'CamelCased'));
41
+ $this->assertEquals($result, array('name' => 'CamelCased'));
42
+
43
+ $installer = new CakePHPInstaller($this->package, $this->composer);
44
+ $result = $installer->inflectPackageVars(array('name' => 'with-dash'));
45
+ $this->assertEquals($result, array('name' => 'WithDash'));
46
+
47
+ $installer = new CakePHPInstaller($this->package, $this->composer);
48
+ $result = $installer->inflectPackageVars(array('name' => 'with_underscore'));
49
+ $this->assertEquals($result, array('name' => 'WithUnderscore'));
50
+
51
+ $installer = new CakePHPInstaller($this->package, $this->composer);
52
+ $result = $installer->inflectPackageVars(array('name' => 'cake/acl'));
53
+ $this->assertEquals($result, array('name' => 'Cake/Acl'));
54
+
55
+ $installer = new CakePHPInstaller($this->package, $this->composer);
56
+ $result = $installer->inflectPackageVars(array('name' => 'cake/debug-kit'));
57
+ $this->assertEquals($result, array('name' => 'Cake/DebugKit'));
58
+ }
59
+
60
+ /**
61
+ * Test getLocations returning appropriate values based on CakePHP version
62
+ *
63
+ */
64
+ public function testGetLocations() {
65
+ $package = new RootPackage('CamelCased', '1.0', '1.0');
66
+ $composer = $this->composer;
67
+ $rm = new RepositoryManager(
68
+ $this->getMock('Composer\IO\IOInterface'),
69
+ $this->getMock('Composer\Config')
70
+ );
71
+ $composer->setRepositoryManager($rm);
72
+ $installer = new CakePHPInstaller($package, $composer);
73
+
74
+ // 2.0 < cakephp < 3.0
75
+ $this->setCakephpVersion($rm, '2.0.0');
76
+ $result = $installer->getLocations();
77
+ $this->assertContains('Plugin/', $result['plugin']);
78
+
79
+ $this->setCakephpVersion($rm, '2.5.9');
80
+ $result = $installer->getLocations();
81
+ $this->assertContains('Plugin/', $result['plugin']);
82
+
83
+ $this->setCakephpVersion($rm, '~2.5');
84
+ $result = $installer->getLocations();
85
+ $this->assertContains('Plugin/', $result['plugin']);
86
+
87
+ // special handling for 2.x versions when 3.x is still in development
88
+ $this->setCakephpVersion($rm, 'dev-master');
89
+ $result = $installer->getLocations();
90
+ $this->assertContains('Plugin/', $result['plugin']);
91
+
92
+ $this->setCakephpVersion($rm, '>=2.5');
93
+ $result = $installer->getLocations();
94
+ $this->assertContains('Plugin/', $result['plugin']);
95
+
96
+ // cakephp >= 3.0
97
+ $this->setCakephpVersion($rm, '3.0.*-dev');
98
+ $result = $installer->getLocations();
99
+ $this->assertContains('vendor/{$vendor}/{$name}/', $result['plugin']);
100
+
101
+ $this->setCakephpVersion($rm, '~8.8');
102
+ $result = $installer->getLocations();
103
+ $this->assertEquals('vendor/{$vendor}/{$name}/', $result['plugin']);
104
+ }
105
+
106
+ protected function setCakephpVersion($rm, $version) {
107
+ $parser = new VersionParser();
108
+ list(, $version) = explode(' ', $parser->parseConstraints($version));
109
+ $installed = new InstalledArrayRepository();
110
+ $package = new Package('cakephp/cakephp', $version, $version);
111
+ $installed->addPackage($package);
112
+ $rm->setLocalRepository($installed);
113
+ }
114
+
115
+ }
includes/vendor/composer/installers/tests/Composer/Installers/Test/DokuWikiInstallerTest.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers\Test;
3
+
4
+ use Composer\Installers\DokuWikiInstaller;
5
+ use Composer\Package\Package;
6
+ use Composer\Composer;
7
+
8
+ class DokuWikiInstallerTest extends \PHPUnit_Framework_TestCase
9
+ {
10
+ /**
11
+ * @var DokuWikiInstaller
12
+ */
13
+ private $installer;
14
+
15
+ public function setUp()
16
+ {
17
+ $this->installer = new DokuWikiInstaller(
18
+ new Package('NyanCat', '4.2', '4.2'),
19
+ new Composer()
20
+ );
21
+ }
22
+
23
+ /**
24
+ * @dataProvider packageNameInflectionProvider
25
+ */
26
+ public function testInflectPackageVars($type, $name, $expected)
27
+ {
28
+ $this->assertEquals(
29
+ $this->installer->inflectPackageVars(array('name' => $name, 'type'=>$type)),
30
+ array('name' => $expected, 'type'=>$type)
31
+ );
32
+ }
33
+
34
+ public function packageNameInflectionProvider()
35
+ {
36
+ return array(
37
+ array(
38
+ 'dokuwiki-plugin',
39
+ 'dokuwiki-test-plugin',
40
+ 'test',
41
+ ),
42
+ array(
43
+ 'dokuwiki-plugin',
44
+ 'test-plugin',
45
+ 'test',
46
+ ),
47
+ array(
48
+ 'dokuwiki-plugin',
49
+ 'dokuwiki_test',
50
+ 'test',
51
+ ),
52
+ array(
53
+ 'dokuwiki-plugin',
54
+ 'test',
55
+ 'test',
56
+ ),
57
+ array(
58
+ 'dokuwiki-plugin',
59
+ 'test-template',
60
+ 'test-template',
61
+ ),
62
+ array(
63
+ 'dokuwiki-template',
64
+ 'dokuwiki-test-template',
65
+ 'test',
66
+ ),
67
+ array(
68
+ 'dokuwiki-template',
69
+ 'test-template',
70
+ 'test',
71
+ ),
72
+ array(
73
+ 'dokuwiki-template',
74
+ 'dokuwiki_test',
75
+ 'test',
76
+ ),
77
+ array(
78
+ 'dokuwiki-template',
79
+ 'test',
80
+ 'test',
81
+ ),
82
+ array(
83
+ 'dokuwiki-template',
84
+ 'test-plugin',
85
+ 'test-plugin',
86
+ ),
87
+ );
88
+ }
89
+ }
includes/vendor/composer/installers/tests/Composer/Installers/Test/GravInstallerTest.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers\Test;
3
+
4
+ use Composer\Composer;
5
+ use Composer\Installers\GravInstaller;
6
+
7
+ class GravInstallerTest extends TestCase
8
+ {
9
+ /* @var \Composer\Composer */
10
+ protected $composer;
11
+
12
+ public function setUp()
13
+ {
14
+ $this->composer = new Composer();
15
+ }
16
+
17
+ public function testInflectPackageVars()
18
+ {
19
+ $package = $this->getPackage('vendor/name', '0.0.0');
20
+ $installer = new GravInstaller($package, $this->composer);
21
+ $packageVars = $this->getPackageVars($package);
22
+
23
+ $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => 'test')));
24
+ $this->assertEquals('test', $result['name']);
25
+
26
+ foreach ($installer->getLocations() as $name => $location) {
27
+ $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "$name-test")));
28
+ $this->assertEquals('test', $result['name']);
29
+ $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "test-$name")));
30
+ $this->assertEquals('test', $result['name']);
31
+ $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "$name-test-test")));
32
+ $this->assertEquals('test-test', $result['name']);
33
+ $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "test-test-$name")));
34
+ $this->assertEquals('test-test', $result['name']);
35
+ $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "grav-$name-test")));
36
+ $this->assertEquals('test', $result['name']);
37
+ $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "grav-test-$name")));
38
+ $this->assertEquals('test', $result['name']);
39
+ $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "grav-$name-test-test")));
40
+ $this->assertEquals('test-test', $result['name']);
41
+ $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "grav-test-test-$name")));
42
+ $this->assertEquals('test-test', $result['name']);
43
+ }
44
+ }
45
+
46
+ /**
47
+ * @param $package \Composer\Package\PackageInterface
48
+ */
49
+ public function getPackageVars($package)
50
+ {
51
+ $type = $package->getType();
52
+
53
+ $prettyName = $package->getPrettyName();
54
+ if (strpos($prettyName, '/') !== false) {
55
+ list($vendor, $name) = explode('/', $prettyName);
56
+ } else {
57
+ $vendor = '';
58
+ $name = $prettyName;
59
+ }
60
+
61
+ return compact('name', 'vendor', 'type');
62
+ }
63
+ }
includes/vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php ADDED
@@ -0,0 +1,422 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers\Test;
3
+
4
+ use Composer\Installers\Installer;
5
+ use Composer\Util\Filesystem;
6
+ use Composer\Package\Package;
7
+ use Composer\Package\RootPackage;
8
+ use Composer\Composer;
9
+ use Composer\Config;
10
+
11
+ class InstallerTest extends TestCase
12
+ {
13
+ private $composer;
14
+ private $config;
15
+ private $vendorDir;
16
+ private $binDir;
17
+ private $dm;
18
+ private $repository;
19
+ private $io;
20
+ private $fs;
21
+
22
+ /**
23
+ * setUp
24
+ *
25
+ * @return void
26
+ */
27
+ public function setUp()
28
+ {
29
+ $this->fs = new Filesystem;
30
+
31
+ $this->composer = new Composer();
32
+ $this->config = new Config();
33
+ $this->composer->setConfig($this->config);
34
+
35
+ $this->vendorDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'baton-test-vendor';
36
+ $this->ensureDirectoryExistsAndClear($this->vendorDir);
37
+
38
+ $this->binDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'baton-test-bin';
39
+ $this->ensureDirectoryExistsAndClear($this->binDir);
40
+
41
+ $this->config->merge(array(
42
+ 'config' => array(
43
+ 'vendor-dir' => $this->vendorDir,
44
+ 'bin-dir' => $this->binDir,
45
+ ),
46
+ ));
47
+
48
+ $this->dm = $this->getMockBuilder('Composer\Downloader\DownloadManager')
49
+ ->disableOriginalConstructor()
50
+ ->getMock();
51
+ $this->composer->setDownloadManager($this->dm);
52
+
53
+ $this->repository = $this->getMock('Composer\Repository\InstalledRepositoryInterface');
54
+ $this->io = $this->getMock('Composer\IO\IOInterface');
55
+ }
56
+
57
+ /**
58
+ * tearDown
59
+ *
60
+ * @return void
61
+ */
62
+ public function tearDown()
63
+ {
64
+ $this->fs->removeDirectory($this->vendorDir);
65
+ $this->fs->removeDirectory($this->binDir);
66
+ }
67
+
68
+ /**
69
+ * testSupports
70
+ *
71
+ * @return void
72
+ *
73
+ * @dataProvider dataForTestSupport
74
+ */
75
+ public function testSupports($type, $expected)
76
+ {
77
+ $installer = new Installer($this->io, $this->composer);
78
+ $this->assertSame($expected, $installer->supports($type), sprintf('Failed to show support for %s', $type));
79
+ }
80
+
81
+ /**
82
+ * dataForTestSupport
83
+ */
84
+ public function dataForTestSupport()
85
+ {
86
+ return array(
87
+ array('agl-module', true),
88
+ array('aimeos-extension', true),
89
+ array('annotatecms-module', true),
90
+ array('annotatecms-component', true),
91
+ array('annotatecms-service', true),
92
+ array('bitrix-module', true),
93
+ array('bitrix-component', true),
94
+ array('bitrix-theme', true),
95
+ array('cakephp', false),
96
+ array('cakephp-', false),
97
+ array('cakephp-app', false),
98
+ array('cakephp-plugin', true),
99
+ array('chef-cookbook', true),
100
+ array('chef-role', true),
101
+ array('codeigniter-app', false),
102
+ array('codeigniter-library', true),
103
+ array('codeigniter-third-party', true),
104
+ array('codeigniter-module', true),
105
+ array('concrete5-block', true),
106
+ array('concrete5-package', true),
107
+ array('concrete5-theme', true),
108
+ array('concrete5-update', true),
109
+ array('craft-plugin', true),
110
+ array('croogo-plugin', true),
111
+ array('croogo-theme', true),
112
+ array('dokuwiki-plugin', true),
113
+ array('dokuwiki-template', true),
114
+ array('drupal-module', true),
115
+ array('dolibarr-module', true),
116
+ array('elgg-plugin', true),
117
+ array('fuel-module', true),
118
+ array('fuel-package', true),
119
+ array('fuel-theme', true),
120
+ array('fuelphp-component', true),
121
+ array('hurad-plugin', true),
122
+ array('hurad-theme', true),
123
+ array('joomla-library', true),
124
+ array('kirby-plugin', true),
125
+ array('kohana-module', true),
126
+ array('laravel-library', true),
127
+ array('lithium-library', true),
128
+ array('magento-library', true),
129
+ array('mako-package', true),
130
+ array('modxevo-snippet', true),
131
+ array('modxevo-plugin', true),
132
+ array('modxevo-module', true),
133
+ array('modxevo-template', true),
134
+ array('modxevo-lib', true),
135
+ array('mediawiki-extension', true),
136
+ array('mediawiki-skin', true),
137
+ array('microweber-module', true),
138
+ array('modulework-module', true),
139
+ array('moodle-mod', true),
140
+ array('october-module', true),
141
+ array('october-plugin', true),
142
+ array('piwik-plugin', true),
143
+ array('phpbb-extension', true),
144
+ array('pimcore-plugin', true),
145
+ array('ppi-module', true),
146
+ array('prestashop-module', true),
147
+ array('prestashop-theme', true),
148
+ array('puppet-module', true),
149
+ array('redaxo-addon', true),
150
+ array('redaxo-bestyle-plugin', true),
151
+ array('roundcube-plugin', true),
152
+ array('shopware-backend-plugin', true),
153
+ array('shopware-core-plugin', true),
154
+ array('shopware-frontend-plugin', true),
155
+ array('shopware-theme', true),
156
+ array('silverstripe-module', true),
157
+ array('silverstripe-theme', true),
158
+ array('smf-module', true),
159
+ array('smf-theme', true),
160
+ array('symfony1-plugin', true),
161
+ array('thelia-module', true),
162
+ array('thelia-frontoffice-template', true),
163
+ array('thelia-backoffice-template', true),
164
+ array('thelia-email-template', true),
165
+ array('tusk-task', true),
166
+ array('tusk-asset', true),
167
+ array('typo3-flow-plugin', true),
168
+ array('typo3-cms-extension', true),
169
+ array('whmcs-gateway', true),
170
+ array('wolfcms-plugin', true),
171
+ array('wordpress-plugin', true),
172
+ array('wordpress-core', false),
173
+ array('zend-library', true),
174
+ array('zikula-module', true),
175
+ array('zikula-theme', true),
176
+ );
177
+ }
178
+
179
+ /**
180
+ * testInstallPath
181
+ *
182
+ * @dataProvider dataForTestInstallPath
183
+ */
184
+ public function testInstallPath($type, $path, $name, $version = '1.0.0')
185
+ {
186
+ $installer = new Installer($this->io, $this->composer);
187
+ $package = new Package($name, $version, $version);
188
+
189
+ $package->setType($type);
190
+ $result = $installer->getInstallPath($package);
191
+ $this->assertEquals($path, $result);
192
+ }
193
+
194
+ /**
195
+ * dataFormTestInstallPath
196
+ */
197
+ public function dataForTestInstallPath()
198
+ {
199
+ return array(
200
+ array('agl-module', 'More/MyTestPackage/', 'agl/my_test-package'),
201
+ array('aimeos-extension', 'ext/ai-test/', 'author/ai-test'),
202
+ array('annotatecms-module', 'addons/modules/my_module/', 'vysinsky/my_module'),
203
+ array('annotatecms-component', 'addons/components/my_component/', 'vysinsky/my_component'),
204
+ array('annotatecms-service', 'addons/services/my_service/', 'vysinsky/my_service'),
205
+ array('bitrix-module', 'local/modules/my_module/', 'author/my_module'),
206
+ array('bitrix-component', 'local/components/my_component/', 'author/my_component'),
207
+ array('bitrix-theme', 'local/templates/my_theme/', 'author/my_theme'),
208
+ array('cakephp-plugin', 'Plugin/Ftp/', 'shama/ftp'),
209
+ array('chef-cookbook', 'Chef/mre/my_cookbook/', 'mre/my_cookbook'),
210
+ array('chef-role', 'Chef/roles/my_role/', 'mre/my_role'),
211
+ array('codeigniter-library', 'application/libraries/my_package/', 'shama/my_package'),
212
+ array('codeigniter-module', 'application/modules/my_package/', 'shama/my_package'),
213
+ array('concrete5-block', 'blocks/concrete5_block/', 'remo/concrete5_block'),
214
+ array('concrete5-package', 'packages/concrete5_package/', 'remo/concrete5_package'),
215
+ array('concrete5-theme', 'themes/concrete5_theme/', 'remo/concrete5_theme'),
216
+ array('concrete5-update', 'updates/concrete5/', 'concrete5/concrete5'),
217
+ array('craft-plugin', 'craft/plugins/my_plugin/', 'mdcpepper/my_plugin'),
218
+ array('croogo-plugin', 'Plugin/Sitemaps/', 'fahad19/sitemaps'),
219
+ array('croogo-theme', 'View/Themed/Readable/', 'rchavik/readable'),
220
+ array('dokuwiki-plugin', 'lib/plugins/someplugin/', 'author/someplugin'),
221
+ array('dokuwiki-template', 'lib/tpl/sometemplate/', 'author/sometemplate'),
222
+ array('dolibarr-module', 'htdocs/custom/my_module/', 'shama/my_module'),
223
+ array('drupal-module', 'modules/my_module/', 'shama/my_module'),
224
+ array('drupal-theme', 'themes/my_module/', 'shama/my_module'),
225
+ array('drupal-profile', 'profiles/my_module/', 'shama/my_module'),
226
+ array('drupal-drush', 'drush/my_module/', 'shama/my_module'),
227
+ array('elgg-plugin', 'mod/sample_plugin/', 'test/sample_plugin'),
228
+ array('fuel-module', 'fuel/app/modules/module/', 'fuel/module'),
229
+ array('fuel-package', 'fuel/packages/orm/', 'fuel/orm'),
230
+ array('fuel-theme', 'fuel/app/themes/theme/', 'fuel/theme'),
231
+ array('fuelphp-component', 'components/demo/', 'fuelphp/demo'),
232
+ array('hurad-plugin', 'plugins/Akismet/', 'atkrad/akismet'),
233
+ array('hurad-theme', 'plugins/Hurad2013/', 'atkrad/Hurad2013'),
234
+ array('joomla-plugin', 'plugins/my_plugin/', 'shama/my_plugin'),
235
+ array('kirby-plugin', 'site/plugins/my_plugin/', 'shama/my_plugin'),
236
+ array('kohana-module', 'modules/my_package/', 'shama/my_package'),
237
+ array('laravel-library', 'libraries/my_package/', 'shama/my_package'),
238
+ array('lithium-library', 'libraries/li3_test/', 'user/li3_test'),
239
+ array('magento-library', 'lib/foo/', 'test/foo'),
240
+ array('modxevo-snippet', 'assets/snippets/my_snippet/', 'shama/my_snippet'),
241
+ array('modxevo-plugin', 'assets/plugins/my_plugin/', 'shama/my_plugin'),
242
+ array('modxevo-module', 'assets/modules/my_module/', 'shama/my_module'),
243
+ array('modxevo-template', 'assets/templates/my_template/', 'shama/my_template'),
244
+ array('modxevo-lib', 'assets/lib/my_lib/', 'shama/my_lib'),
245
+ array('mako-package', 'app/packages/my_package/', 'shama/my_package'),
246
+ array('mediawiki-extension', 'extensions/APC/', 'author/APC'),
247
+ array('mediawiki-extension', 'extensions/APC/', 'author/APC-extension'),
248
+ array('mediawiki-extension', 'extensions/UploadWizard/', 'author/upload-wizard'),
249
+ array('mediawiki-extension', 'extensions/SyntaxHighlight_GeSHi/', 'author/syntax-highlight_GeSHi'),
250
+ array('mediawiki-skin', 'skins/someskin/', 'author/someskin-skin'),
251
+ array('mediawiki-skin', 'skins/someskin/', 'author/someskin'),
252
+ array('microweber-module', 'userfiles/modules/my-thing/', 'author/my-thing-module'),
253
+ array('modulework-module', 'modules/my_package/', 'shama/my_package'),
254
+ array('moodle-mod', 'mod/my_package/', 'shama/my_package'),
255
+ array('october-module', 'modules/my_plugin/', 'shama/my_plugin'),
256
+ array('october-plugin', 'plugins/shama/my_plugin/', 'shama/my_plugin'),
257
+ array('october-theme', 'themes/my_theme/', 'shama/my_theme'),
258
+ array('piwik-plugin', 'plugins/VisitSummary/', 'shama/visit-summary'),
259
+ array('prestashop-module', 'modules/a-module/', 'vendor/a-module'),
260
+ array('prestashop-theme', 'themes/a-theme/', 'vendor/a-theme'),
261
+ array('phpbb-extension', 'ext/test/foo/', 'test/foo'),
262
+ array('phpbb-style', 'styles/foo/', 'test/foo'),
263
+ array('phpbb-language', 'language/foo/', 'test/foo'),
264
+ array('pimcore-plugin', 'plugins/MyPlugin/', 'ubikz/my_plugin'),
265
+ array('ppi-module', 'modules/foo/', 'test/foo'),
266
+ array('puppet-module', 'modules/puppet-name/', 'puppet/puppet-name'),
267
+ array('redaxo-addon', 'redaxo/include/addons/my_plugin/', 'shama/my_plugin'),
268
+ array('redaxo-bestyle-plugin', 'redaxo/include/addons/be_style/plugins/my_plugin/', 'shama/my_plugin'),
269
+ array('roundcube-plugin', 'plugins/base/', 'test/base'),
270
+ array('roundcube-plugin', 'plugins/replace_dash/', 'test/replace-dash'),
271
+ array('shopware-backend-plugin', 'engine/Shopware/Plugins/Local/Backend/ShamaMyBackendPlugin/', 'shama/my-backend-plugin'),
272
+ array('shopware-core-plugin', 'engine/Shopware/Plugins/Local/Core/ShamaMyCorePlugin/', 'shama/my-core-plugin'),
273
+ array('shopware-frontend-plugin', 'engine/Shopware/Plugins/Local/Frontend/ShamaMyFrontendPlugin/', 'shama/my-frontend-plugin'),
274
+ array('shopware-theme', 'templates/my_theme/', 'shama/my-theme'),
275
+ array('silverstripe-module', 'my_module/', 'shama/my_module'),
276
+ array('silverstripe-module', 'sapphire/', 'silverstripe/framework', '2.4.0'),
277
+ array('silverstripe-module', 'framework/', 'silverstripe/framework', '3.0.0'),
278
+ array('silverstripe-module', 'framework/', 'silverstripe/framework', '3.0.0-rc1'),
279
+ array('silverstripe-module', 'framework/', 'silverstripe/framework', 'my/branch'),
280
+ array('silverstripe-theme', 'themes/my_theme/', 'shama/my_theme'),
281
+ array('smf-module', 'Sources/my_module/', 'shama/my_module'),
282
+ array('smf-theme', 'Themes/my_theme/', 'shama/my_theme'),
283
+ array('symfony1-plugin', 'plugins/sfShamaPlugin/', 'shama/sfShamaPlugin'),
284
+ array('symfony1-plugin', 'plugins/sfShamaPlugin/', 'shama/sf-shama-plugin'),
285
+ array('thelia-module', 'local/modules/my_module/', 'shama/my_module'),
286
+ array('thelia-frontoffice-template', 'templates/frontOffice/my_template_fo/', 'shama/my_template_fo'),
287
+ array('thelia-backoffice-template', 'templates/backOffice/my_template_bo/', 'shama/my_template_bo'),
288
+ array('thelia-email-template', 'templates/email/my_template_email/', 'shama/my_template_email'),
289
+ array('tusk-task', '.tusk/tasks/my_task/', 'shama/my_task'),
290
+ array('typo3-flow-package', 'Packages/Application/my_package/', 'shama/my_package'),
291
+ array('typo3-flow-build', 'Build/my_package/', 'shama/my_package'),
292
+ array('typo3-cms-extension', 'typo3conf/ext/my_extension/', 'shama/my_extension'),
293
+ array('whmcs-gateway', 'modules/gateways/gateway_name/', 'vendor/gateway_name'),
294
+ array('wolfcms-plugin', 'wolf/plugins/my_plugin/', 'shama/my_plugin'),
295
+ array('wordpress-plugin', 'wp-content/plugins/my_plugin/', 'shama/my_plugin'),
296
+ array('wordpress-muplugin', 'wp-content/mu-plugins/my_plugin/', 'shama/my_plugin'),
297
+ array('zend-extra', 'extras/library/zend_test/', 'shama/zend_test'),
298
+ array('zikula-module', 'modules/my-test_module/', 'my/test_module'),
299
+ array('zikula-theme', 'themes/my-test_theme/', 'my/test_theme'),
300
+ );
301
+ }
302
+
303
+ /**
304
+ * testGetCakePHPInstallPathException
305
+ *
306
+ * @return void
307
+ *
308
+ * @expectedException \InvalidArgumentException
309
+ */
310
+ public function testGetCakePHPInstallPathException()
311
+ {
312
+ $installer = new Installer($this->io, $this->composer);
313
+ $package = new Package('shama/ftp', '1.0.0', '1.0.0');
314
+
315
+ $package->setType('cakephp-whoops');
316
+ $result = $installer->getInstallPath($package);
317
+ }
318
+
319
+ /**
320
+ * testCustomInstallPath
321
+ */
322
+ public function testCustomInstallPath()
323
+ {
324
+ $installer = new Installer($this->io, $this->composer);
325
+ $package = new Package('shama/ftp', '1.0.0', '1.0.0');
326
+ $package->setType('cakephp-plugin');
327
+ $consumerPackage = new RootPackage('foo/bar', '1.0.0', '1.0.0');
328
+ $this->composer->setPackage($consumerPackage);
329
+ $consumerPackage->setExtra(array(
330
+ 'installer-paths' => array(
331
+ 'my/custom/path/{$name}/' => array(
332
+ 'shama/ftp',
333
+ 'foo/bar',
334
+ ),
335
+ ),
336
+ ));
337
+ $result = $installer->getInstallPath($package);
338
+ $this->assertEquals('my/custom/path/Ftp/', $result);
339
+ }
340
+
341
+ /**
342
+ * testCustomInstallerName
343
+ */
344
+ public function testCustomInstallerName()
345
+ {
346
+ $installer = new Installer($this->io, $this->composer);
347
+ $package = new Package('shama/cakephp-ftp-plugin', '1.0.0', '1.0.0');
348
+ $package->setType('cakephp-plugin');
349
+ $package->setExtra(array(
350
+ 'installer-name' => 'FTP',
351
+ ));
352
+ $result = $installer->getInstallPath($package);
353
+ $this->assertEquals('Plugin/FTP/', $result);
354
+ }
355
+
356
+ /**
357
+ * testCustomTypePath
358
+ */
359
+ public function testCustomTypePath()
360
+ {
361
+ $installer = new Installer($this->io, $this->composer);
362
+ $package = new Package('slbmeh/my_plugin', '1.0.0', '1.0.0');
363
+ $package->setType('wordpress-plugin');
364
+ $consumerPackage = new RootPackage('foo/bar', '1.0.0', '1.0.0');
365
+ $this->composer->setPackage($consumerPackage);
366
+ $consumerPackage->setExtra(array(
367
+ 'installer-paths' => array(
368
+ 'my/custom/path/{$name}/' => array(
369
+ 'type:wordpress-plugin'
370
+ ),
371
+ ),
372
+ ));
373
+ $result = $installer->getInstallPath($package);
374
+ $this->assertEquals('my/custom/path/my_plugin/', $result);
375
+ }
376
+
377
+ /**
378
+ * testNoVendorName
379
+ */
380
+ public function testNoVendorName()
381
+ {
382
+ $installer = new Installer($this->io, $this->composer);
383
+ $package = new Package('sfPhpunitPlugin', '1.0.0', '1.0.0');
384
+
385
+ $package->setType('symfony1-plugin');
386
+ $result = $installer->getInstallPath($package);
387
+ $this->assertEquals('plugins/sfPhpunitPlugin/', $result);
388
+ }
389
+
390
+ /**
391
+ * testTypo3Inflection
392
+ */
393
+ public function testTypo3Inflection()
394
+ {
395
+ $installer = new Installer($this->io, $this->composer);
396
+ $package = new Package('typo3/fluid', '1.0.0', '1.0.0');
397
+
398
+ $package->setAutoload(array(
399
+ 'psr-0' => array(
400
+ 'TYPO3\\Fluid' => 'Classes',
401
+ ),
402
+ ));
403
+
404
+ $package->setType('typo3-flow-package');
405
+ $result = $installer->getInstallPath($package);
406
+ $this->assertEquals('Packages/Application/TYPO3.Fluid/', $result);
407
+ }
408
+
409
+ public function testUninstallAndDeletePackageFromLocalRepo()
410
+ {
411
+ $package = new Package('foo', '1.0.0', '1.0.0');
412
+
413
+ $installer = $this->getMock('Composer\Installers\Installer', array('getInstallPath'), array($this->io, $this->composer));
414
+ $installer->expects($this->once())->method('getInstallPath')->with($package)->will($this->returnValue(sys_get_temp_dir().'/foo'));
415
+
416
+ $repo = $this->getMock('Composer\Repository\InstalledRepositoryInterface');
417
+ $repo->expects($this->once())->method('hasPackage')->with($package)->will($this->returnValue(true));
418
+ $repo->expects($this->once())->method('removePackage')->with($package);
419
+
420
+ $installer->uninstall($repo, $package);
421
+ }
422
+ }
includes/vendor/composer/installers/tests/Composer/Installers/Test/MediaWikiInstallerTest.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers\Test;
3
+
4
+ use Composer\Installers\MediaWikiInstaller;
5
+ use Composer\Package\Package;
6
+ use Composer\Composer;
7
+
8
+ class MediaWikiInstallerTest extends \PHPUnit_Framework_TestCase
9
+ {
10
+ /**
11
+ * @var MediaWikiInstaller
12
+ */
13
+ private $installer;
14
+
15
+ public function setUp()
16
+ {
17
+ $this->installer = new MediaWikiInstaller(
18
+ new Package('NyanCat', '4.2', '4.2'),
19
+ new Composer()
20
+ );
21
+ }
22
+
23
+ /**
24
+ * @dataProvider packageNameInflectionProvider
25
+ */
26
+ public function testInflectPackageVars($type, $name, $expected)
27
+ {
28
+ $this->assertEquals(
29
+ $this->installer->inflectPackageVars(array('name' => $name, 'type'=>$type)),
30
+ array('name' => $expected, 'type'=>$type)
31
+ );
32
+ }
33
+
34
+ public function packageNameInflectionProvider()
35
+ {
36
+ return array(
37
+ array(
38
+ 'mediawiki-extension',
39
+ 'sub-page-list',
40
+ 'SubPageList',
41
+ ),
42
+ array(
43
+ 'mediawiki-extension',
44
+ 'sub-page-list-extension',
45
+ 'SubPageList',
46
+ ),
47
+ array(
48
+ 'mediawiki-extension',
49
+ 'semantic-mediawiki',
50
+ 'SemanticMediawiki',
51
+ ),
52
+ // tests that exactly one '-skin' is cut off, and that skins do not get ucwords treatment like extensions
53
+ array(
54
+ 'mediawiki-skin',
55
+ 'some-skin-skin',
56
+ 'some-skin',
57
+ ),
58
+ // tests that names without '-skin' suffix stay valid
59
+ array(
60
+ 'mediawiki-skin',
61
+ 'someotherskin',
62
+ 'someotherskin',
63
+ ),
64
+ );
65
+ }
66
+ }
includes/vendor/composer/installers/tests/Composer/Installers/Test/OctoberInstallerTest.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers\Test;
3
+
4
+ use Composer\Installers\OctoberInstaller;
5
+ use Composer\Package\Package;
6
+ use Composer\Composer;
7
+
8
+ class OctoberInstallerTest extends \PHPUnit_Framework_TestCase
9
+ {
10
+ /**
11
+ * @var OctoberInstaller
12
+ */
13
+ private $installer;
14
+
15
+ public function setUp()
16
+ {
17
+ $this->installer = new OctoberInstaller(
18
+ new Package('NyanCat', '4.2', '4.2'),
19
+ new Composer()
20
+ );
21
+ }
22
+
23
+ /**
24
+ * @dataProvider packageNameInflectionProvider
25
+ */
26
+ public function testInflectPackageVars($type, $name, $expected)
27
+ {
28
+ $this->assertEquals(
29
+ $this->installer->inflectPackageVars(array('name' => $name, 'type' => $type)),
30
+ array('name' => $expected, 'type' => $type)
31
+ );
32
+ }
33
+
34
+ public function packageNameInflectionProvider()
35
+ {
36
+ return array(
37
+ array(
38
+ 'october-plugin',
39
+ 'subpagelist',
40
+ 'subpagelist',
41
+ ),
42
+ array(
43
+ 'october-plugin',
44
+ 'subpagelist-plugin',
45
+ 'subpagelist',
46
+ ),
47
+ array(
48
+ 'october-plugin',
49
+ 'semanticoctober',
50
+ 'semanticoctober',
51
+ ),
52
+ // tests that exactly one '-theme' is cut off
53
+ array(
54
+ 'october-theme',
55
+ 'some-theme-theme',
56
+ 'some-theme',
57
+ ),
58
+ // tests that names without '-theme' suffix stay valid
59
+ array(
60
+ 'october-theme',
61
+ 'someothertheme',
62
+ 'someothertheme',
63
+ ),
64
+ );
65
+ }
66
+ }
includes/vendor/composer/installers/tests/Composer/Installers/Test/PimcoreInstallerTest.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers\Test;
3
+
4
+ use Composer\Installers\PimcoreInstaller;
5
+ use Composer\Package\Package;
6
+ use Composer\Composer;
7
+
8
+ class PimcoreInstallerTest extends TestCase
9
+ {
10
+ private $composer;
11
+ private $io;
12
+
13
+ /**
14
+ * setUp
15
+ *
16
+ * @return void
17
+ */
18
+ public function setUp()
19
+ {
20
+ $this->package = new Package('CamelCased', '1.0', '1.0');
21
+ $this->io = $this->getMock('Composer\IO\PackageInterface');
22
+ $this->composer = new Composer();
23
+ }
24
+
25
+ /**
26
+ * testInflectPackageVars
27
+ *
28
+ * @return void
29
+ */
30
+ public function testInflectPackageVars()
31
+ {
32
+ $installer = new PimcoreInstaller($this->package, $this->composer);
33
+ $result = $installer->inflectPackageVars(array('name' => 'CamelCased'));
34
+ $this->assertEquals($result, array('name' => 'CamelCased'));
35
+
36
+ $installer = new PimcoreInstaller($this->package, $this->composer);
37
+ $result = $installer->inflectPackageVars(array('name' => 'with-dash'));
38
+ $this->assertEquals($result, array('name' => 'WithDash'));
39
+
40
+ $installer = new PimcoreInstaller($this->package, $this->composer);
41
+ $result = $installer->inflectPackageVars(array('name' => 'with_underscore'));
42
+ $this->assertEquals($result, array('name' => 'WithUnderscore'));
43
+ }
44
+ }
includes/vendor/composer/installers/tests/Composer/Installers/Test/PiwikInstallerTest.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers\Test;
3
+
4
+ use Composer\Composer;
5
+ use Composer\Installers\PiwikInstaller;
6
+ use Composer\Package\Package;
7
+ use Composer\Package\PackageInterface;
8
+
9
+ /**
10
+ * Class PiwikInstallerTest
11
+ *
12
+ * @package Composer\Installers\Test
13
+ */
14
+ class PiwikInstallerTest extends TestCase
15
+ {
16
+ /**
17
+ * @varComposer
18
+ */
19
+ private $composer;
20
+
21
+ /**
22
+ * @var PackageInterface
23
+ */
24
+ private $io;
25
+
26
+ /**
27
+ * @var Package
28
+ */
29
+ private $package;
30
+
31
+ /**
32
+ * setUp
33
+ *
34
+ * @return void
35
+ */
36
+ public function setUp()
37
+ {
38
+ $this->package = new Package('VisitSummary', '1.0', '1.0');
39
+ $this->io = $this->getMock('Composer\IO\PackageInterface');
40
+ $this->composer = new Composer();
41
+ }
42
+
43
+ /**
44
+ * testInflectPackageVars
45
+ *
46
+ * @return void
47
+ */
48
+ public function testInflectPackageVars()
49
+ {
50
+ $installer = new PiwikInstaller($this->package, $this->composer);
51
+ $result = $installer->inflectPackageVars(array('name' => 'VisitSummary'));
52
+ $this->assertEquals($result, array('name' => 'VisitSummary'));
53
+
54
+ $installer = new PiwikInstaller($this->package, $this->composer);
55
+ $result = $installer->inflectPackageVars(array('name' => 'visit-summary'));
56
+ $this->assertEquals($result, array('name' => 'VisitSummary'));
57
+
58
+ $installer = new PiwikInstaller($this->package, $this->composer);
59
+ $result = $installer->inflectPackageVars(array('name' => 'visit_summary'));
60
+ $this->assertEquals($result, array('name' => 'VisitSummary'));
61
+ }
62
+
63
+ }
includes/vendor/composer/installers/tests/Composer/Installers/Test/TestCase.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Composer.
5
+ *
6
+ * (c) Nils Adermann <naderman@naderman.de>
7
+ * Jordi Boggiano <j.boggiano@seld.be>
8
+ *
9
+ * For the full copyright and license information, please view the LICENSE
10
+ * file that was distributed with this source code.
11
+ */
12
+
13
+ namespace Composer\Installers\Test;
14
+
15
+ use Composer\Package\Version\VersionParser;
16
+ use Composer\Package\Package;
17
+ use Composer\Package\AliasPackage;
18
+ use Composer\Package\LinkConstraint\VersionConstraint;
19
+ use Composer\Util\Filesystem;
20
+
21
+ abstract class TestCase extends \PHPUnit_Framework_TestCase
22
+ {
23
+ private static $parser;
24
+
25
+ protected static function getVersionParser()
26
+ {
27
+ if (!self::$parser) {
28
+ self::$parser = new VersionParser();
29
+ }
30
+
31
+ return self::$parser;
32
+ }
33
+
34
+ protected function getVersionConstraint($operator, $version)
35
+ {
36
+ return new VersionConstraint(
37
+ $operator,
38
+ self::getVersionParser()->normalize($version)
39
+ );
40
+ }
41
+
42
+ protected function getPackage($name, $version)
43
+ {
44
+ $normVersion = self::getVersionParser()->normalize($version);
45
+
46
+ return new Package($name, $normVersion, $version);
47
+ }
48
+
49
+ protected function getAliasPackage($package, $version)
50
+ {
51
+ $normVersion = self::getVersionParser()->normalize($version);
52
+
53
+ return new AliasPackage($package, $normVersion, $version);
54
+ }
55
+
56
+ protected function ensureDirectoryExistsAndClear($directory)
57
+ {
58
+ $fs = new Filesystem();
59
+ if (is_dir($directory)) {
60
+ $fs->removeDirectory($directory);
61
+ }
62
+ mkdir($directory, 0777, true);
63
+ }
64
+ }
includes/vendor/composer/installers/tests/bootstrap.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+
3
+ $loader = require __DIR__ . '/../src/bootstrap.php';
4
+ $loader->add('Composer\Installers\Test', __DIR__);
js/.jscsrc ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "requireSpacesInConditionalExpression": true,
3
+ "requireSpacesInFunction": {
4
+ "beforeOpeningCurlyBrace": true
5
+ },
6
+ "disallowSpacesInFunction": {
7
+ "beforeOpeningRoundBrace": true
8
+ },
9
+ "requireMultipleVarDecl": "onevar",
10
+ "requireSpacesInsideObjectBrackets": "all",
11
+ "disallowSpaceAfterObjectKeys": true,
12
+ "requireSpaceAfterBinaryOperators": [
13
+ "=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=",
14
+ "&=", "|=", "^=", "+=",
15
+
16
+ "+", "-", "*", "/", "%", "<<", ">>", ">>>", "&",
17
+ "|", "^", "&&", "||", "===", "==", ">=",
18
+ "<=", "<", ">", "!=", "!=="
19
+ ],
20
+ "requireSpaceBeforeBinaryOperators": [
21
+ "=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=",
22
+ "&=", "|=", "^=", "+=",
23
+
24
+ "+", "-", "*", "/", "%", "<<", ">>", ">>>", "&",
25
+ "|", "^", "&&", "||", "===", "==", ">=",
26
+ "<=", "<", ">", "!=", "!=="
27
+ ],
28
+ "disallowKeywords": ["with"],
29
+ "disallowMultipleLineBreaks": true,
30
+ "validateLineBreaks": "LF",
31
+ "disallowMixedSpacesAndTabs": "smart",
32
+ "disallowTrailingWhitespace": true,
33
+
34
+ "requireCurlyBraces": [ "if", "else", "for", "while", "do", "try", "catch" ],
35
+ "requireSpaceBeforeBlockStatements": true,
36
+ "requireParenthesesAroundIIFE": true,
37
+ "requireBlocksOnNewline": true,
38
+ "requireOperatorBeforeLineBreak": [
39
+ "?",
40
+ "=",
41
+ "+",
42
+ "-",
43
+ "/",
44
+ "*",
45
+ "==",
46
+ "===",
47
+ "!=",
48
+ "!==",
49
+ ">",
50
+ ">=",
51
+ "<",
52
+ "<="
53
+ ],
54
+ "requireSpaceBeforeBinaryOperators": [
55
+ "?",
56
+ "=",
57
+ "+",
58
+ "-",
59
+ "/",
60
+ "*",
61
+ "==",
62
+ "===",
63
+ "!=",
64
+ "!==",
65
+ ">",
66
+ ">=",
67
+ "<",
68
+ "<="
69
+ ],
70
+ "requireSpaceAfterBinaryOperators": [
71
+ "?",
72
+ "=",
73
+ "+",
74
+ "/",
75
+ "*",
76
+ ":",
77
+ "==",
78
+ "===",
79
+ "!=",
80
+ "!==",
81
+ ">",
82
+ ">=",
83
+ "<",
84
+ "<="
85
+ ],
86
+ "disallowSpaceBeforeBinaryOperators": [","],
87
+ "disallowSpaceAfterBinaryOperators": [],
88
+ "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~"],
89
+ "requireSpaceAfterPrefixUnaryOperators": ["!"],
90
+ "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
91
+ "requireCamelCaseOrUpperCaseIdentifiers": true,
92
+ "disallowMultipleLineStrings": true,
93
+ "validateQuoteMarks": "'",
94
+ "validateIndentation": "\t",
95
+ "requireLineFeedAtFileEnd": true,
96
+ "requireDotNotation": true,
97
+ "disallowNewlineBeforeBlockStatements": true,
98
+
99
+ "disallowTrailingComma": true,
100
+ "disallowPaddingNewlinesInBlocks": true,
101
+ "disallowEmptyBlocks": true,
102
+ "disallowQuotedKeysInObjects": "allButReserved",
103
+ "disallowDanglingUnderscores": true,
104
+ "requireCommaBeforeLineBreak": true,
105
+ "disallowKeywordsOnNewLine": ["else"],
106
+ "requireCapitalizedConstructors": true,
107
+ "safeContextKeyword": [ "that" ],
108
+ "validateJSDoc": {
109
+ "checkParamNames": true,
110
+ "checkRedundantParams": true,
111
+ "requireParamTypes": true
112
+ }
113
+ }
js/.jshintrc ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "boss": true,
3
+ "curly": true,
4
+ "eqeqeq": true,
5
+ "eqnull": true,
6
+ "es3": true,
7
+ "immed": true,
8
+ "latedef": true,
9
+ "newcap": true,
10
+ "noarg": true,
11
+ "quotmark": "single",
12
+ "sub": true,
13
+ "strict": true,
14
+ "undef": true,
15
+ "unused": true,
16
+
17
+ "browser": true,
18
+ "jquery": true,
19
+
20
+ "globals": {
21
+ "exports": true,
22
+ "module": false
23
+ }
24
+ }
js/dist/wpFeatherlight.pkgd.js ADDED
@@ -0,0 +1,846 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * jquery.detectSwipe v2.1.1
3
+ * jQuery Plugin to obtain touch gestures from iPhone, iPod Touch, iPad and Android
4
+ * http://github.com/marcandre/detect_swipe
5
+ * Based on touchwipe by Andreas Waltl, netCU Internetagentur (http://www.netcu.de)
6
+ */
7
+ (function($) {
8
+ 'use strict';
9
+
10
+ $.detectSwipe = {
11
+ version: '2.1.1',
12
+ enabled: 'ontouchstart' in document.documentElement,
13
+ preventDefault: true,
14
+ threshold: 20
15
+ };
16
+
17
+ var startX,
18
+ startY,
19
+ isMoving = false;
20
+
21
+ function onTouchEnd() {
22
+ this.removeEventListener('touchmove', onTouchMove);
23
+ this.removeEventListener('touchend', onTouchEnd);
24
+ isMoving = false;
25
+ }
26
+
27
+ function onTouchMove(e) {
28
+ if ($.detectSwipe.preventDefault) {
29
+ e.preventDefault();
30
+ }
31
+ if(isMoving) {
32
+ var x = e.touches[0].pageX,
33
+ y = e.touches[0].pageY,
34
+ dx = startX - x,
35
+ dy = startY - y,
36
+ dir;
37
+ if (Math.abs(dx) >= $.detectSwipe.threshold) {
38
+ dir = dx > 0 ? 'left' : 'right';
39
+ } else if (Math.abs(dy) >= $.detectSwipe.threshold) {
40
+ dir = dy > 0 ? 'down' : 'up';
41
+ }
42
+ if (dir) {
43
+ onTouchEnd.call(this);
44
+ $(this).trigger('swipe', dir).trigger('swipe' + dir);
45
+ }
46
+ }
47
+ }
48
+
49
+ function onTouchStart(e) {
50
+ if (e.touches.length == 1) {
51
+ startX = e.touches[0].pageX;
52
+ startY = e.touches[0].pageY;
53
+ isMoving = true;
54
+ this.addEventListener('touchmove', onTouchMove, false);
55
+ this.addEventListener('touchend', onTouchEnd, false);
56
+ }
57
+ }
58
+
59
+ function setup() {
60
+ this.addEventListener && this.addEventListener('touchstart', onTouchStart, false);
61
+ }
62
+
63
+ function teardown() {
64
+ this.removeEventListener('touchstart', onTouchStart);
65
+ }
66
+
67
+ $.event.special.swipe = { setup: setup };
68
+
69
+ $.each(['left', 'up', 'down', 'right'], function() {
70
+ $.event.special['swipe' + this] = { setup: function() {
71
+ $(this).on('swipe', $.noop);
72
+ } };
73
+ });
74
+ })(jQuery);
75
+
76
+
77
+ /**
78
+ * Featherlight - ultra slim jQuery lightbox
79
+ * Version 1.2.3 - http://noelboss.github.io/featherlight/
80
+ *
81
+ * Copyright 2015, Noël Raoul Bossart (http://www.noelboss.com)
82
+ * MIT Licensed.
83
+ **/
84
+ (function($) {
85
+ "use strict";
86
+
87
+ if('undefined' === typeof $) {
88
+ if('console' in window){ window.console.info('Too much lightness, Featherlight needs jQuery.'); }
89
+ return;
90
+ }
91
+
92
+ /* Featherlight is exported as $.featherlight.
93
+ It is a function used to open a featherlight lightbox.
94
+
95
+ [tech]
96
+ Featherlight uses prototype inheritance.
97
+ Each opened lightbox will have a corresponding object.
98
+ That object may have some attributes that override the
99
+ prototype's.
100
+ Extensions created with Featherlight.extend will have their
101
+ own prototype that inherits from Featherlight's prototype,
102
+ thus attributes can be overriden either at the object level,
103
+ or at the extension level.
104
+ To create callbacks that chain themselves instead of overriding,
105
+ use chainCallbacks.
106
+ For those familiar with CoffeeScript, this correspond to
107
+ Featherlight being a class and the Gallery being a class
108
+ extending Featherlight.
109
+ The chainCallbacks is used since we don't have access to
110
+ CoffeeScript's `super`.
111
+ */
112
+
113
+ function Featherlight($content, config) {
114
+ if(this instanceof Featherlight) { /* called with new */
115
+ this.id = Featherlight.id++;
116
+ this.setup($content, config);
117
+ this.chainCallbacks(Featherlight._callbackChain);
118
+ } else {
119
+ var fl = new Featherlight($content, config);
120
+ fl.open();
121
+ return fl;
122
+ }
123
+ }
124
+
125
+ var opened = [],
126
+ pruneOpened = function(remove) {
127
+ opened = $.grep(opened, function(fl) {
128
+ return fl !== remove && fl.$instance.closest('body').length > 0;
129
+ } );
130
+ return opened;
131
+ };
132
+
133
+ // structure({iframeMinHeight: 44, foo: 0}, 'iframe')
134
+ // #=> {min-height: 44}
135
+ var structure = function(obj, prefix) {
136
+ var result = {},
137
+ regex = new RegExp('^' + prefix + '([A-Z])(.*)');
138
+ for (var key in obj) {
139
+ var match = key.match(regex);
140
+ if (match) {
141
+ var dasherized = (match[1] + match[2].replace(/([A-Z])/g, '-$1')).toLowerCase();
142
+ result[dasherized] = obj[key];
143
+ }
144
+ }
145
+ return result;
146
+ };
147
+
148
+ /* document wide key handler */
149
+ var eventMap = { keyup: 'onKeyUp', resize: 'onResize' };
150
+
151
+ var globalEventHandler = function(event) {
152
+ $.each(Featherlight.opened().reverse(), function() {
153
+ if (!event.isDefaultPrevented()) {
154
+ if (false === this[eventMap[event.type]](event)) {
155
+ event.preventDefault(); event.stopPropagation(); return false;
156
+ }
157
+ }
158
+ });
159
+ };
160
+
161
+ var toggleGlobalEvents = function(set) {
162
+ if(set !== Featherlight._globalHandlerInstalled) {
163
+ Featherlight._globalHandlerInstalled = set;
164
+ var events = $.map(eventMap, function(_, name) { return name+'.'+Featherlight.prototype.namespace; } ).join(' ');
165
+ $(window)[set ? 'on' : 'off'](events, globalEventHandler);
166
+ }
167
+ };
168
+
169
+ Featherlight.prototype = {
170
+ constructor: Featherlight,
171
+ /*** defaults ***/
172
+ /* extend featherlight with defaults and methods */
173
+ namespace: 'featherlight', /* Name of the events and css class prefix */
174
+ targetAttr: 'data-featherlight', /* Attribute of the triggered element that contains the selector to the lightbox content */
175
+ variant: null, /* Class that will be added to change look of the lightbox */
176
+ resetCss: false, /* Reset all css */
177
+ background: null, /* Custom DOM for the background, wrapper and the closebutton */
178
+ openTrigger: 'click', /* Event that triggers the lightbox */
179
+ closeTrigger: 'click', /* Event that triggers the closing of the lightbox */
180
+ filter: null, /* Selector to filter events. Think $(...).on('click', filter, eventHandler) */
181
+ root: 'body', /* Where to append featherlights */
182
+ openSpeed: 250, /* Duration of opening animation */
183
+ closeSpeed: 250, /* Duration of closing animation */
184
+ closeOnClick: 'background', /* Close lightbox on click ('background', 'anywhere' or false) */
185
+ closeOnEsc: true, /* Close lightbox when pressing esc */
186
+ closeIcon: '&#10005;', /* Close icon */
187
+ loading: '', /* Content to show while initial content is loading */
188
+ otherClose: null, /* Selector for alternate close buttons (e.g. "a.close") */
189
+ beforeOpen: $.noop, /* Called before open. can return false to prevent opening of lightbox. Gets event as parameter, this contains all data */
190
+ beforeContent: $.noop, /* Called when content is loaded. Gets event as parameter, this contains all data */
191
+ beforeClose: $.noop, /* Called before close. can return false to prevent opening of lightbox. Gets event as parameter, this contains all data */
192
+ afterOpen: $.noop, /* Called after open. Gets event as parameter, this contains all data */
193
+ afterContent: $.noop, /* Called after content is ready and has been set. Gets event as parameter, this contains all data */
194
+ afterClose: $.noop, /* Called after close. Gets event as parameter, this contains all data */
195
+ onKeyUp: $.noop, /* Called on key down for the frontmost featherlight */
196
+ onResize: $.noop, /* Called after new content and when a window is resized */
197
+ type: null, /* Specify type of lightbox. If unset, it will check for the targetAttrs value. */
198
+ contentFilters: ['jquery', 'image', 'html', 'ajax', 'iframe', 'text'], /* List of content filters to use to determine the content */
199
+
200
+ /*** methods ***/
201
+ /* setup iterates over a single instance of featherlight and prepares the background and binds the events */
202
+ setup: function(target, config){
203
+ /* all arguments are optional */
204
+ if (typeof target === 'object' && target instanceof $ === false && !config) {
205
+ config = target;
206
+ target = undefined;
207
+ }
208
+
209
+ var self = $.extend(this, config, {target: target}),
210
+ css = !self.resetCss ? self.namespace : self.namespace+'-reset', /* by adding -reset to the classname, we reset all the default css */
211
+ $background = $(self.background || [
212
+ '<div class="'+css+'-loading '+css+'">',
213
+ '<div class="'+css+'-content">',
214
+ '<span class="'+css+'-close-icon '+ self.namespace + '-close">',
215
+ self.closeIcon,
216
+ '</span>',
217
+ '<div class="'+self.namespace+'-inner">' + self.loading + '</div>',
218
+ '</div>',
219
+ '</div>'].join('')),
220
+ closeButtonSelector = '.'+self.namespace+'-close' + (self.otherClose ? ',' + self.otherClose : '');
221
+
222
+ self.$instance = $background.clone().addClass(self.variant); /* clone DOM for the background, wrapper and the close button */
223
+
224
+ /* close when click on background/anywhere/null or closebox */
225
+ self.$instance.on(self.closeTrigger+'.'+self.namespace, function(event) {
226
+ var $target = $(event.target);
227
+ if( ('background' === self.closeOnClick && $target.is('.'+self.namespace))
228
+ || 'anywhere' === self.closeOnClick
229
+ || $target.closest(closeButtonSelector).length ){
230
+ event.preventDefault();
231
+ self.close();
232
+ }
233
+ });
234
+
235
+ return this;
236
+ },
237
+
238
+ /* this method prepares the content and converts it into a jQuery object or a promise */
239
+ getContent: function(){
240
+ var self = this,
241
+ filters = this.constructor.contentFilters,
242
+ readTargetAttr = function(name){ return self.$currentTarget && self.$currentTarget.attr(name); },
243
+ targetValue = readTargetAttr(self.targetAttr),
244
+ data = self.target || targetValue || '';
245
+
246
+ /* Find which filter applies */
247
+ var filter = filters[self.type]; /* check explicit type like {type: 'image'} */
248
+
249
+ /* check explicit type like data-featherlight="image" */
250
+ if(!filter && data in filters) {
251
+ filter = filters[data];
252
+ data = self.target && targetValue;
253
+ }
254
+ data = data || readTargetAttr('href') || '';
255
+
256
+ /* check explicity type & content like {image: 'photo.jpg'} */
257
+ if(!filter) {
258
+ for(var filterName in filters) {
259
+ if(self[filterName]) {
260
+ filter = filters[filterName];
261
+ data = self[filterName];
262
+ }
263
+ }
264
+ }
265
+
266
+ /* otherwise it's implicit, run checks */
267
+ if(!filter) {
268
+ var target = data;
269
+ data = null;
270
+ $.each(self.contentFilters, function() {
271
+ filter = filters[this];
272
+ if(filter.test) {
273
+ data = filter.test(target);
274
+ }
275
+ if(!data && filter.regex && target.match && target.match(filter.regex)) {
276
+ data = target;
277
+ }
278
+ return !data;
279
+ });
280
+ if(!data) {
281
+ if('console' in window){ window.console.error('Featherlight: no content filter found ' + (target ? ' for "' + target + '"' : ' (no target specified)')); }
282
+ return false;
283
+ }
284
+ }
285
+ /* Process it */
286
+ return filter.process.call(self, data);
287
+ },
288
+
289
+ /* sets the content of $instance to $content */
290
+ setContent: function($content){
291
+ var self = this;
292
+ /* we need a special class for the iframe */
293
+ if($content.is('iframe') || $('iframe', $content).length > 0){
294
+ self.$instance.addClass(self.namespace+'-iframe');
295
+ }
296
+
297
+ self.$instance.removeClass(self.namespace+'-loading');
298
+
299
+ /* replace content by appending to existing one before it is removed
300
+ this insures that featherlight-inner remain at the same relative
301
+ position to any other items added to featherlight-content */
302
+ self.$instance.find('.'+self.namespace+'-inner')
303
+ .slice(1).remove().end() /* In the unexpected event where there are many inner elements, remove all but the first one */
304
+ .replaceWith($.contains(self.$instance[0], $content[0]) ? '' : $content);
305
+
306
+ self.$content = $content.addClass(self.namespace+'-inner');
307
+
308
+ return self;
309
+ },
310
+
311
+ /* opens the lightbox. "this" contains $instance with the lightbox, and with the config.
312
+ Returns a promise that is resolved after is successfully opened. */
313
+ open: function(event){
314
+ var self = this;
315
+ self.$instance.hide().appendTo(self.root);
316
+ if((!event || !event.isDefaultPrevented())
317
+ && self.beforeOpen(event) !== false) {
318
+
319
+ if(event){
320
+ event.preventDefault();
321
+ }
322
+ var $content = self.getContent();
323
+
324
+ if($content) {
325
+ opened.push(self);
326
+
327
+ toggleGlobalEvents(true);
328
+
329
+ self.$instance.fadeIn(self.openSpeed);
330
+ self.beforeContent(event);
331
+
332
+ /* Set content and show */
333
+ return $.when($content)
334
+ .always(function($content){
335
+ self.setContent($content);
336
+ self.afterContent(event);
337
+ })
338
+ .then(self.$instance.promise())
339
+ /* Call afterOpen after fadeIn is done */
340
+ .done(function(){ self.afterOpen(event); });
341
+ }
342
+ }
343
+ self.$instance.detach();
344
+ return $.Deferred().reject().promise();
345
+ },
346
+
347
+ /* closes the lightbox. "this" contains $instance with the lightbox, and with the config
348
+ returns a promise, resolved after the lightbox is successfully closed. */
349
+ close: function(event){
350
+ var self = this,
351
+ deferred = $.Deferred();
352
+
353
+ if(self.beforeClose(event) === false) {
354
+ deferred.reject();
355
+ } else {
356
+
357
+ if (0 === pruneOpened(self).length) {
358
+ toggleGlobalEvents(false);
359
+ }
360
+
361
+ self.$instance.fadeOut(self.closeSpeed,function(){
362
+ self.$instance.detach();
363
+ self.afterClose(event);
364
+ deferred.resolve();
365
+ });
366
+ }
367
+ return deferred.promise();
368
+ },
369
+
370
+ /* Utility function to chain callbacks
371
+ [Warning: guru-level]
372
+ Used be extensions that want to let users specify callbacks but
373
+ also need themselves to use the callbacks.
374
+ The argument 'chain' has callback names as keys and function(super, event)
375
+ as values. That function is meant to call `super` at some point.
376
+ */
377
+ chainCallbacks: function(chain) {
378
+ for (var name in chain) {
379
+ this[name] = $.proxy(chain[name], this, $.proxy(this[name], this));
380
+ }
381
+ }
382
+ };
383
+
384
+ $.extend(Featherlight, {
385
+ id: 0, /* Used to id single featherlight instances */
386
+ autoBind: '[data-featherlight]', /* Will automatically bind elements matching this selector. Clear or set before onReady */
387
+ defaults: Featherlight.prototype, /* You can access and override all defaults using $.featherlight.defaults, which is just a synonym for $.featherlight.prototype */
388
+ /* Contains the logic to determine content */
389
+ contentFilters: {
390
+ jquery: {
391
+ regex: /^[#.]\w/, /* Anything that starts with a class name or identifiers */
392
+ test: function(elem) { return elem instanceof $ && elem; },
393
+ process: function(elem) { return $(elem).clone(true); }
394
+ },
395
+ image: {
396
+ regex: /\.(png|jpg|jpeg|gif|tiff|bmp)(\?\S*)?$/i,
397
+ process: function(url) {
398
+ var self = this,
399
+ deferred = $.Deferred(),
400
+ img = new Image(),
401
+ $img = $('<img src="'+url+'" alt="" class="'+self.namespace+'-image" />');
402
+ img.onload = function() {
403
+ /* Store naturalWidth & height for IE8 */
404
+ $img.naturalWidth = img.width; $img.naturalHeight = img.height;
405
+ deferred.resolve( $img );
406
+ };
407
+ img.onerror = function() { deferred.reject($img); };
408
+ img.src = url;
409
+ return deferred.promise();
410
+ }
411
+ },
412
+ html: {
413
+ regex: /^\s*<[\w!][^<]*>/, /* Anything that starts with some kind of valid tag */
414
+ process: function(html) { return $(html); }
415
+ },
416
+ ajax: {
417
+ regex: /./, /* At this point, any content is assumed to be an URL */
418
+ process: function(url) {
419
+ var self = this,
420
+ deferred = $.Deferred();
421
+ /* we are using load so one can specify a target with: url.html #targetelement */
422
+ var $container = $('<div></div>').load(url, function(response, status){
423
+ if ( status !== "error" ) {
424
+ deferred.resolve($container.contents());
425
+ }
426
+ deferred.fail();
427
+ });
428
+ return deferred.promise();
429
+ }
430
+ },
431
+ iframe: {
432
+ process: function(url) {
433
+ var deferred = new $.Deferred();
434
+ var $content = $('<iframe/>')
435
+ .hide()
436
+ .attr('src', url)
437
+ .css(structure(this, 'iframe'))
438
+ .on('load', function() { deferred.resolve($content.show()); })
439
+ // We can't move an <iframe> and avoid reloading it,
440
+ // so let's put it in place ourselves right now:
441
+ .appendTo(this.$instance.find('.' + this.namespace + '-content'));
442
+ return deferred.promise();
443
+ }
444
+ },
445
+ text: {
446
+ process: function(text) { return $('<div>', {text: text}); }
447
+ }
448
+ },
449
+
450
+ functionAttributes: ['beforeOpen', 'afterOpen', 'beforeContent', 'afterContent', 'beforeClose', 'afterClose'],
451
+
452
+ /*** class methods ***/
453
+ /* read element's attributes starting with data-featherlight- */
454
+ readElementConfig: function(element, namespace) {
455
+ var Klass = this,
456
+ regexp = new RegExp('^data-' + namespace + '-(.*)'),
457
+ config = {};
458
+ if (element && element.attributes) {
459
+ $.each(element.attributes, function(){
460
+ var match = this.name.match(regexp);
461
+ if (match) {
462
+ var val = this.value,
463
+ name = $.camelCase(match[1]);
464
+ if ($.inArray(name, Klass.functionAttributes) >= 0) { /* jshint -W054 */
465
+ val = new Function(val); /* jshint +W054 */
466
+ } else {
467
+ try { val = $.parseJSON(val); }
468
+ catch(e) {}
469
+ }
470
+ config[name] = val;
471
+ }
472
+ });
473
+ }
474
+ return config;
475
+ },
476
+
477
+ /* Used to create a Featherlight extension
478
+ [Warning: guru-level]
479
+ Creates the extension's prototype that in turn
480
+ inherits Featherlight's prototype.
481
+ Could be used to extend an extension too...
482
+ This is pretty high level wizardy, it comes pretty much straight
483
+ from CoffeeScript and won't teach you anything about Featherlight
484
+ as it's not really specific to this library.
485
+ My suggestion: move along and keep your sanity.
486
+ */
487
+ extend: function(child, defaults) {
488
+ /* Setup class hierarchy, adapted from CoffeeScript */
489
+ var Ctor = function(){ this.constructor = child; };
490
+ Ctor.prototype = this.prototype;
491
+ child.prototype = new Ctor();
492
+ child.__super__ = this.prototype;
493
+ /* Copy class methods & attributes */
494
+ $.extend(child, this, defaults);
495
+ child.defaults = child.prototype;
496
+ return child;
497
+ },
498
+
499
+ attach: function($source, $content, config) {
500
+ var Klass = this;
501
+ if (typeof $content === 'object' && $content instanceof $ === false && !config) {
502
+ config = $content;
503
+ $content = undefined;
504
+ }
505
+ /* make a copy */
506
+ config = $.extend({}, config);
507
+
508
+ /* Only for openTrigger and namespace... */
509
+ var namespace = config.namespace || Klass.defaults.namespace,
510
+ tempConfig = $.extend({}, Klass.defaults, Klass.readElementConfig($source[0], namespace), config);
511
+
512
+ $source.on(tempConfig.openTrigger+'.'+tempConfig.namespace, tempConfig.filter, function(event) {
513
+ /* ... since we might as well compute the config on the actual target */
514
+ var elemConfig = $.extend(
515
+ {$source: $source, $currentTarget: $(this)},
516
+ Klass.readElementConfig($source[0], tempConfig.namespace),
517
+ Klass.readElementConfig(this, tempConfig.namespace),
518
+ config);
519
+ new Klass($content, elemConfig).open(event);
520
+ });
521
+ return $source;
522
+ },
523
+
524
+ current: function() {
525
+ var all = this.opened();
526
+ return all[all.length - 1] || null;
527
+ },
528
+
529
+ opened: function() {
530
+ var klass = this;
531
+ pruneOpened();
532
+ return $.grep(opened, function(fl) { return fl instanceof klass; } );
533
+ },
534
+
535
+ close: function() {
536
+ var cur = this.current();
537
+ if(cur) { return cur.close(); }
538
+ },
539
+
540
+ /* Does the auto binding on startup.
541
+ Meant only to be used by Featherlight and its extensions
542
+ */
543
+ _onReady: function() {
544
+ var Klass = this;
545
+ if(Klass.autoBind){
546
+ /* First, bind click on document, so it will work for items added dynamically */
547
+ Klass.attach($(document), {filter: Klass.autoBind});
548
+ /* Auto bound elements with attr-featherlight-filter won't work
549
+ (since we already used it to bind on document), so bind these
550
+ directly. We can't easily support dynamically added element with filters */
551
+ $(Klass.autoBind).filter('[data-featherlight-filter]').each(function(){
552
+ Klass.attach($(this));
553
+ });
554
+ }
555
+ },
556
+
557
+ /* Featherlight uses the onKeyUp callback to intercept the escape key.
558
+ Private to Featherlight.
559
+ */
560
+ _callbackChain: {
561
+ onKeyUp: function(_super, event){
562
+ if(27 === event.keyCode) {
563
+ if (this.closeOnEsc) {
564
+ this.$instance.find('.'+this.namespace+'-close:first').click();
565
+ }
566
+ return false;
567
+ } else {
568
+ return _super(event);
569
+ }
570
+ },
571
+
572
+ onResize: function(_super, event){
573
+ if (this.$content.naturalWidth) {
574
+ var w = this.$content.naturalWidth, h = this.$content.naturalHeight;
575
+ /* Reset apparent image size first so container grows */
576
+ this.$content.css('width', '').css('height', '');
577
+ /* Calculate the worst ratio so that dimensions fit */
578
+ var ratio = Math.max(
579
+ w / parseInt(this.$content.parent().css('width'),10),
580
+ h / parseInt(this.$content.parent().css('height'),10));
581
+ /* Resize content */
582
+ if (ratio > 1) {
583
+ this.$content.css('width', '' + w / ratio + 'px').css('height', '' + h / ratio + 'px');
584
+ }
585
+ }
586
+ return _super(event);
587
+ },
588
+
589
+ afterContent: function(_super, event){
590
+ var r = _super(event);
591
+ this.onResize(event);
592
+ return r;
593
+ }
594
+ }
595
+ });
596
+
597
+ $.featherlight = Featherlight;
598
+
599
+ /* bind jQuery elements to trigger featherlight */
600
+ $.fn.featherlight = function($content, config) {
601
+ return Featherlight.attach(this, $content, config);
602
+ };
603
+
604
+ /* bind featherlight on ready if config autoBind is set */
605
+ $(document).ready(function(){ Featherlight._onReady(); });
606
+ }(jQuery));
607
+
608
+ /**
609
+ * Featherlight Gallery – an extension for the ultra slim jQuery lightbox
610
+ * Version 1.2.3 - http://noelboss.github.io/featherlight/
611
+ *
612
+ * Copyright 2015, Noël Raoul Bossart (http://www.noelboss.com)
613
+ * MIT Licensed.
614
+ **/
615
+ (function($) {
616
+ "use strict";
617
+
618
+ var warn = function(m) {
619
+ if(window.console && window.console.warn) {
620
+ window.console.warn('FeatherlightGallery: ' + m);
621
+ }
622
+ };
623
+
624
+ if('undefined' === typeof $) {
625
+ return warn('Too much lightness, Featherlight needs jQuery.');
626
+ } else if(!$.featherlight) {
627
+ return warn('Load the featherlight plugin before the gallery plugin');
628
+ }
629
+
630
+ var isTouchAware = 'ontouchstart' in document.documentElement,
631
+ jQueryConstructor = $.event && $.event.special.swipeleft && $,
632
+ hammerConstructor = window.Hammer && function($el){
633
+ var mc = new window.Hammer.Manager($el[0]);
634
+ mc.add(new window.Hammer.Swipe());
635
+ return mc;
636
+ },
637
+ swipeAwareConstructor = isTouchAware && (jQueryConstructor || hammerConstructor);
638
+ if(isTouchAware && !swipeAwareConstructor) {
639
+ warn('No compatible swipe library detected; one must be included before featherlightGallery for swipe motions to navigate the galleries.');
640
+ }
641
+
642
+ var callbackChain = {
643
+ afterClose: function(_super, event) {
644
+ var self = this;
645
+ self.$instance.off('next.'+self.namespace+' previous.'+self.namespace);
646
+ if (self._swiper) {
647
+ self._swiper
648
+ .off('swipeleft', self._swipeleft) /* See http://stackoverflow.com/questions/17367198/hammer-js-cant-remove-event-listener */
649
+ .off('swiperight', self._swiperight);
650
+ self._swiper = null;
651
+ }
652
+ return _super(event);
653
+ },
654
+ beforeOpen: function(_super, event){
655
+ var self = this;
656
+
657
+ self.$instance.on('next.'+self.namespace+' previous.'+self.namespace, function(event){
658
+ var offset = event.type === 'next' ? +1 : -1;
659
+ self.navigateTo(self.currentNavigation() + offset);
660
+ });
661
+
662
+ if (swipeAwareConstructor) {
663
+ self._swiper = swipeAwareConstructor(self.$instance)
664
+ .on('swipeleft', self._swipeleft = function() { self.$instance.trigger('next'); })
665
+ .on('swiperight', self._swiperight = function() { self.$instance.trigger('previous'); });
666
+ } else {
667
+ self.$instance.find('.'+self.namespace+'-content')
668
+ .append(self.createNavigation('previous'))
669
+ .append(self.createNavigation('next'));
670
+ }
671
+ return _super(event);
672
+ },
673
+ onKeyUp: function(_super, event){
674
+ var dir = {
675
+ 37: 'previous', /* Left arrow */
676
+ 39: 'next' /* Rigth arrow */
677
+ }[event.keyCode];
678
+ if(dir) {
679
+ this.$instance.trigger(dir);
680
+ return false;
681
+ } else {
682
+ return _super(event);
683
+ }
684
+ }
685
+ };
686
+
687
+ function FeatherlightGallery($source, config) {
688
+ if(this instanceof FeatherlightGallery) { /* called with new */
689
+ $.featherlight.apply(this, arguments);
690
+ this.chainCallbacks(callbackChain);
691
+ } else {
692
+ var flg = new FeatherlightGallery($.extend({$source: $source, $currentTarget: $source.first()}, config));
693
+ flg.open();
694
+ return flg;
695
+ }
696
+ }
697
+
698
+ $.featherlight.extend(FeatherlightGallery, {
699
+ autoBind: '[data-featherlight-gallery]'
700
+ });
701
+
702
+ $.extend(FeatherlightGallery.prototype, {
703
+ /** Additional settings for Gallery **/
704
+ previousIcon: '&#9664;', /* Code that is used as previous icon */
705
+ nextIcon: '&#9654;', /* Code that is used as next icon */
706
+ galleryFadeIn: 100, /* fadeIn speed when image is loaded */
707
+ galleryFadeOut: 300, /* fadeOut speed before image is loaded */
708
+
709
+ images: function() {
710
+ if (this.filter) {
711
+ return this.$source.find(this.filter);
712
+ }
713
+ return this.$source;
714
+ },
715
+
716
+ currentNavigation: function() {
717
+ return this.images().index(this.$currentTarget);
718
+ },
719
+
720
+ navigateTo: function(index) {
721
+ var self = this,
722
+ source = self.images(),
723
+ len = source.length,
724
+ $inner = self.$instance.find('.' + self.namespace + '-inner');
725
+ index = ((index % len) + len) % len; /* pin index to [0, len[ */
726
+
727
+ self.$currentTarget = source.eq(index);
728
+ self.beforeContent();
729
+ return $.when(
730
+ self.getContent(),
731
+ $inner.fadeTo(self.galleryFadeOut,0.2)
732
+ ).always(function($newContent) {
733
+ self.setContent($newContent);
734
+ self.afterContent();
735
+ $newContent.fadeTo(self.galleryFadeIn,1);
736
+ });
737
+ },
738
+
739
+ createNavigation: function(target) {
740
+ var self = this;
741
+ return $('<span title="'+target+'" class="'+this.namespace+'-'+target+'"><span>'+this[target+'Icon']+'</span></span>').click(function(){
742
+ $(this).trigger(target+'.'+self.namespace);
743
+ });
744
+ }
745
+ });
746
+
747
+ $.featherlightGallery = FeatherlightGallery;
748
+
749
+ /* extend jQuery with selector featherlight method $(elm).featherlight(config, elm); */
750
+ $.fn.featherlightGallery = function(config) {
751
+ return FeatherlightGallery.attach(this, config);
752
+ };
753
+
754
+ /* bind featherlight on ready if config autoBind is set */
755
+ $(document).ready(function(){ FeatherlightGallery._onReady(); });
756
+
757
+ }(jQuery));
758
+
759
+ /**
760
+ * WP Featherlight - Loader and helpers for the Featherlight WordPress plugin
761
+ *
762
+ * @version Version 0.1.0
763
+ * @copyright Copyright 2015, Robert Neu (http://robneu.com)
764
+ * @license MIT
765
+ */
766
+ (function( window, $, undefined ) {
767
+ 'use strict';
768
+
769
+ /**
770
+ * Checks href targets to see if a given anchor is linking to an image.
771
+ *
772
+ * Returns false if the anchor is pointing to an external URL.
773
+ *
774
+ * @since 0.1.0
775
+ * @return mixed
776
+ */
777
+ function testImages( index, element ) {
778
+ if ( element.hostname && element.hostname !== location.hostname ) {
779
+ return false;
780
+ }
781
+ return /(png|jpg|jpeg|gif|tiff|bmp)$/.test( $( element ).attr( 'href' ) );
782
+ }
783
+
784
+ /**
785
+ * Filters all href elements on a page to add Featherlight's data attribute.
786
+ * When a match is found, the data attribute is added so Featherlight will
787
+ * open it normally.
788
+ *
789
+ * @since 0.1.0
790
+ * @return void
791
+ */
792
+ function findImages() {
793
+ $( 'a[href]' ).filter( testImages ).attr( 'data-featherlight', 'image' );
794
+ }
795
+
796
+ /**
797
+ * Callback function to initialize Featherlight galleries when they contain
798
+ * items that are able to be opened in a light box.
799
+ *
800
+ * @since 0.1.0
801
+ * @return void
802
+ */
803
+ function buildGalleries( index, value ) {
804
+ var galleryID = $( value ).attr( 'id' ),
805
+ $galleryItem = $( '#' + galleryID + ' .gallery-item a' );
806
+
807
+ if ( ! $galleryItem.attr( 'data-featherlight' ) ) {
808
+ return;
809
+ }
810
+
811
+ $galleryItem.featherlightGallery({
812
+ openSpeed: 300
813
+ });
814
+ }
815
+
816
+ /**
817
+ * Finds and creates Featherlight galleries for WordPress image galleries.
818
+ *
819
+ * @since 0.1.0
820
+ * @return void
821
+ */
822
+ function findGalleries() {
823
+ var $gallery = $( '.gallery' );
824
+
825
+ if ( $gallery.length === 0 ) {
826
+ return;
827
+ }
828
+
829
+ $.each( $gallery, buildGalleries );
830
+ }
831
+
832
+ /**
833
+ * Fires all of our helper methods to load featherlight.
834
+ *
835
+ * @since 0.1.0
836
+ * @return void
837
+ */
838
+ function wpFeatherlightInit() {
839
+ findImages();
840
+ findGalleries();
841
+ }
842
+
843
+ $(document).ready(function() {
844
+ wpFeatherlightInit();
845
+ });
846
+ })( this, jQuery );
js/dist/wpFeatherlight.pkgd.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e){"use strict";function t(){this.removeEventListener("touchmove",n),this.removeEventListener("touchend",t),s=!1}function n(n){if(e.detectSwipe.preventDefault&&n.preventDefault(),s){var r,i=n.touches[0].pageX,c=n.touches[0].pageY,u=a-i,f=o-c;Math.abs(u)>=e.detectSwipe.threshold?r=u>0?"left":"right":Math.abs(f)>=e.detectSwipe.threshold&&(r=f>0?"down":"up"),r&&(t.call(this),e(this).trigger("swipe",r).trigger("swipe"+r))}}function r(e){1==e.touches.length&&(a=e.touches[0].pageX,o=e.touches[0].pageY,s=!0,this.addEventListener("touchmove",n,!1),this.addEventListener("touchend",t,!1))}function i(){this.addEventListener&&this.addEventListener("touchstart",r,!1)}e.detectSwipe={version:"2.1.1",enabled:"ontouchstart"in document.documentElement,preventDefault:!0,threshold:20};var a,o,s=!1;e.event.special.swipe={setup:i},e.each(["left","up","down","right"],function(){e.event.special["swipe"+this]={setup:function(){e(this).on("swipe",e.noop)}}})}(jQuery),function(e){"use strict";function t(e,n){if(!(this instanceof t)){var r=new t(e,n);return r.open(),r}this.id=t.id++,this.setup(e,n),this.chainCallbacks(t._callbackChain)}if("undefined"==typeof e)return void("console"in window&&window.console.info("Too much lightness, Featherlight needs jQuery."));var n=[],r=function(t){return n=e.grep(n,function(e){return e!==t&&e.$instance.closest("body").length>0})},i=function(e,t){var n={},r=new RegExp("^"+t+"([A-Z])(.*)");for(var i in e){var a=i.match(r);if(a){var o=(a[1]+a[2].replace(/([A-Z])/g,"-$1")).toLowerCase();n[o]=e[i]}}return n},a={keyup:"onKeyUp",resize:"onResize"},o=function(n){e.each(t.opened().reverse(),function(){return n.isDefaultPrevented()||!1!==this[a[n.type]](n)?void 0:(n.preventDefault(),n.stopPropagation(),!1)})},s=function(n){if(n!==t._globalHandlerInstalled){t._globalHandlerInstalled=n;var r=e.map(a,function(e,n){return n+"."+t.prototype.namespace}).join(" ");e(window)[n?"on":"off"](r,o)}};t.prototype={constructor:t,namespace:"featherlight",targetAttr:"data-featherlight",variant:null,resetCss:!1,background:null,openTrigger:"click",closeTrigger:"click",filter:null,root:"body",openSpeed:250,closeSpeed:250,closeOnClick:"background",closeOnEsc:!0,closeIcon:"&#10005;",loading:"",otherClose:null,beforeOpen:e.noop,beforeContent:e.noop,beforeClose:e.noop,afterOpen:e.noop,afterContent:e.noop,afterClose:e.noop,onKeyUp:e.noop,onResize:e.noop,type:null,contentFilters:["jquery","image","html","ajax","iframe","text"],setup:function(t,n){"object"!=typeof t||t instanceof e!=!1||n||(n=t,t=void 0);var r=e.extend(this,n,{target:t}),i=r.resetCss?r.namespace+"-reset":r.namespace,a=e(r.background||['<div class="'+i+"-loading "+i+'">','<div class="'+i+'-content">','<span class="'+i+"-close-icon "+r.namespace+'-close">',r.closeIcon,"</span>",'<div class="'+r.namespace+'-inner">'+r.loading+"</div>","</div>","</div>"].join("")),o="."+r.namespace+"-close"+(r.otherClose?","+r.otherClose:"");return r.$instance=a.clone().addClass(r.variant),r.$instance.on(r.closeTrigger+"."+r.namespace,function(t){var n=e(t.target);("background"===r.closeOnClick&&n.is("."+r.namespace)||"anywhere"===r.closeOnClick||n.closest(o).length)&&(t.preventDefault(),r.close())}),this},getContent:function(){var t=this,n=this.constructor.contentFilters,r=function(e){return t.$currentTarget&&t.$currentTarget.attr(e)},i=r(t.targetAttr),a=t.target||i||"",o=n[t.type];if(!o&&a in n&&(o=n[a],a=t.target&&i),a=a||r("href")||"",!o)for(var s in n)t[s]&&(o=n[s],a=t[s]);if(!o){var c=a;if(a=null,e.each(t.contentFilters,function(){return o=n[this],o.test&&(a=o.test(c)),!a&&o.regex&&c.match&&c.match(o.regex)&&(a=c),!a}),!a)return"console"in window&&window.console.error("Featherlight: no content filter found "+(c?' for "'+c+'"':" (no target specified)")),!1}return o.process.call(t,a)},setContent:function(t){var n=this;return(t.is("iframe")||e("iframe",t).length>0)&&n.$instance.addClass(n.namespace+"-iframe"),n.$instance.removeClass(n.namespace+"-loading"),n.$instance.find("."+n.namespace+"-inner").slice(1).remove().end().replaceWith(e.contains(n.$instance[0],t[0])?"":t),n.$content=t.addClass(n.namespace+"-inner"),n},open:function(t){var r=this;if(r.$instance.hide().appendTo(r.root),!(t&&t.isDefaultPrevented()||r.beforeOpen(t)===!1)){t&&t.preventDefault();var i=r.getContent();if(i)return n.push(r),s(!0),r.$instance.fadeIn(r.openSpeed),r.beforeContent(t),e.when(i).always(function(e){r.setContent(e),r.afterContent(t)}).then(r.$instance.promise()).done(function(){r.afterOpen(t)})}return r.$instance.detach(),e.Deferred().reject().promise()},close:function(t){var n=this,i=e.Deferred();return n.beforeClose(t)===!1?i.reject():(0===r(n).length&&s(!1),n.$instance.fadeOut(n.closeSpeed,function(){n.$instance.detach(),n.afterClose(t),i.resolve()})),i.promise()},chainCallbacks:function(t){for(var n in t)this[n]=e.proxy(t[n],this,e.proxy(this[n],this))}},e.extend(t,{id:0,autoBind:"[data-featherlight]",defaults:t.prototype,contentFilters:{jquery:{regex:/^[#.]\w/,test:function(t){return t instanceof e&&t},process:function(t){return e(t).clone(!0)}},image:{regex:/\.(png|jpg|jpeg|gif|tiff|bmp)(\?\S*)?$/i,process:function(t){var n=this,r=e.Deferred(),i=new Image,a=e('<img src="'+t+'" alt="" class="'+n.namespace+'-image" />');return i.onload=function(){a.naturalWidth=i.width,a.naturalHeight=i.height,r.resolve(a)},i.onerror=function(){r.reject(a)},i.src=t,r.promise()}},html:{regex:/^\s*<[\w!][^<]*>/,process:function(t){return e(t)}},ajax:{regex:/./,process:function(t){var n=e.Deferred(),r=e("<div></div>").load(t,function(e,t){"error"!==t&&n.resolve(r.contents()),n.fail()});return n.promise()}},iframe:{process:function(t){var n=new e.Deferred,r=e("<iframe/>").hide().attr("src",t).css(i(this,"iframe")).on("load",function(){n.resolve(r.show())}).appendTo(this.$instance.find("."+this.namespace+"-content"));return n.promise()}},text:{process:function(t){return e("<div>",{text:t})}}},functionAttributes:["beforeOpen","afterOpen","beforeContent","afterContent","beforeClose","afterClose"],readElementConfig:function(t,n){var r=this,i=new RegExp("^data-"+n+"-(.*)"),a={};return t&&t.attributes&&e.each(t.attributes,function(){var t=this.name.match(i);if(t){var n=this.value,o=e.camelCase(t[1]);if(e.inArray(o,r.functionAttributes)>=0)n=new Function(n);else try{n=e.parseJSON(n)}catch(s){}a[o]=n}}),a},extend:function(t,n){var r=function(){this.constructor=t};return r.prototype=this.prototype,t.prototype=new r,t.__super__=this.prototype,e.extend(t,this,n),t.defaults=t.prototype,t},attach:function(t,n,r){var i=this;"object"!=typeof n||n instanceof e!=!1||r||(r=n,n=void 0),r=e.extend({},r);var a=r.namespace||i.defaults.namespace,o=e.extend({},i.defaults,i.readElementConfig(t[0],a),r);return t.on(o.openTrigger+"."+o.namespace,o.filter,function(a){var s=e.extend({$source:t,$currentTarget:e(this)},i.readElementConfig(t[0],o.namespace),i.readElementConfig(this,o.namespace),r);new i(n,s).open(a)}),t},current:function(){var e=this.opened();return e[e.length-1]||null},opened:function(){var t=this;return r(),e.grep(n,function(e){return e instanceof t})},close:function(){var e=this.current();return e?e.close():void 0},_onReady:function(){var t=this;t.autoBind&&(t.attach(e(document),{filter:t.autoBind}),e(t.autoBind).filter("[data-featherlight-filter]").each(function(){t.attach(e(this))}))},_callbackChain:{onKeyUp:function(e,t){return 27===t.keyCode?(this.closeOnEsc&&this.$instance.find("."+this.namespace+"-close:first").click(),!1):e(t)},onResize:function(e,t){if(this.$content.naturalWidth){var n=this.$content.naturalWidth,r=this.$content.naturalHeight;this.$content.css("width","").css("height","");var i=Math.max(n/parseInt(this.$content.parent().css("width"),10),r/parseInt(this.$content.parent().css("height"),10));i>1&&this.$content.css("width",""+n/i+"px").css("height",""+r/i+"px")}return e(t)},afterContent:function(e,t){var n=e(t);return this.onResize(t),n}}}),e.featherlight=t,e.fn.featherlight=function(e,n){return t.attach(this,e,n)},e(document).ready(function(){t._onReady()})}(jQuery),function(e){"use strict";function t(n,r){if(!(this instanceof t)){var i=new t(e.extend({$source:n,$currentTarget:n.first()},r));return i.open(),i}e.featherlight.apply(this,arguments),this.chainCallbacks(s)}var n=function(e){window.console&&window.console.warn&&window.console.warn("FeatherlightGallery: "+e)};if("undefined"==typeof e)return n("Too much lightness, Featherlight needs jQuery.");if(!e.featherlight)return n("Load the featherlight plugin before the gallery plugin");var r="ontouchstart"in document.documentElement,i=e.event&&e.event.special.swipeleft&&e,a=window.Hammer&&function(e){var t=new window.Hammer.Manager(e[0]);return t.add(new window.Hammer.Swipe),t},o=r&&(i||a);r&&!o&&n("No compatible swipe library detected; one must be included before featherlightGallery for swipe motions to navigate the galleries.");var s={afterClose:function(e,t){var n=this;return n.$instance.off("next."+n.namespace+" previous."+n.namespace),n._swiper&&(n._swiper.off("swipeleft",n._swipeleft).off("swiperight",n._swiperight),n._swiper=null),e(t)},beforeOpen:function(e,t){var n=this;return n.$instance.on("next."+n.namespace+" previous."+n.namespace,function(e){var t="next"===e.type?1:-1;n.navigateTo(n.currentNavigation()+t)}),o?n._swiper=o(n.$instance).on("swipeleft",n._swipeleft=function(){n.$instance.trigger("next")}).on("swiperight",n._swiperight=function(){n.$instance.trigger("previous")}):n.$instance.find("."+n.namespace+"-content").append(n.createNavigation("previous")).append(n.createNavigation("next")),e(t)},onKeyUp:function(e,t){var n={37:"previous",39:"next"}[t.keyCode];return n?(this.$instance.trigger(n),!1):e(t)}};e.featherlight.extend(t,{autoBind:"[data-featherlight-gallery]"}),e.extend(t.prototype,{previousIcon:"&#9664;",nextIcon:"&#9654;",galleryFadeIn:100,galleryFadeOut:300,images:function(){return this.filter?this.$source.find(this.filter):this.$source},currentNavigation:function(){return this.images().index(this.$currentTarget)},navigateTo:function(t){var n=this,r=n.images(),i=r.length,a=n.$instance.find("."+n.namespace+"-inner");return t=(t%i+i)%i,n.$currentTarget=r.eq(t),n.beforeContent(),e.when(n.getContent(),a.fadeTo(n.galleryFadeOut,.2)).always(function(e){n.setContent(e),n.afterContent(),e.fadeTo(n.galleryFadeIn,1)})},createNavigation:function(t){var n=this;return e('<span title="'+t+'" class="'+this.namespace+"-"+t+'"><span>'+this[t+"Icon"]+"</span></span>").click(function(){e(this).trigger(t+"."+n.namespace)})}}),e.featherlightGallery=t,e.fn.featherlightGallery=function(e){return t.attach(this,e)},e(document).ready(function(){t._onReady()})}(jQuery),function(e,t){"use strict";function n(e,n){return n.hostname&&n.hostname!==location.hostname?!1:/(png|jpg|jpeg|gif|tiff|bmp)$/.test(t(n).attr("href"))}function r(){t("a[href]").filter(n).attr("data-featherlight","image")}function i(e,n){var r=t(n).attr("id"),i=t("#"+r+" .gallery-item a");i.attr("data-featherlight")&&i.featherlightGallery({openSpeed:300})}function a(){var e=t(".gallery");0!==e.length&&t.each(e,i)}function o(){r(),a()}t(document).ready(function(){o()})}(this,jQuery);
js/src/vendor/featherlight.gallery.js ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Featherlight Gallery – an extension for the ultra slim jQuery lightbox
3
+ * Version 1.2.3 - http://noelboss.github.io/featherlight/
4
+ *
5
+ * Copyright 2015, 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 document.documentElement,
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
+ } else {
60
+ self.$instance.find('.'+self.namespace+'-content')
61
+ .append(self.createNavigation('previous'))
62
+ .append(self.createNavigation('next'));
63
+ }
64
+ return _super(event);
65
+ },
66
+ onKeyUp: function(_super, event){
67
+ var dir = {
68
+ 37: 'previous', /* Left arrow */
69
+ 39: 'next' /* Rigth arrow */
70
+ }[event.keyCode];
71
+ if(dir) {
72
+ this.$instance.trigger(dir);
73
+ return false;
74
+ } else {
75
+ return _super(event);
76
+ }
77
+ }
78
+ };
79
+
80
+ function FeatherlightGallery($source, config) {
81
+ if(this instanceof FeatherlightGallery) { /* called with new */
82
+ $.featherlight.apply(this, arguments);
83
+ this.chainCallbacks(callbackChain);
84
+ } else {
85
+ var flg = new FeatherlightGallery($.extend({$source: $source, $currentTarget: $source.first()}, config));
86
+ flg.open();
87
+ return flg;
88
+ }
89
+ }
90
+
91
+ $.featherlight.extend(FeatherlightGallery, {
92
+ autoBind: '[data-featherlight-gallery]'
93
+ });
94
+
95
+ $.extend(FeatherlightGallery.prototype, {
96
+ /** Additional settings for Gallery **/
97
+ previousIcon: '&#9664;', /* Code that is used as previous icon */
98
+ nextIcon: '&#9654;', /* Code that is used as next icon */
99
+ galleryFadeIn: 100, /* fadeIn speed when image is loaded */
100
+ galleryFadeOut: 300, /* fadeOut speed before image is loaded */
101
+
102
+ images: function() {
103
+ if (this.filter) {
104
+ return this.$source.find(this.filter);
105
+ }
106
+ return this.$source;
107
+ },
108
+
109
+ currentNavigation: function() {
110
+ return this.images().index(this.$currentTarget);
111
+ },
112
+
113
+ navigateTo: function(index) {
114
+ var self = this,
115
+ source = self.images(),
116
+ len = source.length,
117
+ $inner = self.$instance.find('.' + self.namespace + '-inner');
118
+ index = ((index % len) + len) % len; /* pin index to [0, len[ */
119
+
120
+ self.$currentTarget = source.eq(index);
121
+ self.beforeContent();
122
+ return $.when(
123
+ self.getContent(),
124
+ $inner.fadeTo(self.galleryFadeOut,0.2)
125
+ ).always(function($newContent) {
126
+ self.setContent($newContent);
127
+ self.afterContent();
128
+ $newContent.fadeTo(self.galleryFadeIn,1);
129
+ });
130
+ },
131
+
132
+ createNavigation: function(target) {
133
+ var self = this;
134
+ return $('<span title="'+target+'" class="'+this.namespace+'-'+target+'"><span>'+this[target+'Icon']+'</span></span>').click(function(){
135
+ $(this).trigger(target+'.'+self.namespace);
136
+ });
137
+ }
138
+ });
139
+
140
+ $.featherlightGallery = FeatherlightGallery;
141
+
142
+ /* extend jQuery with selector featherlight method $(elm).featherlight(config, elm); */
143
+ $.fn.featherlightGallery = function(config) {
144
+ return FeatherlightGallery.attach(this, config);
145
+ };
146
+
147
+ /* bind featherlight on ready if config autoBind is set */
148
+ $(document).ready(function(){ FeatherlightGallery._onReady(); });
149
+
150
+ }(jQuery));
js/src/vendor/featherlight.js ADDED
@@ -0,0 +1,530 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Featherlight - ultra slim jQuery lightbox
3
+ * Version 1.2.3 - http://noelboss.github.io/featherlight/
4
+ *
5
+ * Copyright 2015, Noël Raoul Bossart (http://www.noelboss.com)
6
+ * MIT Licensed.
7
+ **/
8
+ (function($) {
9
+ "use strict";
10
+
11
+ if('undefined' === typeof $) {
12
+ if('console' in window){ window.console.info('Too much lightness, Featherlight needs jQuery.'); }
13
+ return;
14
+ }
15
+
16
+ /* Featherlight is exported as $.featherlight.
17
+ It is a function used to open a featherlight lightbox.
18
+
19
+ [tech]
20
+ Featherlight uses prototype inheritance.
21
+ Each opened lightbox will have a corresponding object.
22
+ That object may have some attributes that override the
23
+ prototype's.
24
+ Extensions created with Featherlight.extend will have their
25
+ own prototype that inherits from Featherlight's prototype,
26
+ thus attributes can be overriden either at the object level,
27
+ or at the extension level.
28
+ To create callbacks that chain themselves instead of overriding,
29
+ use chainCallbacks.
30
+ For those familiar with CoffeeScript, this correspond to
31
+ Featherlight being a class and the Gallery being a class
32
+ extending Featherlight.
33
+ The chainCallbacks is used since we don't have access to
34
+ CoffeeScript's `super`.
35
+ */
36
+
37
+ function Featherlight($content, config) {
38
+ if(this instanceof Featherlight) { /* called with new */
39
+ this.id = Featherlight.id++;
40
+ this.setup($content, config);
41
+ this.chainCallbacks(Featherlight._callbackChain);
42
+ } else {
43
+ var fl = new Featherlight($content, config);
44
+ fl.open();
45
+ return fl;
46
+ }
47
+ }
48
+
49
+ var opened = [],
50
+ pruneOpened = function(remove) {
51
+ opened = $.grep(opened, function(fl) {
52
+ return fl !== remove && fl.$instance.closest('body').length > 0;
53
+ } );
54
+ return opened;
55
+ };
56
+
57
+ // structure({iframeMinHeight: 44, foo: 0}, 'iframe')
58
+ // #=> {min-height: 44}
59
+ var structure = function(obj, prefix) {
60
+ var result = {},
61
+ regex = new RegExp('^' + prefix + '([A-Z])(.*)');
62
+ for (var key in obj) {
63
+ var match = key.match(regex);
64
+ if (match) {
65
+ var dasherized = (match[1] + match[2].replace(/([A-Z])/g, '-$1')).toLowerCase();
66
+ result[dasherized] = obj[key];
67
+ }
68
+ }
69
+ return result;
70
+ };
71
+
72
+ /* document wide key handler */
73
+ var eventMap = { keyup: 'onKeyUp', resize: 'onResize' };
74
+
75
+ var globalEventHandler = function(event) {
76
+ $.each(Featherlight.opened().reverse(), function() {
77
+ if (!event.isDefaultPrevented()) {
78
+ if (false === this[eventMap[event.type]](event)) {
79
+ event.preventDefault(); event.stopPropagation(); return false;
80
+ }
81
+ }
82
+ });
83
+ };
84
+
85
+ var toggleGlobalEvents = function(set) {
86
+ if(set !== Featherlight._globalHandlerInstalled) {
87
+ Featherlight._globalHandlerInstalled = set;
88
+ var events = $.map(eventMap, function(_, name) { return name+'.'+Featherlight.prototype.namespace; } ).join(' ');
89
+ $(window)[set ? 'on' : 'off'](events, globalEventHandler);
90
+ }
91
+ };
92
+
93
+ Featherlight.prototype = {
94
+ constructor: Featherlight,
95
+ /*** defaults ***/
96
+ /* extend featherlight with defaults and methods */
97
+ namespace: 'featherlight', /* Name of the events and css class prefix */
98
+ targetAttr: 'data-featherlight', /* Attribute of the triggered element that contains the selector to the lightbox content */
99
+ variant: null, /* Class that will be added to change look of the lightbox */
100
+ resetCss: false, /* Reset all css */
101
+ background: null, /* Custom DOM for the background, wrapper and the closebutton */
102
+ openTrigger: 'click', /* Event that triggers the lightbox */
103
+ closeTrigger: 'click', /* Event that triggers the closing of the lightbox */
104
+ filter: null, /* Selector to filter events. Think $(...).on('click', filter, eventHandler) */
105
+ root: 'body', /* Where to append featherlights */
106
+ openSpeed: 250, /* Duration of opening animation */
107
+ closeSpeed: 250, /* Duration of closing animation */
108
+ closeOnClick: 'background', /* Close lightbox on click ('background', 'anywhere' or false) */
109
+ closeOnEsc: true, /* Close lightbox when pressing esc */
110
+ closeIcon: '&#10005;', /* Close icon */
111
+ loading: '', /* Content to show while initial content is loading */
112
+ otherClose: null, /* Selector for alternate close buttons (e.g. "a.close") */
113
+ beforeOpen: $.noop, /* Called before open. can return false to prevent opening of lightbox. Gets event as parameter, this contains all data */
114
+ beforeContent: $.noop, /* Called when content is loaded. Gets event as parameter, this contains all data */
115
+ beforeClose: $.noop, /* Called before close. can return false to prevent opening of lightbox. Gets event as parameter, this contains all data */
116
+ afterOpen: $.noop, /* Called after open. Gets event as parameter, this contains all data */
117
+ afterContent: $.noop, /* Called after content is ready and has been set. Gets event as parameter, this contains all data */
118
+ afterClose: $.noop, /* Called after close. Gets event as parameter, this contains all data */
119
+ onKeyUp: $.noop, /* Called on key down for the frontmost featherlight */
120
+ onResize: $.noop, /* Called after new content and when a window is resized */
121
+ type: null, /* Specify type of lightbox. If unset, it will check for the targetAttrs value. */
122
+ contentFilters: ['jquery', 'image', 'html', 'ajax', 'iframe', 'text'], /* List of content filters to use to determine the content */
123
+
124
+ /*** methods ***/
125
+ /* setup iterates over a single instance of featherlight and prepares the background and binds the events */
126
+ setup: function(target, config){
127
+ /* all arguments are optional */
128
+ if (typeof target === 'object' && target instanceof $ === false && !config) {
129
+ config = target;
130
+ target = undefined;
131
+ }
132
+
133
+ var self = $.extend(this, config, {target: target}),
134
+ css = !self.resetCss ? self.namespace : self.namespace+'-reset', /* by adding -reset to the classname, we reset all the default css */
135
+ $background = $(self.background || [
136
+ '<div class="'+css+'-loading '+css+'">',
137
+ '<div class="'+css+'-content">',
138
+ '<span class="'+css+'-close-icon '+ self.namespace + '-close">',
139
+ self.closeIcon,
140
+ '</span>',
141
+ '<div class="'+self.namespace+'-inner">' + self.loading + '</div>',
142
+ '</div>',
143
+ '</div>'].join('')),
144
+ closeButtonSelector = '.'+self.namespace+'-close' + (self.otherClose ? ',' + self.otherClose : '');
145
+
146
+ self.$instance = $background.clone().addClass(self.variant); /* clone DOM for the background, wrapper and the close button */
147
+
148
+ /* close when click on background/anywhere/null or closebox */
149
+ self.$instance.on(self.closeTrigger+'.'+self.namespace, function(event) {
150
+ var $target = $(event.target);
151
+ if( ('background' === self.closeOnClick && $target.is('.'+self.namespace))
152
+ || 'anywhere' === self.closeOnClick
153
+ || $target.closest(closeButtonSelector).length ){
154
+ event.preventDefault();
155
+ self.close();
156
+ }
157
+ });
158
+
159
+ return this;
160
+ },
161
+
162
+ /* this method prepares the content and converts it into a jQuery object or a promise */
163
+ getContent: function(){
164
+ var self = this,
165
+ filters = this.constructor.contentFilters,
166
+ readTargetAttr = function(name){ return self.$currentTarget && self.$currentTarget.attr(name); },
167
+ targetValue = readTargetAttr(self.targetAttr),
168
+ data = self.target || targetValue || '';
169
+
170
+ /* Find which filter applies */
171
+ var filter = filters[self.type]; /* check explicit type like {type: 'image'} */
172
+
173
+ /* check explicit type like data-featherlight="image" */
174
+ if(!filter && data in filters) {
175
+ filter = filters[data];
176
+ data = self.target && targetValue;
177
+ }
178
+ data = data || readTargetAttr('href') || '';
179
+
180
+ /* check explicity type & content like {image: 'photo.jpg'} */
181
+ if(!filter) {
182
+ for(var filterName in filters) {
183
+ if(self[filterName]) {
184
+ filter = filters[filterName];
185
+ data = self[filterName];
186
+ }
187
+ }
188
+ }
189
+
190
+ /* otherwise it's implicit, run checks */
191
+ if(!filter) {
192
+ var target = data;
193
+ data = null;
194
+ $.each(self.contentFilters, function() {
195
+ filter = filters[this];
196
+ if(filter.test) {
197
+ data = filter.test(target);
198
+ }
199
+ if(!data && filter.regex && target.match && target.match(filter.regex)) {
200
+ data = target;
201
+ }
202
+ return !data;
203
+ });
204
+ if(!data) {
205
+ if('console' in window){ window.console.error('Featherlight: no content filter found ' + (target ? ' for "' + target + '"' : ' (no target specified)')); }
206
+ return false;
207
+ }
208
+ }
209
+ /* Process it */
210
+ return filter.process.call(self, data);
211
+ },
212
+
213
+ /* sets the content of $instance to $content */
214
+ setContent: function($content){
215
+ var self = this;
216
+ /* we need a special class for the iframe */
217
+ if($content.is('iframe') || $('iframe', $content).length > 0){
218
+ self.$instance.addClass(self.namespace+'-iframe');
219
+ }
220
+
221
+ self.$instance.removeClass(self.namespace+'-loading');
222
+
223
+ /* replace content by appending to existing one before it is removed
224
+ this insures that featherlight-inner remain at the same relative
225
+ position to any other items added to featherlight-content */
226
+ self.$instance.find('.'+self.namespace+'-inner')
227
+ .slice(1).remove().end() /* In the unexpected event where there are many inner elements, remove all but the first one */
228
+ .replaceWith($.contains(self.$instance[0], $content[0]) ? '' : $content);
229
+
230
+ self.$content = $content.addClass(self.namespace+'-inner');
231
+
232
+ return self;
233
+ },
234
+
235
+ /* opens the lightbox. "this" contains $instance with the lightbox, and with the config.
236
+ Returns a promise that is resolved after is successfully opened. */
237
+ open: function(event){
238
+ var self = this;
239
+ self.$instance.hide().appendTo(self.root);
240
+ if((!event || !event.isDefaultPrevented())
241
+ && self.beforeOpen(event) !== false) {
242
+
243
+ if(event){
244
+ event.preventDefault();
245
+ }
246
+ var $content = self.getContent();
247
+
248
+ if($content) {
249
+ opened.push(self);
250
+
251
+ toggleGlobalEvents(true);
252
+
253
+ self.$instance.fadeIn(self.openSpeed);
254
+ self.beforeContent(event);
255
+
256
+ /* Set content and show */
257
+ return $.when($content)
258
+ .always(function($content){
259
+ self.setContent($content);
260
+ self.afterContent(event);
261
+ })
262
+ .then(self.$instance.promise())
263
+ /* Call afterOpen after fadeIn is done */
264
+ .done(function(){ self.afterOpen(event); });
265
+ }
266
+ }
267
+ self.$instance.detach();
268
+ return $.Deferred().reject().promise();
269
+ },
270
+
271
+ /* closes the lightbox. "this" contains $instance with the lightbox, and with the config
272
+ returns a promise, resolved after the lightbox is successfully closed. */
273
+ close: function(event){
274
+ var self = this,
275
+ deferred = $.Deferred();
276
+
277
+ if(self.beforeClose(event) === false) {
278
+ deferred.reject();
279
+ } else {
280
+
281
+ if (0 === pruneOpened(self).length) {
282
+ toggleGlobalEvents(false);
283
+ }
284
+
285
+ self.$instance.fadeOut(self.closeSpeed,function(){
286
+ self.$instance.detach();
287
+ self.afterClose(event);
288
+ deferred.resolve();
289
+ });
290
+ }
291
+ return deferred.promise();
292
+ },
293
+
294
+ /* Utility function to chain callbacks
295
+ [Warning: guru-level]
296
+ Used be extensions that want to let users specify callbacks but
297
+ also need themselves to use the callbacks.
298
+ The argument 'chain' has callback names as keys and function(super, event)
299
+ as values. That function is meant to call `super` at some point.
300
+ */
301
+ chainCallbacks: function(chain) {
302
+ for (var name in chain) {
303
+ this[name] = $.proxy(chain[name], this, $.proxy(this[name], this));
304
+ }
305
+ }
306
+ };
307
+
308
+ $.extend(Featherlight, {
309
+ id: 0, /* Used to id single featherlight instances */
310
+ autoBind: '[data-featherlight]', /* Will automatically bind elements matching this selector. Clear or set before onReady */
311
+ defaults: Featherlight.prototype, /* You can access and override all defaults using $.featherlight.defaults, which is just a synonym for $.featherlight.prototype */
312
+ /* Contains the logic to determine content */
313
+ contentFilters: {
314
+ jquery: {
315
+ regex: /^[#.]\w/, /* Anything that starts with a class name or identifiers */
316
+ test: function(elem) { return elem instanceof $ && elem; },
317
+ process: function(elem) { return $(elem).clone(true); }
318
+ },
319
+ image: {
320
+ regex: /\.(png|jpg|jpeg|gif|tiff|bmp)(\?\S*)?$/i,
321
+ process: function(url) {
322
+ var self = this,
323
+ deferred = $.Deferred(),
324
+ img = new Image(),
325
+ $img = $('<img src="'+url+'" alt="" class="'+self.namespace+'-image" />');
326
+ img.onload = function() {
327
+ /* Store naturalWidth & height for IE8 */
328
+ $img.naturalWidth = img.width; $img.naturalHeight = img.height;
329
+ deferred.resolve( $img );
330
+ };
331
+ img.onerror = function() { deferred.reject($img); };
332
+ img.src = url;
333
+ return deferred.promise();
334
+ }
335
+ },
336
+ html: {
337
+ regex: /^\s*<[\w!][^<]*>/, /* Anything that starts with some kind of valid tag */
338
+ process: function(html) { return $(html); }
339
+ },
340
+ ajax: {
341
+ regex: /./, /* At this point, any content is assumed to be an URL */
342
+ process: function(url) {
343
+ var self = this,
344
+ deferred = $.Deferred();
345
+ /* we are using load so one can specify a target with: url.html #targetelement */
346
+ var $container = $('<div></div>').load(url, function(response, status){
347
+ if ( status !== "error" ) {
348
+ deferred.resolve($container.contents());
349
+ }
350
+ deferred.fail();
351
+ });
352
+ return deferred.promise();
353
+ }
354
+ },
355
+ iframe: {
356
+ process: function(url) {
357
+ var deferred = new $.Deferred();
358
+ var $content = $('<iframe/>')
359
+ .hide()
360
+ .attr('src', url)
361
+ .css(structure(this, 'iframe'))
362
+ .on('load', function() { deferred.resolve($content.show()); })
363
+ // We can't move an <iframe> and avoid reloading it,
364
+ // so let's put it in place ourselves right now:
365
+ .appendTo(this.$instance.find('.' + this.namespace + '-content'));
366
+ return deferred.promise();
367
+ }
368
+ },
369
+ text: {
370
+ process: function(text) { return $('<div>', {text: text}); }
371
+ }
372
+ },
373
+
374
+ functionAttributes: ['beforeOpen', 'afterOpen', 'beforeContent', 'afterContent', 'beforeClose', 'afterClose'],
375
+
376
+ /*** class methods ***/
377
+ /* read element's attributes starting with data-featherlight- */
378
+ readElementConfig: function(element, namespace) {
379
+ var Klass = this,
380
+ regexp = new RegExp('^data-' + namespace + '-(.*)'),
381
+ config = {};
382
+ if (element && element.attributes) {
383
+ $.each(element.attributes, function(){
384
+ var match = this.name.match(regexp);
385
+ if (match) {
386
+ var val = this.value,
387
+ name = $.camelCase(match[1]);
388
+ if ($.inArray(name, Klass.functionAttributes) >= 0) { /* jshint -W054 */
389
+ val = new Function(val); /* jshint +W054 */
390
+ } else {
391
+ try { val = $.parseJSON(val); }
392
+ catch(e) {}
393
+ }
394
+ config[name] = val;
395
+ }
396
+ });
397
+ }
398
+ return config;
399
+ },
400
+
401
+ /* Used to create a Featherlight extension
402
+ [Warning: guru-level]
403
+ Creates the extension's prototype that in turn
404
+ inherits Featherlight's prototype.
405
+ Could be used to extend an extension too...
406
+ This is pretty high level wizardy, it comes pretty much straight
407
+ from CoffeeScript and won't teach you anything about Featherlight
408
+ as it's not really specific to this library.
409
+ My suggestion: move along and keep your sanity.
410
+ */
411
+ extend: function(child, defaults) {
412
+ /* Setup class hierarchy, adapted from CoffeeScript */
413
+ var Ctor = function(){ this.constructor = child; };
414
+ Ctor.prototype = this.prototype;
415
+ child.prototype = new Ctor();
416
+ child.__super__ = this.prototype;
417
+ /* Copy class methods & attributes */
418
+ $.extend(child, this, defaults);
419
+ child.defaults = child.prototype;
420
+ return child;
421
+ },
422
+
423
+ attach: function($source, $content, config) {
424
+ var Klass = this;
425
+ if (typeof $content === 'object' && $content instanceof $ === false && !config) {
426
+ config = $content;
427
+ $content = undefined;
428
+ }
429
+ /* make a copy */
430
+ config = $.extend({}, config);
431
+
432
+ /* Only for openTrigger and namespace... */
433
+ var namespace = config.namespace || Klass.defaults.namespace,
434
+ tempConfig = $.extend({}, Klass.defaults, Klass.readElementConfig($source[0], namespace), config);
435
+
436
+ $source.on(tempConfig.openTrigger+'.'+tempConfig.namespace, tempConfig.filter, function(event) {
437
+ /* ... since we might as well compute the config on the actual target */
438
+ var elemConfig = $.extend(
439
+ {$source: $source, $currentTarget: $(this)},
440
+ Klass.readElementConfig($source[0], tempConfig.namespace),
441
+ Klass.readElementConfig(this, tempConfig.namespace),
442
+ config);
443
+ new Klass($content, elemConfig).open(event);
444
+ });
445
+ return $source;
446
+ },
447
+
448
+ current: function() {
449
+ var all = this.opened();
450
+ return all[all.length - 1] || null;
451
+ },
452
+
453
+ opened: function() {
454
+ var klass = this;
455
+ pruneOpened();
456
+ return $.grep(opened, function(fl) { return fl instanceof klass; } );
457
+ },
458
+
459
+ close: function() {
460
+ var cur = this.current();
461
+ if(cur) { return cur.close(); }
462
+ },
463
+
464
+ /* Does the auto binding on startup.
465
+ Meant only to be used by Featherlight and its extensions
466
+ */
467
+ _onReady: function() {
468
+ var Klass = this;
469
+ if(Klass.autoBind){
470
+ /* First, bind click on document, so it will work for items added dynamically */
471
+ Klass.attach($(document), {filter: Klass.autoBind});
472
+ /* Auto bound elements with attr-featherlight-filter won't work
473
+ (since we already used it to bind on document), so bind these
474
+ directly. We can't easily support dynamically added element with filters */
475
+ $(Klass.autoBind).filter('[data-featherlight-filter]').each(function(){
476
+ Klass.attach($(this));
477
+ });
478
+ }
479
+ },
480
+
481
+ /* Featherlight uses the onKeyUp callback to intercept the escape key.
482
+ Private to Featherlight.
483
+ */
484
+ _callbackChain: {
485
+ onKeyUp: function(_super, event){
486
+ if(27 === event.keyCode) {
487
+ if (this.closeOnEsc) {
488
+ this.$instance.find('.'+this.namespace+'-close:first').click();
489
+ }
490
+ return false;
491
+ } else {
492
+ return _super(event);
493
+ }
494
+ },
495
+
496
+ onResize: function(_super, event){
497
+ if (this.$content.naturalWidth) {
498
+ var w = this.$content.naturalWidth, h = this.$content.naturalHeight;
499
+ /* Reset apparent image size first so container grows */
500
+ this.$content.css('width', '').css('height', '');
501
+ /* Calculate the worst ratio so that dimensions fit */
502
+ var ratio = Math.max(
503
+ w / parseInt(this.$content.parent().css('width'),10),
504
+ h / parseInt(this.$content.parent().css('height'),10));
505
+ /* Resize content */
506
+ if (ratio > 1) {
507
+ this.$content.css('width', '' + w / ratio + 'px').css('height', '' + h / ratio + 'px');
508
+ }
509
+ }
510
+ return _super(event);
511
+ },
512
+
513
+ afterContent: function(_super, event){
514
+ var r = _super(event);
515
+ this.onResize(event);
516
+ return r;
517
+ }
518
+ }
519
+ });
520
+
521
+ $.featherlight = Featherlight;
522
+
523
+ /* bind jQuery elements to trigger featherlight */
524
+ $.fn.featherlight = function($content, config) {
525
+ return Featherlight.attach(this, $content, config);
526
+ };
527
+
528
+ /* bind featherlight on ready if config autoBind is set */
529
+ $(document).ready(function(){ Featherlight._onReady(); });
530
+ }(jQuery));
js/src/vendor/jquery.detect_swipe.js ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * jquery.detectSwipe v2.1.1
3
+ * jQuery Plugin to obtain touch gestures from iPhone, iPod Touch, iPad and Android
4
+ * http://github.com/marcandre/detect_swipe
5
+ * Based on touchwipe by Andreas Waltl, netCU Internetagentur (http://www.netcu.de)
6
+ */
7
+ (function($) {
8
+
9
+ $.detectSwipe = {
10
+ version: '2.1.1',
11
+ enabled: 'ontouchstart' in document.documentElement,
12
+ preventDefault: true,
13
+ threshold: 20
14
+ };
15
+
16
+ var startX,
17
+ startY,
18
+ isMoving = false;
19
+
20
+ function onTouchEnd() {
21
+ this.removeEventListener('touchmove', onTouchMove);
22
+ this.removeEventListener('touchend', onTouchEnd);
23
+ isMoving = false;
24
+ }
25
+
26
+ function onTouchMove(e) {
27
+ if ($.detectSwipe.preventDefault) { e.preventDefault(); }
28
+ if(isMoving) {
29
+ var x = e.touches[0].pageX;
30
+ var y = e.touches[0].pageY;
31
+ var dx = startX - x;
32
+ var dy = startY - y;
33
+ var dir;
34
+ if(Math.abs(dx) >= $.detectSwipe.threshold) {
35
+ dir = dx > 0 ? 'left' : 'right'
36
+ }
37
+ else if(Math.abs(dy) >= $.detectSwipe.threshold) {
38
+ dir = dy > 0 ? 'down' : 'up'
39
+ }
40
+ if(dir) {
41
+ onTouchEnd.call(this);
42
+ $(this).trigger('swipe', dir).trigger('swipe' + dir);
43
+ }
44
+ }
45
+ }
46
+
47
+ function onTouchStart(e) {
48
+ if (e.touches.length == 1) {
49
+ startX = e.touches[0].pageX;
50
+ startY = e.touches[0].pageY;
51
+ isMoving = true;
52
+ this.addEventListener('touchmove', onTouchMove, false);
53
+ this.addEventListener('touchend', onTouchEnd, false);
54
+ }
55
+ }
56
+
57
+ function setup() {
58
+ this.addEventListener && this.addEventListener('touchstart', onTouchStart, false);
59
+ }
60
+
61
+ function teardown() {
62
+ this.removeEventListener('touchstart', onTouchStart);
63
+ }
64
+
65
+ $.event.special.swipe = { setup: setup };
66
+
67
+ $.each(['left', 'up', 'down', 'right'], function () {
68
+ $.event.special['swipe' + this] = { setup: function(){
69
+ $(this).on('swipe', $.noop);
70
+ } };
71
+ });
72
+ })(jQuery);
js/src/wpFeatherlight.js ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * WP Featherlight - Loader and helpers for the Featherlight WordPress plugin
3
+ *
4
+ * @version Version 0.1.0
5
+ * @copyright Copyright 2015, Robert Neu (http://robneu.com)
6
+ * @license MIT
7
+ */
8
+ (function( window, $, undefined ) {
9
+ 'use strict';
10
+
11
+ /**
12
+ * Checks href targets to see if a given anchor is linking to an image.
13
+ *
14
+ * Returns false if the anchor is pointing to an external URL.
15
+ *
16
+ * @since 0.1.0
17
+ * @return mixed
18
+ */
19
+ function testImages( index, element ) {
20
+ if ( element.hostname && element.hostname !== location.hostname ) {
21
+ return false;
22
+ }
23
+ return /(png|jpg|jpeg|gif|tiff|bmp)$/.test( $( element ).attr( 'href' ) );
24
+ }
25
+
26
+ /**
27
+ * Filters all href elements on a page to add Featherlight's data attribute.
28
+ * When a match is found, the data attribute is added so Featherlight will
29
+ * open it normally.
30
+ *
31
+ * @since 0.1.0
32
+ * @return void
33
+ */
34
+ function findImages() {
35
+ $( 'a[href]' ).filter( testImages ).attr( 'data-featherlight', 'image' );
36
+ }
37
+
38
+ /**
39
+ * Callback function to initialize Featherlight galleries when they contain
40
+ * items that are able to be opened in a light box.
41
+ *
42
+ * @since 0.1.0
43
+ * @return void
44
+ */
45
+ function buildGalleries( index, value ) {
46
+ var galleryID = $( value ).attr( 'id' ),
47
+ $galleryItem = $( '#' + galleryID + ' .gallery-item a' );
48
+
49
+ if ( ! $galleryItem.attr( 'data-featherlight' ) ) {
50
+ return;
51
+ }
52
+
53
+ $galleryItem.featherlightGallery({
54
+ openSpeed: 300
55
+ });
56
+ }
57
+
58
+ /**
59
+ * Finds and creates Featherlight galleries for WordPress image galleries.
60
+ *
61
+ * @since 0.1.0
62
+ * @return void
63
+ */
64
+ function findGalleries() {
65
+ var $gallery = $( '.gallery' );
66
+
67
+ if ( $gallery.length === 0 ) {
68
+ return;
69
+ }
70
+
71
+ $.each( $gallery, buildGalleries );
72
+ }
73
+
74
+ /**
75
+ * Fires all of our helper methods to load featherlight.
76
+ *
77
+ * @since 0.1.0
78
+ * @return void
79
+ */
80
+ function wpFeatherlightInit() {
81
+ findImages();
82
+ findGalleries();
83
+ }
84
+
85
+ $(document).ready(function() {
86
+ wpFeatherlightInit();
87
+ });
88
+ })( this, jQuery );
readme.txt ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === WP Featherlight ===
2
+
3
+ Contributors: fatmedia, wpsitecare
4
+ Tags: jquery, lightbox, featherlight, photography, images, popup, minimal, responsive
5
+ Requires at least: 4.1
6
+ Tested up to: 4.1
7
+ Stable tag: 0.1.0
8
+ License: GPL-2.0+
9
+
10
+ An ultra lightweight jQuery lightbox for WordPress images and galleries.
11
+
12
+ == Description ==
13
+
14
+ A WordPress plugin wrapper for the Featherlight jQuery lightbox plugin. This plugin automatically displays all standard WordPress images and galleries in a simple, minimalistic lightbox popup.
15
+
16
+ Featherlight is a very lightweight jQuery lightbox plugin. It's simple yet flexible and easy to use. Featherlight has minimal css and uses no inline styles, everything is name-spaced, it's completely customizable via config object and offers image, ajax and iframe support out of the box. Featherlight's small footprint weights about 4kB – in total.
17
+
18
+ For more information about the Featherlight script, check out their GitHub plugin page. http://noelboss.github.io/featherlight/
19
+
20
+ == Developers ==
21
+
22
+ If you'd like to submit code patches or contribute in any other way, please fork the plugin on GitHub. https://github.com/wpsitecare/wp-featherlight
23
+
24
+ == Screenshots ==
25
+
26
+ 1. A view of the lightbox in action.
27
+
28
+ == Changelog ==
29
+
30
+ = 0.1.1 =
31
+ 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.
32
+
33
+ = 0.1.0 =
34
+ Initial release!
templates/admin/metabox-sidebar.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Template to display the WP Featherlight admin sidebar meta box.
4
+ *
5
+ * @package WPFeatherlight
6
+ * @author Robert Neu
7
+ * @copyright Copyright (c) 2015, Robert Neu
8
+ * @license GPL-2.0+
9
+ * @since 0.1.0
10
+ */
11
+ ?>
12
+ <?php wp_nonce_field( plugin_basename( WP_FEATHERLIGHT_FILE ), 'wp_featherlight_nonce' ); ?>
13
+ <p>
14
+ <label for="meta-checkbox">
15
+ <input type="checkbox" name="wp_featherlight_disable" id="wp_featherlight_disable" value="yes" <?php esc_attr( checked( $checked, 'yes' ) ); ?> />
16
+ <?php _e( 'Disable Lightbox on This', 'wp-featherlight' ); ?> <?php echo $name; ?>
17
+ </label>
18
+ </p>
wp-featherlight.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Name: WP Featherlight
4
+ * Plugin URI: http://www.wpsitecare.com/wp-featherlight/
5
+ * Description: An ultra lightweight jQuery lightbox for WordPress images and galleries.
6
+ * Version: 0.1.1
7
+ * Author: Robert Neu
8
+ * Author URI: http://robneu.com
9
+ * License: GPL-2.0+
10
+ * License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
+ * Text Domain: wp-featherlight
12
+ * Domain Path: /languages
13
+ * Git URI: https://github.com/wpsitecare/wp-featherlight
14
+ * GitHub Plugin URI: https://github.com/wpsitecare/wp-featherlight
15
+ * GitHub Branch: master
16
+ */
17
+
18
+ // Prevent direct access.
19
+ defined( 'ABSPATH' ) || exit;
20
+
21
+ define( 'WP_FEATHERLIGHT_FILE', __FILE__ );
22
+ define( 'WP_FEATHERLIGHT_VERSION', '0.1.1' );
23
+
24
+ if ( ! defined( 'WP_FEATHERLIGHT_DIR' ) ) {
25
+ define( 'WP_FEATHERLIGHT_DIR', plugin_dir_path( WP_FEATHERLIGHT_FILE ) );
26
+ }
27
+
28
+ if ( ! defined( 'WP_FEATHERLIGHT_URL' ) ) {
29
+ define( 'WP_FEATHERLIGHT_URL', plugin_dir_url( WP_FEATHERLIGHT_FILE ) );
30
+ }
31
+
32
+ // Load the main plugin class.
33
+ require_once WP_FEATHERLIGHT_DIR . 'includes/plugin.php';
34
+
35
+ /**
36
+ * Allow themes and plugins to access WP_Featherlight methods and properties.
37
+ *
38
+ * Because we aren't using a singleton pattern for our main plugin class, we
39
+ * need to make sure it's only instantiated once in our helper function.
40
+ * If you need to access methods inside the plugin classes, use this function.
41
+ *
42
+ * Example:
43
+ *
44
+ * <?php wp_featherlight()->meta; ?>
45
+ *
46
+ * @since 0.1.0
47
+ * @access public
48
+ * @uses WP_Featherlight
49
+ * @return object WP_Featherlight A single instance of the main plugin class.
50
+ */
51
+ function wp_featherlight() {
52
+ static $plugin;
53
+ if ( null === $plugin ) {
54
+ $plugin = new WP_Featherlight;
55
+ }
56
+ return $plugin;
57
+ }
58
+
59
+ /**
60
+ * Register an activation hook to run all necessary plugin setup procedures.
61
+ *
62
+ * @since 0.1.0
63
+ * @access public
64
+ * @return void
65
+ */
66
+ register_activation_hook(
67
+ WP_FEATHERLIGHT_FILE,
68
+ array( wp_featherlight(), 'activate' )
69
+ );
70
+
71
+ // Hook the main plugin class into WordPress to get things running.
72
+ add_action( 'plugins_loaded', array( wp_featherlight(), 'run' ) );