Skip to content

Commit

Permalink
v4.5.3 release
Browse files Browse the repository at this point in the history
  • Loading branch information
pryley committed Mar 29, 2020
1 parent 11a1204 commit 9c97a12
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 75 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ mix-manifest.json
/_
/node_modules
/vendor
assets/scripts/site-reviews-blocks.js.LICENSE.txt
Binary file modified languages/site-reviews-en_US.mo
Binary file not shown.
30 changes: 9 additions & 21 deletions languages/site-reviews-en_US.po
Original file line number Diff line number Diff line change
Expand Up @@ -1054,61 +1054,49 @@ msgstr "A license you entered was invalid."
msgid "Filter by category"
msgstr "Filter by category"

#: plugin/Controllers/TranslationController.php:32
#: plugin/Controllers/TranslationController.php:52
msgid "%s review updated."
msgid_plural "%s reviews updated."
msgstr[0] "%s review updated."
msgstr[1] "%s reviews updated."

#: plugin/Controllers/TranslationController.php:33
#: plugin/Controllers/TranslationController.php:53
msgid "%s review not updated, somebody is editing it."
msgid_plural "%s reviews not updated, somebody is editing them."
msgstr[0] "%s review not updated, somebody is editing it."
msgstr[1] "%s reviews not updated, somebody is editing them."

#: plugin/Controllers/TranslationController.php:34
#: plugin/Controllers/TranslationController.php:54
msgid "%s review permanently deleted."
msgid_plural "%s reviews permanently deleted."
msgstr[0] "%s review permanently deleted."
msgstr[1] "%s reviews permanently deleted."

#: plugin/Controllers/TranslationController.php:35
#: plugin/Controllers/TranslationController.php:55
msgid "%s review moved to the Trash."
msgid_plural "%s reviews moved to the Trash."
msgstr[0] "%s review moved to the Trash."
msgstr[1] "%s reviews moved to the Trash."

#: plugin/Controllers/TranslationController.php:36
#: plugin/Controllers/TranslationController.php:56
msgid "%s review restored from the Trash."
msgid_plural "%s reviews restored from the Trash."
msgstr[0] "%s review restored from the Trash."
msgstr[1] "%s reviews restored from the Trash."

#: plugin/Controllers/TranslationController.php:169, plugin/Controllers/TranslationController.php:201, plugin/Controllers/EditorController/Labels.php:102, plugin/Controllers/EditorController/Labels.php:103
#: plugin/Controllers/TranslationController.php:189, plugin/Controllers/TranslationController.php:221, plugin/Controllers/EditorController/Labels.php:102, plugin/Controllers/EditorController/Labels.php:103
msgid "Unapproved"
msgstr "Unapproved"

#: plugin/Controllers/TranslationController.php:200, plugin/Controllers/EditorController/Labels.php:62, plugin/Controllers/EditorController/Labels.php:106
#: plugin/Controllers/TranslationController.php:220, plugin/Controllers/EditorController/Labels.php:62, plugin/Controllers/EditorController/Labels.php:106
msgid "Approved"
msgstr "Approved"

#: plugin/Controllers/TrustalyzeController.php:134
#: plugin/Controllers/TrustalyzeController.php:130
msgid "Create Your Trustalyze Account"
msgstr "Create Your Trustalyze Account"

#: plugin/Controllers/TrustalyzeController.php:147
msgid ""
"Free Trustalyze accounts are limited to 500 blockchain transactions per "
"year."
msgstr ""
"Free Trustalyze accounts are limited to 500 blockchain transactions per "
"year."

#: plugin/Controllers/TrustalyzeController.php:148
msgid "Upgrade Your Trustalyze Plan"
msgstr "Upgrade Your Trustalyze Plan"

#: plugin/Controllers/TrustalyzeController.php:236
#: plugin/Controllers/TrustalyzeController.php:215
msgid "Your Trustalyze account details could not be verified, please try again. %s"
msgstr "Your Trustalyze account details could not be verified, please try again. %s"

Expand Down
26 changes: 9 additions & 17 deletions languages/site-reviews.pot
Original file line number Diff line number Diff line change
Expand Up @@ -1013,57 +1013,49 @@ msgstr ""
msgid "Filter by category"
msgstr ""

#: plugin/Controllers/TranslationController.php:32
#: plugin/Controllers/TranslationController.php:52
msgid "%s review updated."
msgid_plural "%s reviews updated."
msgstr[0] ""
msgstr[1] ""

#: plugin/Controllers/TranslationController.php:33
#: plugin/Controllers/TranslationController.php:53
msgid "%s review not updated, somebody is editing it."
msgid_plural "%s reviews not updated, somebody is editing them."
msgstr[0] ""
msgstr[1] ""

#: plugin/Controllers/TranslationController.php:34
#: plugin/Controllers/TranslationController.php:54
msgid "%s review permanently deleted."
msgid_plural "%s reviews permanently deleted."
msgstr[0] ""
msgstr[1] ""

