GithubHelp home page GithubHelp logo

isabella232 / crowdsignal-forms Goto Github PK

View Code? Open in Web Editor NEW

This project forked from automattic/crowdsignal-forms

0.0 0.0 0.0 3.92 MB

Gutenberg blocks for Crowdsignal

License: GNU General Public License v2.0

Makefile 0.51% SCSS 6.12% JavaScript 41.00% PHP 45.00% Dockerfile 0.61% Shell 5.46% CSS 1.30%

crowdsignal-forms's Introduction

Crowdsignal Forms

Note: this file is intended for developers, the plugin readme is README.txt

Using docker for local dev

You will need the following installed locally:

More info here. After you finish with that setup, you can run the docker instance like this:

make docker_up

Access the site through http://localhost:8000

Login to the Docker container using this command:

make docker_sh

Setting up for JS and CSS

  • make install will install any required Node modules.
  • make client will build the CSS and JavaScript files required by the plugin.
  • make clean will delete the generated CSS and JavaScript files.

Running the PHP linter and tests

Assuming you are using the docker setup:

  • Set up the local test env by running ./tests/bin/install.sh crowdsignal_forms_tests (see install.sh for more info on arguments)
  • If on debian, install php-xml and php-mbstring
  • composer install
  • ./vendor/bin/phpunit
  • ./vendor/bin/phpcs
  • make composer
  • make phpunit
  • make phpcs

How to set a test usercode for the API

Filter the crowdsignal_user_code user meta call to return a test usercode. Add this snippet to the main crowdsignal-forms.php file and return your custom usercode string:

function crowdsignal_get_test_user_code( $check, $object_id, $meta_key, $single ) {
    if ( 'crowdsignal_user_code' === $meta_key ) {
        return 'your-custom-user-code-here';
    }

    return null;
}
add_filter( 'get_user_metadata', 'crowdsignal_get_test_user_code', 10, 4 );

Translations

We use translate.wordpress.com for translating Crowdsignal Forms. Prior to shipping a release candidate, or release, we need to ensure an updated potfile is uploaded to our translate.wordpress.com project.

To do that, run make pot to update the potfile. Additionally, this will run any time you do make release.

Remember to commit the updated .pot file.

Compile for Release

Run make release. This will compile all production files necessary for the plugin, add them to a zip archive, and copy it to the release folder.

PHP Class Conventions

We use our own autoloader for loading classes. When adding new classes follow these conventions:

  • all classes live within the includes folder or it's subdirs. This folder is implicitly namespaced as Crowdsignal_Forms
  • all class file names must be prefixed with class-
  • any - in a folder name or file name needs to be a _ in the class or namespace name.
  • if you nest in folders, that folder name should be added to the class namespace with the first letter capitalized.

examples:

Crowdsignal_Forms\Foo -> includes/class-foo.php
Crowdsignal_Forms\Foo\Bar\Baz\Foobar -> includes/foo/bar/baz/class-foobar.php
Crowdsignal_Forms\Rest_API\Bar -> includes/rest-api/class-bar.php

crowdsignal-forms's People

Contributors

akirk avatar cgastrell avatar donnchawp avatar ice9js avatar jgcaruso avatar pgk avatar roundhill avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.