geoip-detect

So you are a developer looking on how to get started to modify this plugin? Great! Here are some hints:

About the project

Unsure if your pull request will be accepted?

Generally, I am very open to accept contributions, and to help those who take the time contributing. Here are some general guidelines:

Scope of the project

The target audience of this plugin are the Wordpress coders. They can use the functionality provided by this plugin on their (clients’?) sites, in their plugins or themes, etc. In some cases, integrating into other standard plugins is part of this project, but most of the time, this plugin will be integrated and thus, has to have a stable and documented API. (Only functions in api.php, and documented Wordpress filters, are deemed official API.)

However, more and more also non-coders are using this plugin. That’s ok, as it can be helpful to them as well (for example via the shortcodes) - and if I find ways of decreasing the number of support requests I get from them, that’s great - but they are not my main audience. End-Users would need a simplified UI that helps them set up the plugin (the issues I get most contacted about are reverse proxies and site caches), so if you want to create a frontend for this, that would be great. It’s not my priority, though.

About coding

General procedure

Phpunit tests

After each commit that is uploaded to the repo, Travis executes all tests. (So if it is too complicated for you too install this locally, just create the pull request and wait for the travis tests to execute.)

If you want to execute them locally:

It should show something like that at the end of the output:

OK (165 tests, 5434 assertions)

JS / Ajax Mode

When editing the JS files, you need to recompile it.

Do this once (after installing yarn):

yarn install

While testing your changes, start this and leave it open

yarn start 

Then run this command to create a production version of the final JS:

yarn build

Then you can commit your changes.

Jest Unit Tests

After setting up the JS dev environment (see above), simply run:

yarn test

Composer

The composer PHP dependencies are also committed to the git project (because they need to be present in the Wordpress SVN repo as well), so you only need to install composer if you need to add a dependency there.