Changeset 2010054
- Timestamp:
- 01/10/2019 03:25:37 PM (7 years ago)
- Location:
- avecdo-for-woocommerce
- Files:
-
- 4 edited
- 3 copied
-
tags/1.4.3 (copied) (copied from avecdo-for-woocommerce/trunk)
-
tags/1.4.3/avecdo.php (copied) (copied from avecdo-for-woocommerce/trunk/avecdo.php) (3 diffs)
-
tags/1.4.3/models/Model.php (modified) (3 diffs)
-
tags/1.4.3/readme.txt (copied) (copied from avecdo-for-woocommerce/trunk/readme.txt) (2 diffs)
-
trunk/avecdo.php (modified) (3 diffs)
-
trunk/models/Model.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
avecdo-for-woocommerce/tags/1.4.3/avecdo.php
r1985262 r2010054 4 4 * Plugin URI: http://avecdo.com/ 5 5 * Description: avecdo connector plugin for WooCommerce 6 * Version: 1.4. 26 * Version: 1.4.3 7 7 * Author: Modified Solutions ApS 8 8 * Author URI: https://www.modified.dk/ … … 10 10 * Developer URI: https://www.modified.dk/ 11 11 * Requires at least: 3.5 12 * Tested up to: 4.9.812 * Tested up to: 5.0.2 13 13 * WC requires at least: 2.0.20 14 * WC tested up to: 3. 4.314 * WC tested up to: 3.5.3 15 15 * 16 16 * Text Domain: avecdo-for-woocommerce … … 31 31 * @var string Version string 32 32 */ 33 define('AVECDO_WOOCOMMERCE_PLUGIN_VERSION', '1.4. 2');33 define('AVECDO_WOOCOMMERCE_PLUGIN_VERSION', '1.4.3'); 34 34 35 35 /** -
avecdo-for-woocommerce/tags/1.4.3/models/Model.php
r1985249 r2010054 473 473 ->setProductId($productId) 474 474 ->setParentId(null) 475 ->setName($ row->name)476 ->setDescription( strip_tags($this->getDescription($row)))475 ->setName($this->cleanupDescrictionTitle($row->name)) 476 ->setDescription(($this->cleanupDescrictionTitle($this->getDescription($row)))) 477 477 ->setWeightUnit($this->getWeightUnit()) 478 478 ->setDimensionUnit($this->getDimensionUnit()) 479 479 ->setCurrency($avecdoCurrency) 480 ->setStockStatus( StockStatus::IN_STOCK)480 ->setStockStatus($this->get_stock($productId)) 481 481 ->setUrl(get_permalink($productId)) 482 482 ->setShippingCost(null); … … 488 488 } 489 489 return $products; 490 } 491 492 /** 493 * Get product stock 494 * @since 1.4.3 495 */ 496 private function get_stock( $id ){ 497 $status=$this->get_attribute_value($id,"_stock_status"); 498 if ($status) { 499 if ($status == 'instock') { 500 return "in stock"; 501 } elseif ($status == 'outofstock') { 502 return "out of stock"; 503 } 504 } 505 return "out of stock"; 506 } 507 508 /** 509 * Get attribute value 510 * @since 1.4.3 511 */ 512 public function get_attribute_value( $id, $name ){ 513 if (strpos($name, 'attribute_pa') !== false) { 514 $taxonomy = str_replace("attribute_","",$name); 515 $meta = get_post_meta($id,$name, true); 516 $term = get_term_by('slug', $meta, $taxonomy); 517 return $term->name; 518 } else { 519 $blaat = get_post_meta($id, $name, true); 520 return get_post_meta($id, $name, true); 521 } 522 } 523 524 /** 525 * Cleanup description and titles 526 * @param string $string 527 * @return string 528 * @since 1.4.3 529 */ 530 531 private function cleanupDescrictionTitle($string) 532 { 533 // Strip HTML from (short) description 534 $string = $this->rip_tags($string); 535 // Strip out Visual Composer short codes 536 $string = preg_replace( '/\[(.*?)\]/', ' ', $string ); 537 // Strip out the non-line-brake character 538 $string = str_replace(" ", "", $string); 539 return strip_tags($string); 540 541 } 542 543 /** 544 * Clean tags from various fields. 545 * @param string $string 546 * @return string 547 * @since 1.4.3 548 */ 549 public function rip_tags( $string ) { 550 // ----- remove HTML TAGs ----- 551 $string = preg_replace ('/<[^>]*>/', ' ', $string); 552 553 // ----- remove control characters ----- 554 $string = str_replace("\r", '', $string); // --- replace with empty space 555 $string = str_replace("\n", ' ', $string); // --- replace with space 556 $string = str_replace("\t", ' ', $string); // --- replace with space 557 558 // ----- remove multiple spaces ----- 559 $string = trim(preg_replace('/ {2,}/', ' ', $string)); 560 561 return $string; 490 562 } 491 563 … … 692 764 } 693 765 // Set EAN, UPC, JAN, ISBN.. 694 if(!is_null($ean) && !empty($ean)) {695 $avecdoProduct->setEan($ean);696 }697 if(!is_null($upc) && !empty($upc)) {698 $avecdoProduct->setUpc($upc);699 }700 if(!is_null($isbn) && !empty($isbn)) {701 $avecdoProduct->setIsbn($isbn);702 }703 if(!is_null($jan) && !empty($jan)) {704 $avecdoProduct->setJan($jan);705 }766 if(!is_null($ean) && !empty($ean)) { 767 $avecdoProduct->setEan($ean); 768 } 769 if(!is_null($upc) && !empty($upc)) { 770 $avecdoProduct->setUpc($upc); 771 } 772 if(!is_null($isbn) && !empty($isbn)) { 773 $avecdoProduct->setIsbn($isbn); 774 } 775 if(!is_null($jan) && !empty($jan)) { 776 $avecdoProduct->setJan($jan); 777 } 706 778 707 779 // get images from parent product if none is assigned to this variations of the product. -
avecdo-for-woocommerce/tags/1.4.3/readme.txt
r1985262 r2010054 3 3 Tags: feed, service, avecdo, Facebook, Google Shopping, shopping, woocommerce, kelkoo, miinto, Pricerunner, Partner-ads, ecommerce, e-commerce 4 4 Requires at least: 3.5 5 Tested up to: 4.9.86 Stable tag: 1.4. 25 Tested up to: 5.0.2 6 Stable tag: 1.4.3 7 7 License: Mozilla Public License Version 2.0 8 8 License URI: https://www.mozilla.org/en-US/MPL/2.0/ … … 45 45 46 46 == Changelog == 47 48 = 1.4.3 = 49 * Added automatically removal of various pagebuilder tags - from title and description of products. 47 50 48 51 = 1.4.2 = -
avecdo-for-woocommerce/trunk/avecdo.php
r1985262 r2010054 4 4 * Plugin URI: http://avecdo.com/ 5 5 * Description: avecdo connector plugin for WooCommerce 6 * Version: 1.4. 26 * Version: 1.4.3 7 7 * Author: Modified Solutions ApS 8 8 * Author URI: https://www.modified.dk/ … … 10 10 * Developer URI: https://www.modified.dk/ 11 11 * Requires at least: 3.5 12 * Tested up to: 4.9.812 * Tested up to: 5.0.2 13 13 * WC requires at least: 2.0.20 14 * WC tested up to: 3. 4.314 * WC tested up to: 3.5.3 15 15 * 16 16 * Text Domain: avecdo-for-woocommerce … … 31 31 * @var string Version string 32 32 */ 33 define('AVECDO_WOOCOMMERCE_PLUGIN_VERSION', '1.4. 2');33 define('AVECDO_WOOCOMMERCE_PLUGIN_VERSION', '1.4.3'); 34 34 35 35 /** -
avecdo-for-woocommerce/trunk/models/Model.php
r1985249 r2010054 473 473 ->setProductId($productId) 474 474 ->setParentId(null) 475 ->setName($ row->name)476 ->setDescription( strip_tags($this->getDescription($row)))475 ->setName($this->cleanupDescrictionTitle($row->name)) 476 ->setDescription(($this->cleanupDescrictionTitle($this->getDescription($row)))) 477 477 ->setWeightUnit($this->getWeightUnit()) 478 478 ->setDimensionUnit($this->getDimensionUnit()) 479 479 ->setCurrency($avecdoCurrency) 480 ->setStockStatus( StockStatus::IN_STOCK)480 ->setStockStatus($this->get_stock($productId)) 481 481 ->setUrl(get_permalink($productId)) 482 482 ->setShippingCost(null); … … 488 488 } 489 489 return $products; 490 } 491 492 /** 493 * Get product stock 494 * @since 1.4.3 495 */ 496 private function get_stock( $id ){ 497 $status=$this->get_attribute_value($id,"_stock_status"); 498 if ($status) { 499 if ($status == 'instock') { 500 return "in stock"; 501 } elseif ($status == 'outofstock') { 502 return "out of stock"; 503 } 504 } 505 return "out of stock"; 506 } 507 508 /** 509 * Get attribute value 510 * @since 1.4.3 511 */ 512 public function get_attribute_value( $id, $name ){ 513 if (strpos($name, 'attribute_pa') !== false) { 514 $taxonomy = str_replace("attribute_","",$name); 515 $meta = get_post_meta($id,$name, true); 516 $term = get_term_by('slug', $meta, $taxonomy); 517 return $term->name; 518 } else { 519 $blaat = get_post_meta($id, $name, true); 520 return get_post_meta($id, $name, true); 521 } 522 } 523 524 /** 525 * Cleanup description and titles 526 * @param string $string 527 * @return string 528 * @since 1.4.3 529 */ 530 531 private function cleanupDescrictionTitle($string) 532 { 533 // Strip HTML from (short) description 534 $string = $this->rip_tags($string); 535 // Strip out Visual Composer short codes 536 $string = preg_replace( '/\[(.*?)\]/', ' ', $string ); 537 // Strip out the non-line-brake character 538 $string = str_replace(" ", "", $string); 539 return strip_tags($string); 540 541 } 542 543 /** 544 * Clean tags from various fields. 545 * @param string $string 546 * @return string 547 * @since 1.4.3 548 */ 549 public function rip_tags( $string ) { 550 // ----- remove HTML TAGs ----- 551 $string = preg_replace ('/<[^>]*>/', ' ', $string); 552 553 // ----- remove control characters ----- 554 $string = str_replace("\r", '', $string); // --- replace with empty space 555 $string = str_replace("\n", ' ', $string); // --- replace with space 556 $string = str_replace("\t", ' ', $string); // --- replace with space 557 558 // ----- remove multiple spaces ----- 559 $string = trim(preg_replace('/ {2,}/', ' ', $string)); 560 561 return $string; 490 562 } 491 563 … … 692 764 } 693 765 // Set EAN, UPC, JAN, ISBN.. 694 if(!is_null($ean) && !empty($ean)) {695 $avecdoProduct->setEan($ean);696 }697 if(!is_null($upc) && !empty($upc)) {698 $avecdoProduct->setUpc($upc);699 }700 if(!is_null($isbn) && !empty($isbn)) {701 $avecdoProduct->setIsbn($isbn);702 }703 if(!is_null($jan) && !empty($jan)) {704 $avecdoProduct->setJan($jan);705 }766 if(!is_null($ean) && !empty($ean)) { 767 $avecdoProduct->setEan($ean); 768 } 769 if(!is_null($upc) && !empty($upc)) { 770 $avecdoProduct->setUpc($upc); 771 } 772 if(!is_null($isbn) && !empty($isbn)) { 773 $avecdoProduct->setIsbn($isbn); 774 } 775 if(!is_null($jan) && !empty($jan)) { 776 $avecdoProduct->setJan($jan); 777 } 706 778 707 779 // get images from parent product if none is assigned to this variations of the product. -
avecdo-for-woocommerce/trunk/readme.txt
r1985262 r2010054 3 3 Tags: feed, service, avecdo, Facebook, Google Shopping, shopping, woocommerce, kelkoo, miinto, Pricerunner, Partner-ads, ecommerce, e-commerce 4 4 Requires at least: 3.5 5 Tested up to: 4.9.86 Stable tag: 1.4. 25 Tested up to: 5.0.2 6 Stable tag: 1.4.3 7 7 License: Mozilla Public License Version 2.0 8 8 License URI: https://www.mozilla.org/en-US/MPL/2.0/ … … 45 45 46 46 == Changelog == 47 48 = 1.4.3 = 49 * Added automatically removal of various pagebuilder tags - from title and description of products. 47 50 48 51 = 1.4.2 =
Note: See TracChangeset
for help on using the changeset viewer.