Cyr-To-Lat - Version 3.6.1

Version Description

(31.01.2019) = * Text domain corrected.

Download this release

Release Info

Developer mihdan
Plugin Icon 128x128 Cyr-To-Lat
Version 3.6.1
Comparing to
See all releases

Code changes from version 3.4 to 3.6.1

Files changed (123) hide show
  1. .editorconfig +22 -0
  2. css/cyr-to-lat-admin.css +61 -0
  3. cyr-to-lat.php +30 -285
  4. dist/js/settings/app.js +1 -0
  5. includes/class-cyr-to-lat-conversion-tables.php +166 -0
  6. includes/class-cyr-to-lat-main.php +215 -0
  7. includes/class-cyr-to-lat-settings.php +671 -0
  8. languages/cyr2lat-ru_RU.mo +0 -0
  9. languages/cyr2lat-ru_RU.po +84 -0
  10. languages/en_US.pot +81 -0
  11. readme.txt +17 -4
  12. vendor/autoload.php +7 -0
  13. vendor/autoload_52.php +7 -0
  14. vendor/composer/ClassLoader.php +445 -0
  15. vendor/composer/ClassLoader52.php +271 -0
  16. vendor/composer/LICENSE +56 -0
  17. vendor/composer/autoload_classmap.php +12 -0
  18. vendor/composer/autoload_namespaces.php +10 -0
  19. vendor/composer/autoload_psr4.php +10 -0
  20. vendor/composer/autoload_real.php +52 -0
  21. vendor/composer/autoload_real_52.php +44 -0
  22. vendor/composer/autoload_static.php +49 -0
  23. vendor/composer/installed.json +157 -0
  24. vendor/composer/installers/LICENSE +19 -0
  25. vendor/composer/installers/composer.json +105 -0
  26. vendor/composer/installers/src/Composer/Installers/AglInstaller.php +21 -0
  27. vendor/composer/installers/src/Composer/Installers/AimeosInstaller.php +9 -0
  28. vendor/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php +11 -0
  29. vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php +49 -0
  30. vendor/composer/installers/src/Composer/Installers/AttogramInstaller.php +9 -0
  31. vendor/composer/installers/src/Composer/Installers/BaseInstaller.php +136 -0
  32. vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php +126 -0
  33. vendor/composer/installers/src/Composer/Installers/BonefishInstaller.php +9 -0
  34. vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php +82 -0
  35. vendor/composer/installers/src/Composer/Installers/ChefInstaller.php +11 -0
  36. vendor/composer/installers/src/Composer/Installers/CiviCrmInstaller.php +9 -0
  37. vendor/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php +10 -0
  38. vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php +34 -0
  39. vendor/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php +11 -0
  40. vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php +13 -0
  41. vendor/composer/installers/src/Composer/Installers/CraftInstaller.php +35 -0
  42. vendor/composer/installers/src/Composer/Installers/CroogoInstaller.php +21 -0
  43. vendor/composer/installers/src/Composer/Installers/DecibelInstaller.php +10 -0
  44. vendor/composer/installers/src/Composer/Installers/DokuWikiInstaller.php +50 -0
  45. vendor/composer/installers/src/Composer/Installers/DolibarrInstaller.php +16 -0
  46. vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php +16 -0
  47. vendor/composer/installers/src/Composer/Installers/ElggInstaller.php +9 -0
  48. vendor/composer/installers/src/Composer/Installers/EliasisInstaller.php +12 -0
  49. vendor/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php +29 -0
  50. vendor/composer/installers/src/Composer/Installers/EzPlatformInstaller.php +10 -0
  51. vendor/composer/installers/src/Composer/Installers/FuelInstaller.php +11 -0
  52. vendor/composer/installers/src/Composer/Installers/FuelphpInstaller.php +9 -0
  53. vendor/composer/installers/src/Composer/Installers/GravInstaller.php +30 -0
  54. vendor/composer/installers/src/Composer/Installers/HuradInstaller.php +25 -0
  55. vendor/composer/installers/src/Composer/Installers/ImageCMSInstaller.php +11 -0
  56. vendor/composer/installers/src/Composer/Installers/Installer.php +274 -0
  57. vendor/composer/installers/src/Composer/Installers/ItopInstaller.php +9 -0
  58. vendor/composer/installers/src/Composer/Installers/JoomlaInstaller.php +15 -0
  59. vendor/composer/installers/src/Composer/Installers/KanboardInstaller.php +18 -0
  60. vendor/composer/installers/src/Composer/Installers/KirbyInstaller.php +11 -0
  61. vendor/composer/installers/src/Composer/Installers/KodiCMSInstaller.php +10 -0
  62. vendor/composer/installers/src/Composer/Installers/KohanaInstaller.php +9 -0
  63. vendor/composer/installers/src/Composer/Installers/LanManagementSystemInstaller.php +27 -0
  64. vendor/composer/installers/src/Composer/Installers/LaravelInstaller.php +9 -0
  65. vendor/composer/installers/src/Composer/Installers/LavaLiteInstaller.php +10 -0
  66. vendor/composer/installers/src/Composer/Installers/LithiumInstaller.php +10 -0
  67. vendor/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php +9 -0
  68. vendor/composer/installers/src/Composer/Installers/MODXEvoInstaller.php +16 -0
  69. vendor/composer/installers/src/Composer/Installers/MagentoInstaller.php +11 -0
  70. vendor/composer/installers/src/Composer/Installers/MajimaInstaller.php +37 -0
  71. vendor/composer/installers/src/Composer/Installers/MakoInstaller.php +9 -0
  72. vendor/composer/installers/src/Composer/Installers/MauticInstaller.php +25 -0
  73. vendor/composer/installers/src/Composer/Installers/MayaInstaller.php +33 -0
  74. vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php +51 -0
  75. vendor/composer/installers/src/Composer/Installers/MicroweberInstaller.php +111 -0
  76. vendor/composer/installers/src/Composer/Installers/ModxInstaller.php +12 -0
  77. vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php +57 -0
  78. vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php +47 -0
  79. vendor/composer/installers/src/Composer/Installers/OntoWikiInstaller.php +24 -0
  80. vendor/composer/installers/src/Composer/Installers/OsclassInstaller.php +14 -0
  81. vendor/composer/installers/src/Composer/Installers/OxidInstaller.php +59 -0
  82. vendor/composer/installers/src/Composer/Installers/PPIInstaller.php +9 -0
  83. vendor/composer/installers/src/Composer/Installers/PhiftyInstaller.php +11 -0
  84. vendor/composer/installers/src/Composer/Installers/PhpBBInstaller.php +11 -0
  85. vendor/composer/installers/src/Composer/Installers/PimcoreInstaller.php +21 -0
  86. vendor/composer/installers/src/Composer/Installers/PiwikInstaller.php +32 -0
  87. vendor/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php +29 -0
  88. vendor/composer/installers/src/Composer/Installers/Plugin.php +17 -0
  89. vendor/composer/installers/src/Composer/Installers/PortoInstaller.php +9 -0
  90. vendor/composer/installers/src/Composer/Installers/PrestashopInstaller.php +10 -0
  91. vendor/composer/installers/src/Composer/Installers/PuppetInstaller.php +11 -0
  92. vendor/composer/installers/src/Composer/Installers/PxcmsInstaller.php +63 -0
  93. vendor/composer/installers/src/Composer/Installers/RadPHPInstaller.php +24 -0
  94. vendor/composer/installers/src/Composer/Installers/ReIndexInstaller.php +10 -0
  95. vendor/composer/installers/src/Composer/Installers/RedaxoInstaller.php +10 -0
  96. vendor/composer/installers/src/Composer/Installers/RoundcubeInstaller.php +22 -0
  97. vendor/composer/installers/src/Composer/Installers/SMFInstaller.php +10 -0
  98. vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php +60 -0
  99. vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php +35 -0
  100. vendor/composer/installers/src/Composer/Installers/SiteDirectInstaller.php +25 -0
  101. vendor/composer/installers/src/Composer/Installers/SyDESInstaller.php +49 -0
  102. vendor/composer/installers/src/Composer/Installers/Symfony1Installer.php +26 -0
  103. vendor/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php +16 -0
  104. vendor/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php +38 -0
  105. vendor/composer/installers/src/Composer/Installers/TheliaInstaller.php +12 -0
  106. vendor/composer/installers/src/Composer/Installers/TuskInstaller.php +14 -0
  107. vendor/composer/installers/src/Composer/Installers/UserFrostingInstaller.php +9 -0
  108. vendor/composer/installers/src/Composer/Installers/VanillaInstaller.php +10 -0
  109. vendor/composer/installers/src/Composer/Installers/VgmcpInstaller.php +49 -0
  110. vendor/composer/installers/src/Composer/Installers/WHMCSInstaller.php +10 -0
  111. vendor/composer/installers/src/Composer/Installers/WolfCMSInstaller.php +9 -0
  112. vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php +12 -0
  113. vendor/composer/installers/src/Composer/Installers/YawikInstaller.php +32 -0
  114. vendor/composer/installers/src/Composer/Installers/ZendInstaller.php +11 -0
  115. vendor/composer/installers/src/Composer/Installers/ZikulaInstaller.php +10 -0
  116. vendor/composer/installers/src/bootstrap.php +13 -0
  117. vendor/xrstf/composer-php52/.gitignore +1 -0
  118. vendor/xrstf/composer-php52/LICENSE +19 -0
  119. vendor/xrstf/composer-php52/README.md +37 -0
  120. vendor/xrstf/composer-php52/composer.json +26 -0
  121. vendor/xrstf/composer-php52/lib/xrstf/Composer52/AutoloadGenerator.php +346 -0
  122. vendor/xrstf/composer-php52/lib/xrstf/Composer52/ClassLoader.php +271 -0
  123. vendor/xrstf/composer-php52/lib/xrstf/Composer52/Generator.php +39 -0
.editorconfig ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is for unifying the coding style for different editors and IDEs
2
+ # editorconfig.org
3
+
4
+ # WordPress Coding Standards
5
+ # https://make.wordpress.org/core/handbook/coding-standards/
6
+
7
+ root = true
8
+
9
+ [*]
10
+ charset = utf-8
11
+ end_of_line = lf
12
+ insert_final_newline = true
13
+ trim_trailing_whitespace = true
14
+ indent_style = tab
15
+ indent_size = 4
16
+
17
+ [{.jshintrc,*.json,*.yml}]
18
+ indent_style = space
19
+ indent_size = 2
20
+
21
+ [{*.txt,wp-config-sample.php}]
22
+ end_of_line = crlf
css/cyr-to-lat-admin.css ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .ctl-col {
2
+ float: left;
3
+ }
4
+
5
+ .ctl-col.left {
6
+ /* width: 70%; */
7
+ }
8
+
9
+ .ctl-col.right {
10
+ width: 30%;
11
+ }
12
+
13
+ #ctl-options .form-table:not(:nth-child(2)) th {
14
+ display: none;
15
+ }
16
+
17
+ .ctl-table {
18
+ display: none;
19
+ }
20
+
21
+ #ctl-options .nav-tab {
22
+ cursor: pointer;
23
+ margin-bottom: -1px;
24
+ }
25
+
26
+ #ctl-options .nav-tab-active {
27
+ border-bottom: 1px solid #f1f1f1;
28
+ background: #f1f1f1;
29
+ }
30
+
31
+ .ctl-table.active {
32
+ display: block;
33
+ }
34
+
35
+ .ctl-table-cell {
36
+ float: left;
37
+ }
38
+
39
+ .ctl-table-cell label {
40
+ width: 2.4em;
41
+ display: inline-block;
42
+ text-align: right;
43
+ margin-right: 0.2em;
44
+ }
45
+
46
+ .ctl-table-cell input {
47
+ width: 3em !important;
48
+ display: inline-block !important;
49
+ }
50
+
51
+ .ctl-col.right form input[name="submit"] {
52
+ cursor: pointer;
53
+ padding: 0;
54
+ margin: 0;
55
+ }
56
+
57
+ @media screen and (max-width: 767px) {
58
+ .ctl-col.left, .ctl-col.right {
59
+ width: 100%;
60
+ }
61
+ }
cyr-to-lat.php CHANGED
@@ -1,317 +1,62 @@
1
  <?php
2
  /**
 
 
3
  * Plugin Name: Cyr-To-Lat
4
- * Plugin URI: http://wordpress.org/extend/plugins/cyr2lat/
5
  * Description: Converts Cyrillic characters in post and term slugs to Latin characters. Useful for creating human-readable URLs. Based on the original plugin by Anton Skorobogatov.
6
  * Author: Sergey Biryukov, Mikhail Kobzarev
7
- * Author URI: http://ru.wordpress.org/
8
  * Requires at least: 2.3
9
  * Tested up to: 5.1
10
- * Version: 3.4
 
 
 
 
 
 
 
11
  */
12
 
13
  if ( ! defined( 'ABSPATH' ) ) {
14
- exit;
15
  }
16
 
17
  /**
18
- * Sanitize title
19
- *
20
- * @param string $title Post title.
21
- *
22
- * @return string
23
  */
24
- function ctl_sanitize_title( $title ) {
25
- global $wpdb;
26
-
27
- $pre = apply_filters( 'ctl_pre_sanitize_title', false, $title );
28
-
29
- if ( false !== $pre ) {
30
- return $pre;
31
- }
32
-
33
- $iso9_table = array(
34
- 'А' => 'A',
35
- 'Б' => 'B',
36
- 'В' => 'V',
37
- 'Г' => 'G',
38
- 'Ѓ' => 'G',
39
- 'Ґ' => 'G',
40
- 'Д' => 'D',
41
- 'Е' => 'E',
42
- 'Ё' => 'YO',
43
- 'Є' => 'YE',
44
- 'Ж' => 'ZH',
45
- 'З' => 'Z',
46
- 'Ѕ' => 'Z',
47
- 'И' => 'I',
48
- 'Й' => 'J',
49
- 'Ј' => 'J',
50
- 'І' => 'I',
51
- 'Ї' => 'YI',
52
- 'К' => 'K',
53
- 'Ќ' => 'K',
54
- 'Л' => 'L',
55
- 'Љ' => 'L',
56
- 'М' => 'M',
57
- 'Н' => 'N',
58
- 'Њ' => 'N',
59
- 'О' => 'O',
60
- 'П' => 'P',
61
- 'Р' => 'R',
62
- 'С' => 'S',
63
- 'Т' => 'T',
64
- 'У' => 'U',
65
- 'Ў' => 'U',
66
- 'Ф' => 'F',
67
- 'Х' => 'H',
68
- 'Ц' => 'TS',
69
- 'Ч' => 'CH',
70
- 'Џ' => 'DH',
71
- 'Ш' => 'SH',
72
- 'Щ' => 'SHH',
73
- 'Ъ' => '',
74
- 'Ы' => 'Y',
75
- 'Ь' => '',
76
- 'Э' => 'E',
77
- 'Ю' => 'YU',
78
- 'Я' => 'YA',
79
- 'а' => 'a',
80
- 'б' => 'b',
81
- 'в' => 'v',
82
- 'г' => 'g',
83
- 'ѓ' => 'g',
84
- 'ґ' => 'g',
85
- 'д' => 'd',
86
- 'е' => 'e',
87
- 'ё' => 'yo',
88
- 'є' => 'ye',
89
- 'ж' => 'zh',
90
- 'з' => 'z',
91
- 'ѕ' => 'z',
92
- 'и' => 'i',
93
- 'й' => 'j',
94
- 'ј' => 'j',
95
- 'і' => 'i',
96
- 'ї' => 'yi',
97
- 'к' => 'k',
98
- 'ќ' => 'k',
99
- 'л' => 'l',
100
- 'љ' => 'l',
101
- 'м' => 'm',
102
- 'н' => 'n',
103
- 'њ' => 'n',
104
- 'о' => 'o',
105
- 'п' => 'p',
106
- 'р' => 'r',
107
- 'с' => 's',
108
- 'т' => 't',
109
- 'у' => 'u',
110
- 'ў' => 'u',
111
- 'ф' => 'f',
112
- 'х' => 'h',
113
- 'ц' => 'ts',
114
- 'ч' => 'ch',
115
- 'џ' => 'dh',
116
- 'ш' => 'sh',
117
- 'щ' => 'shh',
118
- 'ъ' => '',
119
- 'ы' => 'y',
120
- 'ь' => '',
121
- 'э' => 'e',
122
- 'ю' => 'yu',
123
- 'я' => 'ya',
124
- );
125
-
126
- // Locales list - https://make.wordpress.org/polyglots/teams/
127
- $locale = get_locale();
128
- switch ( $locale ) {
129
- case 'bg_BG':
130
- $iso9_table['Щ'] = 'SHT';
131
- $iso9_table['щ'] = 'sht';
132
- $iso9_table['Ъ'] = 'A';
133
- $iso9_table['ъ'] = 'a';
134
- break;
135
- case 'uk':
136
- $iso9_table['И'] = 'Y';
137
- $iso9_table['и'] = 'y';
138
- break;
139
- case 'ka_GE':
140
- $iso9_table['ა'] = 'a';
141
- $iso9_table['ბ'] = 'b';
142
- $iso9_table['გ'] = 'g';
143
- $iso9_table['დ'] = 'd';
144
- $iso9_table['ე'] = 'e';
145
- $iso9_table['ვ'] = 'v';
146
- $iso9_table['ზ'] = 'z';
147
- $iso9_table['თ'] = 'th';
148
- $iso9_table['ი'] = 'i';
149
- $iso9_table['კ'] = 'k';
150
- $iso9_table['ლ'] = 'l';
151
- $iso9_table['მ'] = 'm';
152
- $iso9_table['ნ'] = 'n';
153
- $iso9_table['ო'] = 'o';
154
- $iso9_table['პ'] = 'p';
155
- $iso9_table['ჟ'] = 'zh';
156
- $iso9_table['რ'] = 'r';
157
- $iso9_table['ს'] = 's';
158
- $iso9_table['ტ'] = 't';
159
- $iso9_table['უ'] = 'u';
160
- $iso9_table['ფ'] = 'ph';
161
- $iso9_table['ქ'] = 'q';
162
- $iso9_table['ღ'] = 'gh';
163
- $iso9_table['ყ'] = 'qh';
164
- $iso9_table['შ'] = 'sh';
165
- $iso9_table['ჩ'] = 'ch';
166
- $iso9_table['ც'] = 'ts';
167
- $iso9_table['ძ'] = 'dz';
168
- $iso9_table['წ'] = 'ts';
169
- $iso9_table['ჭ'] = 'tch';
170
- $iso9_table['ხ'] = 'kh';
171
- $iso9_table['ჯ'] = 'j';
172
- $iso9_table['ჰ'] = 'h';
173
- break;
174
- }
175
-
176
- $is_term = false;
177
- // @codingStandardsIgnoreLine
178
- $backtrace = debug_backtrace();
179
- foreach ( $backtrace as $backtrace_entry ) {
180
- if ( 'wp_insert_term' === $backtrace_entry['function'] ) {
181
- $is_term = true;
182
- break;
183
- }
184
- }
185
-
186
- $term = $is_term ? $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE name = %s", $title ) ) : '';
187
-
188
- if ( ! empty( $term ) ) {
189
- $title = $term;
190
- } else {
191
- $title = strtr( $title, apply_filters( 'ctl_table', $iso9_table ) );
192
-
193
- if ( function_exists( 'iconv' ) ) {
194
- $title = iconv( 'UTF-8', 'UTF-8//TRANSLIT//IGNORE', $title );
195
- }
196
-
197
- $title = preg_replace( "/[^A-Za-z0-9'_\-\.]/", '-', $title );
198
- $title = preg_replace( '/\-+/', '-', $title );
199
- $title = trim( $title, '-' );
200
- }
201
-
202
- return $title;
203
- }
204
-
205
- add_filter( 'sanitize_title', 'ctl_sanitize_title', 9 );
206
- add_filter( 'sanitize_file_name', 'ctl_sanitize_title' );
207
 
208
  /**
209
- * Convert Existing Slugs
210
  */
211
- function ctl_convert_existing_slugs() {
212
- global $wpdb;
213
-
214
- $posts = $wpdb->get_results( "SELECT ID, post_name FROM $wpdb->posts WHERE post_name REGEXP('[^A-Za-z0-9\-]+') AND post_status IN ('publish', 'future', 'private')" );
215
-
216
- foreach ( (array) $posts as $post ) {
217
- $sanitized_name = ctl_sanitize_title( urldecode( $post->post_name ) );
218
-
219
- if ( $post->post_name !== $sanitized_name ) {
220
- add_post_meta( $post->ID, '_wp_old_slug', $post->post_name );
221
- $wpdb->update( $wpdb->posts, array( 'post_name' => $sanitized_name ), array( 'ID' => $post->ID ) );
222
- }
223
- }
224
-
225
- $terms = $wpdb->get_results( "SELECT term_id, slug FROM $wpdb->terms WHERE slug REGEXP('[^A-Za-z0-9\-]+') " );
226
-
227
- foreach ( (array) $terms as $term ) {
228
- $sanitized_slug = ctl_sanitize_title( urldecode( $term->slug ) );
229
-
230
- if ( $term->slug !== $sanitized_slug ) {
231
- $wpdb->update( $wpdb->terms, array( 'slug' => $sanitized_slug ), array( 'term_id' => $term->term_id ) );
232
- }
233
- }
234
- }
235
-
236
- function ctl_schedule_conversion() {
237
- add_action( 'shutdown', 'ctl_convert_existing_slugs' );
238
- }
239
-
240
- register_activation_hook( __FILE__, 'ctl_schedule_conversion' );
241
 
242
  /**
243
- * Check if Classic Editor plugin is active.
244
- *
245
- * @link https://kagg.eu/how-to-catch-gutenberg/
246
- *
247
- * @return bool
248
  */
249
- function ctl_is_classic_editor_plugin_active() {
250
- if ( ! function_exists( 'is_plugin_active' ) ) {
251
- include_once ABSPATH . 'wp-admin/includes/plugin.php';
252
- }
253
-
254
- if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) {
255
- return true;
256
- }
257
-
258
- return false;
259
- }
260
 
261
  /**
262
- * Check if Block Editor is active.
263
- * Must only be used after plugins_loaded action is fired.
264
- *
265
- * @link https://kagg.eu/how-to-catch-gutenberg/
266
- *
267
- * @return bool
268
  */
269
- function ctl_is_gutenberg_editor_active() {
270
-
271
- // Gutenberg plugin is installed and activated.
272
- $gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) );
273
-
274
- // Block editor since 5.0.
275
- $block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' );
276
-
277
- if ( ! $gutenberg && ! $block_editor ) {
278
- return false;
279
- }
280
-
281
- if ( ctl_is_classic_editor_plugin_active() ) {
282
- $editor_option = get_option( 'classic-editor-replace' );
283
- $block_editor_active = array( 'no-replace', 'block' );
284
-
285
- return in_array( $editor_option, $block_editor_active, true );
286
- }
287
-
288
- return true;
289
- }
290
 
291
  /**
292
- * Gutenberg support
293
- *
294
- * @param array $data An array of slashed post data.
295
- * @param array $postarr An array of sanitized, but otherwise unmodified post data.
296
- *
297
- * @return mixed
298
  */
299
- function ctl_sanitize_post_name( $data, $postarr ) {
300
 
301
- if ( ! ctl_is_gutenberg_editor_active() ) {
302
- return $data;
303
- }
304
 
305
- if (
306
- ! $data['post_name'] && $data['post_title'] &&
307
- ! in_array( $data['post_status'], array( 'auto-draft', 'revision' ), true )
308
- ) {
309
- $data['post_name'] = sanitize_title( $data['post_title'] );
310
  }
311
 
312
- return $data;
313
  }
314
 
315
- add_filter( 'wp_insert_post_data', 'ctl_sanitize_post_name', 10, 2 );
316
-
317
- // eof;
1
  <?php
