diff --git a/README.adoc b/README.adoc index d92ae48..de658d3 100644 --- a/README.adoc +++ b/README.adoc @@ -78,7 +78,7 @@ IMPORTANT: The plugin's latest version is already installed at https://hosting.r == 🪛 Configuration -. Set parameter `ROTARACT_ELASTIC_HOST` in your `wp-config.php` +. Set parameter `ROTARACT_APPOINTMENTS_CLOUD_ID`, `ROTARACT_APPOINTMENTS_API_ID` and `ROTARACT_APPOINTMENTS_API_KEY` in your `wp-config.php` + .snippet of `wp-config.php` [source,php] @@ -86,7 +86,9 @@ IMPORTANT: The plugin's latest version is already installed at https://hosting.r /** * Rotaract Params */ -define( 'ROTARACT_ELASTIC_HOST', 'https://my-elastic-host.com:9200' ); +define( 'ROTARACT_APPOINTMENTS_CLOUD_ID', '' ); +define( 'ROTARACT_APPOINTMENTS_API_ID', '' ); +define( 'ROTARACT_APPOINTMENTS_API_KEY', '' ); ---- . Navigate to setting page 'Rotaract' within the https://wordpress.org/support/article/administration-screens/[Administration Screen] . Add at least one owner, select a color and save changes diff --git a/composer.json b/composer.json index 4750036..960aca5 100644 --- a/composer.json +++ b/composer.json @@ -20,6 +20,7 @@ "issues": "https://github.com/rotaract/rotaract-appointments/issues" }, "require": { + "elasticsearch/elasticsearch": "~7.0", "erusev/parsedown": "1.8.0-beta-7" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 7bca5ef..e29e8bd 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,74 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e7f6b3190b1b129c96ea4108bd2a230c", + "content-hash": "0aba93dd61fbd39907d63e30504c5591", "packages": [ + { + "name": "elasticsearch/elasticsearch", + "version": "v7.15.0", + "source": { + "type": "git", + "url": "https://github.com/elastic/elasticsearch-php.git", + "reference": "77a4ade87aef8e8e6b84bafb6704cd35ac15742a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/77a4ade87aef8e8e6b84bafb6704cd35ac15742a", + "reference": "77a4ade87aef8e8e6b84bafb6704cd35ac15742a", + "shasum": "" + }, + "require": { + "ext-json": ">=1.3.7", + "ezimuel/ringphp": "^1.1.2", + "php": "^7.3 || ^8.0", + "psr/log": "^1|^2" + }, + "require-dev": { + "ext-yaml": "*", + "ext-zip": "*", + "mockery/mockery": "^1.2", + "phpstan/phpstan": "^0.12", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "^3.4", + "symfony/finder": "~4.0" + }, + "suggest": { + "ext-curl": "*", + "monolog/monolog": "Allows for client-level logging and tracing" + }, + "type": "library", + "autoload": { + "files": [ + "src/autoload.php" + ], + "psr-4": { + "Elasticsearch\\": "src/Elasticsearch/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Zachary Tong" + }, + { + "name": "Enrico Zimuel" + } + ], + "description": "PHP Client for Elasticsearch", + "keywords": [ + "client", + "elasticsearch", + "search" + ], + "support": { + "issues": "https://github.com/elastic/elasticsearch-php/issues", + "source": "https://github.com/elastic/elasticsearch-php/tree/v7.15.0" + }, + "time": "2021-09-23T07:05:35+00:00" + }, { "name": "erusev/parsedown", "version": "1.8.0-beta-7", @@ -55,21 +121,231 @@ "source": "https://github.com/erusev/parsedown/tree/1.8.0-beta-7" }, "time": "2019-03-17T18:47:21+00:00" + }, + { + "name": "ezimuel/guzzlestreams", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/ezimuel/guzzlestreams.git", + "reference": "abe3791d231167f14eb80d413420d1eab91163a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ezimuel/guzzlestreams/zipball/abe3791d231167f14eb80d413420d1eab91163a8", + "reference": "abe3791d231167f14eb80d413420d1eab91163a8", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Stream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Fork of guzzle/streams (abandoned) to be used with elasticsearch-php", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "Guzzle", + "stream" + ], + "support": { + "source": "https://github.com/ezimuel/guzzlestreams/tree/3.0.1" + }, + "time": "2020-02-14T23:11:50+00:00" + }, + { + "name": "ezimuel/ringphp", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/ezimuel/ringphp.git", + "reference": "92b8161404ab1ad84059ebed41d9f757e897ce74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ezimuel/ringphp/zipball/92b8161404ab1ad84059ebed41d9f757e897ce74", + "reference": "92b8161404ab1ad84059ebed41d9f757e897ce74", + "shasum": "" + }, + "require": { + "ezimuel/guzzlestreams": "^3.0.1", + "php": ">=5.4.0", + "react/promise": "~2.0" + }, + "replace": { + "guzzlehttp/ringphp": "self.version" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "~9.0" + }, + "suggest": { + "ext-curl": "Guzzle will use specific adapters if cURL is present" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Ring\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Fork of guzzle/RingPHP (abandoned) to be used with elasticsearch-php", + "support": { + "source": "https://github.com/ezimuel/ringphp/tree/1.2.0" + }, + "time": "2021-11-16T11:51:30+00:00" + }, + { + "name": "psr/log", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.4" + }, + "time": "2021-05-03T11:20:27+00:00" + }, + { + "name": "react/promise", + "version": "v2.8.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "f3cff96a19736714524ca0dd1d4130de73dbbbc4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/f3cff96a19736714524ca0dd1d4130de73dbbbc4", + "reference": "f3cff96a19736714524ca0dd1d4130de73dbbbc4", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^7.0 || ^6.5 || ^5.7 || ^4.8.36" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ], + "support": { + "issues": "https://github.com/reactphp/promise/issues", + "source": "https://github.com/reactphp/promise/tree/v2.8.0" + }, + "time": "2020-05-12T15:16:56+00:00" } ], "packages-dev": [ { "name": "composer/ca-bundle", - "version": "1.2.11", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "0b072d51c5a9c6f3412f7ea3ab043d6603cb2582" + "reference": "4c679186f2aca4ab6a0f1b0b9cf9252decb44d0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/0b072d51c5a9c6f3412f7ea3ab043d6603cb2582", - "reference": "0b072d51c5a9c6f3412f7ea3ab043d6603cb2582", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/4c679186f2aca4ab6a0f1b0b9cf9252decb44d0b", + "reference": "4c679186f2aca4ab6a0f1b0b9cf9252decb44d0b", "shasum": "" }, "require": { @@ -116,7 +392,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/ca-bundle/issues", - "source": "https://github.com/composer/ca-bundle/tree/1.2.11" + "source": "https://github.com/composer/ca-bundle/tree/1.3.1" }, "funding": [ { @@ -132,20 +408,20 @@ "type": "tidelift" } ], - "time": "2021-09-25T20:32:43+00:00" + "time": "2021-10-28T20:44:15+00:00" }, { "name": "composer/composer", - "version": "2.1.9", + "version": "2.1.14", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "e558c88f28d102d497adec4852802c0dc14c7077" + "reference": "cd28fc05b0c9d3beaf58b57018725c4dc15a6446" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/e558c88f28d102d497adec4852802c0dc14c7077", - "reference": "e558c88f28d102d497adec4852802c0dc14c7077", + "url": "https://api.github.com/repos/composer/composer/zipball/cd28fc05b0c9d3beaf58b57018725c4dc15a6446", + "reference": "cd28fc05b0c9d3beaf58b57018725c4dc15a6446", "shasum": "" }, "require": { @@ -156,11 +432,11 @@ "composer/xdebug-handler": "^2.0", "justinrainbow/json-schema": "^5.2.11", "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1.0", + "psr/log": "^1.0 || ^2.0", "react/promise": "^1.2 || ^2.7", "seld/jsonlint": "^1.4", "seld/phar-utils": "^1.0", - "symfony/console": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0", + "symfony/console": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0", "symfony/filesystem": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0", "symfony/finder": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0", "symfony/process": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0" @@ -180,7 +456,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-main": "2.1-dev" } }, "autoload": { @@ -214,7 +490,7 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/composer/issues", - "source": "https://github.com/composer/composer/tree/2.1.9" + "source": "https://github.com/composer/composer/tree/2.1.14" }, "funding": [ { @@ -230,7 +506,7 @@ "type": "tidelift" } ], - "time": "2021-10-05T07:47:38+00:00" + "time": "2021-11-30T09:51:43+00:00" }, { "name": "composer/metadata-minifier", @@ -303,16 +579,16 @@ }, { "name": "composer/semver", - "version": "3.2.5", + "version": "3.2.6", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "31f3ea725711245195f62e54ffa402d8ef2fdba9" + "reference": "83e511e247de329283478496f7a1e114c9517506" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/31f3ea725711245195f62e54ffa402d8ef2fdba9", - "reference": "31f3ea725711245195f62e54ffa402d8ef2fdba9", + "url": "https://api.github.com/repos/composer/semver/zipball/83e511e247de329283478496f7a1e114c9517506", + "reference": "83e511e247de329283478496f7a1e114c9517506", "shasum": "" }, "require": { @@ -364,7 +640,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.2.5" + "source": "https://github.com/composer/semver/tree/3.2.6" }, "funding": [ { @@ -380,27 +656,28 @@ "type": "tidelift" } ], - "time": "2021-05-24T12:41:47+00:00" + "time": "2021-10-25T11:34:17+00:00" }, { "name": "composer/spdx-licenses", - "version": "1.5.5", + "version": "1.5.6", "source": { "type": "git", "url": "https://github.com/composer/spdx-licenses.git", - "reference": "de30328a7af8680efdc03e396aad24befd513200" + "reference": "a30d487169d799745ca7280bc90fdfa693536901" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/de30328a7af8680efdc03e396aad24befd513200", - "reference": "de30328a7af8680efdc03e396aad24befd513200", + "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/a30d487169d799745ca7280bc90fdfa693536901", + "reference": "a30d487169d799745ca7280bc90fdfa693536901", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 7" + "phpstan/phpstan": "^0.12.55", + "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", "extra": { @@ -443,7 +720,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/spdx-licenses/issues", - "source": "https://github.com/composer/spdx-licenses/tree/1.5.5" + "source": "https://github.com/composer/spdx-licenses/tree/1.5.6" }, "funding": [ { @@ -459,7 +736,7 @@ "type": "tidelift" } ], - "time": "2020-12-03T16:04:16+00:00" + "time": "2021-11-18T10:14:14+00:00" }, { "name": "composer/xdebug-handler", @@ -597,16 +874,16 @@ }, { "name": "gettext/gettext", - "version": "v4.8.5", + "version": "v4.8.6", "source": { "type": "git", "url": "https://github.com/php-gettext/Gettext.git", - "reference": "ef2e312dff383fc0e4cd62dd39042e1157f137d4" + "reference": "bbeb8f4d3077663739aecb4551b22e720c0e9efe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-gettext/Gettext/zipball/ef2e312dff383fc0e4cd62dd39042e1157f137d4", - "reference": "ef2e312dff383fc0e4cd62dd39042e1157f137d4", + "url": "https://api.github.com/repos/php-gettext/Gettext/zipball/bbeb8f4d3077663739aecb4551b22e720c0e9efe", + "reference": "bbeb8f4d3077663739aecb4551b22e720c0e9efe", "shasum": "" }, "require": { @@ -658,7 +935,7 @@ "support": { "email": "oom@oscarotero.com", "issues": "https://github.com/oscarotero/Gettext/issues", - "source": "https://github.com/php-gettext/Gettext/tree/v4.8.5" + "source": "https://github.com/php-gettext/Gettext/tree/v4.8.6" }, "funding": [ { @@ -674,20 +951,20 @@ "type": "patreon" } ], - "time": "2021-07-13T16:45:53+00:00" + "time": "2021-10-19T10:44:53+00:00" }, { "name": "gettext/languages", - "version": "2.8.1", + "version": "2.9.0", "source": { "type": "git", "url": "https://github.com/php-gettext/Languages.git", - "reference": "4ad818b6341e177b7c508ec4c37e18932a7b788a" + "reference": "ed56dd2c7f4024cc953ed180d25f02f2640e3ffa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-gettext/Languages/zipball/4ad818b6341e177b7c508ec4c37e18932a7b788a", - "reference": "4ad818b6341e177b7c508ec4c37e18932a7b788a", + "url": "https://api.github.com/repos/php-gettext/Languages/zipball/ed56dd2c7f4024cc953ed180d25f02f2640e3ffa", + "reference": "ed56dd2c7f4024cc953ed180d25f02f2640e3ffa", "shasum": "" }, "require": { @@ -736,7 +1013,7 @@ ], "support": { "issues": "https://github.com/php-gettext/Languages/issues", - "source": "https://github.com/php-gettext/Languages/tree/2.8.1" + "source": "https://github.com/php-gettext/Languages/tree/2.9.0" }, "funding": [ { @@ -748,7 +1025,7 @@ "type": "github" } ], - "time": "2021-07-14T15:03:58+00:00" + "time": "2021-11-11T17:30:39+00:00" }, { "name": "justinrainbow/json-schema", @@ -822,16 +1099,16 @@ }, { "name": "mck89/peast", - "version": "v1.13.5", + "version": "v1.13.9", "source": { "type": "git", "url": "https://github.com/mck89/peast.git", - "reference": "4f89ad98e3402b851beb81ad1925e325adaa2124" + "reference": "5329e997fb50e0b82ca8f6e4164f92941f689b47" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mck89/peast/zipball/4f89ad98e3402b851beb81ad1925e325adaa2124", - "reference": "4f89ad98e3402b851beb81ad1925e325adaa2124", + "url": "https://api.github.com/repos/mck89/peast/zipball/5329e997fb50e0b82ca8f6e4164f92941f689b47", + "reference": "5329e997fb50e0b82ca8f6e4164f92941f689b47", "shasum": "" }, "require": { @@ -843,7 +1120,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13.5-dev" + "dev-master": "1.13.9-dev" } }, "autoload": { @@ -865,9 +1142,9 @@ "description": "Peast is PHP library that generates AST for JavaScript code", "support": { "issues": "https://github.com/mck89/peast/issues", - "source": "https://github.com/mck89/peast/tree/v1.13.5" + "source": "https://github.com/mck89/peast/tree/v1.13.9" }, - "time": "2021-07-28T17:14:56+00:00" + "time": "2021-11-12T13:44:49+00:00" }, { "name": "mustache/mustache", @@ -1028,20 +1305,20 @@ }, { "name": "psr/container", - "version": "1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", "shasum": "" }, "require": { - "php": ">=7.2.0" + "php": ">=7.4.0" }, "type": "library", "autoload": { @@ -1070,109 +1347,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.1" - }, - "time": "2021-03-05T17:36:06+00:00" - }, - { - "name": "psr/log", - "version": "1.1.4", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" - }, - "time": "2021-05-03T11:20:27+00:00" - }, - { - "name": "react/promise", - "version": "v2.8.0", - "source": { - "type": "git", - "url": "https://github.com/reactphp/promise.git", - "reference": "f3cff96a19736714524ca0dd1d4130de73dbbbc4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise/zipball/f3cff96a19736714524ca0dd1d4130de73dbbbc4", - "reference": "f3cff96a19736714524ca0dd1d4130de73dbbbc4", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^7.0 || ^6.5 || ^5.7 || ^4.8.36" - }, - "type": "library", - "autoload": { - "psr-4": { - "React\\Promise\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] + "source": "https://github.com/php-fig/container/tree/1.1.2" }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jan Sorgalla", - "email": "jsorgalla@gmail.com" - } - ], - "description": "A lightweight implementation of CommonJS Promises/A for PHP", - "keywords": [ - "promise", - "promises" - ], - "support": { - "issues": "https://github.com/reactphp/promise/issues", - "source": "https://github.com/reactphp/promise/tree/v2.8.0" - }, - "time": "2020-05-12T15:16:56+00:00" + "time": "2021-11-05T16:50:12+00:00" }, { "name": "rmccue/requests", @@ -1347,16 +1524,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.6.0", + "version": "3.6.1", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625" + "reference": "f268ca40d54617c6e06757f83f699775c9b3ff2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ffced0d2c8fa8e6cdc4d695a743271fab6c38625", - "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/f268ca40d54617c6e06757f83f699775c9b3ff2e", + "reference": "f268ca40d54617c6e06757f83f699775c9b3ff2e", "shasum": "" }, "require": { @@ -1399,30 +1576,30 @@ "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, - "time": "2021-04-09T00:54:41+00:00" + "time": "2021-10-11T04:00:11+00:00" }, { "name": "symfony/console", - "version": "v5.3.7", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "8b1008344647462ae6ec57559da166c2bfa5e16a" + "reference": "ec3661faca1d110d6c307e124b44f99ac54179e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/8b1008344647462ae6ec57559da166c2bfa5e16a", - "reference": "8b1008344647462ae6ec57559da166c2bfa5e16a", + "url": "https://api.github.com/repos/symfony/console/zipball/ec3661faca1d110d6c307e124b44f99ac54179e3", + "reference": "ec3661faca1d110d6c307e124b44f99ac54179e3", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php73": "^1.8", "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2", - "symfony/string": "^5.1" + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" }, "conflict": { "psr/log": ">=3", @@ -1437,12 +1614,12 @@ }, "require-dev": { "psr/log": "^1|^2", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/lock": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" }, "suggest": { "psr/log": "For using the console logger", @@ -1482,7 +1659,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.3.7" + "source": "https://github.com/symfony/console/tree/v5.4.0" }, "funding": [ { @@ -1498,20 +1675,20 @@ "type": "tidelift" } ], - "time": "2021-08-25T20:02:16+00:00" + "time": "2021-11-29T15:30:56+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.4.0", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627" + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/6f981ee24cf69ee7ce9736146d1c57c2780598a8", + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8", "shasum": "" }, "require": { @@ -1520,7 +1697,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -1549,7 +1726,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.0" }, "funding": [ { @@ -1565,25 +1742,26 @@ "type": "tidelift" } ], - "time": "2021-03-23T23:28:01+00:00" + "time": "2021-07-12T14:48:14+00:00" }, { "name": "symfony/filesystem", - "version": "v5.3.4", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "343f4fe324383ca46792cae728a3b6e2f708fb32" + "reference": "731f917dc31edcffec2c6a777f3698c33bea8f01" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/343f4fe324383ca46792cae728a3b6e2f708fb32", - "reference": "343f4fe324383ca46792cae728a3b6e2f708fb32", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/731f917dc31edcffec2c6a777f3698c33bea8f01", + "reference": "731f917dc31edcffec2c6a777f3698c33bea8f01", "shasum": "" }, "require": { "php": ">=7.2.5", "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8", "symfony/polyfill-php80": "^1.16" }, "type": "library", @@ -1612,7 +1790,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.3.4" + "source": "https://github.com/symfony/filesystem/tree/v5.4.0" }, "funding": [ { @@ -1628,24 +1806,25 @@ "type": "tidelift" } ], - "time": "2021-07-21T12:40:44+00:00" + "time": "2021-10-28T13:39:27+00:00" }, { "name": "symfony/finder", - "version": "v5.3.7", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "a10000ada1e600d109a6c7632e9ac42e8bf2fb93" + "reference": "d2f29dac98e96a98be467627bd49c2efb1bc2590" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/a10000ada1e600d109a6c7632e9ac42e8bf2fb93", - "reference": "a10000ada1e600d109a6c7632e9ac42e8bf2fb93", + "url": "https://api.github.com/repos/symfony/finder/zipball/d2f29dac98e96a98be467627bd49c2efb1bc2590", + "reference": "d2f29dac98e96a98be467627bd49c2efb1bc2590", "shasum": "" }, "require": { "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-php80": "^1.16" }, "type": "library", @@ -1674,7 +1853,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.3.7" + "source": "https://github.com/symfony/finder/tree/v5.4.0" }, "funding": [ { @@ -1690,7 +1869,7 @@ "type": "tidelift" } ], - "time": "2021-08-04T21:20:46+00:00" + "time": "2021-11-28T15:25:38+00:00" }, { "name": "symfony/polyfill-ctype", @@ -2180,16 +2359,16 @@ }, { "name": "symfony/process", - "version": "v5.3.7", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "38f26c7d6ed535217ea393e05634cb0b244a1967" + "reference": "5be20b3830f726e019162b26223110c8f47cf274" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/38f26c7d6ed535217ea393e05634cb0b244a1967", - "reference": "38f26c7d6ed535217ea393e05634cb0b244a1967", + "url": "https://api.github.com/repos/symfony/process/zipball/5be20b3830f726e019162b26223110c8f47cf274", + "reference": "5be20b3830f726e019162b26223110c8f47cf274", "shasum": "" }, "require": { @@ -2222,7 +2401,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.3.7" + "source": "https://github.com/symfony/process/tree/v5.4.0" }, "funding": [ { @@ -2238,25 +2417,29 @@ "type": "tidelift" } ], - "time": "2021-08-04T21:20:46+00:00" + "time": "2021-11-28T15:25:38+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.4.0", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb" + "reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc", + "reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc", "shasum": "" }, "require": { "php": ">=7.2.5", - "psr/container": "^1.1" + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1" + }, + "conflict": { + "ext-psr": "<1.1|>=2" }, "suggest": { "symfony/service-implementation": "" @@ -2264,7 +2447,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -2301,7 +2484,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/service-contracts/tree/v2.5.0" }, "funding": [ { @@ -2317,20 +2500,20 @@ "type": "tidelift" } ], - "time": "2021-04-01T10:43:52+00:00" + "time": "2021-11-04T16:48:04+00:00" }, { "name": "symfony/string", - "version": "v5.3.7", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5" + "reference": "9ffaaba53c61ba75a3c7a3a779051d1e9ec4fd2d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/8d224396e28d30f81969f083a58763b8b9ceb0a5", - "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5", + "url": "https://api.github.com/repos/symfony/string/zipball/9ffaaba53c61ba75a3c7a3a779051d1e9ec4fd2d", + "reference": "9ffaaba53c61ba75a3c7a3a779051d1e9ec4fd2d", "shasum": "" }, "require": { @@ -2341,11 +2524,14 @@ "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php80": "~1.15" }, + "conflict": { + "symfony/translation-contracts": ">=3.0" + }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0", - "symfony/http-client": "^4.4|^5.0", + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/http-client": "^4.4|^5.0|^6.0", "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0" + "symfony/var-exporter": "^4.4|^5.0|^6.0" }, "type": "library", "autoload": { @@ -2384,7 +2570,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.3.7" + "source": "https://github.com/symfony/string/tree/v5.4.0" }, "funding": [ { @@ -2400,7 +2586,7 @@ "type": "tidelift" } ], - "time": "2021-08-26T08:00:08+00:00" + "time": "2021-11-24T10:02:00+00:00" }, { "name": "wp-cli/cache-command", @@ -2747,16 +2933,16 @@ }, { "name": "wp-cli/db-command", - "version": "v2.0.14", + "version": "v2.0.17", "source": { "type": "git", "url": "https://github.com/wp-cli/db-command.git", - "reference": "6034921c7696865946ec0986f06b911c8a56ad3a" + "reference": "7cb7828e1619d03a9aa45df5cf82cb88b4029622" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/db-command/zipball/6034921c7696865946ec0986f06b911c8a56ad3a", - "reference": "6034921c7696865946ec0986f06b911c8a56ad3a", + "url": "https://api.github.com/repos/wp-cli/db-command/zipball/7cb7828e1619d03a9aa45df5cf82cb88b4029622", + "reference": "7cb7828e1619d03a9aa45df5cf82cb88b4029622", "shasum": "" }, "require": { @@ -2764,7 +2950,7 @@ }, "require-dev": { "wp-cli/entity-command": "^1.3 || ^2", - "wp-cli/wp-cli-tests": "^3.0.17" + "wp-cli/wp-cli-tests": "^3.1" }, "type": "wp-cli-package", "extra": { @@ -2815,9 +3001,9 @@ "homepage": "https://github.com/wp-cli/db-command", "support": { "issues": "https://github.com/wp-cli/db-command/issues", - "source": "https://github.com/wp-cli/db-command/tree/v2.0.14" + "source": "https://github.com/wp-cli/db-command/tree/v2.0.17" }, - "time": "2021-07-26T13:56:24+00:00" + "time": "2021-12-03T01:43:55+00:00" }, { "name": "wp-cli/embed-command", @@ -2888,16 +3074,16 @@ }, { "name": "wp-cli/entity-command", - "version": "v2.1.0", + "version": "v2.1.1", "source": { "type": "git", "url": "https://github.com/wp-cli/entity-command.git", - "reference": "9b3c030d5b056f3f7b8835e117139f92799340a9" + "reference": "0cbfaef4cb29a600431bbcf1bb5333d734e73a04" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/entity-command/zipball/9b3c030d5b056f3f7b8835e117139f92799340a9", - "reference": "9b3c030d5b056f3f7b8835e117139f92799340a9", + "url": "https://api.github.com/repos/wp-cli/entity-command/zipball/0cbfaef4cb29a600431bbcf1bb5333d734e73a04", + "reference": "0cbfaef4cb29a600431bbcf1bb5333d734e73a04", "shasum": "" }, "require": { @@ -2908,7 +3094,7 @@ "wp-cli/db-command": "^1.3 || ^2", "wp-cli/extension-command": "^1.2 || ^2", "wp-cli/media-command": "^1.1 || ^2", - "wp-cli/wp-cli-tests": "^3.0.11" + "wp-cli/wp-cli-tests": "^3.1" }, "type": "wp-cli-package", "extra": { @@ -3092,9 +3278,9 @@ "homepage": "https://github.com/wp-cli/entity-command", "support": { "issues": "https://github.com/wp-cli/entity-command/issues", - "source": "https://github.com/wp-cli/entity-command/tree/v2.1.0" + "source": "https://github.com/wp-cli/entity-command/tree/v2.1.1" }, - "time": "2021-05-11T15:55:07+00:00" + "time": "2021-12-02T23:54:50+00:00" }, { "name": "wp-cli/eval-command", @@ -3156,16 +3342,16 @@ }, { "name": "wp-cli/export-command", - "version": "v2.0.9", + "version": "v2.0.10", "source": { "type": "git", "url": "https://github.com/wp-cli/export-command.git", - "reference": "b32d4324e110901cedd8a663bea5563b7e332c44" + "reference": "05c4af9903e39d808f55960b9b6875652438bba8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/export-command/zipball/b32d4324e110901cedd8a663bea5563b7e332c44", - "reference": "b32d4324e110901cedd8a663bea5563b7e332c44", + "url": "https://api.github.com/repos/wp-cli/export-command/zipball/05c4af9903e39d808f55960b9b6875652438bba8", + "reference": "05c4af9903e39d808f55960b9b6875652438bba8", "shasum": "" }, "require": { @@ -3178,7 +3364,7 @@ "wp-cli/extension-command": "^1.2 || ^2", "wp-cli/import-command": "^1 || ^2", "wp-cli/media-command": "^1 || ^2", - "wp-cli/wp-cli-tests": "^3.0.11" + "wp-cli/wp-cli-tests": "^3.1" }, "type": "wp-cli-package", "extra": { @@ -3213,9 +3399,9 @@ "homepage": "https://github.com/wp-cli/export-command", "support": { "issues": "https://github.com/wp-cli/export-command/issues", - "source": "https://github.com/wp-cli/export-command/tree/v2.0.9" + "source": "https://github.com/wp-cli/export-command/tree/v2.0.10" }, - "time": "2021-07-25T17:00:42+00:00" + "time": "2021-12-03T02:47:38+00:00" }, { "name": "wp-cli/extension-command", @@ -3518,23 +3704,23 @@ }, { "name": "wp-cli/maintenance-mode-command", - "version": "v2.0.6", + "version": "v2.0.7", "source": { "type": "git", "url": "https://github.com/wp-cli/maintenance-mode-command.git", - "reference": "26c1c0a79ed1194c863cb95fa364b4db7929d7cc" + "reference": "02f03b83c99721a0a61c478c13886222ea916737" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/maintenance-mode-command/zipball/26c1c0a79ed1194c863cb95fa364b4db7929d7cc", - "reference": "26c1c0a79ed1194c863cb95fa364b4db7929d7cc", + "url": "https://api.github.com/repos/wp-cli/maintenance-mode-command/zipball/02f03b83c99721a0a61c478c13886222ea916737", + "reference": "02f03b83c99721a0a61c478c13886222ea916737", "shasum": "" }, "require": { "wp-cli/wp-cli": "^2.5" }, "require-dev": { - "wp-cli/wp-cli-tests": "^3.0.11" + "wp-cli/wp-cli-tests": "^3.1" }, "type": "wp-cli-package", "extra": { @@ -3573,9 +3759,9 @@ "homepage": "https://github.com/wp-cli/maintenance-mode-command", "support": { "issues": "https://github.com/wp-cli/maintenance-mode-command/issues", - "source": "https://github.com/wp-cli/maintenance-mode-command/tree/v2.0.6" + "source": "https://github.com/wp-cli/maintenance-mode-command/tree/v2.0.7" }, - "time": "2021-05-10T10:23:08+00:00" + "time": "2021-12-03T02:48:06+00:00" }, { "name": "wp-cli/media-command", @@ -3692,26 +3878,26 @@ }, { "name": "wp-cli/package-command", - "version": "v2.1.1", + "version": "v2.1.2", "source": { "type": "git", "url": "https://github.com/wp-cli/package-command.git", - "reference": "2e345df6c67d4f9b4bf42ce12a7fa07b2b44399d" + "reference": "07600529cbb03a0319908b8082fb85662502f751" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/package-command/zipball/2e345df6c67d4f9b4bf42ce12a7fa07b2b44399d", - "reference": "2e345df6c67d4f9b4bf42ce12a7fa07b2b44399d", + "url": "https://api.github.com/repos/wp-cli/package-command/zipball/07600529cbb03a0319908b8082fb85662502f751", + "reference": "07600529cbb03a0319908b8082fb85662502f751", "shasum": "" }, "require": { - "composer/composer": ">=1.2.0 <1.7.0 || ^1.7.1 || ^2.0.0", + "composer/composer": "^1.10.23 || ^2.1.9", "ext-json": "*", "wp-cli/wp-cli": "^2.5" }, "require-dev": { "wp-cli/scaffold-command": "^1 || ^2", - "wp-cli/wp-cli-tests": "^3.0.11" + "wp-cli/wp-cli-tests": "^3.1" }, "type": "wp-cli-package", "extra": { @@ -3751,9 +3937,9 @@ "homepage": "https://github.com/wp-cli/package-command", "support": { "issues": "https://github.com/wp-cli/package-command/issues", - "source": "https://github.com/wp-cli/package-command/tree/v2.1.1" + "source": "https://github.com/wp-cli/package-command/tree/v2.1.2" }, - "time": "2021-05-12T17:09:23+00:00" + "time": "2021-12-02T23:45:08+00:00" }, { "name": "wp-cli/php-cli-tools", @@ -4240,16 +4426,16 @@ }, { "name": "wp-cli/widget-command", - "version": "v2.1.5", + "version": "v2.1.6", "source": { "type": "git", "url": "https://github.com/wp-cli/widget-command.git", - "reference": "5ffe7bc380a7b3cc2d96ac545fcbd8b1739b79d1" + "reference": "8d225ad344b1a0cea1eeeecef1bd553a4b92f21f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/widget-command/zipball/5ffe7bc380a7b3cc2d96ac545fcbd8b1739b79d1", - "reference": "5ffe7bc380a7b3cc2d96ac545fcbd8b1739b79d1", + "url": "https://api.github.com/repos/wp-cli/widget-command/zipball/8d225ad344b1a0cea1eeeecef1bd553a4b92f21f", + "reference": "8d225ad344b1a0cea1eeeecef1bd553a4b92f21f", "shasum": "" }, "require": { @@ -4257,7 +4443,7 @@ }, "require-dev": { "wp-cli/extension-command": "^1.2 || ^2", - "wp-cli/wp-cli-tests": "^3.0.11" + "wp-cli/wp-cli-tests": "^3.1" }, "type": "wp-cli-package", "extra": { @@ -4301,9 +4487,9 @@ "homepage": "https://github.com/wp-cli/widget-command", "support": { "issues": "https://github.com/wp-cli/widget-command/issues", - "source": "https://github.com/wp-cli/widget-command/tree/v2.1.5" + "source": "https://github.com/wp-cli/widget-command/tree/v2.1.6" }, - "time": "2021-07-26T16:11:11+00:00" + "time": "2021-12-03T02:48:34+00:00" }, { "name": "wp-cli/wp-cli", diff --git a/includes/class-rotaract-appointments.php b/includes/class-rotaract-appointments.php index 3db0d4b..f4f1a2e 100644 --- a/includes/class-rotaract-appointments.php +++ b/includes/class-rotaract-appointments.php @@ -169,7 +169,7 @@ private function define_admin_hooks() { $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); - if ( ! $this->elastic_caller->isset_elastic_host() ) { + if ( ! $this->elastic_caller->isset_client() ) { $this->loader->add_action( 'admin_notices', $plugin_admin, 'elastic_missing_notice' ); } $this->loader->add_action( 'admin_init', $plugin_admin, 'admin_init' ); diff --git a/includes/class-rotaract-elastic-caller.php b/includes/class-rotaract-elastic-caller.php index 71031e7..0acfbb6 100644 --- a/includes/class-rotaract-elastic-caller.php +++ b/includes/class-rotaract-elastic-caller.php @@ -9,6 +9,9 @@ * @subpackage Rotaract_Appointments/includes */ +use Elasticsearch\Client; +use Elasticsearch\ClientBuilder; + /** * Interface functions to receive data from Elasticsearch API. * @@ -21,63 +24,51 @@ class Rotaract_Elastic_Caller { /** - * The host URL auf the Elasticsearch instance containing Rotaract events. + * The elasticsearch API client instance. * * @since 1.0.0 * @access private - * @var string $elastic_host The host URL auf the Elasticsearch instance containing Rotaract events. + * @var Client $client The elasticsearch API client instance. */ - private string $elastic_host; + private Client $client; /** * Set the Elasticsearch host URL if defined. * - * @since 1.0.0 + * @since 2.0.0 */ public function __construct() { - if ( defined( 'ROTARACT_ELASTIC_HOST' ) ) { - $this->elastic_host = trailingslashit( ROTARACT_ELASTIC_HOST ); + if ( defined( 'ROTARACT_APPOINTMENTS_CLOUD_ID' ) && + defined( 'ROTARACT_APPOINTMENTS_API_ID' ) && + defined( 'ROTARACT_APPOINTMENTS_API_KEY' ) ) { + $this->client = ClientBuilder::create() + ->setElasticCloudId( ROTARACT_APPOINTMENTS_CLOUD_ID ) + ->setApiKey( ROTARACT_APPOINTMENTS_API_ID, ROTARACT_APPOINTMENTS_API_KEY ) + ->build(); } } /** - * Receive appointments from elestic that match the search_param. - * - * @param String $api_path absolute API path. - * @param String $search_param API attributes in JSON format. + * Check if Elasticsearch host URL is set. * - * @return array of appointments + * @since 1.0.0 + * @return boolean */ - private function elastic_request( string $api_path, string $search_param ): array { - if ( ! $this->isset_elastic_host() ) { - return array(); - } - $url = $this->elastic_host . $api_path; - $header = array( - 'Content-Type' => 'application/json', - ); - - $res = wp_remote_post( - $url, - array( - 'headers' => $header, - 'body' => $search_param, - ) - ); - $res_body = wp_remote_retrieve_body( $res ); - - $result = json_decode( $res_body )->hits->hits; - return $result ?: array(); + public function isset_client(): bool { + return isset( $this->client ); } - /** - * Check if Elasticsearch host URL is set. + * Receive appointments from elestic that match the search_param. * - * @return boolean + * @param array $params Search query. + * @return array of appointments */ - public function isset_elastic_host(): bool { - return isset( $this->elastic_host ); + private function elastic_request( array $params ): array { + if ( ! $this->isset_client() ) { + return array(); + } + return $this->client->search( $params )['hits']['hits']; } /** @@ -88,27 +79,29 @@ public function isset_elastic_host(): bool { * @return array of appointments */ public function get_appointments( array $appointment_owner ): array { - $path = 'events/_search'; - $search_param = array( - 'size' => '100', - 'query' => array( - 'bool' => array( - 'filter' => array( - array( - 'match' => array( - 'publish_on_homepage' => true, + $params = array( + 'index' => 'events', + 'body' => array( + 'size' => '100', + 'query' => array( + 'bool' => array( + 'filter' => array( + array( + 'match' => array( + 'publish_on_homepage' => true, + ), ), - ), - array( - 'terms' => array( - 'owner_select_names.keyword' => $appointment_owner, + array( + 'terms' => array( + 'owner_select_names.keyword' => $appointment_owner, + ), ), - ), - array( - 'range' => array( - 'begins_at' => array( - 'gte' => 'now-1y/y', - 'lte' => 'now+2y/y', + array( + 'range' => array( + 'begins_at' => array( + 'gte' => 'now-1y/y', + 'lte' => 'now+2y/y', + ), ), ), ), @@ -117,7 +110,7 @@ public function get_appointments( array $appointment_owner ): array { ), ); - return $this->elastic_request( $path, wp_json_encode( $search_param ) ); + return $this->elastic_request( $params ); } /** @@ -126,21 +119,23 @@ public function get_appointments( array $appointment_owner ): array { * @return array of appointments */ public function get_all_clubs(): array { - $path = 'clubs/_search'; - $search_param = array( - '_source' => array( - 'select_name', - 'district_name', - ), - 'size' => '250', - 'query' => array( - 'constant_score' => array( - 'filter' => array( - 'terms' => array( - 'status' => array( - 'active', - 'founding', - 'preparing', + $params = array( + 'index' => 'clubs', + 'body' => array( + '_source' => array( + 'select_name', + 'district_name', + ), + 'size' => '250', + 'query' => array( + 'constant_score' => array( + 'filter' => array( + 'terms' => array( + 'status' => array( + 'active', + 'founding', + 'preparing', + ), ), ), ), @@ -148,7 +143,7 @@ public function get_all_clubs(): array { ), ); - $res = $this->elastic_request( $path, wp_json_encode( $search_param ) ); + $res = $this->elastic_request( $params ); // Unwrap array of club objects. return array_map( fn( object $club ): string => $club->_source->select_name, $res ); @@ -160,15 +155,17 @@ public function get_all_clubs(): array { * @return array of appointments */ public function get_all_ressorts(): array { - $path = 'ressorts/_search'; - $search_param = array( - '_source' => array( - 'select_name', + $params = array( + 'index' => 'ressorts', + 'body' => array( + '_source' => array( + 'select_name', + ), + 'size' => '20', ), - 'size' => '20', ); - $res = $this->elastic_request( $path, wp_json_encode( $search_param ) ); + $res = $this->elastic_request( $params ); // Unwrap array of ressort objects. return array_map( fn( object $ressort ): string => $ressort->_source->select_name, $res ); @@ -180,17 +177,19 @@ public function get_all_ressorts(): array { * @return array of appointments */ public function get_all_districts(): array { - $path = 'districts/_search'; - $search_param = array( - '_source' => array( - 'select_name', + $params = array( + 'index' => 'districts', + 'body' => array( + '_source' => array( + 'select_name', + ), + 'size' => '20', ), - 'size' => '20', ); - $res = $this->elastic_request( $path, wp_json_encode( $search_param ) ); + $res = $this->elastic_request( $params ); - // Unwrap array of district objects. + // Unwrap array of ressort objects. return array_map( fn( object $district ): string => $district->_source->select_name, $res ); } diff --git a/public/class-rotaract-appointments-public.php b/public/class-rotaract-appointments-public.php index bbc0c7c..b459975 100644 --- a/public/class-rotaract-appointments-public.php +++ b/public/class-rotaract-appointments-public.php @@ -181,7 +181,7 @@ function ( $o ) { $owner_appointments = array_filter( $appointments, function ( $a ) use ( $owner ) { - return in_array( $owner['name'], $a->_source->owner_select_names, true ); + return in_array( $owner['name'], $a['_source']['owner_select_names'], true ); } ); @@ -200,19 +200,19 @@ function ( $a ) use ( $owner ) { /** * Creates fullcalendar events from search results. * - * @param object $appointment Appointment object from search results. + * @param array $appointment Appointment object from search results. * * @return array in form of a fullcalendar event. */ - private function create_event( object $appointment ): array { + private function create_event( array $appointment ): array { return array( - 'title' => $appointment->_source->title, - 'start' => wp_date( 'Y-m-d\TH:i', strtotime( $appointment->_source->begins_at ) ), - 'end' => wp_date( 'Y-m-d\TH:i', strtotime( $appointment->_source->ends_at ) ), - 'allDay' => $appointment->_source->all_day, - 'address' => $appointment->_source->address, - 'description' => $this->parser->text( $appointment->_source->description ), - 'owner' => $appointment->_source->owner_select_names, + 'title' => $appointment['_source']['title'], + 'start' => wp_date( 'Y-m-d\TH:i', strtotime( $appointment['_source']['begins_at'] ) ), + 'end' => wp_date( 'Y-m-d\TH:i', strtotime( $appointment['_source']['ends_at'] ) ), + 'allDay' => $appointment['_source']['all_day'], + 'address' => $appointment['_source']['address'], + 'description' => $this->parser->text( $appointment['_source']['description'] ), + 'owner' => $appointment['_source']['owner_select_names'], ); }