Changeset 3793012
- Timestamp:
- 11/09/2026 06:07:35 PM (less than one hour ago)
- Location:
- trustami-badge-for-customer-reviews-and-google-stars
- Files:
-
- 8 deleted
- 36 edited
- 1 copied
-
tags/1.1.1 (copied) (copied from trustami-badge-for-customer-reviews-and-google-stars/trunk )
-
tags/1.1.1/README.txt (modified) (2 diffs)
-
tags/1.1.1/admin/partials (deleted)
-
tags/1.1.1/includes/class-trustami-settings-tab.php (modified) (11 diffs)
-
tags/1.1.1/includes/class-trustami.php (modified) (1 diff)
-
tags/1.1.1/includes/widgets/class-trustami-widget-badge.php (modified) (1 diff)
-
tags/1.1.1/includes/widgets/class-trustami-widget-box.php (modified) (1 diff)
-
tags/1.1.1/includes/widgets/class-trustami-widget-button.php (modified) (1 diff)
-
tags/1.1.1/includes/widgets/class-trustami-widget-comments.php (modified) (1 diff)
-
tags/1.1.1/includes/widgets/class-trustami-widget-container.php (modified) (1 diff)
-
tags/1.1.1/includes/widgets/class-trustami-widget-duo.php (modified) (1 diff)
-
tags/1.1.1/includes/widgets/class-trustami-widget-shopauskunft.php (modified) (1 diff)
-
tags/1.1.1/includes/widgets/class-trustami-widget-social.php (modified) (1 diff)
-
tags/1.1.1/includes/widgets/class-trustami-widget-stars.php (modified) (1 diff)
-
tags/1.1.1/includes/widgets/class-trustami-widget-sticker.php (modified) (1 diff)
-
tags/1.1.1/includes/widgets/class-trustami-widget-text.php (modified) (1 diff)
-
tags/1.1.1/languages/trustami-badge-for-customer-reviews-and-google-stars-de_DE.mo (modified) ( previous)
-
tags/1.1.1/languages/trustami-badge-for-customer-reviews-and-google-stars-de_DE.po (modified) (1 diff)
-
tags/1.1.1/public/class-trustami-public.php (modified) (2 diffs)
-
tags/1.1.1/public/css (deleted)
-
tags/1.1.1/public/js (deleted)
-
tags/1.1.1/public/partials (deleted)
-
tags/1.1.1/trustami.php (modified) (1 diff)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/admin/partials (deleted)
-
trunk/includes/class-trustami-settings-tab.php (modified) (11 diffs)
-
trunk/includes/class-trustami.php (modified) (1 diff)
-
trunk/includes/widgets/class-trustami-widget-badge.php (modified) (1 diff)
-
trunk/includes/widgets/class-trustami-widget-box.php (modified) (1 diff)
-
trunk/includes/widgets/class-trustami-widget-button.php (modified) (1 diff)
-
trunk/includes/widgets/class-trustami-widget-comments.php (modified) (1 diff)
-
trunk/includes/widgets/class-trustami-widget-container.php (modified) (1 diff)
-
trunk/includes/widgets/class-trustami-widget-duo.php (modified) (1 diff)
-
trunk/includes/widgets/class-trustami-widget-shopauskunft.php (modified) (1 diff)
-
trunk/includes/widgets/class-trustami-widget-social.php (modified) (1 diff)
-
trunk/includes/widgets/class-trustami-widget-stars.php (modified) (1 diff)
-
trunk/includes/widgets/class-trustami-widget-sticker.php (modified) (1 diff)
-
trunk/includes/widgets/class-trustami-widget-text.php (modified) (1 diff)
-
trunk/languages/trustami-badge-for-customer-reviews-and-google-stars-de_DE.mo (modified) ( previous)
-
trunk/languages/trustami-badge-for-customer-reviews-and-google-stars-de_DE.po (modified) (1 diff)
-
trunk/public/class-trustami-public.php (modified) (2 diffs)
-
trunk/public/css (deleted)
-
trunk/public/js (deleted)
-
trunk/public/partials (deleted)
-
trunk/trustami.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trustami-badge-for-customer-reviews-and-google-stars/tags/1.1.1/README.txt
r3773501 r3793012 5 5 Requires at least: 6.0 6 6 Tested up to: 7.1 7 Stable tag: 1.1. 07 Stable tag: 1.1.1 8 8 Requires PHP: 7.4 9 9 License: GPLv3 … … 119 119 * fix widget script not loading when the custom data attribute contains quotes or invalid JSON 120 120 * add missing German translation 121 122 = 1.1.1 = 123 * fix fatal error after updating to 1.1.0: the 1.1.0 package on wordpress.org was missing files, 1.1.1 ships the complete plugin -
trustami-badge-for-customer-reviews-and-google-stars/tags/1.1.1/includes/class-trustami-settings-tab.php
r3417416 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; // Exit if accessed directly 5 } 3 defined('ABSPATH') || exit; // Exit if accessed directly 6 4 7 5 class WC_Trustami_Settings_Tab … … 131 129 'name' => __('Display trust badge text in the footer', 'trustami-badge-for-customer-reviews-and-google-stars'), 132 130 'type' => 'checkbox', 133 'default' => ' 1',131 'default' => 'no', 134 132 'id' => 'WC_Trustami_Settings_Tab_text_badge' 135 133 ), … … 137 135 'name' => __('Display trust badge overlay', 'trustami-badge-for-customer-reviews-and-google-stars'), 138 136 'type' => 'checkbox', 139 'default' => ' 1',137 'default' => 'no', 140 138 'id' => 'WC_Trustami_Settings_Tab_overlay_badge' 141 139 ), … … 143 141 'name' => __('Display trust badge frame', 'trustami-badge-for-customer-reviews-and-google-stars'), 144 142 'type' => 'checkbox', 145 'default' => ' 1',143 'default' => 'no', 146 144 'id' => 'WC_Trustami_Settings_Tab_overlay_frame' 147 145 ), … … 149 147 'name' => __('Display trust badge list', 'trustami-badge-for-customer-reviews-and-google-stars'), 150 148 'type' => 'checkbox', 151 'default' => ' 1',149 'default' => 'no', 152 150 'id' => 'WC_Trustami_Settings_Tab_overlay_list' 153 151 ), … … 155 153 'name' => __('Display trust badge sticker', 'trustami-badge-for-customer-reviews-and-google-stars'), 156 154 'type' => 'checkbox', 157 'default' => ' 1',155 'default' => 'no', 158 156 'id' => 'WC_Trustami_Settings_Tab_overlay_sticker' 159 157 ), … … 161 159 'name' => __('Display trust badge button', 'trustami-badge-for-customer-reviews-and-google-stars'), 162 160 'type' => 'checkbox', 163 'default' => ' 0',161 'default' => 'no', 164 162 'id' => 'WC_Trustami_Settings_Tab_overlay_button' 165 163 ), … … 167 165 'name' => __('Display trust badge social', 'trustami-badge-for-customer-reviews-and-google-stars'), 168 166 'type' => 'checkbox', 169 'default' => ' 0',167 'default' => 'no', 170 168 'id' => 'WC_Trustami_Settings_Tab_overlay_social' 171 169 ), … … 173 171 'name' => __('Display trust badge duo', 'trustami-badge-for-customer-reviews-and-google-stars'), 174 172 'type' => 'checkbox', 175 'default' => ' 0',173 'default' => 'no', 176 174 'id' => 'WC_Trustami_Settings_Tab_overlay_duo' 177 175 ), … … 179 177 'name' => __('Display trust badge stars', 'trustami-badge-for-customer-reviews-and-google-stars'), 180 178 'type' => 'checkbox', 181 'default' => ' 0',179 'default' => 'no', 182 180 'id' => 'WC_Trustami_Settings_Tab_overlay_stars' 183 181 ), … … 185 183 'name' => __('Display Shopauskunft trust badge', 'trustami-badge-for-customer-reviews-and-google-stars'), 186 184 'type' => 'checkbox', 187 'default' => ' 0',185 'default' => 'no', 188 186 'id' => 'WC_Trustami_Settings_Tab_overlay_shopak' 189 187 ), -
trustami-badge-for-customer-reviews-and-google-stars/tags/1.1.1/includes/class-trustami.php
r3417416 r3793012 70 70 71 71 $this->plugin_name = 'Trustami Badge for Customer Reviews and Google Stars'; 72 $this->version = '1. 0.12';72 $this->version = '1.1.1'; 73 73 74 74 $this->load_dependencies(); -
trustami-badge-for-customer-reviews-and-google-stars/tags/1.1.1/includes/widgets/class-trustami-widget-badge.php
r3328197 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; 5 } 6 // Exit if accessed directly 3 defined('ABSPATH') || exit; // Exit if accessed directly 7 4 8 5 /** -
trustami-badge-for-customer-reviews-and-google-stars/tags/1.1.1/includes/widgets/class-trustami-widget-box.php
r3328197 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; 5 } 6 // Exit if accessed directly 3 defined('ABSPATH') || exit; // Exit if accessed directly 7 4 8 5 /** -
trustami-badge-for-customer-reviews-and-google-stars/tags/1.1.1/includes/widgets/class-trustami-widget-button.php
r3328197 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; 5 } 6 // Exit if accessed directly 3 defined('ABSPATH') || exit; // Exit if accessed directly 7 4 8 5 /** -
trustami-badge-for-customer-reviews-and-google-stars/tags/1.1.1/includes/widgets/class-trustami-widget-comments.php
r3328197 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; 5 } 6 // Exit if accessed directly 3 defined('ABSPATH') || exit; // Exit if accessed directly 7 4 8 5 /** -
trustami-badge-for-customer-reviews-and-google-stars/tags/1.1.1/includes/widgets/class-trustami-widget-container.php
r3328197 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; 5 } 6 // Exit if accessed directly 3 defined('ABSPATH') || exit; // Exit if accessed directly 7 4 8 5 /** -
trustami-badge-for-customer-reviews-and-google-stars/tags/1.1.1/includes/widgets/class-trustami-widget-duo.php
r3328197 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; 5 } 6 // Exit if accessed directly 3 defined('ABSPATH') || exit; // Exit if accessed directly 7 4 8 5 /** -
trustami-badge-for-customer-reviews-and-google-stars/tags/1.1.1/includes/widgets/class-trustami-widget-shopauskunft.php
r3328197 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; 5 } 6 // Exit if accessed directly 3 defined('ABSPATH') || exit; // Exit if accessed directly 7 4 8 5 /** -
trustami-badge-for-customer-reviews-and-google-stars/tags/1.1.1/includes/widgets/class-trustami-widget-social.php
r3328197 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; 5 } 6 // Exit if accessed directly 3 defined('ABSPATH') || exit; // Exit if accessed directly 7 4 8 5 /** -
trustami-badge-for-customer-reviews-and-google-stars/tags/1.1.1/includes/widgets/class-trustami-widget-stars.php
r3328197 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; 5 } 6 // Exit if accessed directly 3 defined('ABSPATH') || exit; // Exit if accessed directly 7 4 8 5 /** -
trustami-badge-for-customer-reviews-and-google-stars/tags/1.1.1/includes/widgets/class-trustami-widget-sticker.php
r3328197 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; 5 } 6 // Exit if accessed directly 3 defined('ABSPATH') || exit; // Exit if accessed directly 7 4 8 5 /** -
trustami-badge-for-customer-reviews-and-google-stars/tags/1.1.1/includes/widgets/class-trustami-widget-text.php
r3328197 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; 5 } 6 // Exit if accessed directly 3 defined('ABSPATH') || exit; // Exit if accessed directly 7 4 8 5 /** -
trustami-badge-for-customer-reviews-and-google-stars/tags/1.1.1/languages/trustami-badge-for-customer-reviews-and-google-stars-de_DE.po
r3417416 r3793012 103 103 msgstr "Wähle den Action Hook, der die Header Snippets erzeugt (bspw. get_header, wp_head). Standardwert: get_header" 104 104 105 msgid "Product Action Hook" 106 msgstr "Produkt Action Hook" 107 105 108 msgid "Choose the filter-hook used to create product snippets (e.g. woocommerce_short_description, woocommerce_product_get_short_description, woocommerce_product_meta_end). Default: woocommerce_short_description" 106 109 msgstr "Wähle den Filter Hook, der die Produkt Snippets erzeugt (bspw. woocommerce_short_description, woocommerce_product_get_short_description, woocommerce_product_meta_end). Standardwert: woocommerce_short_description" -
trustami-badge-for-customer-reviews-and-google-stars/tags/1.1.1/public/class-trustami-public.php
r3417416 r3793012 63 63 function returnTrustamiScriptCnt() 64 64 { 65 $opts = get_option('WC_Trustami_Settings_Tab_trustami_profile_id'); 66 if (!empty($opts)) { 67 $footerCtn = ""; 68 69 $options = array( 70 "profileId" => $opts, 71 "textBadge" => get_option('WC_Trustami_Settings_Tab_text_badge'), 72 "overlayBadge" => get_option('WC_Trustami_Settings_Tab_overlay_badge'), 73 "overlayFrame" => get_option('WC_Trustami_Settings_Tab_overlay_frame'), 74 "overlayList" => get_option('WC_Trustami_Settings_Tab_overlay_list'), 75 "overlaySticker" => get_option('WC_Trustami_Settings_Tab_overlay_sticker'), 76 "overlayButton" => get_option('WC_Trustami_Settings_Tab_overlay_button'), 77 "overlaySocial" => get_option('WC_Trustami_Settings_Tab_overlay_social'), 78 "overlayDuo" => get_option('WC_Trustami_Settings_Tab_overlay_duo'), 79 "cusDataAtt" => get_option('WC_Trustami_Settings_Tab_cus_data_att') 80 ); 81 82 $footerCtn .= '<script>let taScript = document.createElement("script"); 83 taScript.setAttribute("type", "text/javascript"); 84 taScript.setAttribute("id", "trustamiwidget"); 85 taScript.setAttribute("src", "https://cdn.trustami.com/widgetapi/widget2/trustami-widget.js?cache=off"); 86 taScript.setAttribute("data-user", "31ae1621831be5333185d875512bf5e52c480452"); 87 taScript.setAttribute("data-profile", "' . $options["profileId"] . '"); 88 taScript.setAttribute("data-platform", "0"); 89 taScript.setAttribute("data-plugin", "wc");'; 90 91 if (!empty($options["cusDataAtt"])) { 92 $footerCtn .= 'taScript.setAttribute("data-custom", "' . urlencode($options["cusDataAtt"]) . '"); 93 let ta_parsed_json = JSON.parse(\'' . $options["cusDataAtt"] . '\'); 94 for (let property in ta_parsed_json) { 95 if (ta_parsed_json[property] !== undefined) { 96 taScript.setAttribute(property, ta_parsed_json[property]); 65 $profileId = get_option('WC_Trustami_Settings_Tab_trustami_profile_id'); 66 if (empty($profileId)) { 67 return; 68 } 69 70 $attributes = array( 71 'type' => 'text/javascript', 72 'id' => 'trustamiwidget', 73 'src' => 'https://cdn.trustami.com/widgetapi/widget2/trustami-widget.js?cache=off', 74 'data-user' => '31ae1621831be5333185d875512bf5e52c480452', 75 'data-profile' => (string) $profileId, 76 'data-platform' => '0', 77 'data-plugin' => 'wc' 78 ); 79 80 // The custom data attribute is a JSON object whose keys become additional script attributes. 81 $customData = get_option('WC_Trustami_Settings_Tab_cus_data_att'); 82 if (!empty($customData)) { 83 $attributes['data-custom'] = urlencode($customData); 84 $parsed = json_decode($customData, true); 85 if (is_array($parsed)) { 86 foreach ($parsed as $name => $value) { 87 if (is_scalar($value)) { 88 $attributes[(string) $name] = (string) $value; 89 } 97 90 } 98 }';99 91 } 100 101 $footerCtn .= 'document.body.appendChild(taScript);</script>'; 102 if (!empty($footerCtn)) echo $footerCtn; 103 } 92 } 93 94 // The JSON_HEX_* flags prevent values from closing the script tag or breaking out of the JS string. 95 $json = wp_json_encode($attributes, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); 96 97 echo '<script>let taScript = document.createElement("script"); 98 let taAttributes = ' . $json . '; 99 for (let property in taAttributes) { 100 taScript.setAttribute(property, taAttributes[property]); 101 } 102 document.body.appendChild(taScript);</script>'; 104 103 } 105 104 … … 156 155 } 157 156 158 function returnTrustamiCategoryCnt($html) 159 { 160 $opts = get_option('WC_Trustami_Settings_Tab_trustami_profile_id'); 161 if (!empty($opts)) { 157 /** 158 * Output the badge in the product description. 159 * 160 * Works for both filter hooks (e.g. woocommerce_short_description) and action hooks 161 * (e.g. woocommerce_product_meta_end). A filter must return its input, so the badge 162 * is prepended to it; an action has no input, so the badge is echoed. 163 * 164 * The number or type of arguments cannot tell them apart: do_action() passes an empty 165 * string to callbacks even when the action has no arguments. Instead, WordPress counts 166 * every executed action (did_action) but not filters, so a hook with a count is an action. 167 * 168 * No badge is added in REST (e.g. WooCommerce Store API), JSON or feed requests. 169 * 170 * @param string $html Filtered content (only passed when used as a filter). 171 * @return string|void 172 */ 173 function returnTrustamiCategoryCnt($html = '') 174 { 175 $hook = current_filter(); 176 $isFilter = !$hook || did_action($hook) === 0; 177 $catHtml = null; 178 179 if (!empty(get_option('WC_Trustami_Settings_Tab_trustami_profile_id')) && !$this->isNonHtmlRequest()) { 162 180 $catHtml = $this->trustamiDiv(get_option('WC_Trustami_Settings_Tab_trustami_product_display'), "productDesc"); 163 if ($catHtml) echo $catHtml; 164 } 181 } 182 183 if ($isFilter) { 184 return $catHtml ? $catHtml . $html : $html; 185 } 186 if ($catHtml) { 187 echo $catHtml; 188 } 189 } 190 191 /** 192 * Whether the current request returns data instead of a rendered page (REST/Store API, JSON, feeds). 193 * The badge is only useful on HTML pages, where the widget script can fill it. 194 * 195 * @return bool 196 */ 197 private function isNonHtmlRequest() 198 { 199 return (defined('REST_REQUEST') && REST_REQUEST) || wp_is_json_request() || is_feed(); 165 200 } 166 201 -
trustami-badge-for-customer-reviews-and-google-stars/tags/1.1.1/trustami.php
r3773501 r3793012 16 16 * Plugin URI: https://app.trustami.com/manuals/WooCommerce?lang=en 17 17 * Description: Trustami plugin for WooCommerce. Trustami - One badge for all your customer reviews. Trustami collects, analyzes and presents a users’ distributed social media data in a standardized and user-friendly format to fill the need for trust in online interactions. Trustami enables users to collect ratings and reviews from all networks and show a trust badge. 18 * Version: 1.1. 018 * Version: 1.1.1 19 19 * Requires at least: 6.0 20 20 * Requires PHP: 7.4 -
trustami-badge-for-customer-reviews-and-google-stars/trunk/README.txt
r3773501 r3793012 5 5 Requires at least: 6.0 6 6 Tested up to: 7.1 7 Stable tag: 1.1. 07 Stable tag: 1.1.1 8 8 Requires PHP: 7.4 9 9 License: GPLv3 … … 119 119 * fix widget script not loading when the custom data attribute contains quotes or invalid JSON 120 120 * add missing German translation 121 122 = 1.1.1 = 123 * fix fatal error after updating to 1.1.0: the 1.1.0 package on wordpress.org was missing files, 1.1.1 ships the complete plugin -
trustami-badge-for-customer-reviews-and-google-stars/trunk/includes/class-trustami-settings-tab.php
r3417416 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; // Exit if accessed directly 5 } 3 defined('ABSPATH') || exit; // Exit if accessed directly 6 4 7 5 class WC_Trustami_Settings_Tab … … 131 129 'name' => __('Display trust badge text in the footer', 'trustami-badge-for-customer-reviews-and-google-stars'), 132 130 'type' => 'checkbox', 133 'default' => ' 1',131 'default' => 'no', 134 132 'id' => 'WC_Trustami_Settings_Tab_text_badge' 135 133 ), … … 137 135 'name' => __('Display trust badge overlay', 'trustami-badge-for-customer-reviews-and-google-stars'), 138 136 'type' => 'checkbox', 139 'default' => ' 1',137 'default' => 'no', 140 138 'id' => 'WC_Trustami_Settings_Tab_overlay_badge' 141 139 ), … … 143 141 'name' => __('Display trust badge frame', 'trustami-badge-for-customer-reviews-and-google-stars'), 144 142 'type' => 'checkbox', 145 'default' => ' 1',143 'default' => 'no', 146 144 'id' => 'WC_Trustami_Settings_Tab_overlay_frame' 147 145 ), … … 149 147 'name' => __('Display trust badge list', 'trustami-badge-for-customer-reviews-and-google-stars'), 150 148 'type' => 'checkbox', 151 'default' => ' 1',149 'default' => 'no', 152 150 'id' => 'WC_Trustami_Settings_Tab_overlay_list' 153 151 ), … … 155 153 'name' => __('Display trust badge sticker', 'trustami-badge-for-customer-reviews-and-google-stars'), 156 154 'type' => 'checkbox', 157 'default' => ' 1',155 'default' => 'no', 158 156 'id' => 'WC_Trustami_Settings_Tab_overlay_sticker' 159 157 ), … … 161 159 'name' => __('Display trust badge button', 'trustami-badge-for-customer-reviews-and-google-stars'), 162 160 'type' => 'checkbox', 163 'default' => ' 0',161 'default' => 'no', 164 162 'id' => 'WC_Trustami_Settings_Tab_overlay_button' 165 163 ), … … 167 165 'name' => __('Display trust badge social', 'trustami-badge-for-customer-reviews-and-google-stars'), 168 166 'type' => 'checkbox', 169 'default' => ' 0',167 'default' => 'no', 170 168 'id' => 'WC_Trustami_Settings_Tab_overlay_social' 171 169 ), … … 173 171 'name' => __('Display trust badge duo', 'trustami-badge-for-customer-reviews-and-google-stars'), 174 172 'type' => 'checkbox', 175 'default' => ' 0',173 'default' => 'no', 176 174 'id' => 'WC_Trustami_Settings_Tab_overlay_duo' 177 175 ), … … 179 177 'name' => __('Display trust badge stars', 'trustami-badge-for-customer-reviews-and-google-stars'), 180 178 'type' => 'checkbox', 181 'default' => ' 0',179 'default' => 'no', 182 180 'id' => 'WC_Trustami_Settings_Tab_overlay_stars' 183 181 ), … … 185 183 'name' => __('Display Shopauskunft trust badge', 'trustami-badge-for-customer-reviews-and-google-stars'), 186 184 'type' => 'checkbox', 187 'default' => ' 0',185 'default' => 'no', 188 186 'id' => 'WC_Trustami_Settings_Tab_overlay_shopak' 189 187 ), -
trustami-badge-for-customer-reviews-and-google-stars/trunk/includes/class-trustami.php
r3417416 r3793012 70 70 71 71 $this->plugin_name = 'Trustami Badge for Customer Reviews and Google Stars'; 72 $this->version = '1. 0.12';72 $this->version = '1.1.1'; 73 73 74 74 $this->load_dependencies(); -
trustami-badge-for-customer-reviews-and-google-stars/trunk/includes/widgets/class-trustami-widget-badge.php
r3328197 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; 5 } 6 // Exit if accessed directly 3 defined('ABSPATH') || exit; // Exit if accessed directly 7 4 8 5 /** -
trustami-badge-for-customer-reviews-and-google-stars/trunk/includes/widgets/class-trustami-widget-box.php
r3328197 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; 5 } 6 // Exit if accessed directly 3 defined('ABSPATH') || exit; // Exit if accessed directly 7 4 8 5 /** -
trustami-badge-for-customer-reviews-and-google-stars/trunk/includes/widgets/class-trustami-widget-button.php
r3328197 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; 5 } 6 // Exit if accessed directly 3 defined('ABSPATH') || exit; // Exit if accessed directly 7 4 8 5 /** -
trustami-badge-for-customer-reviews-and-google-stars/trunk/includes/widgets/class-trustami-widget-comments.php
r3328197 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; 5 } 6 // Exit if accessed directly 3 defined('ABSPATH') || exit; // Exit if accessed directly 7 4 8 5 /** -
trustami-badge-for-customer-reviews-and-google-stars/trunk/includes/widgets/class-trustami-widget-container.php
r3328197 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; 5 } 6 // Exit if accessed directly 3 defined('ABSPATH') || exit; // Exit if accessed directly 7 4 8 5 /** -
trustami-badge-for-customer-reviews-and-google-stars/trunk/includes/widgets/class-trustami-widget-duo.php
r3328197 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; 5 } 6 // Exit if accessed directly 3 defined('ABSPATH') || exit; // Exit if accessed directly 7 4 8 5 /** -
trustami-badge-for-customer-reviews-and-google-stars/trunk/includes/widgets/class-trustami-widget-shopauskunft.php
r3328197 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; 5 } 6 // Exit if accessed directly 3 defined('ABSPATH') || exit; // Exit if accessed directly 7 4 8 5 /** -
trustami-badge-for-customer-reviews-and-google-stars/trunk/includes/widgets/class-trustami-widget-social.php
r3328197 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; 5 } 6 // Exit if accessed directly 3 defined('ABSPATH') || exit; // Exit if accessed directly 7 4 8 5 /** -
trustami-badge-for-customer-reviews-and-google-stars/trunk/includes/widgets/class-trustami-widget-stars.php
r3328197 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; 5 } 6 // Exit if accessed directly 3 defined('ABSPATH') || exit; // Exit if accessed directly 7 4 8 5 /** -
trustami-badge-for-customer-reviews-and-google-stars/trunk/includes/widgets/class-trustami-widget-sticker.php
r3328197 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; 5 } 6 // Exit if accessed directly 3 defined('ABSPATH') || exit; // Exit if accessed directly 7 4 8 5 /** -
trustami-badge-for-customer-reviews-and-google-stars/trunk/includes/widgets/class-trustami-widget-text.php
r3328197 r3793012 1 1 <?php 2 2 3 if (!defined('ABSPATH')) { 4 exit; 5 } 6 // Exit if accessed directly 3 defined('ABSPATH') || exit; // Exit if accessed directly 7 4 8 5 /** -
trustami-badge-for-customer-reviews-and-google-stars/trunk/languages/trustami-badge-for-customer-reviews-and-google-stars-de_DE.po
r3417416 r3793012 103 103 msgstr "Wähle den Action Hook, der die Header Snippets erzeugt (bspw. get_header, wp_head). Standardwert: get_header" 104 104 105 msgid "Product Action Hook" 106 msgstr "Produkt Action Hook" 107 105 108 msgid "Choose the filter-hook used to create product snippets (e.g. woocommerce_short_description, woocommerce_product_get_short_description, woocommerce_product_meta_end). Default: woocommerce_short_description" 106 109 msgstr "Wähle den Filter Hook, der die Produkt Snippets erzeugt (bspw. woocommerce_short_description, woocommerce_product_get_short_description, woocommerce_product_meta_end). Standardwert: woocommerce_short_description" -
trustami-badge-for-customer-reviews-and-google-stars/trunk/public/class-trustami-public.php
r3417416 r3793012 63 63 function returnTrustamiScriptCnt() 64 64 { 65 $opts = get_option('WC_Trustami_Settings_Tab_trustami_profile_id'); 66 if (!empty($opts)) { 67 $footerCtn = ""; 68 69 $options = array( 70 "profileId" => $opts, 71 "textBadge" => get_option('WC_Trustami_Settings_Tab_text_badge'), 72 "overlayBadge" => get_option('WC_Trustami_Settings_Tab_overlay_badge'), 73 "overlayFrame" => get_option('WC_Trustami_Settings_Tab_overlay_frame'), 74 "overlayList" => get_option('WC_Trustami_Settings_Tab_overlay_list'), 75 "overlaySticker" => get_option('WC_Trustami_Settings_Tab_overlay_sticker'), 76 "overlayButton" => get_option('WC_Trustami_Settings_Tab_overlay_button'), 77 "overlaySocial" => get_option('WC_Trustami_Settings_Tab_overlay_social'), 78 "overlayDuo" => get_option('WC_Trustami_Settings_Tab_overlay_duo'), 79 "cusDataAtt" => get_option('WC_Trustami_Settings_Tab_cus_data_att') 80 ); 81 82 $footerCtn .= '<script>let taScript = document.createElement("script"); 83 taScript.setAttribute("type", "text/javascript"); 84 taScript.setAttribute("id", "trustamiwidget"); 85 taScript.setAttribute("src", "https://cdn.trustami.com/widgetapi/widget2/trustami-widget.js?cache=off"); 86 taScript.setAttribute("data-user", "31ae1621831be5333185d875512bf5e52c480452"); 87 taScript.setAttribute("data-profile", "' . $options["profileId"] . '"); 88 taScript.setAttribute("data-platform", "0"); 89 taScript.setAttribute("data-plugin", "wc");'; 90 91 if (!empty($options["cusDataAtt"])) { 92 $footerCtn .= 'taScript.setAttribute("data-custom", "' . urlencode($options["cusDataAtt"]) . '"); 93 let ta_parsed_json = JSON.parse(\'' . $options["cusDataAtt"] . '\'); 94 for (let property in ta_parsed_json) { 95 if (ta_parsed_json[property] !== undefined) { 96 taScript.setAttribute(property, ta_parsed_json[property]); 65 $profileId = get_option('WC_Trustami_Settings_Tab_trustami_profile_id'); 66 if (empty($profileId)) { 67 return; 68 } 69 70 $attributes = array( 71 'type' => 'text/javascript', 72 'id' => 'trustamiwidget', 73 'src' => 'https://cdn.trustami.com/widgetapi/widget2/trustami-widget.js?cache=off', 74 'data-user' => '31ae1621831be5333185d875512bf5e52c480452', 75 'data-profile' => (string) $profileId, 76 'data-platform' => '0', 77 'data-plugin' => 'wc' 78 ); 79 80 // The custom data attribute is a JSON object whose keys become additional script attributes. 81 $customData = get_option('WC_Trustami_Settings_Tab_cus_data_att'); 82 if (!empty($customData)) { 83 $attributes['data-custom'] = urlencode($customData); 84 $parsed = json_decode($customData, true); 85 if (is_array($parsed)) { 86 foreach ($parsed as $name => $value) { 87 if (is_scalar($value)) { 88 $attributes[(string) $name] = (string) $value; 89 } 97 90 } 98 }';99 91 } 100 101 $footerCtn .= 'document.body.appendChild(taScript);</script>'; 102 if (!empty($footerCtn)) echo $footerCtn; 103 } 92 } 93 94 // The JSON_HEX_* flags prevent values from closing the script tag or breaking out of the JS string. 95 $json = wp_json_encode($attributes, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); 96 97 echo '<script>let taScript = document.createElement("script"); 98 let taAttributes = ' . $json . '; 99 for (let property in taAttributes) { 100 taScript.setAttribute(property, taAttributes[property]); 101 } 102 document.body.appendChild(taScript);</script>'; 104 103 } 105 104 … … 156 155 } 157 156 158 function returnTrustamiCategoryCnt($html) 159 { 160 $opts = get_option('WC_Trustami_Settings_Tab_trustami_profile_id'); 161 if (!empty($opts)) { 157 /** 158 * Output the badge in the product description. 159 * 160 * Works for both filter hooks (e.g. woocommerce_short_description) and action hooks 161 * (e.g. woocommerce_product_meta_end). A filter must return its input, so the badge 162 * is prepended to it; an action has no input, so the badge is echoed. 163 * 164 * The number or type of arguments cannot tell them apart: do_action() passes an empty 165 * string to callbacks even when the action has no arguments. Instead, WordPress counts 166 * every executed action (did_action) but not filters, so a hook with a count is an action. 167 * 168 * No badge is added in REST (e.g. WooCommerce Store API), JSON or feed requests. 169 * 170 * @param string $html Filtered content (only passed when used as a filter). 171 * @return string|void 172 */ 173 function returnTrustamiCategoryCnt($html = '') 174 { 175 $hook = current_filter(); 176 $isFilter = !$hook || did_action($hook) === 0; 177 $catHtml = null; 178 179 if (!empty(get_option('WC_Trustami_Settings_Tab_trustami_profile_id')) && !$this->isNonHtmlRequest()) { 162 180 $catHtml = $this->trustamiDiv(get_option('WC_Trustami_Settings_Tab_trustami_product_display'), "productDesc"); 163 if ($catHtml) echo $catHtml; 164 } 181 } 182 183 if ($isFilter) { 184 return $catHtml ? $catHtml . $html : $html; 185 } 186 if ($catHtml) { 187 echo $catHtml; 188 } 189 } 190 191 /** 192 * Whether the current request returns data instead of a rendered page (REST/Store API, JSON, feeds). 193 * The badge is only useful on HTML pages, where the widget script can fill it. 194 * 195 * @return bool 196 */ 197 private function isNonHtmlRequest() 198 { 199 return (defined('REST_REQUEST') && REST_REQUEST) || wp_is_json_request() || is_feed(); 165 200 } 166 201 -
trustami-badge-for-customer-reviews-and-google-stars/trunk/trustami.php
r3773501 r3793012 16 16 * Plugin URI: https://app.trustami.com/manuals/WooCommerce?lang=en 17 17 * Description: Trustami plugin for WooCommerce. Trustami - One badge for all your customer reviews. Trustami collects, analyzes and presents a users’ distributed social media data in a standardized and user-friendly format to fill the need for trust in online interactions. Trustami enables users to collect ratings and reviews from all networks and show a trust badge. 18 * Version: 1.1. 018 * Version: 1.1.1 19 19 * Requires at least: 6.0 20 20 * Requires PHP: 7.4
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)