bac0823429c4150fce8bf08ae15df223a14a94e0
namp2
Not another MP2 a.k.a MP3 done the right way.
Install.
- Install system dependencies:
php
nodejs
phantomjs
-
Clone the repo in wp-content/plugins.
-
Install composer.
$ curl -sS https://getcomposer.org/installer | php
$ ./composer.phar install
- Install dependencies.
$ ./do install
- Update dependencies when needed.
$ ./do update
- Copy .env.sample to .env.
$ cp .env.sample .env
Structure.
- Dependencies.
# PHP dependencies.
composer.json
# JS dependencies.
package.json
-
/assets CSS and JS.
-
/lang Language files.
-
/lib MailPoet classes. All classes are autoloaded, under the MailPoet namespace.
// file: ./lib/models/subscriber.php
namespace \MailPoet\Models;
class Subscriber {}
$subscriber = new \MailPoet\Models\Subscriber();
-
/tests Acceptance and spec tests.
-
/mailpoet.php Kickstart file.
Tests.
- Unit tests (using verify):
$ ./do test:unit
- Acceptance tests:
# Setup .env
$ ./do test:acceptance
- Run all tests:
$ ./do test:all
Watch assets.
$ ./do watch
JS Dependencies.
In order to use a JS library (let's take Handlebars as an example), you need to follow these steps:
- add "handlebars" as a dependency in the
package.json
file
{
"private": true,
"dependencies": {
"handlebars": "3.0.3",
},
- run
./do install
(the handlebars module will be added into the node_modules folder) - create a symlink to the file you want to use by running this command
# from the root of the project
$ cd assets/js/lib/
# /!\ use relative path to the node_modules folder
$ ln -nsf ../../../node_modules/handlebars/dist/handlebars.min.js handlebars.min.js
- make sure to push the symlink onto the repository
Translations.
When editing a Twig template (views/*.html
), you have to the following WordPress functions:
__
: returns a string_n
: returns a pluralized string
<p>{{ __('Click %shere%s!') | format('<a href="#">', '</a>') | raw }}</p>
This will print: "Click here"
<p>{{ _n('deleted one message', 'deleted %d messages', count, 'wysija-newsletters') | format(count) }}</p>
This will print "deleted one message" (if count === 1) This will print "deleted X message" (if count !== 1)
Description
5.12.4-pirate
Latest
Languages
PHP
73.2%
TypeScript
12.8%
JavaScript
7.7%
SCSS
2.5%
HTML
2%
Other
1.7%