Plugin Directory

Changeset 3293056


Ignore:
Timestamp:
05/14/2025 08:00:52 AM (10 months ago)
Author:
polyplugins
Message:

Update to version 1.0.6 from GitHub

Location:
content-api
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • content-api/tags/1.0.6/content-api.php

    r3289306 r3293056  
    55 * Plugin URI: https://www.polyplugins.com/contact/
    66 * Description: Adds various endpoints to create content
    7  * Version: 1.0.5
     7 * Version: 1.0.6
    88 * Requires at least: 6.5
    99 * Requires PHP: 7.4
     
    424424    $cost              = $product->get_meta('_cost');
    425425    $sku               = $product->get_sku();
     426    $upc               = $product->get_meta('_global_unique_id');
    426427    $stock_status      = $product->get_stock_status();
    427428    $stock_quantity    = $product->get_stock_quantity();
     
    458459      'cost'              => $cost ? floatval($cost) : '',
    459460      'sku'               => $sku ? sanitize_text_field($sku) : '',
     461      'upc'               => $upc ? sanitize_text_field($upc) : '',
    460462      'stock_status'      => $stock_status ? sanitize_text_field($product->get_stock_status()) : '',
    461463      'stock_quantity'    => $stock_quantity ? absint($product->get_stock_quantity()) : 0,
     
    490492    $cost              = isset($fields['cost']) ? floatval($fields['cost']) : '';
    491493    $sku               = isset($fields['sku']) ? sanitize_text_field($fields['sku']) : '';
     494    $upc               = isset($fields['upc']) ? sanitize_text_field($fields['upc']) : '';
    492495    $stock_status      = isset($fields['stock_status']) ? sanitize_text_field($fields['stock_status']) : '';
    493496    $stock_quantity    = isset($fields['stock_quantity']) ? intval($fields['stock_quantity']) : '';
     
    587590    if ($sku) {
    588591      $product->set_sku($sku);
     592    }
     593
     594    if ($upc) {
     595      if (!preg_match('/^[0-9\-]+$/', $upc)) {
     596        return new WP_Error('upc_malformed', 'UPC must contain only numbers and hyphens', array('status' => 500));
     597      }
     598
     599      $product->update_meta_data('_global_unique_id', $upc);
    589600    }
    590601
     
    703714    $cost              = isset($fields['cost']) ? floatval($fields['cost']) : '';
    704715    $sku               = isset($fields['sku']) ? sanitize_text_field($fields['sku']) : '';
     716    $upc               = isset($fields['upc']) ? sanitize_text_field($fields['upc']) : '';
    705717    $stock_status      = isset($fields['stock_status']) ? sanitize_text_field($fields['stock_status']) : '';
    706718    $stock_quantity    = isset($fields['stock_quantity']) ? intval($fields['stock_quantity']) : '';
     
    772784    if ($sku) {
    773785      $product->set_sku($sku);
     786    }
     787
     788    if ($upc) {
     789      if (!preg_match('/^[0-9\-]+$/', $upc)) {
     790        return new WP_Error('upc_malformed', 'UPC must contain only numbers and hyphens', array('status' => 500));
     791      }
     792
     793      $product->update_meta_data('_global_unique_id', $upc);
    774794    }
    775795
  • content-api/tags/1.0.6/readme.txt

    r3289306 r3293056  
    33Tags: content api, rest api, content, creative, api
    44Tested up to: 6.8
    5 Stable tag: 1.0.5
     5Stable tag: 1.0.6
    66Requires PHP: 7.4
    77License: GPLv3
     
    8585== Changelog ==
    8686
     87= 1.0.6 =
     88* Added: upc attribute to results of [Get Product](https://www.polyplugins.com/docs/content-api/api/get-product/) endpoint
     89* Added: upc attribute to [Update Product](https://www.polyplugins.com/docs/content-api/api/update-product/) endpoint
     90* Added: upc attribute to [Create Product](https://www.polyplugins.com/docs/content-api/api/create-product/) endpoint
     91
    8792= 1.0.5 =
    8893* Added: status attribute to [Update Product](https://www.polyplugins.com/docs/content-api/api/update-product/) endpoint
  • content-api/trunk/content-api.php

    r3289306 r3293056  
    55 * Plugin URI: https://www.polyplugins.com/contact/
    66 * Description: Adds various endpoints to create content
    7  * Version: 1.0.5
     7 * Version: 1.0.6
    88 * Requires at least: 6.5
    99 * Requires PHP: 7.4
     
    424424    $cost              = $product->get_meta('_cost');
    425425    $sku               = $product->get_sku();
     426    $upc               = $product->get_meta('_global_unique_id');
    426427    $stock_status      = $product->get_stock_status();
    427428    $stock_quantity    = $product->get_stock_quantity();
     
    458459      'cost'              => $cost ? floatval($cost) : '',
    459460      'sku'               => $sku ? sanitize_text_field($sku) : '',
     461      'upc'               => $upc ? sanitize_text_field($upc) : '',
    460462      'stock_status'      => $stock_status ? sanitize_text_field($product->get_stock_status()) : '',
    461463      'stock_quantity'    => $stock_quantity ? absint($product->get_stock_quantity()) : 0,
     
    490492    $cost              = isset($fields['cost']) ? floatval($fields['cost']) : '';
    491493    $sku               = isset($fields['sku']) ? sanitize_text_field($fields['sku']) : '';
     494    $upc               = isset($fields['upc']) ? sanitize_text_field($fields['upc']) : '';
    492495    $stock_status      = isset($fields['stock_status']) ? sanitize_text_field($fields['stock_status']) : '';
    493496    $stock_quantity    = isset($fields['stock_quantity']) ? intval($fields['stock_quantity']) : '';
     
    587590    if ($sku) {
    588591      $product->set_sku($sku);
     592    }
     593
     594    if ($upc) {
     595      if (!preg_match('/^[0-9\-]+$/', $upc)) {
     596        return new WP_Error('upc_malformed', 'UPC must contain only numbers and hyphens', array('status' => 500));
     597      }
     598
     599      $product->update_meta_data('_global_unique_id', $upc);
    589600    }
    590601
     
    703714    $cost              = isset($fields['cost']) ? floatval($fields['cost']) : '';
    704715    $sku               = isset($fields['sku']) ? sanitize_text_field($fields['sku']) : '';
     716    $upc               = isset($fields['upc']) ? sanitize_text_field($fields['upc']) : '';
    705717    $stock_status      = isset($fields['stock_status']) ? sanitize_text_field($fields['stock_status']) : '';
    706718    $stock_quantity    = isset($fields['stock_quantity']) ? intval($fields['stock_quantity']) : '';
     
    772784    if ($sku) {
    773785      $product->set_sku($sku);
     786    }
     787
     788    if ($upc) {
     789      if (!preg_match('/^[0-9\-]+$/', $upc)) {
     790        return new WP_Error('upc_malformed', 'UPC must contain only numbers and hyphens', array('status' => 500));
     791      }
     792
     793      $product->update_meta_data('_global_unique_id', $upc);
    774794    }
    775795
  • content-api/trunk/readme.txt

    r3289306 r3293056  
    33Tags: content api, rest api, content, creative, api
    44Tested up to: 6.8
    5 Stable tag: 1.0.5
     5Stable tag: 1.0.6
    66Requires PHP: 7.4
    77License: GPLv3
     
    8585== Changelog ==
    8686
     87= 1.0.6 =
     88* Added: upc attribute to results of [Get Product](https://www.polyplugins.com/docs/content-api/api/get-product/) endpoint
     89* Added: upc attribute to [Update Product](https://www.polyplugins.com/docs/content-api/api/update-product/) endpoint
     90* Added: upc attribute to [Create Product](https://www.polyplugins.com/docs/content-api/api/create-product/) endpoint
     91
    8792= 1.0.5 =
    8893* Added: status attribute to [Update Product](https://www.polyplugins.com/docs/content-api/api/update-product/) endpoint
Note: See TracChangeset for help on using the changeset viewer.