| 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 |
} |
| 51 |
|