WordPress.org

Plugin Directory

Changeset 1571900


Ignore:
Timestamp:
01/10/17 14:26:16 (6 months ago)
Author:
daggerhart
Message:

v 1.5.42 bug fixes and some minor features added

Location:
query-wrangler
Files:
1 added
1 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • query-wrangler/trunk/README.txt

    r1544833 r1571900  
    44Tags: query, pages, widget, admin, widgets, administration, manage, views, loop 
    55Requires at least: 4 
    6 Tested up to: 4.6.1 
     6Tested up to: 4.7 
    77Stable tag: trunk 
    88 
     
    7474 
    7575== Changelog == 
     76= 1.5.42 = 
     77 
     78* Feature: Search box on query list page 
     79* Feature: Strip tags on Group by field 
     80* Feature: Added query shortcode by ID on edit page 
     81* Bug fix: Maintain token settings in later fields 
     82* Bug fix: Query data doesn't unserialize correctly in some environments 
     83* Bug fix: Query wasn't retaining Group by field in editor 
     84* Bug fix: JSON export may not load correctly 
     85 
    7686= 1.5.41 = 
    7787 
     
    346356== Upgrade Notice == 
    347357 
    348 1.5.41 Contextual tokens in callback parameters, multiple bug fixes, new json export/import 
     3581.5.42 Editor bug fixes and some minor features added 
  • query-wrangler/trunk/admin/admin.php

    r1544833 r1571900  
    195195    unset( $row['id'] ); 
    196196    // unserialize the stored data 
    197     $row['data'] = unserialize( $row['data'] ); 
     197    $row['data'] = qw_unserialize( $row['data'] ); 
    198198    $row['data'] = qw_query_escape_export( $row['data'] ); 
    199199 
  • query-wrangler/trunk/admin/query-admin-pages.php

    r1329785 r1571900  
    195195    $admin_args = array( 
    196196        'title'       => 'Edit query <em>' . $edit_args['query_name'] . '</em>', 
    197         'description' => '[query slug="' . $row->slug . '"]', 
     197        'description' => '<code>[query slug="' . $row->slug . '"]</code> -or- <code>[query id="'.$query_id.'"]</code>', 
    198198        // content is the query_edit page 
    199199        'content'     => theme( 'query_edit_wrapper', $edit_wrapper_args ) 
     
    202202    // shortcode compatibility 
    203203    if ( $settings->get('shortcode_compat') ){ 
    204         $admin_args['description'] = '[qw_query slug="' . $row->slug . '"]'; 
     204        $admin_args['description'] = '<code>[qw_query slug="' . $row->slug . '"]</code> -or- <code>[qw_query id="'.$query_id.'"]</code>'; 
    205205    } 
    206206 
  • query-wrangler/trunk/admin/templates/form-settings.php

    r1329785 r1571900  
    107107                       name="qw-shortcode-compat" <?php checked( $shortcode_compat, "on" ); ?> /> 
    108108 
    109                 <p class="description">Change the shortcode keyword from <code>query</code> to <code>qw_query</code>, to avoid conflicts with other plugins. 
    110                     <br />Example usage, <code>[query slug="my-test"]</code></p> 
     109                <p class="description">Change the shortcode keyword from <code>query</code> to <code>qw_query</code>, to avoid conflicts with other plugins.</p> 
     110                <p> 
     111                    Example usage: 
     112                    <br> 
     113                    <b>Compatibility Disabled</b>- <code>[query slug="my-test"]</code> 
     114                    <br> 
     115                    <b>Compatibility Enabled</b>- <code>[qw_query slug="my-test"]</code> 
     116                </p> 
    111117            </td> 
    112118        </tr> 
  • query-wrangler/trunk/admin/templates/page-query-list.php

    r1329785 r1571900  
    395395         **********************************************************************/ 
    396396        global $wpdb; 
    397         $orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : 'name'; //If no sort, default to title 
    398         $order   = ( ! empty( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : 'asc'; //If no order, default to asc 
    399  
    400         $sql  = "SELECT id as ID, type, name, slug, path 
    401                 FROM " . $wpdb->prefix . "query_wrangler 
    402                 ORDER BY " . $orderby . " " . $order; 
     397 
     398        $sql = "SELECT `id` as `ID`, `type`, `name`, `slug`, `path` FROM {$wpdb->prefix}query_wrangler"; 
     399        $args = array(); 
     400 
     401        if ( !empty( $_REQUEST['s'] ) ){ 
     402            $sql.= " WHERE `name` LIKE %s"; 
     403            $args[] = '%' . $wpdb->esc_like( trim( $_REQUEST['s'] ) ) . '%'; 
     404        } 
     405 
     406        // whitelist orderby 
     407        $orderby = 'name'; 
     408        if ( ! empty( $_REQUEST['orderby'] ) && 
     409             in_array( $_REQUEST['orderby'], array('name', 'type') ) ){ 
     410            $orderby = $_REQUEST['orderby']; 
     411        } 
     412 
     413        // whitelist order 
     414        $order = 'ASC'; 
     415        if ( ! empty( $_REQUEST['order'] ) && strtolower( $_REQUEST['order'] ) == 'desc' ){ 
     416            $order = 'DESC'; 
     417        } 
     418 
     419        $sql.= " ORDER BY %s {$order}"; 
     420        $args[] = $orderby; 
     421 
     422        $sql = $wpdb->prepare( $sql, $args ); 
     423 
    403424        $data = $wpdb->get_results( $sql, ARRAY_A ); 
    404425 
     
    477498            </h2> 
    478499 
     500            <form id="search-queries-filter" method="get"> 
     501                <input type="hidden" name="page" value="<?php echo esc_attr($_REQUEST['page']); ?>"/> 
     502                <?php $ListTable->search_box( 'Search', 'post' ); ?> 
     503            </form> 
     504 
    479505            <!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions --> 
    480506            <form id="queries-filter" method="get"> 
  • query-wrangler/trunk/includes/basics/row_styles.php

    r1329785 r1571900  
    138138function qw_row_style_fields_settings( $row_style, $display ) { 
    139139    $query_fields = isset( $display['field_settings']['fields'] ) ? $display['field_settings']['fields'] : array(); 
     140    $group_by = !empty( $display['field_settings']['group_by_field'] ) ? $display['field_settings']['group_by_field'] : false; 
     141    $strip = !empty( $display['field_settings']['strip_group_by_field'] ) ? true : false; 
    140142    $all_fields   = qw_all_fields(); 
    141143    ?> 
    142     <p class="description">Group by field</p> 
    143     <select class="qw-js-title" 
    144             name="qw-query-options[display][field_settings][group_by_field]"> 
    145         <option value="__none__"> - None -</option> 
    146         <?php 
    147         if ( ! empty( $query_fields ) ) { 
    148             foreach ( $query_fields as $field_name => $field ) { 
    149                 ?> 
    150                 <option 
    151                     value="<?php print esc_attr( $field_name ); ?>"><?php print $all_fields[ $field['hook_key'] ]['title']; ?> </option> 
     144    <p> 
     145        <label>Group by field</label> 
     146        <select class="qw-js-title" 
     147                name="qw-query-options[display][field_settings][group_by_field]"> 
     148            <option value="__none__"> - None -</option> 
    152149            <?php 
     150            if ( ! empty( $query_fields ) ) { 
     151                foreach ( $query_fields as $field_name => $field ) { 
     152                    ?> 
     153                    <option 
     154                        value="<?php print esc_attr( $field_name ); ?>" 
     155                        <?php selected( $field_name, $group_by ); ?>><?php print $all_fields[ $field['hook_key'] ]['title']; ?> </option> 
     156                    <?php 
     157                } 
    153158            } 
    154         } 
    155         ?> 
    156     </select> 
     159            ?> 
     160        </select> 
     161    </p> 
     162    <p> 
     163        <input type="hidden" 
     164               name="qw-query-options[display][field_settings][strip_group_by_field]" 
     165               value=""> 
     166        <label> 
     167            <input type="checkbox" 
     168                   name="qw-query-options[display][field_settings][strip_group_by_field]" 
     169                   value="1" 
     170                   <?php checked( $strip ); ?> 
     171            > - Strip tags from Group by field 
     172        </label> 
     173    </p> 
    157174<?php 
    158175} 
  • query-wrangler/trunk/includes/query.php

    r1544833 r1571900  
    374374 */ 
    375375function qw_unserialize( $serial_str ) { 
    376     $array = maybe_unserialize( $serial_str ); 
    377  
    378     if ( is_array( $array ) ) { 
     376    $data = maybe_unserialize( $serial_str ); 
     377 
     378    // if the string failed to unserialize, we may have a quotation problem 
     379    if ( !is_array( $data ) ) { 
     380        $serial_str = @preg_replace( '!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $serial_str ); 
     381        $data = maybe_unserialize( $serial_str ); 
     382    } 
     383 
     384    if ( is_array( $data ) ) { 
    379385        // stripslashes twice for science 
    380         $array = array_map( 'stripslashes_deep', $array ); 
    381         $array = array_map( 'stripslashes_deep', $array ); 
    382  
    383         return $array; 
    384     } 
     386        $data = array_map( 'stripslashes_deep', $data ); 
     387        $data = array_map( 'stripslashes_deep', $data ); 
     388 
     389        return $data; 
     390    } 
     391 
     392    // if we're here the data wasn't unserialized properly. 
     393    // return a modified version of the default query to prevent major failures. 
     394    $default = qw_default_query_data(); 
     395    $default['display']['title'] = 'error unserializing query data'; 
     396    $default['args']['posts_per_page'] = 1; 
     397 
     398    return $default; 
    385399} 
    386400 
  • query-wrangler/trunk/includes/theme.php

    r1330840 r1571900  
    365365            } 
    366366 
    367             // add token for replace 
     367            // add token for initial replacement 
    368368            $tokens[ '{{' . $field_name . '}}' ] = $row['fields'][ $field_name ]['output']; 
    369369 
     
    402402            } 
    403403 
     404            // update the token for replacement by later fields 
     405            $tokens[ '{{' . $field_name . '}}' ] = $row['fields'][ $field_name ]['output']; 
     406 
    404407            // save a copy of the field output in case it is excluded, but we need it later 
    405408            $row['fields'][ $field_name ]['content'] = $row['fields'][ $field_name ]['output']; 
     
    418421 
    419422        // if set, hash the output of the group_by_field 
    420         if ( $group_by_field_name && isset( $row['fields'][ $group_by_field_name ] ) ) { 
    421             $group_hash = md5( $row['fields'][ $group_by_field_name ]['content'] ); 
     423        if ( $group_by_field_name && isset( $row['fields'][ $group_by_field_name ] ) ) 
     424        { 
     425            // strip tags from group by field 
     426            if ( !empty( $display['field_settings']['strip_group_by_field'] ) ) { 
     427                $row['fields'][ $group_by_field_name ]['content'] = strip_tags( $row['fields'][ $group_by_field_name ]['content'] ); 
     428            } 
     429 
     430            $group_by_field_content = $row['fields'][ $group_by_field_name ]['content']; 
     431 
     432            $group_hash = md5( $group_by_field_content ); 
    422433        } 
    423434 
  • query-wrangler/trunk/query-wrangler.php

    r1544833 r1571900  
    1010Author:            Jonathan Daggerhart 
    1111Author URI:        http://daggerhart.com 
    12 Version:           1.5.41 
     12Version:           1.5.42 
    1313 
    1414****************************************************************** 
     
    3131 
    3232// some useful definitions 
    33 define( 'QW_VERSION', 1.541 ); 
     33define( 'QW_VERSION', 1.542 ); 
    3434define( 'QW_PLUGIN_DIR', dirname( __FILE__ ) ); 
    3535define( 'QW_PLUGIN_URL', plugins_url( '', __FILE__ ) ); 
Note: See TracChangeset for help on using the changeset viewer.