Changeset 3363232
- Timestamp:
- 09/17/2025 01:14:13 PM (6 months ago)
- Location:
- a4-barcode-generator/trunk
- Files:
-
- 10 added
- 9 deleted
- 20 edited
-
assets/css/style-3.4.11-f114ea43.css (deleted)
-
assets/css/style-3.4.12-4807abb8.css (added)
-
assets/js/api-3.4.11-f114ea43.js (deleted)
-
assets/js/api-3.4.12-4807abb8.js (added)
-
assets/js/barcode_template_preview-3.4.11-f114ea43.js (deleted)
-
assets/js/barcode_template_preview-3.4.12-4807abb8.js (added)
-
assets/js/barcodes-core-3.4.11-f114ea43.js (deleted)
-
assets/js/barcodes-core-3.4.12-4807abb8.js (added)
-
assets/js/index-3.4.11-f114ea43.js (deleted)
-
assets/js/index-3.4.12-4807abb8.js (added)
-
assets/js/jszip.min-3.4.11-f114ea43.js (deleted)
-
assets/js/jszip.min-3.4.12-4807abb8.js (added)
-
barcode_generator.php (modified) (3 diffs)
-
class/BarcodeTemplates/BarcodeView.php (modified) (1 diff)
-
class/Core.php (modified) (11 diffs)
-
class/Database.php (modified) (1 diff)
-
class/Generators/BarcodeImage.php (modified) (5 diffs)
-
class/Makers/A4BarcodesMaker.php (modified) (4 diffs)
-
class/Makers/WoocommercePostsA4BarcodesMakerFull.php (modified) (28 diffs)
-
class/Models/PostsUtils.php (modified) (1 diff)
-
class/Profiles.php (modified) (4 diffs)
-
class/Settings.php (modified) (1 diff)
-
class/Shortcodes.php (modified) (1 diff)
-
class/WooCommerce.php (modified) (15 diffs)
-
class/functions.php (modified) (2 diffs)
-
config/jsL10n.php (modified) (6 diffs)
-
languages/wpbcu-barcode-generator.pot.backup (added)
-
lib/meyfa/php-svg/src/Rasterization/Renderers/RectRenderer.php (modified) (1 diff)
-
lib/meyfa/php-svg/src/Rasterization/Renderers/Renderer.php (modified) (1 diff)
-
lib/meyfa/php-svg/src/Rasterization/Renderers/TextRenderer.php (modified) (1 diff)
-
lib/meyfa/php-svg/src/Rasterization/SVGRasterizer.php (modified) (1 diff)
-
public/dist/css/app_demo_3.4.11-f114ea43.css (deleted)
-
public/dist/css/app_demo_3.4.12-4807abb8.css (added)
-
public/dist/index.html (modified) (1 diff)
-
public/dist/js/app_demo_3.4.11-f114ea43.js (deleted)
-
public/dist/js/app_demo_3.4.12-4807abb8.js (added)
-
public/dist/js/chunk-vendors_demo_3.4.11-f114ea43.js (deleted)
-
public/dist/js/chunk-vendors_demo_3.4.12-4807abb8.js (added)
-
templates/printpage.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
a4-barcode-generator/trunk/barcode_generator.php
r3204983 r3363232 4 4 Description: Create and Print barcodes on label sheets using a printer. Best tool to make inventory of your stock. 5 5 Text Domain: wpbcu-barcode-generator 6 Version: 3.4.1 16 Version: 3.4.12 7 7 Author: UkrSolution 8 8 Plugin URI: https://www.ukrsolution.com/Joomla/A4-BarCode-Generator-For-Wordpress … … 10 10 License: GPL2 11 11 WC requires at least: 4.0.0 12 -WC tested up to: 9.4.*12 -WC tested up to: 10.1.* 13 13 */ 14 14 … … 126 126 127 127 $lastVersion = get_option("active-print-barcodes-version", ""); 128 if ($lastVersion !== "3.4.1 1") {128 if ($lastVersion !== "3.4.12") { 129 129 UkrSolution\ProductLabelsPrinting\Database::createTables(); 130 update_option("active-print-barcodes-version", "3.4.1 1");130 update_option("active-print-barcodes-version", "3.4.12"); 131 131 } 132 132 }); -
a4-barcode-generator/trunk/class/BarcodeTemplates/BarcodeView.php
r3083367 r3363232 40 40 41 41 $barcodeGenerator = new Generator(); 42 echo esc_html($barcodeGenerator->getGeneratedBarcodeSVGFileName($this->code, $this->algorithm, $w, $h, 'black', true));42 echo $barcodeGenerator->getGeneratedBarcodeSVGFileName($this->code, $this->algorithm, $w, $h, 'black', true); 43 43 } 44 44 } -
a4-barcode-generator/trunk/class/Core.php
r3204983 r3363232 3 3 namespace UkrSolution\ProductLabelsPrinting; 4 4 5 use UkrSolution\ProductLabelsPrinting\Makers\WoocommercePostsA4BarcodesMaker; 5 6 use UkrSolution\ProductLabelsPrinting\Api\PostsData; 6 7 use UkrSolution\ProductLabelsPrinting\BarcodeTemplates\BarcodeTemplatesController; 7 8 use UkrSolution\ProductLabelsPrinting\BarcodeTemplates\BarcodeView; 8 use UkrSolution\ProductLabelsPrinting\Cart\BarcodeCart;9 9 use UkrSolution\ProductLabelsPrinting\Filters\Items; 10 10 use UkrSolution\ProductLabelsPrinting\Generators\BarcodeImage; … … 12 12 use UkrSolution\ProductLabelsPrinting\Helpers\UserSettings; 13 13 use UkrSolution\ProductLabelsPrinting\Helpers\Variables; 14 use UkrSolution\ProductLabelsPrinting\Makers\A4BarcodesMaker;15 14 use UkrSolution\ProductLabelsPrinting\Makers\ManualA4BarcodesMaker; 16 15 use UkrSolution\ProductLabelsPrinting\Makers\TestA4BarcodesMaker; … … 24 23 protected $dimensions; 25 24 protected $updater; 25 protected $woocommerceBarcodesMakerInstance; 26 26 27 27 public function __construct() … … 35 35 add_action('init', function() { 36 36 $this->config = require Variables::$A4B_PLUGIN_BASE_PATH . 'config/config.php'; 37 $this->woocommerceBarcodesMakerInstance = new WoocommercePostsA4BarcodesMaker(array()); 37 38 }, 1); 38 39 … … 379 380 } 380 381 381 wp_register_style('import_categories_button_demo', Variables::$A4B_PLUGIN_BASE_URL . 'templates/actions-assets/style.css', false, '3.4.1 1');382 wp_register_style('import_categories_button_demo', Variables::$A4B_PLUGIN_BASE_URL . 'templates/actions-assets/style.css', false, '3.4.12'); 382 383 wp_enqueue_style('import_categories_button_demo'); 383 384 … … 390 391 global $current_user; 391 392 392 wp_enqueue_script("barcode_loader_print", Variables::$A4B_PLUGIN_BASE_URL."assets/js/index-3.4.1 1-f114ea43.js", array("jquery"), null, true);393 wp_enqueue_script("barcode_api_print", Variables::$A4B_PLUGIN_BASE_URL."assets/js/api-3.4.1 1-f114ea43.js", array("jquery"), null, true);394 wp_enqueue_style("barcode_core_css_print", Variables::$A4B_PLUGIN_BASE_URL."public/dist/css/app_demo_3.4.1 1-f114ea43.css", null, null);$appJsPath = Variables::$A4B_PLUGIN_BASE_URL."public/dist/js/app_demo_3.4.11-f114ea43.js";395 $vendorJsPath = Variables::$A4B_PLUGIN_BASE_URL."public/dist/js/chunk-vendors_demo_3.4.1 1-f114ea43.js";396 $jszip = Variables::$A4B_PLUGIN_BASE_URL."assets/js/jszip.min-3.4.1 1-f114ea43.js";393 wp_enqueue_script("barcode_loader_print", Variables::$A4B_PLUGIN_BASE_URL."assets/js/index-3.4.12-4807abb8.js", array("jquery"), null, true); 394 wp_enqueue_script("barcode_api_print", Variables::$A4B_PLUGIN_BASE_URL."assets/js/api-3.4.12-4807abb8.js", array("jquery"), null, true); 395 wp_enqueue_style("barcode_core_css_print", Variables::$A4B_PLUGIN_BASE_URL."public/dist/css/app_demo_3.4.12-4807abb8.css", null, null);$appJsPath = Variables::$A4B_PLUGIN_BASE_URL."public/dist/js/app_demo_3.4.12-4807abb8.js"; 396 $vendorJsPath = Variables::$A4B_PLUGIN_BASE_URL."public/dist/js/chunk-vendors_demo_3.4.12-4807abb8.js"; 397 $jszip = Variables::$A4B_PLUGIN_BASE_URL."assets/js/jszip.min-3.4.12-4807abb8.js"; 397 398 398 399 … … 458 459 } 459 460 460 $active_template->shortcodes = A4BarcodesMaker::getTemplateShortcodes($active_template->template); 461 $active_template->shortcodes = array(); 462 $this->woocommerceBarcodesMakerInstance->extractTemplateShortcodes($active_template->template, $active_template->shortcodes); 461 463 462 464 $mainConfig = array( … … 465 467 'websiteUrl' => get_bloginfo("url"), 466 468 'adminUrl' => get_admin_url(), 467 'pluginVersion' => '3.4.1 1',469 'pluginVersion' => '3.4.12', 468 470 'isWoocommerceActive' => is_plugin_active('woocommerce/woocommerce.php'), 469 471 'isCF7Active' => is_plugin_active('contact-form-7/wp-contact-form-7.php'), … … 618 620 619 621 $barcodes = [ 620 'isLatest' => (int) version_compare('3.4.1 1', $lastReleaseData['version'], '>='),622 'isLatest' => (int) version_compare('3.4.12', $lastReleaseData['version'], '>='), 621 623 'latest' => $lastReleaseData['version'], 622 'version' => '3.4.1 1',624 'version' => '3.4.12', 623 625 'downloadUrl' => $lastReleaseData['url'], 624 626 'pluginUrl' => Variables::$A4B_PLUGIN_BASE_URL, … … 668 670 } 669 671 670 $template->shortcodes = A4BarcodesMaker::getTemplateShortcodes($template->template); 672 673 $template->shortcodes = array(); 674 $this->woocommerceBarcodesMakerInstance->extractTemplateShortcodes($template->template, $template->shortcodes); 671 675 } 672 676 … … 703 707 { 704 708 if ('BASIC' !== Variables::$A4B_PLUGIN_PLAN) { 705 wp_enqueue_script('barcode_template_preview', Variables::$A4B_PLUGIN_BASE_URL . 'assets/js/barcode_template_preview-3.4.1 1-f114ea43.js', array('jquery'), null, true);709 wp_enqueue_script('barcode_template_preview', Variables::$A4B_PLUGIN_BASE_URL . 'assets/js/barcode_template_preview-3.4.12-4807abb8.js', array('jquery'), null, true); 706 710 wp_localize_script('barcode_templates', 'a4bBarcodeTemplates', array('pluginUrl' => Variables::$A4B_PLUGIN_BASE_URL)); 707 711 -
a4-barcode-generator/trunk/class/Database.php
r2985149 r3363232 178 178 `params` LONGTEXT DEFAULT NULL, 179 179 `barcodeRotate` tinyint(1) DEFAULT 0, 180 `sortAlphabetically` tinyint(1) DEFAULT 0, 180 181 `fontSize` varchar(255) DEFAULT '', 181 182 `fontAlgorithm` varchar(255) DEFAULT 'auto', -
a4-barcode-generator/trunk/class/Generators/BarcodeImage.php
r3083367 r3363232 69 69 public function parseHash($hash, $fileData = array()) 70 70 { 71 if (!function_exists("imagecreate")) { 72 echo "GD not even installed."; 73 return; 74 } 75 71 76 $customTemplates = new BarcodeTemplatesController(); 72 77 … … 161 166 $svg = $barcodeGenerator->getGeneratedBarcodeSVGFileName($code, $algorithm, $barcodeWidth, $barcodeHeight, 'black', true); 162 167 $svg2png = SVG::fromString($svg); 163 $png = $svg2png->toRasterImage( $barcodeWidth,$barcodeHeight);168 $png = $svg2png->toRasterImage((int) $barcodeWidth, (int) $barcodeHeight); 164 169 165 170 Variables::initCodes($this, array( … … 170 175 171 176 if ($width && $height) { 172 $image = $this->createImage( $width,$height);177 $image = $this->createImage((int) $width, (int) $height); 173 178 } else { 174 $image = $this->createImage( $template->width,$template->height);179 $image = $this->createImage((int) $template->width, (int) $template->height); 175 180 } 176 181 … … 278 283 } 279 284 280 imagecopymerge($image, $barcode, $x, $y, 0, 0, $barcodeWidth,$barcodeHeight, 100);285 imagecopymerge($image, $barcode, (int)$x, (int)$y, 0, 0, (int)$barcodeWidth, (int)$barcodeHeight, 100); 281 286 } 282 287 … … 336 341 $x = $position['x']; 337 342 $y = $position['y'] > 0 ? $this->zoomY * $position['y'] : $position['y']; 338 imagettftext($image, $fontSize, 0, $x, $y, $textColor, $font, $text); 343 imagettftext($image, $fontSize, 0, (int)$x, (int)$y, $textColor, $font, $text); 344 339 345 } 340 346 -
a4-barcode-generator/trunk/class/Makers/A4BarcodesMaker.php
r3204983 r3363232 467 467 'product-all-parent-attributes', 468 468 'variation-all-attr', 469 'variation-all-attr-with-names', 469 470 'product-all-attr', 470 471 'product_id_prefix', … … 486 487 'atum-order-supplier-name', 487 488 'atum-order-supplier-code', 489 'atum-product-location', 488 490 489 491 'pbet-product-expire-date', … … 497 499 498 500 'woo-booking_item-booking-date', 501 502 'dokan-vendor-name' 499 503 ); 500 504 … … 579 583 } 580 584 581 public static function getTemplateShortcodes($template)582 {583 $shortcodesArgs = array();584 $barcodesGenerator = new WoocommercePostsA4BarcodesMaker(array());585 $barcodesGenerator->extractTemplateShortcodes($template, $shortcodesArgs);586 587 return $shortcodesArgs;588 }589 585 } -
a4-barcode-generator/trunk/class/Makers/WoocommercePostsA4BarcodesMakerFull.php
r3204983 r3363232 137 137 if ($this->type === "orders") { 138 138 $this->items = $this->getItemsByOrders(); 139 140 if (!empty($this->data['existingIds'])) { 141 $this->data['ordersIds'] = $this->data['existingIds']; 142 $existingItems = $this->getItemsByOrders(); 143 } 139 144 } elseif ($this->type === "order-products") { 140 145 $this->items = $this->getItemsByOrderProducts(); 146 147 if (!empty($this->data['existingIds'])) { 148 $existingItems = uswbg_a4bGetPosts(array('post__in' => $this->data['existingIds'], 'post_type' => array('product', 'product_variation'))); 149 } 141 150 } elseif ($this->type === "products") { 142 151 $this->items = $this->getItemsByProducts(); 152 153 if (!empty($this->data['existingIds'])) { 154 $existingItems = uswbg_a4bGetPosts(array('post__in' => $this->data['existingIds'], 'post_type' => array('product', 'product_variation'))); 155 } 143 156 } elseif ($this->type === "atum-po-order-products") { 144 157 $this->items = $this->getItemsByAtumPoOrderProducts(); … … 148 161 $getItemsMethod = $this->getItemsMethods[$forCategories][$withVariations]; 149 162 $this->items = $this->$getItemsMethod(); 150 } 151 163 164 if (!empty($this->data['existingIds'])) { 165 $existingItems = uswbg_a4bGetPosts(array('post__in' => $this->data['existingIds'], 'post_type' => array('product', 'product_variation'))); 166 } 167 } 168 169 if (!empty($this->data['sortAlphabetically']) && '1' === $this->data['sortAlphabetically']) { 170 171 if (!empty($this->data['existingIds']) && !empty($existingItems)) { 172 $this->items = array_merge( 173 $this->duplicatePostsByGivenIds( 174 $existingItems, 175 $this->data['existingIds'] 176 ), 177 $this->items 178 ); 179 } 180 181 $this->items = $this->sortByTitle($this->items); 182 } 183 184 } 185 186 protected function duplicatePostsByGivenIds($posts, $ids, $field = 'ID') 187 { 188 $counts = array_count_values($ids); 189 190 $objectMap = []; 191 foreach ($posts as $object) { 192 $objectMap[$object->$field][] = $object; 193 } 194 195 $newObjects = $posts; 196 197 foreach ($counts as $value => $requiredCount) { 198 if (isset($objectMap[$value])) { 199 $existingCount = count($objectMap[$value]); 200 while ($existingCount < $requiredCount) { 201 $duplicate = $objectMap[$value][0]; 202 $newObjects[] = $duplicate; 203 $existingCount++; 204 } 205 } 206 } 207 208 return $newObjects; 152 209 } 153 210 154 211 protected function getItemsForCategoriesWithVariations() 155 212 { 156 $productsCategories = isset($this->data['productsCategories']) ? $this->data['productsCategories'] : null;213 $productsCategories = isset($this->data['productsCategories']) ? $this->data['productsCategories'] : array(); 157 214 158 215 $products = $this->getProductsByCategoriesFilteredByProductsStatus($productsCategories); … … 166 223 protected function getItemsForCategories() 167 224 { 168 $productsCategories = isset($this->data['productsCategories']) ? $this->data['productsCategories'] : null;225 $productsCategories = isset($this->data['productsCategories']) ? $this->data['productsCategories'] : array(); 169 226 170 227 return $this->getProductsByCategoriesFilteredByProductsStatus($productsCategories); … … 183 240 'fields' => 'id=>parent', 184 241 )); 242 185 243 $parentsIdsOfVariationsByGivenProductsIds = wp_list_pluck($variationsByGivenProductsIds, 'post_parent'); 186 244 $actualProductsIdsOfVariationsByGivenProductsIds = uswbg_a4bGetPosts(array( … … 188 246 'post_status' => array('publish', 'pending', 'draft', 'future', 'private', 'inherit', 'trash'), 189 247 'post__in' => empty($parentsIdsOfVariationsByGivenProductsIds) ? array(0) : array_values($parentsIdsOfVariationsByGivenProductsIds), 190 'posts_per_page' => -1,191 248 'fields' => 'ids', 192 'suppress_filters' => true,193 'lang' => 'all',194 249 )); 195 250 … … 225 280 protected function getItemsForProducts() 226 281 { 227 $productsIds = isset($this->data['productsIds']) ? $this->data['productsIds'] : null;282 $productsIds = isset($this->data['productsIds']) ? $this->data['productsIds'] : array(); 228 283 $importType = isset($this->data["isImportSingleVariation"]) ? $this->data["isImportSingleVariation"] : ""; 229 284 230 285 if ($importType === "variation") { 231 $products = uswbg_a4bGetPosts(array('post__in' => $productsIds, 'post_type' => 'product_variation'));286 $products = uswbg_a4bGetPosts(array('post__in' => !empty($productsIds) ? $productsIds : array(0), 'post_type' => 'product_variation')); 232 287 } else { 233 288 $products = $this->getProductsByIdsFilteredByProductsStatus($productsIds); … … 239 294 protected function getItemsByProducts() 240 295 { 241 $productsIds = isset($this->data['productsIds']) ? $this->data['productsIds'] : null;296 $productsIds = isset($this->data['productsIds']) ? $this->data['productsIds'] : array(); 242 297 243 298 $onlySelectedVariations = !empty($productsIds) 244 299 ? uswbg_a4bGetPosts(array( 245 300 'post_type' => 'product_variation', 246 'post__in' => $productsIds,301 'post__in' => !empty($productsIds) ? $productsIds : array(0), 247 302 )) 248 303 : array(); … … 271 326 protected function getProductsByIdsFilteredByProductsStatus($productsIds) 272 327 { 273 $products = uswbg_a4bGetPosts(array('post__in' => $productsIds));328 $products = uswbg_a4bGetPosts(array('post__in' => !empty($productsIds) ? $productsIds : array(0))); 274 329 275 330 $productsExcludedByStatus = !empty($this->excludedProdStatusesArr) … … 286 341 { 287 342 $products = uswbg_a4bGetPosts(array( 288 'post__in' => $productsIds,343 'post__in' => !empty($productsIds) ? $productsIds : array(0), 289 344 'tax_query' => array( 290 345 array( … … 324 379 325 380 $productsExcludedByStatus = !empty(UserSettings::getOption('excludedProdStatuses')) 326 ? uswbg_a4bGetPostsByCategories($productsCategories, explode(',', UserSettings::getOption('excludedProdStatuses')))381 ? uswbg_a4bGetPostsByCategories($productsCategories, array('post_status' => explode(',', UserSettings::getOption('excludedProdStatuses')))) 327 382 : array(); 328 383 … … 404 459 )); 405 460 461 $orderSimpleProducts = uswbg_a4bGetPosts(array( 462 'post_type' => 'any', 463 'post__in' => empty($itemIdToProductIdMap) ? array(0) : array_values($itemIdToProductIdMap), 464 'orderby' => 'post__in', 465 )); 466 406 467 $orderProductsIndexedByPostId = array(); 407 468 foreach ($orderProducts as $orderProduct) { 469 $orderProductsIndexedByPostId[$orderProduct->ID] = $orderProduct; 470 } 471 foreach ($orderSimpleProducts as $orderProduct) { 408 472 $orderProductsIndexedByPostId[$orderProduct->ID] = $orderProduct; 409 473 } … … 826 890 $value = $this->getVariationAllAttribute($post, $field); 827 891 break; 892 case 'variation-all-attr-with-names': 893 if (!isset($field['args']) || !is_array($field['args'])) { 894 $field['args'] = array(); 895 } 896 $field['args']['show-attr-name'] = 'true'; 897 $value = $this->getVariationAllAttribute($post, $field); 898 break; 828 899 case 'product_id_prefix': 829 900 $value = $this->getProductIdWithPrefix($post, $field); … … 857 928 $value = $this->getSupplierCode($post, $field); 858 929 break; 930 case 'atum-product-location': 931 $value = $this->getAtumProductLocation($post, $field); 932 break; 859 933 case 'pbet-product-expire-date': 860 934 $value = $this->getPbetProductExpireDate($post, $field); … … 882 956 case 'order-item-consequential-number': 883 957 $value = $this->getOrderItemConsequentialNumber($post, $field); 958 break; 959 case 'dokan-vendor-name': 960 $value = $this->getDokanVendorName($post, $field); 884 961 break; 885 962 default: … … 985 1062 986 1063 return !empty($supplierId) ? get_post_meta($supplierId, '_code', true) : ''; 1064 } 1065 1066 protected function getAtumProductLocation($post, $field) 1067 { 1068 return $this->termsObjectsToString(get_the_terms($post, 'atum_location')); 987 1069 } 988 1070 … … 1081 1163 { 1082 1164 $separator = isset($field['args']['separator']) ? $field['args']['separator'] : ', '; 1165 $showLabel = isset($field['args']['show-attr-name']) && 'true' === $field['args']['show-attr-name']; 1083 1166 $product = wc_get_product($post->ID); 1084 1167 … … 1094 1177 if (0 === strpos($metaData->key, 'pa_')) { 1095 1178 $option_term = get_term_by('slug', $attributeValue, $metaData->key); 1096 $attributeValue = $option_term && ! is_wp_error($option_term) ? str_replace(',', '\\,', $option_term->name) : str_replace(',', '\\,', $attributeValue); 1179 $attributeValue = $option_term && ! is_wp_error($option_term) ? str_replace(',', '\\,', $option_term->name) : str_replace(',', '\\,', $attributeValue); 1180 $taxonomy = get_taxonomy($metaData->key); 1181 $attributeLabel = !empty($taxonomy) ? $taxonomy->labels->singular_name : $metaData->key; 1182 } else { 1183 $attributeLabel = $metaData->key; 1097 1184 } 1098 $allAttrsValues[] = $attributeValue;1185 $allAttrsValues[] = ($showLabel ? $attributeLabel . ': ' : '') . $attributeValue; 1099 1186 } 1100 1187 } … … 1110 1197 $parentNotVariableAttributesOptions = $this->getAttributesOptions($parentNotVariableAttributes); 1111 1198 1112 return implode($separator, array_filter($parentNotVariableAttributesOptions)); 1199 $attributesValues = array(); 1200 foreach ($parentNotVariableAttributesOptions as $attributesOption) { 1201 $attributesValues[] = ($showLabel ? ($attributesOption['label'] . ': ') : '') . implode($separator, array_filter($attributesOption['options'])); 1202 } 1203 return implode($separator, $attributesValues); 1113 1204 } elseif ('product' === $post->post_type) { 1114 1205 if ('variable' === $product->get_type()) { … … 1118 1209 $parentNotVariableAttributesOptions = $this->getAttributesOptions($parentNotVariableAttributes); 1119 1210 1120 return implode($separator, array_filter($parentNotVariableAttributesOptions)); 1211 $attributesValues = array(); 1212 foreach ($parentNotVariableAttributesOptions as $attributesOption) { 1213 $attributesValues[] = ($showLabel ? ($attributesOption['label'] . ': ') : '') . implode($separator, array_filter($attributesOption['options'])); 1214 } 1215 return implode($separator, $attributesValues); 1121 1216 } elseif ('simple' === $product->get_type()) { 1122 1217 $simpleProductAttributes = $product->get_attributes(); 1123 1218 $simpleProductAttributesOptions = $this->getAttributesOptions($simpleProductAttributes); 1124 1219 1125 return implode($separator, array_filter($simpleProductAttributesOptions)); 1220 $attributesValues = array(); 1221 foreach ($simpleProductAttributesOptions as $attributesOption) { 1222 $attributesValues[] = ($showLabel ? ($attributesOption['label'] . ': ') : '') . implode($separator, array_filter($attributesOption['options'])); 1223 } 1224 return implode($separator, $attributesValues); 1126 1225 } else { 1127 1226 return ''; … … 1135 1234 { 1136 1235 $separator = isset($field['args']['separator']) ? $field['args']['separator'] : ', '; 1137 $product = wc_get_product($post->ID); 1138 1139 if (empty($product)) { 1140 return ''; 1141 } 1142 1143 if (isset($post->orderItem)) { 1144 $allAttrsValues = array(); 1145 foreach ($post->orderItem->get_all_formatted_meta_data('') as $metaData) { 1146 if (substr($metaData->key, 0, 1) !== '_') { 1147 $attributeValue = $metaData->value; 1148 if (0 === strpos($metaData->key, 'pa_')) { 1149 $option_term = get_term_by('slug', $attributeValue, $metaData->key); 1150 $attributeValue = $option_term && ! is_wp_error($option_term) ? str_replace(',', '\\,', $option_term->name) : str_replace(',', '\\,', $attributeValue); 1151 } 1152 $allAttrsValues[] = $attributeValue; 1153 } 1154 } 1155 1156 return implode($separator, array_filter($allAttrsValues)); 1157 } elseif ('product_variation' === $post->post_type) { 1158 1159 if (!method_exists($product, 'get_variation_attributes')) { 1160 return ''; 1161 } 1162 1163 $attrsInfo = $product->get_variation_attributes(false); 1164 array_walk($attrsInfo, function(&$attribute, $attribute_name) { 1165 if (0 === strpos($attribute_name, 'pa_')) { 1166 $option_term = get_term_by('slug', $attribute, $attribute_name); 1167 $attribute = $option_term && ! is_wp_error($option_term) 1168 ? str_replace(',', '\\,', $option_term->name) 1169 : str_replace(',', '\\,', $attribute); 1170 } 1171 }); 1172 1173 return implode($separator, array_filter($attrsInfo)); 1174 } elseif ('product' === $post->post_type) { 1175 if ('variable' === $product->get_type()) { 1176 $parentNotVariableAttributes = array_filter($product->get_attributes(), function($wcAttribute){ 1177 return !$wcAttribute->get_variation(); 1178 }); 1179 $parentNotVariableAttributesOptions = $this->getAttributesOptions($parentNotVariableAttributes); 1180 1181 return implode($separator, array_filter($parentNotVariableAttributesOptions)); 1182 } elseif ('simple' === $product->get_type()) { 1183 $simpleProductAttributes = $product->get_attributes(); 1184 $simpleProductAttributesOptions = $this->getAttributesOptions($simpleProductAttributes); 1185 1186 return implode($separator, array_filter($simpleProductAttributesOptions)); 1187 } else { 1188 return ''; 1189 } 1190 } else { 1191 return ''; 1192 } 1193 } 1194 1195 protected function getVariationAllAttribute($post, $field) 1196 { 1197 $separator = isset($field['args']['separator']) ? $field['args']['separator'] : ', '; 1236 $showLabel = isset($field['args']['show-attr-name']) && 'true' === $field['args']['show-attr-name']; 1198 1237 $product = wc_get_product($post->ID); 1199 1238 … … 1210 1249 $option_term = get_term_by('slug', $attributeValue, $metaData->key); 1211 1250 $attributeValue = $option_term && ! is_wp_error($option_term) ? str_replace(',', '\\,', $option_term->name) : str_replace(',', '\\,', $attributeValue); 1251 $taxonomy = get_taxonomy($metaData->key); 1252 $attributeLabel = !empty($taxonomy) ? $taxonomy->labels->singular_name : $metaData->key; 1253 } else { 1254 $attributeLabel = $metaData->key; 1212 1255 } 1213 $allAttrsValues[] = $attributeValue;1256 $allAttrsValues[] = ($showLabel ? $attributeLabel . ': ' : '') . $attributeValue; 1214 1257 } 1215 1258 } … … 1223 1266 1224 1267 $attrsInfo = $product->get_variation_attributes(false); 1225 array_walk($attrsInfo, function(&$attribute, $attribute_name) { 1268 1269 array_walk($attrsInfo, function(&$attribute, $attribute_name) use ($showLabel) { 1226 1270 if (0 === strpos($attribute_name, 'pa_')) { 1227 1271 $option_term = get_term_by('slug', $attribute, $attribute_name); … … 1229 1273 ? str_replace(',', '\\,', $option_term->name) 1230 1274 : str_replace(',', '\\,', $attribute); 1275 1276 $taxonomy = get_taxonomy($attribute_name); 1277 $attributeLabel = !empty($taxonomy) ? $taxonomy->labels->singular_name : $attribute_name; 1278 } else { 1279 $attributeLabel = $attribute_name; 1280 } 1281 1282 if ($showLabel && !empty($attribute)) { 1283 $attribute = $attributeLabel . ': ' . $attribute; 1284 } 1285 }); 1286 1287 return implode($separator, array_filter($attrsInfo)); 1288 } elseif ('product' === $post->post_type) { 1289 if ('variable' === $product->get_type()) { 1290 $parentNotVariableAttributes = array_filter($product->get_attributes(), function($wcAttribute){ 1291 return !$wcAttribute->get_variation(); 1292 }); 1293 $parentNotVariableAttributesOptions = $this->getAttributesOptions($parentNotVariableAttributes); 1294 1295 $attributesValues = array(); 1296 foreach ($parentNotVariableAttributesOptions as $attributesOption) { 1297 $attributesValues[] = ($showLabel ? ($attributesOption['label'] . ': ') : '') . implode($separator, array_filter($attributesOption['options'])); 1298 } 1299 return implode($separator, $attributesValues); 1300 } elseif ('simple' === $product->get_type()) { 1301 $simpleProductAttributes = $product->get_attributes(); 1302 $simpleProductAttributesOptions = $this->getAttributesOptions($simpleProductAttributes); 1303 1304 $attributesValues = array(); 1305 foreach ($simpleProductAttributesOptions as $attributesOption) { 1306 $attributesValues[] = ($showLabel ? ($attributesOption['label'] . ': ') : '') . implode($separator, array_filter($attributesOption['options'])); 1307 } 1308 return implode($separator, $attributesValues); 1309 } else { 1310 return ''; 1311 } 1312 } else { 1313 return ''; 1314 } 1315 } 1316 1317 protected function getVariationAllAttribute($post, $field) 1318 { 1319 $separator = isset($field['args']['separator']) ? $field['args']['separator'] : ', '; 1320 $showLabel = isset($field['args']['show-attr-name']) && 'true' === $field['args']['show-attr-name']; 1321 $product = wc_get_product($post->ID); 1322 1323 if (empty($product)) { 1324 return ''; 1325 } 1326 1327 if (isset($post->orderItem)) { 1328 $allAttrsValues = array(); 1329 foreach ($post->orderItem->get_all_formatted_meta_data('') as $metaData) { 1330 if (substr($metaData->key, 0, 1) !== '_') { 1331 $attributeValue = $metaData->value; 1332 if (0 === strpos($metaData->key, 'pa_')) { 1333 $option_term = get_term_by('slug', $attributeValue, $metaData->key); 1334 $attributeValue = $option_term && ! is_wp_error($option_term) ? str_replace(',', '\\,', $option_term->name) : str_replace(',', '\\,', $attributeValue); 1335 $taxonomy = get_taxonomy($metaData->key); 1336 $attributeLabel = !empty($taxonomy) ? $taxonomy->labels->singular_name : $metaData->key; 1337 } else { 1338 $attributeLabel = $metaData->key; 1339 } 1340 $allAttrsValues[] = ($showLabel ? $attributeLabel . ': ' : '') . $attributeValue; 1341 } 1342 } 1343 1344 return implode($separator, array_filter($allAttrsValues)); 1345 } elseif ('product_variation' === $post->post_type) { 1346 1347 if (!method_exists($product, 'get_variation_attributes')) { 1348 return ''; 1349 } 1350 1351 $attrsInfo = $product->get_variation_attributes(false); 1352 array_walk($attrsInfo, function(&$attribute, $attribute_name) use ($showLabel) { 1353 if (0 === strpos($attribute_name, 'pa_')) { 1354 $option_term = get_term_by('slug', $attribute, $attribute_name); 1355 $attribute = $option_term && ! is_wp_error($option_term) 1356 ? str_replace(',', '\\,', $option_term->name) 1357 : str_replace(',', '\\,', $attribute); 1358 1359 $taxonomy = get_taxonomy($attribute_name); 1360 $attributeLabel = !empty($taxonomy) ? $taxonomy->labels->singular_name : $attribute_name; 1361 } else { 1362 $attributeLabel = $attribute_name; 1363 } 1364 1365 if ($showLabel && !empty($attribute)) { 1366 $attribute = $attributeLabel . ': ' . $attribute; 1231 1367 } 1232 1368 }); … … 1243 1379 1244 1380 foreach ($parentNotVariableAttributes as $parentNotVariableAttribute) { 1245 $attributesOptions = array_merge( 1246 $attributesOptions, 1247 $parentNotVariableAttribute->is_taxonomy() 1248 ? wp_list_pluck($parentNotVariableAttribute->get_terms(), 'name') 1249 : $parentNotVariableAttribute->get_options() 1250 ); 1381 if ($parentNotVariableAttribute->is_taxonomy()) { 1382 $attributesOptions[] = array( 1383 'label' => $parentNotVariableAttribute->get_taxonomy_object()->attribute_label, 1384 'options' => wp_list_pluck($parentNotVariableAttribute->get_terms(), 'name'), 1385 ); 1386 } else { 1387 $attributesOptions[] = array( 1388 'label' => $parentNotVariableAttribute->get_name(), 1389 'options' => $parentNotVariableAttribute->get_options(), 1390 ); 1391 } 1251 1392 } 1252 1393 … … 1884 2025 protected function sortByIds($targetArray, $orderArray) 1885 2026 { 2027 $targetArray = array_values($targetArray); 1886 2028 $foundProductsIds = array(); 1887 foreach ($targetArray as $ product) {2029 foreach ($targetArray as $key => $product) { 1888 2030 if ('product_variation' === $product->post_type) { 1889 $foundProductsIds[ ] = $product->post_parent;2031 $foundProductsIds[$key] = $product->post_parent; 1890 2032 } else { 1891 $foundProductsIds[] = $product->ID; 1892 } 1893 } 2033 $foundProductsIds[$key] = $product->ID; 2034 } 2035 } 2036 1894 2037 1895 2038 if ($orderArray) { 1896 $orderArray = array_values(array_intersect($orderArray, $foundProductsIds));1897 2039 uksort($targetArray, function ($key1, $key2) use ($orderArray, $foundProductsIds) { 1898 2040 $product1Id = $foundProductsIds[$key1]; 1899 2041 $product2Id = $foundProductsIds[$key2]; 1900 2042 1901 if (array_search($product1Id, $orderArray) >array_search($product2Id, $orderArray)) {1902 return 1;2043 if (array_search($product1Id, $orderArray) === array_search($product2Id, $orderArray)) { 2044 return 0; 1903 2045 } else { 1904 return 0; 1905 } 2046 return array_search($product1Id, $orderArray) > array_search($product2Id, $orderArray) ? 1 : -1; 2047 } 2048 1906 2049 }); 1907 2050 } 2051 2052 return $targetArray; 2053 } 2054 2055 protected function sortByTitle($targetArray) 2056 { 2057 usort($targetArray, function($item1, $item2) { 2058 if (property_exists($item1, 'post_title') && property_exists($item2, 'post_title')) { 2059 return strcmp($item1->post_title, $item2->post_title); 2060 } else { 2061 return 0; 2062 } 2063 }); 1908 2064 1909 2065 return $targetArray; … … 2208 2364 if ('shop_order' === $post->post_type || 'shop_order_placehold' === $post->post_type) { 2209 2365 $order = $this->getOrder($post); 2210 return !empty($order) ? wp_date($format, strtotime($order->get_date_completed())) : ''; 2366 return !empty($order) && !empty($order->get_date_completed()) 2367 ? wp_date($format, strtotime($order->get_date_completed())) 2368 : ''; 2211 2369 2212 2370 … … 2218 2376 ) { 2219 2377 $order = wc_get_order($post->orderId); 2220 return !empty($order) ? wp_date($format, strtotime($order->get_date_completed())) : ''; 2378 return !empty($order) && !empty($order->get_date_completed()) 2379 ? wp_date($format, strtotime($order->get_date_completed())) 2380 : ''; 2221 2381 2222 2382 } else { … … 2681 2841 : ''; 2682 2842 } 2843 2844 protected function getDokanVendorName($post, $field) 2845 { 2846 if (!property_exists($post, 'post_author')) { 2847 return ''; 2848 } 2849 2850 $dokanVendorName = get_user_meta($post->post_author, 'dokan_store_name', true); 2851 2852 return !empty($dokanVendorName) ? $dokanVendorName : ''; 2853 } 2683 2854 } -
a4-barcode-generator/trunk/class/Models/PostsUtils.php
r3204983 r3363232 71 71 $value = (int)$value; 72 72 return uswbg_a4bGetPosts(array( 73 'post_type' => array('product', 'product_variation'), 73 74 'post__in' => empty($value) ? array(0) : array($value), 74 75 'fields' => 'ids', -
a4-barcode-generator/trunk/class/Profiles.php
r3083367 r3363232 17 17 foreach (array( 18 18 'name', 'templateId', 'paperId', 'sheetId', 'update', 19 'barcodeRotate', 'fontSize', 'fontAlgorithm', 'fontLineBreak', 'barcodePosition', 'imageTextGap', 19 'barcodeRotate', 'fontSize', 'fontAlgorithm', 'fontLineBreak', 'barcodePosition', 'imageTextGap', 'sortAlphabetically', 20 20 'barcodeHeightAuto', 'barcodeHeight', 'barcodeWidth', 'basePadding', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft', 'showBarcode' 21 21 ) as $key) { … … 36 36 'params' => 'array', 37 37 'barcodeRotate' => 'required|numeric', 38 'sortAlphabetically' => 'required|numeric', 38 39 'fontSize' => 'string', 39 40 'fontAlgorithm' => 'required|string', … … 82 83 'params' => $profileParams, 83 84 'barcodeRotate' => $data['barcodeRotate'], 85 'sortAlphabetically' => $data['sortAlphabetically'], 84 86 'fontSize' => $data['fontSize'], 85 87 'fontAlgorithm' => $data['fontAlgorithm'], … … 178 180 'params' => $profileParams, 179 181 'barcodeRotate' => $data['barcodeRotate'], 182 'sortAlphabetically' => $data['sortAlphabetically'], 180 183 'fontSize' => $data['fontSize'], 181 184 'fontAlgorithm' => $data['fontAlgorithm'], -
a4-barcode-generator/trunk/class/Settings.php
r3204983 r3363232 258 258 if (isset($data['lken'])) { 259 259 $prefix = 'ukrsolution_upgrade_print_barcodes_'; 260 @delete_transient($prefix . '3.4.1 1');260 @delete_transient($prefix . '3.4.12'); 261 261 } 262 262 -
a4-barcode-generator/trunk/class/Shortcodes.php
r3204983 r3363232 38 38 39 39 if (isset($attributes['class']) && is_product()) { 40 wp_enqueue_style('product-barcode', Variables::$A4B_PLUGIN_BASE_URL . 'assets/css/style-3.4.1 1-f114ea43.css', array());41 wp_enqueue_script('product-barcode-js', Variables::$A4B_PLUGIN_BASE_URL . 'assets/js/barcodes-core-3.4.1 1-f114ea43.js', array('jquery'), null, true);40 wp_enqueue_style('product-barcode', Variables::$A4B_PLUGIN_BASE_URL . 'assets/css/style-3.4.12-4807abb8.css', array()); 41 wp_enqueue_script('product-barcode-js', Variables::$A4B_PLUGIN_BASE_URL . 'assets/js/barcodes-core-3.4.12-4807abb8.js', array('jquery'), null, true); 42 42 43 43 wp_localize_script('product-barcode-js', 'digitalBarcodeJS', array( -
a4-barcode-generator/trunk/class/WooCommerce.php
r3083367 r3363232 56 56 57 57 $post = array(); 58 foreach (array('format', 'withVariations', 'isImportSingleVariation', 'isUseApi', 'lineSeparator1', 'lineSeparator2', 'lineSeparator3', 'lineSeparator4', 'page', 'profileId' ) as $key) {58 foreach (array('format', 'withVariations', 'isImportSingleVariation', 'isUseApi', 'lineSeparator1', 'lineSeparator2', 'lineSeparator3', 'lineSeparator4', 'page', 'profileId', 'sortAlphabetically') as $key) { 59 59 if (isset($_POST[$key])) { 60 60 $post[$key] = sanitize_text_field($_POST[$key]); … … 74 74 'fieldSepLine4', 75 75 'options', 76 'existingIds', 76 77 ) as $key) { 77 78 if (isset($_POST[$key])) { … … 85 86 86 87 $validationRules = array( 87 'productsCategories' => ' requiredItem:if_empty,productsIds|array|bail',88 'productsIds' => ' requiredItem:if_empty,productsCategories|array|bail',88 'productsCategories' => 'array', 89 'productsIds' => 'array', 89 90 'lineBarcode' => $activeTemplate->code_match || (!empty($activeTemplate->matchingType) && !empty($activeTemplate->matching->lineBarcode)) ? 'array' : 'required|array', 90 91 'fieldLine1' => 'array', … … 107 108 'profileId' => 'numeric', 108 109 'options' => 'array', 110 'sortAlphabetically' => 'numeric', 111 'existingIds' => 'array', 109 112 ); 110 113 … … 138 141 139 142 $post = array(); 140 foreach (array('format', 'withVariations', 'isImportSingleVariation', 'isUseApi', 'lineSeparator1', 'lineSeparator2', 'lineSeparator3', 'lineSeparator4', 'page', 'profileId' ) as $key) {143 foreach (array('format', 'withVariations', 'isImportSingleVariation', 'isUseApi', 'lineSeparator1', 'lineSeparator2', 'lineSeparator3', 'lineSeparator4', 'page', 'profileId', 'sortAlphabetically') as $key) { 141 144 if (isset($_POST[$key])) { 142 145 $post[$key] = sanitize_text_field($_POST[$key]); … … 155 158 'fieldSepLine3', 156 159 'fieldSepLine4', 160 'existingIds', 157 161 ) as $key) { 158 162 if (isset($_POST[$key])) { … … 166 170 167 171 $validationRules = array( 168 'productsCategories' => ' requiredItem:if_empty,productsIds|array|bail',169 'productsIds' => ' requiredItem:if_empty,productsCategories|array|bail',172 'productsCategories' => 'array', 173 'productsIds' => 'array', 170 174 'lineBarcode' => $activeTemplate->code_match ? 'array' : 'required|array', 171 175 'fieldLine1' => 'array', … … 187 191 'page' => 'string', 188 192 'profileId' => 'numeric', 193 'sortAlphabetically' => 'numeric', 194 'existingIds' => 'array', 189 195 ); 190 196 … … 378 384 global $current_user; 379 385 $post = array(); 380 foreach (array('format', 'orderQuantity', 'useStockQuantity', 'isUseApi', 'lineSeparator1', 'lineSeparator2', 'lineSeparator3', 'lineSeparator4', 'profileId', 'page' ) as $key) {386 foreach (array('format', 'orderQuantity', 'useStockQuantity', 'isUseApi', 'lineSeparator1', 'lineSeparator2', 'lineSeparator3', 'lineSeparator4', 'profileId', 'page', 'sortAlphabetically') as $key) { 381 387 if (isset($_POST[$key])) { 382 388 $post[$key] = sanitize_text_field($_POST[$key]); … … 395 401 'fieldSepLine3', 396 402 'fieldSepLine4', 403 'existingIds', 397 404 ) as $key) { 398 405 if (isset($_POST[$key])) { … … 409 416 410 417 $validationRules = array( 411 'ordersCategories' => ' requiredItem:if_empty,ordersIds|array|bail',412 'ordersIds' => ' requiredItem:if_empty,ordersCategories|array|bail',418 'ordersCategories' => 'array', 419 'ordersIds' => 'array', 413 420 'lineBarcode' => $activeTemplate->code_match ? 'array' : 'required|array', 414 421 'fieldLine1' => 'array', … … 430 437 'page' => 'string', 431 438 'profileId' => 'numeric', 439 'sortAlphabetically' => 'numeric', 440 'existingIds' => 'array', 432 441 ); 433 442 … … 500 509 501 510 public function getBarcodesByOrderProducts() 511 { 512 Request::ajaxRequestAccess(); 513 514 if (!current_user_can('read')) { 515 wp_die(); 516 } 517 518 global $current_user; 519 520 $post = array(); 521 foreach (array('format', 'orderQuantity', 'useStockQuantity', 'isUseApi', 'lineSeparator1', 'lineSeparator2', 'lineSeparator3', 'lineSeparator4', 'profileId', 'page', 'sortAlphabetically') as $key) { 522 if (isset($_POST[$key])) { 523 $post[$key] = sanitize_text_field($_POST[$key]); 524 } 525 } 526 foreach (array( 527 'ordersCategories', 528 'ordersIds', 529 'lineBarcode', 530 'fieldLine1', 531 'fieldLine2', 532 'fieldLine3', 533 'fieldLine4', 534 'fieldSepLine1', 535 'fieldSepLine2', 536 'fieldSepLine3', 537 'fieldSepLine4', 538 'itemsIds', 539 'existingIds', 540 ) as $key) { 541 if (isset($_POST[$key])) { 542 $post[$key] = USWBG_a4bRecursiveSanitizeTextField($_POST[$key]); 543 } 544 } 545 546 $customTemplatesController = new BarcodeTemplatesController(); 547 $activeTemplate = $customTemplatesController->getActiveTemplate(); 548 549 $validationRules = array( 550 'ordersCategories' => 'array', 551 'ordersIds' => 'array', 552 'lineBarcode' => $activeTemplate->code_match ? 'array' : 'required|array', 553 'fieldLine1' => 'array', 554 'fieldLine2' => 'array', 555 'fieldLine3' => 'array', 556 'fieldLine4' => 'array', 557 'fieldSepLine1' => 'array', 558 'fieldSepLine2' => 'array', 559 'fieldSepLine3' => 'array', 560 'fieldSepLine4' => 'array', 561 'itemsIds' => 'array', 562 'format' => 'required', 563 'orderQuantity' => 'required', 564 'useStockQuantity' => 'required', 565 'lineSeparator1' => 'string', 566 'lineSeparator2' => 'string', 567 'lineSeparator3' => 'string', 568 'lineSeparator4' => 'string', 569 'page' => 'string', 570 'profileId' => 'numeric', 571 'sortAlphabetically' => 'numeric', 572 'existingIds' => 'array', 573 ); 574 575 $data = Validator::create($post, $validationRules, true)->validate(); 576 577 $postsBarcodesGenerator = new WoocommercePostsA4BarcodesMaker($data, 'order-products'); 578 $result = $postsBarcodesGenerator->make(); 579 580 581 if ($current_user && isset($data['page']) && $data['page'] === "template-editor") { 582 if (isset($data['ordersIds']) && count($data['ordersIds'])) { 583 \update_user_meta($current_user->ID, "usplp_product_preview", $data['ordersIds'][0]); 584 } 585 } 586 587 uswbg_a4bJsonResponse($result); 588 } 589 590 public function getBarcodesByAtumPoOrderProducts() 502 591 { 503 592 Request::ajaxRequestAccess(); … … 563 652 $data = Validator::create($post, $validationRules, true)->validate(); 564 653 565 $postsBarcodesGenerator = new WoocommercePostsA4BarcodesMaker($data, ' order-products');654 $postsBarcodesGenerator = new WoocommercePostsA4BarcodesMaker($data, 'atum-po-order-products'); 566 655 $result = $postsBarcodesGenerator->make(); 567 656 … … 575 664 uswbg_a4bJsonResponse($result); 576 665 } 577 578 public function getBarcodesByAtumPoOrderProducts()579 {580 Request::ajaxRequestAccess();581 582 if (!current_user_can('read')) {583 wp_die();584 }585 586 global $current_user;587 588 $post = array();589 foreach (array('format', 'orderQuantity', 'useStockQuantity', 'isUseApi', 'lineSeparator1', 'lineSeparator2', 'lineSeparator3', 'lineSeparator4', 'profileId', 'page') as $key) {590 if (isset($_POST[$key])) {591 $post[$key] = sanitize_text_field($_POST[$key]);592 }593 }594 foreach (array(595 'ordersCategories',596 'ordersIds',597 'lineBarcode',598 'fieldLine1',599 'fieldLine2',600 'fieldLine3',601 'fieldLine4',602 'fieldSepLine1',603 'fieldSepLine2',604 'fieldSepLine3',605 'fieldSepLine4',606 'itemsIds',607 ) as $key) {608 if (isset($_POST[$key])) {609 $post[$key] = USWBG_a4bRecursiveSanitizeTextField($_POST[$key]);610 }611 }612 613 $customTemplatesController = new BarcodeTemplatesController();614 $activeTemplate = $customTemplatesController->getActiveTemplate();615 616 $validationRules = array(617 'ordersCategories' => 'requiredItem:if_empty,ordersIds|array|bail',618 'ordersIds' => 'requiredItem:if_empty,ordersCategories|array|bail',619 'lineBarcode' => $activeTemplate->code_match ? 'array' : 'required|array',620 'fieldLine1' => 'array',621 'fieldLine2' => 'array',622 'fieldLine3' => 'array',623 'fieldLine4' => 'array',624 'fieldSepLine1' => 'array',625 'fieldSepLine2' => 'array',626 'fieldSepLine3' => 'array',627 'fieldSepLine4' => 'array',628 'itemsIds' => 'array',629 'format' => 'required',630 'orderQuantity' => 'required',631 'useStockQuantity' => 'required',632 'lineSeparator1' => 'string',633 'lineSeparator2' => 'string',634 'lineSeparator3' => 'string',635 'lineSeparator4' => 'string',636 'page' => 'string',637 'profileId' => 'numeric',638 );639 640 $data = Validator::create($post, $validationRules, true)->validate();641 642 $postsBarcodesGenerator = new WoocommercePostsA4BarcodesMaker($data, 'atum-po-order-products');643 $result = $postsBarcodesGenerator->make();644 645 646 if ($current_user && isset($data['page']) && $data['page'] === "template-editor") {647 if (isset($data['ordersIds']) && count($data['ordersIds'])) {648 \update_user_meta($current_user->ID, "usplp_product_preview", $data['ordersIds'][0]);649 }650 }651 652 uswbg_a4bJsonResponse($result);653 }654 666 } -
a4-barcode-generator/trunk/class/functions.php
r2985149 r3363232 25 25 array( 26 26 'taxonomy' => 'product_cat', 27 'terms' => $categoriesIds,27 'terms' => !empty($categoriesIds) ? $categoriesIds : array(0), 28 28 'field' => 'term_id', 29 29 'operator' => 'IN', … … 51 51 52 52 $args = array_merge($defaultArgs, $args); 53 54 if (is_plugin_active('polylang/polylang.php')) { 55 unset($args['lang']); 56 } 57 53 58 $query = new \WP_Query($args); 54 59 -
a4-barcode-generator/trunk/config/jsL10n.php
r3204983 r3363232 70 70 'include_variations_field_label' => __('Include variations', 'wpbcu-barcode-generator'), 71 71 'use_stock_quantity_field_label' => __('Use stock quantity', 'wpbcu-barcode-generator'), 72 'sort_alphabetically_field_label' => __('Sort alphabetically', 'wpbcu-barcode-generator'), 72 73 73 74 'select_template' => __('Select template:', 'wpbcu-barcode-generator'), … … 404 405 __('Attributes example:', 'wpbcu-barcode-generator') => '[attr=Color], [attr=Size]', 405 406 __('Get attribute of parent:', 'wpbcu-barcode-generator') => '[attr=parent.Color]', 406 __("All Product's Attributes:", 'wpbcu-barcode-generator') => '[product-all-attr separator=", " ]',407 __('All Parent Attributes:', 'wpbcu-barcode-generator') => '[product-all-parent-attributes separator=", " ]',407 __("All Product's Attributes:", 'wpbcu-barcode-generator') => '[product-all-attr separator=", " show-attr-name="true"]', 408 __('All Parent Attributes:', 'wpbcu-barcode-generator') => '[product-all-parent-attributes separator=", " show-attr-name="true"]', 408 409 __('<i>"Color" and "Size" are actual names of attributes, please replace them to your attribute names.</i>', 'wpbcu-barcode-generator') => '', 409 410 ), … … 411 412 __('Parent product ID:', 'wpbcu-barcode-generator') => '[field=parent.ID]', 412 413 __('Parent product SKU:', 'wpbcu-barcode-generator') => '[cf=parent._sku]', 413 __("All Variation�s Attributes:", 'wpbcu-barcode-generator') => '[variation-all-attr separator=", " ]',414 __("All Variation�s Attributes:", 'wpbcu-barcode-generator') => '[variation-all-attr separator=", " show-attr-name="true"]', 414 415 ), 415 416 __('Date & time:', 'wpbcu-barcode-generator') => array( … … 615 616 __('Order item quantity:', 'wpbcu-barcode-generator') => '[order-product-qty]', 616 617 __("Get product's meta data:", 'wpbcu-barcode-generator') => '[atum-order-item-meta-field=Size]', 618 __("Atum product location:", 'wpbcu-barcode-generator') => '[atum-product-location]', 617 619 ), 618 620 ), … … 852 854 'field_72' => __("Cart tax", 'wpbcu-barcode-generator'), 853 855 'field_73' => __("All Product's Attributes", 'wpbcu-barcode-generator'), 856 'field_85' => __("All Product's Attributes (with names)", 'wpbcu-barcode-generator'), 854 857 'field_74' => __("Order item quantity", 'wpbcu-barcode-generator'), 855 858 'field_75' => __("Sale Price + Tax", 'wpbcu-barcode-generator'), … … 862 865 'field_82' => __("Order coupon", 'wpbcu-barcode-generator'), 863 866 'field_83' => __("All Parent Attributes", 'wpbcu-barcode-generator'), 867 'field_84' => __("Dokan vendor name", 'wpbcu-barcode-generator'), 864 868 865 869 'shipping_info' => __("Shipping info", 'wpbcu-barcode-generator'), -
a4-barcode-generator/trunk/lib/meyfa/php-svg/src/Rasterization/Renderers/RectRenderer.php
r2870656 r3363232 56 56 } 57 57 58 58 59 imagefilledrectangle( 59 60 $image, 60 $params['x1'],$params['y1'],61 $params['x2'],$params['y2'],61 (int)$params['x1'], (int)$params['y1'], 62 (int)$params['x2'], (int)$params['y2'], 62 63 $color 63 64 ); -
a4-barcode-generator/trunk/lib/meyfa/php-svg/src/Rasterization/Renderers/Renderer.php
r2870656 r3363232 49 49 { 50 50 $paintOrder = $context->getComputedStyle('paint-order'); 51 $paintOrder = preg_replace('#\s{2,}#', ' ', trim( $paintOrder));51 $paintOrder = preg_replace('#\s{2,}#', ' ', trim(is_string($paintOrder) ? $paintOrder : '')); 52 52 53 53 $defaultOrder = array('fill', 'stroke', 'markers'); -
a4-barcode-generator/trunk/lib/meyfa/php-svg/src/Rasterization/Renderers/TextRenderer.php
r2870656 r3363232 21 21 $font_path = dirname(__FILE__) . "/../../../../../../assets/fonts/arial.ttf"; 22 22 23 23 24 imagettftext( 24 25 $image, 25 26 $params['size'] * 0.8, 26 27 0, 27 $params['x'],28 $params['y'],28 (int) $params['x'], 29 (int) $params['y'], 29 30 $color, 30 31 $font_path, -
a4-barcode-generator/trunk/lib/meyfa/php-svg/src/Rasterization/SVGRasterizer.php
r3083367 r3363232 48 48 private static function createImage($width, $height, $background) 49 49 { 50 $img = imagecreatetruecolor( $width,$height);50 $img = imagecreatetruecolor((int)$width, (int)$height); 51 51 52 52 imagealphablending($img, true); -
a4-barcode-generator/trunk/public/dist/index.html
r3204983 r3363232 1 <!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><title>Vue App</title><link href=/wp-content/plugins/barcodes/public/dist/css/app_demo_3.4.1 1-f114ea43.css rel=preload as=style><link href=/wp-content/plugins/barcodes/public/dist/js/app_demo_3.4.11-f114ea43.js rel=preload as=script><link href=/wp-content/plugins/barcodes/public/dist/js/chunk-vendors_demo_3.4.11-f114ea43.js rel=preload as=script><link href=/wp-content/plugins/barcodes/public/dist/css/app_demo_3.4.11-f114ea43.css rel=stylesheet></head><body><div id=app></div><script src=/wp-content/plugins/barcodes/public/dist/js/chunk-vendors_demo_3.4.11-f114ea43.js></script><script src=/wp-content/plugins/barcodes/public/dist/js/app_demo_3.4.11-f114ea43.js></script></body></html>1 <!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><title>Vue App</title><link href=/wp-content/plugins/barcodes/public/dist/css/app_demo_3.4.12-4807abb8.css rel=preload as=style><link href=/wp-content/plugins/barcodes/public/dist/js/app_demo_3.4.12-4807abb8.js rel=preload as=script><link href=/wp-content/plugins/barcodes/public/dist/js/chunk-vendors_demo_3.4.12-4807abb8.js rel=preload as=script><link href=/wp-content/plugins/barcodes/public/dist/css/app_demo_3.4.12-4807abb8.css rel=stylesheet></head><body><div id=app></div><script src=/wp-content/plugins/barcodes/public/dist/js/chunk-vendors_demo_3.4.12-4807abb8.js></script><script src=/wp-content/plugins/barcodes/public/dist/js/app_demo_3.4.12-4807abb8.js></script></body></html> -
a4-barcode-generator/trunk/templates/printpage.php
r3204983 r3363232 10 10 <title>Print page</title> 11 11 <?php $allowedTags = array('link' => array('rel' => 1, 'type' => 1, 'href' => 1)); ?> 12 <?php echo wp_kses(implode(USWBG_print_lStylePath('public/dist/css/app_demo_3.4.1 1-f114ea43.css')), $allowedTags); ?>12 <?php echo wp_kses(implode(USWBG_print_lStylePath('public/dist/css/app_demo_3.4.12-4807abb8.css')), $allowedTags); ?> 13 13 14 14 <style> … … 78 78 </script> 79 79 <script src='<?php echo esc_attr(A4B_SITE_BASE_URL . '/wp-includes/js/jquery/jquery.js'); ?>'></script> 80 <script src='<?php echo esc_attr(Variables::$A4B_PLUGIN_BASE_URL . 'assets/js/jszip.min-3.4.1 1-f114ea43.js'); ?>'></script>81 <script src='<?php echo esc_attr(Variables::$A4B_PLUGIN_BASE_URL . 'assets/js/api-3.4.1 1-f114ea43.js'); ?>'></script>82 <script src='<?php echo esc_attr(Variables::$A4B_PLUGIN_BASE_URL . 'public/dist/js/app_demo_3.4.1 1-f114ea43.js'); ?>'></script>83 <script src='<?php echo esc_attr(Variables::$A4B_PLUGIN_BASE_URL . 'public/dist/js/chunk-vendors_demo_3.4.1 1-f114ea43.js'); ?>'></script>80 <script src='<?php echo esc_attr(Variables::$A4B_PLUGIN_BASE_URL . 'assets/js/jszip.min-3.4.12-4807abb8.js'); ?>'></script> 81 <script src='<?php echo esc_attr(Variables::$A4B_PLUGIN_BASE_URL . 'assets/js/api-3.4.12-4807abb8.js'); ?>'></script> 82 <script src='<?php echo esc_attr(Variables::$A4B_PLUGIN_BASE_URL . 'public/dist/js/app_demo_3.4.12-4807abb8.js'); ?>'></script> 83 <script src='<?php echo esc_attr(Variables::$A4B_PLUGIN_BASE_URL . 'public/dist/js/chunk-vendors_demo_3.4.12-4807abb8.js'); ?>'></script> 84 84 </body> 85 85
Note: See TracChangeset
for help on using the changeset viewer.