PluginProbe ʕ •ᴥ•ʔ
Weight Based Shipping Table Rate for WooCommerce – Flexible Shipping / 6.11.0
Weight Based Shipping Table Rate for WooCommerce – Flexible Shipping v6.11.0
6.12.1 6.12.0 6.11.0 6.10.0 6.9.1 6.9.0 6.8.1 6.8.0 6.7.4 6.7.3 6.7.2 6.7.0 4.21.7 4.22.0 4.22.1 4.23.0 4.23.1 4.23.2 4.23.3 4.24.0 4.24.1 4.24.10 4.24.11 4.24.12 4.24.13 4.24.14 4.24.15 4.24.16 4.24.17 4.24.18 4.24.19 4.24.2 4.24.4 4.24.6 4.24.7 4.24.8 4.24.9 4.25.0 4.25.1 4.25.2 4.25.4 4.25.5 4.25.6 4.25.7 4.25.8 4.3.0 4.3.1 4.4.0 4.4.1 4.5.0 4.5.1 4.6.0 4.6.1 4.7.0 4.7.1 4.7.2 4.8.0 4.8.1 4.8.3 4.8.4 4.8.5 4.9.0 5.0.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.0.9 5.1.0 5.1.1 5.1.2 5.1.3 5.2.0 5.3.0 5.3.1 5.3.3 5.3.4 5.3.5 6.0.0 6.1.0 6.1.1 6.1.2 6.2.0 6.2.1 6.2.2 6.2.3 6.2.4 6.3.0 trunk 6.4.0 1.4 6.4.1 1.4.1 6.4.2 1.5 6.4.3 1.6 6.4.5 1.6.1 6.5.0 1.6.2 6.5.1 1.7 6.5.2 1.8 6.5.3 1.9 6.5.4 1.9.1 6.5.5 1.9.10 6.5.6 1.9.11 6.5.7 1.9.12 6.5.8 1.9.2 6.6.0 1.9.3 6.6.1 1.9.4 6.6.2 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0 2.0.1 2.1 2.1.1 2.1.10 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.6 3.0.7 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.10.0 3.11.0 3.11.1 3.11.2 3.11.3 3.11.4 3.12.0 3.13.0 3.14.0 3.14.1 3.14.2 3.14.3 3.14.4 3.15.0 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.16.5 3.2.0 3.3.1 3.3.10 3.3.11 3.3.12 3.3.13 3.3.14 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.5.0 3.5.1 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.7.0 3.8.0 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.15 3.9.16 3.9.17 3.9.18 3.9.19 3.9.2 3.9.20 3.9.21 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.9 4.0.0 4.0.1 4.0.10 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10.0 4.10.1 4.11.0 4.11.1 4.11.2 4.11.3 4.11.4 4.11.5 4.11.6 4.11.7 4.11.8 4.11.9 4.12.0 4.13.0 4.13.1 4.13.2 4.13.3 4.14.0 4.14.1 4.14.2 4.15.0 4.16.0 4.16.1 4.16.2 4.17.0 4.18.0 4.18.1 4.18.2 4.18.3 4.18.4 4.18.5 4.18.6 4.19.0 4.19.1 4.2.0 4.20.0 4.20.1 4.20.2 4.20.3 4.21.0 4.21.1 4.21.2 4.21.3 4.21.4 4.21.5
flexible-shipping / vendor_prefixed / wpdesk / wp-pointer / src / WPDesk / Pointer / PointerMessage.php
flexible-shipping / vendor_prefixed / wpdesk / wp-pointer / src / WPDesk / Pointer Last commit date
views 2 weeks ago PointerConditions.php 2 weeks ago PointerMessage.php 2 weeks ago PointerPosition.php 2 weeks ago PointersScripts.php 2 weeks ago
PointerMessage.php
288 lines
1 <?php
2
3 namespace FSVendor\WPDesk\Pointer;
4
5 /**
6 * WordPress admin pointer message.
7 *
8 * @package WPDesk\Pointer
9 */
10 class PointerMessage
11 {
12 const USER_META_DISMISSED_WP_POINTERS = 'dismissed_wp_pointers';
13 /**
14 * Is action added?
15 * @var bool
16 */
17 private $actionAdded = \false;
18 /**
19 * @var string
20 */
21 private $id;
22 /**
23 * @var string
24 */
25 private $anchor;
26 /**
27 * @var string
28 */
29 private $content;
30 /**
31 * @var string
32 */
33 private $title;
34 /**
35 * @var PointerPosition
36 */
37 private $position;
38 /**
39 * @var string|array
40 */
41 private $pointerClass;
42 /**
43 * @var int
44 */
45 private $pointerWidth;
46 /**
47 * @var PointerConditions
48 */
49 private $conditions;
50 /**
51 * @var array
52 */
53 private $pointerCss = array();
54 /**
55 * @var array
56 */
57 private $defaultPointerCss = array('top' => '50%', 'left' => '100%', '-webkit-transform' => 'translateY(-50%)', '-ms-transform' => 'translateY(-50%)', 'transform' => 'translateY(-50%)');
58 /**
59 * PointerMessage constructor.
60 *
61 * @param string $id
62 * @param string $anchor
63 * @param string $title
64 * @param string $content
65 * @param PointerPosition $position
66 * @param string pointerClass
67 * @param int $pointerWidth
68 * @param null|PointerConditions $conditions Pointer conditions.
69 * @param array $pointerCss Pointer CSS.
70 */
71 public function __construct($id, $anchor, $title, $content, $position = null, $pointerClass = 'wp-pointer', $pointerWidth = 320, $conditions = null, $pointerCss = array())
72 {
73 $this->id = $id;
74 $this->anchor = $anchor;
75 $this->title = $title;
76 $this->content = $content;
77 if ($position === null) {
78 $position = new PointerPosition();
79 }
80 $this->position = $position;
81 $this->pointerClass = $pointerClass;
82 $this->pointerWidth = $pointerWidth;
83 if (null === $conditions) {
84 $this->conditions = new PointerConditions();
85 } else {
86 $this->conditions = $conditions;
87 }
88 $this->pointerCss = $pointerCss;
89 $this->addAction();
90 }
91 /**
92 * Enqueue scripts.
93 */
94 public function enqueueScripts()
95 {
96 wp_enqueue_style('wp-pointer');
97 wp_enqueue_script('wp-pointer');
98 }
99 /**
100 * Add notice action.
101 */
102 protected function addAction()
103 {
104 if (!$this->actionAdded) {
105 add_action('admin_print_footer_scripts', array($this, 'maybeRenderJavascript'));
106 add_action('admin_enqueue_scripts', array($this, 'enqueueScripts'));
107 $this->actionAdded = \true;
108 }
109 }
110 /**
111 * Remove action.
112 */
113 public function removeAction()
114 {
115 if ($this->actionAdded) {
116 remove_action('admin_print_footer_scripts', array($this, 'maybeRenderJavascript'));
117 remove_action('admin_enqueue_scripts', array($this, 'enqueueScripts'));
118 $this->actionAdded = \false;
119 }
120 }
121 /**
122 * @return string
123 */
124 public function getId()
125 {
126 return $this->id;
127 }
128 /**
129 * @param string $id
130 */
131 public function setId($id)
132 {
133 $this->id = $id;
134 }
135 /**
136 * @return string
137 */
138 public function getAnchor()
139 {
140 return $this->anchor;
141 }
142 /**
143 * @param string $anchor
144 */
145 public function setAnchor($anchor)
146 {
147 $this->anchor = $anchor;
148 }
149 /**
150 * @return string
151 */
152 public function getContent()
153 {
154 return $this->content;
155 }
156 /**
157 * @param string $content
158 */
159 public function setContent($content)
160 {
161 $this->content = $content;
162 }
163 /**
164 * @return string
165 */
166 public function getTitle()
167 {
168 return $this->title;
169 }
170 /**
171 * @param string $title
172 */
173 public function setTitle($title)
174 {
175 $this->title = $title;
176 }
177 /**
178 * @return array|string
179 */
180 public function getPosition()
181 {
182 return $this->position;
183 }
184 /**
185 * @param array|string $position
186 */
187 public function setPosition($position)
188 {
189 $this->position = $position;
190 }
191 /**
192 * @return array|string
193 */
194 public function getPointerClass()
195 {
196 return $this->pointerClass;
197 }
198 /**
199 * @param array|string $pointerClass
200 */
201 public function setPointerClass($pointerClass)
202 {
203 $this->pointerClass = $pointerClass;
204 }
205 /**
206 * @return int
207 */
208 public function getPointerWidth()
209 {
210 return $this->pointerWidth;
211 }
212 /**
213 * @param int $pointerWidth
214 */
215 public function setPointerWidth($pointerWidth)
216 {
217 $this->pointerWidth = $pointerWidth;
218 }
219 /**
220 * @return PointerConditions
221 */
222 public function getConditions()
223 {
224 return $this->conditions;
225 }
226 /**
227 * @return array
228 */
229 public function getPointerCss()
230 {
231 return $this->pointerCss;
232 }
233 /**
234 * @param PointerConditions $conditions
235 */
236 public function setConditions($conditions)
237 {
238 $this->conditions = $conditions;
239 }
240 /**
241 * Render Java Script for pointer message.
242 */
243 public function renderJavaScript()
244 {
245 $pointerAnchor = $this->getAnchor();
246 $pointerClass = $this->getPointerClass();
247 $pointerContentId = 'wpdesk_pointer_content_' . $this->getId();
248 $pointerWidth = $this->getPointerWidth();
249 $pointerContent = sprintf('<h3>%1$s</h3><p id="%2$s">%3$s</p>', $this->title, $pointerContentId, $this->content);
250 $pointerPosition = $this->getPosition();
251 $pointerId = $this->getId();
252 $pointerCss = array_merge($this->defaultPointerCss, $this->getPointerCss());
253 include 'views/html-script-pointer-message.php';
254 }
255 /**
256 * Meybe render Java Script for pointer message.
257 */
258 public function maybeRenderJavascript()
259 {
260 if ($this->conditions->areConditionsMet() && !$this->isDismissed()) {
261 $this->renderJavaScript();
262 }
263 }
264 /**
265 * Is pointer message already dismissed?
266 *
267 * @return bool
268 */
269 private function isDismissed()
270 {
271 $dismissedPointerMessages = array_filter(explode(',', (string) get_user_meta(get_current_user_id(), self::USER_META_DISMISSED_WP_POINTERS, \true)));
272 return in_array($this->id, $dismissedPointerMessages, \true);
273 }
274 /**
275 * Un dismiss pointer message.
276 */
277 public function unDismiss()
278 {
279 $dismissedPointerMessages = array_filter(explode(',', (string) get_user_meta(get_current_user_id(), self::USER_META_DISMISSED_WP_POINTERS, \true)));
280 foreach ($dismissedPointerMessages as $key => $value) {
281 if ($value === $this->getId()) {
282 unset($dismissedPointerMessages[$key]);
283 update_user_meta(get_current_user_id(), self::USER_META_DISMISSED_WP_POINTERS, implode(',', $dismissedPointerMessages));
284 }
285 }
286 }
287 }
288