Skip to content

Commit

Permalink
Merge pull request pods-framework#3500 from pods-framework/2.x
Browse files Browse the repository at this point in the history
2.6.5 Release
  • Loading branch information
jimtrue committed May 3, 2016
2 parents d3449b5 + 1397549 commit 2f89f55
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 30 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# [Pods Framework](http://pods.io) #
[![Travis](https://secure.travis-ci.org/pods-framework/pods.png?branch=master)](http://travis-ci.org/pods-framework/pods)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/pods-framework/pods/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/pods-framework/pods/?branch=master)
[![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)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/pods-framework/pods/badges/quality-score.png?b=2.x)](https://scrutinizer-ci.com/g/pods-framework/pods/?branch=2.x)
[![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 Expand Up @@ -34,7 +34,7 @@ If you find an issue that you believe to be a *bug*, [let us know](https://githu

## Contributions Welcome

Anyone is welcome to contribute to Pods Framework. Please read the [guidelines for contributing](https://github.com/pods-framework/pods/blob/master/CONTRIBUTING.md) to this repository.
Anyone is welcome to contribute to Pods Framework. Please read the [guidelines for contributing](https://github.com/pods-framework/pods/blob/2.x/CONTRIBUTING.md) to this repository.

There are various ways you can contribute:

Expand Down
28 changes: 18 additions & 10 deletions classes/PodsAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -7316,19 +7316,27 @@ public function get_table_info ( $object_type, $object, $name = null, $pod = nul
$current_language_t_id = $current_language_tt_id = 0;

// WPML support
if ( is_object( $sitepress ) && !$icl_adjust_id_url_filter_off )
if ( is_object( $sitepress ) && !$icl_adjust_id_url_filter_off ) {
$current_language = pods_sanitize( ICL_LANGUAGE_CODE );
// Polylang support
elseif ( is_object( $polylang ) && function_exists( 'pll_current_language' ) ) {
} elseif ( ( function_exists( 'PLL' ) || is_object( $polylang ) ) && function_exists( 'pll_current_language' ) ) {
$current_language = pods_sanitize( pll_current_language( 'slug' ) );

if ( !empty( $current_language ) ) {
if ( isset( $polylang->model ) && method_exists( $polylang->model, 'get_language' )) {
$current_language_t_id = (int) $polylang->model->get_language( $current_language )->term_id;
$current_language_tt_id = (int) $polylang->model->get_language( $current_language )->term_taxonomy_id;
} else {
$current_language_t_id = (int) $polylang->get_language( $current_language )->term_id;
$current_language_tt_id = (int) $polylang->get_language( $current_language )->term_taxonomy_id;
if ( function_exists( 'PLL' ) && isset( PPL()->model ) && method_exists( PLL()->model, 'get_language' ) ) {
// Polylang 1.8 and newer
$current_language_t = PLL()->model->get_language( $current_language );
} elseif ( is_object( $polylang ) && isset( $polylang->model ) && method_exists( $polylang->model, 'get_language' ) ) {
// Polylang 1.2 - 1.7.x
$current_language_t = $polylang->model->get_language( $current_language );
} elseif ( is_object( $polylang ) && method_exists( $polylang, 'get_language' ) ) {
// Polylang 1.1.x and older
$current_language_t = $polylang->get_language( $current_language );
}

if ( isset( $current_language_t->term_id ) ) {
$current_language_t_id = (int) $current_language_t->term_id;
$current_language_tt_id = (int) $current_language_t->term_taxonomy_id;
}
}
}
Expand Down Expand Up @@ -7446,7 +7454,7 @@ public function get_table_info ( $object_type, $object, $name = null, $pod = nul
$info[ 'where' ][ 'wpml_languages' ] = "`wpml_languages`.`code` IS NOT NULL";
}
// Polylang support
elseif( is_object( $polylang ) && !empty( $current_language ) && function_exists( 'pll_is_translated_post_type' ) && pll_is_translated_post_type( $post_type ) ) {
elseif( ( function_exists( 'PLL' ) || is_object( $polylang ) ) && !empty( $current_language ) && function_exists( 'pll_is_translated_post_type' ) && pll_is_translated_post_type( $post_type ) ) {
$info[ 'join' ][ 'polylang_languages' ] = "
LEFT JOIN `{$wpdb->term_relationships}` AS `polylang_languages`
ON `polylang_languages`.`object_id` = `t`.`ID`
Expand Down Expand Up @@ -7524,7 +7532,7 @@ public function get_table_info ( $object_type, $object, $name = null, $pod = nul
$info[ 'where' ][ 'wpml_languages' ] = "`wpml_languages`.`code` IS NOT NULL";
}
// Polylang support
elseif ( is_object( $polylang ) && !empty( $current_language ) && function_exists( 'pll_is_translated_taxonomy' ) && pll_is_translated_taxonomy( $taxonomy ) ) {
elseif ( ( function_exists( 'PLL' ) || is_object( $polylang ) ) && !empty( $current_language ) && function_exists( 'pll_is_translated_taxonomy' ) && pll_is_translated_taxonomy( $taxonomy ) ) {
$info[ 'join' ][ 'polylang_languages' ] = "
LEFT JOIN `{$wpdb->termmeta}` AS `polylang_languages`
ON `polylang_languages`.`term_id` = `t`.`term_id`
Expand Down
34 changes: 26 additions & 8 deletions classes/PodsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -1115,15 +1115,33 @@ public static function default_value( $value, $type = 'text', $name = null, $opt
* @since 2.0
*/
public static function clean( $input, $noarray = false, $db_field = false ) {
$input = str_replace( array( '--1', '__1' ), '00000', (string) $input );
if ( false !== $noarray )
$input = preg_replace( '/\[\d*\]/', '-', $input );
$output = str_replace( array( '[', ']' ), '-', strtolower( $input ) );

$output = trim( (string) $input );

$output = str_replace( '--1', 'podsfixtemp1', $output );
$output = str_replace( '__1', 'podsfixtemp2', $output );

if ( false !== $noarray ) {
$output = preg_replace( '/\[\d*\]/', '-', $output );
}

$output = str_replace( array( '[', ']' ), '-', $output );

$output = pods_clean_name( $output );

$output = preg_replace( '/([^a-z0-9\-_])/', '', $output );
$output = trim( str_replace( array( '__', '_', '--' ), '-', $output ), '-' );
$output = str_replace( '00000', '--1', $output );
if ( false !== $db_field )
$output = str_replace( '-', '_', $output );
$output = preg_replace( '/(_){2,}/', '_', $output );
$output = preg_replace( '/(-){2,}/', '-', $output );

if ( true !== $db_field ) {
$output = str_replace( '_', '-', $output );
}

$output = rtrim( $output, '-' );

$output = str_replace( 'podsfixtemp1', '--1', $output );
$output = str_replace( 'podsfixtemp2', '__1', $output );

return $output;
}

Expand Down
14 changes: 12 additions & 2 deletions classes/fields/pick.php
Original file line number Diff line number Diff line change
Expand Up @@ -1681,7 +1681,7 @@ public function get_object_data ( $object_params = null ) {
}
}
// Polylang integration for Post Types and Taxonomies
elseif ( is_object( $polylang ) && in_array( $object_type, array( 'post_type', 'taxonomy' ) ) && method_exists( $polylang, 'get_translation' ) ) {
elseif ( function_exists( 'PLL' ) || ( is_object( $polylang ) ) && in_array( $object_type, array( 'post_type', 'taxonomy' ) ) ) {
$translated = false;

if ( 'post_type' == $object_type && pll_is_translated_post_type( $object ) )
Expand All @@ -1690,7 +1690,17 @@ public function get_object_data ( $object_params = null ) {
$translated = true;

if ( $translated ) {
$object_id = $polylang->get_translation( $object, $result[ $search_data->field_id ], $current_language );
$object_id = 0; // default
if ( function_exists( 'PLL' ) && isset( PPL()->model ) && method_exists( PLL()->model, 'get_translation' ) ) {
// Polylang 1.8 and newer
$object_id = PLL()->model->get_translation( $object, $result[ $search_data->field_id ], $current_language );
} elseif ( is_object( $polylang ) && isset( $polylang->model ) && method_exists( $polylang->model, 'get_translation' ) ) {
// Polylang 1.2 - 1.7.x
$object_id = $polylang->model->get_translation( $object, $result[ $search_data->field_id ], $current_language );
} elseif ( is_object( $polylang ) && method_exists( $polylang, 'get_translation' ) ) {
// Polylang 1.1.x and older
$object_id = $polylang->get_translation( $object, $result[ $search_data->field_id ], $current_language );
}

if ( 0 < $object_id && !in_array( $object_id, $ids ) ) {
$text = $result[ $search_data->field_index ];
Expand Down
6 changes: 3 additions & 3 deletions init.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
Plugin Name: Pods - Custom Content Types and Fields
Plugin URI: http://pods.io/
Description: Pods is a framework for creating, managing, and deploying customized content types and fields
Version: 2.6.4
Version: 2.6.5-a-1
Author: Pods Framework Team
Author URI: http://pods.io/about/
Text Domain: pods
Domain Path: /languages/
GitHub Plugin URI: https://github.com/pods-framework/pods
GitHub Branch: master
GitHub Branch: 2.x
Copyright 2009-2015 Pods Foundation, Inc (email : contact@podsfoundation.org)
Expand Down Expand Up @@ -39,7 +39,7 @@
}
else {
// Current version
define( 'PODS_VERSION', '2.6.4' );
define( 'PODS_VERSION', '2.6.5-a-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.6.4",
"version": "2.6.5-a-1",
"description": "Pods is a development framework for creating, extending, managing, and deploying customized content types in WordPress.",
"author": "Pods Foundation, Inc",
"homepage": "http://pods.io/",
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: http://podsfoundation.org/donate/
Tags: pods, custom post types, custom taxonomies, user fields, custom fields, cck, cms, content types, database, framework, drupal, post types, avatars, comment fields, media fields
Requires at least: 3.8
Tested up to: 4.5
Stable tag: 2.6.4
Stable tag: 2.6.5-a-1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -166,6 +166,10 @@ Join us in further translating the Pods interface at: http://wp-translate.org/pr

== Changelog ==

= 2.6.5 - May 3rd, 2016 =
* Fixed: Renaming of Pods with underscores to hyphenated names that was introduced in 2.6.3. Hyphenated Pods names will remain hyphenated and Underscored Pods names will remain underscored. Fixes (#3499). [@sc0ttkclark]
* Fixed: Support for new Polylang Versions with much kudos to @JoryHogeveen for tackling this (#3491). Fixes (#3490,#3223) [@JoryHogeveen]

= 2.6.4 - April 25th, 2016 =
* Fixed: Modified Run activation/install priority to fire before plugins loaded. Fix for the Clearing Pods Cache automatically after Pods Upgrade (#3487). Fixes (#2558,#3348) [@sc0ttkclark]

Expand Down
2 changes: 1 addition & 1 deletion ui/fields/_db.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
$attributes = array();
$attributes[ 'type' ] = 'text';
$attributes[ 'value' ] = PodsForm::clean( $value, false );
$attributes[ 'value' ] = PodsForm::clean( $value, false, true );
$attributes[ 'tabindex' ] = 2;
$attributes = PodsForm::merge_attributes( $attributes, $name, $form_field_type, $options );
?>
Expand Down

0 comments on commit 2f89f55

Please sign in to comment.