Skip to content

Commit

Permalink
Merge pull request #5645 from pods-framework/2.x
Browse files Browse the repository at this point in the history
Pods 2.7.17.1
  • Loading branch information
sc0ttkclark authored Mar 27, 2020
2 parents eb23887 + 2c2815b commit ea81ea8
Show file tree
Hide file tree
Showing 12 changed files with 271 additions and 22 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# [Pods Framework](https://pods.io) #
[![Travis](https://secure.travis-ci.org/pods-framework/pods.png?branch=master)](http://travis-ci.org/pods-framework/pods)
[![License](https://img.shields.io/badge/license-GPL--2.0%2B-green.svg)](https://github.com/pods-framework/pods/blob/master/license.txt)
[![Travis](https://secure.travis-ci.org/pods-framework/pods.png?branch=2.x)](http://travis-ci.org/pods-framework/pods)
[![License](https://img.shields.io/badge/license-GPL--2.0%2B-green.svg)](https://github.com/pods-framework/pods/blob/2.x/license.txt)

[![WordPress Plugin version](https://img.shields.io/wordpress/plugin/v/pods.svg?style=flat)](https://wordpress.org/plugins/pods/)
[![WordPress Plugin WP tested version](https://img.shields.io/wordpress/v/pods.svg?style=flat)](https://wordpress.org/plugins/pods/)
Expand Down
16 changes: 12 additions & 4 deletions classes/fields/pick.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,9 @@ public function options() {
'default' => 'default',
'type' => 'pick',
'data' => array(
'default' => __( 'Item 1, Item 2, and Item 3', 'pods' ),
'custom' => __( 'Custom separator (with no "and")', 'pods' ),
'default' => __( 'Item 1, Item 2, and Item 3', 'pods' ),
'non_serial' => __( 'Item 1, Item 2 and Item 3', 'pods' ),
'custom' => __( 'Custom separator (without "and")', 'pods' ),
),
'dependency' => true,
),
Expand Down Expand Up @@ -747,9 +748,16 @@ public function display( $value = null, $name = null, $options = null, $pod = nu
'fields' => $fields,
);

if ( 'custom' === pods_v( static::$type . '_display_format_multi', $options, 'default' ) ) {
$separator = pods_v( static::$type . '_display_format_separator', $options, ', ' );
$display_format = pods_v( static::$type . '_display_format_multi', $options, 'default' );

if ( 'non_serial' === $display_format ) {
$args['serial'] = false;
}

if ( 'custom' === $display_format ) {
$args['serial'] = false;

$separator = pods_v( static::$type . '_display_format_separator', $options, ', ' );
if ( ! empty( $separator ) ) {
$args['separator'] = $separator;

Expand Down
3 changes: 2 additions & 1 deletion docs/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<!-- New feature (non-breaking change which adds functionality) -->
<!-- Breaking change (fix or feature that would cause existing functionality to not work as expected) -->

## ChangeLog
## Changelog text for these changes
<!-- Please include a human readable description of what your change did for the Changelog -->
<!-- Examples: Fix: Updates changelog to be more friendly #Issue (@your-GH-Handle) -->
<!-- If your fix addresses multiple issues, please list all of them. -->
Expand All @@ -24,3 +24,4 @@
- [ ] My code is tested.
- [ ] My code follows the WordPress code style.
- [ ] My code follows has proper inline documentation.
- [ ] My code includes PHP Unit Tests (if applicable)
11 changes: 8 additions & 3 deletions includes/data.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,18 @@ function pods_trim( $input, $charlist = null, $lr = null ) {
$output[ pods_sanitize( $key ) ] = pods_trim( $val, $charlist, $lr );
}
} else {
$args = array( $input );
if ( null !== $charlist ) {
$args[] = $charlist;
}
if ( 'l' === $lr ) {
$output = ltrim( $input, $charlist );
$function = 'ltrim';
} elseif ( 'r' === $lr ) {
$output = rtrim( $input, $charlist );
$function = 'rtrim';
} else {
$output = trim( $input, $charlist );
$function = 'trim';
}
$output = call_user_func_array( $function, $args );
}//end if

return $output;
Expand Down
8 changes: 4 additions & 4 deletions includes/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -894,8 +894,8 @@ function pods_shortcode_run( $tags, $content = null ) {
}
}

if ( empty( $tags['name'] ) ) {
return '<p>Please provide a Pod name</p>';
if ( ! $tags['use_current'] && empty( $tags['name'] ) ) {
return '<p>' . __( 'Please provide a Pod name', 'pods' ) . '</p>';
}
}

Expand All @@ -912,7 +912,7 @@ function pods_shortcode_run( $tags, $content = null ) {
}

if ( empty( $content ) && empty( $tags['pods_page'] ) && empty( $tags['template'] ) && empty( $tags['field'] ) && empty( $tags['form'] ) ) {
return '<p>Please provide either a template or field name</p>';
return '<p>' . __( 'Please provide either a template or field name', 'pods' ) . '</p>';
}

if ( ! $tags['use_current'] && ! isset( $id ) ) {
Expand Down Expand Up @@ -950,7 +950,7 @@ function pods_shortcode_run( $tags, $content = null ) {
}

if ( empty( $pod ) || ! $pod->valid() ) {
return '<p>Pod not found</p>';
return '<p>' . __( 'Pod not found', 'pods' ) . '</p>';
}

$found = 0;
Expand Down
4 changes: 2 additions & 2 deletions init.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Pods - Custom Content Types and Fields
Plugin URI: https://pods.io/
Description: Pods is a framework for creating, managing, and deploying customized content types and fields
Version: 2.7.17
Version: 2.7.17.1
Author: Pods Framework Team
Author URI: https://pods.io/about/
Text Domain: pods
Expand Down Expand Up @@ -36,7 +36,7 @@
add_action( 'init', 'pods_deactivate_pods_ui' );
} else {
// Current version
define( 'PODS_VERSION', '2.7.17' );
define( 'PODS_VERSION', '2.7.17.1' );

// Version tracking between DB updates themselves
define( 'PODS_DB_VERSION', '2.3.5' );
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pods",
"version": "2.7.17",
"version": "2.7.17.1",
"description": "Pods is a development framework for creating, extending, managing, and deploying customized content types in WordPress.",
"author": "Pods Foundation, Inc",
"homepage": "https://pods.io/",
Expand Down
16 changes: 15 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: pods, custom post types, custom taxonomies, content types, custom fields,
Requires at least: 4.5
Tested up to: 5.4
Requires PHP: 5.3
Stable tag: 2.7.17
Stable tag: 2.7.17.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -190,9 +190,18 @@ We are also available through our [Live Slack Chat](https://pods.io/chat/) to he

== Changelog ==

= 2.7.17.1 - March 27th 2020 =

**Bug Fixes**

* Fixed: Double comma in custom pick display formats. #5637 (@JoryHogeveen)
* Fixed: Auto `use_current` not working correctly outside the loop. #5636 (@JoryHogeveen)
* Fixed: pods_trim() does not trim whitespaces by default. #5640 (@JoryHogeveen)

= 2.7.17 - March 26th 2020 =

**New Features & Enhancements**

* Added: New callout for our Friends of Pods program will show up on the Pods Admin > Pods list so we can let people know how to donate. #5571 (@nicdford, @sc0ttkclark, @JoryHogeveen)
* Added: Freemius integration to support our new Friends of Pods add-ons and enable us to let people opt-in to usage stats for planning future compatibility decisions. #5624 (@sc0ttkclark)
* Added: New `not_found` tag to the Pods shortcode to return default string if no output is empty. #5580 (@JoryHogeveen)
Expand All @@ -208,6 +217,7 @@ We are also available through our [Live Slack Chat](https://pods.io/chat/) to he
* Docs: Update inline docs for pick field selected logic. #5014 & #5017 (@sc0ttkclark)

**Bug Fixes**

* Fixed: Date/Time - Correct empty value validation. #5534 & #5544 (@JoryHogeveen)
* Fixed: Date/Time - Allow midnight (00:00:00) as time value. #5616 (@JoryHogeveen)
* Fixed: Number/Currency - Parsing error for number format 9'999.99. #5559 & #5597 (@JoryHogeveen)
Expand All @@ -234,12 +244,14 @@ We are also available through our [Live Slack Chat](https://pods.io/chat/) to he
= 2.7.16 - November 13th 2019 =

**Enhancements**

* Enhancement: CSS fixes for WP 5.3. #5501 (@JoryHogeveen)
* Enhancement: Format traversed fields properly. #4932 (@jamesgol)
* Enhancement: ACT list view pagination. #5510 (@JoryHogeveen)
* Enhancement: Add PODS_SHORTCODE_ALLOW_EVALUATE_TAGS to debug info. #5310 (@JoryHogeveen)

**Bug Fixes**

* Fixed: Avoid SQL errors when using special magic tags. #5310 (@sc0ttkclark)
* Fixed: Validate shortcode query tags before default to current object. #5520 (@JoryHogeveen)
* Fixed: Unslash simple relationship values to support saving quoted values. #5517 (@JoryHogeveen)
Expand All @@ -262,12 +274,14 @@ We are also available through our [Live Slack Chat](https://pods.io/chat/) to he
= 2.7.15 - September 5th 2019 =

**Enhancements**

* Enhancement: Add year range option to date & datetime fields. #5442 (@JoryHogeveen)
* Enhancement: Support single select relationships in templates when using `[each]`. #4507 (@sc0ttkclark, @JoryHogeveen)
* Enhancement: Prevent creation of Pods using reserved keywords from WordPress Codex and Pods. #5428 (@JoryHogeveen)
* Enhancement: Allow all callables to be passed in magic tags. #5436 (@JoryHogeveen)

**Bug Fixes**

* Fixed: Always convert database value for date/time fields without timezone to maintain the actual value. #5423 & #5424 (@JoryHogeveen)
* Fixed: Solve issues with saving date/time fields in other locales. #5444, #5421, #5415 & #5451 (@JoryHogeveen)
* Fixed: Import from file with absolute path. #5430 (@mistraloz)
Expand Down
122 changes: 120 additions & 2 deletions tests/phpunit/includes/tests-pods-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,79 @@ public function test_pods_unslash() {

public function test_pods_trim() {

$this->markTestIncomplete( 'not yet implemented' );
$string = ' test ';

$this->assertEquals( 'test', pods_trim( $string ) );

$this->assertEquals( ' test', pods_trim( $string, null, 'r' ) );

$this->assertEquals( 'test ', pods_trim( $string, null, 'l' ) );

$string = ' test & ';

$this->assertEquals( 'test', pods_trim( $string, ' &' ) );

$this->assertEquals( ' test', pods_trim( $string, ' &', 'r' ) );

// Arrays.

$array = array(
' test ',
' test2 ',
);

$result = array(
'test',
'test2'
);

$this->assertEquals( $result, pods_trim( $array ) );

$result = array(
' test',
' test2'
);

$this->assertEquals( $result, pods_trim( $array, null, 'r' ) );

$array = array(
' test & ',
' test2 ',
);

$result = array(
' test',
' test2'
);

$this->assertEquals( $result, pods_trim( $array, ' &', 'r' ) );

// Objects.

$object = new stdClass();
$object->test = ' test ';
$object->test2 = ' test2 ';

$result = new stdClass();
$result->test = 'test';
$result->test2 = 'test2';

$this->assertEquals( $result, pods_trim( $object ) );

$result->test = ' test';
$result->test2 = ' test2';

$this->assertEquals( $result, pods_trim( $object, null, 'r' ) );

$object->test = ' test & ';
$object->test2 = ' test2 ';

$result->test = ' test';
$result->test2 = ' test2';

$this->assertEquals( $result, pods_trim( $object, ' &', 'r' ) );

//$this->markTestIncomplete( 'not yet implemented' );
}

public function test_pods_v() {
Expand Down Expand Up @@ -244,7 +316,53 @@ public function test_pods_evaluate_tag() {

public function test_pods_serial_comma() {

$this->markTestIncomplete( 'not yet implemented' );
$values = array(
'test1',
'test2',
'test3',
);

$result = 'test1, test2, and test3';

$this->assertEquals( $result, pods_serial_comma( $values ) );

$args = array(
'serial' => false,
);

$result = 'test1, test2 and test3';

$this->assertEquals( $result, pods_serial_comma( $values, $args ) );

$args = array(
'separator' => ' | ',
'serial' => false,
);

$result = 'test1 | test2 and test3';

$this->assertEquals( $result, pods_serial_comma( $values, $args ) );

$args = array(
'and' => ' & ',
'serial' => false,
);

$result = 'test1, test2 & test3';

$this->assertEquals( $result, pods_serial_comma( $values, $args ) );

$args = array(
'separator' => ' | ',
'and' => ' | ',
'serial' => false,
);

$result = 'test1 | test2 | test3';

$this->assertEquals( $result, pods_serial_comma( $values, $args ) );

//$this->markTestIncomplete( 'not yet implemented' );
}

public function test_pods_var_user() {
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/includes/tests-pods-field-boolean.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use PodsField_Boolean;

require PODS_TEST_PLUGIN_DIR . '/classes/fields/boolean.php';
require_once PODS_TEST_PLUGIN_DIR . '/classes/fields/boolean.php';

/**
* Class Test_PodsField_Boolean
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/includes/tests-pods-field-currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use PodsField_Currency;

require PODS_TEST_PLUGIN_DIR . '/classes/fields/currency.php';
require_once PODS_TEST_PLUGIN_DIR . '/classes/fields/currency.php';

/**
* Class Test_PodsField_Boolean
Expand Down
Loading

0 comments on commit ea81ea8

Please sign in to comment.