Skip to content

Commit

Permalink
Pods 2.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0ttkclark committed Oct 16, 2012
1 parent ea48579 commit 0b3975e
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 41 deletions.
98 changes: 66 additions & 32 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ function pods_query ( $sql, $error = 'Database Error', $results_error = null, $n
$error = 'Database Error';
}

if ( 1 == pods_var( 'pods_debug_sql_all', 'get', 0 ) && is_user_logged_in() && ( is_super_admin() || current_user_can( 'delete_users' ) || current_user_can( 'pods' ) ) ) {
$debug_sql = $sql;

echo '<textarea cols="100" rows="24">';

if ( is_array( $debug_sql ) )
print_r( $debug_sql );
else
echo $debug_sql;

echo '</textarea>';
}

return $podsdata->query( $sql, $error, $results_error, $no_results_error );
}

Expand Down Expand Up @@ -166,7 +179,10 @@ function pods_debug ( $debug = '_null', $die = false, $prefix = '_null' ) {
if ( !defined( 'DOING_AJAX' ) || !DOING_AJAX )
$debug = esc_html( $debug );

$debug = '<e><pre>' . $debug . '</pre>';
if ( false === strpos( $debug, "<pre class='xdebug-var-dump' dir='ltr'>" ) )
$debug = '<e><pre>' . $debug . '</pre>';
else
$debug = '<e>' . $debug;

if ( 2 === $die )
wp_die( $debug );
Expand Down Expand Up @@ -668,12 +684,22 @@ function pods_var_update ( $array = null, $allowed = null, $excluded = null, $ur

if ( !empty( $array ) ) {
foreach ( $array as $key => $val ) {
if ( is_array( $val ) && !empty( $val ) )
$get[ $key ] = $val;
elseif ( !is_array( $val ) && 0 < strlen( $val ) )
$get[ $key ] = $val;
elseif ( isset( $get[ $key ] ) )
unset( $get[ $key ] );
if ( null !== $val || false === strpos( $key, '*' ) ) {
if ( is_array( $val ) && !empty( $val ) )
$get[ $key ] = $val;
elseif ( !is_array( $val ) && 0 < strlen( $val ) )
$get[ $key ] = $val;
elseif ( isset( $get[ $key ] ) )
unset( $get[ $key ] );
}
else {
$key = str_replace( '*', '', $key );

foreach ( $get as $k => $v ) {
if ( false !== strpos( $k, $key ) )
unset( $get[ $k ] );
}
}
}
}

Expand Down Expand Up @@ -905,7 +931,7 @@ function pods_access ( $privs, $method = 'OR' ) {
if ( !is_user_logged_in() )
return false;

if ( current_user_can( 'administrator' ) || current_user_can( 'pods_administrator' ) || is_super_admin() )
if ( is_super_admin() || current_user_can( 'delete_users' ) || current_user_can( 'pods' ) || current_user_can( 'pods_content' ) )
return true;

// Store approved privs when using "AND"
Expand Down Expand Up @@ -974,7 +1000,11 @@ function pods_shortcode ( $tags, $content = null ) {
'field' => null,
'col' => null,
'template' => null,
'helper' => null
'helper' => null,
'form' => null,
'fields' => null,
'label' => null,
'thank_you' => null
);

$tags = array_merge( $defaults, $tags );
Expand All @@ -984,16 +1014,23 @@ function pods_shortcode ( $tags, $content = null ) {
$content = null;

if ( empty( $tags[ 'name' ] ) ) {
return '<e>Please provide a Pod name';
return '<p>Please provide a Pod name</p>';
}

if ( !empty( $tags[ 'col' ] ) ) {
$tags[ 'field' ] = $tags[ 'col' ];

unset( $tags[ 'col' ] );
}

if ( !empty( $tags[ 'order' ] ) ) {
$tags[ 'orderby' ] = $tags[ 'order' ];

unset( $tags[ 'order' ] );
}

if ( empty( $content ) && empty( $tags[ 'template' ] ) && empty( $tags[ 'field' ] ) ) {
return '<e>Please provide either a template or field name';
return '<p>Please provide either a template or field name</p>';
}

// id > slug (if both exist)
Expand All @@ -1010,12 +1047,11 @@ function pods_shortcode ( $tags, $content = null ) {

$found = 0;

if ( empty( $id ) ) {
if ( !empty( $tags[ 'form' ] ) )
return $pod->form( $tags[ 'fields' ], $tags[ 'label' ], $tags[ 'thank_you' ] );
elseif ( empty( $id ) ) {
$params = array();

if ( 0 < strlen( $tags[ 'order' ] ) )
$params[ 'orderby' ] = $tags[ 'order' ];

if ( 0 < strlen( $tags[ 'orderby' ] ) )
$params[ 'orderby' ] = $tags[ 'orderby' ];

Expand Down Expand Up @@ -1078,7 +1114,11 @@ function pods_shortcode ( $tags, $content = null ) {
* @return string
*/
function pods_serial_comma ( $value, $field = null, $fields = null ) {
$value = (array) $value;
if ( is_object( $value ) )
$value = get_object_vars( $value );

if ( !is_array( $value ) )
return $value;

$field_index = null;

Expand Down Expand Up @@ -1121,18 +1161,12 @@ function pods_serial_comma ( $value, $field = null, $fields = null ) {
if ( isset( $value[ 0 ] ) )
$value = $value[ 0 ];

if ( isset( $value[ $field_index ] ) ) {
$value = $value[ $field_index ];

if ( 0 < strlen( $value ) && 0 < strlen( $last ) )
$value .= $and . $last;
elseif ( 0 < strlen( $last ) )
$value = $last;
if ( is_array( $value ) ) {
if ( isset( $value[ $field_index ] ) )
$value = $value[ $field_index ];
else
$value = '';
}
else
$value = '';
}
else {
if ( isset( $value[ $field_index ] ) )
Expand All @@ -1150,14 +1184,14 @@ function pods_serial_comma ( $value, $field = null, $fields = null ) {
}

$value = implode( ', ', $value );

if ( 0 < strlen( $value ) && 0 < strlen( $last ) )
$value .= $and . $last;
elseif ( 0 < strlen( $last ) )
$value = $last;
else
$value = '';
}

if ( 0 < strlen( $value ) && 0 < strlen( $last ) )
$value .= $and . $last;
elseif ( 0 < strlen( $last ) )
$value = $last;
else
$value = '';
}
else
$value = $last;
Expand Down
6 changes: 3 additions & 3 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: http://podsframework.org/
Description: Pods is a framework for creating, managing, and deploying customized content types and fields
Version: 2.0.3.1
Version: 2.0.4
Author: Pods Framework Team
Author URI: http://podsframework.org/about/
Text Domain: pods
Expand Down Expand Up @@ -32,13 +32,13 @@

// Prevent conflicts with Pods 1.x
if ( !defined( 'PODS_VERSION' ) && !defined( 'PODS_DIR' ) && !function_exists( 'pods_ui_manage' ) ) {
define( 'PODS_VERSION', '2.0.3.1' );
define( 'PODS_VERSION', '2.0.4' );

if ( !defined( 'PODS_GITHUB_UPDATE' ) )
define( 'PODS_GITHUB_UPDATE', false );

if ( !defined( 'PODS_GITHUB_BRANCH' ) )
define( 'PODS_GITHUB_BRANCH', '2.1' );
define( 'PODS_GITHUB_BRANCH', '2.0.x' );

if ( !defined( 'PODS_WP_VERSION_MINIMUM' ) )
define( 'PODS_WP_VERSION_MINIMUM', '3.4' );
Expand Down
8 changes: 6 additions & 2 deletions 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
Requires at least: 3.4
Tested up to: 3.5
Stable tag: 2.0.3.1
Stable tag: 2.0.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -99,10 +99,14 @@ OR you can just install it with WordPress by going to Plugins >> Add New >> and

== Changelog ==

= 2.0.4 - October 15th, 2012 =
* Big bug fix release, we've fixed tons of bugs and improved backwards compatibility even further - stability, stability, stability!
* Found a bug? Have a great feature idea? Get on GitHub and tell us about it and we'll get right on it: https://github.com/pods-framework/pods/issues/new
* Our GitHub also has a full list of issues closed for this release and all previous 2.x releases, you can even browse our code and contribute notes and patches all from the web

= 2.0.3.1 - October 5th, 2012 =
* Fixed an upgrade issue a few users were reporting where the upgrade wouldn't start
* Fixed reserved post_name issues with our internal post types for Pods and Fields (rss, date, and any other feeds)
* Found a bug? Have a great feature idea? Get on GitHub and tell us about it and we'll get right on it: https://github.com/pods-framework/pods/issues/new

= 2.0.3 - October 4th, 2012 =
* We've fixed many more bugs, that means even more stability and backwards compatibility for those who have been holding off on upgrading
Expand Down
9 changes: 9 additions & 0 deletions ui/front/widgets.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
echo $before_widget;

if ( !empty( $title ) )
echo $before_title . $title . $after_title;

echo pods_shortcode( $args, $content );

echo $after_widget;
18 changes: 14 additions & 4 deletions updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,16 @@ public function get_new_version () {
)
);

if ( is_wp_error( $raw_response ) ) {
$__version = false;

if ( !is_wp_error( $raw_response ) ) {
$__version = explode( '~Current Version:', $raw_response[ 'body' ] );

if ( !isset( $__version[ '1' ] ) )
$__version = false;
}

if ( !$__version || is_wp_error( $raw_response ) ) {
$raw_response = wp_remote_get(
trailingslashit( $this->config[ 'raw_url' ] ) . 'README.md',
array(
Expand All @@ -176,15 +185,16 @@ public function get_new_version () {

if ( is_wp_error( $raw_response ) )
return false;
}

$__version = explode( '~Current Version:', $raw_response[ 'body' ] );
$__version = explode( '~Current Version:', $raw_response[ 'body' ] );
}

if ( !isset( $__version[ '1' ] ) )
return false;

$_version = explode( '~', $__version[ '1' ] );
$version = $_version[ 0 ];

$version = trim( $_version[ 0 ] );

// refresh every 6 hours
set_site_transient( $this->config[ 'slug' ] . '_new_version', $version, 60 * 60 * 6 );
Expand Down

0 comments on commit 0b3975e

Please sign in to comment.