Permalink
Browse files

Implement PODS_DISABLE_SHORTCODE_SQL constant to disable parameters p…

…assed into SQL from shortcode, for additional control in #2043
  • Loading branch information...
1 parent b8a912c commit 52c9683409295e1e40a6fcbf4cb767c75dc42869 @sc0ttkclark sc0ttkclark committed Feb 21, 2014
Showing with 33 additions and 22 deletions.
  1. +33 −22 includes/general.php
View
@@ -679,37 +679,48 @@ function pods_shortcode ( $tags, $content = null ) {
elseif ( empty( $id ) ) {
$params = array();
- if ( 0 < strlen( $tags[ 'orderby' ] ) )
- $params[ 'orderby' ] = $tags[ 'orderby' ];
+ if ( !defined( 'PODS_DISABLE_SHORTCODE_SQL' ) || !PODS_DISABLE_SHORTCODE_SQL ) {
+ if ( 0 < strlen( $tags[ 'orderby' ] ) ) {
+ $params[ 'orderby' ] = $tags[ 'orderby' ];
+ }
- if ( !empty( $tags[ 'limit' ] ) )
- $params[ 'limit' ] = $tags[ 'limit' ];
+ if ( 0 < strlen( $tags[ 'where' ] ) ) {
+ $params[ 'where' ] = pods_evaluate_tags( $tags[ 'where' ] );
+ }
- if ( 0 < strlen( $tags[ 'where' ] ) )
- $params[ 'where' ] = pods_evaluate_tags( $tags[ 'where' ] );
+ if ( 0 < strlen( $tags[ 'having' ] ) ) {
+ $params[ 'having' ] = pods_evaluate_tags( $tags[ 'having' ] );
+ }
- if ( 0 < strlen( $tags[ 'having' ] ) )
- $params[ 'having' ] = pods_evaluate_tags( $tags[ 'having' ] );
+ if ( 0 < strlen( $tags[ 'groupby' ] ) ) {
+ $params[ 'groupby' ] = $tags[ 'groupby' ];
+ }
- if ( 0 < strlen( $tags[ 'groupby' ] ) )
- $params[ 'groupby' ] = $tags[ 'groupby' ];
+ if ( 0 < strlen( $tags[ 'select' ] ) ) {
+ $params[ 'select' ] = $tags[ 'select' ];
+ }
+ }
- if ( 0 < strlen( $tags[ 'select' ] ) )
- $params[ 'select' ] = $tags[ 'select' ];
+ if ( !empty( $tags[ 'limit' ] ) ) {
+ $params[ 'limit' ] = (int) $tags[ 'limit' ];
+ }
- if ( empty( $tags[ 'search' ] ) )
- $params[ 'search' ] = false;
+ if ( empty( $tags[ 'search' ] ) ) {
+ $params[ 'search' ] = false;
+ }
- if ( 0 < absint( $tags[ 'page' ] ) )
- $params[ 'page' ] = absint( $tags[ 'page' ] );
+ if ( 0 < absint( $tags[ 'page' ] ) ) {
+ $params[ 'page' ] = absint( $tags[ 'page' ] );
+ }
- if ( empty( $tags[ 'pagination' ] ) )
- $params[ 'pagination' ] = false;
+ if ( empty( $tags[ 'pagination' ] ) ) {
+ $params[ 'pagination' ] = false;
+ }
- if ( !empty( $tags[ 'cache_mode' ] ) && 'none' != $tags[ 'cache_mode' ] ) {
- $params[ 'cache_mode' ] = $tags[ 'cache_mode' ];
- $params[ 'expires' ] = (int) $tags[ 'expires' ];
- }
+ if ( !empty( $tags[ 'cache_mode' ] ) && 'none' != $tags[ 'cache_mode' ] ) {
+ $params[ 'cache_mode' ] = $tags[ 'cache_mode' ];
+ $params[ 'expires' ] = (int) $tags[ 'expires' ];
+ }
$params = apply_filters( 'pods_shortcode_findrecords_params', $params );

0 comments on commit 52c9683

Please sign in to comment.