From f58248a8e7ffa83c060d286e370682aef7eebf0a Mon Sep 17 00:00:00 2001 From: Duskell Date: Tue, 17 Mar 2026 13:47:55 +0100 Subject: [PATCH] finished comment integration, it should be working now --- .../class-partnerexpo-core-integrations.php | 8 +- .../class-partnerexpo-core-user-fields.php | 61 ++- includes/class-partnerexpo-core.php | 12 +- includes/mc-integrations/com-form.php | 188 ++++++++- includes/utils/class-crm-client.php | 362 ++++++++++++++++++ partnerexpo-core.php | 4 +- public/class-partnerexpo-core-public.php | 12 +- public/css/comments.css | 26 +- public/js/comments.js | 10 + .../partnerexpo-core-public-comments.php | 35 +- 10 files changed, 689 insertions(+), 29 deletions(-) create mode 100644 includes/utils/class-crm-client.php create mode 100644 public/js/comments.js diff --git a/includes/class-partnerexpo-core-integrations.php b/includes/class-partnerexpo-core-integrations.php index 1518321..a33c25b 100644 --- a/includes/class-partnerexpo-core-integrations.php +++ b/includes/class-partnerexpo-core-integrations.php @@ -1,7 +1,7 @@ add_action( 'comment_post', Partnerexpo_Core_Integration_Comment_Form::class, 'queue_up', 10, 3 ); - $loader->add_action( 'process_comment_data', Partnerexpo_Core_Integration_Comment_Form::class, 'run_process', 10, 1 ); + $comment_form_integration = new Partnerexpo_Core_Integration_Comment_Form($crm_client); + + $loader->add_action( 'comment_post', $comment_form_integration, 'queue_up', 10, 3 ); + $loader->add_action( 'process_comment_data', $comment_form_integration, 'run_process', 10, 1 ); } } \ No newline at end of file diff --git a/includes/class-partnerexpo-core-user-fields.php b/includes/class-partnerexpo-core-user-fields.php index aa3b529..a5f4b4d 100644 --- a/includes/class-partnerexpo-core-user-fields.php +++ b/includes/class-partnerexpo-core-user-fields.php @@ -173,11 +173,62 @@ class Partnerexpo_Core_User_Fields extends Partnerexpo_Core { wp_die( sprintf('%s: %s',__( 'Error', 'partnerexpo-core' ),__( 'Cég megadása kötelező!', 'partnerexpo-core' ) ) ); return false; } - add_comment_meta( - $id, - 'company', - sanitize_text_field($_POST['company']) - ); + + if ( isset($_POST['last_name']) ) { + add_comment_meta( + $id, + 'last_name', + sanitize_text_field($_POST['last_name']) + ); + } + + if ( isset($_POST['first_name']) ) { + add_comment_meta( + $id, + 'first_name', + sanitize_text_field($_POST['first_name']) + ); + } + + if ( isset($_POST['mail']) ) { + add_comment_meta( + $id, + 'mail', + sanitize_text_field($_POST['mail']) + ); + } + + if ( isset($_POST['phone']) ) { + add_comment_meta( + $id, + 'phone', + sanitize_text_field($_POST['phone']) + ); + } + + if ( isset($_POST['company']) ) { + add_comment_meta( + $id, + 'company', + sanitize_text_field($_POST['company']) + ); + } + + if ( isset($_POST['gdpr']) ) { + add_comment_meta( + $id, + 'gdpr', + sanitize_text_field($_POST['gdpr']) + ); + } + + if ( isset($_POST['newsletter']) ) { + add_comment_meta( + $id, + 'newsletter', + sanitize_text_field($_POST['newsletter']) + ); + } return true; } } diff --git a/includes/class-partnerexpo-core.php b/includes/class-partnerexpo-core.php index bdcb413..d014db0 100644 --- a/includes/class-partnerexpo-core.php +++ b/includes/class-partnerexpo-core.php @@ -126,10 +126,19 @@ class Partnerexpo_Core { */ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/utils/class-query-w-relevance.php'; + include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/utils/class-crypto.php'; + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/utils/class-logger.php'; + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/utils/class-crm-client.php'; + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-partnerexpo-core-integrations.php'; + /** + * Action scheduler, used for scheduling comment processing. + */ + require_once( plugin_dir_path( dirname( __FILE__ ) ) . '/libraries/action-scheduler/action-scheduler.php' ); + /** * The class responsible for registering custom user fields. */ @@ -143,8 +152,9 @@ class Partnerexpo_Core { public function setup() { Logger::init("PartnerEXPO Core", __("Megjegyezve, elrejtés", 'partnerexpo-core'), 'partnerexpo-core'); + $crm_client = new CRMClient(Crypto::encryptSecret(CRM_AUTH)); - Partnerexpo_Core_Integrations::add_hooks( $this->loader ); + Partnerexpo_Core_Integrations::add_hooks( $this->loader, $crm_client ); $user_fields = new Partnerexpo_Core_User_Fields( $this->loader ); diff --git a/includes/mc-integrations/com-form.php b/includes/mc-integrations/com-form.php index 38ed6f8..cc4426b 100644 --- a/includes/mc-integrations/com-form.php +++ b/includes/mc-integrations/com-form.php @@ -7,7 +7,7 @@ * @since 1.1.11 * * @package Partnerexpo_Core - * @subpackage Partnerexpo_Core/includes/mc-integrations + * @compackage Partnerexpo_Core/includes/mc-integrations */ if ( ! defined( 'WPINC' ) ) { @@ -15,13 +15,191 @@ if ( ! defined( 'WPINC' ) ) { } class Partnerexpo_Core_Integration_Comment_Form { - public static function queue_up($comment_id, $comment_approved, $commentdata) { + private $client; + + public function __construct($crm_client) { + $this->client = $crm_client; + } + + public function queue_up($comment_id, $comment_approved, $commentdata) { as_schedule_single_action( time() + 60, 'process_comment_data', [ $comment_id ] ); } - public static function run_process($comment_id) { - Logger::log('data', $comment_id); + public function run_process($comment_id) { + # DATA # + $crm_user_id = "Kotlárik Diána, Ügyfélszolgálat"; + $category_id = 98; + $deadline = date("Y-m-d"); + $com_id_text = __("Komment azonosító", "partnerexpo-core"); + $task_message = __("Új visszajelzés érkezett a(z) %s oldalra!\n\nVisszajelzés tartalma:\n%s\n\nEzen a linken tudod megtekinteni a visszajelzést a WordPress adminban: %s", "partnerexpo-core"); + $error_text = __("hiba", "partnerexpo-core"); + $gdpr_value = 1; + $newsletter_value = 1; + # # # # # + try { + + + if ( ! $this->client ) { + Logger::log(__("MiniCRM Kliens nem található, Szinkronizálás megszakítása!", 'partnerexpo-core'), [$com_id_text => $comment_id]); + return; + } + + $com_data = get_comment($comment_id, ARRAY_A); + + $data = [ + 'firstName' => get_comment_meta($comment_id, 'first_name', true) ?? '', + 'lastName' => get_comment_meta($comment_id, 'last_name', true) ?? '', + 'company' => get_comment_meta($comment_id, 'company', true) ?? '', + 'email' => get_comment_meta($comment_id, 'mail', true) ?? '', + 'phone' => get_comment_meta($comment_id, 'phone', true) ?? '', + 'content' => get_comment_text($comment_id) ?? '', + 'postTitle' => get_the_title($com_data['comment_post_ID']) ?? '', + 'editLink' => get_edit_comment_link($comment_id) ?? '', + 'gdpr' => get_comment_meta($comment_id, 'gdpr', true) ?? '', + 'newsletter' => get_comment_meta($comment_id, 'newsletter', true) ?? '', + ]; + + # Task messages # + + $message = sprintf($task_message, $data['postTitle'] ?? __("Nincs cím megadva!", "partnerexpo-core"), $data['content'] ?: __("Nincs leírás megadva!", "partnerexpo-core"), $data['editLink'] ?? __("Szerkesztési link nem elérhető!", "partnerexpo-core")); + + # # # # # # # # # + + if (empty($data['email'])) { + Logger::log(__("Email nincs megadva, lekérdezés nem lehetséges!", "partnerexpo-core"), [$com_id_text => $comment_id, 'data' => $data]); + return; + } + + $user_exists = $this->client->get('Contact', ['Email' => $data['email']]); + if ( ! is_array($user_exists) ) { + Logger::log(__("Kontakt létezésének lekérése sikertelen!", "partnerexpo-core"), [$com_id_text => $comment_id, 'email' => $data['email'], $error_text => $this->client->getLastError()]); + return; + } + + $user_id = 0; + $has_company = true; + + if ($user_exists['Count'] == 0) { + $new_contact = $this->client->put('Contact', [ + 'FirstName' => $data['firstName'], + 'LastName' => $data['lastName'], + 'Email' => $data['email'], + 'Phone' => $data['phone'], + 'Type' => "Person" + ]); + if ( ! is_array($new_contact) || ! isset($new_contact['Id']) ) { + Logger::log(__("Kontakt létrehozása sikertelen!", "partnerexpo-core"), [$com_id_text => $comment_id, 'email' => $data['email'], $error_text => $this->client->getLastError()]); + return; + } + $user_id = $new_contact['Id']; + $has_company = false; + } else { + $user_id = array_key_first($user_exists['Results']); + $existing_contact = $this->client->get('Contact/'.$user_id); + if ( ! is_array($existing_contact) || ! isset($existing_contact['id']) ) { + Logger::log(__("Kontakt adatok lekérése sikertelen!", "partnerexpo-core"), [$com_id_text => $comment_id, 'contact_id' => $user_id, $error_text => $this->client->getLastError()]); + return; + } + if (!isset($existing_contact['BusinessId']) || empty($existing_contact['BusinessId'])) { + $has_company = false; + } + + } + + if ( ! $user_id ) { + Logger::log(__("Kontakt azonosító hiányzik lekérés/létrehozás után is!", "partnerexpo-core"), [$com_id_text => $comment_id, 'email' => $data['email']]); + return; + } + + if ( ! $has_company ) { + $comp_exists = $this->client->get('Contact', ['Name' => $data['company'], 'Type' => 'Business']); + if ( ! is_array($user_exists) ) { + Logger::log(__("Kontakt létezésének lekérése sikertelen!", "partnerexpo-core"), [$com_id_text => $comment_id, 'email' => $data['email'], $error_text => $this->client->getLastError()]); + return; + } + + $comp_id = 0; + + if ($comp_exists['Count'] == 0) { + $new_comp = $this->client->put('Contact', [ + 'Name' => $data['company'], + 'ContactId' => $user_id, + 'Type' => "Business" + ]); + if ( ! is_array($new_comp) || ! isset($new_comp['Id']) ) { + Logger::log(__("Cég létrehozása sikertelen!", "partnerexpo-core"), [$com_id_text => $comment_id, 'email' => $data['email'], $error_text => $this->client->getLastError()]); + return; + } + $comp_id = $new_comp['Id']; + } else { + $comp_id = array_key_first($comp_exists['Results']); + } + + $updated_contact = $this->client->put('Contact/'.$user_id, [ + 'BusinessId' => $comp_id + ]); + } + + if ( ! $comp_id ) { + Logger::log(__("Cég azonosító hiányzik lekérés/létrehozás után is!", "partnerexpo-core"), [$com_id_text => $comment_id, 'email' => $data['email']]); + return; + } + + $card_exists = $this->client->get('Project', ['CategoryId' => $category_id, 'ContactId' => $user_id]); + if ( ! is_array($card_exists) ) { + Logger::log(__("Adatlap adatok lekérése sikertelen:", "partnerexpo-core"), [$com_id_text => $comment_id, 'contact_id' => $user_id, $error_text => $this->client->getLastError()]); + return; + } + + $card_id = 0; + + + if ($card_exists['Count'] == 0) { + $payload = [ + 'CategoryId' => $category_id, + 'ContactId' => $user_id, + 'Name' => $data['lastName']. " " .$data['firstName'], + 'UserId' => $crm_user_id, + 'GdprNyilatkozat4' => ($data['gdpr'] === 'on') ? 1 : '', + 'ModeratorRendszerepitoHirlevel2' => ($data['newsletter'] === 'on') ? 1 : '' + ]; + + $new_card = $this->client->put('Project', $payload); + if ( ! is_array($new_card) || ! array_key_exists('Id', $new_card) ) { + Logger::log(__("Adatlap létrehozás sikertelen:", "partnerexpo-core"), [$com_id_text => $comment_id, 'contact_id' => $user_id, $error_text => $this->client->getLastError()]); + return; + } + $card_id = $new_card['Id']; + + $result = $this->client->put('ToDo', [ + 'UserId' => $crm_user_id, + 'ProjectId' => $card_id, + 'Comment' => $message, + 'Deadline' => $deadline, + ]); + + if ( ! is_array($result) ) { + Logger::log(__("Teendő létrehozása sikertelen létező adatlap esetén!", "partnerexpo-core"), [$com_id_text => $comment_id, 'project_id' => $card_id, $error_text => $this->client->getLastError()]); + } + } else { + $card_id = array_key_first($card_exists['Results']); + + $result = $this->client->put('ToDo', [ + 'UserId' => $crm_user_id, + 'ProjectId' => $card_id, + 'Comment' => $message, + 'Deadline' => $deadline, + ]); + + if ( ! is_array($result) ) { + Logger::log(__("Teendő létrehozása sikertelen létező adatlap esetén!", "partnerexpo-core"), [$com_id_text => $comment_id, 'project_id' => $card_id, $error_text => $this->client->getLastError()]); + } + } + } catch ( Exception $e ) { + Logger::log(__("Ismeretlen hiba történt a szinkronizálás során!", "partnerexpo-core"), [$com_id_text => $comment_id, 'exception' => $e->getMessage()]); + } } -} \ No newline at end of file +} + diff --git a/includes/utils/class-crm-client.php b/includes/utils/class-crm-client.php new file mode 100644 index 0000000..7c6dcbd --- /dev/null +++ b/includes/utils/class-crm-client.php @@ -0,0 +1,362 @@ + + * + * Based on work by Drew McLellan + * Source: https://github.com/drewm/mailchimp-api + */ +class CRMClient { + public const VERSION = '1.1'; + + private $auth; + private $model = "MiniCRM"; + private $api_endpoint = 'https://r3.minicrm.hu/Api/R3'; + + /* SSL Verification + Read before disabling: + http://snippets.webaware.com.au/howto/stop-turning-off-curlopt_ssl_verifypeer-and-fix-your-php-config/ + */ + public $verify_ssl = true; + + private $request_successful = false; + private $last_error = ''; + private $last_response = []; + private $last_request = []; + private $last_http_status = 418; + + public function __construct($auth, $model = null, $endpoint = null ) { + $this->auth = $auth; + $this->last_response = ['headers' => null, 'body' => null]; + $this->model = $model ?? $this->model; + + if ( $endpoint ) { + $this->api_endpoint = $endpoint; + } elseif ( $model === 'Vera' ) { + $this->api_endpoint = 'https://api.rendszerepito.hu/R3'; + } + } + + public function getApiEndpoint() { + return $this->api_endpoint; + } + + /** + * Was the last message successfull + * + * @return bool True for success, false for failure + */ + public function success() { + return $this->request_successful; + } + + public function getLastError() { + return $this->last_error ?: false; + } + + /** + * Get an array containing the HTTP headers and body of the API request + * + * @return array assoc array with keys 'headers' and 'body' + */ + public function getLastResponse() { + return $this->last_response; + } + + /** + * Get the HTTP status of the last response + * + * @return array int + */ + public function getLastStatus() { + return $this->last_http_status; + } + + public function get($method, $args = []) { + return $this->makeRequest('get', $method, $args); + } + + public function put($method, $args = []) { + return $this->makeRequest('put', $method, $args); + } + + public function post($method, $args = []) { + return $this->makeRequest('post', $method, $args); + } + + + private function makeRequest($http_verb, $method, $args = []) { + if (! function_exists('curl_init') || ! function_exists('curl_setopt')) { + throw new \Exception("cURL support is required, but can't be found!"); + } + + $url = $this->api_endpoint . '/' . $method; + + $response = $this->prepareStateForRequest($http_verb, $method, $url); + + $httpHeader = [ + 'Accept: application/json', + ]; + + if (!empty($args)) { + $httpHeader[] = 'Content-Type: application/json'; + } + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + if ($this-> model == 'MiniCRM') {curl_setopt($ch, CURLOPT_USERPWD, Crypto::decryptSecret($this->auth));} + elseif ($this-> model === 'Vera') {$httpHeader[] = 'Authorization: Bearer '.Crypto::decryptSecret($this->auth);} + curl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeader); + curl_setopt($ch, CURLOPT_USERAGENT, 'Levente-CRMClient/'. self::VERSION); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_VERBOSE, true); + curl_setopt($ch, CURLOPT_HEADER, true); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->verify_ssl); + curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + curl_setopt($ch, CURLOPT_ENCODING, ''); + curl_setopt($ch, CURLINFO_HEADER_OUT, true); + + switch ($http_verb) { + case 'get': + if (!empty($args)) { + $query = http_build_query($args, '', '&'); + curl_setopt($ch, CURLOPT_URL, $url . '?' . $query); + } else { + curl_setopt($ch, CURLOPT_URL, $url); + } + + break; + case 'put': + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); + $this->attachRequestPayload($ch, $args); + break; + case 'post': + curl_setopt($ch, CURLOPT_POST, true); + $this->attachRequestPayload($ch, $args); + break; + } + + $responseContent = curl_exec($ch); + $response['headers'] = curl_getinfo($ch); + $response = $this->setResponseState($response, $responseContent, $ch); + $formattedResponse = $this->formatResponse($response); + + curl_close($ch); + + $this->determineSuccess($response, $formattedResponse); + + return $formattedResponse; + } + + /** + * @param string $http_verb + * @param string $method + * @param string $url + */ + private function prepareStateForRequest($http_verb, $method, $url) { + $this->last_error = ''; + + $this->request_successful = false; + + $this->last_response = [ + 'headers' => null, + 'httpHeaders' => null, + 'body' => null, + ]; + + $this->last_request = [ + 'method' => $http_verb, + 'path' => $method, + 'url' => $url, + 'body' => '', + ]; + + return $this->last_response; + } + + /** + * Get the HTTP headers as an array of header-name => header-value pairs. + * + * The "Link" header is parsed into an associative array based on the + * rel names it contains. The original value is available under + * the "_raw" key. + * + * @param string $headersAsString + * + * @return array + */ + private function getHeadersAsArray($headersAsString) + { + $headers = []; + + foreach (explode("\r\n", $headersAsString) as $i => $line) { + if (0 === $i) { // HTTP code + continue; + } + + $line = trim($line); + if (empty($line)) { + continue; + } + + if (strpos($line, ':') === false) { + continue; + } + + list($key, $value) = array_pad(explode(':', $line, 2), 2, ''); + $key = trim($key); + $value = trim($value); + + if ('Link' == $key) { + $value = array_merge( + ['_raw' => $value], + $this->getLinkHeaderAsArray($value) + ); + } + + $headers[$key] = $value; + } + + return $headers; + } + + /** + * Encode the data and attach it to the request + * + * @param resource $ch cURL session handle, used by reference + * @param array $data Assoc array of data to attach + */ + private function attachRequestPayload($ch, $data) + { + $encoded = json_encode($data); + $this->last_request['body'] = $encoded; + curl_setopt($ch, CURLOPT_POSTFIELDS, $encoded); + } + + /** + * Decode the response and format any error messages for debugging + * + * @param array $response The response from the curl request + * + * @return array|false The JSON decoded into an array + */ + private function formatResponse($response) + { + $this->last_response = $response; + + $message = null; + if (!empty($response['body'])) { + $decoded = json_decode($response['body'], true); + if (json_last_error() === JSON_ERROR_NONE) { + $message = $decoded; + } else { + $message = $response['body']; + } + } + + return $message; + } + + /** + * Extract all rel => URL pairs from the provided Link header value + * + * @param string $linkHeaderAsString + * + * @return array + */ + private function getLinkHeaderAsArray($linkHeaderAsString) + { + $urls = []; + + if (preg_match_all('/<(.*?)>\s*;\s*rel="(.*?)"\s*/', $linkHeaderAsString, $matches)) { + foreach ($matches[2] as $i => $relName) { + $urls[$relName] = $matches[1][$i]; + } + } + + return $urls; + } + + + + /** + * Do post-request formatting and setting state from the response + * + * @param array $response The response from the curl request + * @param string $responseContent The body of the response from the curl request + * + * * @return array The modified response + */ + private function setResponseState($response, $responseContent, $ch) + { + if (false === $responseContent) { + $this->last_error = curl_error($ch); + } else { + $headerSize = $response['headers']['header_size']; + $response['httpHeaders'] = $this->getHeadersAsArray(substr($responseContent, 0, $headerSize)); + $response['body'] = substr($responseContent, $headerSize); + + if (isset($response['headers']['request_header'])) { + $this->last_request['headers'] = $response['headers']['request_header']; + } + } + + return $response; + } + + /** + * Check if the response was successful or a failure. If it failed, store the error. + * + * @param array $response The response from the curl request + * @param array|false $formattedResponse The response body payload from the curl request + * + * @return bool If the request was successful + */ + private function determineSuccess($response, $formattedResponse) + { + $status = $this->findHTTPStatus($response, $formattedResponse); + + $this->last_http_status = $status; + + if ($status >= 200 && $status <= 299) { + $this->request_successful = true; + return true; + } + + if ($formattedResponse){ + $this->last_error = sprintf('%d: %s', $status, $formattedResponse); + return false; + } + + $this->last_error = 'Unknown error, call getLastResponse() to find out what happened.'; + return false; + } + + /** + * Find the HTTP status code from the headers or API response body + * + * @param array $response The response from the curl request + * @param array|false $formattedResponse The response body payload from the curl request + * + * @return int HTTP status code + */ + private function findHTTPStatus($response, $formattedResponse) + { + if (! empty($response['headers']) && isset($response['headers']['http_code'])) { + return (int) $response['headers']['http_code']; + } + + if (! empty($response['body']) && isset($formattedResponse['status'])) { + return (int) $formattedResponse['status']; + } + + return 418; + } + + +} \ No newline at end of file diff --git a/partnerexpo-core.php b/partnerexpo-core.php index 6630713..872856b 100644 --- a/partnerexpo-core.php +++ b/partnerexpo-core.php @@ -9,7 +9,7 @@ * Plugin Name: PartnerExpo Core * Plugin URI: https://partnerexpo.eu * Description: A PartnerEXPO oldal belső pluginja - * Version: 1.1.11 + * Version: 1.1.12 * Author: Juhász Levente * Author URI: https://github.com/Duskell/ * License: GPL-2.0+ @@ -23,7 +23,7 @@ if ( ! defined( 'WPINC' ) ) { die; } -define( 'PARTNEREXPO_CORE_VERSION', '1.1.11' ); +define( 'PARTNEREXPO_CORE_VERSION', '1.1.12' ); function activate_partnerexpo_core() { require_once plugin_dir_path( __FILE__ ) . 'includes/class-partnerexpo-core-activator.php'; diff --git a/public/class-partnerexpo-core-public.php b/public/class-partnerexpo-core-public.php index 1e96a92..dd25ddb 100644 --- a/public/class-partnerexpo-core-public.php +++ b/public/class-partnerexpo-core-public.php @@ -59,9 +59,8 @@ class Partnerexpo_Core_Public { public function comments_shortcode($atts) { wp_enqueue_style( $this->plugin_name . '-comments-css' ); + wp_enqueue_script('jquery'); wp_enqueue_script( $this->plugin_name . '-comments-js' ); - // wp_enqueue_style( $this->plugin_name . '-multiselect-css' ); - // wp_enqueue_script( $this->plugin_name . '-multiselect-js' ); $atts = shortcode_atts( array( 'post_id' => get_the_ID(), @@ -264,6 +263,15 @@ class Partnerexpo_Core_Public { $this->version, true ); + + + wp_register_script( + $this->plugin_name . '-comments-js', + plugin_dir_url( __FILE__ ) . 'js/comments.js', + [ 'jquery' ], + $this->version, + true + ); } diff --git a/public/css/comments.css b/public/css/comments.css index 1c61251..c91892b 100644 --- a/public/css/comments.css +++ b/public/css/comments.css @@ -46,13 +46,13 @@ width: max-content; will-change: transform; animation: scrolling 20s linear infinite; - gap: 100px; } .pexpo-core-comment-group { display: flex; gap: 100px; + width: max-content; } .pexpo-core-comment { @@ -149,6 +149,28 @@ } } +.pexpo-core-com-consent { + display: flex; + flex-direction: column; + gap: 10px; + justify-content: left; + font-size: 1.3rem; + + & div { + display: flex; + gap: 5px; + + & input[type="checkbox"] { + width: auto; + transform: scale(1.2); + + &:focus { + outline: none; + } + } + } +} + .pexpo-core-no-comments { text-align: center; font-size: 1.2rem; @@ -177,6 +199,6 @@ @keyframes scrolling { to { - transform: translate3d(-50%,0,0); + transform: translate3d(-50%, 0, 0); } } \ No newline at end of file diff --git a/public/js/comments.js b/public/js/comments.js new file mode 100644 index 0000000..9f08f7b --- /dev/null +++ b/public/js/comments.js @@ -0,0 +1,10 @@ +jQuery( document ).ready( function( $ ) { + const wrapper = $('.pexpo-core-comment-groups-wrapper').first(); + const group = wrapper.find('.pexpo-core-comment-group').first(); + + let childrenCount = group.children().length; + + if (childrenCount > 3) { + wrapper.css('animation', 'scrolling ' + group.children().length * 5 + 's linear infinite'); + } +}); \ No newline at end of file diff --git a/public/partials/partnerexpo-core-public-comments.php b/public/partials/partnerexpo-core-public-comments.php index ea9a48a..73ca869 100644 --- a/public/partials/partnerexpo-core-public-comments.php +++ b/public/partials/partnerexpo-core-public-comments.php @@ -10,6 +10,8 @@ * @subpackage Partnerexpo_Core/public/partials */ +$complience_url = "rendszerepito.hu/adatkezeles"; + ?>
@@ -40,14 +42,14 @@
- comment_ID, 'author', true ) ): ?> + comment_ID, 'first_name', true ) && get_comment_meta( $comment->comment_ID, 'last_name', true ) ): ?>
-

comment_ID, 'author', true ); ?>

+

comment_ID, 'first_name', true ) ); ?> comment_ID, 'last_name', true ) ); ?>

-

-

comment_ID, 'company', true ); ?>

+

comment_ID, 'company', true ) ); ?>

@@ -69,13 +71,23 @@

-
- +
+

-
- +
+ +

+ +

+
+ +

+ +

+
+

@@ -87,8 +99,13 @@

-
-
+ + + +
+