PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.11.3
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.11.3
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
visualizer / vendor / codeinwp / themeisle-sdk / src / Modules / Review.php

Review.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 3.11.3, at vendor/codeinwp/themeisle-sdk/src/Modules/Review.php

119 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The Review model class for ThemeIsle SDK
4 *
5 * @package ThemeIsleSDK
6 * @subpackage Modules
7 * @copyright Copyright (c) 2017, Marius Cristea
8 * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9 * @since 1.0.0
10 */
11
12 namespace ThemeisleSDK\Modules;
13
14 use ThemeisleSDK\Common\Abstract_Module;
15 use ThemeisleSDK\Loader;
16 use ThemeisleSDK\Product;
17
18 // Exit if accessed directly.
19 if ( ! defined( 'ABSPATH' ) ) {
20 exit;
21 }
22
23 /**
24 * Review module for ThemeIsle SDK.
25 */
26 class Review extends Abstract_Module {
27
28 /**
29 * Check if we should load module for this.
30 *
31 * @param Product $product Product to check.
32 *
33 * @return bool Should load ?
34 */
35 public function can_load( $product ) {
36 if ( $this->is_from_partner( $product ) ) {
37 return false;
38 }
39 if ( ! $product->is_wordpress_available() ) {
40 return false;
41 }
42
43 return apply_filters( $product->get_slug() . '_sdk_should_review', true );
44 }
45
46
47 /**
48 * Add notification to queue.
49 *
50 * @param array $all_notifications Previous notification.
51 *
52 * @return array All notifications.
53 */
54 public function add_notification( $all_notifications ) {
55
56 $developers = [
57 'Bogdan',
58 'Marius',
59 'Hardeep',
60 'Rodica',
61 'Stefan',
62 'Uriahs',
63 'Madalin',
64 'Cristi',
65 'Silviu',
66 'Andrei',
67 ];
68
69 $link = 'https://wordpress.org/support/' . $this->product->get_type() . '/' . $this->product->get_slug() . '/reviews/#wporg-footer';
70
71 $message = apply_filters( $this->product->get_key() . '_feedback_review_message', Loader::$labels['review']['notice'] );
72
73 $button_submit = apply_filters( $this->product->get_key() . '_feedback_review_button_do', Loader::$labels['review']['ctay'] );
74 $button_cancel = apply_filters( $this->product->get_key() . '_feedback_review_button_cancel', Loader::$labels['review']['ctan'] );
75 $message = str_replace(
76 [ '{product}', '{developer}' ],
77 [
78 $this->product->get_friendly_name(),
79 $developers[ strlen( get_site_url() ) % 10 ],
80 ],
81 $message
82 );
83
84 $all_notifications[] = [
85 'id' => $this->product->get_key() . '_review_flag',
86 'message' => $message,
87 'ctas' => [
88 'confirm' => [
89 'link' => $link,
90 'text' => $button_submit,
91 ],
92 'cancel' => [
93 'link' => '#',
94 'text' => $button_cancel,
95 ],
96 ],
97 ];
98
99 return $all_notifications;
100 }
101
102
103 /**
104 * Load module logic.
105 *
106 * @param Product $product Product to load.
107 *
108 * @return Review Module instance.
109 */
110 public function load( $product ) {
111
112 $this->product = $product;
113
114 add_filter( 'themeisle_sdk_registered_notifications', [ $this, 'add_notification' ] );
115
116 return $this;
117 }
118 }
119