Cyr-To-Lat - Version 4.2

Version Description

(28.05.2019) = * Bumped up required php version - to 5.6 * Added phpunit tests for all php versions from 5.6 to 7.3 * Fixed php warning during conversion of existing slugs * Fixed locale selection during conversion of existing post slugs when WPML is activated * Fixed locale selection during conversion of existing term slugs when WPML is activated * Fixed bug with infinite redirection of some slugs after conversion of existing slugs

Download this release

Release Info

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

Code changes from version 4.1.2 to 4.2

cyr-to-lat.php CHANGED
@@ -9,8 +9,8 @@
9
  * Author URI: https://profiles.wordpress.org/sergeybiryukov/
10
  * Requires at least: 2.3
11
  * Tested up to: 5.2
12
- * Version: 4.1.2
13
- * Stable tag: 4.1.2
14
  *
15
  * Text Domain: cyr2lat
16
  * Domain Path: /languages/
@@ -26,7 +26,7 @@ if ( ! defined( 'ABSPATH' ) ) {
26
  /**
27
  * Plugin version.
28
  */
29
- define( 'CYR_TO_LAT_VERSION', '4.1.2' );
30
 
31
  /**
32
  * Path to the plugin dir.
@@ -65,11 +65,7 @@ define( 'CYR_TO_LAT_TERM_CONVERSION_ACTION', 'term_conversion_action' );
65
  static $plugin;
66
 
67
  if ( ! isset( $plugin ) ) {
68
- if ( version_compare( PHP_VERSION, '5.3.0' ) >= 0 ) {
69
- require_once CYR_TO_LAT_PATH . '/vendor/autoload.php';
70
- } else {
71
- require_once CYR_TO_LAT_PATH . '/vendor/autoload_52.php';
72
- }
73
 
74
  $plugin = new Cyr_To_Lat_Main();
75
  }
9
  * Author URI: https://profiles.wordpress.org/sergeybiryukov/
10
  * Requires at least: 2.3
11
  * Tested up to: 5.2
12
+ * Version: 4.2
13
+ * Stable tag: 4.2
14
  *
15
  * Text Domain: cyr2lat
16
  * Domain Path: /languages/
26
  /**
27
  * Plugin version.
28
  */
29
+ define( 'CYR_TO_LAT_VERSION', '4.2' );
30
 
31
  /**
32
  * Path to the plugin dir.
65
  static $plugin;
66
 
67
  if ( ! isset( $plugin ) ) {
68
+ require_once CYR_TO_LAT_PATH . '/vendor/autoload.php';
 
 
 
 
69
 
70
  $plugin = new Cyr_To_Lat_Main();
71
  }
includes/background-processes/class-cyr-to-lat-post-conversion-process.php CHANGED
@@ -10,6 +10,20 @@
10
  */
11
  class Cyr_To_Lat_Post_Conversion_Process extends Cyr_To_Lat_Conversion_Process {
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  /**
14
  * Process action name
15
  *
@@ -17,6 +31,16 @@ class Cyr_To_Lat_Post_Conversion_Process extends Cyr_To_Lat_Conversion_Process {
17
  */
18
  protected $action = CYR_TO_LAT_POST_CONVERSION_ACTION;
19
 
 
 
 
 
 
 
 
 
 
 
20
  /**
21
  * Task. Updates single post
22
  *
@@ -27,16 +51,21 @@ class Cyr_To_Lat_Post_Conversion_Process extends Cyr_To_Lat_Conversion_Process {
27
  protected function task( $post ) {
28
  global $wpdb;
29
 
30
- $sanitized_name = $this->main->ctl_sanitize_title( $post->post_name );
 
 
 
 
 
31
 
32
- if ( $sanitized_name !== $post->post_name ) {
33
- add_post_meta( $post->ID, '_wp_old_slug', $post->post_name );
34
  // phpcs:disable WordPress.DB.DirectDatabaseQuery
35
  $wpdb->update( $wpdb->posts, array( 'post_name' => $sanitized_name ), array( 'ID' => $post->ID ) );
36
  // phpcs:enable
37
- }
38
 
39
- $this->log( __( 'Post slug converted:', 'cyr2lat' ) . ' ' . urldecode( $post->post_name ) . ' => ' . $sanitized_name );
 
40
 
41
  return false;
42
  }
@@ -49,4 +78,15 @@ class Cyr_To_Lat_Post_Conversion_Process extends Cyr_To_Lat_Conversion_Process {
49
 
50
  $this->log( __( 'Post slugs conversion completed.', 'cyr2lat' ) );
51
  }
 
 
 
 
 
 
 
 
 
 
 
52
  }
10
  */
11
  class Cyr_To_Lat_Post_Conversion_Process extends Cyr_To_Lat_Conversion_Process {
12
 
13
+ /**
14
+ * Site locale.
15
+ *
16
+ * @var string
17
+ */
18
+ private $locale;
19
+
20
+ /**
21
+ * Current post to convert.
22
+ *
23
+ * @var stdClass
24
+ */
25
+ private $post;
26
+
27
  /**
28
  * Process action name
29
  *
31
  */
32
  protected $action = CYR_TO_LAT_POST_CONVERSION_ACTION;
33
 
34
+ /**
35
+ * Cyr_To_Lat_Post_Conversion_Process constructor.
36
+ *
37
+ * @param Cyr_To_Lat_Main $main Plugin main class.
38
+ */
39
+ public function __construct( $main ) {
40
+ parent::__construct( $main );
41
+ $this->locale = get_locale();
42
+ }
43
+
44
  /**
45
  * Task. Updates single post
46
  *
51
  protected function task( $post ) {
52
  global $wpdb;
53
 
54
+ $this->post = $post;
55
+ $post_name = urldecode( $post->post_name );
56
+
57
+ add_filter( 'locale', array( $this, 'filter_post_locale' ) );
58
+ $sanitized_name = sanitize_title( $post_name );
59
+ remove_filter( 'locale', array( $this, 'filter_post_locale' ) );
60
 
61
+ if ( urldecode( $sanitized_name ) !== $post_name ) {
62
+ update_post_meta( $post->ID, '_wp_old_slug', $post_name );
63
  // phpcs:disable WordPress.DB.DirectDatabaseQuery
64
  $wpdb->update( $wpdb->posts, array( 'post_name' => $sanitized_name ), array( 'ID' => $post->ID ) );
65
  // phpcs:enable
 
66
 
67
+ $this->log( __( 'Post slug converted:', 'cyr2lat' ) . ' ' . $post_name . ' => ' . urldecode( $sanitized_name ) );
68
+ }
69
 
70
  return false;
71
  }
78
 
79
  $this->log( __( 'Post slugs conversion completed.', 'cyr2lat' ) );
80
  }
81
+
82
+ /**
83
+ * Filter post locale
84
+ *
85
+ * @return string
86
+ */
87
+ public function filter_post_locale() {
88
+ $wpml_post_language_details = apply_filters( 'wpml_post_language_details', false, $this->post->ID );
89
+
90
+ return isset( $wpml_post_language_details['locale'] ) ? $wpml_post_language_details['locale'] : $this->locale;
91
+ }
92
  }
includes/background-processes/class-cyr-to-lat-term-conversion-process.php CHANGED
@@ -10,6 +10,20 @@
10
  */
11
  class Cyr_To_Lat_Term_Conversion_Process extends Cyr_To_Lat_Conversion_Process {
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  /**
14
  * Process action name
15
  *
@@ -17,6 +31,16 @@ class Cyr_To_Lat_Term_Conversion_Process extends Cyr_To_Lat_Conversion_Process {
17
  */
18
  protected $action = CYR_TO_LAT_TERM_CONVERSION_ACTION;
19
 
 
 
 
 
 
 
 
 
 
 
20
  /**
21
  * Task. Updates single term
22
  *
@@ -27,15 +51,20 @@ class Cyr_To_Lat_Term_Conversion_Process extends Cyr_To_Lat_Conversion_Process {
27
  protected function task( $term ) {
28
  global $wpdb;
29
 
30
- $sanitized_slug = $this->main->ctl_sanitize_title( $term->slug );
 
31
 
32
- if ( $sanitized_slug !== $term->slug ) {
 
 
 
 
33
  // phpcs:disable WordPress.DB.DirectDatabaseQuery
34
  $wpdb->update( $wpdb->terms, array( 'slug' => $sanitized_slug ), array( 'term_id' => $term->term_id ) );
35
  // phpcs:enable
36
- }
37
 
38
- $this->log( __( 'Term slug converted:', 'cyr2lat' ) . ' ' . urldecode( $term->slug ) . ' => ' . $sanitized_slug );
 
39
 
40
  return false;
41
  }
@@ -48,4 +77,29 @@ class Cyr_To_Lat_Term_Conversion_Process extends Cyr_To_Lat_Conversion_Process {
48
 
49
  $this->log( __( 'Term slugs conversion completed.', 'cyr2lat' ) );
50
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
10
  */
11
  class Cyr_To_Lat_Term_Conversion_Process extends Cyr_To_Lat_Conversion_Process {
12
 
13
+ /**
14
+ * Site locale.
15
+ *
16
+ * @var string
17
+ */
18
+ private $locale;
19
+
20
+ /**
21
+ * Current term to convert.
22
+ *
23
+ * @var stdClass
24
+ */
25
+ private $term;
26
+
27
  /**
28
  * Process action name
29
  *
31
  */
32
  protected $action = CYR_TO_LAT_TERM_CONVERSION_ACTION;
33
 
34
+ /**
35
+ * Cyr_To_Lat_Term_Conversion_Process constructor.
36
+ *
37
+ * @param Cyr_To_Lat_Main $main Plugin main class.
38
+ */
39
+ public function __construct( $main ) {
40
+ parent::__construct( $main );
41
+ $this->locale = get_locale();
42
+ }
43
+
44
  /**
45
  * Task. Updates single term
46
  *
51
  protected function task( $term ) {
52
  global $wpdb;
53
 
54
+ $this->term = $term;
55
+ $slug = urldecode( $term->slug );
56
 
57
+ add_filter( 'locale', array( $this, 'filter_term_locale' ) );
58
+ $sanitized_slug = sanitize_title( $slug );
59
+ remove_filter( 'locale', array( $this, 'filter_term_locale' ) );
60
+
61
+ if ( urldecode( $sanitized_slug ) !== $slug ) {
62
  // phpcs:disable WordPress.DB.DirectDatabaseQuery
63
  $wpdb->update( $wpdb->terms, array( 'slug' => $sanitized_slug ), array( 'term_id' => $term->term_id ) );
64
  // phpcs:enable
 
65
 
66
+ $this->log( __( 'Term slug converted:', 'cyr2lat' ) . ' ' . $slug . ' => ' . urldecode( $sanitized_slug ) );
67
+ }
68
 
69
  return false;
70
  }
77
 
78
  $this->log( __( 'Term slugs conversion completed.', 'cyr2lat' ) );
79
  }
80
+
81
+ /**
82
+ * Filter term locale
83
+ *
84
+ * @return string
85
+ */
86
+ public function filter_term_locale() {
87
+ $args = array(
88
+ 'element_type' => $this->term->taxonomy,
89
+ 'element_id' => $this->term->term_taxonomy_id,
90
+ );
91
+
92
+ $wpml_element_language_details = apply_filters( 'wpml_element_language_details', false, $args );
93
+
94
+ if ( ! isset( $wpml_element_language_details->language_code ) ) {
95
+ return $this->locale;
96
+ }
97
+
98
+ $language_code = $wpml_element_language_details->language_code;
99
+
100
+ $wpml_active_languages = apply_filters( 'wpml_active_languages', false, array() );
101
+
102
+ return isset( $wpml_active_languages[ $language_code ]['default_locale'] ) ?
103
+ $wpml_active_languages[ $language_code ]['default_locale'] : $this->locale;
104
+ }
105
  }
includes/class-cyr-to-lat-converter.php CHANGED
@@ -73,7 +73,7 @@ class Cyr_To_Lat_Converter {
73
  ) {
74
  $this->main = $main;
75
  $this->settings = $settings;
76
- $this->option_group = Cyr_To_Lat_Settings::OPTION_GROUP;
77
 
78
  $this->process_all_posts = $process_all_posts;
79
  if ( ! $this->process_all_posts ) {
@@ -99,30 +99,6 @@ class Cyr_To_Lat_Converter {
99
  public function init_hooks() {
100
  add_action( 'admin_init', array( $this, 'process_handler' ) );
101
  add_action( 'admin_init', array( $this, 'conversion_notices' ) );
102
-
103
- /**
104
- * Fix bug in WP_Background_Process::memory_exceeded() function.
105
- * See hook.
106
- */
107
- add_filter(
108
- CYR_TO_LAT_PREFIX . '_' . CYR_TO_LAT_POST_CONVERSION_ACTION . '_memory_exceeded',
109
- array( $this, 'memory_exceeded_filter' )
110
- );
111
- add_filter(
112
- CYR_TO_LAT_PREFIX . '_' . CYR_TO_LAT_TERM_CONVERSION_ACTION . '_memory_exceeded',
113
- array( $this, 'memory_exceeded_filter' )
114
- );
115
-
116
- // Do not limit execution time with WP_CLI.
117
- add_filter(
118
- CYR_TO_LAT_PREFIX . '_' . CYR_TO_LAT_POST_CONVERSION_ACTION . '_time_exceeded',
119
- array( $this, 'time_exceeded_filter' )
120
- );
121
- add_filter(
122
- CYR_TO_LAT_PREFIX . '_' . CYR_TO_LAT_TERM_CONVERSION_ACTION . '_time_exceeded',
123
- array( $this, 'time_exceeded_filter' )
124
- );
125
-
126
  }
127
 
128
  /**
@@ -242,7 +218,8 @@ class Cyr_To_Lat_Converter {
242
  // phpcs:ignore WordPress.DB.DirectDatabaseQuery
243
  $terms = $wpdb->get_results(
244
  $wpdb->prepare(
245
- "SELECT term_id, slug FROM $wpdb->terms WHERE slug REGEXP(%s)",
 
246
  $regexp
247
  )
248
  );
73
  ) {
74
  $this->main = $main;
75
  $this->settings = $settings;
76
+ $this->option_group = Cyr_To_Lat_Settings::OPTION_GROUP;
77
 
78
  $this->process_all_posts = $process_all_posts;
79
  if ( ! $this->process_all_posts ) {
99
  public function init_hooks() {
100
  add_action( 'admin_init', array( $this, 'process_handler' ) );
101
  add_action( 'admin_init', array( $this, 'conversion_notices' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  }
103
 
104
  /**
218
  // phpcs:ignore WordPress.DB.DirectDatabaseQuery
219
  $terms = $wpdb->get_results(
220
  $wpdb->prepare(
221
+ "SELECT t.term_id, slug, tt.taxonomy, tt.term_taxonomy_id FROM $wpdb->terms t, $wpdb->term_taxonomy tt
222
+ WHERE t.slug REGEXP(%s) AND tt.term_id = t.term_id",
223
  $regexp
224
  )
225
  );
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: SergeyBiryukov, mihdan, karevn, webvitaly, kaggdesign
3
  Tags: cyrillic, belorussian, ukrainian, bulgarian, macedonian, georgian, kazakh, latin, l10n, russian, cyr-to-lat, cyr2lat, rustolat, slugs, translations, transliteration
4
  Requires at least: 2.3
5
  Tested up to: 5.2
6
- Stable tag: 4.1.2
7
- Requires PHP: 5.2
8
 
9
  Converts Cyrillic characters in post, page and term slugs to Latin characters.
10
 
@@ -42,7 +42,30 @@ function my_cyr_to_lat_table($ctl_table) {
42
  add_filter('ctl_table', 'my_cyr_to_lat_table');
43
  `
44
 
45
- == How can I convert a large number of posts/terms using wp-cli? ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  Use the following command in console:
48
 
@@ -63,6 +86,14 @@ Yes you can!
63
 
64
  == Changelog ==
65
 
 
 
 
 
 
 
 
 
66
  = 4.1.2 (22.05.2019) =
67
  * Fixed bug with fatal error in Cyr_To_Lat_Converter with php 5.2
68
 
3
  Tags: cyrillic, belorussian, ukrainian, bulgarian, macedonian, georgian, kazakh, latin, l10n, russian, cyr-to-lat, cyr2lat, rustolat, slugs, translations, transliteration
4
  Requires at least: 2.3
5
  Tested up to: 5.2
6
+ Stable tag: 4.2
7
+ Requires PHP: 5.6
8
 
9
  Converts Cyrillic characters in post, page and term slugs to Latin characters.
10
 
42
  add_filter('ctl_table', 'my_cyr_to_lat_table');
43
  `
44
 
45
+ = How can I redefine non-standard locale ? =
46
+
47
+ For instance, if your non-standard locale is uk_UA, you can redefine it to `uk` by adding the following code to your theme's `function.php` file:
48
+ `
49
+ /**
50
+ * Use conversion table for non-standard locale.
51
+ *
52
+ * @param array $table Conversion table.
53
+ *
54
+ * @return array
55
+ */
56
+ function my_ctl_table( $table ) {
57
+ if ( 'uk_UA' === get_locale() ) {
58
+ $settings = new Cyr_To_Lat_Settings();
59
+ $table = $settings->get_option( 'uk' );
60
+ }
61
+
62
+ return $table;
63
+ }
64
+
65
+ add_filter( 'ctl_table', 'my_ctl_table' );
66
+ `
67
+
68
+ = How can I convert a large number of posts/terms using wp-cli? =
69
 
70
  Use the following command in console:
71
 
86
 
87
  == Changelog ==
88
 
89
+ = 4.2 (28.05.2019) =
90
+ * Bumped up required php version - to 5.6
91
+ * Added phpunit tests for all php versions from 5.6 to 7.3
92
+ * Fixed php warning during conversion of existing slugs
93
+ * Fixed locale selection during conversion of existing post slugs when WPML is activated
94
+ * Fixed locale selection during conversion of existing term slugs when WPML is activated
95
+ * Fixed bug with infinite redirection of some slugs after conversion of existing slugs
96
+
97
  = 4.1.2 (22.05.2019) =
98
  * Fixed bug with fatal error in Cyr_To_Lat_Converter with php 5.2
99
 
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitb2cb5b42293de8241d0b75cfc42e5a6f::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit6ea461ea7c2388800365ee94bb99f7e0::getLoader();
vendor/autoload_52.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
- return ComposerAutoloaderInitf48b252460a056718de79bcea58d9f8a::getLoader();
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
+ return ComposerAutoloaderInit18b08e895742391cb46af3b3d43b33fd::getLoader();
vendor/composer/autoload_namespaces.php CHANGED
@@ -6,5 +6,4 @@ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
- 'xrstf\\Composer52' => array($vendorDir . '/xrstf/composer-php52/lib'),
10
  );
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
 
9
  );
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitb2cb5b42293de8241d0b75cfc42e5a6f
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInitb2cb5b42293de8241d0b75cfc42e5a6f
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInitb2cb5b42293de8241d0b75cfc42e5a6f', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInitb2cb5b42293de8241d0b75cfc42e5a6f', '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\ComposerStaticInitb2cb5b42293de8241d0b75cfc42e5a6f::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit6ea461ea7c2388800365ee94bb99f7e0
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit6ea461ea7c2388800365ee94bb99f7e0', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit6ea461ea7c2388800365ee94bb99f7e0', '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\ComposerStaticInit6ea461ea7c2388800365ee94bb99f7e0::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_real_52.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
- class ComposerAutoloaderInitf48b252460a056718de79bcea58d9f8a {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
@@ -19,9 +19,9 @@ class ComposerAutoloaderInitf48b252460a056718de79bcea58d9f8a {
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInitf48b252460a056718de79bcea58d9f8a', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInitf48b252460a056718de79bcea58d9f8a', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
@@ -39,6 +39,16 @@ class ComposerAutoloaderInitf48b252460a056718de79bcea58d9f8a {
39
 
40
  $loader->register(true);
41
 
 
 
 
 
 
 
 
 
 
 
42
  return $loader;
43
  }
44
  }
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
+ class ComposerAutoloaderInit18b08e895742391cb46af3b3d43b33fd {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit18b08e895742391cb46af3b3d43b33fd', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit18b08e895742391cb46af3b3d43b33fd', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
39
 
40
  $loader->register(true);
41
 
42
+ // require $vendorDir . '/symfony/polyfill-ctype/bootstrap.php'; // disabled because of PHP 5.3 syntax
43
+ // require $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php'; // disabled because of PHP 5.3 syntax
44
+ require $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php';
45
+ // require $vendorDir . '/guzzlehttp/promises/src/functions_include.php'; // disabled because of PHP 5.3 syntax
46
+ // require $vendorDir . '/guzzlehttp/psr7/src/functions_include.php'; // disabled because of PHP 5.3 syntax
47
+ // require $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php'; // disabled because of PHP 5.3 syntax
48
+ // require $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php'; // disabled because of PHP 5.3 syntax
49
+ require $vendorDir . '/wp-cli/mustangostang-spyc/includes/functions.php';
50
+ // require $vendorDir . '/wp-cli/php-cli-tools/lib/cli/cli.php'; // disabled because of PHP 5.3 syntax
51
+
52
  return $loader;
53
  }
54
  }
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInitb2cb5b42293de8241d0b75cfc42e5a6f
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'C' =>
@@ -20,16 +20,6 @@ class ComposerStaticInitb2cb5b42293de8241d0b75cfc42e5a6f
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_Admin_Notices' => __DIR__ . '/../..' . '/includes/class-cyr-to-lat-admin-notices.php',
35
  'Cyr_To_Lat_Conversion_Process' => __DIR__ . '/../..' . '/includes/background-processes/class-cyr-to-lat-conversion-process.php',
@@ -47,10 +37,9 @@ class ComposerStaticInitb2cb5b42293de8241d0b75cfc42e5a6f
47
  public static function getInitializer(ClassLoader $loader)
48
  {
49
  return \Closure::bind(function () use ($loader) {
50
- $loader->prefixLengthsPsr4 = ComposerStaticInitb2cb5b42293de8241d0b75cfc42e5a6f::$prefixLengthsPsr4;
51
- $loader->prefixDirsPsr4 = ComposerStaticInitb2cb5b42293de8241d0b75cfc42e5a6f::$prefixDirsPsr4;
52
- $loader->prefixesPsr0 = ComposerStaticInitb2cb5b42293de8241d0b75cfc42e5a6f::$prefixesPsr0;
53
- $loader->classMap = ComposerStaticInitb2cb5b42293de8241d0b75cfc42e5a6f::$classMap;
54
 
55
  }, null, ClassLoader::class);
56
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit6ea461ea7c2388800365ee94bb99f7e0
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'C' =>
20
  ),
21
  );
22
 
 
 
 
 
 
 
 
 
 
 
23
  public static $classMap = array (
24
  'Cyr_To_Lat_Admin_Notices' => __DIR__ . '/../..' . '/includes/class-cyr-to-lat-admin-notices.php',
25
  'Cyr_To_Lat_Conversion_Process' => __DIR__ . '/../..' . '/includes/background-processes/class-cyr-to-lat-conversion-process.php',
37
  public static function getInitializer(ClassLoader $loader)
38
  {
39
  return \Closure::bind(function () use ($loader) {
40
+ $loader->prefixLengthsPsr4 = ComposerStaticInit6ea461ea7c2388800365ee94bb99f7e0::$prefixLengthsPsr4;
41
+ $loader->prefixDirsPsr4 = ComposerStaticInit6ea461ea7c2388800365ee94bb99f7e0::$prefixDirsPsr4;
42
+ $loader->classMap = ComposerStaticInit6ea461ea7c2388800365ee94bb99f7e0::$classMap;
 
43
 
44
  }, null, ClassLoader::class);
45
  }
vendor/composer/installed.json CHANGED
@@ -160,38 +160,5 @@
160
  "zend",
161
  "zikula"
162
  ]
163
- },
164
- {
165
- "name": "xrstf/composer-php52",
166
- "version": "v1.0.20",
167
- "version_normalized": "1.0.20.0",
168
- "source": {
169
- "type": "git",
170
- "url": "https://github.com/composer-php52/composer-php52.git",
171
- "reference": "bd41459d5e27df8d33057842b32377c39e97a5a8"
172
- },
173
- "dist": {
174
- "type": "zip",
175
- "url": "https://api.github.com/repos/composer-php52/composer-php52/zipball/bd41459d5e27df8d33057842b32377c39e97a5a8",
176
- "reference": "bd41459d5e27df8d33057842b32377c39e97a5a8",
177
- "shasum": ""
178
- },
179
- "time": "2016-04-16T21:52:24+00:00",
180
- "type": "library",
181
- "extra": {
182
- "branch-alias": {
183
- "dev-default": "1.x-dev"
184
- }
185
- },
186
- "installation-source": "dist",
187
- "autoload": {
188
- "psr-0": {
189
- "xrstf\\Composer52": "lib/"
190
- }
191
- },
192
- "notification-url": "https://packagist.org/downloads/",
193
- "license": [
194
- "MIT"
195
- ]
196
  }
197
  ]
160
  "zend",
161
  "zikula"
162
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  }
164
  ]
vendor/xrstf/composer-php52/.gitignore DELETED
@@ -1 +0,0 @@
1
- /vendor/
 
vendor/xrstf/composer-php52/LICENSE DELETED
@@ -1,19 +0,0 @@
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 DELETED
@@ -1,37 +0,0 @@
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 DELETED
@@ -1,26 +0,0 @@
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 DELETED
@@ -1,346 +0,0 @@
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 DELETED
@@ -1,271 +0,0 @@
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 DELETED
@@ -1,39 +0,0 @@
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
- }