Plugin Directory

Changeset 2930754


Ignore:
Timestamp:
06/26/2023 08:19:48 AM (3 years ago)
Author:
zebrasoft
Message:

Update for 1.3.0

Location:
immotoolbox-connect
Files:
1078 added
8 edited

Legend:

Unmodified
Added
Removed
  • immotoolbox-connect

    • Property svn:ignore set to
      .idea
  • immotoolbox-connect/trunk/admin/js/block.js

    r2747456 r2930754  
    3939            type: 'string'
    4040        },
     41        price_min: {
     42            type: 'string'
     43        },
    4144        price_max: {
    4245            type: 'string'
    4346        },
     47        price_on_request: {
     48            type: 'string'
     49        },
    4450        area_min: {
    4551            type: 'string'
     
    5561        },
    5662        featured: {
    57             type: 'string'
     63            type: 'boolean'
    5864        },
    5965        ids: {
     
    98104                                    value: props.attributes.country,
    99105                                    label: i18n.__("Country Code", "immotoolbox-connect"),
     106                                    placeholder: "MC / FR / ...",
    100107                                    onChange: function (newValue) { props.setAttributes( { country: newValue } ) },
    101108                                }
     
    136143                                TextControl,
    137144                                {
     145                                    value: props.attributes.price_min,
     146                                    label: i18n.__("Min. price", "immotoolbox-connect"),
     147                                    onChange: function (newValue) { props.setAttributes( { price_min: newValue } ) },
     148                                }
     149                            ),
     150                            el(
     151                                TextControl,
     152                                {
    138153                                    value: props.attributes.price_max,
    139154                                    label: i18n.__("Max. price", "immotoolbox-connect"),
    140155                                    onChange: function (newValue) { props.setAttributes( { price_max: newValue } ) },
     156                                }
     157                            ),
     158                            el(
     159                                SelectControl,
     160                                {
     161                                    value: props.attributes.price_on_request,
     162                                    label: i18n.__("Prices on request when using price filter", "immotoolbox-connect"),
     163                                    onChange: function (newValue) { props.setAttributes( { price_on_request: newValue } ) },
     164                                    options: [
     165                                        {value: 'dont_include', label: i18n.__('Don\'t include', "immotoolbox-connect")}
     166                                        , {value: 'include_match', label: i18n.__('Include if private price match', "immotoolbox-connect")}
     167                                        , {value: 'always_include', label: i18n.__('Always include', "immotoolbox-connect")}
     168                                    ]
    141169                                }
    142170                            ),
     
    264292                                        props.attributes.rooms?el("span", {className: "itbconnect_label"}, i18n.__("Num. rooms", "immotoolbox-connect")+" : "+props.attributes.rooms):null,
    265293                                        props.attributes.price_max?el("span", {className: "itbconnect_label"}, i18n.__("Max. price", "immotoolbox-connect")+" : "+props.attributes.price_max):null,
     294                                        props.attributes.price_min?el("span", {className: "itbconnect_label"}, i18n.__("Min. price", "immotoolbox-connect")+" : "+props.attributes.price_min):null,
     295                                        props.attributes.price_on_request?el("span", {className: "itbconnect_label"}, i18n.__("Price on request", "immotoolbox-connect")+" : "+props.attributes.price_on_request):null,
    266296                                        props.attributes.area_min?el("span", {className: "itbconnect_label"}, i18n.__("Min. area", "immotoolbox-connect")+" : "+props.attributes.area_min):null,
    267297                                        props.attributes.featured?el("span", {className: "itbconnect_label"}, i18n.__("Featured properties", "immotoolbox-connect")):null,
     
    327357    }
    328358    if (props.attributes.rooms) code+=' rooms="'+props.attributes.rooms+'"';
     359    if (props.attributes.price_min) code+=' price_min="'+props.attributes.price_min+'"';
    329360    if (props.attributes.price_max) code+=' price_max="'+props.attributes.price_max+'"';
     361    if (props.attributes.price_on_request) code+=' price_on_request="'+props.attributes.price_on_request+'"';
    330362    if (props.attributes.area_min) code+=' area_min="'+props.attributes.area_min+'"';
    331363    if (props.attributes.featured) code+=' featured="1"';
     
    378410            type: 'string'
    379411        },
     412        price_min: {
     413            type: 'string'
     414        },
    380415        price_max: {
     416            type: 'string'
     417        },
     418        price_on_request: {
    381419            type: 'string'
    382420        },
     
    478516                                TextControl,
    479517                                {
     518                                    value: props.attributes.price_min,
     519                                    label: i18n.__("Min. price", "immotoolbox-connect"),
     520                                    onChange: function (newValue) { props.setAttributes( { price_min: newValue } ) },
     521                                }
     522                            ),
     523                            el(
     524                                TextControl,
     525                                {
    480526                                    value: props.attributes.price_max,
    481527                                    label: i18n.__("Max. price", "immotoolbox-connect"),
    482528                                    onChange: function (newValue) { props.setAttributes( { price_max: newValue } ) },
     529                                }
     530                            ),
     531                            el(
     532                                SelectControl,
     533                                {
     534                                    value: props.attributes.price_on_request,
     535                                    label: i18n.__("Prices on request when using price filter", "immotoolbox-connect"),
     536                                    onChange: function (newValue) { props.setAttributes( { price_on_request: newValue } ) },
     537                                    options: [
     538                                        {value: 'dont_include', label: i18n.__('Don\'t include', "immotoolbox-connect")}
     539                                        , {value: 'include_match', label: i18n.__('Include if private price match', "immotoolbox-connect")}
     540                                        , {value: 'always_include', label: i18n.__('Always include', "immotoolbox-connect")}
     541                                    ]
    483542                                }
    484543                            ),
     
    609668                            {},
    610669                            [
    611                                 (props.attributes.type||props.attributes.country||props.attributes.city||props.attributes.district||props.attributes.building||props.attributes.rooms||props.attributes.price_max||props.attributes.area_min||props.attributes.featured||props.attributes.ids||props.attributes.nids||props.attributes.agency)?el(
     670                                (props.attributes.type||props.attributes.country||props.attributes.city||props.attributes.district||props.attributes.building||props.attributes.rooms||props.attributes.price_max||props.attributes.price_min||props.attributes.price_on_request||props.attributes.area_min||props.attributes.featured||props.attributes.ids||props.attributes.nids||props.attributes.agency)?el(
    612671                                    "li",
    613672                                    {className: "itbconnect_subvalues"},
     
    620679                                        props.attributes.building?el("span", {className: "itbconnect_label"}, i18n.__("Building", "immotoolbox-connect")+" : "+props.attributes.building):null,
    621680                                        props.attributes.rooms?el("span", {className: "itbconnect_label"}, i18n.__("Num. rooms", "immotoolbox-connect")+" : "+props.attributes.rooms):null,
     681                                        props.attributes.price_min?el("span", {className: "itbconnect_label"}, i18n.__("Min. price", "immotoolbox-connect")+" : "+props.attributes.price_min):null,
    622682                                        props.attributes.price_max?el("span", {className: "itbconnect_label"}, i18n.__("Max. price", "immotoolbox-connect")+" : "+props.attributes.price_max):null,
     683                                        props.attributes.price_on_request?el("span", {className: "itbconnect_label"}, i18n.__("Price on request", "immotoolbox-connect")+" : "+props.attributes.price_on_request):null,
    623684                                        props.attributes.area_min?el("span", {className: "itbconnect_label"}, i18n.__("Min. area", "immotoolbox-connect")+" : "+props.attributes.area_min):null,
    624685                                        props.attributes.featured?el("span", {className: "itbconnect_label"}, i18n.__("Featured properties", "immotoolbox-connect")):null,
     
    685746    }
    686747    if (props.attributes.rooms) code+=' rooms="'+props.attributes.rooms+'"';
     748    if (props.attributes.price_min) code+=' price_min="'+props.attributes.price_min+'"';
    687749    if (props.attributes.price_max) code+=' price_max="'+props.attributes.price_max+'"';
     750    if (props.attributes.price_on_request) code+=' price_on_request="'+props.attributes.price_on_request+'"';
    688751    if (props.attributes.area_min) code+=' area_min="'+props.attributes.area_min+'"';
    689     if (props.attributes.featured) code+=' featured="'+props.attributes.featured+'"';
     752    if (props.attributes.featured) code+=' featured="1"';
    690753    if (props.attributes.ids) code+=' ids="'+props.attributes.ids+'"';
    691754    if (props.attributes.nids) code+=' nids="'+props.attributes.nids+'"';
     
    897960                                        TextControl,
    898961                                        {
     962                                            value: props.attributes.price_min,
     963                                            label: i18n.__("Min. price", "immotoolbox-connect"),
     964                                            onChange: function (newValue) { props.setAttributes( { price_min: newValue } ) },
     965                                        }
     966                                    ),
     967                                    el(
     968                                        TextControl,
     969                                        {
    899970                                            value: props.attributes.price_max,
    900971                                            label: i18n.__("Max. price", "immotoolbox-connect"),
    901972                                            onChange: function (newValue) { props.setAttributes( { price_max: newValue } ) },
     973                                        }
     974                                    ),
     975                                    el(
     976                                        SelectControl,
     977                                        {
     978                                            value: props.attributes.price_on_request,
     979                                            label: i18n.__("Prices on request when using price filter", "immotoolbox-connect"),
     980                                            onChange: function (newValue) { props.setAttributes( { price_on_request: newValue } ) },
     981                                            options: [
     982                                                {value: 'dont_include', label: i18n.__('Don\'t include', "immotoolbox-connect")}
     983                                                , {value: 'include_match', label: i18n.__('Include if private price match', "immotoolbox-connect")}
     984                                                , {value: 'always_include', label: i18n.__('Always include', "immotoolbox-connect")}
     985                                            ]
    902986                                        }
    903987                                    ),
     
    10041088                                        props.attributes.building?el("span", {className: "itbconnect_label"}, i18n.__("Building", "immotoolbox-connect")+" : "+props.attributes.building):null,
    10051089                                        props.attributes.rooms?el("span", {className: "itbconnect_label"}, i18n.__("Rooms", "immotoolbox-connect")+" : "+props.attributes.rooms):null,
     1090                                        props.attributes.price_min?el("span", {className: "itbconnect_label"}, i18n.__("Min. price", "immotoolbox-connect")+" : "+props.attributes.price_min):null,
    10061091                                        props.attributes.price_max?el("span", {className: "itbconnect_label"}, i18n.__("Max. price", "immotoolbox-connect")+" : "+props.attributes.price_max):null,
     1092                                        props.attributes.price_on_request?el("span", {className: "itbconnect_label"}, i18n.__("Price on request", "immotoolbox-connect")+" : "+props.attributes.price_on_request):null,
    10071093                                        props.attributes.area_min?el("span", {className: "itbconnect_label"}, i18n.__("Min. area", "immotoolbox-connect")+" : "+props.attributes.area_min):null,
    10081094                                        props.attributes.featured?el("span", {className: "itbconnect_label"}, i18n.__("Featured", "immotoolbox-connect")):null,
     
    10811167        code+=' rooms="'+props.attributes.rooms+'"';
    10821168    }
     1169    if (props.attributes.price_min) {
     1170        code+=' price_min="'+props.attributes.price_min+'"';
     1171    }
    10831172    if (props.attributes.price_max) {
    10841173        code+=' price_max="'+props.attributes.price_max+'"';
    10851174    }
     1175    if (props.attributes.price_on_request) {
     1176        code+=' price_on_request="'+props.attributes.price_on_request+'"';
     1177    }
    10861178    if (props.attributes.area_min) {
    10871179        code+=' area_min="'+props.attributes.area_min+'"';
  • immotoolbox-connect/trunk/immotoolbox-connect.php

    r2747456 r2930754  
    44Plugin URI: https://www.immotoolbox.com/
    55Description: Displays ImmoToolBox real estate listings in your website
    6 Version: 1.2.24
     6Version: 1.3.0
    77Author: ZebraSoft Monaco
    88Author URI: https://www.zebrasoft.mc
     
    2424along with ImmoToolBox Connect. If not, see https://www.gnu.org/licenses/gpl.html.
    2525*/
    26 define('ITBCONNECT_VERSION', '1.2.24');
     26define('ITBCONNECT_VERSION', '1.3.0');
    2727
    2828/**
     
    4141 */
    4242define('ITBCONNECT_OPTION_NAME', 'itbconnect_data');
    43 if (version_compare('7.0', phpversion()) > 0) {
    44     require_once __DIR__.'/includeslegacy/vendor/autoload.php';
    45 }
    46 else {
    47     require_once __DIR__.'/includes/vendor/autoload.php';
     43if (version_compare('7.0', phpversion()) === 1) {
     44    require_once __DIR__ . '/includeslegacy/vendor/autoload.php';
     45} elseif (version_compare('8.2', phpversion()) === -1) {
     46    require_once __DIR__ . '/includes8.2/vendor/autoload.php';
     47} elseif (version_compare('8.0', phpversion()) === -1) {
     48    require_once __DIR__ . '/includes8.0/vendor/autoload.php';
     49} else {
     50    require_once __DIR__ . '/includes/vendor/autoload.php';
    4851}
    4952require_once __DIR__.'/includes/ITBConnect.php';
  • immotoolbox-connect/trunk/includes/ITBConnectAPI.php

    r2746279 r2930754  
    102102        if (!empty($atts['price_max'])) {
    103103            $get['price']['lte'] = $atts['price_max'];
     104        }
     105        if (!empty($atts['price_on_request'])) {
     106            if ($atts['price_on_request'] == 'always_include') $get['includePricePrivate'] = 1;
     107            elseif ($atts['price_on_request'] == 'include_match') $get['searchPricePrivate'] = 1;
     108        }
     109        elseif (!empty($atts['includepriceprivate'])) {
     110            $get['includePricePrivate'] = 1;
     111        }
     112        elseif (!empty($atts['searchpriceprivate'])) {
     113            $get['searchPricePrivate'] = 1;
    104114        }
    105115
  • immotoolbox-connect/trunk/public/ITBConnectPublic.php

    r2747456 r2930754  
    290290        $option = get_option(ITBCONNECT_OPTION_NAME, array());
    291291
    292         $args = shortcode_atts([
    293             'num_per_page' => 5,
    294             'type' => '',
    295             'carousel' => 'responsive',
    296             'country' => '',
    297             'city' => '',
    298             'district' => '',
    299             'featured' => false,
    300             'ids' => '',
    301             'nids' => '',
    302             'locale' => get_locale(),
    303             'nbpp' => $option['nbpp'],
    304             'property_page_id' => $option['property_page_id'],
    305         ],
    306             $atts
    307         );
    308         $data_view['atts'] = $atts;
    309 
    310         $url = ITBCONNECT_API_BASEURL.'/properties';
    311         $get = ['locale'=>current(explode('_', $args['locale']))];
    312         if ($args['nbpp']) {
    313             $get['nbpp'] = $args['nbpp'];
    314         }
    315         if ($args['type']) {
    316             $get['type_transaction'] = $args['type'];
    317         }
    318         if ($args['country']) {
    319             $get['country'] = $args['country'];
    320         }
    321         if ($args['city']) {
    322             $get['city'] = $args['city'];
    323         }
    324         if ($args['district']) {
    325             $get['district'] = $args['district'];
    326         }
    327         if ($args['featured']) {
    328             $get['featured'] = 1;
    329         }
    330         if ($args['ids']) {
    331             $get['ids'] = $args['ids'];
    332         }
    333         if ($args['nids']) {
    334             $get['nids'] = $args['nids'];
    335         }
    336 
    337         $headers = [
    338             'X-AUTH-TOKEN: '.$option['private_key']
    339             , 'accept: application/ld+json'
    340         ];
    341         $response = ITBConnect::getRemoteUrl($url, $get, [], $headers, 60*60, isset($option['nocheck_ssl'])&&$option['nocheck_ssl']);
    342 
    343         if ($response) {
    344             $data = json_decode($response, true);
    345             $properties = [];
    346             foreach ($data['hydra:member'] as $property) {
    347                 $property = $this->format_property($property, get_locale());
    348                 $slug = trim( sanitize_title($property['type_property'] . '-' . $property['label_num_rooms'] . '-' . $property['country_name']), '-');
    349                 $property['url'] = $url = rtrim(get_page_link($args['property_page_id']), '/').'/'.$property['id'].'-'.$slug.'/';
    350                 $property['image'] = $img = $property['images'][0]['url'];
    351                 $properties[] = $property;
    352             }
    353             $data_view['properties'] = $properties;
    354 
    355             $twig = self::getTwig();
    356 
    357             if ($content) {
    358                 $template = $twig->createTemplate("{% extends 'carousel.html.twig' %}\r\n".trim(str_replace("<br />\n", "\n", $content), "\r\n "));
    359 
    360             }
    361             else $template = $twig->load('carousel.html.twig');
    362 
    363             return $template->render($data_view);
    364         }
    365 
    366         return '';
     292        $selection = isset($_COOKIE['itbconnect_selection'])&&@unserialize($_COOKIE['itbconnect_selection'])?unserialize($_COOKIE['itbconnect_selection']):[];
     293        $data_view['selection'] = $selection;
     294        $data_view['selection_url'] = get_page_link(isset($atts['selection_page_id'])?$atts['selection_page_id']:$option['basket_page_id']);
     295        $data_view['atts'] = $atts;
     296        $properties = ITBConnectAPI::properties($atts);
     297        $data_view['properties'] = [];
     298        foreach ($properties['list'] as $property) {
     299            $property = $this->format_property($property, get_locale());
     300            $slug = trim( sanitize_title($property['type_property'] . '-' . $property['label_num_rooms'] . '-' . $property['country_name']), '-');
     301            $property['url'] = $url = rtrim(get_page_link($args['property_page_id']), '/').'/'.$property['id'].'-'.$slug.'/';
     302            $property['image'] = $img = $property['images'][0]['url'];
     303            $data_view['properties'][] = $property;
     304        }
     305        if ($data_view['properties']) {
     306            $twig = self::getTwig();
     307            $template = $twig->load('carousel.html.twig');
     308            return $template->render($data_view);
     309        }
     310        return '';
    367311    }
    368312
  • immotoolbox-connect/trunk/public/partials/base/carousel.html.twig

    r1998127 r2930754  
    6868                        0:{
    6969                            items:2,
    70                             center: true
     70                            center: true,
     71                            loop: {{ properties|length>2?"true":"false" }}
    7172                        },
    7273                        640:{
    7374                            items:4,
     75                            loop: {{ properties|length>4?"true":"false" }}
    7476                        },
    7577                        1000:{
    7678                            items:4,
     79                            loop: {{ properties|length>4?"true":"false" }}
    7780                        },
    7881                        1200:{
    7982                            items:4,
     83                            loop: {{ properties|length>4?"true":"false" }}
    8084                        }
    8185                    }
     
    8993                    responsive:{
    9094                        0:{
    91                             items:2
     95                            items:2,
     96                            loop: {{ properties|length>2?"true":"false" }}
    9297                        },
    9398                        480:{
    94                             items:4
     99                            items:4,
     100                            loop: {{ properties|length>4?"true":"false" }}
    95101                        },
    96102                        980:{
    97                             items:2
     103                            items:2,
     104                            loop: {{ properties|length>2?"true":"false" }}
    98105                        }
    99106                    }
  • immotoolbox-connect/trunk/readme.md

    r2747456 r2930754  
    44Tags: immotoolbox, realestate, agency, property
    55Requires at least: 4.9
    6 Tested up to: 5.9
     6Tested up to: 6.2
    77Requires PHP: 5.9
    8 Stable tag: 1.2.24
     8Stable tag: 1.3.0
    99License: GPL3
    1010License URI: https://www.gnu.org/licenses/gpl.html
     
    3434== Changelog ==
    3535
     36= 1.2 =
     37* Handle PHP versions up to 8.2
     38* New filter option to filter properties with price on request : `searchpriceprivate`
     39 
    3640= 1.2 =
    3741* Add handling of not found properties
  • immotoolbox-connect/trunk/readme.txt

    r2747456 r2930754  
    44Tags: immotoolbox, realestate, agency, property
    55Requires at least: 4.9
    6 Tested up to: 5.9
     6Tested up to: 6.2
    77Requires PHP: 5.9
    8 Stable tag: 1.2.24
     8Stable tag: 1.3.0
    99License: GPL3
    1010License URI: https://www.gnu.org/licenses/gpl.html
     
    3333
    3434== Changelog ==
     35
     36= 1.2 =
     37* Handle PHP versions up to 8.2
     38* New filter option to filter properties with price on request : `searchpriceprivate`
    3539
    3640= 1.2 =
Note: See TracChangeset for help on using the changeset viewer.