diff --git a/.gitignore b/.gitignore index 06171cb4..75ec4419 100644 --- a/.gitignore +++ b/.gitignore @@ -40,7 +40,7 @@ cache node_modules scratch -src/vendor-prefixed/ +/vendor-prefixed/ wp-content/ wordpress /vendor/ diff --git a/README.md b/README.md index 812fc1ca..4d79284d 100644 --- a/README.md +++ b/README.md @@ -291,20 +291,20 @@ mysql -u $mysql_username -p$mysql_password $TEST_SITE_DB_NAME < tests/_data/dump To create a .zip archive for uploading to WordPress: ``` -mv src $(basename "`pwd`"); zip -r $(basename "`pwd`").zip $(basename "`pwd`"); mv $(basename "`pwd`") src; +mv includes $(basename "`pwd`"); zip -r $(basename "`pwd`").zip $(basename "`pwd`"); mv $(basename "`pwd`") includes; ``` To configure automatic WordPress.org plugin repository deployment, add your WordPress.org username and password as Secrets `SVN_USERNAME` and `SVN_PASSWORD` in the GitHub repository's settings, then when a Release is created, the plugin will be updated on WordPress.org (from [zerowp.com](https://zerowp.com)'s [Use Github Actions to publish WordPress plugins on WP.org repository](https://zerowp.com/use-github-actions-to-publish-wordpress-plugins-on-wp-org-repository/)). ## Composer Notes -By convention, WordPress plugins and themes installed by composer get installed into the project's `/wp-content/plugins` and `/wp-content/themes` directory. In a typical PHP project, libraries required by the project during runtime are installed in the `vendor` directory. In the case of this project, libraries are downloaded to the project's `vendor` folder, then their files copied to `src/vendor` and their namespace changed. +By convention, WordPress plugins and themes installed by composer get installed into the project's `/wp-content/plugins` and `/wp-content/themes` directory. In a typical PHP project, libraries required by the project during runtime are installed in the `vendor` directory. In the case of this project, libraries are downloaded to the project's `vendor` folder, then their files copied to `vendor-prefixed` and their namespace changed. https://stackoverflow.com/a/32407670/336146 ### Mozart -[Mozart](https://github.com/coenjacobs/mozart) is included in composer.json to prefix libraries' namespaces to avoid clashes with other WordPress plugins. e.g. in this case, [wp-namespace-autoloader](https://github.com/pablo-sg-pacheco/wp-namespace-autoloader) appears in `src/vendor/` with the namespace `Plugin_Name\Pablo_Pacheco\WP_Namespace_Autoloader`. +[Mozart](https://github.com/coenjacobs/mozart) is included in composer.json to prefix libraries' namespaces to avoid clashes with other WordPress plugins. e.g. in this case, [wp-namespace-autoloader](https://github.com/pablo-sg-pacheco/wp-namespace-autoloader) appears in `vendor-prefixed/` with the namespace `Plugin_Name\Pablo_Pacheco\WP_Namespace_Autoloader`. To use e.g. a [.ics parser](https://github.com/u01jmg3/ics-parser) in your project: diff --git a/composer.json b/composer.json index 1246d8db..9b3753a5 100644 --- a/composer.json +++ b/composer.json @@ -168,10 +168,10 @@ "updated_files=$( git status | grep -v 'deleted' | grep '.php$' | cut -c14- | awk '{ printf(\"%s \", $0) }' ); phpcbf $(echo $updated_files); phpcs $(echo $updated_files); phpstan analyse $(echo $updated_files) --memory-limit 1G" ], "php-compatibility": [ - "phpcs -p src templates vendor-prefixed --standard=PHPCompatibilityWP --runtime-set testVersion 7.4-" + "phpcs -p includes templates vendor-prefixed --standard=PHPCompatibilityWP --runtime-set testVersion 7.4-" ], "create-plugin-archive": [ - "wp i18n make-pot src languages/$(basename \"$PWD\").pot --domain=$(basename \"$PWD\")", + "wp i18n make-pot includes languages/$(basename \"$PWD\").pot --domain=$(basename \"$PWD\")", "wp dist-archive . ./dist-archive --plugin-dirname=$(basename \"$PWD\") --create-target-dir" ], "generate-openapi": [ diff --git a/src/admin/class-admin-assets.php b/includes/admin/class-admin-assets.php similarity index 100% rename from src/admin/class-admin-assets.php rename to includes/admin/class-admin-assets.php diff --git a/src/admin/class-settings-page.php b/includes/admin/class-settings-page.php similarity index 100% rename from src/admin/class-settings-page.php rename to includes/admin/class-settings-page.php diff --git a/src/class-plugin-slug.php b/includes/class-plugin-slug.php similarity index 100% rename from src/class-plugin-slug.php rename to includes/class-plugin-slug.php diff --git a/src/class-settings.php b/includes/class-settings.php similarity index 100% rename from src/class-settings.php rename to includes/class-settings.php diff --git a/src/frontend/class-frontend-assets.php b/includes/frontend/class-frontend-assets.php similarity index 100% rename from src/frontend/class-frontend-assets.php rename to includes/frontend/class-frontend-assets.php diff --git a/src/interface-settings-interface.php b/includes/interface-settings-interface.php similarity index 100% rename from src/interface-settings-interface.php rename to includes/interface-settings-interface.php diff --git a/src/wp-includes/class-activator.php b/includes/wp-includes/class-activator.php similarity index 100% rename from src/wp-includes/class-activator.php rename to includes/wp-includes/class-activator.php diff --git a/src/wp-includes/class-admin-ajax.php b/includes/wp-includes/class-admin-ajax.php similarity index 100% rename from src/wp-includes/class-admin-ajax.php rename to includes/wp-includes/class-admin-ajax.php diff --git a/src/wp-includes/class-deactivator.php b/includes/wp-includes/class-deactivator.php similarity index 100% rename from src/wp-includes/class-deactivator.php rename to includes/wp-includes/class-deactivator.php diff --git a/src/wp-includes/class-i18n.php b/includes/wp-includes/class-i18n.php similarity index 100% rename from src/wp-includes/class-i18n.php rename to includes/wp-includes/class-i18n.php diff --git a/phpstan.neon b/phpstan.neon index f24dbb43..4d86688c 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,7 +1,7 @@ parameters: level: 8 paths: - - src + - includes - plugin-slug.php - autoload.php - uninstall.php diff --git a/tests/_wpenv/initialize-external.sh b/tests/_wpenv/initialize-external.sh index 77c51aa7..25577084 100755 --- a/tests/_wpenv/initialize-external.sh +++ b/tests/_wpenv/initialize-external.sh @@ -10,7 +10,7 @@ PLUGIN_SLUG=$(basename $PWD) echo "Building $PLUGIN_SLUG" # Build the plugin -vendor/bin/wp i18n make-pot src languages/$PLUGIN_SLUG.pot --domain=$PLUGIN_SLUG +vendor/bin/wp i18n make-pot includes languages/$PLUGIN_SLUG.pot --domain=$PLUGIN_SLUG vendor/bin/wp dist-archive . ./tests/e2e-pw/setup --plugin-dirname=$PLUGIN_SLUG --filename-format="{name}.latest" # Run the internal scripts which configure the environments: