Plugin Directory

Changeset 2450742


Ignore:
Timestamp:
01/05/2021 04:33:30 PM (5 years ago)
Author:
ownerrez
Message:

Update to version 1.1.1 from GitHub

Location:
ownerrez
Files:
6 deleted
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • ownerrez/tags/1.1.1/ownerrez.php

    r2444600 r2450742  
    1616 * Plugin Name:       OwnerRez
    1717 * Plugin URI:        https://www.ownerreservations.com/support/wordpress
    18  * Description:       Integrate your OwnerRez account with your wordpress site.
    19  * Version:           1.0.5
     18 * Description:       The official WordPress plugin for the OwnerRez API.
     19 * Version:           1.1.0
    2020 * Author:            OwnerRez, Inc.
    2121 * Author URI:        https://www.ownerreservations.com/
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define('OWNERREZ_VERSION', '1.0.5');
     38define('OWNERREZ_VERSION', '1.1.0');
    3939
    4040/**
  • ownerrez/tags/1.1.1/public/class-ownerrez-shortcodes.php

    r2439293 r2450742  
    115115    }
    116116
     117    function filter_array ($array, $callback, $args){
     118        if(is_array($array) && count($array)>0)
     119        {
     120            foreach(array_keys($array) as $key){
     121                $temp[$key] = $array[$key];
     122
     123                if ($callback($temp[$key], $args)){
     124                    $newarray[count($newarray ?? [])] = $array[$key];
     125                }
     126            }
     127        }
     128        return $newarray ?? null;
     129    }
     130
    117131    function get_resource($attrs, $resourceName, $id = null, $action = null, $query = null, $verb = null, $body = null)
    118132    {
     
    190204
    191205        if (property_exists($listing, "callOutAmenities")) {
    192             $list = "<ul class='ownerrez-amenities-list'>";
     206            $list = "<ul class='ownerrez-callout-amenities-list'>";
    193207
    194208            foreach ($listing->callOutAmenities as &$amenity) {
     
    216230
    217231            foreach ($listing->amenities as $category => $amenities) {
    218                 $tr = "<tr><td class='ownerrez-amenities-table-category-name'>" . $this->camelToTitle(ucfirst($category)) .  "</td><td class='ownerrez-amenities-table-category-items'><ul class='ownerrez-amenities-table-list'>";
    219 
    220                 foreach ($amenities as $amenity) {
    221                     $tr .= "<li class='ownerrez-amenities-table-list-item'>" . $this->camelToTitle(ucfirst($amenity->text)) . "</li>";
    222                 }
    223 
    224                 $tr .= "</ul></td>";
    225 
     232                $tr = "<tr><th class='ownerrez-amenities-table-category-name'>" . $this->camelToTitle(ucfirst($category)) . "</th><td class='ownerrez-amenities-table-category-items'>";
     233                $tr .= $this->get_amenities_list($amenities);
     234                $tr .= "</td></tr>";
    226235                $table .= $tr;
    227236            }
     
    233242
    234243        return "[The current ownerrez api does not support type: widget_amenities_table]";
     244    }
     245
     246    function type_widget_amenities_category($attrs, $content, $additionalArgs)
     247    {
     248        $category = null;
     249        if (array_key_exists("category", $additionalArgs) && is_string($additionalArgs["category"]))
     250            $category = strtolower($additionalArgs["category"]);
     251        else
     252            return '[The "category" attribute is required for this shortcode.]';
     253
     254        $listing = $this->get_resource($attrs, "listings", $this->get_id($attrs, "orp"), "summary", ["includeDescriptions"=>"true", "includeAmenities"=>"true"]);
     255
     256        if (property_exists($listing, "amenityCategories") && is_array($listing->amenityCategories))
     257        {
     258            $match = $this->filter_array($listing->amenityCategories, function ($x, $args) {
     259                return !strcasecmp($args, $x->type);
     260            }, $category);
     261
     262            if (!empty($match)) {
     263                return $this->get_amenities_list($match[0]->amenities);
     264            }
     265            else {
     266                return "";
     267            }
     268        }
     269
     270        return "[The current ownerrez api does not support type: widget_amenities_category]";
     271    }
     272
     273    function type_widget_listing_details($attrs, $content, $additionalArgs)
     274    {
     275        $listing = $this->get_resource($attrs, "listings", $this->get_id($attrs, "orp"), "summary", ["includeDescriptions"=>"true", "includeAmenities"=>"true"]);
     276
     277        if (property_exists($listing, "amenityCategories") && is_array($listing->amenityCategories))
     278        {
     279            $output = "<div class='ownerrez-listing-details'>";
     280
     281            if (property_exists($listing, "amenitiesAdditionalInfo"))
     282                $output .= "<div class='ownerrez-listing-details-additional-info'>" . $listing->amenitiesAdditionalInfo . "</div>";
     283
     284            $output .= "<table class='ownerrez-amenities-table'>";
     285
     286            foreach ($listing->amenityCategories as $category)
     287            {
     288                $output .= "<tr><th class='ownerrez-amenities-table-category-name'>" . $category->caption . "</th><td class='ownerrez-amenities-table-category-items'>";
     289                $output .= $this->get_amenities_list($category->amenities);
     290                $output .= "</td>";
     291            }
     292
     293            return $output . "</table></div>";
     294        }
     295
     296        return "[The current ownerrez api does not support type: widget_listing_details]";
     297    }
     298
     299    /**
     300     * @param $amenities
     301     * @return string
     302     */
     303    public function get_amenities_list($amenities): string
     304    {
     305        $ul = "<ul class='ownerrez-amenities-list'>";
     306
     307        foreach ($amenities as $amenity) {
     308            $ul .= "<li class='ownerrez-amenities-list-item'>" . $this->camelToTitle(ucfirst($amenity->text));
     309            if (!empty($amenity->title)) {
     310                $ul .= '<i class="fas fa-info-circle" title="' . $amenity->title . '"></i>';
     311            }
     312            $ul .= "</li>";
     313        }
     314
     315        $ul .= "</ul>";
     316
     317        return $ul;
    235318    }
    236319
  • ownerrez/tags/1.1.1/public/css/ownerrez-public.css

    r2439293 r2450742  
    158158}
    159159
    160 .ownerrez-amenities-list {
     160.ownerrez-callout-amenities-list {
    161161}
    162 .ownerrez-amenities-list>li {
     162.ownerrez-callout-amenities-list > li {
    163163    list-style: none;
    164164    margin: 0 20px 0 0;
    165165    display: inline-block;
    166166}
     167.ownerrez-callout-amenities-list .fas {
     168    margin-right: 5px;
     169}
     170
    167171.ownerrez-amenities-table {
    168172    border: none;
     
    174178    min-width: 150px;
    175179}
    176 .ownerrez-amenities-table-list {
     180.ownerrez-amenities-list {
    177181    margin: 0;
    178182    padding: 0;
    179183}
    180 .ownerrez-amenities-table-list-item {
     184.ownerrez-amenities-list-item {
    181185    margin: 0;
    182186    padding: 0;
    183187    list-style: none;
    184188}
     189.ownerrez-amenities-list-item .fa-info-circle {
     190    margin-left: 5px;
     191}
  • ownerrez/tags/1.1.1/readme.txt

    r2444600 r2450742  
    44Requires at least: 5.4
    55Tested up to: 5.6
    6 Stable tag: 1.0.5
     6Stable tag: 1.1.0
    77License: MIT
    88License URI: https://github.com/ownerrez/orez-wp/blob/master/LICENSE
     
    32321. Complete the registration information (username and personal access token) under Settings -> OwnerRez
    3333
    34 == Frequently Asked Questions ==
    35 
    36 
    37 == Screenshots ==
    38 
    39 
    4034== Changelog ==
     35= 1.1.0 =
     36- Added two new widget shortcodes.
     37- **Breaking** Modified css classes on existing widget shortcodes.
    4138
    4239= 1.0.5 =
    43 
    4440Fixed a bug that occurred when Wordpress was hosted in a subfolder named /ownerrez
    4541
    4642== Upgrade Notice ==
     43
     44After upgrading to 1.1.0, please review any custom css you have added for OwnerRez widgets.
  • ownerrez/trunk/ownerrez.php

    r2444600 r2450742  
    1616 * Plugin Name:       OwnerRez
    1717 * Plugin URI:        https://www.ownerreservations.com/support/wordpress
    18  * Description:       Integrate your OwnerRez account with your wordpress site.
    19  * Version:           1.0.5
     18 * Description:       The official WordPress plugin for the OwnerRez API.
     19 * Version:           1.1.0
    2020 * Author:            OwnerRez, Inc.
    2121 * Author URI:        https://www.ownerreservations.com/
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define('OWNERREZ_VERSION', '1.0.5');
     38define('OWNERREZ_VERSION', '1.1.0');
    3939
    4040/**
  • ownerrez/trunk/public/class-ownerrez-shortcodes.php

    r2439293 r2450742  
    115115    }
    116116
     117    function filter_array ($array, $callback, $args){
     118        if(is_array($array) && count($array)>0)
     119        {
     120            foreach(array_keys($array) as $key){
     121                $temp[$key] = $array[$key];
     122
     123                if ($callback($temp[$key], $args)){
     124                    $newarray[count($newarray ?? [])] = $array[$key];
     125                }
     126            }
     127        }
     128        return $newarray ?? null;
     129    }
     130
    117131    function get_resource($attrs, $resourceName, $id = null, $action = null, $query = null, $verb = null, $body = null)
    118132    {
     
    190204
    191205        if (property_exists($listing, "callOutAmenities")) {
    192             $list = "<ul class='ownerrez-amenities-list'>";
     206            $list = "<ul class='ownerrez-callout-amenities-list'>";
    193207
    194208            foreach ($listing->callOutAmenities as &$amenity) {
     
    216230
    217231            foreach ($listing->amenities as $category => $amenities) {
    218                 $tr = "<tr><td class='ownerrez-amenities-table-category-name'>" . $this->camelToTitle(ucfirst($category)) .  "</td><td class='ownerrez-amenities-table-category-items'><ul class='ownerrez-amenities-table-list'>";
    219 
    220                 foreach ($amenities as $amenity) {
    221                     $tr .= "<li class='ownerrez-amenities-table-list-item'>" . $this->camelToTitle(ucfirst($amenity->text)) . "</li>";
    222                 }
    223 
    224                 $tr .= "</ul></td>";
    225 
     232                $tr = "<tr><th class='ownerrez-amenities-table-category-name'>" . $this->camelToTitle(ucfirst($category)) . "</th><td class='ownerrez-amenities-table-category-items'>";
     233                $tr .= $this->get_amenities_list($amenities);
     234                $tr .= "</td></tr>";
    226235                $table .= $tr;
    227236            }
     
    233242
    234243        return "[The current ownerrez api does not support type: widget_amenities_table]";
     244    }
     245
     246    function type_widget_amenities_category($attrs, $content, $additionalArgs)
     247    {
     248        $category = null;
     249        if (array_key_exists("category", $additionalArgs) && is_string($additionalArgs["category"]))
     250            $category = strtolower($additionalArgs["category"]);
     251        else
     252            return '[The "category" attribute is required for this shortcode.]';
     253
     254        $listing = $this->get_resource($attrs, "listings", $this->get_id($attrs, "orp"), "summary", ["includeDescriptions"=>"true", "includeAmenities"=>"true"]);
     255
     256        if (property_exists($listing, "amenityCategories") && is_array($listing->amenityCategories))
     257        {
     258            $match = $this->filter_array($listing->amenityCategories, function ($x, $args) {
     259                return !strcasecmp($args, $x->type);
     260            }, $category);
     261
     262            if (!empty($match)) {
     263                return $this->get_amenities_list($match[0]->amenities);
     264            }
     265            else {
     266                return "";
     267            }
     268        }
     269
     270        return "[The current ownerrez api does not support type: widget_amenities_category]";
     271    }
     272
     273    function type_widget_listing_details($attrs, $content, $additionalArgs)
     274    {
     275        $listing = $this->get_resource($attrs, "listings", $this->get_id($attrs, "orp"), "summary", ["includeDescriptions"=>"true", "includeAmenities"=>"true"]);
     276
     277        if (property_exists($listing, "amenityCategories") && is_array($listing->amenityCategories))
     278        {
     279            $output = "<div class='ownerrez-listing-details'>";
     280
     281            if (property_exists($listing, "amenitiesAdditionalInfo"))
     282                $output .= "<div class='ownerrez-listing-details-additional-info'>" . $listing->amenitiesAdditionalInfo . "</div>";
     283
     284            $output .= "<table class='ownerrez-amenities-table'>";
     285
     286            foreach ($listing->amenityCategories as $category)
     287            {
     288                $output .= "<tr><th class='ownerrez-amenities-table-category-name'>" . $category->caption . "</th><td class='ownerrez-amenities-table-category-items'>";
     289                $output .= $this->get_amenities_list($category->amenities);
     290                $output .= "</td>";
     291            }
     292
     293            return $output . "</table></div>";
     294        }
     295
     296        return "[The current ownerrez api does not support type: widget_listing_details]";
     297    }
     298
     299    /**
     300     * @param $amenities
     301     * @return string
     302     */
     303    public function get_amenities_list($amenities): string
     304    {
     305        $ul = "<ul class='ownerrez-amenities-list'>";
     306
     307        foreach ($amenities as $amenity) {
     308            $ul .= "<li class='ownerrez-amenities-list-item'>" . $this->camelToTitle(ucfirst($amenity->text));
     309            if (!empty($amenity->title)) {
     310                $ul .= '<i class="fas fa-info-circle" title="' . $amenity->title . '"></i>';
     311            }
     312            $ul .= "</li>";
     313        }
     314
     315        $ul .= "</ul>";
     316
     317        return $ul;
    235318    }
    236319
  • ownerrez/trunk/public/css/ownerrez-public.css

    r2439293 r2450742  
    158158}
    159159
    160 .ownerrez-amenities-list {
     160.ownerrez-callout-amenities-list {
    161161}
    162 .ownerrez-amenities-list>li {
     162.ownerrez-callout-amenities-list > li {
    163163    list-style: none;
    164164    margin: 0 20px 0 0;
    165165    display: inline-block;
    166166}
     167.ownerrez-callout-amenities-list .fas {
     168    margin-right: 5px;
     169}
     170
    167171.ownerrez-amenities-table {
    168172    border: none;
     
    174178    min-width: 150px;
    175179}
    176 .ownerrez-amenities-table-list {
     180.ownerrez-amenities-list {
    177181    margin: 0;
    178182    padding: 0;
    179183}
    180 .ownerrez-amenities-table-list-item {
     184.ownerrez-amenities-list-item {
    181185    margin: 0;
    182186    padding: 0;
    183187    list-style: none;
    184188}
     189.ownerrez-amenities-list-item .fa-info-circle {
     190    margin-left: 5px;
     191}
  • ownerrez/trunk/readme.txt

    r2444600 r2450742  
    44Requires at least: 5.4
    55Tested up to: 5.6
    6 Stable tag: 1.0.5
     6Stable tag: 1.1.0
    77License: MIT
    88License URI: https://github.com/ownerrez/orez-wp/blob/master/LICENSE
     
    32321. Complete the registration information (username and personal access token) under Settings -> OwnerRez
    3333
    34 == Frequently Asked Questions ==
    35 
    36 
    37 == Screenshots ==
    38 
    39 
    4034== Changelog ==
     35= 1.1.0 =
     36- Added two new widget shortcodes.
     37- **Breaking** Modified css classes on existing widget shortcodes.
    4138
    4239= 1.0.5 =
    43 
    4440Fixed a bug that occurred when Wordpress was hosted in a subfolder named /ownerrez
    4541
    4642== Upgrade Notice ==
     43
     44After upgrading to 1.1.0, please review any custom css you have added for OwnerRez widgets.
Note: See TracChangeset for help on using the changeset viewer.