2
  /**
3
+ * Cyr-To-Lat
4
+ *
5
  * Plugin Name: Cyr-To-Lat
6
+ * Plugin URI: https://wordpress.org/plugins/cyr2lat/
7
  * Description: Converts Cyrillic characters in post and term slugs to Latin characters. Useful for creating human-readable URLs. Based on the original plugin by Anton Skorobogatov.
8
  * Author: Sergey Biryukov, Mikhail Kobzarev
9
+ * Author URI: https://profiles.wordpress.org/sergeybiryukov/
10
  * Requires at least: 2.3
11
  * Tested up to: 5.1
12
+ * Version: 3.6.1
13
+ * Stable tag: 3.6.1
14
+ *
15
+ * Text Domain: cyr-to-lat
16
+ * Domain Path: /languages/
17
+ *
18
+ * @package cyr-to-lat
19
+ * @author Sergey Biryukov, Mikhail Kobzarev
20
  */
21
 
22
  if ( ! defined( 'ABSPATH' ) ) {
23
+ exit; // Exit if accessed directly.
24
  }
25
 
26
  /**
27
+ * Path to the plugin dir.
 
 
 
 
28
  */
29
+ define( 'CYR_TO_LAT_PATH', dirname( __FILE__ ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
  /**
32
+ * Plugin dir url.
33
  */
34
+ define( 'CYR_TO_LAT_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
  /**
37
+ * Main plugin file.
 
 
 
 
38
  */
39
+ define( 'CYR_TO_LAT_FILE', __FILE__ );
 
 
 
 
 
 
 
 
 
 
40
 
41
  /**
42
+ * Plugin version.
 
 
 
 
 
43
  */
44
+ define( 'CYR_TO_LAT_VERSION', '3.6.1' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
  /**
47
+ * Init plugin class on plugin load.
 
 
 
 
 
48
  */
 
49
 
50
+ static $plugin;
 
 
51
 
52
+ if ( ! isset( $plugin ) ) {
53
+ if ( version_compare( PHP_VERSION, '5.3.0' ) >= 0 ) {
54
+ require_once CYR_TO_LAT_PATH . '/vendor/autoload.php';
55
+ } else {
56
+ require_once CYR_TO_LAT_PATH . '/vendor/autoload_52.php';
57
  }
58
 
59
+ $plugin = new Cyr_To_Lat_Main();
60
  }
61
 
62
+ // eof.
 
 
dist/js/settings/app.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=3)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function o(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}var i=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.hideTables(),this.bindEvents()}return n(t,[{key:"hideTables",value:function(){var t=[].concat(o(document.querySelectorAll("#ctl-options table")));t.shift(),t.map(function(t,e){if(t.classList.add("ctl-table"),0===e){t.classList.add("active");var r=document.createElement("ul");r.classList.add("nav-tab-wrapper"),t.parentNode.insertBefore(r,t)}});var e=[].concat(o(document.querySelectorAll("#ctl-options h2")));e.shift(),e.map(function(t,e){t.classList.add("nav-tab"),t.dataset.index=e,document.querySelector("#ctl-options ul").appendChild(t),0===e&&t.classList.add("nav-tab-active")})}},{key:"bindEvents",value:function(){[].concat(o(document.querySelectorAll("#ctl-options ul h2"))).map(function(t){t.onclick=function(t){t.preventDefault();var e=t.target.dataset.index;[].concat(o(document.querySelectorAll("#ctl-options ul h2"))).map(function(t){t.classList.remove("nav-tab-active")}),t.target.classList.add("nav-tab-active");var r=[].concat(o(document.querySelectorAll(".ctl-table")));return r.map(function(t){t.classList.remove("active")}),r[e].classList.add("active"),!1}})}}]),t}();e.default=i},function(t,e,r){"use strict";var n=function(t){return t&&t.__esModule?t:{default:t}}(r(0));document.addEventListener("DOMContentLoaded",function(){new n.default})},function(t,e){!function(t){"use strict";if(!t.fetch){var e={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(e.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=function(t){return t&&DataView.prototype.isPrototypeOf(t)},o=ArrayBuffer.isView||function(t){return t&&r.indexOf(Object.prototype.toString.call(t))>-1};c.prototype.append=function(t,e){t=a(t),e=u(e);var r=this.map[t];this.map[t]=r?r+","+e:e},c.prototype.delete=function(t){delete this.map[a(t)]},c.prototype.get=function(t){return t=a(t),this.has(t)?this.map[t]:null},c.prototype.has=function(t){return this.map.hasOwnProperty(a(t))},c.prototype.set=function(t,e){this.map[a(t)]=u(e)},c.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},c.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),f(t)},c.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),f(t)},c.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),f(t)},e.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var i=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},p.call(b.prototype),p.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},v.error=function(){var t=new v(null,{status:0,statusText:""});return t.type="error",t};var s=[301,302,303,307,308];v.redirect=function(t,e){if(-1===s.indexOf(e))throw new RangeError("Invalid status code");return new v(null,{status:e,headers:{location:t}})},t.Headers=c,t.Request=b,t.Response=v,t.fetch=function(t,r){return new Promise(function(n,o){var i=new b(t,r),s=new XMLHttpRequest;s.onload=function(){var t={status:s.status,statusText:s.statusText,headers:function(t){var e=new c;return t.split(/\r?\n/).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}}),e}(s.getAllResponseHeaders()||"")};t.url="responseURL"in s?s.responseURL:t.headers.get("X-Request-URL");var e="response"in s?s.response:s.responseText;n(new v(e,t))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.open(i.method,i.url,!0),"include"===i.credentials&&(s.withCredentials=!0),"responseType"in s&&e.blob&&(s.responseType="blob"),i.headers.forEach(function(t,e){s.setRequestHeader(e,t)}),s.send(void 0===i._bodyInit?null:i._bodyInit)})},t.fetch.polyfill=!0}function a(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function u(t){return"string"!=typeof t&&(t=String(t)),t}function f(t){var r={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return e.iterable&&(r[Symbol.iterator]=function(){return r}),r}function c(t){this.map={},t instanceof c?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function l(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function d(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function h(t){var e=new FileReader,r=d(e);return e.readAsArrayBuffer(t),r}function y(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function p(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t)if("string"==typeof t)this._bodyText=t;else if(e.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(e.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(e.arrayBuffer&&e.blob&&n(t))this._bodyArrayBuffer=y(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!e.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t)&&!o(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=y(t)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e.blob&&(this.blob=function(){var t=l(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?l(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var t=l(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,r=d(e);return e.readAsText(t),r}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},e.formData&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}function b(t,e){var r=(e=e||{}).body;if(t instanceof b){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new c(t.headers)),this.method=t.method,this.mode=t.mode,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new c(e.headers)),this.method=function(t){var e=t.toUpperCase();return i.indexOf(e)>-1?e:t}(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function m(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}}),e}function v(t,e){e||(e={}),this.type="default",this.status="status"in e?e.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new c(e.headers),this.url=e.url||"",this._initBody(t)}}("undefined"!=typeof self?self:this)},function(t,e,r){r(2),t.exports=r(1)}]);
includes/class-cyr-to-lat-conversion-tables.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Conversion tables.
4
+ *
5
+ * @package cyr-to-lat
6
+ */
7
+
8
+ /**
9
+ * Class Cyr_To_Lat_Conversion_Tables
10
+ *
11
+ * @class Cyr_To_Lat_Conversion_Tables
12
+ */
13
+ class Cyr_To_Lat_Conversion_Tables {
14
+
15
+ /**
16
+ * Get conversion table by locale.
17
+ *
18
+ * @param string $locale WordPress locale.
19
+ *
20
+ * @return array
21
+ */
22
+ public static function get( $locale = '' ) {
23
+ $table = array(
24
+ 'А' => 'A',
25
+ 'Б' => 'B',
26
+ 'В' => 'V',
27
+ 'Г' => 'G',
28
+ 'Ѓ' => 'G',
29
+ 'Ґ' => 'G',
30
+ 'Д' => 'D',
31
+ 'Е' => 'E',
32
+ 'Ё' => 'YO',
33
+ 'Є' => 'YE',
34
+ 'Ж' => 'ZH',
35
+ 'З' => 'Z',
36
+ 'Ѕ' => 'Z',
37
+ 'И' => 'I',
38
+ 'Й' => 'J',
39
+ 'Ј' => 'J',
40
+ 'І' => 'I',
41
+ 'Ї' => 'YI',
42
+ 'К' => 'K',
43
+ 'Ќ' => 'K',
44
+ 'Л' => 'L',
45
+ 'Љ' => 'L',
46
+ 'М' => 'M',
47
+ 'Н' => 'N',
48
+ 'Њ' => 'N',
49
+ 'О' => 'O',
50
+ 'П' => 'P',
51
+ 'Р' => 'R',
52
+ 'С' => 'S',
53
+ 'Т' => 'T',
54
+ 'У' => 'U',
55
+ 'Ў' => 'U',
56
+ 'Ф' => 'F',
57
+ 'Х' => 'H',
58
+ 'Ц' => 'TS',
59
+ 'Ч' => 'CH',
60
+ 'Џ' => 'DH',
61
+ 'Ш' => 'SH',
62
+ 'Щ' => 'SHH',
63
+ 'Ъ' => '',
64
+ 'Ы' => 'Y',
65
+ 'Ь' => '',
66
+ 'Э' => 'E',
67
+ 'Ю' => 'YU',
68
+ 'Я' => 'YA',
69
+ 'а' => 'a',
70
+ 'б' => 'b',
71
+ 'в' => 'v',
72
+ 'г' => 'g',
73
+ 'ѓ' => 'g',
74
+ 'ґ' => 'g',
75
+ 'д' => 'd',
76
+ 'е' => 'e',
77
+ 'ё' => 'yo',
78
+ 'є' => 'ye',
79
+ 'ж' => 'zh',
80
+ 'з' => 'z',
81
+ 'ѕ' => 'z',
82
+ 'и' => 'i',
83
+ 'й' => 'j',
84
+ 'ј' => 'j',
85
+ 'і' => 'i',
86
+ 'ї' => 'yi',
87
+ 'к' => 'k',
88
+ 'ќ' => 'k',
89
+ 'л' => 'l',
90
+ 'љ' => 'l',
91
+ 'м' => 'm',
92
+ 'н' => 'n',
93
+ 'њ' => 'n',
94
+ 'о' => 'o',
95
+ 'п' => 'p',
96
+ 'р' => 'r',
97
+ 'с' => 's',
98
+ 'т' => 't',
99
+ 'у' => 'u',
100
+ 'ў' => 'u',
101
+ 'ф' => 'f',
102
+ 'х' => 'h',
103
+ 'ц' => 'ts',
104
+ 'ч' => 'ch',
105
+ 'џ' => 'dh',
106
+ 'ш' => 'sh',
107
+ 'щ' => 'shh',
108
+ 'ъ' => '',
109
+ 'ы' => 'y',
110
+ 'ь' => '',
111
+ 'э' => 'e',
112
+ 'ю' => 'yu',
113
+ 'я' => 'ya',
114
+ );
115
+ switch ( $locale ) {
116
+ case 'bg_BG':
117
+ $table['Щ'] = 'SHT';
118
+ $table['щ'] = 'sht';
119
+ $table['Ъ'] = 'A';
120
+ $table['ъ'] = 'a';
121
+ break;
122
+ case 'uk':
123
+ $table['И'] = 'Y';
124
+ $table['и'] = 'y';
125
+ break;
126
+ case 'ka_GE':
127
+ $table['ა'] = 'a';
128
+ $table['ბ'] = 'b';
129
+ $table['გ'] = 'g';
130
+ $table['დ'] = 'd';
131
+ $table['ე'] = 'e';
132
+ $table['ვ'] = 'v';
133
+ $table['ზ'] = 'z';
134
+ $table['თ'] = 'th';
135
+ $table['ი'] = 'i';
136
+ $table['კ'] = 'k';
137
+ $table['ლ'] = 'l';
138
+ $table['მ'] = 'm';
139
+ $table['ნ'] = 'n';
140
+ $table['ო'] = 'o';
141
+ $table['პ'] = 'p';
142
+ $table['ჟ'] = 'zh';
143
+ $table['რ'] = 'r';
144
+ $table['ს'] = 's';
145
+ $table['ტ'] = 't';
146
+ $table['უ'] = 'u';
147
+ $table['ფ'] = 'ph';
148
+ $table['ქ'] = 'q';
149
+ $table['ღ'] = 'gh';
150
+ $table['ყ'] = 'qh';
151
+ $table['შ'] = 'sh';
152
+ $table['ჩ'] = 'ch';
153
+ $table['ც'] = 'ts';
154
+ $table['ძ'] = 'dz';
155
+ $table['წ'] = 'ts';
156
+ $table['ჭ'] = 'tch';
157
+ $table['ხ'] = 'kh';
158
+ $table['ჯ'] = 'j';
159
+ $table['ჰ'] = 'h';
160
+ break;
161
+ default:
162
+ }
163
+
164
+ return $table;
165
+ }
166
+ }
includes/class-cyr-to-lat-main.php ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Main class of the plugin.
4
+ *
5
+ * @package cyr-to-lat
6
+ */
7
+
8
+ /**
9
+ * Class Cyr_To_Lat_Main
10
+ */
11
+ class Cyr_To_Lat_Main {
12
+
13
+ /**
14
+ * Plugin settings.
15
+ *
16
+ * @var Cyr_To_Lat_Settings
17
+ */
18
+ private $settings;
19
+
20
+ /**
21
+ * Cyr_To_Lat constructor.
22
+ */
23
+ public function __construct() {
24
+ $this->init();
25
+ $this->init_hooks();
26
+ }
27
+
28
+ /**
29
+ * Init class.
30
+ */
31
+ public function init() {
32
+ $this->settings = new Cyr_To_Lat_Settings();
33
+ }
34
+
35
+ /**
36
+ * Init class hooks.
37
+ */
38
+ public function init_hooks() {
39
+ add_filter( 'sanitize_title', array( $this, 'ctl_sanitize_title' ), 9, 3 );
40
+ add_filter( 'sanitize_file_name', array( $this, 'ctl_sanitize_title' ), 10, 2 );
41
+
42
+ add_filter( 'wp_insert_post_data', array( $this, 'ctl_sanitize_post_name' ), 10, 2 );
43
+
44
+ if ( 'yes' === $this->settings->get_option( 'convert_existing_slugs' ) ) {
45
+ $this->settings->set_option( 'convert_existing_slugs', 'no' );
46
+ add_action( 'shutdown', array( $this, 'convert_existing_slugs' ) );
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Sanitize title.
52
+ *
53
+ * @param string $title Sanitized title.
54
+ * @param string $raw_title The title prior to sanitization.
55
+ * @param string $context The context for which the title is being sanitized.
56
+ *
57
+ * @return string
58
+ */
59
+ public function ctl_sanitize_title( $title, $raw_title = '', $context = '' ) {
60
+ global $wpdb;
61
+
62
+ $pre = apply_filters( 'ctl_pre_sanitize_title', false, $title );
63
+
64
+ if ( false !== $pre ) {
65
+ return $pre;
66
+ }
67
+
68
+ // Locales list - https://make.wordpress.org/polyglots/teams/.
69
+ $locale = get_locale();
70
+ $iso9_table = $this->settings->get_option( $locale );
71
+ $iso9_table = ! empty( $iso9_table ) ? $iso9_table : Cyr_To_Lat_Conversion_Tables::get( $locale );
72
+
73
+ $is_term = false;
74
+ // phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_debug_backtrace
75
+ $backtrace = debug_backtrace();
76
+ // phpcs:enable
77
+ foreach ( $backtrace as $backtrace_entry ) {
78
+ if ( 'wp_insert_term' === $backtrace_entry['function'] ) {
79
+ $is_term = true;
80
+ break;
81
+ }
82
+ }
83
+
84
+ // phpcs:disable WordPress.DB.DirectDatabaseQuery
85
+ $term = $is_term ? $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE name = %s", $title ) ) : '';
86
+ // phpcs:enable
87
+
88
+ if ( ! empty( $term ) ) {
89
+ $title = $term;
90
+ } else {
91
+ $title = strtr( $title, apply_filters( 'ctl_table', $iso9_table ) );
92
+
93
+ if ( function_exists( 'iconv' ) ) {
94
+ $title = iconv( 'UTF-8', 'UTF-8//TRANSLIT//IGNORE', $title );
95
+ }
96
+
97
+ $title = preg_replace( "/[^A-Za-z0-9'_\-\.]/", '-', $title );
98
+ $title = preg_replace( '/\-+/', '-', $title );
99
+ $title = trim( $title, '-' );
100
+ }
101
+
102
+ return $title;
103
+ }
104
+
105
+ /**
106
+ * Convert Existing Slugs
107
+ */
108
+ public function convert_existing_slugs() {
109
+ global $wpdb;
110
+
111
+ // phpcs:disable WordPress.DB.DirectDatabaseQuery
112
+ $posts = $wpdb->get_results( "SELECT ID, post_name FROM $wpdb->posts WHERE post_name REGEXP('[^A-Za-z0-9\-]+') AND post_status IN ('publish', 'future', 'private')" );
113
+ // phpcs:enable
114
+
115
+ foreach ( (array) $posts as $post ) {
116
+ $sanitized_name = $this->ctl_sanitize_title( urldecode( $post->post_name ) );
117
+
118
+ if ( $post->post_name !== $sanitized_name ) {
119
+ add_post_meta( $post->ID, '_wp_old_slug', $post->post_name );
120
+ // phpcs:disable WordPress.DB.DirectDatabaseQuery
121
+ $wpdb->update( $wpdb->posts, array( 'post_name' => $sanitized_name ), array( 'ID' => $post->ID ) );
122
+ // phpcs:enable
123
+ }
124
+ }
125
+
126
+ // phpcs:disable WordPress.DB.DirectDatabaseQuery
127
+ $terms = $wpdb->get_results( "SELECT term_id, slug FROM $wpdb->terms WHERE slug REGEXP('[^A-Za-z0-9\-]+') " );
128
+ // phpcs:enable
129
+
130
+ foreach ( (array) $terms as $term ) {
131
+ $sanitized_slug = $this->ctl_sanitize_title( urldecode( $term->slug ) );
132
+
133
+ if ( $term->slug !== $sanitized_slug ) {
134
+ // phpcs:disable WordPress.DB.DirectDatabaseQuery
135
+ $wpdb->update( $wpdb->terms, array( 'slug' => $sanitized_slug ), array( 'term_id' => $term->term_id ) );
136
+ // phpcs:enable
137
+ }
138
+ }
139
+ }
140
+
141
+ /**
142
+ * Check if Classic Editor plugin is active.
143
+ *
144
+ * @link https://kagg.eu/how-to-catch-gutenberg/
145
+ *
146
+ * @return bool
147
+ */
148
+ private function ctl_is_classic_editor_plugin_active() {
149
+ if ( ! function_exists( 'is_plugin_active' ) ) {
150
+ include_once ABSPATH . 'wp-admin/includes/plugin.php';
151
+ }
152
+
153
+ if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) {
154
+ return true;
155
+ }
156
+
157
+ return false;
158
+ }
159
+
160
+ /**
161
+ * Check if Block Editor is active.
162
+ * Must only be used after plugins_loaded action is fired.
163
+ *
164
+ * @link https://kagg.eu/how-to-catch-gutenberg/
165
+ *
166
+ * @return bool
167
+ */
168
+ private function ctl_is_gutenberg_editor_active() {
169
+
170
+ // Gutenberg plugin is installed and activated.
171
+ $gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) );
172
+
173
+ // Block editor since 5.0.
174
+ $block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' );
175
+
176
+ if ( ! $gutenberg && ! $block_editor ) {
177
+ return false;
178
+ }
179
+
180
+ if ( $this->ctl_is_classic_editor_plugin_active() ) {
181
+ $editor_option = get_option( 'classic-editor-replace' );
182
+ $block_editor_active = array( 'no-replace', 'block' );
183
+
184
+ return in_array( $editor_option, $block_editor_active, true );
185
+ }
186
+
187
+ return true;
188
+ }
189
+
190
+ /**
191
+ * Gutenberg support
192
+ *
193
+ * @param array $data An array of slashed post data.
194
+ * @param array $postarr An array of sanitized, but otherwise unmodified post data.
195
+ *
196
+ * @return mixed
197
+ */
198
+ public function ctl_sanitize_post_name( $data, $postarr = array() ) {
199
+
200
+ if ( ! $this->ctl_is_gutenberg_editor_active() ) {
201
+ return $data;
202
+ }
203
+
204
+ if (
205
+ ! $data['post_name'] && $data['post_title'] &&
206
+ ! in_array( $data['post_status'], array( 'auto-draft', 'revision' ), true )
207
+ ) {
208
+ $data['post_name'] = sanitize_title( $data['post_title'] );
209
+ }
210
+
211
+ return $data;
212
+ }
213
+ }
214
+
215
+ // eof.
includes/class-cyr-to-lat-settings.php ADDED
@@ -0,0 +1,671 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Settings.
4
+ *
5
+ * @package cyr-to-lat
6
+ */
7
+
8
+ /**
9
+ * Class Cyr_To_Lat_Settings
10
+ *
11
+ * @class Cyr_To_Lat_Settings
12
+ */
13
+ class Cyr_To_Lat_Settings {
14
+
15
+ /**
16
+ * Admin screen id.
17
+ *
18
+ * @var string
19
+ */
20
+ const SCREEN_ID = 'toplevel_page_cyr-to-lat';
21
+
22
+ /**
23
+ * Option group.
24
+ *
25
+ * @var string
26
+ */
27
+ const OPTION_GROUP = 'cyr_to_lat_group';
28
+
29
+ /**
30
+ * Option page.
31
+ *
32
+ * @var string
33
+ */
34
+ const PAGE = 'cyr-to-lat';
35
+
36
+ /**
37
+ * Plugin options name.
38
+ *
39
+ * @var string
40
+ */
41
+ const OPTION_NAME = 'cyr_to_lat_settings';
42
+
43
+ /**
44
+ * Plugin options.
45
+ *
46
+ * @var array
47
+ */
48
+ private $options;
49
+
50
+ /**
51
+ * Form fields.
52
+ *
53
+ * @var array
54
+ */
55
+ public $form_fields;
56
+
57
+ /**
58
+ * Plugin options.
59
+ *
60
+ * @var array
61
+ */
62
+ public $settings;
63
+
64
+ /**
65
+ * Cyr_To_Lat_Settings constructor.
66
+ */
67
+ public function __construct() {
68
+ $this->load_plugin_textdomain();
69
+ $this->init_form_fields();
70
+ $this->init_settings();
71
+ $this->init_hooks();
72
+ }
73
+
74
+ /**
75
+ * Init class hooks.
76
+ */
77
+ public function init_hooks() {
78
+ add_filter(
79
+ 'plugin_action_links_' . plugin_basename( CYR_TO_LAT_FILE ),
80
+ array(
81
+ $this,
82
+ 'add_settings_link',
83
+ ),
84
+ 10,
85
+ 4
86
+ );
87
+
88
+ add_action( 'admin_menu', array( $this, 'add_settings_page' ) );
89
+ add_action( 'current_screen', array( $this, 'setup_sections' ) );
90
+ add_action( 'current_screen', array( $this, 'setup_fields' ) );
91
+
92
+ add_filter( 'pre_update_option_' . self::OPTION_NAME, array( $this, 'pre_update_option_filter' ), 10, 3 );
93
+
94
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
95
+ }
96
+
97
+ /**
98
+ * Add link to plugin setting page on plugins page.
99
+ *
100
+ * @param array $actions An array of plugin action links. By default this can include 'activate',
101
+ * 'deactivate', and 'delete'. With Multisite active this can also include
102
+ * 'network_active' and 'network_only' items.
103
+ * @param string $plugin_file Path to the plugin file relative to the plugins directory.
104
+ * @param array $plugin_data An array of plugin data. See `get_plugin_data()`.
105
+ * @param string $context The plugin context. By default this can include 'all', 'active', 'inactive',
106
+ * 'recently_activated', 'upgrade', 'mustuse', 'dropins', and 'search'.
107
+ *
108
+ * @return array|mixed Plugin links
109
+ */
110
+ public function add_settings_link( $actions, $plugin_file, $plugin_data, $context ) {
111
+ $ctl_actions = array(
112
+ 'settings' =>
113
+ '<a href="' . admin_url( 'options-general.php?page=' . self::PAGE ) .
114
+ '" aria-label="' . esc_attr__( 'View Cyr To Lat settings', 'cyr2lat' ) . '">' .
115
+ esc_html__( 'Settings', 'cyr2lat' ) . '</a>',
116
+ );
117
+
118
+ return array_merge( $ctl_actions, $actions );
119
+ }
120
+
121
+ /**
122
+ * Init options form fields.
123
+ */
124
+ public function init_form_fields() {
125
+ $this->form_fields = array(
126
+ 'convert_existing_slugs' => array(
127
+ 'label' => __( 'Convert Existing Slugs', 'cyr2lat' ),
128
+ 'section' => 'general_section',
129
+ 'type' => 'checkbox',
130
+ 'placeholder' => '',
131
+ 'helper' => '',
132
+ 'supplemental' => '',
133
+ ),
134
+ 'iso9' => array(
135
+ 'label' => __( 'ISO9 Table', 'cyr2lat' ),
136
+ 'section' => 'iso9_section',
137
+ 'type' => 'table',
138
+ 'placeholder' => '',
139
+ 'helper' => '',
140
+ 'supplemental' => '',
141
+ 'default' => Cyr_To_Lat_Conversion_Tables::get(),
142
+ ),
143
+ 'bg_BG' => array(
144
+ 'label' => __( 'bg_BG Table', 'cyr2lat' ),
145
+ 'section' => 'bg_BG_section',
146
+ 'type' => 'table',
147
+ 'placeholder' => '',
148
+ 'helper' => '',
149
+ 'supplemental' => '',
150
+ 'default' => Cyr_To_Lat_Conversion_Tables::get( 'bg_BG' ),
151
+ ),
152
+ 'uk' => array(
153
+ 'label' => __( 'uk Table', 'cyr2lat' ),
154
+ 'section' => 'uk_section',
155
+ 'type' => 'table',
156
+ 'placeholder' => '',
157
+ 'helper' => '',
158
+ 'supplemental' => '',
159
+ 'default' => Cyr_To_Lat_Conversion_Tables::get( 'uk' ),
160
+ ),
161
+ 'ka_GE' => array(
162
+ 'label' => __( 'ka_GE Table', 'cyr2lat' ),
163
+ 'section' => 'ka_GE_section',
164
+ 'type' => 'table',
165
+ 'placeholder' => '',
166
+ 'helper' => '',
167
+ 'supplemental' => '',
168
+ 'default' => Cyr_To_Lat_Conversion_Tables::get( 'ka_GE' ),
169
+ ),
170
+ );
171
+ }
172
+
173
+ /**
174
+ * Initialise Settings.
175
+ *
176
+ * Store all settings in a single database entry
177
+ * and make sure the $settings array is either the default
178
+ * or the settings stored in the database.
179
+ */
180
+ public function init_settings() {
181
+ $this->settings = get_option( self::OPTION_NAME, null );
182
+
183
+ // If there are no settings defined, use defaults.
184
+ if ( ! is_array( $this->settings ) ) {
185
+ $form_fields = $this->get_form_fields();
186
+ $this->settings = array_merge( array_fill_keys( array_keys( $form_fields ), '' ), wp_list_pluck( $form_fields, 'default' ) );
187
+ }
188
+ }
189
+
190
+ /**
191
+ * Get the form fields after they are initialized.
192
+ *
193
+ * @return array of options
194
+ */
195
+ public function get_form_fields() {
196
+ if ( empty( $this->form_fields ) ) {
197
+ $this->init_form_fields();
198
+ }
199
+
200
+ return array_map( array( $this, 'set_defaults' ), $this->form_fields );
201
+ }
202
+
203
+ /**
204
+ * Set default required properties for each field.
205
+ *
206
+ * @param array $field Settings field.
207
+ *
208
+ * @return array
209
+ */
210
+ protected function set_defaults( $field ) {
211
+ if ( ! isset( $field['default'] ) ) {
212
+ $field['default'] = '';
213
+ }
214
+
215
+ return $field;
216
+ }
217
+
218
+ /**
219
+ * Add settings page to the menu.
220
+ */
221
+ public function add_settings_page() {
222
+ $page_title = __( 'Cyr To Lat', 'cyr2lat' );
223
+ $menu_title = __( 'Cyr To Lat', 'cyr2lat' );
224
+ $capability = 'manage_options';
225
+ $slug = self::PAGE;
226
+ $callback = array( $this, 'ctl_settings_page' );
227
+ // phpcs:disable WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
228
+ $icon = 'data:image/svg+xml;base64,' . base64_encode( '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" x="0" y="0" width="512" height="512" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve"><polygon fill="#EEEEEE" points="246.2 411.2 267.9 479.7 273.9 473.1 273.9 473.1 331 411.2 "/><path fill="#EEEEEE" d="M449.7 99.8H269.4l49.8 157.2 24.9-58.5h35.5l75 176.3h-40.2l-16-39.2h-54.3l23.1 72.8 -0.2 0h0.1l-71.7 77.9h154.3c23.4 0 42.4-19 42.4-42.4V142.3C492.1 118.8 473.2 99.8 449.7 99.8z"/><polygon fill="#EEEEEE" points="338.1 301.6 384.6 301.6 361.4 244.8 "/><path fill="#EEEEEE" d="M219.7 24.7H49c-16.6 0-30 13.5-30 30v301.6c0 16.6 13.5 30 30 30h285.3L219.7 24.7zM230.3 302.3c-30.5-8.3-59-21.9-82.9-39.4 -23.8 17.5-52.4 31.1-82.9 39.4l-3.4 0.9L52.7 273.2l3.5-0.9c24.7-6.6 47.2-16.8 67-30.3 -19.6-19.6-34.2-42.5-42.4-66.6H58v-27.2h75.9v-23.6h27.2v23.6h75.9v27.2h-22.7c-8.2 24.1-22.8 47-42.4 66.6 19.8 13.5 42.3 23.6 67 30.3l3.5 0.9 -8.5 30L230.3 302.3zM114 175.4c7.4 17 18.6 32.7 33.4 47 14.8-14.2 26-30 33.4-47H114z"/></svg>' );
229
+ // phpcs:enable
230
+ $position = null;
231
+ add_menu_page( $page_title, $menu_title, $capability, $slug, $callback, $icon );
232
+ }
233
+
234
+ /**
235
+ * Settings page.
236
+ */
237
+ public function ctl_settings_page() {
238
+ if ( ! $this->is_ctl_options_screen() ) {
239
+ return;
240
+ }
241
+
242
+ ?>
243
+ <div class="wrap">
244
+ <h2 id="title">
245
+ <?php
246
+ // Admin panel title.
247
+ echo( esc_html( __( 'Cyr To Lat Plugin Options', 'cyr2lat' ) ) );
248
+ ?>
249
+ </h2>
250
+
251
+ <form id="ctl-options" action="<?php echo esc_url( admin_url( 'options.php' ) ); ?>" method="POST">
252
+ <?php
253
+ do_settings_sections( self::PAGE ); // Sections with options.
254
+ settings_fields( self::OPTION_GROUP ); // Hidden protection fields.
255
+ submit_button();
256
+ ?>
257
+ </form>
258
+
259
+ <div>
260
+ <h2 id="donate">
261
+ <?php echo esc_html( __( 'Donate', 'cyr2lat' ) ); ?>
262
+ </h2>
263
+ <p>
264
+ <?php echo esc_html( __( 'Would you like to support the advancement of this plugin?', 'cyr2lat' ) ); ?>
265
+ </p>
266
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
267
+ <input type="hidden" name="cmd" value="_s-xclick">
268
+ <input type="hidden" name="hosted_button_id" value="BENCPARA8S224">
269
+ <input
270
+ type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
271
+ name="submit" alt="PayPal - The safer, easier way to pay online!">
272
+ <img
273
+ alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1"
274
+ height="1">
275
+ </form>
276
+
277
+ <h2 id="appreciation">
278
+ <?php echo esc_html( __( 'Your appreciation', 'cyr2lat' ) ); ?>
279
+ </h2>
280
+ <a
281
+ target="_blank"
282
+ href="https://wordpress.org/support/view/plugin-reviews/cyr2lat?rate=5#postform">
283
+ <?php echo esc_html( __( 'Leave a ★★★★★ plugin review on WordPress.org', 'cyr2lat' ) ); ?>
284
+ </a>
285
+ </div>
286
+ </div>
287
+ <?php
288
+ }
289
+
290
+ /**
291
+ * Setup settings sections.
292
+ */
293
+ public function setup_sections() {
294
+ add_settings_section(
295
+ 'general_section',
296
+ __( 'General Options', 'cyr2lat' ),
297
+ array( $this, 'cyr_to_lat_section' ),
298
+ self::PAGE
299
+ );
300
+ add_settings_section(
301
+ 'iso9_section',
302
+ __( 'ISO9 Table', 'cyr2lat' ),
303
+ array( $this, 'cyr_to_lat_section' ),
304
+ self::PAGE
305
+ );
306
+ add_settings_section(
307
+ 'bg_BG_section',
308
+ __( 'bg_BG Table', 'cyr2lat' ),
309
+ array( $this, 'cyr_to_lat_section' ),
310
+ self::PAGE
311
+ );
312
+ add_settings_section(
313
+ 'uk_section',
314
+ __( 'uk Table', 'cyr2lat' ),
315
+ array( $this, 'cyr_to_lat_section' ),
316
+ self::PAGE
317
+ );
318
+ add_settings_section(
319
+ 'ka_GE_section',
320
+ __( 'ka_GE Table', 'cyr2lat' ),
321
+ array( $this, 'cyr_to_lat_section' ),
322
+ self::PAGE
323
+ );
324
+ }
325
+
326
+ /**
327
+ * Section callback.
328
+ *
329
+ * @param array $arguments Section arguments.
330
+ */
331
+ public function cyr_to_lat_section( $arguments ) {
332
+ }
333
+
334
+
335
+ /**
336
+ * Setup settings fields.
337
+ */
338
+ public function setup_fields() {
339
+ if ( ! $this->is_ctl_options_screen() ) {
340
+ return;
341
+ }
342
+
343
+ register_setting( self::OPTION_GROUP, self::OPTION_NAME );
344
+
345
+ // Get current settings.
346
+ $this->options = get_option( self::OPTION_NAME );
347
+
348
+ foreach ( $this->form_fields as $key => $field ) {
349
+ $field['field_id'] = $key;
350
+
351
+ add_settings_field(
352
+ $key,
353
+ $field['label'],
354
+ array( $this, 'field_callback' ),
355
+ self::PAGE,
356
+ $field['section'],
357
+ $field
358
+ );
359
+ }
360
+ }
361
+
362
+ /**
363
+ * Output settings field.
364
+ *
365
+ * @param array $arguments Field arguments.
366
+ */
367
+ public function field_callback( $arguments ) {
368
+ $value = $this->get_option( $arguments['field_id'] );
369
+
370
+ // Check which type of field we want.
371
+ switch ( $arguments['type'] ) {
372
+ case 'text':
373
+ case 'password':
374
+ case 'number':
375
+ printf(
376
+ '<input name="%1$s[%2$s]" id="%2$s" type="%3$s" placeholder="%4$s" value="%5$s" class="regular-text" />',
377
+ esc_html( self::OPTION_NAME ),
378
+ esc_attr( $arguments['field_id'] ),
379
+ esc_attr( $arguments['type'] ),
380
+ esc_attr( $arguments['placeholder'] ),
381
+ esc_html( $value )
382
+ );
383
+ break;
384
+ case 'textarea':
385
+ printf(
386
+ '<textarea name="%1$s[%2$s]" id="%2$s" placeholder="%3$s" rows="5" cols="50">%4$s</textarea>',
387
+ esc_html( self::OPTION_NAME ),
388
+ esc_attr( $arguments['field_id'] ),
389
+ esc_attr( $arguments['placeholder'] ),
390
+ wp_kses_post( $value )
391
+ );
392
+ break;
393
+ case 'checkbox':
394
+ case 'radio':
395
+ if ( 'checkbox' === $arguments['type'] ) {
396
+ $arguments['options'] = array( 'yes' => '' );
397
+ }
398
+
399
+ if ( ! empty( $arguments['options'] ) && is_array( $arguments['options'] ) ) {
400
+ $options_markup = '';
401
+ $iterator = 0;
402
+ foreach ( $arguments['options'] as $key => $label ) {
403
+ $iterator ++;
404
+ $options_markup .= sprintf(
405
+ '<label for="%2$s_%7$s"><input id="%2$s_%7$s" name="%1$s[%2$s]" type="%3$s" value="%4$s" %5$s /> %6$s</label><br/>',
406
+ esc_html( self::OPTION_NAME ),
407
+ $arguments['field_id'],
408
+ $arguments['type'],
409
+ $key,
410
+ checked( $value, $key, false ),
411
+ $label,
412
+ $iterator
413
+ );
414
+ }
415
+ printf(
416
+ '<fieldset>%s</fieldset>',
417
+ wp_kses(
418
+ $options_markup,
419
+ array(
420
+ 'label' => array(
421
+ 'for' => array(),
422
+ ),
423
+ 'input' => array(
424
+ 'id' => array(),
425
+ 'name' => array(),
426
+ 'type' => array(),
427
+ 'value' => array(),
428
+ 'checked' => array(),
429
+ ),
430
+ 'br' => array(),
431
+ )
432
+ )
433
+ );
434
+ }
435
+ break;
436
+ case 'select': // If it is a select dropdown.
437
+ if ( ! empty( $arguments['options'] ) && is_array( $arguments['options'] ) ) {
438
+ $options_markup = '';
439
+ foreach ( $arguments['options'] as $key => $label ) {
440
+ $options_markup .= sprintf(
441
+ '<option value="%s" %s>%s</option>',
442
+ $key,
443
+ selected( $value, $key, false ),
444
+ $label
445
+ );
446
+ }
447
+ printf(
448
+ '<select name="%1$s[%2$s]">%3$s</select>',
449
+ esc_html( self::OPTION_NAME ),
450
+ esc_html( $arguments['field_id'] ),
451
+ wp_kses(
452
+ $options_markup,
453
+ array(
454
+ 'option' => array(
455
+ 'value' => array(),
456
+ 'selected' => array(),
457
+ ),
458
+ )
459
+ )
460
+ );
461
+ }
462
+ break;
463
+ case 'multiple': // If it is a multiple select dropdown.
464
+ if ( ! empty( $arguments['options'] ) && is_array( $arguments['options'] ) ) {
465
+ $options_markup = '';
466
+ foreach ( $arguments['options'] as $key => $label ) {
467
+ $selected = '';
468
+ if ( is_array( $value ) ) {
469
+ if ( in_array( $key, $value, true ) ) {
470
+ $selected = selected( $key, $key, false );
471
+ }
472
+ }
473
+ $options_markup .= sprintf(
474
+ '<option value="%s" %s>%s</option>',
475
+ $key,
476
+ $selected,
477
+ $label
478
+ );
479
+ }
480
+ printf(
481
+ '<select multiple="multiple" name="%1$s[%2$s][]">%3$s</select>',
482
+ esc_html( self::OPTION_NAME ),
483
+ esc_html( $arguments['field_id'] ),
484
+ wp_kses(
485
+ $options_markup,
486
+ array(
487
+ 'option' => array(
488
+ 'value' => array(),
489
+ 'selected' => array(),
490
+ ),
491
+ )
492
+ )
493
+ );
494
+ }
495
+ break;
496
+ case 'table':
497
+ if ( is_array( $value ) ) {
498
+ $iterator = 0;
499
+ foreach ( $value as $key => $cell_value ) {
500
+ $id = $arguments['field_id'] . '-' . $iterator;
501
+
502
+ echo '<div class="ctl-table-cell">';
503
+ printf(
504
+ '<label for="%1$s">%2$s</label>',
505
+ esc_html( $id ),
506
+ esc_html( $key )
507
+ );
508
+ printf(
509
+ '<input name="%1$s[%2$s][%3$s]" id="%4$s" type="%5$s" placeholder="%6$s" value="%7$s" class="regular-text" />',
510
+ esc_html( self::OPTION_NAME ),
511
+ esc_attr( $arguments['field_id'] ),
512
+ esc_attr( $key ),
513
+ esc_attr( $id ),
514
+ 'text',
515
+ esc_attr( $arguments['placeholder'] ),
516
+ esc_html( $cell_value )
517
+ );
518
+ echo '</div>';
519
+
520
+ $iterator ++;
521
+ }
522
+ }
523
+ break;
524
+ default:
525
+ }
526
+
527
+ // If there is help text.
528
+ $helper = $arguments['helper'];
529
+ if ( $helper ) {
530
+ printf( '<span class="helper"> %s</span>', esc_html( $helper ) );
531
+ }
532
+
533
+ // If there is supplemental text.
534
+ $supplemental = $arguments['supplemental'];
535
+ if ( $supplemental ) {
536
+ printf( '<p class="description">%s</p>', esc_html( $supplemental ) );
537
+ }
538
+ }
539
+
540
+ /**
541
+ * Get plugin option.
542
+ *
543
+ * @param string $key Setting name.
544
+ * @param mixed $empty_value Empty value for this setting.
545
+ *
546
+ * @return string The value specified for the option or a default value for the option.
547
+ */
548
+ public function get_option( $key, $empty_value = null ) {
549
+ if ( empty( $this->settings ) ) {
550
+ $this->init_settings();
551
+ }
552
+
553
+ // Get option default if unset.
554
+ if ( ! isset( $this->settings[ $key ] ) ) {
555
+ $form_fields = $this->get_form_fields();
556
+ $this->settings[ $key ] = isset( $form_fields[ $key ] ) ? $this->get_field_default( $form_fields[ $key ] ) : '';
557
+ }
558
+
559
+ if ( ! is_null( $empty_value ) && '' === $this->settings[ $key ] ) {
560
+ $this->settings[ $key ] = $empty_value;
561
+ }
562
+
563
+ return $this->settings[ $key ];
564
+ }
565
+
566
+ /**
567
+ * Get a field default value. Defaults to '' if not set.
568
+ *
569
+ * @param array $field Setting field default value.
570
+ *
571
+ * @return string
572
+ */
573
+ protected function get_field_default( $field ) {
574
+ return empty( $field['default'] ) ? '' : $field['default'];
575
+ }
576
+
577
+ /**
578
+ * Set plugin option.
579
+ *
580
+ * @param string $key Setting name.
581
+ * @param mixed $value Setting value.
582
+ */
583
+ public function set_option( $key, $value ) {
584
+ if ( empty( $this->settings ) ) {
585
+ $this->init_settings();
586
+ }
587
+
588
+ $this->settings[ $key ] = $value;
589
+ update_option( self::OPTION_NAME, $this->settings );
590
+ }
591
+
592
+ /**
593
+ * Filter plugin option update.
594
+ *
595
+ * @param mixed $value New option value.
596
+ * @param mixed $old_value Old option value.
597
+ * @param string $option Option name.
598
+ *
599
+ * @return mixed
600
+ */
601
+ public function pre_update_option_filter( $value, $old_value, $option ) {
602
+ if ( $value === $old_value ) {
603
+ return $value;
604
+ }
605
+
606
+ $form_fields = $this->get_form_fields();
607
+ foreach ( $form_fields as $key => $form_field ) {
608
+ switch ( $form_field['type'] ) {
609
+ case 'checkbox':
610
+ $form_field_value = isset( $value[ $key ] ) ? $value[ $key ] : 'no';
611
+ $form_field_value = '1' === $form_field_value || 'yes' === $form_field_value ? 'yes' : 'no';
612
+ $value[ $key ] = $form_field_value;
613
+ break;
614
+ default:
615
+ }
616
+ }
617
+
618
+ return $value;
619
+ }
620
+
621
+ /**
622
+ * Enqueue class scripts.
623
+ */
624
+ public function admin_enqueue_scripts() {
625
+ if ( ! $this->is_ctl_options_screen() ) {
626
+ return;
627
+ }
628
+
629
+ wp_enqueue_script(
630
+ 'cyr-to-lat-settings',
631
+ CYR_TO_LAT_URL . '/dist/js/settings/app.js',
632
+ array(),
633
+ CYR_TO_LAT_VERSION,
634
+ true
635
+ );
636
+
637
+ wp_enqueue_style(
638
+ 'cyr-to-lat-admin',
639
+ CYR_TO_LAT_URL . '/css/cyr-to-lat-admin.css',
640
+ array(),
641
+ CYR_TO_LAT_VERSION
642
+ );
643
+ }
644
+
645
+ /**
646
+ * Load plugin text domain.
647
+ */
648
+ public function load_plugin_textdomain() {
649
+ if ( ! function_exists( 'wp_get_current_user' ) ) {
650
+ require_once ABSPATH . 'wp-includes/pluggable.php';
651
+ }
652
+ load_plugin_textdomain(
653
+ 'cyr2lat',
654
+ false,
655
+ dirname( plugin_basename( CYR_TO_LAT_FILE ) ) . '/languages/'
656
+ );
657
+ }
658
+
659
+ /**
660
+ * Is current admin screen the plugin options screen.
661
+ *
662
+ * @return bool
663
+ */
664
+ protected function is_ctl_options_screen() {
665
+ $current_screen = get_current_screen();
666
+
667
+ return $current_screen && ( 'options' === $current_screen->id || self::SCREEN_ID === $current_screen->id );
668
+ }
669
+ }
670
+
671
+ // eof.
languages/cyr2lat-ru_RU.mo ADDED
Binary file
languages/cyr2lat-ru_RU.po ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Cyr To Lat\n"
4
+ "POT-Creation-Date: 2019-01-31 19:21+0200\n"
5
+ "PO-Revision-Date: 2019-01-31 19:21+0200\n"
6
+ "Last-Translator: KAGG Design <info@kagg.eu>\n"
7
+ "Language-Team: KAGG Design\n"
8
+ "Language: ru_RU\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 2.2.1\n"
13
+ "X-Poedit-Basepath: ..\n"
14
+ "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
15
+ "%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"
16
+ "X-Poedit-KeywordsList: __;esc_html__;esc_attr__\n"
17
+ "X-Poedit-Flags-xgettext: --add-comments\n"
18
+ "X-Poedit-SearchPath-0: .\n"
19
+ "X-Poedit-SearchPath-1: src\n"
20
+ "X-Poedit-SearchPathExcluded-0: vendor\n"
21
+ "X-Poedit-SearchPathExcluded-1: dist\n"
22
+ "X-Poedit-SearchPathExcluded-2: src\n"
23
+
24
+ #: includes/class-cyr-to-lat-settings.php:114
25
+ msgid "View Cyr To Lat settings"
26
+ msgstr "Посмотреть настройки Cyr To Lat"
27
+
28
+ #: includes/class-cyr-to-lat-settings.php:115
29
+ msgid "Settings"
30
+ msgstr "Настройки"
31
+
32
+ #: includes/class-cyr-to-lat-settings.php:127
33
+ msgid "Convert Existing Slugs"
34
+ msgstr "Конвертировать существующие слаги"
35
+
36
+ #: includes/class-cyr-to-lat-settings.php:135
37
+ #: includes/class-cyr-to-lat-settings.php:302
38
+ msgid "ISO9 Table"
39
+ msgstr "Таблица ISO9"
40
+
41
+ #: includes/class-cyr-to-lat-settings.php:144
42
+ #: includes/class-cyr-to-lat-settings.php:308
43
+ msgid "bg_BG Table"
44
+ msgstr "Таблица bg_BG"
45
+
46
+ #: includes/class-cyr-to-lat-settings.php:153
47
+ #: includes/class-cyr-to-lat-settings.php:314
48
+ msgid "uk Table"
49
+ msgstr "Таблица uk"
50
+
51
+ #: includes/class-cyr-to-lat-settings.php:162
52
+ #: includes/class-cyr-to-lat-settings.php:320
53
+ msgid "ka_GE Table"
54
+ msgstr "Таблица ka_GE"
55
+
56
+ #: includes/class-cyr-to-lat-settings.php:222
57
+ #: includes/class-cyr-to-lat-settings.php:223
58
+ msgid "Cyr To Lat"
59
+ msgstr "Cyr To Lat"
60
+
61
+ #. Admin panel title.
62
+ #: includes/class-cyr-to-lat-settings.php:247
63
+ msgid "Cyr To Lat Plugin Options"
64
+ msgstr "Опции плагина Cyr To Lat"
65
+
66
+ #: includes/class-cyr-to-lat-settings.php:261
67
+ msgid "Donate"
68
+ msgstr "Пожертвовать"
69
+
70
+ #: includes/class-cyr-to-lat-settings.php:264
71
+ msgid "Would you like to support the advancement of this plugin?"
72
+ msgstr "Хотите поддержать развитие этого плагина?"
73
+
74
+ #: includes/class-cyr-to-lat-settings.php:278
75
+ msgid "Your appreciation"
76
+ msgstr "Ваша оценка"
77
+
78
+ #: includes/class-cyr-to-lat-settings.php:283
79
+ msgid "Leave a ★★★★★ plugin review on WordPress.org"
80
+ msgstr "Оставьте ★★★★★ обзор плагина на WordPress.org"
81
+
82
+ #: includes/class-cyr-to-lat-settings.php:296
83
+ msgid "General Options"
84
+ msgstr "Общие настройки"
languages/en_US.pot ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #, fuzzy
2
+ msgid ""
3
+ msgstr ""
4
+ "Project-Id-Version: Cyr To Lat\n"
5
+ "POT-Creation-Date: 2019-01-26 17:55+0200\n"
6
+ "PO-Revision-Date: 2019-01-25 19:18+0200\n"
7
+ "Last-Translator: KAGG Design <info@kagg.eu>\n"
8
+ "Language-Team: KAGG Design\n"
9
+ "Language: ru_RU\n"
10
+ "MIME-Version: 1.0\n"
11
+ "Content-Type: text/plain; charset=UTF-8\n"
12
+ "Content-Transfer-Encoding: 8bit\n"
13
+ "X-Generator: Poedit 2.2.1\n"
14
+ "X-Poedit-Basepath: ..\n"
15
+ "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
16
+ "%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"
17
+ "X-Poedit-KeywordsList: __;esc_html__;esc_attr__\n"
18
+ "X-Poedit-Flags-xgettext: --add-comments\n"
19
+ "X-Poedit-SearchPath-0: .\n"
20
+ "X-Poedit-SearchPath-1: src\n"
21
+ "X-Poedit-SearchPathExcluded-0: vendor\n"
22
+ "X-Poedit-SearchPathExcluded-1: dist\n"
23
+ "X-Poedit-SearchPathExcluded-2: src\n"
24
+
25
+ #: includes/class-ctl-settings.php:77
26
+ msgid "View Cyr To Lat settings"
27
+ msgstr ""
28
+
29
+ #: includes/class-ctl-settings.php:78
30
+ msgid "Settings"
31
+ msgstr ""
32
+
33
+ #: includes/class-ctl-settings.php:90
34
+ msgid "Convert Existing Slugs"
35
+ msgstr ""
36
+
37
+ #: includes/class-ctl-settings.php:98 includes/class-ctl-settings.php:264
38
+ msgid "ISO9 Table"
39
+ msgstr ""
40
+
41
+ #: includes/class-ctl-settings.php:107 includes/class-ctl-settings.php:270
42
+ msgid "bg_BG Table"
43
+ msgstr ""
44
+
45
+ #: includes/class-ctl-settings.php:116 includes/class-ctl-settings.php:276
46
+ msgid "uk Table"
47
+ msgstr ""
48
+
49
+ #: includes/class-ctl-settings.php:125 includes/class-ctl-settings.php:282
50
+ msgid "ka_GE Table"
51
+ msgstr ""
52
+
53
+ #: includes/class-ctl-settings.php:185 includes/class-ctl-settings.php:186
54
+ msgid "Cyr To Lat"
55
+ msgstr ""
56
+
57
+ #. Admin panel title.
58
+ #: includes/class-ctl-settings.php:208
59
+ msgid "Cyr To Lat Plugin Options"
60
+ msgstr ""
61
+
62
+ #: includes/class-ctl-settings.php:222
63
+ msgid "Donate"
64
+ msgstr ""
65
+
66
+ #: includes/class-ctl-settings.php:225
67
+ msgid "Would you like to support the advancement of this plugin?"
68
+ msgstr ""
69
+
70
+ #. @todo Change to Sergey's account
71
+ #: includes/class-ctl-settings.php:240
72
+ msgid "Your appreciation"
73
+ msgstr ""
74
+
75
+ #: includes/class-ctl-settings.php:245
76
+ msgid "Leave a ★★★★★ plugin review on WordPress.org"
77
+ msgstr ""
78
+
79
+ #: includes/class-ctl-settings.php:258
80
+ msgid "General Options"
81
+ msgstr ""
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Cyr-To-Lat ===
2
- Contributors: SergeyBiryukov, mihdan, karevn, webvitaly, kagg-design
3
  Tags: cyrillic, georgian, latin, l10n, russian, rustolat, slugs, translations, transliteration
4
  Requires at least: 2.3
5
  Tested up to: 5.1
6
- Stable tag: 3.4
7
 
8
  Converts Cyrillic characters in post, page and term slugs to Latin characters.
9
 
@@ -15,7 +15,7 @@ Converts Cyrillic characters in post, page and term slugs to Latin characters. U
15
  * Automatically converts existing post, page and term slugs on activation
16
  * Saves existing post and page permalinks integrity
17
  * Performs transliteration of attachment file names
18
- * Includes Russian, Belarusian, Ukrainian, Bulgarian and Macedonian characters
19
  * Transliteration table can be customized without editing the plugin by itself
20
 
21
  Based on the original Rus-To-Lat plugin by Anton Skorobogatov.
@@ -41,6 +41,19 @@ add_filter('ctl_table', 'my_cyr_to_lat_table');
41
 
42
  == Changelog ==
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  = 3.4 (21.01.2019) =
45
  * Tested up to WP 5.1
46
  * Code formatting to follow WPCS.
@@ -66,7 +79,7 @@ add_filter('ctl_table', 'my_cyr_to_lat_table');
66
  * Added saving of existing post and page permalinks integrity
67
  * Added transliteration of attachment file names
68
  * Adjusted transliteration table in accordance with ISO 9 standard
69
- * Included Russian, Belarusian, Ukrainian, Bulgarian and Macedonian characters
70
  * Added filter for the transliteration table
71
 
72
  = 2.1 =
1
  === Cyr-To-Lat ===
2
+ Contributors: SergeyBiryukov, mihdan, karevn, webvitaly, kaggdesign
3
  Tags: cyrillic, georgian, latin, l10n, russian, rustolat, slugs, translations, transliteration
4
  Requires at least: 2.3
5
  Tested up to: 5.1
6
+ Stable tag: 3.6.1
7
 
8
  Converts Cyrillic characters in post, page and term slugs to Latin characters.
9
 
15
  * Automatically converts existing post, page and term slugs on activation
16
  * Saves existing post and page permalinks integrity
17
  * Performs transliteration of attachment file names
18
+ * Includes Russian, Belarusian, Ukrainian, Bulgarian and Georgian characters
19
  * Transliteration table can be customized without editing the plugin by itself
20
 
21
  Based on the original Rus-To-Lat plugin by Anton Skorobogatov.
41
 
42
  == Changelog ==
43
 
44
+ = 3.6.1 (31.01.2019) =
45
+ * Text domain corrected.
46
+
47
+ = 3.6 (31.01.2019) =
48
+ * Plugin settings page added.
49
+ * Settings page allows user to edit conversion tables online.
50
+ * Code converted to OOP.
51
+ * Code refactored to conform WordPress Coding Standards.
52
+ * JS developed according to ECMA-6 script standards.
53
+ * Settings page also works if JS is switched off in the browser.
54
+ * Composer and yarn added.
55
+ * Assets (banner, icon, admin icon) are added.
56
+
57
  = 3.4 (21.01.2019) =
58
  * Tested up to WP 5.1
59
  * Code formatting to follow WPCS.
79
  * Added saving of existing post and page permalinks integrity
80
  * Added transliteration of attachment file names
81
  * Adjusted transliteration table in accordance with ISO 9 standard
82
+ * Included Russian, Ukrainian, Bulgarian and Georgian characters
83
  * Added filter for the transliteration table
84
 
85
  = 2.1 =
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 ComposerAutoloaderInitb7c5f930ec4fa1c83689fac301fc90e8::getLoader();
vendor/autoload_52.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_52.php generated by xrstf/composer-php52
4
+
5
+ require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
+
7
+ return ComposerAutoloaderInite5b4a5882d35277bc301bb8546f05b78::getLoader();
vendor/composer/ClassLoader.php ADDED
@@ -0,0 +1,445 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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, PSR-4 and classmap class loader.
17
+ *
18
+ * $loader = new \Composer\Autoload\ClassLoader();
19
+ *
20
+ * // register classes with namespaces
21
+ * $loader->add('Symfony\Component', __DIR__.'/component');
22
+ * $loader->add('Symfony', __DIR__.'/framework');
23
+ *
24
+ * // activate the autoloader
25
+ * $loader->register();
26
+ *
27
+ * // to enable searching the include path (eg. for PEAR packages)
28
+ * $loader->setUseIncludePath(true);
29
+ *
30
+ * In this example, if you try to use a class in the Symfony\Component
31
+ * namespace or one of its children (Symfony\Component\Console for instance),
32
+ * the autoloader will first look for the class under the component/
33
+ * directory, and it will then fallback to the framework/ directory if not
34
+ * found before giving up.
35
+ *
36
+ * This class is loosely based on the Symfony UniversalClassLoader.
37
+ *
38
+ * @author Fabien Potencier <fabien@symfony.com>
39
+ * @author Jordi Boggiano <j.boggiano@seld.be>
40
+ * @see http://www.php-fig.org/psr/psr-0/
41
+ * @see http://www.php-fig.org/psr/psr-4/
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
+ private $classMapAuthoritative = false;
57
+ private $missingClasses = array();
58
+ private $apcuPrefix;
59
+
60
+ public function getPrefixes()
61
+ {
62
+ if (!empty($this->prefixesPsr0)) {
63
+ return call_user_func_array('array_merge', $this->prefixesPsr0);
64
+ }
65
+
66
+ return array();
67
+ }
68
+
69
+ public function getPrefixesPsr4()
70
+ {
71
+ return $this->prefixDirsPsr4;
72
+ }
73
+
74
+ public function getFallbackDirs()
75
+ {
76
+ return $this->fallbackDirsPsr0;
77
+ }
78
+
79
+ public function getFallbackDirsPsr4()
80
+ {
81
+ return $this->fallbackDirsPsr4;
82
+ }
83
+
84
+ public function getClassMap()
85
+ {
86
+ return $this->classMap;
87
+ }
88
+
89
+ /**
90
+ * @param array $classMap Class to filename map
91
+ */
92
+ public function addClassMap(array $classMap)
93
+ {
94
+ if ($this->classMap) {
95
+ $this->classMap = array_merge($this->classMap, $classMap);
96
+ } else {
97
+ $this->classMap = $classMap;
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Registers a set of PSR-0 directories for a given prefix, either
103
+ * appending or prepending to the ones previously set for this prefix.
104
+ *
105
+ * @param string $prefix The prefix
106
+ * @param array|string $paths The PSR-0 root directories
107
+ * @param bool $prepend Whether to prepend the directories
108
+ */
109
+ public function add($prefix, $paths, $prepend = false)
110
+ {
111
+ if (!$prefix) {
112
+ if ($prepend) {
113
+ $this->fallbackDirsPsr0 = array_merge(
114
+ (array) $paths,
115
+ $this->fallbackDirsPsr0
116
+ );
117
+ } else {
118
+ $this->fallbackDirsPsr0 = array_merge(
119
+ $this->fallbackDirsPsr0,
120
+ (array) $paths
121
+ );
122
+ }
123
+
124
+ return;
125
+ }
126
+
127
+ $first = $prefix[0];
128
+ if (!isset($this->prefixesPsr0[$first][$prefix])) {
129
+ $this->prefixesPsr0[$first][$prefix] = (array) $paths;
130
+
131
+ return;
132
+ }
133
+ if ($prepend) {
134
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
135
+ (array) $paths,
136
+ $this->prefixesPsr0[$first][$prefix]
137
+ );
138
+ } else {
139
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
140
+ $this->prefixesPsr0[$first][$prefix],
141
+ (array) $paths
142
+ );
143
+ }
144
+ }
145
+
146
+ /**
147
+ * Registers a set of PSR-4 directories for a given namespace, either
148
+ * appending or prepending to the ones previously set for this namespace.
149
+ *
150
+ * @param string $prefix The prefix/namespace, with trailing '\\'
151
+ * @param array|string $paths The PSR-4 base directories
152
+ * @param bool $prepend Whether to prepend the directories
153
+ *
154
+ * @throws \InvalidArgumentException
155
+ */
156
+ public function addPsr4($prefix, $paths, $prepend = false)
157
+ {
158
+ if (!$prefix) {
159
+ // Register directories for the root namespace.
160
+ if ($prepend) {
161
+ $this->fallbackDirsPsr4 = array_merge(
162
+ (array) $paths,
163
+ $this->fallbackDirsPsr4
164
+ );
165
+ } else {
166
+ $this->fallbackDirsPsr4 = array_merge(
167
+ $this->fallbackDirsPsr4,
168
+ (array) $paths
169
+ );
170
+ }
171
+ } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
172
+ // Register directories for a new namespace.
173
+ $length = strlen($prefix);
174
+ if ('\\' !== $prefix[$length - 1]) {
175
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
176
+ }
177
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
178
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
179
+ } elseif ($prepend) {
180
+ // Prepend directories for an already registered namespace.
181
+ $this->prefixDirsPsr4[$prefix] = array_merge(
182
+ (array) $paths,
183
+ $this->prefixDirsPsr4[$prefix]
184
+ );
185
+ } else {
186
+ // Append directories for an already registered namespace.
187
+ $this->prefixDirsPsr4[$prefix] = array_merge(
188
+ $this->prefixDirsPsr4[$prefix],
189
+ (array) $paths
190
+ );
191
+ }
192
+ }
193
+
194
+ /**
195
+ * Registers a set of PSR-0 directories for a given prefix,
196
+ * replacing any others previously set for this prefix.
197
+ *
198
+ * @param string $prefix The prefix
199
+ * @param array|string $paths The PSR-0 base directories
200
+ */
201
+ public function set($prefix, $paths)
202
+ {
203
+ if (!$prefix) {
204
+ $this->fallbackDirsPsr0 = (array) $paths;
205
+ } else {
206
+ $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
207
+ }
208
+ }
209
+
210
+ /**
211
+ * Registers a set of PSR-4 directories for a given namespace,
212
+ * replacing any others previously set for this namespace.
213
+ *
214
+ * @param string $prefix The prefix/namespace, with trailing '\\'
215
+ * @param array|string $paths The PSR-4 base directories
216
+ *
217
+ * @throws \InvalidArgumentException
218
+ */
219
+ public function setPsr4($prefix, $paths)
220
+ {
221
+ if (!$prefix) {
222
+ $this->fallbackDirsPsr4 = (array) $paths;
223
+ } else {
224
+ $length = strlen($prefix);
225
+ if ('\\' !== $prefix[$length - 1]) {
226
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
227
+ }
228
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
229
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
230
+ }
231
+ }
232
+
233
+ /**
234
+ * Turns on searching the include path for class files.
235
+ *
236
+ * @param bool $useIncludePath
237
+ */
238
+ public function setUseIncludePath($useIncludePath)
239
+ {
240
+ $this->useIncludePath = $useIncludePath;
241
+ }
242
+
243
+ /**
244
+ * Can be used to check if the autoloader uses the include path to check
245
+ * for classes.
246
+ *
247
+ * @return bool
248
+ */
249
+ public function getUseIncludePath()
250
+ {
251
+ return $this->useIncludePath;
252
+ }
253
+
254
+ /**
255
+ * Turns off searching the prefix and fallback directories for classes
256
+ * that have not been registered with the class map.
257
+ *
258
+ * @param bool $classMapAuthoritative
259
+ */
260
+ public function setClassMapAuthoritative($classMapAuthoritative)
261
+ {
262
+ $this->classMapAuthoritative = $classMapAuthoritative;
263
+ }
264
+
265
+ /**
266
+ * Should class lookup fail if not found in the current class map?
267
+ *
268
+ * @return bool
269
+ */
270
+ public function isClassMapAuthoritative()
271
+ {
272
+ return $this->classMapAuthoritative;
273
+ }
274
+
275
+ /**
276
+ * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
277
+ *
278
+ * @param string|null $apcuPrefix
279
+ */
280
+ public function setApcuPrefix($apcuPrefix)
281
+ {
282
+ $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
283
+ }
284
+
285
+ /**
286
+ * The APCu prefix in use, or null if APCu caching is not enabled.
287
+ *
288
+ * @return string|null
289
+ */
290
+ public function getApcuPrefix()
291
+ {
292
+ return $this->apcuPrefix;
293
+ }
294
+
295
+ /**
296
+ * Registers this instance as an autoloader.
297
+ *
298
+ * @param bool $prepend Whether to prepend the autoloader or not
299
+ */
300
+ public function register($prepend = false)
301
+ {
302
+ spl_autoload_register(array($this, 'loadClass'), true, $prepend);
303
+ }
304
+
305
+ /**
306
+ * Unregisters this instance as an autoloader.
307
+ */
308
+ public function unregister()
309
+ {
310
+ spl_autoload_unregister(array($this, 'loadClass'));
311
+ }
312
+
313
+ /**
314
+ * Loads the given class or interface.
315
+ *
316
+ * @param string $class The name of the class
317
+ * @return bool|null True if loaded, null otherwise
318
+ */
319
+ public function loadClass($class)
320
+ {
321
+ if ($file = $this->findFile($class)) {
322
+ includeFile($file);
323
+
324
+ return true;
325
+ }
326
+ }
327
+
328
+ /**
329
+ * Finds the path to the file where the class is defined.
330
+ *
331
+ * @param string $class The name of the class
332
+ *
333
+ * @return string|false The path if found, false otherwise
334
+ */
335
+ public function findFile($class)
336
+ {
337
+ // class map lookup
338
+ if (isset($this->classMap[$class])) {
339
+ return $this->classMap[$class];
340
+ }
341
+ if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
342
+ return false;
343
+ }
344
+ if (null !== $this->apcuPrefix) {
345
+ $file = apcu_fetch($this->apcuPrefix.$class, $hit);
346
+ if ($hit) {
347
+ return $file;
348
+ }
349
+ }
350
+
351
+ $file = $this->findFileWithExtension($class, '.php');
352
+
353
+ // Search for Hack files if we are running on HHVM
354
+ if (false === $file && defined('HHVM_VERSION')) {
355
+ $file = $this->findFileWithExtension($class, '.hh');
356
+ }
357
+
358
+ if (null !== $this->apcuPrefix) {
359
+ apcu_add($this->apcuPrefix.$class, $file);
360
+ }
361
+
362
+ if (false === $file) {
363
+ // Remember that this class does not exist.
364
+ $this->missingClasses[$class] = true;
365
+ }
366
+
367
+ return $file;
368
+ }
369
+
370
+ private function findFileWithExtension($class, $ext)
371
+ {
372
+ // PSR-4 lookup
373
+ $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
374
+
375
+ $first = $class[0];
376
+ if (isset($this->prefixLengthsPsr4[$first])) {
377
+ $subPath = $class;
378
+ while (false !== $lastPos = strrpos($subPath, '\\')) {
379
+ $subPath = substr($subPath, 0, $lastPos);
380
+ $search = $subPath . '\\';
381
+ if (isset($this->prefixDirsPsr4[$search])) {
382
+ $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
383
+ foreach ($this->prefixDirsPsr4[$search] as $dir) {
384
+ if (file_exists($file = $dir . $pathEnd)) {
385
+ return $file;
386
+ }
387
+ }
388
+ }
389
+ }
390
+ }
391
+
392
+ // PSR-4 fallback dirs
393
+ foreach ($this->fallbackDirsPsr4 as $dir) {
394
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
395
+ return $file;
396
+ }
397
+ }
398
+
399
+ // PSR-0 lookup
400
+ if (false !== $pos = strrpos($class, '\\')) {
401
+ // namespaced class name
402
+ $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
403
+ . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
404
+ } else {
405
+ // PEAR-like class name
406
+ $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
407
+ }
408
+
409
+ if (isset($this->prefixesPsr0[$first])) {
410
+ foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
411
+ if (0 === strpos($class, $prefix)) {
412
+ foreach ($dirs as $dir) {
413
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
414
+ return $file;
415
+ }
416
+ }
417
+ }
418
+ }
419
+ }
420
+
421
+ // PSR-0 fallback dirs
422
+ foreach ($this->fallbackDirsPsr0 as $dir) {
423
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
424
+ return $file;
425
+ }
426
+ }
427
+
428
+ // PSR-0 include paths.
429
+ if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
430
+ return $file;
431
+ }
432
+
433
+ return false;
434
+ }
435
+ }
436
+
437
+ /**
438
+ * Scope isolated include.
439
+ *
440
+ * Prevents access to $this/self from included files.
441
+ */
442
+ function includeFile($file)
443
+ {
444
+ include $file;
445
+ }
vendor/composer/ClassLoader52.php ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013, Christoph Mewes, http://www.xrstf.de
4
+ *
5
+ * This file is released under the terms of the MIT license. You can find the
6
+ * complete text in the attached LICENSE file or online at:
7
+ *
8
+ * http://www.opensource.org/licenses/mit-license.php
9
+ *
10
+ * --------------------------------------------------------------------------
11
+ *
12
+ * 99% of this is copied as-is from the original Composer source code and is
13
+ * released under MIT license as well. Copyright goes to:
14
+ *
15
+ * - Fabien Potencier <fabien@symfony.com>
16
+ * - Jordi Boggiano <j.boggiano@seld.be>
17
+ */
18
+
19
+ class xrstf_Composer52_ClassLoader {
20
+ private $prefixes = array();
21
+ private $fallbackDirs = array();
22
+ private $useIncludePath = false;
23
+ private $classMap = array();
24
+ private $classMapAuthoratative = false;
25
+ private $allowUnderscore = false;
26
+
27
+ /**
28
+ * @param boolean $flag true to allow class names with a leading underscore, false to disable
29
+ */
30
+ public function setAllowUnderscore($flag) {
31
+ $this->allowUnderscore = (boolean) $flag;
32
+ }
33
+
34
+ /**
35
+ * @return array
36
+ */
37
+ public function getPrefixes() {
38
+ return $this->prefixes;
39
+ }
40
+
41
+ /**
42
+ * Turns off searching the prefix and fallback directories for classes
43
+ * that have not been registered with the class map.
44
+ *
45
+ * @param bool $classMapAuthoratative
46
+ */
47
+ public function setClassMapAuthoritative($classMapAuthoratative) {
48
+ $this->classMapAuthoratative = $classMapAuthoratative;
49
+ }
50
+
51
+ /**
52
+ * Should class lookup fail if not found in the current class map?
53
+ *
54
+ * @return bool
55
+ */
56
+ public function getClassMapAuthoratative() {
57
+ return $this->classMapAuthoratative;
58
+ }
59
+
60
+ /**
61
+ * @return array
62
+ */
63
+ public function getFallbackDirs() {
64
+ return $this->fallbackDirs;
65
+ }
66
+
67
+ /**
68
+ * @return array
69
+ */
70
+ public function getClassMap() {
71
+ return $this->classMap;
72
+ }
73
+
74
+ /**
75
+ * @param array $classMap class to filename map
76
+ */
77
+ public function addClassMap(array $classMap) {
78
+ if ($this->classMap) {
79
+ $this->classMap = array_merge($this->classMap, $classMap);
80
+ }
81
+ else {
82
+ $this->classMap = $classMap;
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Registers a set of classes, merging with any others previously set.
88
+ *
89
+ * @param string $prefix the classes prefix
90
+ * @param array|string $paths the location(s) of the classes
91
+ * @param bool $prepend prepend the location(s)
92
+ */
93
+ public function add($prefix, $paths, $prepend = false) {
94
+ if (!$prefix) {
95
+ if ($prepend) {
96
+ $this->fallbackDirs = array_merge(
97
+ (array) $paths,
98
+ $this->fallbackDirs
99
+ );
100
+ }
101
+ else {
102
+ $this->fallbackDirs = array_merge(
103
+ $this->fallbackDirs,
104
+ (array) $paths
105
+ );
106
+ }
107
+
108
+ return;
109
+ }
110
+
111
+ if (!isset($this->prefixes[$prefix])) {
112
+ $this->prefixes[$prefix] = (array) $paths;
113
+ return;
114
+ }
115
+
116
+ if ($prepend) {
117
+ $this->prefixes[$prefix] = array_merge(
118
+ (array) $paths,
119
+ $this->prefixes[$prefix]
120
+ );
121
+ }
122
+ else {
123
+ $this->prefixes[$prefix] = array_merge(
124
+ $this->prefixes[$prefix],
125
+ (array) $paths
126
+ );
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Registers a set of classes, replacing any others previously set.
132
+ *
133
+ * @param string $prefix the classes prefix
134
+ * @param array|string $paths the location(s) of the classes
135
+ */
136
+ public function set($prefix, $paths) {
137
+ if (!$prefix) {
138
+ $this->fallbackDirs = (array) $paths;
139
+ return;
140
+ }
141
+
142
+ $this->prefixes[$prefix] = (array) $paths;
143
+ }
144
+
145
+ /**
146
+ * Turns on searching the include path for class files.
147
+ *
148
+ * @param bool $useIncludePath
149
+ */
150
+ public function setUseIncludePath($useIncludePath) {
151
+ $this->useIncludePath = $useIncludePath;
152
+ }
153
+
154
+ /**
155
+ * Can be used to check if the autoloader uses the include path to check
156
+ * for classes.
157
+ *
158
+ * @return bool
159
+ */
160
+ public function getUseIncludePath() {
161
+ return $this->useIncludePath;
162
+ }
163
+
164
+ /**
165
+ * Registers this instance as an autoloader.
166
+ */
167
+ public function register() {
168
+ spl_autoload_register(array($this, 'loadClass'), true);
169
+ }
170
+
171
+ /**
172
+ * Unregisters this instance as an autoloader.
173
+ */
174
+ public function unregister() {
175
+ spl_autoload_unregister(array($this, 'loadClass'));
176
+ }
177
+
178
+ /**
179
+ * Loads the given class or interface.
180
+ *
181
+ * @param string $class the name of the class
182
+ * @return bool|null true, if loaded
183
+ */
184
+ public function loadClass($class) {
185
+ if ($file = $this->findFile($class)) {
186
+ include $file;
187
+ return true;
188
+ }
189
+ }
190
+
191
+ /**
192
+ * Finds the path to the file where the class is defined.
193
+ *
194
+ * @param string $class the name of the class
195
+ * @return string|null the path, if found
196
+ */
197
+ public function findFile($class) {
198
+ if ('\\' === $class[0]) {
199
+ $class = substr($class, 1);
200
+ }
201
+
202
+ if (isset($this->classMap[$class])) {
203
+ return $this->classMap[$class];
204
+ }
205
+ elseif ($this->classMapAuthoratative) {
206
+ return false;
207
+ }
208
+
209
+ $classPath = $this->getClassPath($class);
210
+
211
+ foreach ($this->prefixes as $prefix => $dirs) {
212
+ if (0 === strpos($class, $prefix)) {
213
+ foreach ($dirs as $dir) {
214
+ if (file_exists($dir.DIRECTORY_SEPARATOR.$classPath)) {
215
+ return $dir.DIRECTORY_SEPARATOR.$classPath;
216
+ }
217
+ }
218
+ }
219
+ }
220
+
221
+ foreach ($this->fallbackDirs as $dir) {
222
+ if (file_exists($dir.DIRECTORY_SEPARATOR.$classPath)) {
223
+ return $dir.DIRECTORY_SEPARATOR.$classPath;
224
+ }
225
+ }
226
+
227
+ if ($this->useIncludePath && $file = self::resolveIncludePath($classPath)) {
228
+ return $file;
229
+ }
230
+
231
+ return $this->classMap[$class] = false;
232
+ }
233
+
234
+ private function getClassPath($class) {
235
+ if (false !== $pos = strrpos($class, '\\')) {
236
+ // namespaced class name
237
+ $classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)).DIRECTORY_SEPARATOR;
238
+ $className = substr($class, $pos + 1);
239
+ }
240
+ else {
241
+ // PEAR-like class name
242
+ $classPath = null;
243
+ $className = $class;
244
+ }
245
+
246
+ $className = str_replace('_', DIRECTORY_SEPARATOR, $className);
247
+
248
+ // restore the prefix
249
+ if ($this->allowUnderscore && DIRECTORY_SEPARATOR === $className[0]) {
250
+ $className[0] = '_';
251
+ }
252
+
253
+ $classPath .= $className.'.php';
254
+
255
+ return $classPath;
256
+ }
257
+
258
+ public static function resolveIncludePath($classPath) {
259
+ $paths = explode(PATH_SEPARATOR, get_include_path());
260
+
261
+ foreach ($paths as $path) {
262
+ $path = rtrim($path, '/\\');
263
+
264
+ if ($file = file_exists($path.DIRECTORY_SEPARATOR.$file)) {
265
+ return $file;
266
+ }
267
+ }
268
+
269
+ return false;
270
+ }
271
+ }
vendor/composer/LICENSE ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2
+ Upstream-Name: Composer
3
+ Upstream-Contact: Jordi Boggiano <j.boggiano@seld.be>
4
+ Source: https://github.com/composer/composer
5
+
6
+ Files: *
7
+ Copyright: 2016, Nils Adermann <naderman@naderman.de>
8
+ 2016, Jordi Boggiano <j.boggiano@seld.be>
9
+ License: Expat
10
+
11
+ Files: src/Composer/Util/TlsHelper.php
12
+ Copyright: 2016, Nils Adermann <naderman@naderman.de>
13
+ 2016, Jordi Boggiano <j.boggiano@seld.be>
14
+ 2013, Evan Coury <me@evancoury.com>
15
+ License: Expat and BSD-2-Clause
16
+
17
+ License: BSD-2-Clause
18
+ Redistribution and use in source and binary forms, with or without modification,
19
+ are permitted provided that the following conditions are met:
20
+ .
21
+ * Redistributions of source code must retain the above copyright notice,
22
+ this list of conditions and the following disclaimer.
23
+ .
24
+ * Redistributions in binary form must reproduce the above copyright notice,
25
+ this list of conditions and the following disclaimer in the documentation
26
+ and/or other materials provided with the distribution.
27
+ .
28
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
29
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
30
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
32
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
33
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
34
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
35
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
+
39
+ License: Expat
40
+ Permission is hereby granted, free of charge, to any person obtaining a copy
41
+ of this software and associated documentation files (the "Software"), to deal
42
+ in the Software without restriction, including without limitation the rights
43
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
44
+ copies of the Software, and to permit persons to whom the Software is furnished
45
+ to do so, subject to the following conditions:
46
+ .
47
+ The above copyright notice and this permission notice shall be included in all
48
+ copies or substantial portions of the Software.
49
+ .
50
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
51
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
52
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
53
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
54
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
55
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
56
+ THE SOFTWARE.
vendor/composer/autoload_classmap.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_classmap.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ 'Cyr_To_Lat_Conversion_Tables' => $baseDir . '/includes/class-cyr-to-lat-conversion-tables.php',
10
+ 'Cyr_To_Lat_Main' => $baseDir . '/includes/class-cyr-to-lat-main.php',
11
+ 'Cyr_To_Lat_Settings' => $baseDir . '/includes/class-cyr-to-lat-settings.php',
12
+ );
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($vendorDir);
7
+
8
+ return array(
9
+ 'xrstf\\Composer52' => array($vendorDir . '/xrstf/composer-php52/lib'),
10
+ );
vendor/composer/autoload_psr4.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_psr4.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ 'Composer\\Installers\\' => array($vendorDir . '/composer/installers/src/Composer/Installers'),
10
+ );
vendor/composer/autoload_real.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_real.php @generated by Composer
4
+
5
+ class ComposerAutoloaderInitb7c5f930ec4fa1c83689fac301fc90e8
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('ComposerAutoloaderInitb7c5f930ec4fa1c83689fac301fc90e8', 'loadClassLoader'), true, true);
23
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInitb7c5f930ec4fa1c83689fac301fc90e8', 'loadClassLoader'));
25
+
26
+ $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
+ if ($useStaticLoader) {
28
+ require_once __DIR__ . '/autoload_static.php';
29
+
30
+ call_user_func(\Composer\Autoload\ComposerStaticInitb7c5f930ec4fa1c83689fac301fc90e8::getInitializer($loader));
31
+ } else {
32
+ $map = require __DIR__ . '/autoload_namespaces.php';
33
+ foreach ($map as $namespace => $path) {
34
+ $loader->set($namespace, $path);
35
+ }
36
+
37
+ $map = require __DIR__ . '/autoload_psr4.php';
38
+ foreach ($map as $namespace => $path) {
39
+ $loader->setPsr4($namespace, $path);
40
+ }
41
+
42
+ $classMap = require __DIR__ . '/autoload_classmap.php';
43
+ if ($classMap) {
44
+ $loader->addClassMap($classMap);
45
+ }
46
+ }
47
+
48
+ $loader->register(true);
49
+
50
+ return $loader;
51
+ }
52
+ }
vendor/composer/autoload_real_52.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_real_52.php generated by xrstf/composer-php52
4
+
5
+ class ComposerAutoloaderInite5b4a5882d35277bc301bb8546f05b78 {
6
+ private static $loader;
7
+
8
+ public static function loadClassLoader($class) {
9
+ if ('xrstf_Composer52_ClassLoader' === $class) {
10
+ require dirname(__FILE__).'/ClassLoader52.php';
11
+ }
12
+ }
13
+
14
+ /**
15
+ * @return xrstf_Composer52_ClassLoader
16
+ */
17
+ public static function getLoader() {
18
+ if (null !== self::$loader) {
19
+ return self::$loader;
20
+ }
21
+
22
+ spl_autoload_register(array('ComposerAutoloaderInite5b4a5882d35277bc301bb8546f05b78', 'loadClassLoader'), true /*, true */);
23
+ self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInite5b4a5882d35277bc301bb8546f05b78', 'loadClassLoader'));
25
+
26
+ $vendorDir = dirname(dirname(__FILE__));
27
+ $baseDir = dirname($vendorDir);
28
+ $dir = dirname(__FILE__);
29
+
30
+ $map = require $dir.'/autoload_namespaces.php';
31
+ foreach ($map as $namespace => $path) {
32
+ $loader->add($namespace, $path);
33
+ }
34
+
35
+ $classMap = require $dir.'/autoload_classmap.php';
36
+ if ($classMap) {
37
+ $loader->addClassMap($classMap);
38
+ }
39
+
40
+ $loader->register(true);
41
+
42
+ return $loader;
43
+ }
44
+ }
vendor/composer/autoload_static.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_static.php @generated by Composer
4
+
5
+ namespace Composer\Autoload;
6
+
7
+ class ComposerStaticInitb7c5f930ec4fa1c83689fac301fc90e8
8
+ {
9
+ public static $prefixLengthsPsr4 = array (
10
+ 'C' =>
11
+ array (
12
+ 'Composer\\Installers\\' => 20,
13
+ ),
14
+ );
15
+
16
+ public static $prefixDirsPsr4 = array (
17
+ 'Composer\\Installers\\' =>
18
+ array (
19
+ 0 => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers',
20
+ ),
21
+ );
22
+
23
+ public static $prefixesPsr0 = array (
24
+ 'x' =>
25
+ array (
26
+ 'xrstf\\Composer52' =>
27
+ array (
28
+ 0 => __DIR__ . '/..' . '/xrstf/composer-php52/lib',
29
+ ),
30
+ ),
31
+ );
32
+
33
+ public static $classMap = array (
34
+ 'Cyr_To_Lat_Conversion_Tables' => __DIR__ . '/../..' . '/includes/class-cyr-to-lat-conversion-tables.php',
35
+ 'Cyr_To_Lat_Main' => __DIR__ . '/../..' . '/includes/class-cyr-to-lat-main.php',
36
+ 'Cyr_To_Lat_Settings' => __DIR__ . '/../..' . '/includes/class-cyr-to-lat-settings.php',
37
+ );
38
+
39
+ public static function getInitializer(ClassLoader $loader)
40
+ {
41
+ return \Closure::bind(function () use ($loader) {
42
+ $loader->prefixLengthsPsr4 = ComposerStaticInitb7c5f930ec4fa1c83689fac301fc90e8::$prefixLengthsPsr4;
43
+ $loader->prefixDirsPsr4 = ComposerStaticInitb7c5f930ec4fa1c83689fac301fc90e8::$prefixDirsPsr4;
44
+ $loader->prefixesPsr0 = ComposerStaticInitb7c5f930ec4fa1c83689fac301fc90e8::$prefixesPsr0;
45
+ $loader->classMap = ComposerStaticInitb7c5f930ec4fa1c83689fac301fc90e8::$classMap;
46
+
47
+ }, null, ClassLoader::class);
48
+ }
49
+ }
vendor/composer/installed.json ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "name": "composer/installers",
4
+ "version": "v1.6.0",
5
+ "version_normalized": "1.6.0.0",
6
+ "source": {
7
+ "type": "git",
8
+ "url": "https://github.com/composer/installers.git",
9
+ "reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b"
10
+ },
11
+ "dist": {
12
+ "type": "zip",
13
+ "url": "https://api.github.com/repos/composer/installers/zipball/cfcca6b1b60bc4974324efb5783c13dca6932b5b",
14
+ "reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b",
15
+ "shasum": ""
16
+ },
17
+ "require": {
18
+ "composer-plugin-api": "^1.0"
19
+ },
20
+ "replace": {
21
+ "roundcube/plugin-installer": "*",
22
+ "shama/baton": "*"
23
+ },
24
+ "require-dev": {
25
+ "composer/composer": "1.0.*@dev",
26
+ "phpunit/phpunit": "^4.8.36"
27
+ },
28
+ "time": "2018-08-27T06:10:37+00:00",
29
+ "type": "composer-plugin",
30
+ "extra": {
31
+ "class": "Composer\\Installers\\Plugin",
32
+ "branch-alias": {
33
+ "dev-master": "1.0-dev"
34
+ }
35
+ },
36
+ "installation-source": "dist",
37
+ "autoload": {
38
+ "psr-4": {
39
+ "Composer\\Installers\\": "src/Composer/Installers"
40
+ }
41
+ },
42
+ "notification-url": "https://packagist.org/downloads/",
43
+ "license": [
44
+ "MIT"
45
+ ],
46
+ "authors": [
47
+ {
48
+ "name": "Kyle Robinson Young",
49
+ "email": "kyle@dontkry.com",
50
+ "homepage": "https://github.com/shama"
51
+ }
52
+ ],
53
+ "description": "A multi-framework Composer library installer",
54
+ "homepage": "https://composer.github.io/installers/",
55
+ "keywords": [
56
+ "Craft",
57
+ "Dolibarr",
58
+ "Eliasis",
59
+ "Hurad",
60
+ "ImageCMS",
61
+ "Kanboard",
62
+ "Lan Management System",
63
+ "MODX Evo",
64
+ "Mautic",
65
+ "Maya",
66
+ "OXID",
67
+ "Plentymarkets",
68
+ "Porto",
69
+ "RadPHP",
70
+ "SMF",
71
+ "Thelia",
72
+ "WolfCMS",
73
+ "agl",
74
+ "aimeos",
75
+ "annotatecms",
76
+ "attogram",
77
+ "bitrix",
78
+ "cakephp",
79
+ "chef",
80
+ "cockpit",
81
+ "codeigniter",
82
+ "concrete5",
83
+ "croogo",
84
+ "dokuwiki",
85
+ "drupal",
86
+ "eZ Platform",
87
+ "elgg",
88
+ "expressionengine",
89
+ "fuelphp",
90
+ "grav",
91
+ "installer",
92
+ "itop",
93
+ "joomla",
94
+ "kohana",
95
+ "laravel",
96
+ "lavalite",
97
+ "lithium",
98
+ "magento",
99
+ "majima",
100
+ "mako",
101
+ "mediawiki",
102
+ "modulework",
103
+ "modx",
104
+ "moodle",
105
+ "osclass",
106
+ "phpbb",
107
+ "piwik",
108
+ "ppi",
109
+ "puppet",
110
+ "pxcms",
111
+ "reindex",
112
+ "roundcube",
113
+ "shopware",
114
+ "silverstripe",
115
+ "sydes",
116
+ "symfony",
117
+ "typo3",
118
+ "wordpress",
119
+ "yawik",
120
+ "zend",
121
+ "zikula"
122
+ ]
123
+ },
124
+ {
125
+ "name": "xrstf/composer-php52",
126
+ "version": "v1.0.20",
127
+ "version_normalized": "1.0.20.0",
128
+ "source": {
129
+ "type": "git",
130
+ "url": "https://github.com/composer-php52/composer-php52.git",
131
+ "reference": "bd41459d5e27df8d33057842b32377c39e97a5a8"
132
+ },
133
+ "dist": {
134
+ "type": "zip",
135
+ "url": "https://api.github.com/repos/composer-php52/composer-php52/zipball/bd41459d5e27df8d33057842b32377c39e97a5a8",
136
+ "reference": "bd41459d5e27df8d33057842b32377c39e97a5a8",
137
+ "shasum": ""
138
+ },
139
+ "time": "2016-04-16T21:52:24+00:00",
140
+ "type": "library",
141
+ "extra": {
142
+ "branch-alias": {
143
+ "dev-default": "1.x-dev"
144
+ }
145
+ },
146
+ "installation-source": "dist",
147
+ "autoload": {
148
+ "psr-0": {
149
+ "xrstf\\Composer52": "lib/"
150
+ }
151
+ },
152
+ "notification-url": "https://packagist.org/downloads/",
153
+ "license": [
154
+ "MIT"
155
+ ]
156
+ }
157
+ ]
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.
vendor/composer/installers/composer.json ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "composer/installers",
3
+ "type": "composer-plugin",
4
+ "license": "MIT",
5
+ "description": "A multi-framework Composer library installer",
6
+ "keywords": [
7
+ "installer",
8
+ "Aimeos",
9
+ "AGL",
10
+ "AnnotateCms",
11
+ "Attogram",
12
+ "Bitrix",
13
+ "CakePHP",
14
+ "Chef",
15
+ "Cockpit",
16
+ "CodeIgniter",
17
+ "concrete5",
18
+ "Craft",
19
+ "Croogo",
20
+ "DokuWiki",
21
+ "Dolibarr",
22
+ "Drupal",
23
+ "Elgg",
24
+ "Eliasis",
25
+ "ExpressionEngine",
26
+ "eZ Platform",
27
+ "FuelPHP",
28
+ "Grav",
29
+ "Hurad",
30
+ "ImageCMS",
31
+ "iTop",
32
+ "Joomla",
33
+ "Kanboard",
34
+ "Kohana",
35
+ "Lan Management System",
36
+ "Laravel",
37
+ "Lavalite",
38
+ "Lithium",
39
+ "Magento",
40
+ "majima",
41
+ "Mako",
42
+ "Mautic",
43
+ "Maya",
44
+ "MODX",
45
+ "MODX Evo",
46
+ "MediaWiki",
47
+ "OXID",
48
+ "osclass",
49
+ "MODULEWork",
50
+ "Moodle",
51
+ "Piwik",
52
+ "pxcms",
53
+ "phpBB",
54
+ "Plentymarkets",
55
+ "PPI",
56
+ "Puppet",
57
+ "Porto",
58
+ "RadPHP",
59
+ "ReIndex",
60
+ "Roundcube",
61
+ "shopware",
62
+ "SilverStripe",
63
+ "SMF",
64
+ "SyDES",
65
+ "symfony",
66
+ "Thelia",
67
+ "TYPO3",
68
+ "WolfCMS",
69
+ "WordPress",
70
+ "YAWIK",
71
+ "Zend",
72
+ "Zikula"
73
+ ],
74
+ "homepage": "https://composer.github.io/installers/",
75
+ "authors": [
76
+ {
77
+ "name": "Kyle Robinson Young",
78
+ "email": "kyle@dontkry.com",
79
+ "homepage": "https://github.com/shama"
80
+ }
81
+ ],
82
+ "autoload": {
83
+ "psr-4": { "Composer\\Installers\\": "src/Composer/Installers" }
84
+ },
85
+ "extra": {
86
+ "class": "Composer\\Installers\\Plugin",
87
+ "branch-alias": {
88
+ "dev-master": "1.0-dev"
89
+ }
90
+ },
91
+ "replace": {
92
+ "shama/baton": "*",
93
+ "roundcube/plugin-installer": "*"
94
+ },
95
+ "require": {
96
+ "composer-plugin-api": "^1.0"
97
+ },
98
+ "require-dev": {
99
+ "composer/composer": "1.0.*@dev",
100
+ "phpunit/phpunit": "^4.8.36"
101
+ },
102
+ "scripts": {
103
+ "test": "phpunit"
104
+ }
105
+ }
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
+ }
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
+ }
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
+ }
vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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'] = preg_replace('/-module$/', '', $vars['name']);
35
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
36
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
37
+
38
+ return $vars;
39
+ }
40
+
41
+ protected function inflectThemeVars($vars)
42
+ {
43
+ $vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
44
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
45
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
46
+
47
+ return $vars;
48
+ }
49
+ }
vendor/composer/installers/src/Composer/Installers/AttogramInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class AttogramInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'modules/{$name}/',
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/BaseInstaller.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ use Composer\IO\IOInterface;
5
+ use Composer\Composer;
6
+ use Composer\Package\PackageInterface;
7
+
8
+ abstract class BaseInstaller
9
+ {
10
+ protected $locations = array();
11
+ protected $composer;
12
+ protected $package;
13
+ protected $io;
14
+
15
+ /**
16
+ * Initializes base installer.
17
+ *
18
+ * @param PackageInterface $package
19
+ * @param Composer $composer
20
+ * @param IOInterface $io
21
+ */
22
+ public function __construct(PackageInterface $package = null, Composer $composer = null, IOInterface $io = null)
23
+ {
24
+ $this->composer = $composer;
25
+ $this->package = $package;
26
+ $this->io = $io;
27
+ }
28
+
29
+ /**
30
+ * Return the install path based on package type.
31
+ *
32
+ * @param PackageInterface $package
33
+ * @param string $frameworkType
34
+ * @return string
35
+ */
36
+ public function getInstallPath(PackageInterface $package, $frameworkType = '')
37
+ {
38
+ $type = $this->package->getType();
39
+
40
+ $prettyName = $this->package->getPrettyName();
41
+ if (strpos($prettyName, '/') !== false) {
42
+ list($vendor, $name) = explode('/', $prettyName);
43
+ } else {
44
+ $vendor = '';
45
+ $name = $prettyName;
46
+ }
47
+
48
+ $availableVars = $this->inflectPackageVars(compact('name', 'vendor', 'type'));
49
+
50
+ $extra = $package->getExtra();
51
+ if (!empty($extra['installer-name'])) {
52
+ $availableVars['name'] = $extra['installer-name'];
53
+ }
54
+
55
+ if ($this->composer->getPackage()) {
56
+ $extra = $this->composer->getPackage()->getExtra();
57
+ if (!empty($extra['installer-paths'])) {
58
+ $customPath = $this->mapCustomInstallPaths($extra['installer-paths'], $prettyName, $type, $vendor);
59
+ if ($customPath !== false) {
60
+ return $this->templatePath($customPath, $availableVars);
61
+ }
62
+ }
63
+ }
64
+
65
+ $packageType = substr($type, strlen($frameworkType) + 1);
66
+ $locations = $this->getLocations();
67
+ if (!isset($locations[$packageType])) {
68
+ throw new \InvalidArgumentException(sprintf('Package type "%s" is not supported', $type));
69
+ }
70
+
71
+ return $this->templatePath($locations[$packageType], $availableVars);
72
+ }
73
+
74
+ /**
75
+ * For an installer to override to modify the vars per installer.
76
+ *
77
+ * @param array $vars
78
+ * @return array
79
+ */
80
+ public function inflectPackageVars($vars)
81
+ {
82
+ return $vars;
83
+ }
84
+
85
+ /**
86
+ * Gets the installer's locations
87
+ *
88
+ * @return array
89
+ */
90
+ public function getLocations()
91
+ {
92
+ return $this->locations;
93
+ }
94
+
95
+ /**
96
+ * Replace vars in a path
97
+ *
98
+ * @param string $path
99
+ * @param array $vars
100
+ * @return string
101
+ */
102
+ protected function templatePath($path, array $vars = array())
103
+ {
104
+ if (strpos($path, '{') !== false) {
105
+ extract($vars);
106
+ preg_match_all('@\{\$([A-Za-z0-9_]*)\}@i', $path, $matches);
107
+ if (!empty($matches[1])) {
108
+ foreach ($matches[1] as $var) {
109
+ $path = str_replace('{$' . $var . '}', $$var, $path);
110
+ }
111
+ }
112
+ }
113
+
114
+ return $path;
115
+ }
116
+
117
+ /**
118
+ * Search through a passed paths array for a custom install path.
119
+ *
120
+ * @param array $paths
121
+ * @param string $name
122
+ * @param string $type
123
+ * @param string $vendor = NULL
124
+ * @return string
125
+ */
126
+ protected function mapCustomInstallPaths(array $paths, $name, $type, $vendor = NULL)
127
+ {
128
+ foreach ($paths as $path => $names) {
129
+ if (in_array($name, $names) || in_array('type:' . $type, $names) || in_array('vendor:' . $vendor, $names)) {
130
+ return $path;
131
+ }
132
+ }
133
+
134
+ return false;
135
+ }
136
+ }
vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Composer\Installers;
4
+
5
+ use Composer\Util\Filesystem;
6
+
7
+ /**
8
+ * Installer for Bitrix Framework. Supported types of extensions:
9
+ * - `bitrix-d7-module` — copy the module to directory `bitrix/modules/<vendor>.<name>`.
10
+ * - `bitrix-d7-component` — copy the component to directory `bitrix/components/<vendor>/<name>`.
11
+ * - `bitrix-d7-template` — copy the template to directory `bitrix/templates/<vendor>_<name>`.
12
+ *
13
+ * You can set custom path to directory with Bitrix kernel in `composer.json`:
14
+ *
15
+ * ```json
16
+ * {
17
+ * "extra": {
18
+ * "bitrix-dir": "s1/bitrix"
19
+ * }
20
+ * }
21
+ * ```
22
+ *
23
+ * @author Nik Samokhvalov <nik@samokhvalov.info>
24
+ * @author Denis Kulichkin <onexhovia@gmail.com>
25
+ */
26
+ class BitrixInstaller extends BaseInstaller
27
+ {
28
+ protected $locations = array(
29
+ 'module' => '{$bitrix_dir}/modules/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
30
+ 'component' => '{$bitrix_dir}/components/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
31
+ 'theme' => '{$bitrix_dir}/templates/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
32
+ 'd7-module' => '{$bitrix_dir}/modules/{$vendor}.{$name}/',
33
+ 'd7-component' => '{$bitrix_dir}/components/{$vendor}/{$name}/',
34
+ 'd7-template' => '{$bitrix_dir}/templates/{$vendor}_{$name}/',
35
+ );
36
+
37
+ /**
38
+ * @var array Storage for informations about duplicates at all the time of installation packages.
39
+ */
40
+ private static $checkedDuplicates = array();
41
+
42
+ /**
43
+ * {@inheritdoc}
44
+ */
45
+ public function inflectPackageVars($vars)
46
+ {
47
+ if ($this->composer->getPackage()) {
48
+ $extra = $this->composer->getPackage()->getExtra();
49
+
50
+ if (isset($extra['bitrix-dir'])) {
51
+ $vars['bitrix_dir'] = $extra['bitrix-dir'];
52
+ }
53
+ }
54
+
55
+ if (!isset($vars['bitrix_dir'])) {
56
+ $vars['bitrix_dir'] = 'bitrix';
57
+ }
58
+
59
+ return parent::inflectPackageVars($vars);
60
+ }
61
+
62
+ /**
63
+ * {@inheritdoc}
64
+ */
65
+ protected function templatePath($path, array $vars = array())
66
+ {
67
+ $templatePath = parent::templatePath($path, $vars);
68
+ $this->checkDuplicates($templatePath, $vars);
69
+
70
+ return $templatePath;
71
+ }
72
+
73
+ /**
74
+ * Duplicates search packages.
75
+ *
76
+ * @param string $path
77
+ * @param array $vars
78
+ */
79
+ protected function checkDuplicates($path, array $vars = array())
80
+ {
81
+ $packageType = substr($vars['type'], strlen('bitrix') + 1);
82
+ $localDir = explode('/', $vars['bitrix_dir']);
83
+ array_pop($localDir);
84
+ $localDir[] = 'local';
85
+ $localDir = implode('/', $localDir);
86
+
87
+ $oldPath = str_replace(
88
+ array('{$bitrix_dir}', '{$name}'),
89
+ array($localDir, $vars['name']),
90
+ $this->locations[$packageType]
91
+ );
92
+
93
+ if (in_array($oldPath, static::$checkedDuplicates)) {
94
+ return;
95
+ }
96
+
97
+ if ($oldPath !== $path && file_exists($oldPath) && $this->io && $this->io->isInteractive()) {
98
+
99
+ $this->io->writeError(' <error>Duplication of packages:</error>');
100
+ $this->io->writeError(' <info>Package ' . $oldPath . ' will be called instead package ' . $path . '</info>');
101
+
102
+ while (true) {
103
+ switch ($this->io->ask(' <info>Delete ' . $oldPath . ' [y,n,?]?</info> ', '?')) {
104
+ case 'y':
105
+ $fs = new Filesystem();
106
+ $fs->removeDirectory($oldPath);
107
+ break 2;
108
+
109
+ case 'n':
110
+ break 2;
111
+
112
+ case '?':
113
+ default:
114
+ $this->io->writeError(array(
115
+ ' y - delete package ' . $oldPath . ' and to continue with the installation',
116
+ ' n - don\'t delete and to continue with the installation',
117
+ ));
118
+ $this->io->writeError(' ? - print help');
119
+ break;
120
+ }
121
+ }
122
+ }
123
+
124
+ static::$checkedDuplicates[] = $oldPath;
125
+ }
126
+ }
vendor/composer/installers/src/Composer/Installers/BonefishInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class BonefishInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'package' => 'Packages/{$vendor}/{$name}/'
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ use Composer\DependencyResolver\Pool;
5
+
6
+ class CakePHPInstaller extends BaseInstaller
7
+ {
8
+ protected $locations = array(
9
+ 'plugin' => 'Plugin/{$name}/',
10
+ );
11
+
12
+ /**
13
+ * Format package name to CamelCase
14
+ */
15
+ public function inflectPackageVars($vars)
16
+ {
17
+ if ($this->matchesCakeVersion('>=', '3.0.0')) {
18
+ return $vars;
19
+ }
20
+
21
+ $nameParts = explode('/', $vars['name']);
22
+ foreach ($nameParts as &$value) {
23
+ $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
24
+ $value = str_replace(array('-', '_'), ' ', $value);
25
+ $value = str_replace(' ', '', ucwords($value));
26
+ }
27
+ $vars['name'] = implode('/', $nameParts);
28
+
29
+ return $vars;
30
+ }
31
+
32
+ /**
33
+ * Change the default plugin location when cakephp >= 3.0
34
+ */
35
+ public function getLocations()
36
+ {
37
+ if ($this->matchesCakeVersion('>=', '3.0.0')) {
38
+ $this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/';
39
+ }
40
+ return $this->locations;
41
+ }
42
+
43
+ /**
44
+ * Check if CakePHP version matches against a version
45
+ *
46
+ * @param string $matcher
47
+ * @param string $version
48
+ * @return bool
49
+ */
50
+ protected function matchesCakeVersion($matcher, $version)
51
+ {
52
+ if (class_exists('Composer\Semver\Constraint\MultiConstraint')) {
53
+ $multiClass = 'Composer\Semver\Constraint\MultiConstraint';
54
+ $constraintClass = 'Composer\Semver\Constraint\Constraint';
55
+ } else {
56
+ $multiClass = 'Composer\Package\LinkConstraint\MultiConstraint';
57
+ $constraintClass = 'Composer\Package\LinkConstraint\VersionConstraint';
58
+ }
59
+
60
+ $repositoryManager = $this->composer->getRepositoryManager();
61
+ if ($repositoryManager) {
62
+ $repos = $repositoryManager->getLocalRepository();
63
+ if (!$repos) {
64
+ return false;
65
+ }
66
+ $cake3 = new $multiClass(array(
67
+ new $constraintClass($matcher, $version),
68
+ new $constraintClass('!=', '9999999-dev'),
69
+ ));
70
+ $pool = new Pool('dev');
71
+ $pool->addRepository($repos);
72
+ $packages = $pool->whatProvides('cakephp/cakephp');
73
+ foreach ($packages as $package) {
74
+ $installed = new $constraintClass('=', $package->getVersion());
75
+ if ($cake3->matches($installed)) {
76
+ return true;
77
+ }
78
+ }
79
+ }
80
+ return false;
81
+ }
82
+ }
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
+
vendor/composer/installers/src/Composer/Installers/CiviCrmInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class CiviCrmInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'ext' => 'ext/{$name}/'
8
+ );
9
+ }
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
+ }
vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class CockpitInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'cockpit/modules/addons/{$name}/',
8
+ );
9
+
10
+ /**
11
+ * Format module name.
12
+ *
13
+ * Strip `module-` prefix from package name.
14
+ *
15
+ * @param array @vars
16
+ *
17
+ * @return array
18
+ */
19
+ public function inflectPackageVars($vars)
20
+ {
21
+ if ($vars['type'] == 'cockpit-module') {
22
+ return $this->inflectModuleVars($vars);
23
+ }
24
+
25
+ return $vars;
26
+ }
27
+
28
+ public function inflectModuleVars($vars)
29
+ {
30
+ $vars['name'] = ucfirst(preg_replace('/cockpit-/i', '', $vars['name']));
31
+
32
+ return $vars;
33
+ }
34
+ }
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
+ }
vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class Concrete5Installer extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'core' => 'concrete/',
8
+ 'block' => 'application/blocks/{$name}/',
9
+ 'package' => 'packages/{$name}/',
10
+ 'theme' => 'application/themes/{$name}/',
11
+ 'update' => 'updates/{$name}/',
12
+ );
13
+ }
vendor/composer/installers/src/Composer/Installers/CraftInstaller.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * Installer for Craft Plugins
6
+ */
7
+ class CraftInstaller extends BaseInstaller
8
+ {
9
+ const NAME_PREFIX = 'craft';
10
+ const NAME_SUFFIX = 'plugin';
11
+
12
+ protected $locations = array(
13
+ 'plugin' => 'craft/plugins/{$name}/',
14
+ );
15
+
16
+ /**
17
+ * Strip `craft-` prefix and/or `-plugin` suffix from package names
18
+ *
19
+ * @param array $vars
20
+ *
21
+ * @return array
22
+ */
23
+ final public function inflectPackageVars($vars)
24
+ {
25
+ return $this->inflectPluginVars($vars);
26
+ }
27
+
28
+ private function inflectPluginVars($vars)
29
+ {
30
+ $vars['name'] = preg_replace('/-' . self::NAME_SUFFIX . '$/i', '', $vars['name']);
31
+ $vars['name'] = preg_replace('/^' . self::NAME_PREFIX . '-/i', '', $vars['name']);
32
+
33
+ return $vars;
34
+ }
35
+ }
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
+ }
vendor/composer/installers/src/Composer/Installers/DecibelInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class DecibelInstaller extends BaseInstaller
5
+ {
6
+ /** @var array */
7
+ protected $locations = array(
8
+ 'app' => 'app/{$name}/',
9
+ );
10
+ }
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
+ }
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
+ }
vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ 'custom-theme' => 'themes/custom/{$name}/',
14
+ 'custom-module' => 'modules/custom/{$name}/',
15
+ );
16
+ }
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
+ }
vendor/composer/installers/src/Composer/Installers/EliasisInstaller.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class EliasisInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'component' => 'components/{$name}/',
8
+ 'module' => 'modules/{$name}/',
9
+ 'plugin' => 'plugins/{$name}/',
10
+ 'template' => 'templates/{$name}/',
11
+ );
12
+ }
vendor/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ use Composer\Package\PackageInterface;
5
+
6
+ class ExpressionEngineInstaller extends BaseInstaller
7
+ {
8
+
9
+ protected $locations = array();
10
+
11
+ private $ee2Locations = array(
12
+ 'addon' => 'system/expressionengine/third_party/{$name}/',
13
+ 'theme' => 'themes/third_party/{$name}/',
14
+ );
15
+
16
+ private $ee3Locations = array(
17
+ 'addon' => 'system/user/addons/{$name}/',
18
+ 'theme' => 'themes/user/{$name}/',
19
+ );
20
+
21
+ public function getInstallPath(PackageInterface $package, $frameworkType = '')
22
+ {
23
+
24
+ $version = "{$frameworkType}Locations";
25
+ $this->locations = $this->$version;
26
+
27
+ return parent::getInstallPath($package, $frameworkType);
28
+ }
29
+ }
vendor/composer/installers/src/Composer/Installers/EzPlatformInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class EzPlatformInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'meta-assets' => 'web/assets/ezplatform/',
8
+ 'assets' => 'web/assets/ezplatform/{$name}/',
9
+ );
10
+ }
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
+ }
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
+ }
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
+ }
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
+ }
vendor/composer/installers/src/Composer/Installers/ImageCMSInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class ImageCMSInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'template' => 'templates/{$name}/',
8
+ 'module' => 'application/modules/{$name}/',
9
+ 'library' => 'application/libraries/{$name}/',
10
+ );
11
+ }
vendor/composer/installers/src/Composer/Installers/Installer.php ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Composer\Installers;
4
+
5
+ use Composer\Composer;
6
+ use Composer\Installer\BinaryInstaller;
7
+ use Composer\Installer\LibraryInstaller;
8
+ use Composer\IO\IOInterface;
9
+ use Composer\Package\PackageInterface;
10
+ use Composer\Repository\InstalledRepositoryInterface;
11
+ use Composer\Util\Filesystem;
12
+
13
+ class Installer extends LibraryInstaller
14
+ {
15
+
16
+ /**
17
+ * Package types to installer class map
18
+ *
19
+ * @var array
20
+ */
21
+ private $supportedTypes = array(
22
+ 'aimeos' => 'AimeosInstaller',
23
+ 'asgard' => 'AsgardInstaller',
24
+ 'attogram' => 'AttogramInstaller',
25
+ 'agl' => 'AglInstaller',
26
+ 'annotatecms' => 'AnnotateCmsInstaller',
27
+ 'bitrix' => 'BitrixInstaller',
28
+ 'bonefish' => 'BonefishInstaller',
29
+ 'cakephp' => 'CakePHPInstaller',
30
+ 'chef' => 'ChefInstaller',
31
+ 'civicrm' => 'CiviCrmInstaller',
32
+ 'ccframework' => 'ClanCatsFrameworkInstaller',
33
+ 'cockpit' => 'CockpitInstaller',
34
+ 'codeigniter' => 'CodeIgniterInstaller',
35
+ 'concrete5' => 'Concrete5Installer',
36
+ 'craft' => 'CraftInstaller',
37
+ 'croogo' => 'CroogoInstaller',
38
+ 'dokuwiki' => 'DokuWikiInstaller',
39
+ 'dolibarr' => 'DolibarrInstaller',
40
+ 'decibel' => 'DecibelInstaller',
41
+ 'drupal' => 'DrupalInstaller',
42
+ 'elgg' => 'ElggInstaller',
43
+ 'eliasis' => 'EliasisInstaller',
44
+ 'ee3' => 'ExpressionEngineInstaller',
45
+ 'ee2' => 'ExpressionEngineInstaller',
46
+ 'ezplatform' => 'EzPlatformInstaller',
47
+ 'fuel' => 'FuelInstaller',
48
+ 'fuelphp' => 'FuelphpInstaller',
49
+ 'grav' => 'GravInstaller',
50
+ 'hurad' => 'HuradInstaller',
51
+ 'imagecms' => 'ImageCMSInstaller',
52
+ 'itop' => 'ItopInstaller',
53
+ 'joomla' => 'JoomlaInstaller',
54
+ 'kanboard' => 'KanboardInstaller',
55
+ 'kirby' => 'KirbyInstaller',
56
+ 'kodicms' => 'KodiCMSInstaller',
57
+ 'kohana' => 'KohanaInstaller',
58
+ 'lms' => 'LanManagementSystemInstaller',
59
+ 'laravel' => 'LaravelInstaller',
60
+ 'lavalite' => 'LavaLiteInstaller',
61
+ 'lithium' => 'LithiumInstaller',
62
+ 'magento' => 'MagentoInstaller',
63
+ 'majima' => 'MajimaInstaller',
64
+ 'mako' => 'MakoInstaller',
65
+ 'maya' => 'MayaInstaller',
66
+ 'mautic' => 'MauticInstaller',
67
+ 'mediawiki' => 'MediaWikiInstaller',
68
+ 'microweber' => 'MicroweberInstaller',
69
+ 'modulework' => 'MODULEWorkInstaller',
70
+ 'modx' => 'ModxInstaller',
71
+ 'modxevo' => 'MODXEvoInstaller',
72
+ 'moodle' => 'MoodleInstaller',
73
+ 'october' => 'OctoberInstaller',
74
+ 'ontowiki' => 'OntoWikiInstaller',
75
+ 'oxid' => 'OxidInstaller',
76
+ 'osclass' => 'OsclassInstaller',
77
+ 'pxcms' => 'PxcmsInstaller',
78
+ 'phpbb' => 'PhpBBInstaller',
79
+ 'pimcore' => 'PimcoreInstaller',
80
+ 'piwik' => 'PiwikInstaller',
81
+ 'plentymarkets'=> 'PlentymarketsInstaller',
82
+ 'ppi' => 'PPIInstaller',
83
+ 'puppet' => 'PuppetInstaller',
84
+ 'radphp' => 'RadPHPInstaller',
85
+ 'phifty' => 'PhiftyInstaller',
86
+ 'porto' => 'PortoInstaller',
87
+ 'redaxo' => 'RedaxoInstaller',
88
+ 'reindex' => 'ReIndexInstaller',
89
+ 'roundcube' => 'RoundcubeInstaller',
90
+ 'shopware' => 'ShopwareInstaller',
91
+ 'sitedirect' => 'SiteDirectInstaller',
92
+ 'silverstripe' => 'SilverStripeInstaller',
93
+ 'smf' => 'SMFInstaller',
94
+ 'sydes' => 'SyDESInstaller',
95
+ 'symfony1' => 'Symfony1Installer',
96
+ 'thelia' => 'TheliaInstaller',
97
+ 'tusk' => 'TuskInstaller',
98
+ 'typo3-cms' => 'TYPO3CmsInstaller',
99
+ 'typo3-flow' => 'TYPO3FlowInstaller',
100
+ 'userfrosting' => 'UserFrostingInstaller',
101
+ 'vanilla' => 'VanillaInstaller',
102
+ 'whmcs' => 'WHMCSInstaller',
103
+ 'wolfcms' => 'WolfCMSInstaller',
104
+ 'wordpress' => 'WordPressInstaller',
105
+ 'yawik' => 'YawikInstaller',
106
+ 'zend' => 'ZendInstaller',
107
+ 'zikula' => 'ZikulaInstaller',
108
+ 'prestashop' => 'PrestashopInstaller'
109
+ );
110
+
111
+ /**
112
+ * Installer constructor.
113
+ *
114
+ * Disables installers specified in main composer extra installer-disable
115
+ * list
116
+ *
117
+ * @param IOInterface $io
118
+ * @param Composer $composer
119
+ * @param string $type
120
+ * @param Filesystem|null $filesystem
121
+ * @param BinaryInstaller|null $binaryInstaller
122
+ */
123
+ public function __construct(
124
+ IOInterface $io,
125
+ Composer $composer,
126
+ $type = 'library',
127
+ Filesystem $filesystem = null,
128
+ BinaryInstaller $binaryInstaller = null
129
+ ) {
130
+ parent::__construct($io, $composer, $type, $filesystem,
131
+ $binaryInstaller);
132
+ $this->removeDisabledInstallers();
133
+ }
134
+
135
+ /**
136
+ * {@inheritDoc}
137
+ */
138
+ public function getInstallPath(PackageInterface $package)
139
+ {
140
+ $type = $package->getType();
141
+ $frameworkType = $this->findFrameworkType($type);
142
+
143
+ if ($frameworkType === false) {
144
+ throw new \InvalidArgumentException(
145
+ 'Sorry the package type of this package is not yet supported.'
146
+ );
147
+ }
148
+
149
+ $class = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType];
150
+ $installer = new $class($package, $this->composer, $this->getIO());
151
+
152
+ return $installer->getInstallPath($package, $frameworkType);
153
+ }
154
+
155
+ public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
156
+ {
157
+ parent::uninstall($repo, $package);
158
+ $installPath = $this->getPackageBasePath($package);
159
+ $this->io->write(sprintf('Deleting %s - %s', $installPath, !file_exists($installPath) ? '<comment>deleted</comment>' : '<error>not deleted</error>'));
160
+ }
161
+
162
+ /**
163
+ * {@inheritDoc}
164
+ */
165
+ public function supports($packageType)
166
+ {
167
+ $frameworkType = $this->findFrameworkType($packageType);
168
+
169
+ if ($frameworkType === false) {
170
+ return false;
171
+ }
172
+
173
+ $locationPattern = $this->getLocationPattern($frameworkType);
174
+
175
+ return preg_match('#' . $frameworkType . '-' . $locationPattern . '#', $packageType, $matches) === 1;
176
+ }
177
+
178
+ /**
179
+ * Finds a supported framework type if it exists and returns it
180
+ *
181
+ * @param string $type
182
+ * @return string
183
+ */
184
+ protected function findFrameworkType($type)
185
+ {
186
+ $frameworkType = false;
187
+
188
+ krsort($this->supportedTypes);
189
+
190
+ foreach ($this->supportedTypes as $key => $val) {
191
+ if ($key === substr($type, 0, strlen($key))) {
192
+ $frameworkType = substr($type, 0, strlen($key));
193
+ break;
194
+ }
195
+ }
196
+
197
+ return $frameworkType;
198
+ }
199
+
200
+ /**
201
+ * Get the second part of the regular expression to check for support of a
202
+ * package type
203
+ *
204
+ * @param string $frameworkType
205
+ * @return string
206
+ */
207
+ protected function getLocationPattern($frameworkType)
208
+ {
209
+ $pattern = false;
210
+ if (!empty($this->supportedTypes[$frameworkType])) {
211
+ $frameworkClass = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType];
212
+ /** @var BaseInstaller $framework */
213
+ $framework = new $frameworkClass(null, $this->composer, $this->getIO());
214
+ $locations = array_keys($framework->getLocations());
215
+ $pattern = $locations ? '(' . implode('|', $locations) . ')' : false;
216
+ }
217
+
218
+ return $pattern ? : '(\w+)';
219
+ }
220
+
221
+ /**
222
+ * Get I/O object
223
+ *
224
+ * @return IOInterface
225
+ */
226
+ private function getIO()
227
+ {
228
+ return $this->io;
229
+ }
230
+
231
+ /**
232
+ * Look for installers set to be disabled in composer's extra config and
233
+ * remove them from the list of supported installers.
234
+ *
235
+ * Globals:
236
+ * - true, "all", and "*" - disable all installers.
237
+ * - false - enable all installers (useful with
238
+ * wikimedia/composer-merge-plugin or similar)
239
+ *
240
+ * @return void
241
+ */
242
+ protected function removeDisabledInstallers()
243
+ {
244
+ $extra = $this->composer->getPackage()->getExtra();
245
+
246
+ if (!isset($extra['installer-disable']) || $extra['installer-disable'] === false) {
247
+ // No installers are disabled
248
+ return;
249
+ }
250
+
251
+ // Get installers to disable
252
+ $disable = $extra['installer-disable'];
253
+
254
+ // Ensure $disabled is an array
255
+ if (!is_array($disable)) {
256
+ $disable = array($disable);
257
+ }
258
+
259
+ // Check which installers should be disabled
260
+ $all = array(true, "all", "*");
261
+ $intersect = array_intersect($all, $disable);
262
+ if (!empty($intersect)) {
263
+ // Disable all installers
264
+ $this->supportedTypes = array();
265
+ } else {
266
+ // Disable specified installers
267
+ foreach ($disable as $key => $installer) {
268
+ if (is_string($installer) && key_exists($installer, $this->supportedTypes)) {
269
+ unset($this->supportedTypes[$installer]);
270
+ }
271
+ }
272
+ }
273
+ }
274
+ }
vendor/composer/installers/src/Composer/Installers/ItopInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class ItopInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'extension' => 'extensions/{$name}/',
8
+ );
9
+ }
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
+ }
vendor/composer/installers/src/Composer/Installers/KanboardInstaller.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ *
6
+ * Installer for kanboard plugins
7
+ *
8
+ * kanboard.net
9
+ *
10
+ * Class KanboardInstaller
11
+ * @package Composer\Installers
12
+ */
13
+ class KanboardInstaller extends BaseInstaller
14
+ {
15
+ protected $locations = array(
16
+ 'plugin' => 'plugins/{$name}/',
17
+ );
18
+ }
vendor/composer/installers/src/Composer/Installers/KirbyInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class KirbyInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'site/plugins/{$name}/',
8
+ 'field' => 'site/fields/{$name}/',
9
+ 'tag' => 'site/tags/{$name}/'
10
+ );
11
+ }
vendor/composer/installers/src/Composer/Installers/KodiCMSInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class KodiCMSInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'cms/plugins/{$name}/',
8
+ 'media' => 'cms/media/vendor/{$name}/'
9
+ );
10
+ }
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
+ }
vendor/composer/installers/src/Composer/Installers/LanManagementSystemInstaller.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Composer\Installers;
4
+
5
+ class LanManagementSystemInstaller extends BaseInstaller
6
+ {
7
+
8
+ protected $locations = array(
9
+ 'plugin' => 'plugins/{$name}/',
10
+ 'template' => 'templates/{$name}/',
11
+ 'document-template' => 'documents/templates/{$name}/',
12
+ 'userpanel-module' => 'userpanel/modules/{$name}/',
13
+ );
14
+
15
+ /**
16
+ * Format package name to CamelCase
17
+ */
18
+ public function inflectPackageVars($vars)
19
+ {
20
+ $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
21
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
22
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
23
+
24
+ return $vars;
25
+ }
26
+
27
+ }
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
+ }
vendor/composer/installers/src/Composer/Installers/LavaLiteInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class LavaLiteInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'package' => 'packages/{$vendor}/{$name}/',
8
+ 'theme' => 'public/themes/{$name}/',
9
+ );
10
+ }
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
+ }
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
+ }
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
+ }
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
+ }
vendor/composer/installers/src/Composer/Installers/MajimaInstaller.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * Plugin/theme installer for majima
6
+ * @author David Neustadt
7
+ */
8
+ class MajimaInstaller extends BaseInstaller
9
+ {
10
+ protected $locations = array(
11
+ 'plugin' => 'plugins/{$name}/',
12
+ );
13
+
14
+ /**
15
+ * Transforms the names
16
+ * @param array $vars
17
+ * @return array
18
+ */
19
+ public function inflectPackageVars($vars)
20
+ {
21
+ return $this->correctPluginName($vars);
22
+ }
23
+
24
+ /**
25
+ * Change hyphenated names to camelcase
26
+ * @param array $vars
27
+ * @return array
28
+ */
29
+ private function correctPluginName($vars)
30
+ {
31
+ $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
32
+ return strtoupper($matches[0][1]);
33
+ }, $vars['name']);
34
+ $vars['name'] = ucfirst($camelCasedName);
35
+ return $vars;
36
+ }
37
+ }
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
+ }
vendor/composer/installers/src/Composer/Installers/MauticInstaller.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class MauticInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'plugins/{$name}/',
8
+ 'theme' => 'themes/{$name}/',
9
+ );
10
+
11
+ /**
12
+ * Format package name of mautic-plugins to CamelCase
13
+ */
14
+ public function inflectPackageVars($vars)
15
+ {
16
+ if ($vars['type'] == 'mautic-plugin') {
17
+ $vars['name'] = preg_replace_callback('/(-[a-z])/', function ($matches) {
18
+ return strtoupper($matches[0][1]);
19
+ }, ucfirst($vars['name']));
20
+ }
21
+
22
+ return $vars;
23
+ }
24
+
25
+ }
vendor/composer/installers/src/Composer/Installers/MayaInstaller.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class MayaInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'modules/{$name}/',
8
+ );
9
+
10
+ /**
11
+ * Format package name.
12
+ *
13
+ * For package type maya-module, cut off a trailing '-module' if present.
14
+ *
15
+ */
16
+ public function inflectPackageVars($vars)
17
+ {
18
+ if ($vars['type'] === 'maya-module') {
19
+ return $this->inflectModuleVars($vars);
20
+ }
21
+
22
+ return $vars;
23
+ }
24
+
25
+ protected function inflectModuleVars($vars)
26
+ {
27
+ $vars['name'] = preg_replace('/-module$/', '', $vars['name']);
28
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
29
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
30
+
31
+ return $vars;
32
+ }
33
+ }
vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class MediaWikiInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'core' => 'core/',
8
+ 'extension' => 'extensions/{$name}/',
9
+ 'skin' => 'skins/{$name}/',
10
+ );
11
+
12
+ /**
13
+ * Format package name.
14
+ *
15
+ * For package type mediawiki-extension, cut off a trailing '-extension' if present and transform
16
+ * to CamelCase keeping existing uppercase chars.
17
+ *
18
+ * For package type mediawiki-skin, cut off a trailing '-skin' if present.
19
+ *
20
+ */
21
+ public function inflectPackageVars($vars)
22
+ {
23
+
24
+ if ($vars['type'] === 'mediawiki-extension') {
25
+ return $this->inflectExtensionVars($vars);
26
+ }
27
+
28
+ if ($vars['type'] === 'mediawiki-skin') {
29
+ return $this->inflectSkinVars($vars);
30
+ }
31
+
32
+ return $vars;
33
+ }
34
+
35
+ protected function inflectExtensionVars($vars)
36
+ {
37
+ $vars['name'] = preg_replace('/-extension$/', '', $vars['name']);
38
+ $vars['name'] = str_replace('-', ' ', $vars['name']);
39
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
40
+
41
+ return $vars;
42
+ }
43
+
44
+ protected function inflectSkinVars($vars)
45
+ {
46
+ $vars['name'] = preg_replace('/-skin$/', '', $vars['name']);
47
+
48
+ return $vars;
49
+ }
50
+
51
+ }
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
+ }
vendor/composer/installers/src/Composer/Installers/ModxInstaller.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * An installer to handle MODX specifics when installing packages.
6
+ */
7
+ class ModxInstaller extends BaseInstaller
8
+ {
9
+ protected $locations = array(
10
+ 'extra' => 'core/packages/{$name}/'
11
+ );
12
+ }
vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ 'atto' => 'lib/editor/atto/plugins/{$name}/',
10
+ 'tool' => 'admin/tool/{$name}/',
11
+ 'assignment' => 'mod/assignment/type/{$name}/',
12
+ 'assignsubmission' => 'mod/assign/submission/{$name}/',
13
+ 'assignfeedback' => 'mod/assign/feedback/{$name}/',
14
+ 'auth' => 'auth/{$name}/',
15
+ 'availability' => 'availability/condition/{$name}/',
16
+ 'block' => 'blocks/{$name}/',
17
+ 'booktool' => 'mod/book/tool/{$name}/',
18
+ 'cachestore' => 'cache/stores/{$name}/',
19
+ 'cachelock' => 'cache/locks/{$name}/',
20
+ 'calendartype' => 'calendar/type/{$name}/',
21
+ 'format' => 'course/format/{$name}/',
22
+ 'coursereport' => 'course/report/{$name}/',
23
+ 'datafield' => 'mod/data/field/{$name}/',
24
+ 'datapreset' => 'mod/data/preset/{$name}/',
25
+ 'editor' => 'lib/editor/{$name}/',
26
+ 'enrol' => 'enrol/{$name}/',
27
+ 'filter' => 'filter/{$name}/',
28
+ 'gradeexport' => 'grade/export/{$name}/',
29
+ 'gradeimport' => 'grade/import/{$name}/',
30
+ 'gradereport' => 'grade/report/{$name}/',
31
+ 'gradingform' => 'grade/grading/form/{$name}/',
32
+ 'local' => 'local/{$name}/',
33
+ 'logstore' => 'admin/tool/log/store/{$name}/',
34
+ 'ltisource' => 'mod/lti/source/{$name}/',
35
+ 'ltiservice' => 'mod/lti/service/{$name}/',
36
+ 'message' => 'message/output/{$name}/',
37
+ 'mnetservice' => 'mnet/service/{$name}/',
38
+ 'plagiarism' => 'plagiarism/{$name}/',
39
+ 'portfolio' => 'portfolio/{$name}/',
40
+ 'qbehaviour' => 'question/behaviour/{$name}/',
41
+ 'qformat' => 'question/format/{$name}/',
42
+ 'qtype' => 'question/type/{$name}/',
43
+ 'quizaccess' => 'mod/quiz/accessrule/{$name}/',
44
+ 'quiz' => 'mod/quiz/report/{$name}/',
45
+ 'report' => 'report/{$name}/',
46
+ 'repository' => 'repository/{$name}/',
47
+ 'scormreport' => 'mod/scorm/report/{$name}/',
48
+ 'search' => 'search/engine/{$name}/',
49
+ 'theme' => 'theme/{$name}/',
50
+ 'tinymce' => 'lib/editor/tinymce/plugins/{$name}/',
51
+ 'profilefield' => 'user/profile/field/{$name}/',
52
+ 'webservice' => 'webservice/{$name}/',
53
+ 'workshopallocation' => 'mod/workshop/allocation/{$name}/',
54
+ 'workshopeval' => 'mod/workshop/eval/{$name}/',
55
+ 'workshopform' => 'mod/workshop/form/{$name}/'
56
+ );
57
+ }
vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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('/^oc-|-plugin$/', '', $vars['name']);
36
+ $vars['vendor'] = preg_replace('/[^a-z0-9_]/i', '', $vars['vendor']);
37
+
38
+ return $vars;
39
+ }
40
+
41
+ protected function inflectThemeVars($vars)
42
+ {
43
+ $vars['name'] = preg_replace('/^oc-|-theme$/', '', $vars['name']);
44
+
45
+ return $vars;
46
+ }
47
+ }
vendor/composer/installers/src/Composer/Installers/OntoWikiInstaller.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class OntoWikiInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'extension' => 'extensions/{$name}/',
8
+ 'theme' => 'extensions/themes/{$name}/',
9
+ 'translation' => 'extensions/translations/{$name}/',
10
+ );
11
+
12
+ /**
13
+ * Format package name to lower case and remove ".ontowiki" suffix
14
+ */
15
+ public function inflectPackageVars($vars)
16
+ {
17
+ $vars['name'] = strtolower($vars['name']);
18
+ $vars['name'] = preg_replace('/.ontowiki$/', '', $vars['name']);
19
+ $vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
20
+ $vars['name'] = preg_replace('/-translation$/', '', $vars['name']);
21
+
22
+ return $vars;
23
+ }
24
+ }
vendor/composer/installers/src/Composer/Installers/OsclassInstaller.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+
5
+ class OsclassInstaller extends BaseInstaller
6
+ {
7
+
8
+ protected $locations = array(
9
+ 'plugin' => 'oc-content/plugins/{$name}/',
10
+ 'theme' => 'oc-content/themes/{$name}/',
11
+ 'language' => 'oc-content/languages/{$name}/',
12
+ );
13
+
14
+ }
vendor/composer/installers/src/Composer/Installers/OxidInstaller.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ use Composer\Package\PackageInterface;
5
+
6
+ class OxidInstaller extends BaseInstaller
7
+ {
8
+ const VENDOR_PATTERN = '/^modules\/(?P<vendor>.+)\/.+/';
9
+
10
+ protected $locations = array(
11
+ 'module' => 'modules/{$name}/',
12
+ 'theme' => 'application/views/{$name}/',
13
+ 'out' => 'out/{$name}/',
14
+ );
15
+
16
+ /**
17
+ * getInstallPath
18
+ *
19
+ * @param PackageInterface $package
20
+ * @param string $frameworkType
21
+ * @return void
22
+ */
23
+ public function getInstallPath(PackageInterface $package, $frameworkType = '')
24
+ {
25
+ $installPath = parent::getInstallPath($package, $frameworkType);
26
+ $type = $this->package->getType();
27
+ if ($type === 'oxid-module') {
28
+ $this->prepareVendorDirectory($installPath);
29
+ }
30
+ return $installPath;
31
+ }
32
+
33
+ /**
34
+ * prepareVendorDirectory
35
+ *
36
+ * Makes sure there is a vendormetadata.php file inside
37
+ * the vendor folder if there is a vendor folder.
38
+ *
39
+ * @param string $installPath
40
+ * @return void
41
+ */
42
+ protected function prepareVendorDirectory($installPath)
43
+ {
44
+ $matches = '';
45
+ $hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches);
46
+ if (!$hasVendorDirectory) {
47
+ return;
48
+ }
49
+
50
+ $vendorDirectory = $matches['vendor'];
51
+ $vendorPath = getcwd() . '/modules/' . $vendorDirectory;
52
+ if (!file_exists($vendorPath)) {
53
+ mkdir($vendorPath, 0755, true);
54
+ }
55
+
56
+ $vendorMetaDataPath = $vendorPath . '/vendormetadata.php';
57
+ touch($vendorMetaDataPath);
58
+ }
59
+ }
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
+ }
vendor/composer/installers/src/Composer/Installers/PhiftyInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class PhiftyInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'bundle' => 'bundles/{$name}/',
8
+ 'library' => 'libraries/{$name}/',
9
+ 'framework' => 'frameworks/{$name}/',
10
+ );
11
+ }
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
+ }
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
+ }
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
+ }
vendor/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class PlentymarketsInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => '{$name}/'
8
+ );
9
+
10
+ /**
11
+ * Remove hyphen, "plugin" and format to camelcase
12
+ * @param array $vars
13
+ *
14
+ * @return array
15
+ */
16
+ public function inflectPackageVars($vars)
17
+ {
18
+ $vars['name'] = explode("-", $vars['name']);
19
+ foreach ($vars['name'] as $key => $name) {
20
+ $vars['name'][$key] = ucfirst($vars['name'][$key]);
21
+ if (strcasecmp($name, "Plugin") == 0) {
22
+ unset($vars['name'][$key]);
23
+ }
24
+ }
25
+ $vars['name'] = implode("",$vars['name']);
26
+
27
+ return $vars;
28
+ }
29
+ }
vendor/composer/installers/src/Composer/Installers/Plugin.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Composer\Installers;
4
+
5
+ use Composer\Composer;
6
+ use Composer\IO\IOInterface;
7
+ use Composer\Plugin\PluginInterface;
8
+
9
+ class Plugin implements PluginInterface
10
+ {
11
+
12
+ public function activate(Composer $composer, IOInterface $io)
13
+ {
14
+ $installer = new Installer($io, $composer);
15
+ $composer->getInstallationManager()->addInstaller($installer);
16
+ }
17
+ }
vendor/composer/installers/src/Composer/Installers/PortoInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class PortoInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'container' => 'app/Containers/{$name}/',
8
+ );
9
+ }
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
+ }
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
+ }
vendor/composer/installers/src/Composer/Installers/PxcmsInstaller.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class PxcmsInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'app/Modules/{$name}/',
8
+ 'theme' => '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
+ if ($vars['type'] === 'pxcms-module') {
21
+ return $this->inflectModuleVars($vars);
22
+ }
23
+
24
+ if ($vars['type'] === 'pxcms-theme') {
25
+ return $this->inflectThemeVars($vars);
26
+ }
27
+
28
+ return $vars;
29
+ }
30
+
31
+ /**
32
+ * For package type pxcms-module, cut off a trailing '-plugin' if present.
33
+ *
34
+ * return string
35
+ */
36
+ protected function inflectModuleVars($vars)
37
+ {
38
+ $vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy)
39
+ $vars['name'] = str_replace('module-', '', $vars['name']); // strip out module-
40
+ $vars['name'] = preg_replace('/-module$/', '', $vars['name']); // strip out -module
41
+ $vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s
42
+ $vars['name'] = ucwords($vars['name']); // make module name camelcased
43
+
44
+ return $vars;
45
+ }
46
+
47
+
48
+ /**
49
+ * For package type pxcms-module, cut off a trailing '-plugin' if present.
50
+ *
51
+ * return string
52
+ */
53
+ protected function inflectThemeVars($vars)
54
+ {
55
+ $vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy)
56
+ $vars['name'] = str_replace('theme-', '', $vars['name']); // strip out theme-
57
+ $vars['name'] = preg_replace('/-theme$/', '', $vars['name']); // strip out -theme
58
+ $vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s
59
+ $vars['name'] = ucwords($vars['name']); // make module name camelcased
60
+
61
+ return $vars;
62
+ }
63
+ }
vendor/composer/installers/src/Composer/Installers/RadPHPInstaller.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class RadPHPInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'bundle' => 'src/{$name}/'
8
+ );
9
+
10
+ /**
11
+ * Format package name to CamelCase
12
+ */
13
+ public function inflectPackageVars($vars)
14
+ {
15
+ $nameParts = explode('/', $vars['name']);
16
+ foreach ($nameParts as &$value) {
17
+ $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
18
+ $value = str_replace(array('-', '_'), ' ', $value);
19
+ $value = str_replace(' ', '', ucwords($value));
20
+ }
21
+ $vars['name'] = implode('/', $nameParts);
22
+ return $vars;
23
+ }
24
+ }
vendor/composer/installers/src/Composer/Installers/ReIndexInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class ReIndexInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'theme' => 'themes/{$name}/',
8
+ 'plugin' => 'plugins/{$name}/'
9
+ );
10
+ }
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
+ }
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
+ }
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
+ }
vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ 'plugin' => 'custom/plugins/{$name}/',
16
+ 'frontend-theme' => 'themes/Frontend/{$name}/',
17
+ );
18
+
19
+ /**
20
+ * Transforms the names
21
+ * @param array $vars
22
+ * @return array
23
+ */
24
+ public function inflectPackageVars($vars)
25
+ {
26
+ if ($vars['type'] === 'shopware-theme') {
27
+ return $this->correctThemeName($vars);
28
+ }
29
+
30
+ return $this->correctPluginName($vars);
31
+ }
32
+
33
+ /**
34
+ * Changes the name to a camelcased combination of vendor and name
35
+ * @param array $vars
36
+ * @return array
37
+ */
38
+ private function correctPluginName($vars)
39
+ {
40
+ $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
41
+ return strtoupper($matches[0][1]);
42
+ }, $vars['name']);
43
+
44
+ $vars['name'] = ucfirst($vars['vendor']) . ucfirst($camelCasedName);
45
+
46
+ return $vars;
47
+ }
48
+
49
+ /**
50
+ * Changes the name to a underscore separated name
51
+ * @param array $vars
52
+ * @return array
53
+ */
54
+ private function correctThemeName($vars)
55
+ {
56
+ $vars['name'] = str_replace('-', '_', $vars['name']);
57
+
58
+ return $vars;
59
+ }
60
+ }
vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ }
32
+
33
+ return parent::getInstallPath($package, $frameworkType);
34
+ }
35
+ }
vendor/composer/installers/src/Composer/Installers/SiteDirectInstaller.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Composer\Installers;
4
+
5
+ class SiteDirectInstaller extends BaseInstaller
6
+ {
7
+ protected $locations = array(
8
+ 'module' => 'modules/{$vendor}/{$name}/',
9
+ 'plugin' => 'plugins/{$vendor}/{$name}/'
10
+ );
11
+
12
+ public function inflectPackageVars($vars)
13
+ {
14
+ return $this->parseVars($vars);
15
+ }
16
+
17
+ protected function parseVars($vars)
18
+ {
19
+ $vars['vendor'] = strtolower($vars['vendor']) == 'sitedirect' ? 'SiteDirect' : $vars['vendor'];
20
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
21
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
22
+
23
+ return $vars;
24
+ }
25
+ }
vendor/composer/installers/src/Composer/Installers/SyDESInstaller.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class SyDESInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'app/modules/{$name}/',
8
+ 'theme' => 'themes/{$name}/',
9
+ );
10
+
11
+ /**
12
+ * Format module name.
13
+ *
14
+ * Strip `sydes-` prefix and a trailing '-theme' or '-module' from package name if present.
15
+ *
16
+ * @param array @vars
17
+ *
18
+ * @return array
19
+ */
20
+ public function inflectPackageVars($vars)
21
+ {
22
+ if ($vars['type'] == 'sydes-module') {
23
+ return $this->inflectModuleVars($vars);
24
+ }
25
+
26
+ if ($vars['type'] === 'sydes-theme') {
27
+ return $this->inflectThemeVars($vars);
28
+ }
29
+
30
+ return $vars;
31
+ }
32
+
33
+ public function inflectModuleVars($vars)
34
+ {
35
+ $vars['name'] = preg_replace('/(^sydes-|-module$)/i', '', $vars['name']);
36
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
37
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
38
+
39
+ return $vars;
40
+ }
41
+
42
+ protected function inflectThemeVars($vars)
43
+ {
44
+ $vars['name'] = preg_replace('/(^sydes-|-theme$)/', '', $vars['name']);
45
+ $vars['name'] = strtolower($vars['name']);
46
+
47
+ return $vars;
48
+ }
49
+ }
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
+ }
vendor/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * Extension installer for TYPO3 CMS
6
+ *
7
+ * @deprecated since 1.0.25, use https://packagist.org/packages/typo3/cms-composer-installers instead
8
+ *
9
+ * @author Sascha Egerer <sascha.egerer@dkd.de>
10
+ */
11
+ class TYPO3CmsInstaller extends BaseInstaller
12
+ {
13
+ protected $locations = array(
14
+ 'extension' => 'typo3conf/ext/{$name}/',
15
+ );
16
+ }
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
+ }
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
+ }
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
+ }
vendor/composer/installers/src/Composer/Installers/UserFrostingInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class UserFrostingInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'sprinkle' => 'app/sprinkles/{$name}/',
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/VanillaInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class VanillaInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'plugins/{$name}/',
8
+ 'theme' => 'themes/{$name}/',
9
+ );
10
+ }
vendor/composer/installers/src/Composer/Installers/VgmcpInstaller.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class VgmcpInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'bundle' => 'src/{$vendor}/{$name}/',
8
+ 'theme' => 'themes/{$name}/'
9
+ );
10
+
11
+ /**
12
+ * Format package name.
13
+ *
14
+ * For package type vgmcp-bundle, cut off a trailing '-bundle' if present.
15
+ *
16
+ * For package type vgmcp-theme, cut off a trailing '-theme' if present.
17
+ *
18
+ */
19
+ public function inflectPackageVars($vars)
20
+ {
21
+ if ($vars['type'] === 'vgmcp-bundle') {
22
+ return $this->inflectPluginVars($vars);
23
+ }
24
+
25
+ if ($vars['type'] === 'vgmcp-theme') {
26
+ return $this->inflectThemeVars($vars);
27
+ }
28
+
29
+ return $vars;
30
+ }
31
+
32
+ protected function inflectPluginVars($vars)
33
+ {
34
+ $vars['name'] = preg_replace('/-bundle$/', '', $vars['name']);
35
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
36
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
37
+
38
+ return $vars;
39
+ }
40
+
41
+ protected function inflectThemeVars($vars)
42
+ {
43
+ $vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
44
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
45
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
46
+
47
+ return $vars;
48
+ }
49
+ }
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
+ }
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
+ }
vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
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
+ 'dropin' => 'wp-content/{$name}/',
11
+ );
12
+ }
vendor/composer/installers/src/Composer/Installers/YawikInstaller.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: cbleek
5
+ * Date: 25.03.16
6
+ * Time: 20:55
7
+ */
8
+
9
+ namespace Composer\Installers;
10
+
11
+
12
+ class YawikInstaller extends BaseInstaller
13
+ {
14
+ protected $locations = array(
15
+ 'module' => 'module/{$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
+ }
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
+ }
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
+ }
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;
vendor/xrstf/composer-php52/.gitignore ADDED
@@ -0,0 +1 @@
 
