Plugin Directory

Changeset 2913184


Ignore:
Timestamp:
05/16/2023 06:43:48 PM (3 years ago)
Author:
datafeedr.com
Message:

Update to version 1.3.6 from GitHub

Location:
datafeedr-woocommerce-importer
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • datafeedr-woocommerce-importer/tags/1.3.6/datafeedr-woocommerce-importer.php

    r2901932 r2913184  
    1010Requires PHP: 7.4
    1111Requires at least: 3.8
    12 Tested up to: 6.2.1-alpha
    13 Version: 1.3.5
     12Tested up to: 6.2.1-RC1
     13Version: 1.3.6
    1414
    1515WC requires at least: 3.0
    16 WC tested up to: 7.0
     16WC tested up to: 7.7
    1717
    1818Datafeedr WooCommerce Importer plugin
     
    4343 * Define constants.
    4444 */
    45 define( 'DFRPSWC_VERSION', '1.3.5' );
     45define( 'DFRPSWC_VERSION', '1.3.6' );
    4646define( 'DFRPSWC_DB_VERSION', '1.2.0' );
    4747define( 'DFRPSWC_URL', plugin_dir_url( __FILE__ ) );
     
    174174            ?>
    175175
    176             <div class="error">
    177                 <p>
    178                     <strong style="color:#E44532;"><?php _e( 'URGENT - ACTION REQUIRED!', DFRPSWC_DOMAIN ); ?></strong>
    179 
    180                     <br/>
     176            <div class="error">
     177                <p>
     178                    <strong style="color:#E44532;"><?php _e( 'URGENT - ACTION REQUIRED!', DFRPSWC_DOMAIN ); ?></strong>
     179
     180                    <br/>
    181181
    182182                    <?php
     
    187187                    ?>
    188188
    189                     <br/>
     189                    <br/>
    190190
    191191                    <?php
     
    195195                    ?>
    196196
    197                     <br/>
    198 
    199                     <a class="button button-primary button-large" style="margin-top: 6px" href="<?php echo $url; ?>">
     197                    <br/>
     198
     199                    <a class="button button-primary button-large" style="margin-top: 6px" href="<?php echo $url; ?>">
    200200                        <?php _e( 'Update Now', 'dfrpswc_integration' ); ?>
    201                     </a>
    202                 </p>
    203             </div>
     201                    </a>
     202                </p>
     203            </div>
    204204
    205205            <?php
     
    282282 * @return array
    283283 */
    284 function dfrpswc_get_default_options() {
     284function dfrpswc_get_default_options(): array {
    285285    return [
    286286        'button_text'   => 'Buy Now',
     
    290290        'target_single' => '_blank',
    291291        'target_loop'   => '_blank',
     292        'display_sku'   => 'yes',
    292293    ];
    293294}
     
    334335        __( 'Format Prices', 'dfrpswc_integration' ),
    335336        'dfrpswc_format_price_field',
     337        'dfrpswc_options-page',
     338        'dfrpswc_general_settings'
     339    );
     340
     341    add_settings_field(
     342        'dfrpswc_display_sku',
     343        __( 'Display SKU', 'dfrpswc_integration' ),
     344        'dfrpswc_display_sku_field',
    336345        'dfrpswc_options-page',
    337346        'dfrpswc_general_settings'
     
    423432
    424433/**
     434 * Display SKU field.
     435 */
     436function dfrpswc_display_sku_field(): void {
     437    $options          = dfrpswc_get_options();
     438    $value            = $options['display_sku'];
     439    $yes              = 'yes';
     440    $no               = 'no';
     441    $selected_yes     = checked( $yes, $value, false );
     442    $selected_no      = checked( $no, $value, false );
     443
     444    echo '<input type="radio" class="regular-text" name="dfrpswc_options[display_sku]" value="' . esc_attr( $yes ) . '" ' . $selected_yes . ' /> ' . ucfirst( $yes );
     445    echo '&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" class="regular-text" name="dfrpswc_options[display_sku]" value="' . esc_attr( $no ) . '" ' . $selected_no . ' /> ' . ucfirst( $no );
     446    echo '<p class="description">';
     447    esc_html_e( 'By default, Datafeedr\'s unique product ID will appear on your single product pages.', 'dfrpswc_integration' );
     448    echo '<br/>';
     449    echo __( '- Select "Yes" to continue displaying the product ID. (default)', 'dfrpswc_integration' );
     450    echo '<br/>';
     451    echo __( '- Select "No" to hide the SKU.', 'dfrpswc_integration' );
     452    echo '<br/>';
     453    printf( '<a href="%s" target="_blank" rel="noopener">%s</a>',
     454        'https://datafeedrapi.helpscoutdocs.com/article/164-remove-sku-from-single-product-page',
     455        esc_html__( 'Learn More', 'dfrpswc_integration' )
     456    );
     457    echo '</p>';
     458}
     459
     460/**
    425461 * Set the rel attribute for the buy button on the single product page.
    426462 */
     
    484520        if ( $key === 'format_price' ) {
    485521            $new_input['format_price'] = $value === 'yes' ? 'yes' : 'no';
     522        }
     523
     524        if ( $key === 'display_sku' ) {
     525            $new_input['display_sku'] = in_array( $value, [ 'yes', 'no' ], true ) ? $value : 'yes';
    486526        }
    487527
  • datafeedr-woocommerce-importer/tags/1.3.6/filters.php

    r2705769 r2913184  
    153153        'description' => '',
    154154        'fields'      => [
    155             'button_text'  => [
     155            'format_price'  => [
     156                'label' => __( 'Format Prices', 'dfrpswc_integration' ),
     157                'value' => ! empty( $options['format_price'] ) ? ucfirst( $options['format_price'] ) : '—',
     158                'debug' => ! empty( $options['format_price'] ) ? $options['format_price'] : '—',
     159            ],
     160            'display_sku'   => [
     161                'label' => __( 'Display SKU', 'dfrpswc_integration' ),
     162                'value' => ! empty( $options['display_sku'] ) ? ucfirst( $options['display_sku'] ) : '—',
     163                'debug' => ! empty( $options['display_sku'] ) ? $options['display_sku'] : '—',
     164            ],
     165            'button_text'   => [
    156166                'label' => __( 'Button Text', 'dfrpswc_integration' ),
    157                 'value' => isset( $options['button_text'] ) && ! empty( $options['button_text'] ) ? $options['button_text'] : '—',
    158             ],
    159             'format_price' => [
    160                 'label' => __( 'Format Prices', 'dfrpswc_integration' ),
    161                 'value' => isset( $options['format_price'] ) && ! empty( $options['format_price'] ) ? ucfirst( $options['format_price'] ) : '—',
    162                 'debug' => isset( $options['format_price'] ) && ! empty( $options['format_price'] ) ? $options['format_price'] : '—',
     167                'value' => ! empty( $options['button_text'] ) ? $options['button_text'] : '—',
     168            ],
     169            'rel_loop'      => [
     170                'label' => __( 'Loop Page rel', 'dfrpswc_integration' ),
     171                'value' => ! empty( $options['rel_loop'] ) ? $options['rel_loop'] : '—',
     172            ],
     173            'rel_single'    => [
     174                'label' => __( 'Single Product Page rel', 'dfrpswc_integration' ),
     175                'value' => ! empty( $options['rel_single'] ) ? $options['rel_single'] : '—',
     176            ],
     177            'target_loop'   => [
     178                'label' => __( 'Loop Page target', 'dfrpswc_integration' ),
     179                'value' => ! empty( $options['target_loop'] ) ? $options['target_loop'] : '—',
     180            ],
     181            'target_single' => [
     182                'label' => __( 'Single Product Page target', 'dfrpswc_integration' ),
     183                'value' => ! empty( $options['target_single'] ) ? $options['target_single'] : '—',
    163184            ],
    164185        ]
     
    206227 * Set the rel attribute for the Buy Button on Single Product Pages.
    207228 *
     229 * @param string $product_type
     230 *
     231 * @param string $rel
     232 *
     233 * @return string
    208234 * @since 1.2.58
    209235 *
    210  * @param string $product_type
    211  *
    212  * @param string $rel
    213  *
    214  * @return string
    215236 */
    216237function dfrpswc_single_product_button_rel( string $rel, string $product_type ) {
     
    225246 * Set the rel attribute for the Buy Button in the Loop.
    226247 *
     248 * @param WC_Product $product
     249 *
     250 * @param array $args
     251 *
     252 * @return array
    227253 * @since 1.2.58
    228254 *
    229  * @param WC_Product $product
    230  *
    231  * @param array $args
    232  *
    233  * @return array
    234255 */
    235256function dfrpswc_loop_button_rel( array $args, WC_Product $product ) {
     
    246267 * Set the target attribute for the Buy Button on Single Product Pages.
    247268 *
     269 * @param string $product_type
     270 *
     271 * @param string $rel
     272 *
     273 * @return string
    248274 * @since 1.2.58
    249275 *
    250  * @param string $product_type
    251  *
    252  * @param string $rel
    253  *
    254  * @return string
    255276 */
    256277function dfrpswc_single_product_button_target( string $target, string $product_type ) {
     
    265286 * Set the target attribute for the Buy Button in the Loop.
    266287 *
     288 * @param WC_Product $product
     289 *
     290 * @param array $args
     291 *
     292 * @return array
     293 *
    267294 * @since 1.2.58
    268  *
    269  * @param WC_Product $product
    270  *
    271  * @param array $args
    272  *
    273  * @return array
    274295 *
    275296 */
     
    283304
    284305add_filter( 'woocommerce_loop_add_to_cart_args', 'dfrpswc_loop_button_target', 10, 2 );
     306
     307/**
     308 * Remove "SKU" from WooCommerce single product details page.
     309 *
     310 * @param bool $boolean
     311 *
     312 * @return bool
     313 * @since 1.3.6
     314 */
     315function dfrpswc_display_sku( bool $boolean ): bool {
     316
     317    if ( ! is_single() ) {
     318        return $boolean;
     319    }
     320
     321    if ( $boolean === false ) {
     322        return $boolean;
     323    }
     324
     325    return dfrpswc_get_option( 'display_sku', 'yes' ) === 'yes';
     326}
     327
     328add_filter( 'wc_product_sku_enabled', 'dfrpswc_display_sku' );
  • datafeedr-woocommerce-importer/tags/1.3.6/readme.txt

    r2901932 r2913184  
    88Requires PHP: 7.4
    99Requires at least: 3.8
    10 Tested up to: 6.2.1-alpha
    11 Stable tag: 1.3.5
     10Tested up to: 6.2.1-RC1
     11Stable tag: 1.3.6
    1212
    1313Import products from the Datafeedr API into your WooCommerce store.
     
    200200== Changelog ==
    201201
     202= 1.3.6 - 2023/05/16 =
     203* Created option to disable SKU from appearing on Single Product Pages (WordPress Admin Area > Product Sets > WC Importer > Display SKU)
     204
    202205= 1.3.5 - 2023/04/20 =
    203206* Updated tested up to values
  • datafeedr-woocommerce-importer/trunk/datafeedr-woocommerce-importer.php

    r2901932 r2913184  
    1010Requires PHP: 7.4
    1111Requires at least: 3.8
    12 Tested up to: 6.2.1-alpha
    13 Version: 1.3.5
     12Tested up to: 6.2.1-RC1
     13Version: 1.3.6
    1414
    1515WC requires at least: 3.0
    16 WC tested up to: 7.0
     16WC tested up to: 7.7
    1717
    1818Datafeedr WooCommerce Importer plugin
     
    4343 * Define constants.
    4444 */
    45 define( 'DFRPSWC_VERSION', '1.3.5' );
     45define( 'DFRPSWC_VERSION', '1.3.6' );
    4646define( 'DFRPSWC_DB_VERSION', '1.2.0' );
    4747define( 'DFRPSWC_URL', plugin_dir_url( __FILE__ ) );
     
    174174            ?>
    175175
    176             <div class="error">
    177                 <p>
    178                     <strong style="color:#E44532;"><?php _e( 'URGENT - ACTION REQUIRED!', DFRPSWC_DOMAIN ); ?></strong>
    179 
    180                     <br/>
     176            <div class="error">
     177                <p>
     178                    <strong style="color:#E44532;"><?php _e( 'URGENT - ACTION REQUIRED!', DFRPSWC_DOMAIN ); ?></strong>
     179
     180                    <br/>
    181181
    182182                    <?php
     
    187187                    ?>
    188188
    189                     <br/>
     189                    <br/>
    190190
    191191                    <?php
     
    195195                    ?>
    196196
    197                     <br/>
    198 
    199                     <a class="button button-primary button-large" style="margin-top: 6px" href="<?php echo $url; ?>">
     197                    <br/>
     198
     199                    <a class="button button-primary button-large" style="margin-top: 6px" href="<?php echo $url; ?>">
    200200                        <?php _e( 'Update Now', 'dfrpswc_integration' ); ?>
    201                     </a>
    202                 </p>
    203             </div>
     201                    </a>
     202                </p>
     203            </div>
    204204
    205205            <?php
     
    282282 * @return array
    283283 */
    284 function dfrpswc_get_default_options() {
     284function dfrpswc_get_default_options(): array {
    285285    return [
    286286        'button_text'   => 'Buy Now',
     
    290290        'target_single' => '_blank',
    291291        'target_loop'   => '_blank',
     292        'display_sku'   => 'yes',
    292293    ];
    293294}
     
    334335        __( 'Format Prices', 'dfrpswc_integration' ),
    335336        'dfrpswc_format_price_field',
     337        'dfrpswc_options-page',
     338        'dfrpswc_general_settings'
     339    );
     340
     341    add_settings_field(
     342        'dfrpswc_display_sku',
     343        __( 'Display SKU', 'dfrpswc_integration' ),
     344        'dfrpswc_display_sku_field',
    336345        'dfrpswc_options-page',
    337346        'dfrpswc_general_settings'
     
    423432
    424433/**
     434 * Display SKU field.
     435 */
     436function dfrpswc_display_sku_field(): void {
     437    $options          = dfrpswc_get_options();
     438    $value            = $options['display_sku'];
     439    $yes              = 'yes';
     440    $no               = 'no';
     441    $selected_yes     = checked( $yes, $value, false );
     442    $selected_no      = checked( $no, $value, false );
     443
     444    echo '<input type="radio" class="regular-text" name="dfrpswc_options[display_sku]" value="' . esc_attr( $yes ) . '" ' . $selected_yes . ' /> ' . ucfirst( $yes );
     445    echo '&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" class="regular-text" name="dfrpswc_options[display_sku]" value="' . esc_attr( $no ) . '" ' . $selected_no . ' /> ' . ucfirst( $no );
     446    echo '<p class="description">';
     447    esc_html_e( 'By default, Datafeedr\'s unique product ID will appear on your single product pages.', 'dfrpswc_integration' );
     448    echo '<br/>';
     449    echo __( '- Select "Yes" to continue displaying the product ID. (default)', 'dfrpswc_integration' );
     450    echo '<br/>';
     451    echo __( '- Select "No" to hide the SKU.', 'dfrpswc_integration' );
     452    echo '<br/>';
     453    printf( '<a href="%s" target="_blank" rel="noopener">%s</a>',
     454        'https://datafeedrapi.helpscoutdocs.com/article/164-remove-sku-from-single-product-page',
     455        esc_html__( 'Learn More', 'dfrpswc_integration' )
     456    );
     457    echo '</p>';
     458}
     459
     460/**
    425461 * Set the rel attribute for the buy button on the single product page.
    426462 */
     
    484520        if ( $key === 'format_price' ) {
    485521            $new_input['format_price'] = $value === 'yes' ? 'yes' : 'no';
     522        }
     523
     524        if ( $key === 'display_sku' ) {
     525            $new_input['display_sku'] = in_array( $value, [ 'yes', 'no' ], true ) ? $value : 'yes';
    486526        }
    487527
  • datafeedr-woocommerce-importer/trunk/filters.php

    r2705769 r2913184  
    153153        'description' => '',
    154154        'fields'      => [
    155             'button_text'  => [
     155            'format_price'  => [
     156                'label' => __( 'Format Prices', 'dfrpswc_integration' ),
     157                'value' => ! empty( $options['format_price'] ) ? ucfirst( $options['format_price'] ) : '—',
     158                'debug' => ! empty( $options['format_price'] ) ? $options['format_price'] : '—',
     159            ],
     160            'display_sku'   => [
     161                'label' => __( 'Display SKU', 'dfrpswc_integration' ),
     162                'value' => ! empty( $options['display_sku'] ) ? ucfirst( $options['display_sku'] ) : '—',
     163                'debug' => ! empty( $options['display_sku'] ) ? $options['display_sku'] : '—',
     164            ],
     165            'button_text'   => [
    156166                'label' => __( 'Button Text', 'dfrpswc_integration' ),
    157                 'value' => isset( $options['button_text'] ) && ! empty( $options['button_text'] ) ? $options['button_text'] : '—',
    158             ],
    159             'format_price' => [
    160                 'label' => __( 'Format Prices', 'dfrpswc_integration' ),
    161                 'value' => isset( $options['format_price'] ) && ! empty( $options['format_price'] ) ? ucfirst( $options['format_price'] ) : '—',
    162                 'debug' => isset( $options['format_price'] ) && ! empty( $options['format_price'] ) ? $options['format_price'] : '—',
     167                'value' => ! empty( $options['button_text'] ) ? $options['button_text'] : '—',
     168            ],
     169            'rel_loop'      => [
     170                'label' => __( 'Loop Page rel', 'dfrpswc_integration' ),
     171                'value' => ! empty( $options['rel_loop'] ) ? $options['rel_loop'] : '—',
     172            ],
     173            'rel_single'    => [
     174                'label' => __( 'Single Product Page rel', 'dfrpswc_integration' ),
     175                'value' => ! empty( $options['rel_single'] ) ? $options['rel_single'] : '—',
     176            ],
     177            'target_loop'   => [
     178                'label' => __( 'Loop Page target', 'dfrpswc_integration' ),
     179                'value' => ! empty( $options['target_loop'] ) ? $options['target_loop'] : '—',
     180            ],
     181            'target_single' => [
     182                'label' => __( 'Single Product Page target', 'dfrpswc_integration' ),
     183                'value' => ! empty( $options['target_single'] ) ? $options['target_single'] : '—',
    163184            ],
    164185        ]
     
    206227 * Set the rel attribute for the Buy Button on Single Product Pages.
    207228 *
     229 * @param string $product_type
     230 *
     231 * @param string $rel
     232 *
     233 * @return string
    208234 * @since 1.2.58
    209235 *
    210  * @param string $product_type
    211  *
    212  * @param string $rel
    213  *
    214  * @return string
    215236 */
    216237function dfrpswc_single_product_button_rel( string $rel, string $product_type ) {
     
    225246 * Set the rel attribute for the Buy Button in the Loop.
    226247 *
     248 * @param WC_Product $product
     249 *
     250 * @param array $args
     251 *
     252 * @return array
    227253 * @since 1.2.58
    228254 *
    229  * @param WC_Product $product
    230  *
    231  * @param array $args
    232  *
    233  * @return array
    234255 */
    235256function dfrpswc_loop_button_rel( array $args, WC_Product $product ) {
     
    246267 * Set the target attribute for the Buy Button on Single Product Pages.
    247268 *
     269 * @param string $product_type
     270 *
     271 * @param string $rel
     272 *
     273 * @return string
    248274 * @since 1.2.58
    249275 *
    250  * @param string $product_type
    251  *
    252  * @param string $rel
    253  *
    254  * @return string
    255276 */
    256277function dfrpswc_single_product_button_target( string $target, string $product_type ) {
     
    265286 * Set the target attribute for the Buy Button in the Loop.
    266287 *
     288 * @param WC_Product $product
     289 *
     290 * @param array $args
     291 *
     292 * @return array
     293 *
    267294 * @since 1.2.58
    268  *
    269  * @param WC_Product $product
    270  *
    271  * @param array $args
    272  *
    273  * @return array
    274295 *
    275296 */
     
    283304
    284305add_filter( 'woocommerce_loop_add_to_cart_args', 'dfrpswc_loop_button_target', 10, 2 );
     306
     307/**
     308 * Remove "SKU" from WooCommerce single product details page.
     309 *
     310 * @param bool $boolean
     311 *
     312 * @return bool
     313 * @since 1.3.6
     314 */
     315function dfrpswc_display_sku( bool $boolean ): bool {
     316
     317    if ( ! is_single() ) {
     318        return $boolean;
     319    }
     320
     321    if ( $boolean === false ) {
     322        return $boolean;
     323    }
     324
     325    return dfrpswc_get_option( 'display_sku', 'yes' ) === 'yes';
     326}
     327
     328add_filter( 'wc_product_sku_enabled', 'dfrpswc_display_sku' );
  • datafeedr-woocommerce-importer/trunk/readme.txt

    r2901932 r2913184  
    88Requires PHP: 7.4
    99Requires at least: 3.8
    10 Tested up to: 6.2.1-alpha
    11 Stable tag: 1.3.5
     10Tested up to: 6.2.1-RC1
     11Stable tag: 1.3.6
    1212
    1313Import products from the Datafeedr API into your WooCommerce store.
     
    200200== Changelog ==
    201201
     202= 1.3.6 - 2023/05/16 =
     203* Created option to disable SKU from appearing on Single Product Pages (WordPress Admin Area > Product Sets > WC Importer > Display SKU)
     204
    202205= 1.3.5 - 2023/04/20 =
    203206* Updated tested up to values
Note: See TracChangeset for help on using the changeset viewer.