Plugin Directory

Changeset 3189611


Ignore:
Timestamp:
11/15/2024 01:50:14 PM (17 months ago)
Author:
aliakro
Message:

Update to version 4.1.6 from GitHub

Location:
shortcode-variables
Files:
2 added
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • shortcode-variables/tags/4.1.6/includes/shortcode.presets.premium.php

    r3032812 r3189611  
    405405 * Full example:
    406406 *
    407  * [sv slug="sc-db-value-by-id" table="users" column="user_login" column-to-search="id" key="3" key-format="%d" message-not-found="User not found" cache=false cache-duration=3600 ]
    408  *
     407 * [sv slug="sc-db-value-by-id" table="wp_users" column="user_login" column-to-search="id" key="3" key-format="%d" message-not-found="User not found" cache=false cache-duration=3600 ]
     408 *
     409 * Another example is to fetch the key we're searching for from the query string:
     410 *
     411 * e.g. https://[url]/?user-id=3
     412 *
     413 * [sv slug="sc-db-value-by-id" table="wp_users" column="user_login" column-to-search="id" key-query-string="user-id" key-format="%d" message-not-found="User not found" cache=false cache-duration=3600 ]
     414 *
    409415 * SC_DB_VALUE_BY_ID
    410416 */
     
    413419    protected function unsanitised() {
    414420
    415         $args = wp_parse_args( $this->get_arguments(), [ 'key-format' => '%d', 'message-not-found' => '', 'cache' => true, 'cache-duration' => 1 * HOUR_IN_SECONDS ] );
     421        $args = wp_parse_args( $this->get_arguments(), [ 'key-format' => '%d', 'key-query-string' => NULL, 'message-not-found' => '', 'cache' => true, 'cache-duration' => 1 * HOUR_IN_SECONDS ] );
    416422
    417423        if ( $validation_error = $this->validate_arguments( $args ) ) {
     
    427433
    428434        global $wpdb;
     435
     436        // Load key to look for from querystring?
     437        $key = ( false === empty( $args['key-query-string'] ) ) ?
     438                    $_GET[ $args['key-query-string'] ] : $args['key'];
    429439
    430440        $sql = sprintf( 'Select %s from %s where %s = %s',
     
    435445        );
    436446
    437         $sql    = $wpdb->prepare( $sql, $args['key'] );
     447        $sql    = $wpdb->prepare( $sql, $key );
    438448        $value  = $wpdb->get_var( $sql );
    439449
     
    465475        }
    466476
    467         if ( true === empty( $args['key'] ) ) {
    468             return 'No key has been specified (i.e. "key" argument is missing).';
     477        if ( false === empty( $args['key-query-string'] ) ) {
     478            if( true === empty( $_GET[ $args['key-query-string'] ] ) ) {
     479                return sprintf('A querystring key ( "%1$s" ) has been specified but no value was been passed within the URL? (e.g. https://[website-address]/?%1$s=some-value).', esc_html( $args['key-query-string'] ) );
     480            }
     481        } elseif ( true === empty( $args['key'] ) ) {
     482            return 'No key has been specified (i.e. the "key" and "key-query-string" arguments are both missing).';
    469483        }
    470484
  • shortcode-variables/tags/4.1.6/readme.txt

    r3110951 r3189611  
    44Tags: shortcode, variable, php, text, html, parameter, javascript, embed, reuse
    55Requires at least: 6.0
    6 Tested up to: 6.5
    7 Stable tag: 4.1.5
     6Tested up to: 6.7
     7Stable tag: 4.1.6
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    148148== Changelog ==
    149149
     150= 4.1.6 =
     151
     152* New Feature: Extended [sv slug="sc-db-value-by-id"] shortcode to include the new argument "key-query-string". This allows a key to be read from the matching querystring value. Read more: https://snippet-shortcodes.yeken.uk/shortcodes/sc-db-value-by-id.html
     153
    150154= 4.1.5 =
    151155
  • shortcode-variables/tags/4.1.6/shortcode-variables.php

    r3110951 r3189611  
    66 * Plugin Name: Snippet Shortcodes
    77 * Description: Create your own shortcodes and assign text / variables to it or use our premade ones. You can then embed these shortcodes throughout your entire site and only have to change the value in one place.
    8  * Version: 4.1.5
     8 * Version: 4.1.6
    99 * Requires at least:   6.0
    1010 * Tested up to:        6.5
     
    3535define( 'SH_CD_ABSPATH', plugin_dir_path( __FILE__ ) );
    3636
    37 define( 'SH_CD_PLUGIN_VERSION', '4.1.5' );
     37define( 'SH_CD_PLUGIN_VERSION', '4.1.6' );
    3838define( 'SH_CD_PLUGIN_NAME', 'Snippet Shortcodes' );
    3939define( 'SH_CD_TABLE', 'SH_CD_SHORTCODES' );
  • shortcode-variables/trunk/includes/shortcode.presets.premium.php

    r3032812 r3189611  
    405405 * Full example:
    406406 *
    407  * [sv slug="sc-db-value-by-id" table="users" column="user_login" column-to-search="id" key="3" key-format="%d" message-not-found="User not found" cache=false cache-duration=3600 ]
    408  *
     407 * [sv slug="sc-db-value-by-id" table="wp_users" column="user_login" column-to-search="id" key="3" key-format="%d" message-not-found="User not found" cache=false cache-duration=3600 ]
     408 *
     409 * Another example is to fetch the key we're searching for from the query string:
     410 *
     411 * e.g. https://[url]/?user-id=3
     412 *
     413 * [sv slug="sc-db-value-by-id" table="wp_users" column="user_login" column-to-search="id" key-query-string="user-id" key-format="%d" message-not-found="User not found" cache=false cache-duration=3600 ]
     414 *
    409415 * SC_DB_VALUE_BY_ID
    410416 */
     
    413419    protected function unsanitised() {
    414420
    415         $args = wp_parse_args( $this->get_arguments(), [ 'key-format' => '%d', 'message-not-found' => '', 'cache' => true, 'cache-duration' => 1 * HOUR_IN_SECONDS ] );
     421        $args = wp_parse_args( $this->get_arguments(), [ 'key-format' => '%d', 'key-query-string' => NULL, 'message-not-found' => '', 'cache' => true, 'cache-duration' => 1 * HOUR_IN_SECONDS ] );
    416422
    417423        if ( $validation_error = $this->validate_arguments( $args ) ) {
     
    427433
    428434        global $wpdb;
     435
     436        // Load key to look for from querystring?
     437        $key = ( false === empty( $args['key-query-string'] ) ) ?
     438                    $_GET[ $args['key-query-string'] ] : $args['key'];
    429439
    430440        $sql = sprintf( 'Select %s from %s where %s = %s',
     
    435445        );
    436446
    437         $sql    = $wpdb->prepare( $sql, $args['key'] );
     447        $sql    = $wpdb->prepare( $sql, $key );
    438448        $value  = $wpdb->get_var( $sql );
    439449
     
    465475        }
    466476
    467         if ( true === empty( $args['key'] ) ) {
    468             return 'No key has been specified (i.e. "key" argument is missing).';
     477        if ( false === empty( $args['key-query-string'] ) ) {
     478            if( true === empty( $_GET[ $args['key-query-string'] ] ) ) {
     479                return sprintf('A querystring key ( "%1$s" ) has been specified but no value was been passed within the URL? (e.g. https://[website-address]/?%1$s=some-value).', esc_html( $args['key-query-string'] ) );
     480            }
     481        } elseif ( true === empty( $args['key'] ) ) {
     482            return 'No key has been specified (i.e. the "key" and "key-query-string" arguments are both missing).';
    469483        }
    470484
  • shortcode-variables/trunk/readme.txt

    r3110951 r3189611  
    44Tags: shortcode, variable, php, text, html, parameter, javascript, embed, reuse
    55Requires at least: 6.0
    6 Tested up to: 6.5
    7 Stable tag: 4.1.5
     6Tested up to: 6.7
     7Stable tag: 4.1.6
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    148148== Changelog ==
    149149
     150= 4.1.6 =
     151
     152* New Feature: Extended [sv slug="sc-db-value-by-id"] shortcode to include the new argument "key-query-string". This allows a key to be read from the matching querystring value. Read more: https://snippet-shortcodes.yeken.uk/shortcodes/sc-db-value-by-id.html
     153
    150154= 4.1.5 =
    151155
  • shortcode-variables/trunk/shortcode-variables.php

    r3110951 r3189611  
    66 * Plugin Name: Snippet Shortcodes
    77 * Description: Create your own shortcodes and assign text / variables to it or use our premade ones. You can then embed these shortcodes throughout your entire site and only have to change the value in one place.
    8  * Version: 4.1.5
     8 * Version: 4.1.6
    99 * Requires at least:   6.0
    1010 * Tested up to:        6.5
     
    3535define( 'SH_CD_ABSPATH', plugin_dir_path( __FILE__ ) );
    3636
    37 define( 'SH_CD_PLUGIN_VERSION', '4.1.5' );
     37define( 'SH_CD_PLUGIN_VERSION', '4.1.6' );
    3838define( 'SH_CD_PLUGIN_NAME', 'Snippet Shortcodes' );
    3939define( 'SH_CD_TABLE', 'SH_CD_SHORTCODES' );
Note: See TracChangeset for help on using the changeset viewer.