├── .gitignore ├── README.md ├── bin ├── wp-console └── wp-console.php ├── box.json ├── composer.json ├── composer.lock ├── config.yml ├── config ├── config.yml ├── dist │ └── aliases.yml ├── mappings.yml ├── services │ └── wp-console │ │ ├── cache.yml │ │ ├── create.yml │ │ ├── database.yml │ │ ├── debug.yml │ │ ├── generate.yml │ │ ├── generator.yml │ │ ├── misc.yml │ │ ├── plugin.yml │ │ ├── role.yml │ │ └── theme.yml └── translations │ └── en │ ├── about.yml │ ├── application.yml │ ├── cache.flush.yml │ ├── chain.yml │ ├── common.yml │ ├── create.roles.yml │ ├── create.users.yml │ ├── database.create.yml │ ├── database.drop.yml │ ├── debug.chain.yml │ ├── debug.container.yml │ ├── debug.cron.yml │ ├── debug.multisite.yml │ ├── debug.plugin.yml │ ├── debug.roles.yml │ ├── debug.shortcode.yml │ ├── debug.theme.yml │ ├── exec.yml │ ├── generate.command.yml │ ├── generate.cron.schedule.yml │ ├── generate.cron.single.yml │ ├── generate.dashboard.widgets.yml │ ├── generate.menu.yml │ ├── generate.metabox.yml │ ├── generate.plugin.yml │ ├── generate.post.type.yml │ ├── generate.quicktag.yml │ ├── generate.register.script.yml │ ├── generate.register.style.yml │ ├── generate.settings.page.yml │ ├── generate.shortcode.yml │ ├── generate.sidebar.yml │ ├── generate.taxonomy.yml │ ├── generate.theme.yml │ ├── generate.toolbar.yml │ ├── generate.user.contact.methods.yml │ ├── generate.widget.yml │ ├── help.yml │ ├── init.yml │ ├── list.yml │ ├── multisite.install.yml │ ├── multisite.new.yml │ ├── plugin.activate.yml │ ├── plugin.deactivate.yml │ ├── role.delete.yml │ ├── role.new.yml │ ├── self-update.yml │ ├── settings.set.yml │ ├── site.install.yml │ ├── snippet.yml │ └── theme.activate.yml ├── phpqa.yml ├── services-core.yml ├── services-install.yml ├── services-multisite-install.yml ├── services-multisite.yml ├── services.yml ├── src ├── Annotations │ ├── WPCommand.php │ └── WPCommandAnnotationReader.php ├── Application.php ├── Bootstrap │ ├── AddServicesCompilerPass.php │ └── Wordpress.php ├── Command │ ├── AboutCommand.php │ ├── Cache │ │ └── FlushCommand.php │ ├── Create │ │ ├── RolesCommand.php │ │ └── UsersCommand.php │ ├── Database │ │ ├── CreateCommand.php │ │ └── DropCommand.php │ ├── Debug │ │ ├── ContainerCommand.php │ │ ├── CronCommand.php │ │ ├── MultisiteCommand.php │ │ ├── PluginCommand.php │ │ ├── RolesCommand.php │ │ ├── ShortcodeCommand.php │ │ └── ThemeCommand.php │ ├── Generate │ │ ├── CommandCommand.php │ │ ├── CronBaseCommand.php │ │ ├── CronScheduleCommand.php │ │ ├── CronSingleCommand.php │ │ ├── DashboardWidgetsCommand.php │ │ ├── MenuCommand.php │ │ ├── MetaBoxCommand.php │ │ ├── PluginCommand.php │ │ ├── PostTypeCommand.php │ │ ├── QuickTagCommand.php │ │ ├── RegisterBaseCommand.php │ │ ├── RegisterScriptCommand.php │ │ ├── RegisterStyleCommand.php │ │ ├── SettingsPageCommand.php │ │ ├── ShortcodeCommand.php │ │ ├── SidebarCommand.php │ │ ├── TaxonomyCommand.php │ │ ├── ThemeCommand.php │ │ ├── ToolbarCommand.php │ │ ├── UserContactMethodsCommand.php │ │ └── WidgetCommand.php │ ├── Multisite │ │ ├── InstallCommand.php │ │ └── NewCommand.php │ ├── Plugin │ │ ├── ActivateCommand.php │ │ └── DeactivateCommand.php │ ├── Role │ │ ├── DeleteCommand.php │ │ └── NewCommand.php │ ├── Shared │ │ ├── ConfirmationTrait.php │ │ ├── CreateTrait.php │ │ ├── DatabaseTrait.php │ │ ├── ExtensionTrait.php │ │ ├── FieldsTypeTrait.php │ │ ├── PluginTrait.php │ │ ├── ServicesTrait.php │ │ ├── TaxonomyPostTypeTrait.php │ │ └── ThemeTrait.php │ ├── Site │ │ └── InstallCommand.php │ ├── SnippetCommand.php │ └── Theme │ │ └── ActivateCommand.php ├── Component │ ├── FileCache │ │ ├── ApcuFileCacheBackend.php │ │ ├── FileCache.php │ │ ├── FileCacheBackendInterface.php │ │ ├── FileCacheFactory.php │ │ └── FileCacheInterface.php │ └── Utility │ │ └── Crypt.php ├── Core │ ├── Application.php │ ├── Bootstrap │ │ └── WordpressConsoleCore.php │ ├── Command │ │ ├── Chain │ │ │ ├── BaseCommand.php │ │ │ ├── ChainCommand.php │ │ │ └── ChainCustomCommand.php │ │ ├── Command.php │ │ ├── ContainerAwareCommand.php │ │ ├── Debug │ │ │ └── ChainCommand.php │ │ ├── Exec │ │ │ └── ExecCommand.php │ │ ├── HelpCommand.php │ │ ├── InitCommand.php │ │ ├── ListCommand.php │ │ ├── Settings │ │ │ └── SetCommand.php │ │ └── Shared │ │ │ ├── CommandTrait.php │ │ │ ├── ContainerAwareCommandTrait.php │ │ │ └── InputTrait.php │ ├── DependencyInjection │ │ ├── ContainerBuilder.php │ │ └── ServiceModifierInterface.php │ ├── Descriptor │ │ └── TextDescriptor.php │ ├── EventSubscriber │ │ ├── CallCommandListener.php │ │ ├── SaveStatisticsListener.php │ │ ├── SendStatisticsListener.php │ │ ├── ShowGenerateChainListener.php │ │ ├── ShowGenerateCountCodeLinesListener.php │ │ ├── ShowGenerateInlineListener.php │ │ └── ShowGeneratedFilesListener.php │ ├── Extension │ │ └── Extension.php │ ├── Generator │ │ ├── Generator.php │ │ ├── GeneratorInterface.php │ │ ├── InitGenerator.php │ │ ├── SilentIndexGenerator.php │ │ └── SiteInstallGenerator.php │ ├── Helper │ │ ├── DescriptorHelper.php │ │ └── WordpressChoiceQuestionHelper.php │ ├── Site │ │ └── Settings.php │ ├── Style │ │ └── WPStyle.php │ ├── Utils │ │ ├── ArgvInputReader.php │ │ ├── ChainDiscovery.php │ │ ├── ChainQueue.php │ │ ├── ConfigurationManager.php │ │ ├── CountCodeLines.php │ │ ├── FileQueue.php │ │ ├── KeyValueStorage.php │ │ ├── MessageManager.php │ │ ├── NestedArray.php │ │ ├── Remote.php │ │ ├── ShellProcess.php │ │ ├── ShowFile.php │ │ ├── StringConverter.php │ │ ├── TranslatorManager.php │ │ ├── TranslatorManagerInterface.php │ │ └── TwigRenderer.php │ ├── constants.php │ └── functions.php ├── Extension │ ├── Discovery.php │ ├── Extension.php │ └── Manager.php ├── Generator │ ├── CommandGenerator.php │ ├── CronBaseGenerator.php │ ├── DashboardWidgetsGenerator.php │ ├── MenuGenerator.php │ ├── MetaBoxGenerator.php │ ├── PluginGenerator.php │ ├── PostTypeGenerator.php │ ├── QuickTagGenerator.php │ ├── RegisterBaseGenerator.php │ ├── SettingsPageGenerator.php │ ├── ShortcodeGenerator.php │ ├── SidebarGenerator.php │ ├── TaxonomyGenerator.php │ ├── ThemeGenerator.php │ ├── ToolbarGenerator.php │ ├── UserContactMethodsGenerator.php │ └── WidgetGenerator.php ├── Helper │ └── WordpressFinder.php └── Utils │ ├── AnnotationValidator.php │ ├── Create │ ├── RoleData.php │ └── UserData.php │ ├── Site.php │ ├── TranslatorManager.php │ ├── Validator.php │ └── WordpressApi.php └── templates ├── base ├── class.php.twig ├── file.php.twig └── interface.php.twig ├── core ├── autocomplete │ ├── console.fish.twig │ └── console.rc.twig ├── config.yml.twig ├── htaccess.twig ├── index-silent.php.twig ├── init │ ├── config.yml.twig │ └── statistics.config.yml.twig └── wp-config.php.twig ├── plugin ├── includes │ ├── plugin-activator.php.twig │ ├── plugin-deactivator.php.twig │ └── plugin-shortcode.php.twig ├── php_tag.php.twig ├── plugin.php.twig ├── readme.txt.twig ├── services.yml.twig ├── shortcode-init.php.twig ├── src │ ├── Command │ │ ├── command.php.twig │ │ └── console │ │ │ └── translations │ │ │ └── en │ │ │ └── command.yml.twig │ ├── Cron │ │ ├── class-cron-schedule.php.twig │ │ └── class-cron-single.php.twig │ ├── Menu │ │ └── class-menu.php.twig │ ├── Metabox │ │ └── class-metabox.php.twig │ ├── PostType │ │ └── class-post-type.php.twig │ ├── QuickTag │ │ └── quicktag.js.twig │ ├── RegisterStyle │ │ └── register-styles.php.twig │ ├── SettingsPage │ │ └── class-settings-page.php.twig │ ├── Taxonomy │ │ └── class-taxonomy.php.twig │ ├── Toolbar │ │ └── toolbar.php.twig │ ├── UserContactMethods │ │ └── user-contactmethods.php.twig │ ├── Widget │ │ ├── class-dashboard-widgets.php.twig │ │ └── class-widget.php.twig │ └── class-admin.php.twig └── uninstall.php.twig └── theme ├── functions.php.twig ├── index.php.twig ├── src ├── QuickTag │ └── quicktag.php.twig └── Sidebar │ └── sidebar.php.twig ├── style.css.twig └── template.php.twig /.gitignore: -------------------------------------------------------------------------------- 1 | # deprecation-detector 2 | /.rules 3 | 4 | # Composer 5 | /vendor/ 6 | 7 | # PHPUnit 8 | /app/phpunit.xml 9 | /phpunit.xml 10 | 11 | # Binaries 12 | /box.phar 13 | /composer.phar 14 | /wordpress.phar 15 | /wordpress.phar.version 16 | 17 | # Global 18 | .idea 19 | .vagrant 20 | .DS_Store 21 | Vagrantfile 22 | /.php_cs.cache 23 | -------------------------------------------------------------------------------- /bin/wp-console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | "%s"' 14 | -------------------------------------------------------------------------------- /config/translations/en/cache.flush.yml: -------------------------------------------------------------------------------- 1 | description: 'Flush the Wordpress object cache' 2 | arguments: 3 | options: 4 | questions: 5 | messages: 6 | successful: 'The cache was flushed successfully' 7 | fail: 'The object cache could not be flushed.' 8 | -------------------------------------------------------------------------------- /config/translations/en/chain.yml: -------------------------------------------------------------------------------- 1 | description: 'Chain command execution' 2 | options: 3 | file: 'User defined file containing commands to get executed.' 4 | questions: 5 | chain-file: 'Select chain file to execute' 6 | messages: 7 | missing-file: 'You must provide a valid file path and name.' 8 | invalid-file: 'The file "%s" does not exist.' 9 | module-install: 'module:install command is not runnable inside a chain queue and must be run independently.' 10 | missing-environment-placeholders: 'Missing environment placeholder(s) "%s"' 11 | set-environment-placeholders: 'Set environment placeholders as:' 12 | missing-inline-placeholders: 'Missing inline placeholder(s) "%s"' 13 | set-inline-placeholders: 'Pass inline placeholders as:' 14 | select-value-for-placeholder: 'Select value for "%s" placeholder' 15 | enter-value-for-placeholder: 'Enter value for "%s" placeholder' 16 | legacy-inline: 'Update inline legacy placeholders from %{{name}} to {{name}}.' 17 | legacy-environment: 'Update environment legacy placeholders from ${{(NAME}} or %env(NAME)% to {{env("NAME")}}.' 18 | metadata-registration: | 19 | You should register your chain file as command by providing metadata, more info at: 20 | https://docs.wordpressconsole.com/en/chains/registering.html 21 | examples: 22 | - description: 'Providing a file option using full path. (DEPRECATED)' 23 | execution: | 24 | wp-console chain \ 25 | --file="/path/to/file/chain-file.yml" 26 | 27 | 28 | -------------------------------------------------------------------------------- /config/translations/en/common.yml: -------------------------------------------------------------------------------- 1 | options: 2 | plugin: 'The plugin name.' 3 | extension: 'The extension name.' 4 | extension-type: 'The extension type.' 5 | services: 'Load services from the container.' 6 | status: 7 | checked: 'Yes' 8 | uncheked: 'NO' 9 | enabled: 'Enabled' 10 | disabled: 'Disabled' 11 | messages: 12 | canceled: 'Command generation canceled.' 13 | reserved: 'The following words are reserved for use by WordPress functions and cannot be used as blog names: %s' 14 | user-create-error: 'There was an error creating the user.' 15 | questions: 16 | confirm: 'Do you confirm generation?' 17 | plugin: 'Enter the plugin name' 18 | theme: 'Enter the theme name' 19 | extension: 'Enter the extension name' 20 | extension-type: 'Enter the extension type' 21 | services: 22 | confirm: 'Do you want to load services from the container' 23 | message: "\nType the service name or use keyup or keydown.\nThis is optional, press enter to continue\n" 24 | name: 'Enter your service' 25 | roles: 26 | message: "\nType the role name or use keyup or keydown.\nThis is optional, press enter to continue\n" 27 | name: 'Enter your role' 28 | widgets: 29 | message: "\nType the widget id or use keyup or keydown.\nThis is optional, press enter to continue\n" 30 | name: 'Enter your widget id' 31 | capabilities: 32 | message: "\nType the capibility name or use keyup or keydown.\nThis is optional, press enter to continue\n" 33 | name: 'Enter your capability' -------------------------------------------------------------------------------- /config/translations/en/create.roles.yml: -------------------------------------------------------------------------------- 1 | description: 'Create dummy roles for your Wordpress application.' 2 | help: 'The create:roles command helps you create dummy roles.' 3 | welcome: 'Welcome to the Wordpress roles generator' 4 | options: 5 | limit: 'How many roles would you like to create' 6 | questions: 7 | limit: 'Enter how many roles would you like to create' 8 | messages: 9 | role-id: 'Role Id' 10 | role-name: 'Rolename' 11 | created-roles: 'Created "%s" roles successfully' 12 | error-created-role: 'Created "%s" role unsuccessfully' 13 | examples: 14 | - description: 'Provide roles.' 15 | execution: wp-console create:roles 16 | - description: 'Provide the number of roles to create' 17 | execution: | 18 | wp-console create:roles 19 | 20 | -------------------------------------------------------------------------------- /config/translations/en/create.users.yml: -------------------------------------------------------------------------------- 1 | description: 'Create dummy users for your WordPress application.' 2 | help: 'The create:users command helps you create dummy users.' 3 | welcome: 'Welcome to the WordPress users generator' 4 | arguments: 5 | role: 'Role to be used in users creation' 6 | options: 7 | limit: 'How many users would you like to create' 8 | password: 'Password to be set to users created' 9 | time-range: 'How far back in time should the users be dated' 10 | questions: 11 | role: 'Select role to be used on user creation' 12 | limit: 'Enter how many users would you like to generate' 13 | password: 'Enter the password to be set to users created (empty to generate random)' 14 | time-ranges: 15 | - 'Now' 16 | - '1 hour ago' 17 | - '1 day ago' 18 | - '1 week ago' 19 | - '1 month ago' 20 | - '1 year ago' 21 | messages: 22 | user-id: 'User Id' 23 | username: 'Username' 24 | password: 'Password' 25 | role: 'Role' 26 | registered: 'Registered Time' 27 | created-users: 'Created "%s" users successfully' 28 | -------------------------------------------------------------------------------- /config/translations/en/database.create.yml: -------------------------------------------------------------------------------- 1 | description: "Create a new database." 2 | help: 'The database:create command helps you create database.' 3 | arguments: 4 | dbname: 'Name of new database' 5 | dbuser: 'User to access mysql' 6 | dbpassword: 'Password to access mysql' 7 | dbhost: 'host to access mysql' 8 | question: 9 | create-tables: 'Confirm you really want to create the database "%s"?' 10 | messages: 11 | database-create: 'The database "%s" was created successfully' 12 | errors: 13 | empty-wpdb: 'You must provide dbuser and dbpassword as argument' 14 | failed-database-create: 'Failed to create the database "%s"' 15 | examples: 16 | - description: 'Create a new database specified on the argument' 17 | execution: | 18 | wp-console database:create -------------------------------------------------------------------------------- /config/translations/en/database.drop.yml: -------------------------------------------------------------------------------- 1 | description: "Drop all tables in current or a given database and remove wp-config.php if current database." 2 | help: 'The database:drop command helps you drop database tables.' 3 | arguments: 4 | dbname: 'Name of database' 5 | question: 6 | drop-tables: 'Confirm you really want to drop all tables in the database "%s"?' 7 | messages: 8 | database-drop: 'Drop "%s" tables successfully' 9 | errors: 10 | failed-database-drop: 'Failed to drop the database "%s"' 11 | examples: 12 | - description: 'Drop the tables on the database specified on the argument' 13 | execution: | 14 | wp-console database:drop 15 | -------------------------------------------------------------------------------- /config/translations/en/debug.chain.yml: -------------------------------------------------------------------------------- 1 | description: 'List available chain files.' 2 | messages: 3 | directory: 'Directory' 4 | file: 'File name.' 5 | command: 'Command name.' 6 | no-files: 'No chain files found.' 7 | -------------------------------------------------------------------------------- /config/translations/en/debug.container.yml: -------------------------------------------------------------------------------- 1 | description: 'Displays current services for an application.' 2 | arguments: 3 | service: 'Service name.' 4 | messages: 5 | service_id: 'Service ID' 6 | class_name: 'Class Name' 7 | service: 'Service' 8 | class: 'Class' 9 | interface: 'Interface(s)' 10 | parent: 'Parent class' 11 | variables: 'Variables' 12 | methods: 'Methods' -------------------------------------------------------------------------------- /config/translations/en/debug.cron.yml: -------------------------------------------------------------------------------- 1 | description: 'Displays current cron for the application' 2 | help: 'The debug:cron command helps you get current cron events.' 3 | welcome: 'Welcome to the Wordpress cron events debug' 4 | arguments: 5 | type: 'Cron type [single|schedule|all]' 6 | messages: 7 | type: 'Cron type' 8 | name: 'Hook Name' 9 | time: 'Next run GMT' 10 | next-time: 'Next run relative' 11 | schedule: 'Schedule' 12 | interval: 'Recurrence' 13 | args: 'Cron Arguments' 14 | errors: 15 | invalid-argument: 'The argument must be [single|schedule|all]' 16 | examples: 17 | - description: 'Cron list on the site' 18 | execution: | 19 | wordpress debug:cron all -------------------------------------------------------------------------------- /config/translations/en/debug.multisite.yml: -------------------------------------------------------------------------------- 1 | description: "List all sites in network available to a specific user" 2 | help: 'The multisite:debug list all known sites in network available to a specific user.' 3 | options: 4 | user-id: 'Wordpress User ID' 5 | messages: 6 | user-sites: 'List of sites associated to user %s [id: %s]' 7 | id: 'ID' 8 | name: 'Name' 9 | url: 'URL' 10 | path: 'Path' 11 | archived: 'Archived' 12 | mature: 'Mature' 13 | spam: 'Spam' 14 | deleted: 'Deleted' 15 | true: 'True' 16 | false: 'False' 17 | -------------------------------------------------------------------------------- /config/translations/en/debug.plugin.yml: -------------------------------------------------------------------------------- 1 | description: 'Display current plugins available for application' 2 | options: 3 | status: 'Plugin status [enabled|disabled]' 4 | messages: 5 | name: Name 6 | status: Status 7 | plugin-uri: 'Plugin URI' 8 | version: Version 9 | author: 'Author' 10 | author-url: 'Author website' 11 | 12 | -------------------------------------------------------------------------------- /config/translations/en/debug.roles.yml: -------------------------------------------------------------------------------- 1 | description: 'Displays current roles for the application' 2 | help: 'The debug:roles command helps you get current roles.' 3 | welcome: 'Welcome to the Wordpress roles debug' 4 | messages: 5 | role-id: 'Role ID' 6 | role-name: 'Role Name' 7 | examples: 8 | - description: 'Roles list on the site' 9 | execution: | 10 | wordpress debug:roles 11 | -------------------------------------------------------------------------------- /config/translations/en/debug.shortcode.yml: -------------------------------------------------------------------------------- 1 | description: 'Displays current shortcodes in your WordPress application.' 2 | arguments: 3 | messages: 4 | tag: 'Tag' 5 | callback: 'Callback function' -------------------------------------------------------------------------------- /config/translations/en/debug.theme.yml: -------------------------------------------------------------------------------- 1 | description: 'Display current themes available for application' 2 | options: 3 | status: 'Theme status [enabled|disabled]' 4 | messages: 5 | name: Name 6 | status: Status 7 | theme-uri: 'Theme URI' 8 | version: Version 9 | author: 'Author' 10 | author-url: 'Author website' 11 | 12 | -------------------------------------------------------------------------------- /config/translations/en/exec.yml: -------------------------------------------------------------------------------- 1 | description: 'Execute an external command.' 2 | arguments: 3 | bin: 'Executable command.' 4 | options: 5 | working-directory: 'The current working directory.' 6 | messages: 7 | success: 'Executed the command.' 8 | invalid-bin: 'Error executing the command.' 9 | missing-bin: 'Provide an executable command.' 10 | 11 | -------------------------------------------------------------------------------- /config/translations/en/generate.command.yml: -------------------------------------------------------------------------------- 1 | description: 'Generate commands for the console.' 2 | help: 'The generate:command command helps you generate a new command.' 3 | welcome: 'Welcome to the WP-Console Command generator' 4 | options: 5 | plugin: 'The name of the plugin (that will contain the command).' 6 | class: 'The Class that describes the command. (Must end with the word ''Command'').' 7 | name: 'The Command name.' 8 | questions: 9 | plugin: 'Enter the plugin name' 10 | class: 'Enter the Command Class. (Must end with the word ''Command'').' 11 | name: 'Enter the Command name.' 12 | -------------------------------------------------------------------------------- /config/translations/en/generate.cron.schedule.yml: -------------------------------------------------------------------------------- 1 | description: 'Generate a schedule cron.' 2 | help: 'The generate:cron:schedule command helps you generates a new Schedule cron.' 3 | welcome: 'Welcome to the Wordpress Schedule cron generator' 4 | options: 5 | plugin: 'The Plugin name' 6 | class-name: 'The user contact methods function name' 7 | timestamp: 'The first time you want the event to occur.' 8 | recurrence: 'How often the event should reoccur.' 9 | hook-name: 'The name of an action hook to execute.' 10 | hook-arguments: 'The arguments to pass to the hook function(s).' 11 | questions: 12 | plugin: 'The plugin name' 13 | class-name: 'Enter cron schedule function name' 14 | timestamp: 'Enter time to the event' 15 | recurrence: 'Enter the recurrence to the event' 16 | recurrence-name: 'Enter the recurrence name to the event' 17 | recurrence-label: 'Enter the recurrence label to the event' 18 | recurrence-interval: 'Enter the recurrence interval to the event' 19 | hook-name: 'Enter name of an action hook to execute' 20 | hook-arguments: 'Enter the list of arguments to pass to the hook function(s) separated by comma' 21 | warnings: 22 | plugin-unavailable: 'Warning The following plugin are not already available in your local environment "%s"' 23 | errors: 24 | directory-exists: 'The target directory "%s" is not empty.' 25 | interval-invalid: 'The interval must be a number' -------------------------------------------------------------------------------- /config/translations/en/generate.cron.single.yml: -------------------------------------------------------------------------------- 1 | description: 'Generate a single cron.' 2 | help: 'The generate:cron:single command helps you generates a new single cron.' 3 | welcome: 'Welcome to the Wordpress single cron generator' 4 | options: 5 | plugin: 'The Plugin name' 6 | class-name: 'The user contact methods function name' 7 | timestamp: 'The first time you want the event to occur.' 8 | recurrence: 'How often the event should reoccur.' 9 | hook-name: 'The name of an action hook to execute.' 10 | hook-arguments: 'The arguments to pass to the hook function(s).' 11 | questions: 12 | plugin: 'The plugin name' 13 | class-name: 'Enter cron single function name' 14 | timestamp: 'Enter date and time to execute (example: 2017-12-12 11:00:00)' 15 | hook-name: 'Enter name of an action hook to execute' 16 | hook-arguments: 'Enter the list of arguments to pass to the hook function(s) separated by comma' 17 | warnings: 18 | plugin-unavailable: 'Warning The following plugin are not already available in your local environment "%s"' 19 | errors: 20 | directory-exists: 'The target directory "%s" is not empty.' 21 | interval-invalid: 'The date must have this format [2017-12-12 11:00:00]' -------------------------------------------------------------------------------- /config/translations/en/generate.dashboard.widgets.yml: -------------------------------------------------------------------------------- 1 | description: 'Generate a new custom dashboard widgets.' 2 | help: 'The generate:dashboard:widgets command helps you generates a new dashboard widgets.' 3 | welcome: 'Welcome to the Wordpress dashboard widgets generator' 4 | options: 5 | plugin: 'The Plugin name.' 6 | class-name: 'The dashboard widget class name' 7 | id: 'ID used in the code identifying the widget.' 8 | title: 'The title that will be displayed in its heading.' 9 | render-function: 'The function that displays the widget content.' 10 | submission-function: 'The function that handles widget submission.' 11 | callback-arguments: 'Arguments array passed to the callback function. ["1" => "foo", "2" => "bar"]' 12 | text-domain: 'Translations file.' 13 | questions: 14 | plugin: 'The plugin name' 15 | class-name: 'Enter dashboard widget class name' 16 | id: 'Enter the widget id' 17 | title: 'Enter the widget name' 18 | render-function: 'Enter the function name to display the actual contents of your widget' 19 | submission-function: 'Do you want add function to handle submission of widget options (configuration) forms, and will also display the form elements.' 20 | callback-arguments: 'Enter the arguments to pass into your callback function. Follow this example: "1" => "foo", "2" => "bar"' 21 | text-domain: 'Enter the text-domain to translation file' 22 | warnings: 23 | plugin-unavailable: 'Warning The following plugin are not already available in your local environment "%s"' 24 | errors: 25 | directory-exists: 'The target directory "%s" is not empty.' 26 | interval-invalid: 'The interval must be a number' -------------------------------------------------------------------------------- /config/translations/en/generate.menu.yml: -------------------------------------------------------------------------------- 1 | description: 'Generate a menu.' 2 | help: 'The generate:menu command helps you generates a new menu.' 3 | welcome: 'Welcome to the Wordpress menu generator' 4 | options: 5 | plugin: 'The Plugin name' 6 | class-name: 'The menu class name' 7 | function-name: 'The function used in the code' 8 | menu-items: 'The menu items' 9 | child-themes: 'Support Child Themes' 10 | questions: 11 | plugin: 'Enter the plugin name' 12 | class-name: 'Enter menu class name' 13 | function-name: 'Enter function used in the code' 14 | menu-items: 15 | name: 'Enter menu name' 16 | description: 'Enter the description to menu item' 17 | menu-add-another: 'Do you want to add another menu item?' 18 | child-themes: 'Do you want add Support Child Themes?' 19 | warnings: 20 | plugin-unavailable: 'Warning The following plugin are not already available in your local environment "%s"' 21 | errors: 22 | directory-exists: 'The target directory "%s" is not empty.' -------------------------------------------------------------------------------- /config/translations/en/generate.metabox.yml: -------------------------------------------------------------------------------- 1 | description: 'Generate a metabox.' 2 | help: 'The generate:metabox command helps you generates a new metabox.' 3 | welcome: 'Welcome to the Wordpress metabox generator' 4 | options: 5 | plugin: 'The Plugin name' 6 | class-name: 'The metabox class name' 7 | metabox-id: 'The metabox id' 8 | title: 'The title of the metabox' 9 | callback-function: 'metabox callback function' 10 | screen: 'metabox screen' 11 | page-location: 'metabox page location' 12 | priority: 'metabox priority' 13 | metabox-items: 'The metabox items' 14 | wp-nonce: 'wp nonce for fields' 15 | auto-save: 'Auto save?' 16 | questions: 17 | plugin: 'Enter the plugin name' 18 | class-name: 'Enter metabox class name' 19 | metabox-id: 'Enter the metabox id (lowercase and underscore only)' 20 | title: 'Enter the title of the metabox' 21 | callback-function: 'Enter metabox callback function' 22 | screen: 'Enter metabox screen' 23 | page-location: 'Enter metabox page location' 24 | priority: 'Enter metabox priority' 25 | metabox-items: 26 | metabox-add: 'Do you want to generate the metabox item' 27 | type: 'Enter field type' 28 | id: 'Enter field id' 29 | label: 'Enter field label' 30 | description: 'Enter field description' 31 | placeholder: 'Enter field placeholder' 32 | default-value: 'Enter field default value' 33 | src_image: 'Enter the image path' 34 | metabox-items-add-another: 'Do you want to add another item metabox' 35 | multiple-label: 'Enter the label for option for ' 36 | multiple-value: 'Enter the value for option for ' 37 | multiple-options-add: 'Do you want to add another option for %option%' 38 | wp-nonce: 'Do you want add nonce?' 39 | auto-save: 'Do you want add auto save?' 40 | warnings: 41 | module-unavailable: 'Warning The following modules are not already available in your local environment "%s"' 42 | errors: 43 | invalid-core: 'The core version "%s" is invalid.' 44 | directory-exists: 'The target directory "%s" is not empty.' -------------------------------------------------------------------------------- /config/translations/en/generate.plugin.yml: -------------------------------------------------------------------------------- 1 | description: 'Generate a plugin.' 2 | help: 'The generate:plugin command helps you generates a new plugin.' 3 | welcome: 'Welcome to the Wordpress plugin generator' 4 | options: 5 | plugin: 'The Plugin name' 6 | machine-name: 'The machine name (lowercase and underscore only)' 7 | plugin-path: 'The path of the plugin' 8 | description: 'Plugin description' 9 | test: 'Generate a test class' 10 | author: 'Plugin author' 11 | author-url: 'Plugin author website' 12 | activate: 'Generate an activation function class' 13 | deactivate: 'Generate a deactivation function class' 14 | uninstall: 'Generate the uninstall file' 15 | questions: 16 | plugin: 'Enter the new plugin name' 17 | machine-name: 'Enter the plugin machine name' 18 | plugin-path: 'Enter the plugin Path' 19 | description: 'Enter plugin description' 20 | author: 'Enter plugin author' 21 | author-url: 'Enter Plugin author website' 22 | activate: 'Do you want to generate an activation function class' 23 | deactivate: 'Do you want to generate a deactivation function class' 24 | uninstall: 'Do you want to generate the uninstall file' 25 | warnings: 26 | module-unavailable: 'Warning The following plugins are not already available in your local environment "%s"' 27 | errors: 28 | invalid-core: 'The core version "%s" is invalid.' 29 | directory-exists: 'The target directory "%s" is not empty.' 30 | -------------------------------------------------------------------------------- /config/translations/en/generate.quicktag.yml: -------------------------------------------------------------------------------- 1 | description: 'Generate a quicktag.' 2 | help: 'The generate:quicktag command helps you generates a new quicktag.' 3 | welcome: 'Welcome to the Wordpress quicktag generator' 4 | options: 5 | extension: 'The name of the Extension (that will contain the command).' 6 | extension-type: 'The extension type.' 7 | function-name: 'The function used in the code' 8 | quicktag-items: 'The quicktag items.' 9 | questions: 10 | extension: 'Enter the extension name' 11 | extension-type: 'Enter the extension type' 12 | function-name: 'Enter function used in the code' 13 | quicktag-items: 14 | id: 'Enter the html id for the button.' 15 | display: 'Enter the html value for the button.' 16 | starting-tag: 'Enter the HTML starting tag or a callback function.' 17 | ending-tag: 'Enter the HTML ending tag.' 18 | key: 'Enter the shortcut access key for the button.' 19 | title: 'Enter the html title value for the button.' 20 | priority: 'Enter the button position in the toolbar.' 21 | instance: 'Enter the limit the button to a specific instance of quicktags.' 22 | quicktag-add-another: 'Do you want to add another quicktag item?' 23 | warnings: 24 | plugin-unavailable: 'Warning The following plugin are not already available in your local environment "%s"' 25 | errors: 26 | directory-exists: 'The target directory "%s" is not empty.' -------------------------------------------------------------------------------- /config/translations/en/generate.register.script.yml: -------------------------------------------------------------------------------- 1 | description: 'Generate a register script on your theme or plugin.' 2 | help: 'The generate:register:script command helps you generates a new Register script.' 3 | welcome: 'Welcome to the Wordpress Register script generator' 4 | options: 5 | extension: 'The name of the Extension (that will contain the command).' 6 | extension-type: 'The extension type.' 7 | function-name: 'The register script function name' 8 | hook: 'The hook to enqueue the register script' 9 | script-items: 'Register script items' 10 | questions: 11 | extension: 'Enter the extension name' 12 | extension-type: 'Enter the extension type' 13 | type: 'Enter the register type' 14 | function-name: 'Enter register function' 15 | hook: 'Choice the hook to display the script' 16 | script-items: 17 | name: 'Enter the name used in the code as a script handle' 18 | url: 'Enter the URL to the script' 19 | dependencies: 'Enter the dependencies separated list of scripts to load before this script (use commas)' 20 | version: 'Enter script version number' 21 | location: 'Enter the location to load the script' 22 | deregister: 'Do you want to add deregister the script first' 23 | enqueue: 'Do you want to add enqueue the script' 24 | script-add-another: 'Do you want to add another register script' 25 | warnings: 26 | module-unavailable: 'Warning The following modules are not already available in your local environment "%s"' 27 | errors: 28 | invalid-core: 'The core version "%s" is invalid.' 29 | directory-exists: 'The target directory "%s" is not empty.' -------------------------------------------------------------------------------- /config/translations/en/generate.register.style.yml: -------------------------------------------------------------------------------- 1 | description: 'Generate a register style on your theme or plugin.' 2 | help: 'The generate:register:style command helps you generates a new Register style.' 3 | welcome: 'Welcome to the Wordpress Register style generator' 4 | options: 5 | extension: 'The name of the Extension (that will contain the command).' 6 | extension-type: 'The extension type.' 7 | function-name: 'The register style function name' 8 | hook: 'The hook to enqueue the register style' 9 | style-items: 'Register styles items' 10 | questions: 11 | extension: 'Enter the extension name' 12 | extension-type: 'Enter the extension type' 13 | type: 'Enter the register type' 14 | function-name: 'Enter register function' 15 | hook: 'Choice the hook to display the style' 16 | style-items: 17 | name: 'Enter the name used in the code as a stylesheet handle' 18 | url: 'Enter the URL to the style' 19 | dependencies: 'Enter the dependencies separated list of stylesheets to load before this style (use commas)' 20 | version: 'Enter stylesheets version number' 21 | media: 'Enter the stylesheet media type' 22 | deregister: 'Do you want to add deregister the style first' 23 | enqueue: 'Do you want to add enqueue the style' 24 | style-add-another: 'Do you want to add another register style' 25 | warnings: 26 | module-unavailable: 'Warning The following modules are not already available in your local environment "%s"' 27 | errors: 28 | invalid-core: 'The core version "%s" is invalid.' 29 | directory-exists: 'The target directory "%s" is not empty.' -------------------------------------------------------------------------------- /config/translations/en/generate.settings.page.yml: -------------------------------------------------------------------------------- 1 | description: 'Generate a new custom settings page.' 2 | help: 'The generate:settings:page command helps you generates a new Settings page.' 3 | welcome: 'Welcome to the Wordpress Settings page generator' 4 | options: 5 | plugin: 'The Plugin name.' 6 | class-name: 'The settings page function name' 7 | setting-group: 'Name of the settings group used in register_setting' 8 | setting-name: 'Name of the options saved in the database.' 9 | page-title: 'Setting Page title' 10 | menu-title: 'Admin sidebar menu title.' 11 | capability: 'Access permission.' 12 | slug: 'Unique slug for the admin page' 13 | callback-function: 'The name of the layout function.' 14 | section-field: 'Section to add fields.' 15 | fields: 'Setting Page fields.' 16 | text-domain: 'Translations file.' 17 | questions: 18 | plugin: 'The plugin name' 19 | class-name: 'Enter settings page class name' 20 | setting-group: 'Enter the name of the settings group used in register_setting' 21 | setting-name: 'Enter the name of the options saved in the database' 22 | page-title: 'Enter the setting Page title' 23 | menu-title: 'Enter the admin sidebar menu title' 24 | capability: 'Choice the capability to give access permission' 25 | slug: 'Enter the slug for the admin page' 26 | callback-function: 'Enter the name of the layout function' 27 | section-add: 'Do you want add section to fields' 28 | section-name: 'Enter the name to the new section' 29 | section-add-another: 'Do you want to add another section' 30 | fields: 31 | fields-add: 'Do you want to generate the fields' 32 | type: 'Enter field type' 33 | id: 'Enter field id' 34 | label: 'Enter field label' 35 | description: 'Enter field description' 36 | placeholder: 'Enter field placeholder' 37 | default-value: 'Enter field default value' 38 | src_image: 'Enter the image path' 39 | section-id: 'Choice the section to add the field' 40 | fields-add-another: 'Do you want to add another field' 41 | multiple-label: 'Enter the label for option for ' 42 | multiple-value: 'Enter the value for option for ' 43 | multiple-options-add: 'Do you want to add another option for ' 44 | text-domain: 'Enter the text-domain to translation file' 45 | warnings: 46 | plugin-unavailable: 'Warning The following plugin are not already available in your local environment "%s"' 47 | errors: 48 | directory-exists: 'The target directory "%s" is not empty.' 49 | interval-invalid: 'The interval must be a number' -------------------------------------------------------------------------------- /config/translations/en/generate.shortcode.yml: -------------------------------------------------------------------------------- 1 | description: 'Generate a shortcode.' 2 | help: 'The generate:shortcode command helps you generates a new shortcode.' 3 | welcome: 'Welcome to the Wordpress shortcode generator' 4 | options: 5 | plugin: 'The Plugin name' 6 | tag: 'The shortcode tag name' 7 | questions: 8 | plugin: 'Enter the plugin name' 9 | tag: 'Enter the tag name' 10 | warnings: 11 | tag-required: 'Tag is required' 12 | tag-unavailable: 'Warning The following tag is already in usage in your environment "%s"' 13 | tag-transformed: 'Tag "%s" was transformed to "%s" to avoid syntax issues' 14 | errors: 15 | -------------------------------------------------------------------------------- /config/translations/en/generate.sidebar.yml: -------------------------------------------------------------------------------- 1 | description: 'Generate a sidebar.' 2 | help: 'The generate:sidebar command help you generate a new sidebar.' 3 | welcome: 'Welcome to the Wordpress sidebar generator' 4 | options: 5 | plugin: 'The Plugin name' 6 | class-name: 'The sidebar class name' 7 | function-name: 'The function used in the code' 8 | sidebar-items: 'The sidebar items' 9 | description: 'The description to sidebar item' 10 | child-themes: 'Support Child Themes' 11 | questions: 12 | plugin: 'Enter the plugin name' 13 | class-name: 'Enter sidebar class name' 14 | function-name: 'Enter function used in the code' 15 | sidebar-items: 16 | id: 'Enter sidebar id' 17 | class: 'Enter sidebar class' 18 | name: 'Enter sidebar name' 19 | description: 'Enter sidebar description' 20 | sidebar-add-another: 'Do you want to add another sidebar item?' 21 | child-themes: 'Do you want add Support Child Themes?' 22 | warnings: 23 | plugin-unavailable: 'Warning The following plugin are not already available in your local environment "%s"' 24 | errors: 25 | directory-exists: 'The target directory "%s" is not empty.' -------------------------------------------------------------------------------- /config/translations/en/generate.taxonomy.yml: -------------------------------------------------------------------------------- 1 | description: 'Generate a custom taxonomy.' 2 | help: 'The generate:taxonomy command helps you generates a new custom taxonomy.' 3 | welcome: 'Welcome to the Wordpress taxonomy generator' 4 | options: 5 | plugin: 'The Plugin name' 6 | class-name: 'The taxonomy class name' 7 | function-name: 'The function used in the code' 8 | taxonomy_key: 'Key used in the code' 9 | singular-name: 'Taxonomy singular name' 10 | plural-name: 'Taxonomy plural name' 11 | post-type: 'The post type for taxonomy' 12 | hierarchical: 'Hierarchical taxonomy allows descendants' 13 | labels: 'Labels for taxonomy' 14 | visibility: 'Visibility the taxonomy' 15 | permalinks: 'Permalinks for taxonomy' 16 | capabilities: 'User capabilities to manage taxonomy' 17 | rest: 'REST API for taxonomy' 18 | child-themes: 'Support Child Themes' 19 | update-count-callback: 'A function name that will be called when the count of an associated Post Type is updated' 20 | questions: 21 | plugin: 'Enter the plugin name' 22 | field-metabox-add: 'Do you want to add another field Metabox' 23 | class-name: 'Enter taxonomy class name' 24 | function-name: 'Enter function used in the code' 25 | taxonomy_key: 'Enter taxonomy key used in the code' 26 | singular-name: 'Enter Taxonomy singular name' 27 | plural-name: 'Enter Taxonomy plural name' 28 | post-type: 'Enter The post type for taxonomy' 29 | hierarchical: 'Do you want ad Hierarchical taxonomy allows descendants?' 30 | labels: 'Do you want add Labels for taxonomy?' 31 | labels-add: 'Do you want add this label: ' 32 | labels-edit: 'Enter the name for: ' 33 | visibility: 'Do you want edit Visibility the taxonomy?' 34 | visibility-options: 'Show this Post Type in ' 35 | permalinks: 'Do you want add custom Permalinks for taxonomy?' 36 | permalinks-slug: "Enter slug's name" 37 | permalinks-options: 'Do you want add ' 38 | capabilities: 'Do you want edit user capabilities to manage taxonomy?' 39 | capabilities-options: 'Enter ' 40 | rest: 'Do you want add REST API for taxonomy?' 41 | show-rest: 'Include the taxonomy in the REST API?' 42 | rest-base: 'Enter rest base' 43 | rest-controller-class: 'Enter rest controller base' 44 | child-themes: 'Do you want add Support Child Themes?' 45 | update-count-callback-add: 'Do you want add a function by if a post type is updated' 46 | update-count-callback: 'Enter a function name that will be called when the count of an associated Post Type is updated' 47 | warnings: 48 | module-unavailable: 'Warning The following modules are not already available in your local environment "%s"' 49 | errors: 50 | invalid-core: 'The core version "%s" is invalid.' 51 | directory-exists: 'The target directory "%s" is not empty.' -------------------------------------------------------------------------------- /config/translations/en/generate.theme.yml: -------------------------------------------------------------------------------- 1 | description: 'Generate a theme.' 2 | help: 'The generate:theme command helps you generates a new plugin.' 3 | welcome: 'Welcome to the Wordpress theme generator' 4 | options: 5 | theme: 'The Theme name' 6 | machine-name: 'The machine name (lowercase and underscore only)' 7 | theme-path: 'The path of the theme' 8 | description: 'Theme description' 9 | test: 'Generate a test class' 10 | author: 'Theme author' 11 | author-url: 'Theme author website' 12 | template-header: 'Header template' 13 | template-footer: 'Footer template' 14 | template-sidebar: 'Sidebar template' 15 | template-front-page: 'Front page template' 16 | template-home: 'Home template' 17 | template-single: 'Single template' 18 | template-page: 'Page template' 19 | template-category: 'Category template' 20 | template-comments: 'Comments template' 21 | template-search: 'Search template' 22 | template-404: '404 template' 23 | template-functions: 'Functions template' 24 | screenshot: 'Screenshot of the theme (Must have 1200px 900px resolution)' 25 | questions: 26 | theme: 'Enter the new theme name' 27 | machine-name: 'Enter the theme machine name' 28 | theme-path: 'Enter the theme Path' 29 | description: 'Enter theme description' 30 | author: 'Enter theme author' 31 | author-url: 'Enter theme author website' 32 | template-header: 'Do you want add header template?' 33 | template-footer: 'Do yo want add footer template?' 34 | template-sidebar: 'Do you want add sidebar template?' 35 | template-front-page: 'Do you want add front page template?' 36 | template-home: 'Do you want add home template?' 37 | template-single: 'Do you want add single template?' 38 | template-page: 'Do you want add page template?' 39 | template-category: 'Do you want add category template?' 40 | template-comments: 'Do you want add comments template?' 41 | template-search: 'Do you want add search template?' 42 | template-404: 'Do you want add 404 template?' 43 | template-functions: 'Do you want add functions template?' 44 | screenshot: 'Enter the screenshot path (Must have 1200px 900px resolution)' 45 | test: 'Do you want to generate a unit test class' 46 | warnings: 47 | module-unavailable: 'Warning The following modules are not already available in your local environment "%s"' 48 | errors: 49 | invalid-core: 'The core version "%s" is invalid.' 50 | directory-exists: 'The target directory "%s" is not empty.' 51 | -------------------------------------------------------------------------------- /config/translations/en/generate.toolbar.yml: -------------------------------------------------------------------------------- 1 | description: 'Generate a toolbar.' 2 | help: 'The generate:menu command helps you generates a new toolbar.' 3 | welcome: 'Welcome to the Wordpress toolbar generator' 4 | options: 5 | plugin: 'The Plugin name' 6 | function-name: 'The toolbar function name' 7 | menu-items: 'The menu items' 8 | questions: 9 | plugin: 'The plugin name.' 10 | function-name: 'Enter toolbar function name' 11 | menu-items: 12 | id: 'Enter the ID of the menu' 13 | parent: 'Enter the ID of the parent menu' 14 | title: 'Enter Text/HTML shown in the Toolbar' 15 | href: 'Enter the "href" attribute for the link. If none set the menu will be a text menu' 16 | group: 'Choose the option for menu group' 17 | menu-add-another: 'Do you want to add another menu to toolbar?' 18 | meta-add: 'Do you want to add meta to menu?' 19 | html: 'Enter the HTML used for the menu ' 20 | class: 'Enter the class attribute for the list item containing the link or text. ' 21 | target: 'Enter the target attribute for the link. Will be set if "href" is present. ' 22 | onclick: 'Enter the onclick attribute for the link. Will be set if "href" is present. ' 23 | title: 'Enter the title attribute. Will be set to the link or a div containing a text node. ' 24 | tabindex: 'Enter the tabindex attribute. Will be set to the link or a div containing a text node. ' 25 | warnings: 26 | plugin-unavailable: 'Warning The following plugin are not already available in your local environment "%s"' 27 | errors: 28 | directory-exists: 'The target directory "%s" is not empty.' -------------------------------------------------------------------------------- /config/translations/en/generate.user.contact.methods.yml: -------------------------------------------------------------------------------- 1 | description: 'Generate a User contact methods.' 2 | help: 'The generate:user:contactmethods command helps you generates a new User contact methods.' 3 | welcome: 'Welcome to the Wordpress User contact methods generator' 4 | options: 5 | plugin: 'The Plugin name' 6 | function-name: 'The user contact methods function name' 7 | methods-items: 'The methods items' 8 | questions: 9 | plugin: 'The plugin name.' 10 | function-name: 'Enter function name' 11 | methods: 'Do you want to add methods to user contact methods?' 12 | methods-items: 13 | name: 'Enter the name of the method' 14 | description: 'Enter the description of the method' 15 | methods-add-another: 'Do you want to add another methods to user contact methods?' 16 | warnings: 17 | plugin-unavailable: 'Warning The following plugin are not already available in your local environment "%s"' 18 | errors: 19 | directory-exists: 'The target directory "%s" is not empty.' -------------------------------------------------------------------------------- /config/translations/en/generate.widget.yml: -------------------------------------------------------------------------------- 1 | description: 'Generate a widgets.' 2 | help: 'The generate:widget command helps you generates a new Widget.' 3 | welcome: 'Welcome to the Wordpress Widget generator' 4 | options: 5 | plugin: 'The Plugin name' 6 | class-name: 'The widget class name' 7 | widget-id: 'The widget id (lowercase and underscore only)' 8 | title: 'The title of the widget' 9 | description: 'The widget description' 10 | widget-class-name: 'The widget class name' 11 | widget-items: 'The widget items' 12 | questions: 13 | plugin: 'Enter the plugin name' 14 | class-name: 'Enter widget class name' 15 | widget-id: 'Enter the widget id' 16 | title: 'Enter the title of the widget' 17 | description: 'Enter widget description' 18 | widget-class-name: 'Enter widget class name' 19 | widget-items: 20 | widget-add: 'Do you want to generate the widget items' 21 | type: 'Enter field type' 22 | id: 'Enter field id' 23 | label: 'Enter field label' 24 | description: 'Enter field description' 25 | placeholder: 'Enter field placeholder' 26 | default-value: 'Enter field default value' 27 | src_image: 'Enter the image path' 28 | widget-items-add-another: 'Do you want to add another widget item' 29 | multiple-label: 'Enter the label for option for ' 30 | multiple-value: 'Enter the value for option for ' 31 | multiple-options-add: 'Do you want to add another option for %option%' 32 | warnings: 33 | module-unavailable: 'Warning The following modules are not already available in your local environment "%s"' 34 | errors: 35 | invalid-core: 'The core version "%s" is invalid.' 36 | directory-exists: 'The target directory "%s" is not empty.' -------------------------------------------------------------------------------- /config/translations/en/help.yml: -------------------------------------------------------------------------------- 1 | description: 'Displays help for a command' 2 | help: | 3 | The help command displays help for a given command: 4 | 5 | wp-console help list 6 | 7 | You can also output the help in other formats by using the --format option: 8 | 9 | wp-console help --format=xml list 10 | 11 | To display the list of available commands, please use the list command. 12 | arguments: 13 | command-name: 'The command name' 14 | options: 15 | xml: 'To output list as XML' 16 | raw: 'To output raw command list' 17 | format: 'The output format (txt, xml, json, or md)' 18 | messages: 19 | deprecated: 'The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead' 20 | -------------------------------------------------------------------------------- /config/translations/en/init.yml: -------------------------------------------------------------------------------- 1 | description: 'Copy configuration files.' 2 | options: 3 | destination: 'Destination directory to copy files' 4 | override: 'Override configurations files flag' 5 | autocomplete: 'Autocomplete tool files flag.' 6 | questions: 7 | destination: 'Select destination to copy configuration' 8 | autocomplete: 'Generate autocomplete files' 9 | language: 'Select language' 10 | temp: 'Enter temporary file path' 11 | learning: 'Shows information for learning purposes?' 12 | generate-inline: 'Show inline representation of the executed command?' 13 | generate-chain: 'Show chain representation of the executed command?' 14 | statistics: 'Allow to collect and send this information to wordpressConsole server?' 15 | messages: 16 | statistics: | 17 | Help us improve the Wordpress Console project, providing information about how you use the application. 18 | The colleted information at "%s", would be: 19 | 20 | - Language used 21 | - Command executed 22 | - Lines of code generated if is a generator command 23 | 24 | You could read about our privacy policy at http://wordpressconsole.com/privacy. 25 | statistics-disable: | 26 | You can always disable the sending of information using the following command 27 | 28 | wordpress settings:set statistics.enabled false 29 | -------------------------------------------------------------------------------- /config/translations/en/list.yml: -------------------------------------------------------------------------------- 1 | description: 'Lists all available commands' 2 | help: | 3 | The list command lists all commands: 4 | wp list 5 | You can also display the commands for a specific namespace: 6 | wp-console list test 7 | You can also output the information in other formats by using the --format option: 8 | wp-console list --format=xml 9 | It's also possible to get raw list of commands (useful for embedding command runner): 10 | wp-console list --raw 11 | arguments: 12 | namespace: 'The namespace name' 13 | options: 14 | xml: 'To output list as XML' 15 | raw: 'To output raw command list' 16 | format: 'The output format (txt, xml, json, or md)' 17 | 18 | messages: 19 | usage: "Usage:\n" 20 | usage_details: " command [options] [arguments]\n\n" 21 | arguments: 'Arguments:' 22 | options: 'Options:' 23 | help: 'Help:' 24 | comment: 'Available commands for the "%s" namespace:' 25 | available-commands: 'Available commands:' 26 | -------------------------------------------------------------------------------- /config/translations/en/multisite.install.yml: -------------------------------------------------------------------------------- 1 | description: 'Install a Wordpress multisite network' 2 | arguments: 3 | options: 4 | subdomains: 'If passed, the network will use subdomains, instead of subdirectories.' 5 | network-title: 'Wordpress network title' 6 | network-mail: 'Wordpress network administrator mail' 7 | network-base: 'Wordpress network base path after the domain name that each site url in the network' 8 | questions: 9 | subdomains: 10 | question: 'Provide your Wordpress multisite type' 11 | subdomains: 'Sub-domains' 12 | subdirectories: 'Sub-directories' 13 | network-title: 'Provide your Wordpress network title' 14 | network-mail: 'Provide your Wordpress network mail' 15 | network-base: 'Provide your Wordpress network base path' 16 | messages: 17 | already-multisite: "Wordpress is already multisite" 18 | invalid-domain: "Multisite with subdomains cannot be configured when domain is '%s" 19 | installing: 'Starting Wordpress multisite install process' 20 | installed: 'Your Wordpress multisite installation was completed successfully' 21 | setup-tables: 'Set up multisite database tables' 22 | no-wildcard-dns: 'Wildcard DNS may not be configured correctly' 23 | error-installing-multisite: "Error converting Wordpress installation in mulsite network" 24 | 25 | -------------------------------------------------------------------------------- /config/translations/en/multisite.new.yml: -------------------------------------------------------------------------------- 1 | description: 'Add New Site a Wordpress multisite network' 2 | arguments: 3 | options: 4 | network-url: 'Wordpress network url' 5 | network-title: 'Wordpress network title' 6 | network-mail: 'Wordpress network administrator mail' 7 | network-base: 'Wordpress network base path after the domain name that each site url in the network' 8 | questions: 9 | subdomain-example-network-url: '[YOUR-SUBDOMAIN-HERE]' 10 | subdirectory-example-network-url: '[YOUR-SUBDIRECTORY-HERE]' 11 | network-url: 'Provide your Wordpress network url' 12 | network-title: 'Provide your Wordpress network title' 13 | network-mail: 'Provide your Wordpress network mail' 14 | network-base: 'Provide your Wordpress network base path' 15 | messages: 16 | user-conflict: 'The domain or path entered conflicts with an existing username.' 17 | new-site-created: '[%s] New Site Created' 18 | new-site-created-by: | 19 | New site created by %s 20 | 21 | Address= $s 22 | Name= %s 23 | email-front: 'From: Site Admin" <%s>' 24 | content-dir-created: 'Wordpress content directory was created successfully' 25 | created: 'New Site was created sucessfully' 26 | 27 | -------------------------------------------------------------------------------- /config/translations/en/plugin.activate.yml: -------------------------------------------------------------------------------- 1 | description: 'Activate plugins or plugin in the application' 2 | arguments: 3 | plugin: 'Plugin or plugins to be activated should be separated by a space' 4 | options: 5 | questions: 6 | plugin: 'Plugin name (press to stop adding plugins)' 7 | invalid-plugin: 'Invalid plugin "%s"' 8 | messages: 9 | nothing: 'Nothing to do. All plugin are already activated' 10 | success: 'The following plugin(s) were activated successfully: "%s"' 11 | -------------------------------------------------------------------------------- /config/translations/en/plugin.deactivate.yml: -------------------------------------------------------------------------------- 1 | description: 'Deactivate plugins or plugin in the application' 2 | arguments: 3 | plugin: 'Plugin or plugins to be deactivated should be separated by a space' 4 | options: 5 | questions: 6 | plugin: 'Plugin name (press to stop adding plugins)' 7 | invalid-plugin: 'Invalid plugin "%s"' 8 | messages: 9 | nothing: 'Nothing to do. All plugin are already deactivated' 10 | success: 'The following plugin(s) were deactivated successfully: "%s"' 11 | -------------------------------------------------------------------------------- /config/translations/en/role.delete.yml: -------------------------------------------------------------------------------- 1 | description: 'Delete roles for the application' 2 | help: 'The role:delete command helps you delete roles.' 3 | welcome: 'Welcome to the Wordpress role delete' 4 | arguments: 5 | rolename: 'Roles name to be deleted' 6 | messages: 7 | role-id: 'Role Id' 8 | role-name: 'Role Name' 9 | role-created: 'Roles was deleted successfully' 10 | examples: 11 | - description: 'Delete role specifying rolename' 12 | execution: | 13 | wordpress role:delete moderator 14 | -------------------------------------------------------------------------------- /config/translations/en/role.new.yml: -------------------------------------------------------------------------------- 1 | description: 'Create roles for the application' 2 | help: 'The role:new command helps you create roles.' 3 | welcome: 'Welcome to the Wordpress role create' 4 | arguments: 5 | rolename: 'Role name to be created' 6 | machine-name: 'Role machine name' 7 | options: 8 | capabilities: 'Role capabilities to be created' 9 | questions: 10 | rolename: 'Role name to be created' 11 | machine-name: 'Enter role machine name' 12 | capabilities: 'Do you want add role capabilities' 13 | messages: 14 | capabilities-menu: 15 | showAll: 'Show all capabilities' 16 | import: 'Import capabilities from a role' 17 | role-id: 'Role Id' 18 | role-name: 'Role Name' 19 | role-created: 'Role "%s" was created successfully' 20 | invalid-machine-name: 'The machine name is already exist' 21 | examples: 22 | - description: 'Create role specifying rolename and machine-name' 23 | execution: | 24 | wordpress role:new moderator moderator 25 | -------------------------------------------------------------------------------- /config/translations/en/self-update.yml: -------------------------------------------------------------------------------- 1 | description: 'Update project to the latest version.' 2 | help: 'Update project to the latest version.' 3 | options: 4 | major: 'Update to a new major version, if available.' 5 | manifest: 'Override the manifest file path.' 6 | current-version: 'Override the version to update from.' 7 | questions: 8 | update: 'Update from version "%s" to version "%s".' 9 | messages: 10 | not-phar: 'This instance of the CLI was not installed as a Phar archive.' 11 | update: 'Updating to version "%s".' 12 | success: 'Updated from version "%s" to version "%s".' 13 | check: 'Checking for updates from version: "%s"' 14 | current-version: 'The latest version "%s", was already installed on your system.' 15 | instructions: | 16 | Update using: composer global update 17 | Or you can switch to a Phar install recommended 18 | composer global remove wp-console/console 19 | curl https://wp-console.org/installer -L -o wp-console.phar 20 | 21 | -------------------------------------------------------------------------------- /config/translations/en/settings.set.yml: -------------------------------------------------------------------------------- 1 | description: 'Change a specific setting value in WordpressConsole config file' 2 | arguments: 3 | name: 'Setting name in YAML flatten format to set a value in Wordpress Console config file' 4 | value: 'Setting value to set in Wordpress Console config file' 5 | messages: 6 | error-parsing: 'An error occurs during parsing of YAML file "%s".' 7 | error-generating: 'Error setting new language in config file.' 8 | error-writing: 'Error writing config file.' 9 | success: 'Setting "%s" was set to "%s"' 10 | missing-file: 'The "%s" config file is missing, try executing `drupal init`' 11 | missing-language: 'Provided language: "%s", not found' 12 | examples: 13 | - description: 'Set application language setting value to "es"' 14 | execution: 15 | wordpress settings:set language es 16 | -------------------------------------------------------------------------------- /config/translations/en/site.install.yml: -------------------------------------------------------------------------------- 1 | description: 'Install a Wordpress project' 2 | arguments: 3 | langcode: 'Wordpress language' 4 | db-type: 'Wordpress Database type to be used in install' 5 | db-file: 'Wordpress Database file to be used in install' 6 | site-name: 'Wordpress site name' 7 | account-mail: 'Wordpress site mail' 8 | account-name: 'Wordpress administrator account name' 9 | account-mail: 'Wordpress administrator account mail' 10 | account-pass: 'Wordpress administrator account password' 11 | options: 12 | db-url: 'Wordpress Database url' 13 | db-type: 'Wordpress Database type' 14 | db-host: 'Database Host' 15 | db-name: 'Database Name' 16 | db-user: 'Database User' 17 | db-pass: 'Database Pass' 18 | db-prefix: 'Database Prefix' 19 | db-port: 'Database Port' 20 | questions: 21 | profile: 'Select Wordpress profile to be installed' 22 | langcode: 'Select language for your Wordpress' 23 | db-type: 'Select Wordpress Database type to be used in install' 24 | site-url: 'Provide your Wordpress URL' 25 | site-name: 'Provide your Wordpress site name' 26 | site-mail: 'Provide your Wordpress site mail' 27 | account-name: 'Provide your Wordpress administrator account name' 28 | account-mail: 'Provide your Wordpress administrator account mail' 29 | account-pass: 'Provide your Wordpress administrator account password' 30 | db-type: 'Wordpress Database type' 31 | db-host: 'Database Host' 32 | db-name: 'Database Name' 33 | db-user: 'Database User' 34 | db-pass: 'Database Pass' 35 | db-prefix: 'Database Prefix' 36 | db-port: 'Database Port' 37 | messages: 38 | installing: 'Starting Wordpress install process' 39 | installed: 'Your Wordpress installation was completed successfully' 40 | using-current-database: 'Using "%s" database with name "%s" and user "%s"' 41 | already-installed: 'Wordpress is already installed, try dropping your database executing database:drop or install executing site:install --force --no-interaction' 42 | sites-backup: 'The sites.php file has temporarily been renamed to backup.sites.php while Wordpress installs.' 43 | sites-restore: 'The backup of sites.php has been been restored to sites.php.' 44 | invalid-multisite: 'Invalid multisite, please create multisite using command wp-console multisite:new %s --site-uri=%s' 45 | -------------------------------------------------------------------------------- /config/translations/en/snippet.yml: -------------------------------------------------------------------------------- 1 | description: 'Snippet command' 2 | options: 3 | file: 'User defined file containing code to get executed.' 4 | code: 'Code to get executed.' 5 | show-code: 'Show code to get executed.' 6 | examples: 7 | - description: 'Providing a file option using full path. (DEPRECATED)' 8 | execution: | 9 | wp-console snippet \ 10 | --file="/path/to/file/chain-file.yml" 11 | 12 | 13 | -------------------------------------------------------------------------------- /config/translations/en/theme.activate.yml: -------------------------------------------------------------------------------- 1 | description: 'Activate theme in the application' 2 | arguments: 3 | theme: 'Theme to be activated should be separated by a space' 4 | options: 5 | questions: 6 | theme: 'Theme name (press to stop adding plugins)' 7 | invalid-theme: 'Invalid theme "%s"' 8 | messages: 9 | nothing: 'Nothing to do. All theme are already activated' 10 | success: 'The following theme were activated successfully: "%s"' 11 | -------------------------------------------------------------------------------- /phpqa.yml: -------------------------------------------------------------------------------- 1 | application: 2 | method: 3 | git: 4 | enabled: true 5 | exception: false 6 | composer: 7 | enabled: true 8 | exception: false 9 | analyzer: 10 | parallel-lint: 11 | enabled: true 12 | exception: true 13 | options: 14 | e: 'php' 15 | exclude: vendor/ 16 | arguments: 17 | php-cs-fixer: 18 | enabled: true 19 | exception: false 20 | options: 21 | level: psr2 22 | arguments: 23 | prefixes: 24 | - fix 25 | postfixes: 26 | phpcbf: 27 | enabled: true 28 | exception: false 29 | options: 30 | standard: PSR2 31 | severity: 0 32 | ignore: /vendor 33 | arguments: 34 | - '-n' 35 | phpcs: 36 | enabled: false 37 | exception: false 38 | options: 39 | standard: PSR2 40 | severity: 0 41 | ignore: /vendor 42 | arguments: 43 | - '-n' 44 | phpmd: 45 | enabled: false 46 | exception: false 47 | options: 48 | arguments: 49 | prefixes: 50 | postfixes: 51 | - 'text' 52 | - 'cleancode' 53 | phploc: 54 | enabled: false 55 | exception: false 56 | phpcpd: 57 | enabled: false 58 | exception: false 59 | phpdcd: 60 | enabled: false 61 | exception: false 62 | phpunit: 63 | enabled: false 64 | exception: true 65 | file: 66 | configuration: phpunit.xml.dist 67 | single-execution: true 68 | options: 69 | arguments: -------------------------------------------------------------------------------- /services-install.yml: -------------------------------------------------------------------------------- 1 | services: 2 | # Installer services 3 | console.site_install: 4 | class: WP\Console\Command\Site\InstallCommand 5 | arguments: ['@console.extension_manager', '@console.site', '@console.configuration_manager', '@app.root', '@console.site_install_generator'] 6 | tags: 7 | - { name: wordpress.command } 8 | # WordpressConsoleCore Generators 9 | console.site_install_generator: 10 | class: WP\Console\Core\Generator\SiteInstallGenerator 11 | tags: 12 | - { name: wordpress.generator } -------------------------------------------------------------------------------- /services-multisite-install.yml: -------------------------------------------------------------------------------- 1 | services: 2 | # Installer services 3 | console.multisite_install: 4 | class: WP\Console\Command\Multisite\InstallCommand 5 | arguments: ['@console.site', '@console.configuration_manager', '@app.root', '@console.site_install_generator', '@console.chain_queue'] 6 | tags: 7 | - { name: wordpress.command } 8 | # WordpressConsole Commands 9 | # WordpressConsoleCore Generators 10 | console.site_install_generator: 11 | class: WP\Console\Core\Generator\SiteInstallGenerator 12 | tags: 13 | - { name: wordpress.generator } 14 | # console.multisite_debug: 15 | # class: WP\Console\Command\Multisite\DebugCommand 16 | # arguments: ['@app.root'] 17 | # tags: 18 | # - { name: wordpress.command } 19 | # console.multisite_new: 20 | # class: WP\Console\Command\Multisite\NewCommand 21 | # arguments: ['@app.root'] 22 | # tags: 23 | # - { name: wordpress.command } 24 | -------------------------------------------------------------------------------- /services-multisite.yml: -------------------------------------------------------------------------------- 1 | services: 2 | # WordpressConsole Commands 3 | console.multisite_new: 4 | class: WP\Console\Command\Multisite\NewCommand 5 | arguments: ['@console.site', '@console.configuration_manager', '@app.root', '@console.silent_index_generator'] 6 | tags: 7 | - { name: wordpress.command } 8 | # WordpressConsoleCore Generators 9 | console.silent_index_generator: 10 | class: WP\Console\Core\Generator\SilentIndexGenerator 11 | tags: 12 | - { name: wordpress.generator } 13 | -------------------------------------------------------------------------------- /services.yml: -------------------------------------------------------------------------------- 1 | services: 2 | # WordpressConsoleCore Services 3 | console.root: 4 | class: SplString 5 | console.chain: 6 | class: WP\Console\Core\Command\Chain\ChainCommand 7 | arguments: ['@console.chain_queue', '@console.chain_discovery'] 8 | tags: 9 | - { name: wordpress.command } 10 | console.debug_chain: 11 | class: WP\Console\Core\Command\Debug\ChainCommand 12 | arguments: ['@console.chain_discovery'] 13 | tags: 14 | - { name: wordpress.command } 15 | console.exec: 16 | class: WP\Console\Core\Command\Exec\ExecCommand 17 | arguments: ['@console.shell_process'] 18 | tags: 19 | - { name: wordpress.command } 20 | console.wordpress_api: 21 | class: WP\Console\Utils\WordpressApi 22 | arguments: ['@app.root', '@console.site', '@http_client'] 23 | console.remote: 24 | class: WP\Console\Core\Utils\Remote 25 | arguments: ['@console.translator_manager'] 26 | console.shell_process: 27 | class: WP\Console\Core\Utils\ShellProcess 28 | arguments: ['@app.root', '@console.translator_manager'] 29 | console.validator: 30 | class: WP\Console\Utils\Validator 31 | arguments: ['@console.extension_manager'] 32 | console.create_user_data: 33 | class: WP\Console\Utils\Create\UserData 34 | arguments: ['@console.site'] 35 | console.create_role_data: 36 | class: WP\Console\Utils\Create\RoleData 37 | arguments: ['@console.site', '@console.wordpress_api'] -------------------------------------------------------------------------------- /src/Annotations/WPCommand.php: -------------------------------------------------------------------------------- 1 | getClassAnnotation( 24 | new \ReflectionClass($class), 25 | 'WP\\Console\\Annotations\\WPCommand' 26 | ); 27 | 28 | if ($wpCommandAnnotation) { 29 | $annotation['extension'] = $wpCommandAnnotation->extension?:''; 30 | $annotation['extensionType'] = $wpCommandAnnotation->extensionType?:''; 31 | $annotation['dependencies'] = $wpCommandAnnotation->dependencies?:[]; 32 | } 33 | 34 | return $annotation; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Bootstrap/AddServicesCompilerPass.php: -------------------------------------------------------------------------------- 1 | root = $root; 45 | $this->appRoot = $appRoot; 46 | $this->rebuild = $rebuild; 47 | } 48 | 49 | /** 50 | * @inheritdoc 51 | */ 52 | public function process(ContainerBuilder $container) 53 | { 54 | $servicesData = []; 55 | 56 | $loader = new YamlFileLoader( 57 | $container, 58 | new FileLocator($this->root) 59 | ); 60 | 61 | /** 62 | * @var Manager $extensionManager 63 | */ 64 | $extensionManager = $container->get('console.extension_manager'); 65 | 66 | /** 67 | * @var Extension[] $modules 68 | */ 69 | $plugins = $extensionManager->discoverPlugins() 70 | ->showCore() 71 | ->showNoCore() 72 | ->showActivated() 73 | ->getList(false); 74 | 75 | foreach ($plugins as $plugin) { 76 | $consoleServicesExtensionFile = $this->appRoot . '/' . 77 | $extensionManager->getPlugin($plugin['Name'])->getPath() . '/console.services.yml'; 78 | 79 | print $consoleServicesExtensionFile . PHP_EOL; 80 | 81 | if (is_file($consoleServicesExtensionFile)) { 82 | $loader->load($consoleServicesExtensionFile); 83 | } 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/Bootstrap/Wordpress.php: -------------------------------------------------------------------------------- 1 | autoload = $autoload; 30 | $this->root = $root; 31 | $this->appRoot = $appRoot; 32 | $this->site = new Site($appRoot, new Client()); 33 | } 34 | 35 | public function boot() 36 | { 37 | $wordpress = new WordpressConsoleCore($this->root, $this->appRoot, $this->site); 38 | $container = $wordpress->boot(); 39 | $container->set('class_loader', $this->autoload); 40 | 41 | AnnotationRegistry::registerLoader([$this->autoload, "loadClass"]); 42 | 43 | return $container; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Command/Cache/FlushCommand.php: -------------------------------------------------------------------------------- 1 | site = $site; 39 | parent::__construct(); 40 | } 41 | 42 | protected function configure() 43 | { 44 | $this 45 | ->setName('cache:flush') 46 | ->setDescription($this->trans('commands.cache.flush.description')) 47 | ->setAliases(['cf']); 48 | } 49 | 50 | protected function execute(InputInterface $input, OutputInterface $output) 51 | { 52 | $success = $this->site->cacheFlush(); 53 | 54 | if ($success) { 55 | $this->getIo()->info($this->trans('commands.cache.flush.messages.successful')); 56 | } else { 57 | $this->getIo()->error($this->trans('commands.cache.flush.messages.fail')); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/Command/Create/RolesCommand.php: -------------------------------------------------------------------------------- 1 | createRoleData = $createRoleData; 37 | parent::__construct(); 38 | } 39 | 40 | /** 41 | * {@inheritdoc} 42 | */ 43 | protected function configure() 44 | { 45 | $this 46 | ->setName('create:roles') 47 | ->setDescription($this->trans('commands.create.roles.description')) 48 | ->addOption( 49 | 'limit', 50 | null, 51 | InputOption::VALUE_OPTIONAL, 52 | $this->trans('commands.create.roles.options.limit') 53 | ) 54 | ->setAliases(['crr']); 55 | } 56 | 57 | /** 58 | * {@inheritdoc} 59 | */ 60 | protected function interact(InputInterface $input, OutputInterface $output) 61 | { 62 | $limit = $input->getOption('limit'); 63 | if (!$limit) { 64 | $limit = $this->getIo()->ask( 65 | $this->trans('commands.create.roles.questions.limit'), 66 | 5 67 | ); 68 | $input->setOption('limit', $limit); 69 | } 70 | } 71 | 72 | /** 73 | * {@inheritdoc} 74 | */ 75 | protected function execute(InputInterface $input, OutputInterface $output) 76 | { 77 | $limit = $input->getOption('limit')?:5; 78 | 79 | $roles = $this->createRoleData->create( 80 | $limit 81 | ); 82 | 83 | $tableHeader = [ 84 | $this->trans('commands.create.roles.messages.role-id'), 85 | $this->trans('commands.create.roles.messages.role-name'), 86 | ]; 87 | 88 | if ($roles['success']) { 89 | $this->getIo()->table($tableHeader, $roles['success']); 90 | 91 | $this->getIo()->success( 92 | sprintf( 93 | $this->trans('commands.create.roles.messages.created-roles'), 94 | $limit 95 | ) 96 | ); 97 | } 98 | 99 | return 0; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/Command/Debug/RolesCommand.php: -------------------------------------------------------------------------------- 1 | wordpressApi = $wordpressApi; 36 | parent::__construct(); 37 | } 38 | 39 | /** 40 | * {@inheritdoc} 41 | */ 42 | protected function configure() 43 | { 44 | $this 45 | ->setName('debug:roles') 46 | ->setDescription($this->trans('commands.debug.roles.description')) 47 | ->setAliases(['dusr']); 48 | } 49 | 50 | /** 51 | * {@inheritdoc} 52 | */ 53 | protected function execute(InputInterface $input, OutputInterface $output) 54 | { 55 | $roles = $this->wordpressApi->getRoles(); 56 | 57 | $tableHeader = [ 58 | $this->trans('commands.debug.roles.messages.role-id'), 59 | $this->trans('commands.debug.roles.messages.role-name'), 60 | ]; 61 | 62 | $tableRows = []; 63 | foreach ($roles as $roleId => $role) { 64 | $tableRows[] = [ 65 | $roleId, 66 | $role 67 | ]; 68 | } 69 | 70 | $this->getIo()->table($tableHeader, $tableRows); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/Command/Debug/ShortcodeCommand.php: -------------------------------------------------------------------------------- 1 | site = $site; 37 | parent::__construct(); 38 | } 39 | 40 | /** 41 | * {@inheritdoc} 42 | */ 43 | protected function configure() 44 | { 45 | $this 46 | ->setName('debug:shortcode') 47 | ->setDescription($this->trans('commands.debug.shortcode.description')) 48 | ->setAliases(['ds']); 49 | } 50 | 51 | /** 52 | * {@inheritdoc} 53 | */ 54 | protected function execute(InputInterface $input, OutputInterface $output) 55 | { 56 | $tableHeader = [ 57 | $this->trans('commands.debug.shortcode.messages.tag'), 58 | $this->trans('commands.debug.shortcode.messages.callback') 59 | ]; 60 | 61 | $shortcodes = $this->site->getShortCodes(); 62 | 63 | $rows = []; 64 | foreach ($shortcodes as $tag => $callback) { 65 | $rows[] = ['tag' => $tag , 'callback' => $callback]; 66 | } 67 | 68 | $this->getIo()->table($tableHeader, $rows, 'compact'); 69 | 70 | return 0; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/Command/Generate/CronScheduleCommand.php: -------------------------------------------------------------------------------- 1 | setCronType('schedule'); 20 | $this->setCommandName('generate:cron:schedule'); 21 | parent::configure(); 22 | $this 23 | ->addOption( 24 | 'recurrence', 25 | '', 26 | InputOption::VALUE_REQUIRED, 27 | $this->trans('commands.generate.cron.schedule.options.recurrence') 28 | ) 29 | ->setAliases(['gcsh']); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Command/Generate/CronSingleCommand.php: -------------------------------------------------------------------------------- 1 | setCronType('single'); 18 | $this->setCommandName('generate:cron:single'); 19 | $this->setAliases(['gcs']); 20 | parent::configure(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Command/Generate/RegisterScriptCommand.php: -------------------------------------------------------------------------------- 1 | setRegisterType('script'); 18 | $this->setCommandName('generate:register:script'); 19 | $this->setAliases(['grsp']); 20 | parent::configure(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Command/Generate/RegisterStyleCommand.php: -------------------------------------------------------------------------------- 1 | setRegisterType('style'); 18 | $this->setCommandName('generate:register:style'); 19 | $this->setAliases(['grst']); 20 | parent::configure(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Command/Shared/ConfirmationTrait.php: -------------------------------------------------------------------------------- 1 | getIo()->getInput(); 23 | $yes = $input->hasOption('yes') ? $input->getOption('yes') : false; 24 | 25 | if ($yes) { 26 | return $yes; 27 | } 28 | 29 | $confirmation = $this->getIo()->confirm( 30 | $this->trans('commands.common.questions.confirm'), 31 | true 32 | ); 33 | 34 | if (!$confirmation) { 35 | $this->getIo()->warning($this->trans('commands.common.messages.canceled')); 36 | } 37 | 38 | return $confirmation; 39 | } 40 | 41 | /** 42 | * @deprecated 43 | */ 44 | public function confirmGeneration() 45 | { 46 | return $this->confirmOperation(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Command/Shared/CreateTrait.php: -------------------------------------------------------------------------------- 1 | sprintf('N | %s', $this->trans('commands.create.users.questions.time-ranges.0')), 24 | 3600 => sprintf('H | %s', $this->trans('commands.create.users.questions.time-ranges.1')), 25 | 86400 => sprintf('D | %s', $this->trans('commands.create.users.questions.time-ranges.2')), 26 | 604800 => sprintf('W | %s', $this->trans('commands.create.users.questions.time-ranges.3')), 27 | 2592000 => sprintf('M | %s', $this->trans('commands.create.users.questions.time-ranges.4')), 28 | 31536000 => sprintf('Y | %s', $this->trans('commands.create.users.questions.time-ranges.5')) 29 | ]; 30 | 31 | return $timeRanges; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Command/Shared/DatabaseTrait.php: -------------------------------------------------------------------------------- 1 | getIo()->ask( 25 | $this->trans('commands.site.install.questions.db-host'), 26 | '127.0.0.1' 27 | ); 28 | } 29 | 30 | /** 31 | * @return mixed 32 | */ 33 | public function dbNameQuestion() 34 | { 35 | return $this->getIo()->ask( 36 | $this->trans('commands.site.install.questions.db-name') 37 | ); 38 | } 39 | 40 | /** 41 | * @return mixed 42 | */ 43 | public function dbUserQuestion() 44 | { 45 | return $this->getIo()->ask( 46 | $this->trans('commands.site.install.questions.db-user') 47 | ); 48 | } 49 | 50 | /** 51 | * @return mixed 52 | */ 53 | public function dbPassQuestion() 54 | { 55 | return $this->getIo()->askHiddenEmpty( 56 | $this->trans('commands.site.install.questions.db-pass') 57 | ); 58 | } 59 | 60 | /** 61 | * @return mixed 62 | */ 63 | public function dbPrefixQuestion() 64 | { 65 | $question = new Question($this->trans('commands.site.install.questions.db-prefix'), 'wp_'); 66 | return trim($this->getIo()->askQuestion($question)); 67 | } 68 | 69 | /** 70 | * @return mixed 71 | */ 72 | public function dbPortQuestion() 73 | { 74 | return $this->getIo()->ask( 75 | $this->trans('commands.site.install.questions.db-port'), 76 | '3306' 77 | ); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/Command/Shared/ExtensionTrait.php: -------------------------------------------------------------------------------- 1 | extensionManager->discoverPlugins()->showDeactivated()->showActivated()->getList(true); 31 | } 32 | 33 | if ($extensionType == 'theme') { 34 | $themes = $this->extensionManager->discoverThemes()->showDeactivated()->showActivated()->getList(true); 35 | } 36 | 37 | $extensions = array_merge( 38 | $plugins, 39 | $themes 40 | ); 41 | 42 | if (empty($extensions)) { 43 | throw new \Exception('No extension available, execute the proper generator command to generate one.'); 44 | } 45 | 46 | $extension = $this->getIo()->choiceNoList( 47 | $this->trans('commands.common.questions.extension'), 48 | $extensions 49 | ); 50 | 51 | return $extension; 52 | } 53 | 54 | /** 55 | * @return string 56 | * 57 | * @throws \Exception 58 | */ 59 | public function extensionTypeQuestion() 60 | { 61 | $extensionType = $this->getIo()->choiceNoList( 62 | $this->trans('commands.common.questions.extension-type'), 63 | ['plugin', 'theme'] 64 | ); 65 | 66 | return $extensionType; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/Command/Shared/PluginTrait.php: -------------------------------------------------------------------------------- 1 | extensionManager->discoverPlugins(); 26 | 27 | if ($status == 'all') { 28 | $extensionManager->showDeactivated()->showActivated(); 29 | } elseif ($status) { 30 | $extensionManager->showActivated(); 31 | } else { 32 | $extensionManager->showDeactivated(); 33 | } 34 | 35 | $plugins = $extensionManager->getList(true); 36 | 37 | if (empty($plugins)) { 38 | throw new \Exception('No extension available, execute the proper generator command to generate one.'); 39 | } 40 | 41 | $plugin = $this->getIo()->choiceNoList( 42 | $this->trans('commands.common.questions.plugin'), 43 | $plugins 44 | ); 45 | 46 | return $plugin; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Command/Shared/ServicesTrait.php: -------------------------------------------------------------------------------- 1 | getIo()->confirm( 18 | $this->trans('commands.common.questions.services.confirm'), 19 | false 20 | ) 21 | ) { 22 | $service_collection = []; 23 | $this->getIo()->writeln($this->trans('commands.common.questions.services.message')); 24 | $services = $this->container->getServiceIds(); 25 | while (true) { 26 | $service = $this->getIo()->choiceNoList( 27 | $this->trans('commands.common.questions.services.name'), 28 | $services, 29 | null, 30 | true 31 | ); 32 | 33 | $service = trim($service); 34 | if (empty($service)) { 35 | break; 36 | } 37 | 38 | array_push($service_collection, $service); 39 | $service_key = array_search($service, $services, true); 40 | 41 | if ($service_key >= 0) { 42 | unset($services[$service_key]); 43 | } 44 | } 45 | 46 | return $service_collection; 47 | } 48 | } 49 | 50 | /** 51 | * @param array $services 52 | * 53 | * @return array 54 | */ 55 | public function buildServices($services) 56 | { 57 | if (!empty($services)) { 58 | $buildServices = []; 59 | foreach ($services as $service) { 60 | $class = get_class($this->container->get($service)); 61 | $shortClass = explode('\\', $class); 62 | $machineName = str_replace('.', '_', $service); 63 | $buildServices[$service] = [ 64 | 'name' => $service, 65 | 'machine_name' => $machineName, 66 | 'camel_case_name' => $this->stringConverter->underscoreToCamelCase($machineName), 67 | 'class' => $class, 68 | 'short' => end($shortClass), 69 | ]; 70 | } 71 | 72 | return $buildServices; 73 | } 74 | 75 | return []; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/Command/Shared/ThemeTrait.php: -------------------------------------------------------------------------------- 1 | extensionManager->discoverthemes(); 25 | 26 | if ($status == 'all') { 27 | $extensionManager->showDeactivated()->showActivated(); 28 | } elseif ($status) { 29 | $extensionManager->showActivated(); 30 | } else { 31 | $extensionManager->showDeactivated(); 32 | } 33 | 34 | $themes = $extensionManager->getList(true); 35 | 36 | if (empty($themes)) { 37 | throw new \Exception('No extension available, execute the proper generator command to generate one.'); 38 | } 39 | 40 | $theme = $this->getIo()->choiceNoList( 41 | $this->trans('commands.common.questions.theme'), 42 | $themes 43 | ); 44 | 45 | return $theme; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Component/FileCache/ApcuFileCacheBackend.php: -------------------------------------------------------------------------------- 1 | name = $name; 55 | $this->description = $description; 56 | $this->file = $file; 57 | 58 | parent::__construct($chainDiscovery); 59 | $this->ignoreValidationErrors(); 60 | 61 | $this->addOption( 62 | 'file', 63 | null, 64 | InputOption::VALUE_OPTIONAL, 65 | null, 66 | $file 67 | ); 68 | } 69 | 70 | /** 71 | * {@inheritdoc} 72 | */ 73 | protected function configure() 74 | { 75 | $this 76 | ->setName($this->name) 77 | ->setDescription($this->description); 78 | } 79 | 80 | /** 81 | * {@inheritdoc} 82 | */ 83 | protected function execute(InputInterface $input, OutputInterface $output) 84 | { 85 | $command = $this->getApplication()->find('chain'); 86 | 87 | $arguments = [ 88 | 'command' => 'chain', 89 | '--file' => $this->file, 90 | ]; 91 | 92 | foreach ($input->getOptions() as $option => $value) { 93 | if ($value) { 94 | $arguments['--' . $option] = $value; 95 | } 96 | } 97 | 98 | $commandInput = new ArrayInput($arguments); 99 | $commandInput->setInteractive(true); 100 | 101 | return $command->run($commandInput, $output); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /src/Core/Command/Command.php: -------------------------------------------------------------------------------- 1 | io = new WPStyle($input, $output); 36 | } 37 | 38 | /** 39 | * @return \WP\Console\Core\Style\WPStyle 40 | */ 41 | public function getIo() 42 | { 43 | return $this->io; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Core/Command/ContainerAwareCommand.php: -------------------------------------------------------------------------------- 1 | chainDiscovery = $chainDiscovery; 37 | 38 | parent::__construct(); 39 | } 40 | 41 | /** 42 | * {@inheritdoc} 43 | */ 44 | protected function configure() 45 | { 46 | $this 47 | ->setName('debug:chain') 48 | ->setDescription($this->trans('commands.debug.chain.description')) 49 | ->setAliases(['dc']); 50 | } 51 | 52 | /** 53 | * {@inheritdoc} 54 | */ 55 | protected function execute(InputInterface $input, OutputInterface $output) 56 | { 57 | $files = $this->chainDiscovery->getFiles(); 58 | $filesPerDirectory = $this->chainDiscovery->getFilesPerDirectory(); 59 | 60 | if (!$files || !$filesPerDirectory) { 61 | $this->getIo()->warning($this->trans('commands.debug.chain.messages.no-files')); 62 | 63 | return 0; 64 | } 65 | 66 | foreach ($filesPerDirectory as $directory => $fileNames) { 67 | $this->getIo()->info(' ' . $this->trans('commands.debug.chain.messages.directory'), false); 68 | $this->getIo()->comment($directory); 69 | 70 | $tableHeader = [ 71 | $this->trans('commands.debug.chain.messages.file'), 72 | $this->trans('commands.debug.chain.messages.command') 73 | ]; 74 | 75 | $tableRows = []; 76 | foreach ($fileNames as $file) { 77 | $commandName = ''; 78 | if (array_key_exists('command', $files[$directory.$file])) { 79 | $commandName = $files[$directory.$file]['command']; 80 | } 81 | $tableRows[] = [ 82 | 'file' => $file, 83 | 'command' => $commandName 84 | ]; 85 | } 86 | 87 | $this->getIo()->table($tableHeader, $tableRows); 88 | } 89 | 90 | return 0; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/Core/Command/ListCommand.php: -------------------------------------------------------------------------------- 1 | setName('list') 32 | ->setDefinition($this->createDefinition()) 33 | ->setDescription($this->trans('commands.list.description')) 34 | ->setHelp($this->trans('commands.list.help')); 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function getNativeDefinition() 41 | { 42 | return $this->createDefinition(); 43 | } 44 | 45 | 46 | /** 47 | * {@inheritdoc} 48 | */ 49 | protected function execute(InputInterface $input, OutputInterface $output) 50 | { 51 | $helper = new DescriptorHelper(); 52 | $helper->describe( 53 | $this->getIo(), 54 | $this->getApplication(), 55 | [ 56 | 'format' => $input->getOption('format'), 57 | 'raw_text' => $input->getOption('raw'), 58 | 'namespace' => $input->getArgument('namespace'), 59 | 'translator' => $this->getApplication()->getTranslator() 60 | ] 61 | ); 62 | } 63 | 64 | 65 | /** 66 | * {@inheritdoc} 67 | */ 68 | private function createDefinition() 69 | { 70 | return new InputDefinition( 71 | array( 72 | new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'), 73 | new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'), 74 | new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'), 75 | ) 76 | ); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/Core/Command/Shared/CommandTrait.php: -------------------------------------------------------------------------------- 1 | translator = $translator; 30 | } 31 | 32 | /** 33 | * @param $key string 34 | * 35 | * @return string 36 | */ 37 | public function trans($key) 38 | { 39 | if (!$this->translator) { 40 | return $key; 41 | } 42 | 43 | return $this->translator->trans($key); 44 | } 45 | 46 | /** 47 | * @inheritdoc 48 | */ 49 | public function getDescription() 50 | { 51 | $description = sprintf( 52 | 'commands.%s.description', 53 | str_replace(':', '.', $this->getName()) 54 | ); 55 | 56 | if (parent::getDescription()==$description) { 57 | return $this->trans($description); 58 | } 59 | 60 | return parent::getDescription(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Core/Command/Shared/ContainerAwareCommandTrait.php: -------------------------------------------------------------------------------- 1 | container = $container; 27 | } 28 | 29 | /** 30 | * @param $key 31 | * @return null|object 32 | */ 33 | public function has($key) 34 | { 35 | if (!$key) { 36 | return null; 37 | } 38 | 39 | return $this->container->has($key); 40 | } 41 | 42 | /** 43 | * @param $key 44 | * @return null|object 45 | */ 46 | public function get($key) 47 | { 48 | if (!$key) { 49 | return null; 50 | } 51 | 52 | if ($this->has($key)) { 53 | return $this->container->get($key); 54 | } 55 | 56 | return null; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/Core/Command/Shared/InputTrait.php: -------------------------------------------------------------------------------- 1 | $value) { 24 | if (!is_array($value)) { 25 | try { 26 | $inputAsArray[] = json_decode('[{'.$value.'}]', true)[0]; 27 | } catch (\Exception $e) { 28 | continue; 29 | } 30 | } 31 | } 32 | 33 | return $inputAsArray?$inputAsArray:$inputValue; 34 | } 35 | 36 | /** 37 | * @return array 38 | */ 39 | private function placeHolderInlineValueAsArray($inputValue) 40 | { 41 | $inputArrayValue = []; 42 | foreach ($inputValue as $key => $value) { 43 | if (!is_array($value)) { 44 | $separatorIndex = strpos($value, ':'); 45 | if (!$separatorIndex) { 46 | continue; 47 | } 48 | $inputKeyItem = substr($value, 0, $separatorIndex); 49 | $inputValueItem = substr($value, $separatorIndex+1); 50 | $inputArrayValue[$inputKeyItem] = $inputValueItem; 51 | } 52 | } 53 | 54 | return $inputArrayValue?$inputArrayValue:$inputValue; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Core/DependencyInjection/ServiceModifierInterface.php: -------------------------------------------------------------------------------- 1 | chainQueue = $chainQueue; 38 | } 39 | 40 | /** 41 | * @param ConsoleTerminateEvent $event 42 | */ 43 | public function callCommands(ConsoleTerminateEvent $event) 44 | { 45 | $command = $event->getCommand(); 46 | 47 | /* @var WPStyle $io */ 48 | $io = new WPStyle($event->getInput(), $event->getOutput()); 49 | 50 | if (!$command instanceof Command) { 51 | return; 52 | } 53 | 54 | $application = $command->getApplication(); 55 | $commands = $this->chainQueue->getCommands(); 56 | 57 | if (!$commands) { 58 | return 0; 59 | } 60 | 61 | foreach ($commands as $chainedCommand) { 62 | $callCommand = $application->find($chainedCommand['name']); 63 | 64 | if (!$callCommand) { 65 | continue; 66 | } 67 | 68 | $input = new ArrayInput($chainedCommand['inputs']); 69 | if (!is_null($chainedCommand['interactive'])) { 70 | $input->setInteractive($chainedCommand['interactive']); 71 | } 72 | 73 | $io->text($chainedCommand['name']); 74 | $allowFailure = array_key_exists('allow_failure', $chainedCommand) ? $chainedCommand['allow_failure'] : false; 75 | try { 76 | $callCommand->run($input, $io); 77 | } catch (\Exception $e) { 78 | if (!$allowFailure) { 79 | $io->error($e->getMessage()); 80 | return 1; 81 | } 82 | } 83 | } 84 | } 85 | 86 | /** 87 | * @{@inheritdoc} 88 | */ 89 | public static function getSubscribedEvents() 90 | { 91 | return [ConsoleEvents::TERMINATE => 'callCommands']; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/Core/EventSubscriber/ShowGenerateCountCodeLinesListener.php: -------------------------------------------------------------------------------- 1 | translator = $translator; 48 | $this->countCodeLines = $countCodeLines; 49 | } 50 | 51 | /** 52 | * @param ConsoleTerminateEvent $event 53 | */ 54 | public function showGenerateCountCodeLines(ConsoleTerminateEvent $event) 55 | { 56 | if ($event->getExitCode() != 0) { 57 | return; 58 | } 59 | 60 | /* @var WPStyle $io */ 61 | $io = new WPStyle($event->getInput(), $event->getOutput()); 62 | 63 | $countCodeLines = $this->countCodeLines->getCountCodeLines(); 64 | if ($countCodeLines > 0) { 65 | $io->commentBlock( 66 | sprintf( 67 | $this->translator->trans('application.messages.lines-code'), 68 | $countCodeLines 69 | ) 70 | ); 71 | } 72 | } 73 | 74 | /** 75 | * @{@inheritdoc} 76 | */ 77 | public static function getSubscribedEvents() 78 | { 79 | return [ConsoleEvents::TERMINATE => 'showGenerateCountCodeLines']; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/Core/EventSubscriber/ShowGeneratedFilesListener.php: -------------------------------------------------------------------------------- 1 | fileQueue = $fileQueue; 44 | $this->showFile = $showFile; 45 | } 46 | 47 | /** 48 | * @param ConsoleTerminateEvent $event 49 | */ 50 | public function showGeneratedFiles(ConsoleTerminateEvent $event) 51 | { 52 | /* @var Command $command */ 53 | $command = $event->getCommand(); 54 | /* @var WPStyle $io */ 55 | $io = new WPStyle($event->getInput(), $event->getOutput()); 56 | 57 | if ($event->getExitCode() != 0) { 58 | return; 59 | } 60 | 61 | if ('self-update' == $command->getName()) { 62 | return; 63 | } 64 | 65 | $files = $this->fileQueue->getFiles(); 66 | if ($files) { 67 | $this->showFile->generatedFiles($io, $files, false); 68 | } 69 | } 70 | 71 | /** 72 | * @{@inheritdoc} 73 | */ 74 | public static function getSubscribedEvents() 75 | { 76 | return [ConsoleEvents::TERMINATE => 'showGeneratedFiles']; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/Core/Generator/GeneratorInterface.php: -------------------------------------------------------------------------------- 1 | renderFile( 27 | 'core/index-silent.php.twig', 28 | $indexFile, 29 | [] 30 | ); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Core/Generator/SiteInstallGenerator.php: -------------------------------------------------------------------------------- 1 | renderFile( 49 | 'core/wp-config.php.twig', 50 | $configFile, 51 | $configParameters 52 | ); 53 | 54 | $htaccessFile = $root . '/.htaccess'; 55 | 56 | // Render htaccess file 57 | $this->renderFile( 58 | 'core/htaccess.twig', 59 | $htaccessFile, 60 | $configParameters 61 | ); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/Core/Helper/DescriptorHelper.php: -------------------------------------------------------------------------------- 1 | register('txt', new TextDescriptor()) 32 | ->register('xml', new XmlDescriptor()) 33 | ->register('json', new JsonDescriptor()) 34 | ->register('md', new MarkdownDescriptor()); 35 | } 36 | /** 37 | * Describes an object if supported. 38 | * 39 | * Available options are: 40 | * * format: string, the output format name 41 | * * raw_text: boolean, sets output type as raw 42 | * 43 | * @param OutputInterface $output 44 | * @param object $object 45 | * @param array $options 46 | * 47 | * @throws \InvalidArgumentException when the given format is not supported 48 | */ 49 | public function describe(OutputInterface $output, $object, array $options = array()) 50 | { 51 | $options = array_merge( 52 | array( 53 | 'raw_text' => false, 54 | 'format' => 'txt', 55 | ), $options 56 | ); 57 | if (!isset($this->descriptors[$options['format']])) { 58 | throw new \InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format'])); 59 | } 60 | $descriptor = $this->descriptors[$options['format']]; 61 | $descriptor->describe($output, $object, $options); 62 | } 63 | /** 64 | * Registers a descriptor. 65 | * 66 | * @param string $format 67 | * @param DescriptorInterface $descriptor 68 | * 69 | * @return DescriptorHelper 70 | */ 71 | public function register($format, DescriptorInterface $descriptor) 72 | { 73 | $this->descriptors[$format] = $descriptor; 74 | return $this; 75 | } 76 | /** 77 | * {@inheritdoc} 78 | */ 79 | public function getName() 80 | { 81 | return 'descriptor'; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/Core/Helper/WordpressChoiceQuestionHelper.php: -------------------------------------------------------------------------------- 1 | getQuestion(); 17 | $default = $question->getDefault(); 18 | $choices = $question->getChoices(); 19 | 20 | $text = sprintf(' %s [%s]:', $text, $choices[$default]); 21 | 22 | $output->writeln($text); 23 | 24 | $output->write(' > '); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Core/Utils/ChainQueue.php: -------------------------------------------------------------------------------- 1 | commands[] = 39 | [ 40 | 'name' => $name, 41 | 'inputs' => $inputs, 42 | 'interactive' => $interactive 43 | ]; 44 | } 45 | 46 | /** 47 | * @return array 48 | */ 49 | public function getCommands() 50 | { 51 | return $this->commands; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Core/Utils/CountCodeLines.php: -------------------------------------------------------------------------------- 1 | countCodeLine = $this->countCodeLine + $countCodeLine; 28 | } 29 | 30 | /** 31 | * @return integer 32 | */ 33 | public function getCountCodeLines() 34 | { 35 | return $this->countCodeLine; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Core/Utils/FileQueue.php: -------------------------------------------------------------------------------- 1 | files[] = $file; 28 | } 29 | 30 | /** 31 | * @return array 32 | */ 33 | public function getFiles() 34 | { 35 | return $this->files; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Core/Utils/KeyValueStorage.php: -------------------------------------------------------------------------------- 1 | data); 25 | } 26 | 27 | /** 28 | * Gets the given key from the container, or returns the default if it does 29 | * not exist. 30 | * 31 | * @param string $key 32 | * The key to get. 33 | * @param mixed $default 34 | * Default value to return. 35 | * 36 | * @return mixed 37 | */ 38 | public function get($key, $default = null) 39 | { 40 | return $this->has($key) ? $this->data[$key] : $default; 41 | } 42 | 43 | /** 44 | * Sets the given key in the container. 45 | * 46 | * @param mixed $key 47 | * The key to set 48 | * @param mixed $value 49 | * The value. 50 | */ 51 | public function set($key, $value = null) 52 | { 53 | $this->data[$key] = $value; 54 | } 55 | 56 | /** 57 | * Removes the given key from the container. 58 | * 59 | * @param string $key The key to forget. 60 | * 61 | * @return void 62 | */ 63 | public function remove($key) 64 | { 65 | unset($this->data[$key]); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/Core/Utils/ShellProcess.php: -------------------------------------------------------------------------------- 1 | appRoot = $appRoot; 46 | $this->translator = $translator; 47 | 48 | $output = new ConsoleOutput(); 49 | $input = new ArrayInput([]); 50 | $this->io = new WPStyle($input, $output); 51 | } 52 | 53 | /** 54 | * @param string $command 55 | * @param string $workingDirectory 56 | * 57 | * @throws ProcessFailedException 58 | * 59 | * @return Process 60 | */ 61 | public function exec($command, $workingDirectory=null) 62 | { 63 | if (!$workingDirectory || $workingDirectory==='') { 64 | $workingDirectory = $this->appRoot; 65 | } 66 | 67 | $this->io->newLine(); 68 | $this->io->comment( 69 | $this->translator->trans('commands.exec.messages.working-directory') .': ', 70 | false 71 | ); 72 | $this->io->writeln($workingDirectory); 73 | $this->io->comment( 74 | $this->translator->trans('commands.exec.messages.executing-command') .': ', 75 | false 76 | ); 77 | $this->io->writeln($command); 78 | 79 | $this->process = new Process($command); 80 | $this->process->setWorkingDirectory($workingDirectory); 81 | $this->process->enableOutput(); 82 | $this->process->setTimeout(null); 83 | $this->process->run( 84 | function ($type, $buffer) { 85 | $this->io->write($buffer); 86 | } 87 | ); 88 | 89 | if (!$this->process->isSuccessful()) { 90 | throw new ProcessFailedException($this->process); 91 | } 92 | 93 | return $this->process->isSuccessful(); 94 | } 95 | 96 | /** 97 | * @return string 98 | */ 99 | public function getOutput() 100 | { 101 | return $this->process->getOutput(); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /src/Core/Utils/TranslatorManagerInterface.php: -------------------------------------------------------------------------------- 1 | root . parent::getPath(); 22 | } 23 | 24 | return parent::getPath(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Generator/CommandGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 33 | } 34 | 35 | /** 36 | * {@inheritdoc} 37 | */ 38 | public function generate(array $parameters) 39 | { 40 | $plugin = $parameters['plugin']; 41 | $class = $parameters['class_name']; 42 | $name = $parameters['name']; 43 | 44 | //$pluginCamelCaseMachineName 45 | $command_key = str_replace(':', '.', $name); 46 | 47 | 48 | $parameters = array_merge( 49 | $parameters, [ 50 | 'command_key' => $command_key, 51 | 'tags' => ['name' => 'wordpress.command'], 52 | 'class_path' => sprintf('WP\%s\Command\%s', $parameters['pluginNameSpace'], $class), 53 | 'file_exists' => file_exists($this->extensionManager->getPlugin($plugin)->getPath() .'/console.services.yml'), 54 | ] 55 | ); 56 | 57 | 58 | $this->renderFile( 59 | 'plugin/src/Command/command.php.twig', 60 | $this->extensionManager->getPlugin($plugin)->getCommandDirectory().$class.'.php', 61 | $parameters 62 | ); 63 | 64 | $parameters['name'] = $parameters['pluginCamelCaseMachineName'].'.'.str_replace(':', '_', $name); 65 | unset($parameters['pluginCamelCaseMachineName']); 66 | 67 | $this->renderFile( 68 | 'plugin/services.yml.twig', 69 | $this->extensionManager->getPlugin($plugin)->getPath() .'/console.services.yml', 70 | $parameters, 71 | FILE_APPEND 72 | ); 73 | 74 | $this->renderFile( 75 | 'plugin/src/Command/console/translations/en/command.yml.twig', 76 | $this->extensionManager->getPlugin($plugin)->getPath() .'/console/translations/en/'.$command_key.'.yml' 77 | ); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/Generator/CronBaseGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function generate(array $parameters) 41 | { 42 | $plugin = $parameters['plugin']; 43 | $class = $parameters['class_name']; 44 | $type = $parameters['type']; 45 | 46 | $pluginFile = $this->extensionManager->getPlugin($plugin)->getPathname(); 47 | $dir = $this->extensionManager->getPlugin($plugin)->getPath(); 48 | 49 | $parameters = array_merge( 50 | $parameters, [ 51 | "class_name_path" => 'Cron'.ucfirst($type).'/' . lcfirst($class) . '.php', 52 | "admin_cron_path" => 'admin/partials/cron-'.$type.'-admin.php', 53 | "file_exists" => file_exists($pluginFile), 54 | "command_name" => 'cron'.$type, 55 | ] 56 | ); 57 | 58 | $file_path = $dir.'/admin/partials/'.$parameters['class_name_path']; 59 | $file_path_admin = $dir.'/'.$parameters['admin_cron_path']; 60 | $parameters['admin_file_exists'] = file_exists($file_path_admin); 61 | 62 | if (file_exists($file_path)) { 63 | if (!is_dir($file_path)) { 64 | throw new \RuntimeException( 65 | sprintf( 66 | 'Unable to generate the '.$type.' cron, it already exist at "%s"', 67 | realpath($file_path) 68 | ) 69 | ); 70 | } 71 | } 72 | 73 | if (!file_exists($file_path_admin)) { 74 | $this->renderFile( 75 | 'plugin/plugin.php.twig', 76 | $pluginFile, 77 | $parameters, 78 | FILE_APPEND 79 | ); 80 | } 81 | 82 | $this->renderFile( 83 | 'plugin/src/Cron/class-cron-'.$type.'.php.twig', 84 | $file_path, 85 | $parameters 86 | ); 87 | 88 | 89 | $this->renderFile( 90 | 'plugin/src/class-admin.php.twig', 91 | $file_path_admin, 92 | $parameters, 93 | FILE_APPEND 94 | ); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/Generator/DashboardWidgetsGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function generate(array $parameters) 41 | { 42 | $plugin = $parameters['plugin']; 43 | $class = $parameters['class_name']; 44 | 45 | $pluginFile = $this->extensionManager->getPlugin($plugin)->getPathname(); 46 | $dir = $this->extensionManager->getPlugin($plugin)->getPath(); 47 | 48 | $parameters = array_merge( 49 | $parameters, [ 50 | "class_name_path" => 'DashboardWidgets/' . lcfirst($class) . '.php', 51 | "admin_dashboard_widgets_path" => 'admin/partials/dashboard-widgets-admin.php', 52 | "file_exists" => file_exists($pluginFile), 53 | "command_name" => 'dashboard_widgets' 54 | ] 55 | ); 56 | 57 | $file_path = $dir.'/admin/partials/'.$parameters['class_name_path']; 58 | $file_path_admin = $dir.'/'.$parameters['admin_dashboard_widgets_path']; 59 | $parameters['admin_file_exists'] = file_exists($file_path_admin); 60 | 61 | if (file_exists($file_path)) { 62 | if (!is_dir($file_path)) { 63 | throw new \RuntimeException( 64 | sprintf( 65 | 'Unable to generate dashboard widgets , it already exist at "%s"', 66 | realpath($file_path) 67 | ) 68 | ); 69 | } 70 | } 71 | 72 | if (!file_exists($file_path_admin)) { 73 | $this->renderFile( 74 | 'plugin/plugin.php.twig', 75 | $pluginFile, 76 | $parameters, 77 | FILE_APPEND 78 | ); 79 | } 80 | 81 | $this->renderFile( 82 | 'plugin/src/Widget/class-dashboard-widgets.php.twig', 83 | $file_path, 84 | $parameters 85 | ); 86 | 87 | $this->renderFile( 88 | 'plugin/src/class-admin.php.twig', 89 | $file_path_admin, 90 | $parameters, 91 | FILE_APPEND 92 | ); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/Generator/MenuGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 34 | } 35 | 36 | /** 37 | * {@inheritdoc} 38 | */ 39 | public function generate(array $parameters) 40 | { 41 | $plugin = $parameters['plugin']; 42 | $class = $parameters['class_name']; 43 | 44 | $pluginFile = $this->extensionManager->getPlugin($plugin)->getPathname(); 45 | $dir = $this->extensionManager->getPlugin($plugin)->getPath(); 46 | 47 | $parameters = array_merge( 48 | $parameters, [ 49 | 'class_name_path' => 'Menu/' . lcfirst($class) . '.php', 50 | 'admin_menu_path' => 'admin/partials/menus-admin.php', 51 | 'file_exists' => file_exists($pluginFile), 52 | "command_name" => 'menu' 53 | ] 54 | ); 55 | 56 | $file_path = $dir.'/admin/partials/'.$parameters['class_name_path']; 57 | $file_path_admin = $dir.'/'.$parameters['admin_menu_path']; 58 | 59 | if (file_exists($file_path)) { 60 | if (!is_dir($file_path)) { 61 | throw new \RuntimeException( 62 | sprintf( 63 | 'Unable to generate the menu , it already exist at "%s"', 64 | realpath($file_path) 65 | ) 66 | ); 67 | } 68 | } 69 | 70 | if (!file_exists($file_path_admin)) { 71 | $this->renderFile( 72 | 'plugin/plugin.php.twig', 73 | $pluginFile, 74 | $parameters, 75 | FILE_APPEND 76 | ); 77 | } 78 | 79 | $this->renderFile( 80 | 'plugin/src/Menu/class-menu.php.twig', 81 | $file_path, 82 | $parameters 83 | ); 84 | 85 | $parameters['admin_file_exists'] = file_exists($file_path_admin); 86 | 87 | $this->renderFile( 88 | 'plugin/src/class-admin.php.twig', 89 | $file_path_admin, 90 | $parameters, 91 | FILE_APPEND 92 | ); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/Generator/MetaBoxGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function generate(array $parameters) 41 | { 42 | $plugin = $parameters['plugin']; 43 | $class = $parameters['class_name']; 44 | 45 | $pluginFile = $this->extensionManager->getPlugin($plugin)->getPathname(); 46 | $dir = $this->extensionManager->getPlugin($plugin)->getPath(); 47 | 48 | $parameters = array_merge( 49 | $parameters, [ 50 | "class_name_path" => 'Metabox/' . lcfirst($class) . '.php', 51 | "admin_metabox_path" => 'admin/partials/metaboxes-admin.php', 52 | "file_exists" => file_exists($pluginFile), 53 | "command_name" => 'metabox' 54 | ] 55 | ); 56 | 57 | $file_path = $dir.'/admin/partials/'.$parameters['class_name_path']; 58 | $file_path_admin = $dir.'/'.$parameters['admin_metabox_path']; 59 | 60 | if (file_exists($file_path)) { 61 | if (!is_dir($file_path)) { 62 | throw new \RuntimeException( 63 | sprintf( 64 | 'Unable to generate the metaboxes , it already exist at "%s"', 65 | realpath($file_path) 66 | ) 67 | ); 68 | } 69 | } 70 | 71 | if (!file_exists($file_path_admin)) { 72 | $this->renderFile( 73 | 'plugin/plugin.php.twig', 74 | $pluginFile, 75 | $parameters, 76 | FILE_APPEND 77 | ); 78 | } 79 | 80 | $this->renderFile( 81 | 'plugin/src/Metabox/class-metabox.php.twig', 82 | $file_path, 83 | $parameters 84 | ); 85 | 86 | $parameters['admin_file_exists'] = file_exists($file_path_admin); 87 | 88 | $this->renderFile( 89 | 'plugin/src/class-admin.php.twig', 90 | $file_path_admin, 91 | $parameters, 92 | FILE_APPEND 93 | ); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/Generator/PostTypeGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function generate(array $parameters) 41 | { 42 | $plugin = $parameters['plugin']; 43 | $class = $parameters['class_name']; 44 | 45 | $pluginFile = $this->extensionManager->getPlugin($plugin)->getPathname(); 46 | $dir = $this->extensionManager->getPlugin($plugin)->getPath(); 47 | 48 | $parameters = array_merge( 49 | $parameters, [ 50 | "class_name_path" => 'PostType/' . lcfirst($class) . '.php', 51 | "admin_post_type_path" => 'admin/partials/post-types-admin.php', 52 | "file_exists" => file_exists($pluginFile), 53 | "command_name" => 'post_type' 54 | ] 55 | ); 56 | 57 | $file_path = $dir.'/admin/partials/'.$parameters['class_name_path']; 58 | $file_path_admin = $dir.'/'.$parameters['admin_post_type_path']; 59 | 60 | if (file_exists($file_path)) { 61 | if (!is_dir($file_path)) { 62 | throw new \RuntimeException( 63 | sprintf( 64 | 'Unable to generate the post_type , it already exist at "%s"', 65 | realpath($file_path) 66 | ) 67 | ); 68 | } 69 | } 70 | 71 | if (!file_exists($file_path_admin)) { 72 | $this->renderFile( 73 | 'plugin/plugin.php.twig', 74 | $pluginFile, 75 | $parameters, 76 | FILE_APPEND 77 | ); 78 | } 79 | 80 | $this->renderFile( 81 | 'plugin/src/PostType/class-post-type.php.twig', 82 | $file_path, 83 | $parameters 84 | ); 85 | 86 | $parameters['admin_file_exists'] = file_exists($file_path_admin); 87 | 88 | $this->renderFile( 89 | 'plugin/src/class-admin.php.twig', 90 | $file_path_admin, 91 | $parameters, 92 | FILE_APPEND 93 | ); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/Generator/SettingsPageGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function generate(array $parameters) 41 | { 42 | $plugin = $parameters['plugin']; 43 | $class = $parameters['class_name']; 44 | 45 | $pluginFile = $this->extensionManager->getPlugin($plugin)->getPathname(); 46 | $dir = $this->extensionManager->getPlugin($plugin)->getPath(); 47 | 48 | $parameters = array_merge( 49 | $parameters, [ 50 | "class_name_path" => 'SettingsPage/' . lcfirst($class) . '.php', 51 | "admin_settings_page_path" => 'admin/partials/settings-page-admin.php', 52 | "file_exists" => file_exists($pluginFile), 53 | "command_name" => 'settingspage' 54 | ] 55 | ); 56 | 57 | $file_path = $dir.'/admin/partials/'.$parameters['class_name_path']; 58 | $file_path_admin = $dir.'/'.$parameters['admin_settings_page_path']; 59 | 60 | if (file_exists($file_path)) { 61 | if (!is_dir($file_path)) { 62 | throw new \RuntimeException( 63 | sprintf( 64 | 'Unable to generate the settings page , it already exist at "%s"', 65 | realpath($file_path) 66 | ) 67 | ); 68 | } 69 | } 70 | 71 | if (!file_exists($file_path_admin)) { 72 | $this->renderFile( 73 | 'plugin/plugin.php.twig', 74 | $pluginFile, 75 | $parameters, 76 | FILE_APPEND 77 | ); 78 | } 79 | 80 | $this->renderFile( 81 | 'plugin/src/SettingsPage/class-settings-page.php.twig', 82 | $file_path, 83 | $parameters 84 | ); 85 | 86 | $parameters['admin_file_exists'] = file_exists($file_path_admin); 87 | 88 | $this->renderFile( 89 | 'plugin/src/class-admin.php.twig', 90 | $file_path_admin, 91 | $parameters, 92 | FILE_APPEND 93 | ); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/Generator/ShortcodeGenerator.php: -------------------------------------------------------------------------------- 1 | $pluginCamelCaseMachineName . '_shortcode_' . $tag . '_init', 50 | 'class_name' => $class . 'Shortcode', 51 | 'class_name_path' => 'includes/' . $pluginCamelCaseMachineName . '-shortcode-' . $tag . '.php', 52 | 'file_exists' => file_exists($pluginFile) 53 | ] 54 | ); 55 | 56 | $this->renderFile( 57 | 'plugin/includes/plugin-shortcode.php.twig', 58 | $pluginPath. '/' . $parameters['class_name_path'], 59 | $parameters 60 | ); 61 | 62 | 63 | // Add init function to register shortcode 64 | $this->renderFile( 65 | 'plugin/shortcode-init.php.twig', 66 | $pluginFile, 67 | $parameters, 68 | FILE_APPEND 69 | ); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/Generator/SidebarGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function generate(array $parameters, Site $site) 41 | { 42 | $theme = $parameters['theme']; 43 | 44 | $discoverThemes = $this->extensionManager->discoverThemes()->showActivated()->showDeactivated()->getList(); 45 | $extensions = array_combine(array_keys($discoverThemes), array_column($discoverThemes, 'Name')); 46 | $themeName = array_search($theme, $extensions); 47 | 48 | $class_name_sidebar = 'admin/partials/Sidebar/'.$themeName.'Sidebar.php'; 49 | $themeFile = $this->extensionManager->getTheme($theme)->getPathname(); 50 | $dir = $this->extensionManager->getTheme($theme)->getPath().'/'.$class_name_sidebar; 51 | 52 | $parameters = array_merge( 53 | $parameters, [ 54 | "class_name_sidebar_path" => $class_name_sidebar, 55 | "file_exists" => file_exists($themeFile.'/functions.php'), 56 | "admin_file_exists" => file_exists($dir) 57 | ] 58 | ); 59 | 60 | $site->loadLegacyFile($dir); 61 | 62 | if (function_exists($parameters['function_name'])) { 63 | throw new \RuntimeException( 64 | sprintf( 65 | 'Unable to generate the sidebar , The function name already exist at "%s"', 66 | realpath($dir) 67 | ) 68 | ); 69 | } 70 | 71 | $this->renderFile( 72 | 'theme/functions.php.twig', 73 | $themeFile.'/functions.php', 74 | $parameters, 75 | FILE_APPEND 76 | ); 77 | 78 | $this->renderFile( 79 | 'theme/src/Sidebar/sidebar.php.twig', 80 | $dir, 81 | $parameters, 82 | FILE_APPEND 83 | ); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/Generator/TaxonomyGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 34 | } 35 | 36 | /** 37 | * {@inheritdoc} 38 | */ 39 | public function generate(array $parameters) 40 | { 41 | $plugin = $parameters['plugin']; 42 | $class = $parameters['class_name']; 43 | 44 | $pluginFile = $this->extensionManager->getPlugin($plugin)->getPathname(); 45 | $dir = $this->extensionManager->getPlugin($plugin)->getPath(); 46 | 47 | $parameters = array_merge( 48 | $parameters, [ 49 | "class_name_path" => 'Taxonomy/' . lcfirst($class) . '.php', 50 | "admin_taxonomy_path" => 'admin/partials/taxonomies-admin.php', 51 | "file_exists" => file_exists($pluginFile), 52 | "command_name" => 'taxonomy' 53 | ] 54 | ); 55 | 56 | $file_path = $dir.'/admin/partials/'.$parameters['class_name_path']; 57 | $file_path_admin = $dir.'/'.$parameters['admin_taxonomy_path']; 58 | 59 | if (file_exists($file_path)) { 60 | if (!is_dir($file_path)) { 61 | throw new \RuntimeException( 62 | sprintf( 63 | 'Unable to generate the taxonomy , it already exist at "%s"', 64 | realpath($file_path) 65 | ) 66 | ); 67 | } 68 | } 69 | 70 | if (!file_exists($file_path_admin)) { 71 | $this->renderFile( 72 | 'plugin/plugin.php.twig', 73 | $pluginFile, 74 | $parameters, 75 | FILE_APPEND 76 | ); 77 | } 78 | 79 | $this->renderFile( 80 | 'plugin/src/Taxonomy/class-taxonomy.php.twig', 81 | $file_path, 82 | $parameters 83 | ); 84 | 85 | $parameters['admin_file_exists'] = file_exists($file_path_admin); 86 | 87 | $this->renderFile( 88 | 'plugin/src/class-admin.php.twig', 89 | $file_path_admin, 90 | $parameters, 91 | FILE_APPEND 92 | ); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/Generator/ThemeGenerator.php: -------------------------------------------------------------------------------- 1 | renderFile( 63 | 'theme/template.php.twig', 64 | $dir.'/'.$template.'.php', 65 | ['template' => $template, 'theme' => $parameters['theme'], 'package' => $parameters['package']] 66 | ); 67 | } 68 | } 69 | 70 | $this->renderFile( 71 | 'theme/style.css.twig', 72 | $dir.'/style.css', 73 | $parameters 74 | ); 75 | 76 | $this->renderFile( 77 | 'theme/index.php.twig', 78 | $dir.'/index.php', 79 | $parameters 80 | ); 81 | 82 | if (file_exists($screenshot)) { 83 | $file = explode(".", $screenshot); 84 | copy($screenshot, $dir.'/screenshot.'.end($file)); 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/Generator/ToolbarGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function generate(array $parameters, Site $site) 41 | { 42 | $plugin = $parameters['plugin']; 43 | 44 | $pluginFile = $this->extensionManager->getPlugin($plugin)->getPathname(); 45 | $dir = $this->extensionManager->getPlugin($plugin)->getPath(); 46 | 47 | 48 | $parameters = array_merge( 49 | $parameters, [ 50 | "admin_toolbar_path" => 'admin/partials/toolbars-admin.php', 51 | "file_exists" => file_exists($pluginFile), 52 | "command_name" => 'toolbar' 53 | ] 54 | ); 55 | 56 | $file_path_admin = $dir.'/'.$parameters['admin_toolbar_path']; 57 | $parameters['admin_file_exists'] = file_exists($file_path_admin); 58 | 59 | if (!file_exists($file_path_admin)) { 60 | $this->renderFile( 61 | 'plugin/plugin.php.twig', 62 | $pluginFile, 63 | $parameters, 64 | FILE_APPEND 65 | ); 66 | } else { 67 | $site->loadLegacyFile($file_path_admin); 68 | 69 | if (function_exists($parameters['function_name'])) { 70 | throw new \RuntimeException( 71 | sprintf( 72 | 'Unable to generate the sidebar , The function name already exist at "%s"', 73 | realpath($file_path_admin) 74 | ) 75 | ); 76 | } 77 | } 78 | 79 | $this->renderFile( 80 | 'plugin/src/Toolbar/toolbar.php.twig', 81 | $file_path_admin, 82 | $parameters, 83 | FILE_APPEND 84 | ); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/Generator/UserContactMethodsGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function generate(array $parameters, Site $site) 41 | { 42 | $plugin = $parameters['plugin']; 43 | 44 | $pluginFile = $this->extensionManager->getPlugin($plugin)->getPathname(); 45 | $dir = $this->extensionManager->getPlugin($plugin)->getPath(); 46 | 47 | $parameters = array_merge( 48 | $parameters, [ 49 | "admin_user_contact_methods_path" => 'admin/partials/userContactMethods-admin.php', 50 | "file_exists" => file_exists($pluginFile), 51 | "command_name" => 'userContactMethods' 52 | ] 53 | ); 54 | 55 | $file_path_admin = $dir.'/'.$parameters['admin_user_contact_methods_path']; 56 | $parameters['admin_file_exists'] = file_exists($file_path_admin); 57 | 58 | if (!file_exists($file_path_admin)) { 59 | $this->renderFile( 60 | 'plugin/plugin.php.twig', 61 | $pluginFile, 62 | $parameters, 63 | FILE_APPEND 64 | ); 65 | } else { 66 | $site->loadLegacyFile($file_path_admin); 67 | 68 | if (function_exists($parameters['function_name'])) { 69 | throw new \RuntimeException( 70 | sprintf( 71 | 'Unable to generate the user_contactmethods , The function name already exist at "%s"', 72 | realpath($file_path_admin) 73 | ) 74 | ); 75 | } 76 | } 77 | 78 | $this->renderFile( 79 | 'plugin/src/UserContactMethods/user-contactmethods.php.twig', 80 | $file_path_admin, 81 | $parameters, 82 | FILE_APPEND 83 | ); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/Generator/WidgetGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function generate(array $parameters) 41 | { 42 | $plugin = $parameters['plugin']; 43 | $class = $parameters['class_name']; 44 | 45 | $pluginFile = $this->extensionManager->getPlugin($plugin)->getPathname(); 46 | $dir = $this->extensionManager->getPlugin($plugin)->getPath(); 47 | 48 | $parameters = array_merge( 49 | $parameters, [ 50 | "class_name_path" => 'Widget/' . lcfirst($class) . '.php', 51 | "admin_widget_path" => 'admin/partials/widgets-admin.php', 52 | "file_exists" => file_exists($pluginFile), 53 | "command_name" => 'widget' 54 | ] 55 | ); 56 | 57 | $file_path = $dir.'/admin/partials/'.$parameters['class_name_path']; 58 | $file_path_admin = $dir.'/'.$parameters['admin_widget_path']; 59 | 60 | if (file_exists($file_path)) { 61 | if (!is_dir($file_path)) { 62 | throw new \RuntimeException( 63 | sprintf( 64 | 'Unable to generate the widgets , it already exist at "%s"', 65 | realpath($file_path) 66 | ) 67 | ); 68 | } 69 | } 70 | 71 | if (!file_exists($file_path_admin)) { 72 | $this->renderFile( 73 | 'plugin/plugin.php.twig', 74 | $pluginFile, 75 | $parameters, 76 | FILE_APPEND 77 | ); 78 | } 79 | 80 | $this->renderFile( 81 | 'plugin/src/Widget/class-widget.php.twig', 82 | $file_path, 83 | $parameters 84 | ); 85 | 86 | $parameters['admin_file_exists'] = file_exists($file_path_admin); 87 | 88 | $this->renderFile( 89 | 'plugin/src/class-admin.php.twig', 90 | $file_path_admin, 91 | $parameters, 92 | FILE_APPEND 93 | ); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/Helper/WordpressFinder.php: -------------------------------------------------------------------------------- 1 | wordpressRoot = false; 18 | 19 | foreach (array(true, false) as $follow_symlinks) { 20 | $path = $start_path; 21 | if ($follow_symlinks && is_link($path)) { 22 | $path = realpath($path); 23 | } 24 | // Check the start path. 25 | if ($this->isValidRoot($path)) { 26 | return true; 27 | } 28 | } 29 | 30 | return false; 31 | } 32 | 33 | /** 34 | * @param $path 35 | * 36 | * @return bool 37 | */ 38 | protected function isValidRoot($path) 39 | { 40 | // Validate that Wordpress load files is available 41 | if (!empty($path) && is_dir($path) && file_exists($path . '/wp-load.php')) { 42 | $this->wordpressRoot = $path; 43 | } else { 44 | $this->wordpressRoot = false; 45 | } 46 | return (bool) $this->wordpressRoot; 47 | } 48 | 49 | /** 50 | * @return string 51 | */ 52 | public function getWordpressRoot() 53 | { 54 | return $this->wordpressRoot; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Utils/Create/RoleData.php: -------------------------------------------------------------------------------- 1 | site = $site; 42 | $this->wordpressApi = $wordpressApi; 43 | } 44 | 45 | /** 46 | * Create and returns an array of new Roles. 47 | * 48 | * @param $limit 49 | * 50 | * @return array 51 | */ 52 | public function create( 53 | $limit 54 | ) { 55 | $faker = Faker\Factory::create(); 56 | $roles = []; 57 | $this->site->loadLegacyFile('wp-includes/capabilities.php'); 58 | 59 | for ($i = 0; $i < $limit; $i++) { 60 | $rolename = $faker->userName(); 61 | 62 | try { 63 | $role = add_role( 64 | $rolename, 65 | $rolename, 66 | [ 67 | "edit_posts" => true, 68 | "read" => true, 69 | "level_1" => true, 70 | "level_0" => true, 71 | "delete_posts" => true 72 | ] 73 | ); 74 | 75 | $roles['success'][] = [ 76 | 'role-id' => $role->name, 77 | 'role-name' => $role->name 78 | ]; 79 | } catch (\Exception $error) { 80 | $roles['error'][] = [ 81 | 'error' => $error->getMessage() 82 | ]; 83 | } 84 | } 85 | 86 | return $roles; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/Utils/Create/UserData.php: -------------------------------------------------------------------------------- 1 | site = $site; 35 | } 36 | 37 | /** 38 | * Create and returns an array of new Users. 39 | * 40 | * @param $roles 41 | * @param $limit 42 | * @param $password 43 | * @param $timeRange 44 | * 45 | * @return array 46 | */ 47 | public function create( 48 | $role, 49 | $limit, 50 | $password, 51 | $timeRange 52 | ) { 53 | 54 | $faker = Faker\Factory::create(); 55 | $faker->password(); 56 | 57 | $users = []; 58 | for ($i=0; $i<$limit; $i++) { 59 | 60 | try { 61 | $username = $faker->name; 62 | $userpass = $password?$password:$faker->password(); 63 | $userID = wp_insert_user( array( 64 | 'user_login' => $faker->userName(), 65 | 'user_pass' => $userpass, 66 | 'user_email' => $faker->email, 67 | 'nickname' => $username, 68 | 'display_name' => $username, 69 | 'role' => $role, 70 | 'user_registered' => date('Y-m-d H:i:s', time() - mt_rand(0, $timeRange)) 71 | ) 72 | ); 73 | 74 | $user = $this->site->getUserBy('id', $userID); 75 | 76 | $users['success'][] = [ 77 | 'user-id' => $user->ID, 78 | 'username' => $user->get('user_login'), 79 | 'password' => $userpass, 80 | 'role' => $user->roles[0], 81 | 'created' => $user->get('user_registered'), 82 | ]; 83 | } catch (\Exception $error) { 84 | 85 | $users['error'][] = [ 86 | 'error' => $error->getMessage() 87 | ]; 88 | } 89 | } 90 | 91 | return $users; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /templates/base/class.php.twig: -------------------------------------------------------------------------------- 1 | /dev/null 10 | fi 11 | -------------------------------------------------------------------------------- /templates/core/config.yml.twig: -------------------------------------------------------------------------------- 1 | application: 2 | environment: 'prod' 3 | language: '{{language}}' 4 | editor: 'vim' 5 | temp: '{{temp}}' 6 | develop: 'false' 7 | command: 'about' 8 | checked: 'false' 9 | clear: 'false' 10 | remote: 11 | user: 'wordpress' 12 | # password: 'wordpress' 13 | port: '22' 14 | # keys: 15 | # public: '~/.ssh/id_rsa.pub' 16 | # private: '~/.ssh/id_rsa' 17 | # passphrase: '~/.ssh/passphrase.txt' 18 | disable: 19 | modules: 20 | # - module_name_one 21 | # - module_name_two 22 | commands: 23 | # module:download: 'composer require drupal/project' 24 | namespaces: 25 | # - generate 26 | # - create 27 | options: 28 | learning: {{learning}} 29 | # target: drupalvm.dev 30 | # uri: miltisite.dev 31 | generate-inline: {{generate_inline}} 32 | generate-chain: {{generate_chain}} 33 | -------------------------------------------------------------------------------- /templates/core/htaccess.twig: -------------------------------------------------------------------------------- 1 | # BEGIN WordPress 2 | 3 | RewriteEngine On 4 | RewriteBase / 5 | RewriteRule ^index\.php$ - [L] 6 | {% if multisite %} 7 | 8 | # add a trailing slash to /wp-admin 9 | RewriteRule ^wp-admin$ wp-admin/ [R=301,L] 10 | 11 | RewriteCond %{REQUEST_FILENAME} -f [OR] 12 | RewriteCond %{REQUEST_FILENAME} -d 13 | RewriteRule ^ - [L] 14 | {% if subdomains %} 15 | RewriteRule ^(wp-(content|admin|includes).*) $1 [L] 16 | RewriteRule ^(.*\.php)$ $1 [L] 17 | {% else %} 18 | RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] 19 | RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] 20 | {% endif %} 21 | {% else %} 22 | RewriteCond %{REQUEST_FILENAME} !-f 23 | RewriteCond %{REQUEST_FILENAME} !-d 24 | {% endif %} 25 | RewriteRule . /index.php [L] 26 | 27 | # END WordPress 28 | 29 | 30 | -------------------------------------------------------------------------------- /templates/core/index-silent.php.twig: -------------------------------------------------------------------------------- 1 | setName('{{ name }}') 51 | ->setDescription($this->trans('commands.{{ command_key }}.description')); 52 | } 53 | 54 | /** 55 | * {@inheritdoc} 56 | */ 57 | protected function execute(InputInterface $input, OutputInterface $output) { 58 | $this->getIo()->info($this->trans('commands.{{ command_key }}.messages.success')); 59 | } 60 | {%- endblock -%} 61 | -------------------------------------------------------------------------------- /templates/plugin/src/Command/console/translations/en/command.yml.twig: -------------------------------------------------------------------------------- 1 | description: 'WP Console generated command.' 2 | options: {} 3 | arguments: {} 4 | messages: 5 | success: 'I am a new generated command.' -------------------------------------------------------------------------------- /templates/plugin/src/Cron/class-cron-schedule.php.twig: -------------------------------------------------------------------------------- 1 | {%- extends "base/class.php.twig" -%} 2 | {%- block class_declaration -%} 3 | /** 4 | * Add {{ class_name }} schedule cron. 5 | */ 6 | class {{ class_name }} {% endblock -%} 7 | {% block class_construct %} 8 | /** 9 | * 10 | */ 11 | public function __construct() 12 | { 13 | add_action('init', array( $this, 'custom_{{ hook_name }}_cron' )); 14 | add_action('{{ hook_name }}', array( $this, '{{ hook_name }}' )); 15 | {% if recurrence is iterable %} 16 | add_filter( 'cron_schedules', array( $this, '{{ hook_name }}_cron_recurrence' ) ); 17 | 18 | {% endif %} 19 | } 20 | 21 | {% endblock %} 22 | 23 | {% block class_methods %} 24 | {% if recurrence is iterable %} 25 | // Custom Cron Recurrences 26 | public function {{ hook_name }}_cron_recurrence( $schedules ) { 27 | $schedules['{{ recurrence.name|lower|replace({' ': ''}) }}'] = array( 28 | 'display' => __( '{{ recurrence.label }}', 'textdomain' ), 29 | 'interval' => {{ recurrence.interval }}, 30 | ); 31 | return $schedules; 32 | } 33 | 34 | {% endif %} 35 | 36 | /** 37 | * Schedule Cron Event 38 | */ 39 | public function custom_{{ hook_name }}_cron() 40 | { 41 | if ( ! wp_next_scheduled( '{{ hook_name }}' ) ) { 42 | wp_schedule_event( 43 | {% if timestamp == "GMT Time" %} 44 | time(), 45 | {% else %} 46 | current_time( 'timestamp' ), 47 | {% endif %} 48 | {% if recurrence is iterable %} 49 | '{{ recurrence.name|lower|replace({' ': ''}) }}', 50 | {% else %} 51 | '{{ recurrence|lower|replace({' ': ''}) }}', 52 | {% endif %} 53 | '{{ hook_name }}' 54 | {%- if hook_arguments is defined and hook_arguments is not empty -%}, 55 | array({% for item in hook_arguments %} '{{ item }}',{% endfor %}) 56 | {% endif %} 57 | ); 58 | } 59 | } 60 | 61 | // Scheduled Action Hook 62 | public function {{ hook_name }}({% if hook_arguments is defined and hook_arguments is not empty %}{% for item in hook_arguments %} $param{{ loop.index }} = '{{ item }}',{% endfor %}{% endif %}) 63 | { 64 | // do something 65 | } 66 | {% endblock %} -------------------------------------------------------------------------------- /templates/plugin/src/Cron/class-cron-single.php.twig: -------------------------------------------------------------------------------- 1 | {%- extends "base/class.php.twig" -%} 2 | {%- block class_declaration -%} 3 | /** 4 | * Add {{ class_name }} schedule cron. 5 | */ 6 | class {{ class_name }} {% endblock -%} 7 | {% block class_construct %} 8 | /** 9 | * 10 | */ 11 | public function __construct() 12 | { 13 | add_action('init', array( $this, 'custom_{{ hook_name }}_single_cron' )); 14 | add_action('{{ hook_name }}', array( $this, '{{ hook_name }}' )); 15 | } 16 | 17 | {% endblock %} 18 | 19 | {% block class_methods %} 20 | /** 21 | * Schedule Cron Event 22 | */ 23 | public function custom_{{ hook_name }}_single_cron() 24 | { 25 | if ( ! wp_next_scheduled( '{{ hook_name }}' ) ) { 26 | wp_schedule_single_event( 27 | strtotime('{{ timestamp }}'), 28 | '{{ hook_name }}' 29 | {%- if hook_arguments is defined and hook_arguments is not empty -%}, 30 | array({% for item in hook_arguments %} '{{ item }}',{% endfor %}) 31 | {% endif %} 32 | ); 33 | } 34 | } 35 | 36 | // Scheduled Action Hook 37 | public function {{ hook_name }}({% if hook_arguments is defined and hook_arguments is not empty %}{% for item in hook_arguments %} $param{{ loop.index }} = '{{ item }}',{% endfor %}{% endif %}) 38 | { 39 | // do something 40 | } 41 | {% endblock %} -------------------------------------------------------------------------------- /templates/plugin/src/Menu/class-menu.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | {% block class_declaration %} 3 | /** 4 | * Represents a menu to be displayed. 5 | */ 6 | class {{ class_name }} {% endblock -%} 7 | {% block class_methods %} 8 | /** 9 | * Class constructor. 10 | */ 11 | public function __construct() 12 | { 13 | {% if child_theme %} 14 | if ( ! function_exists( '{{ function_name }}' )) { 15 | add_action( 'init', array( $this, '{{ function_name }}')); 16 | } 17 | {% else %} 18 | add_action( 'init', array( $this, '{{ function_name }}')); 19 | {% endif %} 20 | } 21 | 22 | // Register Navigation Menus 23 | function {{ function_name }}() 24 | { 25 | $locations = array( 26 | {% for label in menu_items %} 27 | '{{ label.name }}' => __('{{ label.description }}', 'text_domain'), 28 | {% endfor %} 29 | ); 30 | register_nav_menus( $locations ); 31 | } 32 | {%- endblock -%} 33 | 34 | -------------------------------------------------------------------------------- /templates/plugin/src/QuickTag/quicktag.js.twig: -------------------------------------------------------------------------------- 1 | {% for item in quicktag_items %} 2 | edButtons[edButtons.length] = new edButton({% for key, value in item %}{% if key == "priority" %}{{ value }},{% else %}'{{ value }}',{% endif %}{% endfor %}); 3 | {% endfor %} -------------------------------------------------------------------------------- /templates/plugin/src/RegisterStyle/register-styles.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/file.php.twig" %} 2 | {% block extra_info %} 3 | {% if not admin_file_exists %} 4 | * Functions with custom class {{ command_name }} 5 | {% endif %} 6 | {% endblock %} 7 | {% block file_docblock %} 8 | {% if not admin_file_exists %} 9 | {{ parent() }} 10 | {% endif %} 11 | {% endblock %} 12 | {% block file_methods %} 13 | // Register Style 14 | function {{ function_name }}() { 15 | {% if register_items is defined %} 16 | {% for item in register_items %} 17 | 18 | {% if item.deregister %} 19 | wp_deregister_{{ type }}( '{{ item.name }}' ); 20 | {% endif %} 21 | wp_register_{{ type }}( 22 | '{{ item.name }}', 23 | '{{ item.url }}', 24 | array({% if item.dependencies is defined and item.dependencies|length > 0 %}{% for label in item.dependencies %}'{{ label }}',{% endfor %}{% endif %}), 25 | '{{ item.version }}', 26 | {% if type == "script" %} 27 | {% if item.location == "footer" %} 28 | true 29 | {% else %} 30 | false 31 | {% endif %} 32 | {% else %} 33 | '{{ item.media }}' 34 | {% endif %} 35 | ); 36 | {% if item.enqueue %} 37 | wp_enqueue_{{ type }}( '{{ item.name }}' ); 38 | {% endif %} 39 | {% endfor %} 40 | {% endif %} 41 | } 42 | add_action( '{{ hook }}', '{{ function_name }}' ); 43 | {%- endblock -%} -------------------------------------------------------------------------------- /templates/plugin/src/Toolbar/toolbar.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/file.php.twig" %} 2 | {% block extra_info %} 3 | {% if not admin_file_exists %} 4 | * Functions with custom class {{ command_name }} 5 | {%- endif -%} 6 | {%- endblock -%} 7 | {% block file_docblock %} 8 | {% if not admin_file_exists %} 9 | {{ parent() }} 10 | {%- endif -%} 11 | {%- endblock -%} 12 | {% block file_methods %} 13 | // Display Toolbar 14 | function {{ function_name }}() { 15 | global $wp_admin_bar; 16 | {% if menu_items is defined %} 17 | {% for item in menu_items %} 18 | $args = array( 19 | {% for key, value in item %} 20 | {% if key == 'title' %} 21 | '{{ key }}' => __('{{ value }}', 'text_domain'), 22 | {% elseif key == 'meta' %} 23 | 'meta' => array( 24 | {% for index, metas in value %} 25 | '{{ index }}' => '{{ metas }}', 26 | {% endfor %} 27 | ), 28 | {% else %} 29 | '{{ key }}' => '{{ value }}', 30 | {% endif %} 31 | {% endfor %} 32 | ); 33 | {% endfor %} 34 | $wp_admin_bar->add_menu( $args ); 35 | {% endif %} 36 | } 37 | add_action( 'wp_before_admin_bar_render', '{{ function_name }}', 999 ); 38 | {%- endblock -%} -------------------------------------------------------------------------------- /templates/plugin/src/UserContactMethods/user-contactmethods.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/file.php.twig" %} 2 | {% block extra_info %} 3 | {% if not admin_file_exists %} 4 | * Functions with custom class {{ command_name }} 5 | {%- endif -%} 6 | {%- endblock -%} 7 | {% block file_docblock %} 8 | {% if not admin_file_exists %} 9 | {{ parent() }} 10 | {%- endif -%} 11 | {%- endblock -%} 12 | {% block file_methods %} 13 | // Register User Contact Methods 14 | function {{ function_name }}( $user_contact_method ) { 15 | {% if methods_items is defined %} 16 | {% for item in methods_items %} 17 | $user_contact_method['{{ item.name }}'] = __( '{{ item.description }}', 'text_domain' ); 18 | {% endfor %} 19 | {% endif %} 20 | return $user_contact_method; 21 | } 22 | add_filter( 'user_contactmethods', '{{ function_name }}' ); 23 | {%- endblock -%} -------------------------------------------------------------------------------- /templates/plugin/src/Widget/class-dashboard-widgets.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | {%- block class_declaration %} 3 | /** 4 | * Create {{ class_name }} dashboard. 5 | */ 6 | class {{ class_name }} {% endblock -%} 7 | 8 | {% block class_construct %} 9 | /** 10 | * Sets up the dashboard widget etc 11 | */ 12 | public function __construct() 13 | { 14 | add_action('wp_dashboard_setup', array( $this, 'add_dashboard_widget')); 15 | } 16 | 17 | {% endblock %} 18 | 19 | {% block class_methods %} 20 | /** 21 | * Register the widget 22 | */ 23 | public function add_dashboard_widget() 24 | { 25 | wp_add_dashboard_widget( 26 | '{{ id }}', //A unique slug/ID 27 | __( '{{ title }}', '{{ text_domain }}' ), //Visible name for the widget 28 | //Callback for the main widget content 29 | '{{ render_function }}' 30 | {%- if submission_function is defined and submission_function -%}, 31 | //Optional callback for widget submission function 32 | '{{ id }}_submission_callback' 33 | {%- endif -%} 34 | {%- if callback_arguments is defined and callback_arguments is not empty -%}, 35 | {% if submission_function is not defined or submission_function == false %} 36 | //Optional callback for widget submission function 37 | null, 38 | {% endif %} 39 | // Optional: Callback args 40 | array({{ callback_arguments }}) 41 | {% endif %} 42 | ); 43 | } 44 | 45 | /** 46 | * Outputs the content of the dashboard widget 47 | */ 48 | public function {{ render_function }}({% if callback_arguments is defined and callback_arguments is not empty %}$args{% endif %}) 49 | { 50 | {% if callback_arguments is defined and callback_arguments is not empty %} 51 | var_dump($args); 52 | {% else %} 53 | //Do something here 54 | {% endif %} 55 | } 56 | 57 | {% if submission_function is defined and submission_function %} 58 | /* 59 | * Submission function 60 | */ 61 | public function {{ id }}_submission_callback() 62 | { 63 | //Do something here 64 | } 65 | {%- endif -%} 66 | {%- endblock -%} -------------------------------------------------------------------------------- /templates/plugin/src/class-admin.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/file.php.twig" %} 2 | {%- block extra_info -%} 3 | {%- if not admin_file_exists -%} 4 | * Functions with custom class {{ command_name }} 5 | {%- endif -%} 6 | {%- endblock -%} 7 | {%- block file_docblock -%} 8 | {%- if not admin_file_exists -%} 9 | {{ parent() }} 10 | {%- endif -%} 11 | {%- endblock -%} 12 | {%- block file_methods -%} 13 | {% if command_name == 'widget' %} 14 | // Register and load the widget 15 | function add_{{ command_name }}_{{ class_name }}() 16 | { 17 | // Include the files for rendering the display. 18 | include_once plugin_dir_path( __FILE__ ) . '{{ class_name_path }}'; 19 | 20 | register_widget( '{{ class_name }}' ); 21 | } 22 | add_action( 'widgets_init', 'add_{{ command_name }}_{{ class_name }}' ); 23 | {% else %} 24 | /** 25 | * Return a custom {{ command_name }} class 26 | * This action is documented in {{ class_name_path }} 27 | */ 28 | function add_{{ command_name }}_{{ class_name }}() 29 | { 30 | // Include the files for rendering the display. 31 | include_once plugin_dir_path( __FILE__ ) . '{{ class_name_path }}'; 32 | 33 | new {{ class_name }}(); 34 | } 35 | add_{{ command_name }}_{{ class_name }}(); 36 | {% endif %} 37 | {%- endblock -%} -------------------------------------------------------------------------------- /templates/plugin/uninstall.php.twig: -------------------------------------------------------------------------------- 1 | 17 | 22 | __('{{ value }}', 'text_domain'), 20 | {% else %} 21 | '{{ key }}' => '{{ value }}', 22 | {% endif %} 23 | {% endfor %} 24 | ); 25 | register_sidebar( $args ); 26 | {% endfor %} 27 | } 28 | add_action( 'widgets_init', '{{ function_name }}'); 29 | 30 | {%- endblock -%} -------------------------------------------------------------------------------- /templates/theme/style.css.twig: -------------------------------------------------------------------------------- 1 | /* 2 | Theme Name: {{ theme|replace({'-':''}) }} 3 | Theme URI: {{ theme_uri }} 4 | Author: {{ author }} 5 | Author URI: {{ author_uri }} 6 | Description: {{ description }} 7 | Version: 0.1 8 | Text Domain: {{ theme }} 9 | */ -------------------------------------------------------------------------------- /templates/theme/template.php.twig: -------------------------------------------------------------------------------- 1 |