| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentForm\App\Modules\Registerer; |
| 4 |
|
| 5 |
defined('ABSPATH') or die; |
| 6 |
|
| 7 |
use FluentForm\App\Models\Form; |
| 8 |
use FluentForm\App\Helpers\Helper; |
| 9 |
use FluentForm\App\Http\Controllers\AdminNoticeController; |
| 10 |
|
| 11 |
class ReviewQuery |
| 12 |
{ |
| 13 |
public static function register() |
| 14 |
{ |
| 15 |
if (static::shouldRegister()) { |
| 16 |
add_action('fluentform/global_menu', [static::class, 'show'], 99); |
| 17 |
} |
| 18 |
} |
| 19 |
|
| 20 |
protected static function shouldRegister() |
| 21 |
{ |
| 22 |
if (Helper::isFluentAdminPage() && !wp_doing_ajax()) { |
| 23 |
return Form::count() > 3; |
| 24 |
} |
| 25 |
|
| 26 |
return false; |
| 27 |
} |
| 28 |
|
| 29 |
public static function show() |
| 30 |
{ |
| 31 |
$notice = new AdminNoticeController(); |
| 32 |
$msg = static::getMessage(); |
| 33 |
$notice->addNotice($msg); |
| 34 |
$notice->showNotice(); |
| 35 |
} |
| 36 |
|
| 37 |
private static function getMessage() |
| 38 |
{ |
| 39 |
return [ |
| 40 |
'name' => 'review_query', |
| 41 |
'title' => '', |
| 42 |
'message' => sprintf('Thank you for using Fluent Forms. We would greatly appreciate it if you could share your experience and leave a review for us on %s. Your review inspires us to keep improving the plugin and delivering a better user experience.', |
| 43 |
'<a target="_blank" href="https://wordpress.org/support/plugin/fluentform/reviews/#new-post">WordPress.org</a>'), |
| 44 |
'links' => [ |
| 45 |
[ |
| 46 |
'href' => 'https://wordpress.org/support/plugin/fluentform/reviews/#new-post', |
| 47 |
'btn_text' => 'Yes', |
| 48 |
'btn_atts' => 'class="mr-1 el-button--success el-button--mini ff_review_now" data-notice_name="review_query"', |
| 49 |
], |
| 50 |
[ |
| 51 |
'href' => admin_url('admin.php?page=fluent_forms'), |
| 52 |
'btn_text' => 'Maybe Later', |
| 53 |
'btn_atts' => 'class="mr-1 el-button--info el-button--soft el-button--mini ff_nag_cross" data-notice_type="temp" data-notice_name="review_query"', |
| 54 |
], |
| 55 |
[ |
| 56 |
'href' => admin_url('admin.php?page=fluent_forms'), |
| 57 |
'btn_text' => 'Do not show again', |
| 58 |
'btn_atts' => 'class="text-button el-button--mini ff_nag_cross" data-notice_type="permanent" data-notice_name="review_query"', |
| 59 |
], |
| 60 |
], |
| 61 |
]; |
| 62 |
} |
| 63 |
} |
| 64 |
|