PHP Class Piwik\Plugins\CoreConsole\Commands\GeneratePluginBase

Inheritance: extends Piwik\Plugin\ConsoleCommand
Afficher le fichier Open project: piwik/piwik Class Usage Examples

Méthodes publiques

Méthode Description
getPluginPath ( $pluginName )
isEnabled ( )

Méthodes protégées

Méthode Description
askPluginNameAndValidate ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output, $pluginNames, $invalidArgumentException ) : array
checkAndUpdateRequiredPiwikVersion ( $pluginName, Symfony\Component\Console\Output\OutputInterface $output )
copyTemplateMethodToExisitingClass ( string $sourceClassName, string $methodName, array $replace ) Copies the given method and all needed use statements into an existing class. The target class name will be built based on the given $replace argument.
copyTemplateToPlugin ( string $templateFolder, string $pluginName, array $replace = [], array $whitelistFiles = [] )
createFileWithinPluginIfNotExists ( $pluginNameOrCore, $fileName, $content )
getPluginNames ( )
getPluginNamesHavingNotSpecificFile ( $filename )
makeTranslationIfPossible ( $pluginName, $translatedText ) : string Creates a lang/en.json within the plugin in case it does not exist yet and adds a translation for the given text.

Private Methods

Méthode Description
buildTranslationKey ( $translatedText )
createFolderWithinPluginIfNotExists ( $pluginNameOrCore, $folder )
getPathToCore ( )
getRelativePluginPath ( $pluginName )
removeNonJsonCompatibleCharacters ( $text )
replaceContent ( $replace, $contentToReplace )
toJson ( $value )

Method Details

askPluginNameAndValidate() protected méthode

protected askPluginNameAndValidate ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output, $pluginNames, $invalidArgumentException ) : array
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
Résultat array

checkAndUpdateRequiredPiwikVersion() protected méthode

protected checkAndUpdateRequiredPiwikVersion ( $pluginName, Symfony\Component\Console\Output\OutputInterface $output )
$output Symfony\Component\Console\Output\OutputInterface

copyTemplateMethodToExisitingClass() protected méthode

Copies the given method and all needed use statements into an existing class. The target class name will be built based on the given $replace argument.
protected copyTemplateMethodToExisitingClass ( string $sourceClassName, string $methodName, array $replace )
$sourceClassName string
$methodName string
$replace array

copyTemplateToPlugin() protected méthode

protected copyTemplateToPlugin ( string $templateFolder, string $pluginName, array $replace = [], array $whitelistFiles = [] )
$templateFolder string full path like /home/...
$pluginName string
$replace array array(key => value) $key will be replaced by $value in all templates
$whitelistFiles array If not empty, only given files/directories will be copied. For instance array('/Controller.php', '/templates', '/templates/index.twig')

createFileWithinPluginIfNotExists() protected méthode

protected createFileWithinPluginIfNotExists ( $pluginNameOrCore, $fileName, $content )

getPluginNames() protected méthode

protected getPluginNames ( )

getPluginNamesHavingNotSpecificFile() protected méthode

protected getPluginNamesHavingNotSpecificFile ( $filename )

getPluginPath() public méthode

public getPluginPath ( $pluginName )

isEnabled() public méthode

public isEnabled ( )

makeTranslationIfPossible() protected méthode

Creates a lang/en.json within the plugin in case it does not exist yet and adds a translation for the given text.
protected makeTranslationIfPossible ( $pluginName, $translatedText ) : string
$pluginName
$translatedText
Résultat string Either the generated translation key or the original text if a different translation for this generated translation key already exists.