Changeset 3293056
- Timestamp:
- 05/14/2025 08:00:52 AM (10 months ago)
- Location:
- content-api
- Files:
-
- 4 edited
- 1 copied
-
tags/1.0.6 (copied) (copied from content-api/trunk)
-
tags/1.0.6/content-api.php (modified) (7 diffs)
-
tags/1.0.6/readme.txt (modified) (2 diffs)
-
trunk/content-api.php (modified) (7 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
content-api/tags/1.0.6/content-api.php
r3289306 r3293056 5 5 * Plugin URI: https://www.polyplugins.com/contact/ 6 6 * Description: Adds various endpoints to create content 7 * Version: 1.0. 57 * Version: 1.0.6 8 8 * Requires at least: 6.5 9 9 * Requires PHP: 7.4 … … 424 424 $cost = $product->get_meta('_cost'); 425 425 $sku = $product->get_sku(); 426 $upc = $product->get_meta('_global_unique_id'); 426 427 $stock_status = $product->get_stock_status(); 427 428 $stock_quantity = $product->get_stock_quantity(); … … 458 459 'cost' => $cost ? floatval($cost) : '', 459 460 'sku' => $sku ? sanitize_text_field($sku) : '', 461 'upc' => $upc ? sanitize_text_field($upc) : '', 460 462 'stock_status' => $stock_status ? sanitize_text_field($product->get_stock_status()) : '', 461 463 'stock_quantity' => $stock_quantity ? absint($product->get_stock_quantity()) : 0, … … 490 492 $cost = isset($fields['cost']) ? floatval($fields['cost']) : ''; 491 493 $sku = isset($fields['sku']) ? sanitize_text_field($fields['sku']) : ''; 494 $upc = isset($fields['upc']) ? sanitize_text_field($fields['upc']) : ''; 492 495 $stock_status = isset($fields['stock_status']) ? sanitize_text_field($fields['stock_status']) : ''; 493 496 $stock_quantity = isset($fields['stock_quantity']) ? intval($fields['stock_quantity']) : ''; … … 587 590 if ($sku) { 588 591 $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); 589 600 } 590 601 … … 703 714 $cost = isset($fields['cost']) ? floatval($fields['cost']) : ''; 704 715 $sku = isset($fields['sku']) ? sanitize_text_field($fields['sku']) : ''; 716 $upc = isset($fields['upc']) ? sanitize_text_field($fields['upc']) : ''; 705 717 $stock_status = isset($fields['stock_status']) ? sanitize_text_field($fields['stock_status']) : ''; 706 718 $stock_quantity = isset($fields['stock_quantity']) ? intval($fields['stock_quantity']) : ''; … … 772 784 if ($sku) { 773 785 $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); 774 794 } 775 795 -
content-api/tags/1.0.6/readme.txt
r3289306 r3293056 3 3 Tags: content api, rest api, content, creative, api 4 4 Tested up to: 6.8 5 Stable tag: 1.0. 55 Stable tag: 1.0.6 6 6 Requires PHP: 7.4 7 7 License: GPLv3 … … 85 85 == Changelog == 86 86 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 87 92 = 1.0.5 = 88 93 * 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 5 5 * Plugin URI: https://www.polyplugins.com/contact/ 6 6 * Description: Adds various endpoints to create content 7 * Version: 1.0. 57 * Version: 1.0.6 8 8 * Requires at least: 6.5 9 9 * Requires PHP: 7.4 … … 424 424 $cost = $product->get_meta('_cost'); 425 425 $sku = $product->get_sku(); 426 $upc = $product->get_meta('_global_unique_id'); 426 427 $stock_status = $product->get_stock_status(); 427 428 $stock_quantity = $product->get_stock_quantity(); … … 458 459 'cost' => $cost ? floatval($cost) : '', 459 460 'sku' => $sku ? sanitize_text_field($sku) : '', 461 'upc' => $upc ? sanitize_text_field($upc) : '', 460 462 'stock_status' => $stock_status ? sanitize_text_field($product->get_stock_status()) : '', 461 463 'stock_quantity' => $stock_quantity ? absint($product->get_stock_quantity()) : 0, … … 490 492 $cost = isset($fields['cost']) ? floatval($fields['cost']) : ''; 491 493 $sku = isset($fields['sku']) ? sanitize_text_field($fields['sku']) : ''; 494 $upc = isset($fields['upc']) ? sanitize_text_field($fields['upc']) : ''; 492 495 $stock_status = isset($fields['stock_status']) ? sanitize_text_field($fields['stock_status']) : ''; 493 496 $stock_quantity = isset($fields['stock_quantity']) ? intval($fields['stock_quantity']) : ''; … … 587 590 if ($sku) { 588 591 $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); 589 600 } 590 601 … … 703 714 $cost = isset($fields['cost']) ? floatval($fields['cost']) : ''; 704 715 $sku = isset($fields['sku']) ? sanitize_text_field($fields['sku']) : ''; 716 $upc = isset($fields['upc']) ? sanitize_text_field($fields['upc']) : ''; 705 717 $stock_status = isset($fields['stock_status']) ? sanitize_text_field($fields['stock_status']) : ''; 706 718 $stock_quantity = isset($fields['stock_quantity']) ? intval($fields['stock_quantity']) : ''; … … 772 784 if ($sku) { 773 785 $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); 774 794 } 775 795 -
content-api/trunk/readme.txt
r3289306 r3293056 3 3 Tags: content api, rest api, content, creative, api 4 4 Tested up to: 6.8 5 Stable tag: 1.0. 55 Stable tag: 1.0.6 6 6 Requires PHP: 7.4 7 7 License: GPLv3 … … 85 85 == Changelog == 86 86 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 87 92 = 1.0.5 = 88 93 * 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.