Plugin Directory

Changeset 2010054


Ignore:
Timestamp:
01/10/2019 03:25:37 PM (7 years ago)
Author:
avecdo
Message:

tagging version 1.4.3

Location:
avecdo-for-woocommerce
Files:
4 edited
3 copied

Legend:

Unmodified
Added
Removed
  • avecdo-for-woocommerce/tags/1.4.3/avecdo.php

    r1985262 r2010054  
    44 * Plugin URI: http://avecdo.com/
    55 * Description: avecdo connector plugin for WooCommerce
    6  * Version: 1.4.2
     6 * Version: 1.4.3
    77 * Author: Modified Solutions ApS
    88 * Author URI: https://www.modified.dk/
     
    1010 * Developer URI: https://www.modified.dk/
    1111 * Requires at least: 3.5
    12  * Tested up to: 4.9.8
     12 * Tested up to: 5.0.2
    1313 * WC requires at least: 2.0.20
    14  * WC tested up to: 3.4.3
     14 * WC tested up to: 3.5.3
    1515 *
    1616 * Text Domain: avecdo-for-woocommerce
     
    3131 * @var string Version string
    3232 */
    33 define('AVECDO_WOOCOMMERCE_PLUGIN_VERSION', '1.4.2');
     33define('AVECDO_WOOCOMMERCE_PLUGIN_VERSION', '1.4.3');
    3434
    3535/**
  • avecdo-for-woocommerce/tags/1.4.3/models/Model.php

    r1985249 r2010054  
    473473                    ->setProductId($productId)
    474474                    ->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))))
    477477                    ->setWeightUnit($this->getWeightUnit())
    478478                    ->setDimensionUnit($this->getDimensionUnit())
    479479                    ->setCurrency($avecdoCurrency)
    480                     ->setStockStatus(StockStatus::IN_STOCK)
     480                    ->setStockStatus($this->get_stock($productId))
    481481                    ->setUrl(get_permalink($productId))
    482482                    ->setShippingCost(null);
     
    488488        }
    489489        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;
    490562    }
    491563
     
    692764        }
    693765        // 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        }
    706778
    707779        // 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  
    33Tags: feed, service, avecdo, Facebook, Google Shopping, shopping, woocommerce, kelkoo, miinto, Pricerunner, Partner-ads, ecommerce, e-commerce
    44Requires at least: 3.5
    5 Tested up to: 4.9.8
    6 Stable tag: 1.4.2
     5Tested up to: 5.0.2
     6Stable tag: 1.4.3
    77License: Mozilla Public License Version 2.0
    88License URI: https://www.mozilla.org/en-US/MPL/2.0/
     
    4545
    4646== Changelog ==
     47
     48= 1.4.3 =
     49* Added automatically removal of various pagebuilder tags - from title and description of products.
    4750
    4851= 1.4.2 =
  • avecdo-for-woocommerce/trunk/avecdo.php

    r1985262 r2010054  
    44 * Plugin URI: http://avecdo.com/
    55 * Description: avecdo connector plugin for WooCommerce
    6  * Version: 1.4.2
     6 * Version: 1.4.3
    77 * Author: Modified Solutions ApS
    88 * Author URI: https://www.modified.dk/
     
    1010 * Developer URI: https://www.modified.dk/
    1111 * Requires at least: 3.5
    12  * Tested up to: 4.9.8
     12 * Tested up to: 5.0.2
    1313 * WC requires at least: 2.0.20
    14  * WC tested up to: 3.4.3
     14 * WC tested up to: 3.5.3
    1515 *
    1616 * Text Domain: avecdo-for-woocommerce
     
    3131 * @var string Version string
    3232 */
    33 define('AVECDO_WOOCOMMERCE_PLUGIN_VERSION', '1.4.2');
     33define('AVECDO_WOOCOMMERCE_PLUGIN_VERSION', '1.4.3');
    3434
    3535/**
  • avecdo-for-woocommerce/trunk/models/Model.php

    r1985249 r2010054  
    473473                    ->setProductId($productId)
    474474                    ->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))))
    477477                    ->setWeightUnit($this->getWeightUnit())
    478478                    ->setDimensionUnit($this->getDimensionUnit())
    479479                    ->setCurrency($avecdoCurrency)
    480                     ->setStockStatus(StockStatus::IN_STOCK)
     480                    ->setStockStatus($this->get_stock($productId))
    481481                    ->setUrl(get_permalink($productId))
    482482                    ->setShippingCost(null);
     
    488488        }
    489489        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("&#xa0;", "", $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;
    490562    }
    491563
     
    692764        }
    693765        // 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        }
    706778
    707779        // get images from parent product if none is assigned to this variations of the product.
  • avecdo-for-woocommerce/trunk/readme.txt

    r1985262 r2010054  
    33Tags: feed, service, avecdo, Facebook, Google Shopping, shopping, woocommerce, kelkoo, miinto, Pricerunner, Partner-ads, ecommerce, e-commerce
    44Requires at least: 3.5
    5 Tested up to: 4.9.8
    6 Stable tag: 1.4.2
     5Tested up to: 5.0.2
     6Stable tag: 1.4.3
    77License: Mozilla Public License Version 2.0
    88License URI: https://www.mozilla.org/en-US/MPL/2.0/
     
    4545
    4646== Changelog ==
     47
     48= 1.4.3 =
     49* Added automatically removal of various pagebuilder tags - from title and description of products.
    4750
    4851= 1.4.2 =
Note: See TracChangeset for help on using the changeset viewer.