#: plugin/Controllers/TranslationController.php:35
#: plugin/Controllers/TranslationController.php:55
msgid "%s review moved to the Trash."
msgid_plural "%s reviews moved to the Trash."
msgstr[0] ""
msgstr[1] ""

#: plugin/Controllers/TranslationController.php:36
#: plugin/Controllers/TranslationController.php:56
msgid "%s review restored from the Trash."
msgid_plural "%s reviews restored from the Trash."
msgstr[0] ""
msgstr[1] ""

#: plugin/Controllers/TranslationController.php:169, plugin/Controllers/TranslationController.php:201, plugin/Controllers/EditorController/Labels.php:102, plugin/Controllers/EditorController/Labels.php:103
#: plugin/Controllers/TranslationController.php:189, plugin/Controllers/TranslationController.php:221, plugin/Controllers/EditorController/Labels.php:102, plugin/Controllers/EditorController/Labels.php:103
msgid "Unapproved"
msgstr ""

#: plugin/Controllers/TranslationController.php:200, plugin/Controllers/EditorController/Labels.php:62, plugin/Controllers/EditorController/Labels.php:106
#: plugin/Controllers/TranslationController.php:220, plugin/Controllers/EditorController/Labels.php:62, plugin/Controllers/EditorController/Labels.php:106
msgid "Approved"
msgstr ""

#: plugin/Controllers/TrustalyzeController.php:134
#: plugin/Controllers/TrustalyzeController.php:130
msgid "Create Your Trustalyze Account"
msgstr ""

#: plugin/Controllers/TrustalyzeController.php:147
msgid "Free Trustalyze accounts are limited to 500 blockchain transactions per year."
msgstr ""

#: plugin/Controllers/TrustalyzeController.php:148
msgid "Upgrade Your Trustalyze Plan"
msgstr ""

#: plugin/Controllers/TrustalyzeController.php:236
#: plugin/Controllers/TrustalyzeController.php:215
msgid "Your Trustalyze account details could not be verified, please try again. %s"
msgstr ""

Expand Down
1 change: 1 addition & 0 deletions plugin/Actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public function run()
add_action(Application::TAXONOMY.'_edit_form', [$this->taxonomy, 'enableParents']);
add_action('restrict_manage_posts', [$this->taxonomy, 'renderTaxonomyFilter'], 9);
add_action('set_object_terms', [$this->taxonomy, 'restrictTermSelection'], 9, 6);
add_action('plugins_loaded', [$this->translator, 'addTranslationFilters']);
add_action('admin_enqueue_scripts', [$this->translator, 'translatePostStatusLabels']);
add_action('site-reviews/review/created', [$this->trustalyze, 'onCreated']);
add_action('site-reviews/review/reverted', [$this->trustalyze, 'onReverted']);
Expand Down
20 changes: 20 additions & 0 deletions plugin/Controllers/TranslationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use GeminiLabs\SiteReviews\Controllers\EditorController\Labels;
use GeminiLabs\SiteReviews\Helpers\Arr;
use GeminiLabs\SiteReviews\Helpers\Str;
use GeminiLabs\SiteReviews\Modules\Translation;
use GeminiLabs\SiteReviews\Modules\Translator;

class TranslationController
Expand All @@ -20,6 +21,25 @@ public function __construct(Translator $translator)
$this->translator = $translator;
}

/**
* @return void
* @action plugins_loaded
*/
public function addTranslationFilters()
{
if (empty(glsr(Translation::class)->translations())) {
return;
}
add_filter('gettext', [$this, 'filterGettext'], 9, 3);
add_filter('site-reviews/gettext/site-reviews', [$this, 'filterGettextSiteReviews'], 10, 2);
add_filter('gettext_with_context', [$this, 'filterGettextWithContext'], 9, 4);
add_filter('site-reviews/gettext_with_context/site-reviews', [$this, 'filterGettextWithContextSiteReviews'], 10, 3);
add_filter('ngettext', [$this, 'filterNgettext'], 9, 5);
add_filter('site-reviews/ngettext/site-reviews', [$this, 'filterNgettextSiteReviews'], 10, 4);
add_filter('ngettext_with_context', [$this, 'filterNgettextWithContext'], 9, 6);
add_filter('site-reviews/ngettext_with_context/site-reviews', [$this, 'filterNgettextWithContextSiteReviews'], 10, 5);
}

