Skip to content

Commit 5e9c988

Browse files
committed
Merge branch 'master' into feature/html-template-import
2 parents db9bbf5 + a7f8802 commit 5e9c988

10 files changed

Lines changed: 217 additions & 23 deletions

.travis.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@ before_install:
1414
# Update Composer
1515
- composer self-update
1616

17-
# Install phpcs with wp-coding-standards
18-
- composer create-project wp-coding-standards/wpcs:dev-master --no-dev $HOME/wpcs
19-
2017
script:
21-
# Check project with phps
22-
- ~/wpcs/vendor/bin/phpcs --extensions=php --standard=./phpcs.xml -n -p .
23-
24-
# Check that composer is valid and installs correctly
2518
- composer install -o --prefer-dist --no-interaction
19+
20+
# Check project with phps
21+
- ./vendor/bin/phpcs -n -p .

CONTRIBUTING.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@ This project comes with a phpcs configuration (`phpcs.xml`) you can use to check
1414
Run phpcs in the project root directory:
1515

1616
```
17-
phpcs --extensions=php --standard=./phpcs.xml -n -p .
17+
./vendor/bin/phpcs ./
1818
```
1919

20-
Before you can run phpcs, you need to install PHP Codesniffer and WordPress coding standards like so:
20+
You need to install the plugin's development dependencies before you can run the PHPCS checks. A regular
2121

2222
```
23-
composer create-project wp-coding-standards/wpcs:dev-master --no-dev $HOME/wpcs
23+
composer install
2424
```
2525

26-
Or read the official installation instructions here:
26+
should install all the required packages.
27+
28+
You can read the official WPCS installation instructions here:
2729

2830
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# WP Libre Form
2-
[![Build Status](https://travis-ci.org/anttiviljami/wp-libre-form.svg?branch=master)](https://travis-ci.org/anttiviljami/wp-libre-form) [![Latest Stable Version](https://poser.pugx.org/anttiviljami/wp-libre-form/v/stable)](https://packagist.org/packages/anttiviljami/wp-libre-form) [![Total Downloads](https://poser.pugx.org/anttiviljami/wp-libre-form/downloads)](https://packagist.org/packages/anttiviljami/wp-libre-form) [![Latest Unstable Version](https://poser.pugx.org/anttiviljami/wp-libre-form/v/unstable)](https://packagist.org/packages/anttiviljami/wp-libre-form) [![License](https://poser.pugx.org/anttiviljami/wp-libre-form/license)](https://packagist.org/packages/anttiviljami/wp-libre-form)
2+
[![Build Status](https://travis-ci.org/libreform/wp-libre-form.svg?branch=master)](https://travis-ci.org/libreform/wp-libre-form) [![Latest Stable Version](https://poser.pugx.org/anttiviljami/wp-libre-form/v/stable)](https://packagist.org/packages/anttiviljami/wp-libre-form) [![Total Downloads](https://poser.pugx.org/anttiviljami/wp-libre-form/downloads)](https://packagist.org/packages/anttiviljami/wp-libre-form) [![Latest Unstable Version](https://poser.pugx.org/anttiviljami/wp-libre-form/v/unstable)](https://packagist.org/packages/anttiviljami/wp-libre-form) [![License](https://poser.pugx.org/anttiviljami/wp-libre-form/license)](https://packagist.org/packages/anttiviljami/wp-libre-form)
33

44
Use standard HTML5 markup to create fully functional forms for WordPress
55

classes/class-cpt-wplf-form.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,8 +726,9 @@ function strip_form_tags( $content ) {
726726
*/
727727
function wplf_form( $id, $content = '', $xclass = '', $attributes = [] ) {
728728
global $post;
729+
$preview = ! empty( $_GET['preview'] ) ? $_GET['preview'] : false;
729730

730-
if ( 'publish' === get_post_status( $id ) || 'true' === $_GET['preview'] ) {
731+
if ( 'publish' === get_post_status( $id ) || $preview ) {
731732
$form = get_post( $id );
732733
if ( empty( $content ) ) {
733734
// you can override the content via parameter

classes/class-cpt-wplf-submission.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ function form_filter_dropdown() {
143143
<option
144144
value="<?php echo intval( $form->ID ); ?>"
145145
<?php echo isset( $_REQUEST['form'] ) && intval( $_REQUEST['form'] ) === $form->ID ? 'selected' : ''; ?>
146-
><?php esc_html( $form->post_title ); ?></option>
146+
><?php echo esc_html( $form->post_title ); ?></option>
147147
<?php endforeach; ?>
148148
</select>
149149
<?php

composer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,9 @@
1212
],
1313
"require": {
1414
"php": ">=5.3.0"
15+
},
16+
"require-dev": {
17+
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
18+
"wp-coding-standards/wpcs": "0.12.0"
1519
}
1620
}

composer.lock

Lines changed: 189 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inc/wplf-ajax.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ function wplf_ajax_submit_handler() {
2222

2323
// form-specific validation
2424
$return->slug = $form->post_name;
25+
$return->title = $form->post_title;
2526
$return = apply_filters( "wplf_{$form->post_name}_validate_submission", $return );
2627
$return = apply_filters( "wplf_{$form->ID}_validate_submission", $return );
2728
}

phpcs.xml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22
<ruleset name="anttiviljami-wordpress">
33
<description>For nicer WordPress and PHP development</description>
44

5-
<!-- Don't check composer dependencies -->
6-
<exclude-pattern>/vendor/</exclude-pattern>
7-
8-
<!-- Exclude language files -->
9-
<exclude-pattern>/lang/</exclude-pattern>
5+
<!-- Files and directories to parse -->
6+
<file>./classes/</file>
7+
<file>./inc/</file>
8+
<file>./wp-libre-form.php</file>
9+
10+
<!-- Excluded directories and files -->
11+
<exclude-pattern>*/vendor/*</exclude-pattern>
12+
<exclude-pattern>*/lang/*</exclude-pattern>
13+
<exclude-pattern>*/assets/*</exclude-pattern>
1014

1115
<!-- Disallow tabs altogether -->
1216
<rule ref="Generic.WhiteSpace.DisallowTabIndent.TabsUsed"/>

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Required field validation, email notifications, file uploads to WP gallery and l
3636

3737
Please contribute to this project on Github. Pull requests welcome!
3838

39-
https://github.com/anttiviljami/wp-libre-form
39+
[https://github.com/anttiviljami/wp-libre-form](https://github.com/anttiviljami/wp-libre-form)
4040

4141
== Installation ==
4242

0 commit comments

Comments
 (0)