1
+ /vendor/
vendor/xrstf/composer-php52/LICENSE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2013 Christoph Mewes
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.
vendor/xrstf/composer-php52/README.md ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PHP 5.2 Autoloading for Composer
2
+ ================================
3
+
4
+ This package provides an easy way to get a PHP 5.2 compatible autoloader out of Composer. The generated autoloader is fully compatible to the original and is written into separate files, each ending with `_52.php`.
5
+
6
+ Legacy
7
+ ------
8
+
9
+ Please do not use this, if you can avoid it. It's a horrible hack, often breaks and is extremely tied to Composer's interna. This package was originally developed in 2012, when PHP 5.2 was much more common on cheap webhosts.
10
+
11
+ In 2016, this package has been moved from Bitbucket to a Github organization, because the original developer could no longer reliably maintain it. This is the reason for this legacy package name ``xrstf/...``.
12
+
13
+ Usage
14
+ -----
15
+
16
+ In your project's `composer.json`, add the following lines:
17
+
18
+ ```json
19
+ {
20
+ "require": {
21
+ "xrstf/composer-php52": "1.*"
22
+ },
23
+ "scripts": {
24
+ "post-install-cmd": [
25
+ "xrstf\\Composer52\\Generator::onPostInstallCmd"
26
+ ],
27
+ "post-update-cmd": [
28
+ "xrstf\\Composer52\\Generator::onPostInstallCmd"
29
+ ],
30
+ "post-autoload-dump": [
31
+ "xrstf\\Composer52\\Generator::onPostInstallCmd"
32
+ ]
33
+ }
34
+ }
35
+ ```
36
+
37
+ After the next update/install, you will have a `vendor/autoload_52.php` file, that you can simply include and use in PHP 5.2 projects.
vendor/xrstf/composer-php52/composer.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "xrstf/composer-php52",
3
+ "license": "MIT",
4
+ "support": {
5
+ "source": "https://github.com/composer-php52/composer-php52",
6
+ "issues": "https://github.com/composer-php52/composer-php52/issues"
7
+ },
8
+ "autoload": {
9
+ "psr-0": {
10
+ "xrstf\\Composer52": "lib/"
11
+ }
12
+ },
13
+ "scripts": {
14
+ "post-install-cmd": [
15
+ "xrstf\\Composer52\\Generator::onPostInstallCmd"
16
+ ],
17
+ "post-update-cmd": [
18
+ "xrstf\\Composer52\\Generator::onPostInstallCmd"
19
+ ]
20
+ },
21
+ "extra": {
22
+ "branch-alias": {
23
+ "dev-default": "1.x-dev"
24
+ }
25
+ }
26
+ }
vendor/xrstf/composer-php52/lib/xrstf/Composer52/AutoloadGenerator.php ADDED
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013, Christoph Mewes, http://www.xrstf.de
4
+ *
5
+ * This file is released under the terms of the MIT license. You can find the
6
+ * complete text in the attached LICENSE file or online at:
7
+ *
8
+ * http://www.opensource.org/licenses/mit-license.php
9
+ *
10
+ * --------------------------------------------------------------------------
11
+ *
12
+ * 99% of this is copied as-is from the original Composer source code and is
13
+ * released under MIT license as well. Copyright goes to:
14
+ *
15
+ * - Igor Wiedler <igor@wiedler.ch>
16
+ * - Jordi Boggiano <j.boggiano@seld.be>
17
+ */
18
+
19
+ namespace xrstf\Composer52;
20
+
21
+ use Composer\Autoload\AutoloadGenerator as BaseGenerator;
22
+ use Composer\Autoload\ClassMapGenerator;
23
+ use Composer\Config;
24
+ use Composer\Installer\InstallationManager;
25
+ use Composer\Package\AliasPackage;
26
+ use Composer\Package\PackageInterface;
27
+ use Composer\Repository\InstalledRepositoryInterface;
28
+ use Composer\Util\Filesystem;
29
+
30
+ class AutoloadGenerator extends BaseGenerator {
31
+
32
+ /**
33
+ * @var bool
34
+ */
35
+ private $classMapAuthoritative = false;
36
+
37
+ public function __construct() {
38
+ // do nothing (but keep this constructor so we can build an instance without the need for an event dispatcher)
39
+ }
40
+
41
+ /**
42
+ * Whether or not generated autoloader considers the class map
43
+ * authoritative.
44
+ *
45
+ * @param bool $classMapAuthoritative
46
+ */
47
+ public function setClassMapAuthoritative($classMapAuthoritative)
48
+ {
49
+ $this->classMapAuthoritative = (boolean) $classMapAuthoritative;
50
+ }
51
+
52
+ public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '') {
53
+ if ($this->classMapAuthoritative) {
54
+ // Force scanPsr0Packages when classmap is authoritative
55
+ $scanPsr0Packages = true;
56
+ }
57
+
58
+ $filesystem = new Filesystem();
59
+ $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
60
+
61
+ $cwd = getcwd();
62
+ $basePath = $filesystem->normalizePath($cwd);
63
+ $vendorPath = $filesystem->normalizePath(realpath($config->get('vendor-dir')));
64
+ $targetDir = $vendorPath.'/'.$targetDir;
65
+ $filesystem->ensureDirectoryExists($targetDir);
66
+
67
+ $useGlobalIncludePath = (bool) $config->get('use-include-path');
68
+ $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
69
+ $classMapAuthoritative = $config->get('classmap-authoritative');
70
+
71
+ $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
72
+ $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
73
+
74
+ $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
75
+ $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
76
+
77
+ // add 5.2 compat
78
+ $vendorPathCode = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
79
+ $vendorPathToTargetDirCode = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathToTargetDirCode);
80
+
81
+ $packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
82
+ $autoloads = $this->parseAutoloads($packageMap, $mainPackage);
83
+
84
+ // add custom psr-0 autoloading if the root package has a target dir
85
+ $targetDirLoader = null;
86
+ $mainAutoload = $mainPackage->getAutoload();
87
+ if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
88
+ $levels = count(explode('/', $filesystem->normalizePath($mainPackage->getTargetDir())));
89
+ $prefixes = implode(', ', array_map(function ($prefix) {
90
+ return var_export($prefix, true);
91
+ }, array_keys($mainAutoload['psr-0'])));
92
+
93
+ $baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
94
+
95
+ $targetDirLoader = <<<EOF
96
+
97
+ public static function autoload(\$class) {
98
+ \$dir = $baseDirFromTargetDirCode.'/';
99
+ \$prefixes = array($prefixes);
100
+
101
+ foreach (\$prefixes as \$prefix) {
102
+ if (0 !== strpos(\$class, \$prefix)) {
103
+ continue;
104
+ }
105
+
106
+ \$path = explode(DIRECTORY_SEPARATOR, self::getClassPath(\$class));
107
+ \$path = \$dir.implode('/', array_slice(\$path, $levels));
108
+
109
+ if (!\$path = self::resolveIncludePath(\$path)) {
110
+ return false;
111
+ }
112
+
113
+ require \$path;
114
+ return true;
115
+ }
116
+ }
117
+
118
+ EOF;
119
+ }
120
+
121
+ $filesCode = "";
122
+ $autoloads['files'] = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($autoloads['files']));
123
+ foreach ($autoloads['files'] as $functionFile) {
124
+ // don't include file if it is using PHP 5.3+ syntax
125
+ // https://bitbucket.org/xrstf/composer-php52/issue/4
126
+ if ($this->isPHP53($functionFile)) {
127
+ $filesCode .= '// require '.$this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile)."; // disabled because of PHP 5.3 syntax\n";
128
+ }
129
+ else {
130
+ $filesCode .= ' require '.$this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile).";\n";
131
+ }
132
+ }
133
+
134
+ if (!$suffix) {
135
+ $suffix = md5(uniqid('', true));
136
+ }
137
+
138
+ $includePathFile = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode);
139
+
140
+ file_put_contents($vendorPath.'/autoload_52.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
141
+ file_put_contents($targetDir.'/autoload_real_52.php', $this->getAutoloadRealFile(true, (bool) $includePathFile, $targetDirLoader, $filesCode, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader));
142
+
143
+ // use stream_copy_to_stream instead of copy
144
+ // to work around https://bugs.php.net/bug.php?id=64634
145
+ $sourceLoader = fopen(__DIR__.'/ClassLoader.php', 'r');
146
+ $targetLoader = fopen($targetDir.'/ClassLoader52.php', 'w+');
147
+ stream_copy_to_stream($sourceLoader, $targetLoader);
148
+ fclose($sourceLoader);
149
+ fclose($targetLoader);
150
+ unset($sourceLoader, $targetLoader);
151
+ }
152
+
153
+ protected function isPHP53($file) {
154
+ $tokens = token_get_all(file_get_contents($file));
155
+ $php53 = array(T_DIR, T_GOTO, T_NAMESPACE, T_NS_C, T_NS_SEPARATOR, T_USE);
156
+
157
+ // PHP 5.4+
158
+ if (defined('T_TRAIT')) {
159
+ $php53[] = T_TRAIT;
160
+ $php53[] = T_TRAIT_C;
161
+ $php53[] = T_TRAIT_C;
162
+ }
163
+
164
+ // PHP 5.5+
165
+ if (defined('T_FINALLY')) {
166
+ $php53[] = T_FINALLY;
167
+ $php53[] = T_YIELD;
168
+ }
169
+
170
+ foreach ($tokens as $token) {
171
+ if (is_array($token) && in_array($token[0], $php53)) {
172
+ return true;
173
+ }
174
+ }
175
+
176
+ return false;
177
+ }
178
+
179
+ protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode) {
180
+ $includePaths = array();
181
+
182
+ foreach ($packageMap as $item) {
183
+ list($package, $installPath) = $item;
184
+
185
+ if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
186
+ $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
187
+ }
188
+
189
+ foreach ($package->getIncludePaths() as $includePath) {
190
+ $includePath = trim($includePath, '/');
191
+ $includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
192
+ }
193
+ }
194
+
195
+ if (!$includePaths) {
196
+ return;
197
+ }
198
+
199
+ $includePathsFile = <<<EOF
200
+ <?php
201
+
202
+ // include_paths_52.php generated by xrstf/composer-php52
203
+
204
+ \$vendorDir = $vendorPathCode;
205
+ \$baseDir = $appBaseDirCode;
206
+
207
+ return array(
208
+
209
+ EOF;
210
+
211
+ foreach ($includePaths as $path) {
212
+ $includePathsFile .= "\t" . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
213
+ }
214
+
215
+ return $includePathsFile . ");\n";
216
+ }
217
+
218
+ protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix) {
219
+ return <<<AUTOLOAD
220
+ <?php
221
+
222
+ // autoload_52.php generated by xrstf/composer-php52
223
+
224
+ require_once $vendorPathToTargetDirCode.'/autoload_real_52.php';
225
+
226
+ return ComposerAutoloaderInit$suffix::getLoader();
227
+
228
+ AUTOLOAD;
229
+ }
230
+
231
+ protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $filesCode, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion = 70000) {
232
+ // TODO the class ComposerAutoloaderInit should be revert to a closure
233
+ // when APC has been fixed:
234
+ // - https://github.com/composer/composer/issues/959
235
+ // - https://bugs.php.net/bug.php?id=52144
236
+ // - https://bugs.php.net/bug.php?id=61576
237
+ // - https://bugs.php.net/bug.php?id=59298
238
+
239
+ if ($filesCode) {
240
+ $filesCode = "\n\n".rtrim($filesCode);
241
+ }
242
+
243
+ $file = <<<HEADER
244
+ <?php
245
+
246
+ // autoload_real_52.php generated by xrstf/composer-php52
247
+
248
+ class ComposerAutoloaderInit$suffix {
249
+ private static \$loader;
250
+
251
+ public static function loadClassLoader(\$class) {
252
+ if ('xrstf_Composer52_ClassLoader' === \$class) {
253
+ require dirname(__FILE__).'/ClassLoader52.php';
254
+ }
255
+ }
256
+
257
+ /**
258
+ * @return xrstf_Composer52_ClassLoader
259
+ */
260
+ public static function getLoader() {
261
+ if (null !== self::\$loader) {
262
+ return self::\$loader;
263
+ }
264
+
265
+ spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true /*, true */);
266
+ self::\$loader = \$loader = new xrstf_Composer52_ClassLoader();
267
+ spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
268
+
269
+ \$vendorDir = $vendorPathCode;
270
+ \$baseDir = $appBaseDirCode;
271
+ \$dir = dirname(__FILE__);
272
+
273
+
274
+ HEADER;
275
+
276
+ if ($useIncludePath) {
277
+ $file .= <<<'INCLUDE_PATH'
278
+ $includePaths = require $dir.'/include_paths.php';
279
+ array_push($includePaths, get_include_path());
280
+ set_include_path(implode(PATH_SEPARATOR, $includePaths));
281
+
282
+
283
+ INCLUDE_PATH;
284
+ }
285
+
286
+ $file .= <<<'PSR0'
287
+ $map = require $dir.'/autoload_namespaces.php';
288
+ foreach ($map as $namespace => $path) {
289
+ $loader->add($namespace, $path);
290
+ }
291
+
292
+
293
+ PSR0;
294
+
295
+ if ($useClassMap) {
296
+ $file .= <<<'CLASSMAP'
297
+ $classMap = require $dir.'/autoload_classmap.php';
298
+ if ($classMap) {
299
+ $loader->addClassMap($classMap);
300
+ }
301
+
302
+
303
+ CLASSMAP;
304
+ }
305
+
306
+ if ($this->classMapAuthoritative) {
307
+ $file .= <<<'CLASSMAPAUTHORITATIVE'
308
+ $loader->setClassMapAuthoritative(true);
309
+
310
+ CLASSMAPAUTHORITATIVE;
311
+ }
312
+
313
+ if ($useGlobalIncludePath) {
314
+ $file .= <<<'INCLUDEPATH'
315
+ $loader->setUseIncludePath(true);
316
+
317
+
318
+ INCLUDEPATH;
319
+ }
320
+
321
+ if ($targetDirLoader) {
322
+ $file .= <<<REGISTER_AUTOLOAD
323
+ spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true);
324
+
325
+
326
+ REGISTER_AUTOLOAD;
327
+
328
+ }
329
+
330
+ $file .= <<<METHOD_FOOTER
331
+ \$loader->register($prependAutoloader);{$filesCode}
332
+
333
+ return \$loader;
334
+ }
335
+
336
+ METHOD_FOOTER;
337
+
338
+ $file .= $targetDirLoader;
339
+
340
+ return $file . <<<FOOTER
341
+ }
342
+
343
+ FOOTER;
344
+
345
+ }
346
+ }
vendor/xrstf/composer-php52/lib/xrstf/Composer52/ClassLoader.php ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013, Christoph Mewes, http://www.xrstf.de
4
+ *
5
+ * This file is released under the terms of the MIT license. You can find the
6
+ * complete text in the attached LICENSE file or online at:
7
+ *
8
+ * http://www.opensource.org/licenses/mit-license.php
9
+ *
10
+ * --------------------------------------------------------------------------
11
+ *
12
+ * 99% of this is copied as-is from the original Composer source code and is
13
+ * released under MIT license as well. Copyright goes to:
14
+ *
15
+ * - Fabien Potencier <fabien@symfony.com>
16
+ * - Jordi Boggiano <j.boggiano@seld.be>
17
+ */
18
+
19
+ class xrstf_Composer52_ClassLoader {
20
+ private $prefixes = array();
21
+ private $fallbackDirs = array();
22
+ private $useIncludePath = false;
23
+ private $classMap = array();
24
+ private $classMapAuthoratative = false;
25
+ private $allowUnderscore = false;
26
+
27
+ /**
28
+ * @param boolean $flag true to allow class names with a leading underscore, false to disable
29
+ */
30
+ public function setAllowUnderscore($flag) {
31
+ $this->allowUnderscore = (boolean) $flag;
32
+ }
33
+
34
+ /**
35
+ * @return array
36
+ */
37
+ public function getPrefixes() {
38
+ return $this->prefixes;
39
+ }
40
+
41
+ /**
42
+ * Turns off searching the prefix and fallback directories for classes
43
+ * that have not been registered with the class map.
44
+ *
45
+ * @param bool $classMapAuthoratative
46
+ */
47
+ public function setClassMapAuthoritative($classMapAuthoratative) {
48
+ $this->classMapAuthoratative = $classMapAuthoratative;
49
+ }
50
+
51
+ /**
52
+ * Should class lookup fail if not found in the current class map?
53
+ *
54
+ * @return bool
55
+ */
56
+ public function getClassMapAuthoratative() {
57
+ return $this->classMapAuthoratative;
58
+ }
59
+
60
+ /**
61
+ * @return array
62
+ */
63
+ public function getFallbackDirs() {
64
+ return $this->fallbackDirs;
65
+ }
66
+
67
+ /**
68
+ * @return array
69
+ */
70
+ public function getClassMap() {
71
+ return $this->classMap;
72
+ }
73
+
74
+ /**
75
+ * @param array $classMap class to filename map
76
+ */
77
+ public function addClassMap(array $classMap) {
78
+ if ($this->classMap) {
79
+ $this->classMap = array_merge($this->classMap, $classMap);
80
+ }
81
+ else {
82
+ $this->classMap = $classMap;
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Registers a set of classes, merging with any others previously set.
88
+ *
89
+ * @param string $prefix the classes prefix
90
+ * @param array|string $paths the location(s) of the classes
91
+ * @param bool $prepend prepend the location(s)
92
+ */
93
+ public function add($prefix, $paths, $prepend = false) {
94
+ if (!$prefix) {
95
+ if ($prepend) {
96
+ $this->fallbackDirs = array_merge(
97
+ (array) $paths,
98
+ $this->fallbackDirs
99
+ );
100
+ }
101
+ else {
102
+ $this->fallbackDirs = array_merge(
103
+ $this->fallbackDirs,
104
+ (array) $paths
105
+ );
106
+ }
107
+
108
+ return;
109
+ }
110
+
111
+ if (!isset($this->prefixes[$prefix])) {
112
+ $this->prefixes[$prefix] = (array) $paths;
113
+ return;
114
+ }
115
+
116
+ if ($prepend) {
117
+ $this->prefixes[$prefix] = array_merge(
118
+ (array) $paths,
119
+ $this->prefixes[$prefix]
120
+ );
121
+ }
122
+ else {
123
+ $this->prefixes[$prefix] = array_merge(
124
+ $this->prefixes[$prefix],
125
+ (array) $paths
126
+ );
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Registers a set of classes, replacing any others previously set.
132
+ *
133
+ * @param string $prefix the classes prefix
134
+ * @param array|string $paths the location(s) of the classes
135
+ */
136
+ public function set($prefix, $paths) {
137
+ if (!$prefix) {
138
+ $this->fallbackDirs = (array) $paths;
139
+ return;
140
+ }
141
+
142
+ $this->prefixes[$prefix] = (array) $paths;
143
+ }
144
+
145
+ /**
146
+ * Turns on searching the include path for class files.
147
+ *
148
+ * @param bool $useIncludePath
149
+ */
150
+ public function setUseIncludePath($useIncludePath) {
151
+ $this->useIncludePath = $useIncludePath;
152
+ }
153
+
154
+ /**
155
+ * Can be used to check if the autoloader uses the include path to check
156
+ * for classes.
157
+ *
158
+ * @return bool
159
+ */
160
+ public function getUseIncludePath() {
161
+ return $this->useIncludePath;
162
+ }
163
+
164
+ /**
165
+ * Registers this instance as an autoloader.
166
+ */
167
+ public function register() {
168
+ spl_autoload_register(array($this, 'loadClass'), true);
169
+ }
170
+
171
+ /**
172
+ * Unregisters this instance as an autoloader.
173
+ */
174
+ public function unregister() {
175
+ spl_autoload_unregister(array($this, 'loadClass'));
176
+ }
177
+
178
+ /**
179
+ * Loads the given class or interface.
180
+ *
181
+ * @param string $class the name of the class
182
+ * @return bool|null true, if loaded
183
+ */
184
+ public function loadClass($class) {
185
+ if ($file = $this->findFile($class)) {
186
+ include $file;
187
+ return true;
188
+ }
189
+ }
190
+
191
+ /**
192
+ * Finds the path to the file where the class is defined.
193
+ *
194
+ * @param string $class the name of the class
195
+ * @return string|null the path, if found
196
+ */
197
+ public function findFile($class) {
198
+ if ('\\' === $class[0]) {
199
+ $class = substr($class, 1);
200
+ }
201
+
202
+ if (isset($this->classMap[$class])) {
203
+ return $this->classMap[$class];
204
+ }
205
+ elseif ($this->classMapAuthoratative) {
206
+ return false;
207
+ }
208
+
209
+ $classPath = $this->getClassPath($class);
210
+
211
+ foreach ($this->prefixes as $prefix => $dirs) {
212
+ if (0 === strpos($class, $prefix)) {
213
+ foreach ($dirs as $dir) {
214
+ if (file_exists($dir.DIRECTORY_SEPARATOR.$classPath)) {
215
+ return $dir.DIRECTORY_SEPARATOR.$classPath;
216
+ }
217
+ }
218
+ }
219
+ }
220
+
221
+ foreach ($this->fallbackDirs as $dir) {
222
+ if (file_exists($dir.DIRECTORY_SEPARATOR.$classPath)) {
223
+ return $dir.DIRECTORY_SEPARATOR.$classPath;
224
+ }
225
+ }
226
+
227
+ if ($this->useIncludePath && $file = self::resolveIncludePath($classPath)) {
228
+ return $file;
229
+ }
230
+
231
+ return $this->classMap[$class] = false;
232
+ }
233
+
234
+ private function getClassPath($class) {
235
+ if (false !== $pos = strrpos($class, '\\')) {
236
+ // namespaced class name
237
+ $classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)).DIRECTORY_SEPARATOR;
238
+ $className = substr($class, $pos + 1);
239
+ }
240
+ else {
241
+ // PEAR-like class name
242
+ $classPath = null;
243
+ $className = $class;
244
+ }
245
+
246
+ $className = str_replace('_', DIRECTORY_SEPARATOR, $className);
247
+
248
+ // restore the prefix
249
+ if ($this->allowUnderscore && DIRECTORY_SEPARATOR === $className[0]) {
250
+ $className[0] = '_';
251
+ }
252
+
253
+ $classPath .= $className.'.php';
254
+
255
+ return $classPath;
256
+ }
257
+
258
+ public static function resolveIncludePath($classPath) {
259
+ $paths = explode(PATH_SEPARATOR, get_include_path());
260
+
261
+ foreach ($paths as $path) {
262
+ $path = rtrim($path, '/\\');
263
+
264
+ if ($file = file_exists($path.DIRECTORY_SEPARATOR.$file)) {
265
+ return $file;
266
+ }
267
+ }
268
+
269
+ return false;
270
+ }
271
+ }
vendor/xrstf/composer-php52/lib/xrstf/Composer52/Generator.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013, Christoph Mewes, http://www.xrstf.de
4
+ *
5
+ * This file is released under the terms of the MIT license. You can find the
6
+ * complete text in the attached LICENSE file or online at:
7
+ *
8
+ * http://www.opensource.org/licenses/mit-license.php
9
+ */
10
+
11
+ namespace xrstf\Composer52;
12
+
13
+ use Composer\Repository\CompositeRepository;
14
+ use Composer\Script\Event;
15
+
16
+ class Generator {
17
+ public static function onPostInstallCmd(Event $event) {
18
+ $composer = $event->getComposer();
19
+ $installationManager = $composer->getInstallationManager();
20
+ $repoManager = $composer->getRepositoryManager();
21
+ $localRepo = $repoManager->getLocalRepository();
22
+ $package = $composer->getPackage();
23
+ $config = $composer->getConfig();
24
+
25
+ // We can't gain access to the Command's input object, so we have to look
26
+ // for -o / --optimize-autoloader ourselves. Sadly, neither getopt() works
27
+ // (always returns an empty array), nor does Symfony's Console Input, as
28
+ // it expects a full definition of the current command line and we can't
29
+ // provide that.
30
+
31
+ $args = $_SERVER['argv'];
32
+ $optimize = in_array('-o', $args) || in_array('--optimize-autoloader', $args) || in_array('--optimize', $args);
33
+
34
+ $suffix = $config->get('autoloader-suffix');
35
+
36
+ $generator = new AutoloadGenerator();
37
+ $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize, $suffix);
38
+ }
39
+ }