/**
* @param array $messages
* @return array
Expand Down
29 changes: 4 additions & 25 deletions plugin/Controllers/TrustalyzeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,12 @@ public function filterSettingsTableRow(array $context, $template, array $data)
if ($this->enabledKey !== Arr::get($data, 'field.path')) {
return $context;
}
$trustalyzeProductType = glsr(OptionManager::class)->getWP($this->trustalyzeKey);
if ('P' === $trustalyzeProductType) {
$isAccountValidated = !empty(glsr(OptionManager::class)->getWP($this->trustalyzeKey));
$isIntegrationEnabled = glsr(OptionManager::class)->getBool('settings.general.trustalyze');
if ($isAccountValidated && $isIntegrationEnabled) {
return $context;
}
if ('F' === $trustalyzeProductType && 'yes' === glsr_get_option('general.trustalyze')) {
$button = $this->buildUpgradeButton();
} else {
$button = $this->buildCreateButton();
}
$context['field'].= $button;
$context['field'].= $this->buildCreateButton();
return $context;
}

Expand Down Expand Up @@ -138,23 +134,6 @@ protected function buildCreateButton()
]);
}

/**
* @return string
*/
protected function buildUpgradeButton()
{
$build = glsr(Builder::class);
$notice = $build->p(__('Free Trustalyze accounts are limited to 500 blockchain transactions per year.', 'site-reviews'));
$button = $build->a(__('Upgrade Your Trustalyze Plan', 'site-reviews'), [
'class' => 'button',
'href' => Trustalyze::WEB_URL,
'target' => '_blank',
]);
return $build->div($notice.$button, [
'class' => 'glsr-notice-inline notice inline notice-info',
]);
}

/**
* @return bool
*/
Expand Down
8 changes: 0 additions & 8 deletions plugin/Filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ public function run()
add_filter('site-reviews/config/forms/submission-form', [$this->public, 'filterFieldOrder'], 11);
add_filter('site-reviews/render/view', [$this->public, 'filterRenderView']);
add_filter('bulk_post_updated_messages', [$this->translator, 'filterBulkUpdateMessages'], 10, 2);
add_filter('gettext', [$this->translator, 'filterGettext'], 9, 3);
add_filter('site-reviews/gettext/site-reviews', [$this->translator, 'filterGettextSiteReviews'], 10, 2);
add_filter('gettext_with_context', [$this->translator, 'filterGettextWithContext'], 9, 4);
add_filter('site-reviews/gettext_with_context/site-reviews', [$this->translator, 'filterGettextWithContextSiteReviews'], 10, 3);
add_filter('ngettext', [$this->translator, 'filterNgettext'], 9, 5);
add_filter('site-reviews/ngettext/site-reviews', [$this->translator, 'filterNgettextSiteReviews'], 10, 4);
add_filter('ngettext_with_context', [$this->translator, 'filterNgettextWithContext'], 9, 6);
add_filter('site-reviews/ngettext_with_context/site-reviews', [$this->translator, 'filterNgettextWithContextSiteReviews'], 10, 5);
add_filter('display_post_states', [$this->translator, 'filterPostStates'], 10, 2);
add_filter('site-reviews/gettext/default', [$this->translator, 'filterPostStatusLabels'], 10, 2);
add_filter('site-reviews/gettext_with_context/default', [$this->translator, 'filterPostStatusLabels'], 10, 2);
Expand Down
7 changes: 6 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: reviews, ratings, testimonials, business reviews, product reviews, stars,
Tested up to: 5.4
Requires at least: 4.7.0
Requires PHP: 5.6
Stable tag: 4.5.2
Stable tag: 4.5.3
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -112,6 +112,11 @@ All documentation can be found in the "Help" page of the plugin. If your questio

== Changelog ==

= 4.5.3 (2020-03-29) =

- Fixed translation filters to only load if translations exist
- Updated Trustalyze integration notice

= 4.5.2 (2020-03-20) =

- Fixed unicode character support
Expand Down
2 changes: 1 addition & 1 deletion site-reviews.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Plugin Name: Site Reviews
* Plugin URI: https://wordpress.org/plugins/site-reviews
* Description: Receive and display reviews on your website
* Version: 4.5.2
* Version: 4.5.3
* Author: Paul Ryley
* Author URI: https://geminilabs.io
* License: GPL2
Expand Down
4 changes: 2 additions & 2 deletions views/partials/notices/trustalyze.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</div>
<div class="glsr-notice-content">
<h3>Validate Your Reviews on the Blockchain With the Trustalyze Confidence System</h3>
<p>Site Reviews now integrates with the Trustalyze Confidence System which uses blockchain technology to verify to your visitors and customers that your reviews are authentic. Simply create a free Trustalyze account and <a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=settings#tab-general'); ?>">enter your credentials in the Settings</a>. Site Reviews will take care of the rest!</p>
<a href="https://trustalyze.com/plans?ref=105" class="button" target="_blank">Create Your Trustalyze Account</a>
<p>Site Reviews integrates with the <a href="https://trustalyze.com/plans?ref=105">Trustalyze Confidence System</a>, a service which uses blockchain technology to verify to your visitors and customers that your reviews are authentic.</p>
<a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=settings#tab-general'); ?>" class="button">Enable the integration</a>
</div>
</div>

0 comments on commit 9c97a12

Please sign in to comment.