PluginProbe
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP / 1.2.67
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP v1.2.67
1.2.74 1.2.73 1.2.72 1.2.71 1.2.70 1.2.69 1.2.68 1.2.67 1.2.66 1.2.65 1.2.64 1.2.63 trunk 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 All 174 releases
userswp / vendor / composer / installers / src / Composer / Installers / CakePHPInstaller.php

CakePHPInstaller.php in UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP 1.2.67, at vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php

67 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Composer\Installers;
3
4 use Composer\DependencyResolver\Pool;
5 use Composer\Semver\Constraint\Constraint;
6
7 class CakePHPInstaller extends BaseInstaller
8 {
9 protected $locations = array(
10 'plugin' => 'Plugin/{$name}/',
11 );
12
13 /**
14 * Format package name to CamelCase
15 */
16 public function inflectPackageVars($vars)
17 {
18 if ($this->matchesCakeVersion('>=', '3.0.0')) {
19 return $vars;
20 }
21
22 $nameParts = explode('/', $vars['name']);
23 foreach ($nameParts as &$value) {
24 $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
25 $value = str_replace(array('-', '_'), ' ', $value);
26 $value = str_replace(' ', '', ucwords($value));
27 }
28 $vars['name'] = implode('/', $nameParts);
29
30 return $vars;
31 }
32
33 /**
34 * Change the default plugin location when cakephp >= 3.0
35 */
36 public function getLocations()
37 {
38 if ($this->matchesCakeVersion('>=', '3.0.0')) {
39 $this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/';
40 }
41 return $this->locations;
42 }
43
44 /**
45 * Check if CakePHP version matches against a version
46 *
47 * @param string $matcher
48 * @param string $version
49 * @return bool
50 * @phpstan-param Constraint::STR_OP_* $matcher
51 */
52 protected function matchesCakeVersion($matcher, $version)
53 {
54 $repositoryManager = $this->composer->getRepositoryManager();
55 if (! $repositoryManager) {
56 return false;
57 }
58
59 $repos = $repositoryManager->getLocalRepository();
60 if (!$repos) {
61 return false;
62 }
63
64 return $repos->findPackage('cakephp/cakephp', new Constraint($matcher, $version)) !== null;
65 }
66 }
67