WP Review - Version 5.2.0

Version Description

Download this release

Release Info

Developer MyThemeShop
Plugin Icon 128x128 WP Review
Version 5.2.0
Comparing to
See all releases

Code changes from version 5.1.8 to 5.2.0

Files changed (46) hide show
  1. LICENSE +674 -674
  2. admin/activation.php +8 -8
  3. admin/admin.php +573 -557
  4. admin/assets/css/admin.css +1 -1
  5. admin/assets/css/jquery-ui.min.css +359 -359
  6. admin/assets/css/select2.min.css +1 -1
  7. admin/assets/images/loading.svg +16 -16
  8. admin/assets/images/wp-review-pro.jpg +0 -0
  9. admin/assets/js/admin.import.js +33 -33
  10. admin/assets/js/admin.js +831 -831
  11. admin/assets/js/editor-plugin.js +195 -195
  12. admin/assets/js/rating-inputs.js +198 -198
  13. admin/assets/js/review-items.js +244 -244
  14. admin/assets/js/select2.min.js +0 -0
  15. admin/assets/js/wp-review-tab-widget-admin.js +39 -39
  16. admin/assets/sass/admin.scss +0 -842
  17. admin/assets/sourcemaps/admin.css.map +0 -1
  18. admin/class-wp-review-form-field.php +57 -57
  19. admin/class-wp-review-importer.php +57 -57
  20. admin/class-wp-review-options.php +200 -200
  21. admin/demo-importer.php +55 -55
  22. admin/demo-importer/class-wp-import.php +1198 -1198
  23. admin/demo-importer/class-wp-review-demo-importer.php +38 -38
  24. admin/demo-importer/parsers.php +698 -698
  25. admin/font-awesome-icons.php +687 -687
  26. admin/metaboxes.php +1283 -1283
  27. admin/options/facebook.php +45 -45
  28. admin/options/google.php +30 -30
  29. admin/options/hello-bar.php +231 -231
  30. admin/options/help.php +27 -27
  31. admin/options/import.php +79 -79
  32. admin/options/multisite.php +344 -344
  33. admin/options/popup.php +274 -274
  34. admin/options/review.php +1016 -1016
  35. admin/options/role-manager.php +42 -42
  36. admin/options/yelp.php +31 -31
  37. admin/review-options-meta-box.php +243 -243
  38. box-templates/aqua.php +471 -471
  39. box-templates/default.php +234 -234
  40. box-templates/global/partials/review-links.php +34 -34
  41. box-templates/global/partials/review-schema.php +69 -69
  42. comments/comments.php +74 -74
  43. filter-list.php +543 -543
  44. includes/ajax.php +432 -432
  45. includes/comments.php +376 -376
  46. includes/demo/demo-content.xml +0 -310
LICENSE CHANGED
@@ -1,674 +1,674 @@
1
- GNU GENERAL PUBLIC LICENSE
2
- Version 3, 29 June 2007
3
-
4
- Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
- Everyone is permitted to copy and distribute verbatim copies
6
- of this license document, but changing it is not allowed.
7
-
8
- Preamble
9
-
10
- The GNU General Public License is a free, copyleft license for
11
- software and other kinds of works.
12
-
13
- The licenses for most software and other practical works are designed
14
- to take away your freedom to share and change the works. By contrast,
15
- the GNU General Public License is intended to guarantee your freedom to
16
- share and change all versions of a program--to make sure it remains free
17
- software for all its users. We, the Free Software Foundation, use the
18
- GNU General Public License for most of our software; it applies also to
19
- any other work released this way by its authors. You can apply it to
20
- your programs, too.
21
-
22
- When we speak of free software, we are referring to freedom, not
23
- price. Our General Public Licenses are designed to make sure that you
24
- have the freedom to distribute copies of free software (and charge for
25
- them if you wish), that you receive source code or can get it if you
26
- want it, that you can change the software or use pieces of it in new
27
- free programs, and that you know you can do these things.
28
-
29
- To protect your rights, we need to prevent others from denying you
30
- these rights or asking you to surrender the rights. Therefore, you have
31
- certain responsibilities if you distribute copies of the software, or if
32
- you modify it: responsibilities to respect the freedom of others.
33
-
34
- For example, if you distribute copies of such a program, whether
35
- gratis or for a fee, you must pass on to the recipients the same
36
- freedoms that you received. You must make sure that they, too, receive
37
- or can get the source code. And you must show them these terms so they
38
- know their rights.
39
-
40
- Developers that use the GNU GPL protect your rights with two steps:
41
- (1) assert copyright on the software, and (2) offer you this License
42
- giving you legal permission to copy, distribute and/or modify it.
43
-
44
- For the developers' and authors' protection, the GPL clearly explains
45
- that there is no warranty for this free software. For both users' and
46
- authors' sake, the GPL requires that modified versions be marked as
47
- changed, so that their problems will not be attributed erroneously to
48
- authors of previous versions.
49
-
50
- Some devices are designed to deny users access to install or run
51
- modified versions of the software inside them, although the manufacturer
52
- can do so. This is fundamentally incompatible with the aim of
53
- protecting users' freedom to change the software. The systematic
54
- pattern of such abuse occurs in the area of products for individuals to
55
- use, which is precisely where it is most unacceptable. Therefore, we
56
- have designed this version of the GPL to prohibit the practice for those
57
- products. If such problems arise substantially in other domains, we
58
- stand ready to extend this provision to those domains in future versions
59
- of the GPL, as needed to protect the freedom of users.
60
-
61
- Finally, every program is threatened constantly by software patents.
62
- States should not allow patents to restrict development and use of
63
- software on general-purpose computers, but in those that do, we wish to
64
- avoid the special danger that patents applied to a free program could
65
- make it effectively proprietary. To prevent this, the GPL assures that
66
- patents cannot be used to render the program non-free.
67
-
68
- The precise terms and conditions for copying, distribution and
69
- modification follow.
70
-
71
- TERMS AND CONDITIONS
72
-
73
- 0. Definitions.
74
-
75
- "This License" refers to version 3 of the GNU General Public License.
76
-
77
- "Copyright" also means copyright-like laws that apply to other kinds of
78
- works, such as semiconductor masks.
79
-
80
- "The Program" refers to any copyrightable work licensed under this
81
- License. Each licensee is addressed as "you". "Licensees" and
82
- "recipients" may be individuals or organizations.
83
-
84
- To "modify" a work means to copy from or adapt all or part of the work
85
- in a fashion requiring copyright permission, other than the making of an
86
- exact copy. The resulting work is called a "modified version" of the
87
- earlier work or a work "based on" the earlier work.
88
-
89
- A "covered work" means either the unmodified Program or a work based
90
- on the Program.
91
-
92
- To "propagate" a work means to do anything with it that, without
93
- permission, would make you directly or secondarily liable for
94
- infringement under applicable copyright law, except executing it on a
95
- computer or modifying a private copy. Propagation includes copying,
96
- distribution (with or without modification), making available to the
97
- public, and in some countries other activities as well.
98
-
99
- To "convey" a work means any kind of propagation that enables other
100
- parties to make or receive copies. Mere interaction with a user through
101
- a computer network, with no transfer of a copy, is not conveying.
102
-
103
- An interactive user interface displays "Appropriate Legal Notices"
104
- to the extent that it includes a convenient and prominently visible
105
- feature that (1) displays an appropriate copyright notice, and (2)
106
- tells the user that there is no warranty for the work (except to the
107
- extent that warranties are provided), that licensees may convey the
108
- work under this License, and how to view a copy of this License. If
109
- the interface presents a list of user commands or options, such as a
110
- menu, a prominent item in the list meets this criterion.
111
-
112
- 1. Source Code.
113
-
114
- The "source code" for a work means the preferred form of the work
115
- for making modifications to it. "Object code" means any non-source
116
- form of a work.
117
-
118
- A "Standard Interface" means an interface that either is an official
119
- standard defined by a recognized standards body, or, in the case of
120
- interfaces specified for a particular programming language, one that
121
- is widely used among developers working in that language.
122
-
123
- The "System Libraries" of an executable work include anything, other
124
- than the work as a whole, that (a) is included in the normal form of
125
- packaging a Major Component, but which is not part of that Major
126
- Component, and (b) serves only to enable use of the work with that
127
- Major Component, or to implement a Standard Interface for which an
128
- implementation is available to the public in source code form. A
129
- "Major Component", in this context, means a major essential component
130
- (kernel, window system, and so on) of the specific operating system
131
- (if any) on which the executable work runs, or a compiler used to
132
- produce the work, or an object code interpreter used to run it.
133
-
134
- The "Corresponding Source" for a work in object code form means all
135
- the source code needed to generate, install, and (for an executable
136
- work) run the object code and to modify the work, including scripts to
137
- control those activities. However, it does not include the work's
138
- System Libraries, or general-purpose tools or generally available free
139
- programs which are used unmodified in performing those activities but
140
- which are not part of the work. For example, Corresponding Source
141
- includes interface definition files associated with source files for
142
- the work, and the source code for shared libraries and dynamically
143
- linked subprograms that the work is specifically designed to require,
144
- such as by intimate data communication or control flow between those
145
- subprograms and other parts of the work.
146
-
147
- The Corresponding Source need not include anything that users
148
- can regenerate automatically from other parts of the Corresponding
149
- Source.
150
-
151
- The Corresponding Source for a work in source code form is that
152
- same work.
153
-
154
- 2. Basic Permissions.
155
-
156
- All rights granted under this License are granted for the term of
157
- copyright on the Program, and are irrevocable provided the stated
158
- conditions are met. This License explicitly affirms your unlimited
159
- permission to run the unmodified Program. The output from running a
160
- covered work is covered by this License only if the output, given its
161
- content, constitutes a covered work. This License acknowledges your
162
- rights of fair use or other equivalent, as provided by copyright law.
163
-
164
- You may make, run and propagate covered works that you do not
165
- convey, without conditions so long as your license otherwise remains
166
- in force. You may convey covered works to others for the sole purpose
167
- of having them make modifications exclusively for you, or provide you
168
- with facilities for running those works, provided that you comply with
169
- the terms of this License in conveying all material for which you do
170
- not control copyright. Those thus making or running the covered works
171
- for you must do so exclusively on your behalf, under your direction
172
- and control, on terms that prohibit them from making any copies of
173
- your copyrighted material outside their relationship with you.
174
-
175
- Conveying under any other circumstances is permitted solely under
176
- the conditions stated below. Sublicensing is not allowed; section 10
177
- makes it unnecessary.
178
-
179
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
-
181
- No covered work shall be deemed part of an effective technological
182
- measure under any applicable law fulfilling obligations under article
183
- 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
- similar laws prohibiting or restricting circumvention of such
185
- measures.
186
-
187
- When you convey a covered work, you waive any legal power to forbid
188
- circumvention of technological measures to the extent such circumvention
189
- is effected by exercising rights under this License with respect to
190
- the covered work, and you disclaim any intention to limit operation or
191
- modification of the work as a means of enforcing, against the work's
192
- users, your or third parties' legal rights to forbid circumvention of
193
- technological measures.
194
-
195
- 4. Conveying Verbatim Copies.
196
-
197
- You may convey verbatim copies of the Program's source code as you
198
- receive it, in any medium, provided that you conspicuously and
199
- appropriately publish on each copy an appropriate copyright notice;
200
- keep intact all notices stating that this License and any
201
- non-permissive terms added in accord with section 7 apply to the code;
202
- keep intact all notices of the absence of any warranty; and give all
203
- recipients a copy of this License along with the Program.
204
-
205
- You may charge any price or no price for each copy that you convey,
206
- and you may offer support or warranty protection for a fee.
207
-
208
- 5. Conveying Modified Source Versions.
209
-
210
- You may convey a work based on the Program, or the modifications to
211
- produce it from the Program, in the form of source code under the
212
- terms of section 4, provided that you also meet all of these conditions:
213
-
214
- a) The work must carry prominent notices stating that you modified
215
- it, and giving a relevant date.
216
-
217
- b) The work must carry prominent notices stating that it is
218
- released under this License and any conditions added under section
219
- 7. This requirement modifies the requirement in section 4 to
220
- "keep intact all notices".
221
-
222
- c) You must license the entire work, as a whole, under this
223
- License to anyone who comes into possession of a copy. This
224
- License will therefore apply, along with any applicable section 7
225
- additional terms, to the whole of the work, and all its parts,
226
- regardless of how they are packaged. This License gives no
227
- permission to license the work in any other way, but it does not
228
- invalidate such permission if you have separately received it.
229
-
230
- d) If the work has interactive user interfaces, each must display
231
- Appropriate Legal Notices; however, if the Program has interactive
232
- interfaces that do not display Appropriate Legal Notices, your
233
- work need not make them do so.
234
-
235
- A compilation of a covered work with other separate and independent
236
- works, which are not by their nature extensions of the covered work,
237
- and which are not combined with it such as to form a larger program,
238
- in or on a volume of a storage or distribution medium, is called an
239
- "aggregate" if the compilation and its resulting copyright are not
240
- used to limit the access or legal rights of the compilation's users
241
- beyond what the individual works permit. Inclusion of a covered work
242
- in an aggregate does not cause this License to apply to the other
243
- parts of the aggregate.
244
-
245
- 6. Conveying Non-Source Forms.
246
-
247
- You may convey a covered work in object code form under the terms
248
- of sections 4 and 5, provided that you also convey the
249
- machine-readable Corresponding Source under the terms of this License,
250
- in one of these ways:
251
-
252
- a) Convey the object code in, or embodied in, a physical product
253
- (including a physical distribution medium), accompanied by the
254
- Corresponding Source fixed on a durable physical medium
255
- customarily used for software interchange.
256
-
257
- b) Convey the object code in, or embodied in, a physical product
258
- (including a physical distribution medium), accompanied by a
259
- written offer, valid for at least three years and valid for as
260
- long as you offer spare parts or customer support for that product
261
- model, to give anyone who possesses the object code either (1) a
262
- copy of the Corresponding Source for all the software in the
263
- product that is covered by this License, on a durable physical
264
- medium customarily used for software interchange, for a price no
265
- more than your reasonable cost of physically performing this
266
- conveying of source, or (2) access to copy the
267
- Corresponding Source from a network server at no charge.
268
-
269
- c) Convey individual copies of the object code with a copy of the
270
- written offer to provide the Corresponding Source. This
271
- alternative is allowed only occasionally and noncommercially, and
272
- only if you received the object code with such an offer, in accord
273
- with subsection 6b.
274
-
275
- d) Convey the object code by offering access from a designated
276
- place (gratis or for a charge), and offer equivalent access to the
277
- Corresponding Source in the same way through the same place at no
278
- further charge. You need not require recipients to copy the
279
- Corresponding Source along with the object code. If the place to
280
- copy the object code is a network server, the Corresponding Source
281
- may be on a different server (operated by you or a third party)
282
- that supports equivalent copying facilities, provided you maintain
283
- clear directions next to the object code saying where to find the
284
- Corresponding Source. Regardless of what server hosts the
285
- Corresponding Source, you remain obligated to ensure that it is
286
- available for as long as needed to satisfy these requirements.
287
-
288
- e) Convey the object code using peer-to-peer transmission, provided
289
- you inform other peers where the object code and Corresponding
290
- Source of the work are being offered to the general public at no
291
- charge under subsection 6d.
292
-
293
- A separable portion of the object code, whose source code is excluded
294
- from the Corresponding Source as a System Library, need not be
295
- included in conveying the object code work.
296
-
297
- A "User Product" is either (1) a "consumer product", which means any
298
- tangible personal property which is normally used for personal, family,
299
- or household purposes, or (2) anything designed or sold for incorporation
300
- into a dwelling. In determining whether a product is a consumer product,
301
- doubtful cases shall be resolved in favor of coverage. For a particular
302
- product received by a particular user, "normally used" refers to a
303
- typical or common use of that class of product, regardless of the status
304
- of the particular user or of the way in which the particular user
305
- actually uses, or expects or is expected to use, the product. A product
306
- is a consumer product regardless of whether the product has substantial
307
- commercial, industrial or non-consumer uses, unless such uses represent
308
- the only significant mode of use of the product.
309
-
310
- "Installation Information" for a User Product means any methods,
311
- procedures, authorization keys, or other information required to install
312
- and execute modified versions of a covered work in that User Product from
313
- a modified version of its Corresponding Source. The information must
314
- suffice to ensure that the continued functioning of the modified object
315
- code is in no case prevented or interfered with solely because
316
- modification has been made.
317
-
318
- If you convey an object code work under this section in, or with, or
319
- specifically for use in, a User Product, and the conveying occurs as
320
- part of a transaction in which the right of possession and use of the
321
- User Product is transferred to the recipient in perpetuity or for a
322
- fixed term (regardless of how the transaction is characterized), the
323
- Corresponding Source conveyed under this section must be accompanied
324
- by the Installation Information. But this requirement does not apply
325
- if neither you nor any third party retains the ability to install
326
- modified object code on the User Product (for example, the work has
327
- been installed in ROM).
328
-
329
- The requirement to provide Installation Information does not include a
330
- requirement to continue to provide support service, warranty, or updates
331
- for a work that has been modified or installed by the recipient, or for
332
- the User Product in which it has been modified or installed. Access to a
333
- network may be denied when the modification itself materially and
334
- adversely affects the operation of the network or violates the rules and
335
- protocols for communication across the network.
336
-
337
- Corresponding Source conveyed, and Installation Information provided,
338
- in accord with this section must be in a format that is publicly
339
- documented (and with an implementation available to the public in
340
- source code form), and must require no special password or key for
341
- unpacking, reading or copying.
342
-
343
- 7. Additional Terms.
344
-
345
- "Additional permissions" are terms that supplement the terms of this
346
- License by making exceptions from one or more of its conditions.
347
- Additional permissions that are applicable to the entire Program shall
348
- be treated as though they were included in this License, to the extent
349
- that they are valid under applicable law. If additional permissions
350
- apply only to part of the Program, that part may be used separately
351
- under those permissions, but the entire Program remains governed by
352
- this License without regard to the additional permissions.
353
-
354
- When you convey a copy of a covered work, you may at your option
355
- remove any additional permissions from that copy, or from any part of
356
- it. (Additional permissions may be written to require their own
357
- removal in certain cases when you modify the work.) You may place
358
- additional permissions on material, added by you to a covered work,
359
- for which you have or can give appropriate copyright permission.
360
-
361
- Notwithstanding any other provision of this License, for material you
362
- add to a covered work, you may (if authorized by the copyright holders of
363
- that material) supplement the terms of this License with terms:
364
-
365
- a) Disclaiming warranty or limiting liability differently from the
366
- terms of sections 15 and 16 of this License; or
367
-
368
- b) Requiring preservation of specified reasonable legal notices or
369
- author attributions in that material or in the Appropriate Legal
370
- Notices displayed by works containing it; or
371
-
372
- c) Prohibiting misrepresentation of the origin of that material, or
373
- requiring that modified versions of such material be marked in
374
- reasonable ways as different from the original version; or
375
-
376
- d) Limiting the use for publicity purposes of names of licensors or
377
- authors of the material; or
378
-
379
- e) Declining to grant rights under trademark law for use of some
380
- trade names, trademarks, or service marks; or
381
-
382
- f) Requiring indemnification of licensors and authors of that
383
- material by anyone who conveys the material (or modified versions of
384
- it) with contractual assumptions of liability to the recipient, for
385
- any liability that these contractual assumptions directly impose on
386
- those licensors and authors.
387
-
388
- All other non-permissive additional terms are considered "further
389
- restrictions" within the meaning of section 10. If the Program as you
390
- received it, or any part of it, contains a notice stating that it is
391
- governed by this License along with a term that is a further
392
- restriction, you may remove that term. If a license document contains
393
- a further restriction but permits relicensing or conveying under this
394
- License, you may add to a covered work material governed by the terms
395
- of that license document, provided that the further restriction does
396
- not survive such relicensing or conveying.
397
-
398
- If you add terms to a covered work in accord with this section, you
399
- must place, in the relevant source files, a statement of the
400
- additional terms that apply to those files, or a notice indicating
401
- where to find the applicable terms.
402
-
403
- Additional terms, permissive or non-permissive, may be stated in the
404
- form of a separately written license, or stated as exceptions;
405
- the above requirements apply either way.
406
-
407
- 8. Termination.
408
-
409
- You may not propagate or modify a covered work except as expressly
410
- provided under this License. Any attempt otherwise to propagate or
411
- modify it is void, and will automatically terminate your rights under
412
- this License (including any patent licenses granted under the third
413
- paragraph of section 11).
414
-
415
- However, if you cease all violation of this License, then your
416
- license from a particular copyright holder is reinstated (a)
417
- provisionally, unless and until the copyright holder explicitly and
418
- finally terminates your license, and (b) permanently, if the copyright
419
- holder fails to notify you of the violation by some reasonable means
420
- prior to 60 days after the cessation.
421
-
422
- Moreover, your license from a particular copyright holder is
423
- reinstated permanently if the copyright holder notifies you of the
424
- violation by some reasonable means, this is the first time you have
425
- received notice of violation of this License (for any work) from that
426
- copyright holder, and you cure the violation prior to 30 days after
427
- your receipt of the notice.
428
-
429
- Termination of your rights under this section does not terminate the
430
- licenses of parties who have received copies or rights from you under
431
- this License. If your rights have been terminated and not permanently
432
- reinstated, you do not qualify to receive new licenses for the same
433
- material under section 10.
434
-
435
- 9. Acceptance Not Required for Having Copies.
436
-
437
- You are not required to accept this License in order to receive or
438
- run a copy of the Program. Ancillary propagation of a covered work
439
- occurring solely as a consequence of using peer-to-peer transmission
440
- to receive a copy likewise does not require acceptance. However,
441
- nothing other than this License grants you permission to propagate or
442
- modify any covered work. These actions infringe copyright if you do
443
- not accept this License. Therefore, by modifying or propagating a
444
- covered work, you indicate your acceptance of this License to do so.
445
-
446
- 10. Automatic Licensing of Downstream Recipients.
447
-
448
- Each time you convey a covered work, the recipient automatically
449
- receives a license from the original licensors, to run, modify and
450
- propagate that work, subject to this License. You are not responsible
451
- for enforcing compliance by third parties with this License.
452
-
453
- An "entity transaction" is a transaction transferring control of an
454
- organization, or substantially all assets of one, or subdividing an
455
- organization, or merging organizations. If propagation of a covered
456
- work results from an entity transaction, each party to that
457
- transaction who receives a copy of the work also receives whatever
458
- licenses to the work the party's predecessor in interest had or could
459
- give under the previous paragraph, plus a right to possession of the
460
- Corresponding Source of the work from the predecessor in interest, if
461
- the predecessor has it or can get it with reasonable efforts.
462
-
463
- You may not impose any further restrictions on the exercise of the
464
- rights granted or affirmed under this License. For example, you may
465
- not impose a license fee, royalty, or other charge for exercise of
466
- rights granted under this License, and you may not initiate litigation
467
- (including a cross-claim or counterclaim in a lawsuit) alleging that
468
- any patent claim is infringed by making, using, selling, offering for
469
- sale, or importing the Program or any portion of it.
470
-
471
- 11. Patents.
472
-
473
- A "contributor" is a copyright holder who authorizes use under this
474
- License of the Program or a work on which the Program is based. The
475
- work thus licensed is called the contributor's "contributor version".
476
-
477
- A contributor's "essential patent claims" are all patent claims
478
- owned or controlled by the contributor, whether already acquired or
479
- hereafter acquired, that would be infringed by some manner, permitted
480
- by this License, of making, using, or selling its contributor version,
481
- but do not include claims that would be infringed only as a
482
- consequence of further modification of the contributor version. For
483
- purposes of this definition, "control" includes the right to grant
484
- patent sublicenses in a manner consistent with the requirements of
485
- this License.
486
-
487
- Each contributor grants you a non-exclusive, worldwide, royalty-free
488
- patent license under the contributor's essential patent claims, to
489
- make, use, sell, offer for sale, import and otherwise run, modify and
490
- propagate the contents of its contributor version.
491
-
492
- In the following three paragraphs, a "patent license" is any express
493
- agreement or commitment, however denominated, not to enforce a patent
494
- (such as an express permission to practice a patent or covenant not to
495
- sue for patent infringement). To "grant" such a patent license to a
496
- party means to make such an agreement or commitment not to enforce a
497
- patent against the party.
498
-
499
- If you convey a covered work, knowingly relying on a patent license,
500
- and the Corresponding Source of the work is not available for anyone
501
- to copy, free of charge and under the terms of this License, through a
502
- publicly available network server or other readily accessible means,
503
- then you must either (1) cause the Corresponding Source to be so
504
- available, or (2) arrange to deprive yourself of the benefit of the
505
- patent license for this particular work, or (3) arrange, in a manner
506
- consistent with the requirements of this License, to extend the patent
507
- license to downstream recipients. "Knowingly relying" means you have
508
- actual knowledge that, but for the patent license, your conveying the
509
- covered work in a country, or your recipient's use of the covered work
510
- in a country, would infringe one or more identifiable patents in that
511
- country that you have reason to believe are valid.
512
-
513
- If, pursuant to or in connection with a single transaction or
514
- arrangement, you convey, or propagate by procuring conveyance of, a
515
- covered work, and grant a patent license to some of the parties
516
- receiving the covered work authorizing them to use, propagate, modify
517
- or convey a specific copy of the covered work, then the patent license
518
- you grant is automatically extended to all recipients of the covered
519
- work and works based on it.
520
-
521
- A patent license is "discriminatory" if it does not include within
522
- the scope of its coverage, prohibits the exercise of, or is
523
- conditioned on the non-exercise of one or more of the rights that are
524
- specifically granted under this License. You may not convey a covered
525
- work if you are a party to an arrangement with a third party that is
526
- in the business of distributing software, under which you make payment
527
- to the third party based on the extent of your activity of conveying
528
- the work, and under which the third party grants, to any of the
529
- parties who would receive the covered work from you, a discriminatory
530
- patent license (a) in connection with copies of the covered work
531
- conveyed by you (or copies made from those copies), or (b) primarily
532
- for and in connection with specific products or compilations that
533
- contain the covered work, unless you entered into that arrangement,
534
- or that patent license was granted, prior to 28 March 2007.
535
-
536
- Nothing in this License shall be construed as excluding or limiting
537
- any implied license or other defenses to infringement that may
538
- otherwise be available to you under applicable patent law.
539
-
540
- 12. No Surrender of Others' Freedom.
541
-
542
- If conditions are imposed on you (whether by court order, agreement or
543
- otherwise) that contradict the conditions of this License, they do not
544
- excuse you from the conditions of this License. If you cannot convey a
545
- covered work so as to satisfy simultaneously your obligations under this
546
- License and any other pertinent obligations, then as a consequence you may
547
- not convey it at all. For example, if you agree to terms that obligate you
548
- to collect a royalty for further conveying from those to whom you convey
549
- the Program, the only way you could satisfy both those terms and this
550
- License would be to refrain entirely from conveying the Program.
551
-
552
- 13. Use with the GNU Affero General Public License.
553
-
554
- Notwithstanding any other provision of this License, you have
555
- permission to link or combine any covered work with a work licensed
556
- under version 3 of the GNU Affero General Public License into a single
557
- combined work, and to convey the resulting work. The terms of this
558
- License will continue to apply to the part which is the covered work,
559
- but the special requirements of the GNU Affero General Public License,
560
- section 13, concerning interaction through a network will apply to the
561
- combination as such.
562
-
563
- 14. Revised Versions of this License.
564
-
565
- The Free Software Foundation may publish revised and/or new versions of
566
- the GNU General Public License from time to time. Such new versions will
567
- be similar in spirit to the present version, but may differ in detail to
568
- address new problems or concerns.
569
-
570
- Each version is given a distinguishing version number. If the
571
- Program specifies that a certain numbered version of the GNU General
572
- Public License "or any later version" applies to it, you have the
573
- option of following the terms and conditions either of that numbered
574
- version or of any later version published by the Free Software
575
- Foundation. If the Program does not specify a version number of the
576
- GNU General Public License, you may choose any version ever published
577
- by the Free Software Foundation.
578
-
579
- If the Program specifies that a proxy can decide which future
580
- versions of the GNU General Public License can be used, that proxy's
581
- public statement of acceptance of a version permanently authorizes you
582
- to choose that version for the Program.
583
-
584
- Later license versions may give you additional or different
585
- permissions. However, no additional obligations are imposed on any
586
- author or copyright holder as a result of your choosing to follow a
587
- later version.
588
-
589
- 15. Disclaimer of Warranty.
590
-
591
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
- APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
- HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
- OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
- PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
- IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
- ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
-
600
- 16. Limitation of Liability.
601
-
602
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
- WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
- THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
- GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
- USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
- DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
- PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
- EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
- SUCH DAMAGES.
611
-
612
- 17. Interpretation of Sections 15 and 16.
613
-
614
- If the disclaimer of warranty and limitation of liability provided
615
- above cannot be given local legal effect according to their terms,
616
- reviewing courts shall apply local law that most closely approximates
617
- an absolute waiver of all civil liability in connection with the
618
- Program, unless a warranty or assumption of liability accompanies a
619
- copy of the Program in return for a fee.
620
-
621
- END OF TERMS AND CONDITIONS
622
-
623
- How to Apply These Terms to Your New Programs
624
-
625
- If you develop a new program, and you want it to be of the greatest
626
- possible use to the public, the best way to achieve this is to make it
627
- free software which everyone can redistribute and change under these terms.
628
-
629
- To do so, attach the following notices to the program. It is safest
630
- to attach them to the start of each source file to most effectively
631
- state the exclusion of warranty; and each file should have at least
632
- the "copyright" line and a pointer to where the full notice is found.
633
-
634
- <one line to give the program's name and a brief idea of what it does.>
635
- Copyright (C) <year> <name of author>
636
-
637
- This program is free software: you can redistribute it and/or modify
638
- it under the terms of the GNU General Public License as published by
639
- the Free Software Foundation, either version 3 of the License, or
640
- (at your option) any later version.
641
-
642
- This program is distributed in the hope that it will be useful,
643
- but WITHOUT ANY WARRANTY; without even the implied warranty of
644
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
- GNU General Public License for more details.
646
-
647
- You should have received a copy of the GNU General Public License
648
- along with this program. If not, see <https://www.gnu.org/licenses/>.
649
-
650
- Also add information on how to contact you by electronic and paper mail.
651
-
652
- If the program does terminal interaction, make it output a short
653
- notice like this when it starts in an interactive mode:
654
-
655
- <program> Copyright (C) <year> <name of author>
656
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
- This is free software, and you are welcome to redistribute it
658
- under certain conditions; type `show c' for details.
659
-
660
- The hypothetical commands `show w' and `show c' should show the appropriate
661
- parts of the General Public License. Of course, your program's commands
662
- might be different; for a GUI interface, you would use an "about box".
663
-
664
- You should also get your employer (if you work as a programmer) or school,
665
- if any, to sign a "copyright disclaimer" for the program, if necessary.
666
- For more information on this, and how to apply and follow the GNU GPL, see
667
- <https://www.gnu.org/licenses/>.
668
-
669
- The GNU General Public License does not permit incorporating your program
670
- into proprietary programs. If your program is a subroutine library, you
671
- may consider it more useful to permit linking proprietary applications with
672
- the library. If this is what you want to do, use the GNU Lesser General
673
- Public License instead of this License. But first, please read
674
- <https://www.gnu.org/licenses/why-not-lgpl.html>.
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright (C) <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ <program> Copyright (C) <year> <name of author>
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <https://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <https://www.gnu.org/licenses/why-not-lgpl.html>.
admin/activation.php CHANGED
@@ -1,8 +1,8 @@
1
- <?php
2
- /**
3
- * Plugins activation code
4
- *
5
- * @package WP_Review
6
- */
7
-
8
- // Silence is gold.
1
+ <?php
2
+ /**
3
+ * Plugins activation code
4
+ *
5
+ * @package WP_Review
6
+ */
7
+
8
+ // Silence is gold.
admin/admin.php CHANGED
@@ -1,557 +1,573 @@
1
- <?php
2
- /**
3
- * Admin functions for this plugin.
4
- *
5
- * @since 1.0
6
- * @copyright Copyright (c) 2013, MyThemesShop
7
- * @author MyThemesShop
8
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9
- * @package WP_Review
10
- */
11
-
12
- /**
13
- * Register custom style for the meta box.
14
- *
15
- * @since 1.0
16
- * @since 3.0.0 Add select2
17
- *
18
- * @param string $hook_suffix Admin page hook suffix.
19
- */
20
- function wp_review_admin_style( $hook_suffix ) {
21
- if ( ! in_array( $hook_suffix, array( 'post-new.php', 'edit-comments.php', 'post.php', 'edit.php', 'widgets.php', 'settings_page_wp-review/admin/options' ), true ) ) {
22
- return;
23
- }
24
-
25
- if ( 'customize' === get_current_screen()->id ) {
26
- return;
27
- }
28
-
29
- if ( 'settings_page_wp-review/admin/options' === $hook_suffix ) {
30
- wp_enqueue_style( 'fontawesome', WP_REVIEW_ASSETS . 'css/font-awesome.min.css', array(), '4.7.0' );
31
-
32
- wp_enqueue_script( 'js-cookie', WP_REVIEW_ASSETS . 'js/js.cookie.min.js', array(), '2.1.4', true );
33
-
34
- wp_enqueue_script( 'wp-review-admin-import', WP_REVIEW_URI . 'admin/assets/js/admin.import.js', array( 'jquery', 'wp-util' ), WP_REVIEW_PLUGIN_VERSION, true );
35
-
36
- wp_localize_script(
37
- 'wp-review-admin-import',
38
- 'wprImportVars',
39
- array(
40
- // translators: import source.
41
- 'confirm' => __( 'Are you sure you want to import from %s?', 'wp-review' ),
42
- 'server_error' => __( 'The server responded with an error. Try again.', 'wp-review' ),
43
- 'confirmOptionsImport' => __( 'Are you sure you want to import options? All current options will be lost.', 'wp-review' ),
44
- 'importOptionsNonce' => wp_create_nonce( 'wp-review-import-options' ),
45
- )
46
- );
47
- }
48
-
49
- if ( in_array( $hook_suffix, array( 'settings_page_wp-review/admin/options', 'post.php', 'post-new.php' ), true ) ) {
50
- wp_enqueue_style( 'jquery-ui', WP_REVIEW_URI . 'admin/assets/css/jquery-ui.min.css', array(), '1.12.1' );
51
-
52
- wp_enqueue_script( 'select2', WP_REVIEW_URI . 'admin/assets/js/select2.min.js', array( 'jquery' ), '4.0.6-rc.0', true );
53
- wp_enqueue_style( 'select2', WP_REVIEW_URI . 'admin/assets/css/select2.min.css', array(), '4.0.6-rc.0' );
54
- }
55
-
56
- // Load frontend css but not on the post editor screen.
57
- if ( stripos( 'post.php', $hook_suffix ) === false ) {
58
- wp_enqueue_style( 'wp_review-style', trailingslashit( WP_REVIEW_ASSETS ) . 'css/wp-review.css', array(), WP_REVIEW_PLUGIN_VERSION, 'all' );
59
- }
60
-
61
- wp_enqueue_style( 'wp-review-admin-style', WP_REVIEW_URI . 'admin/assets/css/admin.css', array( 'wp-color-picker' ), WP_REVIEW_PLUGIN_VERSION );
62
-
63
- $inline_css = '.column-wp_review_rating .pro-only-notice, .latestPost-review-wrapper .pro-only-notice { display: none; }';
64
- wp_add_inline_style( 'wp-review-admin-style', $inline_css );
65
-
66
- wp_enqueue_style( 'magnificPopup', WP_REVIEW_ASSETS . 'css/magnific-popup.css', array(), '1.1.0' );
67
- wp_enqueue_script( 'magnificPopup', WP_REVIEW_ASSETS . 'js/jquery.magnific-popup.min.js', array( 'jquery' ), '1.1.0', true );
68
-
69
- if ( in_array( $hook_suffix, array( 'post.php', 'post-new.php' ), true ) ) {
70
- wp_enqueue_script( 'wp-review-rating-inputs', WP_REVIEW_URI . 'admin/assets/js/rating-inputs.js', array( 'jquery-ui-slider' ), WP_REVIEW_PLUGIN_VERSION, true );
71
-
72
- wp_enqueue_script(
73
- 'wp-review-review-items',
74
- WP_REVIEW_URI . 'admin/assets/js/review-items.js',
75
- array( 'backbone', 'wp-review-admin-script', 'jquery-ui-sortable' ),
76
- WP_REVIEW_PLUGIN_VERSION,
77
- true
78
- );
79
- }
80
-
81
- wp_enqueue_script(
82
- 'wp-review-admin-script',
83
- WP_REVIEW_URI . 'admin/assets/js/admin.js',
84
- array(
85
- 'wp-color-picker',
86
- 'jquery',
87
- 'jquery-ui-core',
88
- 'jquery-ui-slider',
89
- 'jquery-ui-sortable',
90
- 'jquery-ui-datepicker',
91
- 'wp-util',
92
- 'magnificPopup',
93
- 'imagesloaded',
94
- ),
95
- WP_REVIEW_PLUGIN_VERSION,
96
- true
97
- );
98
-
99
- wp_localize_script(
100
- 'wp-review-admin-script',
101
- 'wprVars',
102
- array(
103
- 'ratingPermissionsCommentOnly' => WP_REVIEW_REVIEW_COMMENT_ONLY,
104
- 'ratingPermissionsBoth' => WP_REVIEW_REVIEW_ALLOW_BOTH,
105
- 'imgframe_title' => __( 'Select Image', 'wp-review' ),
106
- 'imgbutton_title' => __( 'Insert Image', 'wp-review' ),
107
- 'imgremove_title' => __( 'Remove Image', 'wp-review' ),
108
- 'title' => __( 'Title', 'wp-review' ),
109
- 'searchTerm' => __( 'Search term', 'wp-review' ),
110
- 'searchLocation' => __( 'Search location', 'wp-review' ),
111
- 'limit' => __( 'Limit', 'wp-review' ),
112
- 'searchRadius' => __( 'Radius', 'wp-review' ),
113
- 'searchCategories' => __( 'Categories', 'wp-review' ),
114
- 'searchLocale' => __( 'Locale', 'wp-review' ),
115
- 'searchOffset' => __( 'Offset', 'wp-review' ),
116
- 'sort_by' => __( 'SortBy', 'wp-review' ),
117
- 'searchPrice' => __( 'Price range', 'wp-review' ),
118
- 'open_now' => __( 'Open now', 'wp-review' ),
119
- 'attributes' => __( 'Attributes', 'wp-review' ),
120
- 'businessId' => __( 'Business ID', 'wp-review' ),
121
- 'locationLookup' => __( 'Location lookup', 'wp-review' ),
122
- 'placeId' => __( 'Place ID', 'wp-review' ),
123
- 'placeType' => __( 'Place type', 'wp-review' ),
124
- 'all' => __( 'All', 'wp-review' ),
125
- 'establishments' => __( 'Establishments', 'wp-review' ),
126
- 'addresses' => __( 'Addresses', 'wp-review' ),
127
- 'geocodes' => __( 'Geocodes', 'wp-review' ),
128
- 'pageId' => __( 'Page ID', 'wp-review' ),
129
- 'generateToken' => __( 'Generate token', 'wp-review' ),
130
- 'reviewIds' => __( 'Review IDs (separate by commas)', 'wp-review' ),
131
- 'reviewPosts' => __( 'Review posts', 'wp-review' ),
132
- 'queryType' => __( 'Query type', 'wp-review' ),
133
- 'recentReviews' => __( 'Recent reviews', 'wp-review' ),
134
- 'topRated' => __( 'Top rated', 'wp-review' ),
135
- 'mostVoted' => __( 'Most voted', 'wp-review' ),
136
- 'categoryReviews' => __( 'Category reviews', 'wp-review' ),
137
- 'reviewTypesText' => __( 'Review types', 'wp-review' ),
138
- 'separateByCommas' => __( 'separate by commas', 'wp-review' ),
139
- 'categoryIds' => __( 'Category IDs', 'wp-review' ),
140
- 'allowPagination' => __( 'Allow pagination', 'wp-review' ),
141
- 'numberOfReviews' => __( 'Number of reviews', 'wp-review' ),
142
- 'titleLength' => __( 'Title length (words)', 'wp-review' ),
143
- 'thumbSize' => __( 'Thumb size', 'wp-review' ),
144
- 'small' => __( 'Small', 'wp-review' ),
145
- 'large' => __( 'Large', 'wp-review' ),
146
- 'showDate' => __( 'Show date', 'wp-review' ),
147
- 'reviewBox' => __( 'Review box', 'wp-review' ),
148
- 'reviewTotal' => __( 'Review total', 'wp-review' ),
149
- 'visitorRating' => __( 'Visitor rating', 'wp-review' ),
150
- 'reviewId' => __( 'Review ID', 'wp-review' ),
151
- 'leaveReviewIdEmpty' => __( 'Leave empty to use current review ID', 'wp-review' ),
152
- 'insert' => __( 'Insert', 'wp-review' ),
153
- 'cancel' => __( 'Cancel', 'wp-review' ),
154
- 'reviewTypes' => wp_review_get_rating_types(),
155
- 'globalReviewType' => wp_review_option( 'review_type', 'none' ),
156
- 'assetsUrl' => WP_REVIEW_ASSETS,
157
- 'boxTemplates' => wp_review_get_box_templates(),
158
- 'purgeRatingsNonce' => wp_create_nonce( 'wpr_purge_ratings' ),
159
- 'confirmPurgeRatings' => esc_html__( 'Are you sure you want to do this?', 'wp-review' ),
160
- 'importDemoConfirm' => __( 'Are you sure you want to import demo?', 'wp-review' ),
161
- 'importDemoDone' => __( 'Importing proccess finished!', 'wp-review' ),
162
- )
163
- );
164
- }
165
-
166
- add_action( 'admin_enqueue_scripts', 'wp_review_admin_style' );
167
-
168
-
169
- /**
170
- * Gets list of icons.
171
- *
172
- * @since 3.0.0
173
- *
174
- * @return array
175
- */
176
- function wp_review_get_icons() {
177
- $icons = include WP_REVIEW_ADMIN . 'font-awesome-icons.php';
178
- /**
179
- * Filters list of font icons.
180
- *
181
- * @since 3.0.0
182
- *
183
- * @param array $icons List of icons. View file `wp-review/admin/font-awesome-icons.php
184
- */
185
- return apply_filters( 'wp_review_icons', $icons );
186
- }
187
-
188
-
189
- /**
190
- * Gets list of animations in.
191
- *
192
- * @since 3.0.0
193
- *
194
- * @return array
195
- */
196
- function wp_review_get_animations_in() {
197
- return array(
198
- __( 'Attention Seekers', 'wp-review' ) => array(
199
- 'bounce' => __( 'bounce', 'wp-review' ),
200
- 'flash' => __( 'flash', 'wp-review' ),
201
- 'pulse' => __( 'pulse', 'wp-review' ),
202
- 'rubberBand' => __( 'rubberBand', 'wp-review' ),
203
- 'shake' => __( 'shake', 'wp-review' ),
204
- 'swing' => __( 'swing', 'wp-review' ),
205
- 'tada' => __( 'tada', 'wp-review' ),
206
- 'wobble' => __( 'wobble', 'wp-review' ),
207
- 'jello' => __( 'jello', 'wp-review' ),
208
- ),
209
- __( 'Bouncing Entrances', 'wp-review' ) => array(
210
- 'bounceIn' => __( 'bounceIn', 'wp-review' ),
211
- 'bounceInDown' => __( 'bounceInDown', 'wp-review' ),
212
- 'bounceInLeft' => __( 'bounceInLeft', 'wp-review' ),
213
- 'bounceInRight' => __( 'bounceInRight', 'wp-review' ),
214
- 'bounceInUp' => __( 'bounceInUp', 'wp-review' ),
215
- ),
216
- __( 'Fading Entrances', 'wp-review' ) => array(
217
- 'fadeIn' => __( 'fadeIn', 'wp-review' ),
218
- 'fadeInDown' => __( 'fadeInDown', 'wp-review' ),
219
- 'fadeInDownBig' => __( 'fadeInDownBig', 'wp-review' ),
220
- 'fadeInLeft' => __( 'fadeInLeft', 'wp-review' ),
221
- 'fadeInLeftBig' => __( 'fadeInLeftBig', 'wp-review' ),
222
- 'fadeInRight' => __( 'fadeInRight', 'wp-review' ),
223
- 'fadeInRightBig' => __( 'fadeInRightBig', 'wp-review' ),
224
- 'fadeInUp' => __( 'fadeInUp', 'wp-review' ),
225
- 'fadeInUpBig' => __( 'fadeInUpBig', 'wp-review' ),
226
- ),
227
- __( 'Flippers', 'wp-review' ) => array(
228
- 'flip' => __( 'flip', 'wp-review' ),
229
- 'flipInX' => __( 'flipInX', 'wp-review' ),
230
- 'flipInY' => __( 'flipInY', 'wp-review' ),
231
- 'flipOutX' => __( 'flipOutX', 'wp-review' ),
232
- 'flipOutY' => __( 'flipOutY', 'wp-review' ),
233
- ),
234
- __( 'Lightspeed', 'wp-review' ) => array(
235
- 'lightSpeedIn' => __( 'lightSpeedIn', 'wp-review' ),
236
- 'lightSpeedOut' => __( 'lightSpeedOut', 'wp-review' ),
237
- ),
238
- __( 'Rotating Entrances', 'wp-review' ) => array(
239
- 'rotateIn' => __( 'rotateIn', 'wp-review' ),
240
- 'rotateInDownLeft' => __( 'rotateInDownLeft', 'wp-review' ),
241
- 'rotateInDownRight' => __( 'rotateInDownRight', 'wp-review' ),
242
- 'rotateInUpLeft' => __( 'rotateInUpLeft', 'wp-review' ),
243
- 'rotateInUpRight' => __( 'rotateInUpRight', 'wp-review' ),
244
- ),
245
- __( 'Sliding Entrances', 'wp-review' ) => array(
246
- 'slideInUp' => __( 'slideInUp', 'wp-review' ),
247
- 'slideInDown' => __( 'slideInDown', 'wp-review' ),
248
- 'slideInLeft' => __( 'slideInLeft', 'wp-review' ),
249
- 'slideInRight' => __( 'slideInRight', 'wp-review' ),
250
- ),
251
- __( 'Zoom Entrances', 'wp-review' ) => array(
252
- 'zoomIn' => __( 'zoomIn', 'wp-review' ),
253
- 'zoomInDown' => __( 'zoomInDown', 'wp-review' ),
254
- 'zoomInLeft' => __( 'zoomInLeft', 'wp-review' ),
255
- 'zoomInRight' => __( 'zoomInRight', 'wp-review' ),
256
- 'zoomInUp' => __( 'zoomInUp', 'wp-review' ),
257
- ),
258
- __( 'Specials', 'wp-review' ) => array(
259
- 'hinge' => __( 'hinge', 'wp-review' ),
260
- 'jackInTheBox' => __( 'jackInTheBox', 'wp-review' ),
261
- 'rollIn' => __( 'rollIn', 'wp-review' ),
262
- 'rollOut' => __( 'rollOut', 'wp-review' ),
263
- ),
264
- );
265
- }
266
-
267
-
268
- /**
269
- * Gets list of animations out.
270
- *
271
- * @since 3.0.0
272
- *
273
- * @return array
274
- */
275
- function wp_review_get_animations_out() {
276
- return array(
277
- __( 'Attention Seekers', 'wp-review' ) => array(
278
- 'bounce' => __( 'bounce', 'wp-review' ),
279
- 'flash' => __( 'flash', 'wp-review' ),
280
- 'pulse' => __( 'pulse', 'wp-review' ),
281
- 'rubberBand' => __( 'rubberBand', 'wp-review' ),
282
- 'shake' => __( 'shake', 'wp-review' ),
283
- 'swing' => __( 'swing', 'wp-review' ),
284
- 'tada' => __( 'tada', 'wp-review' ),
285
- 'wobble' => __( 'wobble', 'wp-review' ),
286
- 'jello' => __( 'jello', 'wp-review' ),
287
- ),
288
- __( 'Bouncing Exits', 'wp-review' ) => array(
289
- 'bounceOut' => __( 'bounceOut', 'wp-review' ),
290
- 'bounceOutDown' => __( 'bounceOutDown', 'wp-review' ),
291
- 'bounceOutLeft' => __( 'bounceOutLeft', 'wp-review' ),
292
- 'bounceOutRight' => __( 'bounceOutRight', 'wp-review' ),
293
- 'bounceOutUp' => __( 'bounceOutUp', 'wp-review' ),
294
- ),
295
- __( 'Fading Exits', 'wp-review' ) => array(
296
- 'fadeOut' => __( 'fadeOut', 'wp-review' ),
297
- 'fadeOutDown' => __( 'fadeOutDown', 'wp-review' ),
298
- 'fadeOutDownBig' => __( 'fadeOutDownBig', 'wp-review' ),
299
- 'fadeOutLeft' => __( 'fadeOutLeft', 'wp-review' ),
300
- 'fadeOutLeftBig' => __( 'fadeOutLeftBig', 'wp-review' ),
301
- 'fadeOutRight' => __( 'fadeOutRight', 'wp-review' ),
302
- 'fadeOutRightBig' => __( 'fadeOutRightBig', 'wp-review' ),
303
- 'fadeOutUp' => __( 'fadeOutUp', 'wp-review' ),
304
- 'fadeOutUpBig' => __( 'fadeOutUpBig', 'wp-review' ),
305
- ),
306
- __( 'Flippers', 'wp-review' ) => array(
307
- 'flip' => __( 'flip', 'wp-review' ),
308
- 'flipInX' => __( 'flipInX', 'wp-review' ),
309
- 'flipInY' => __( 'flipInY', 'wp-review' ),
310
- 'flipOutX' => __( 'flipOutX', 'wp-review' ),
311
- 'flipOutY' => __( 'flipOutY', 'wp-review' ),
312
- ),
313
- __( 'Lightspeed', 'wp-review' ) => array(
314
- 'lightSpeedIn' => __( 'lightSpeedIn', 'wp-review' ),
315
- 'lightSpeedOut' => __( 'lightSpeedOut', 'wp-review' ),
316
- ),
317
- __( 'Rotating Exits', 'wp-review' ) => array(
318
- 'rotateOut' => __( 'rotateOut', 'wp-review' ),
319
- 'rotateOutDownLeft' => __( 'rotateOutDownLeft', 'wp-review' ),
320
- 'rotateOutDownRight' => __( 'rotateOutDownRight', 'wp-review' ),
321
- 'rotateOutUpLeft' => __( 'rotateOutUpLeft', 'wp-review' ),
322
- 'rotateOutUpRight' => __( 'rotateOutUpRight', 'wp-review' ),
323
- ),
324
- __( 'Sliding Exits', 'wp-review' ) => array(
325
- 'slideOutUp' => __( 'slideOutUp', 'wp-review' ),
326
- 'slideOutDown' => __( 'slideOutDown', 'wp-review' ),
327
- 'slideOutLeft' => __( 'slideOutLeft', 'wp-review' ),
328
- 'slideOutRight' => __( 'slideOutRight', 'wp-review' ),
329
- ),
330
- __( 'Zoom Exits', 'wp-review' ) => array(
331
- 'zoomOut' => __( 'zoomOut', 'wp-review' ),
332
- 'zoomOutDown' => __( 'zoomOutDown', 'wp-review' ),
333
- 'zoomOutLeft' => __( 'zoomOutLeft', 'wp-review' ),
334
- 'zoomOutRight' => __( 'zoomOutRight', 'wp-review' ),
335
- 'zoomOutUp' => __( 'zoomOutUp', 'wp-review' ),
336
- ),
337
- __( 'Specials', 'wp-review' ) => array(
338
- 'hinge' => __( 'hinge', 'wp-review' ),
339
- 'jackInTheBox' => __( 'jackInTheBox', 'wp-review' ),
340
- 'rollIn' => __( 'rollIn', 'wp-review' ),
341
- 'rollOut' => __( 'rollOut', 'wp-review' ),
342
- ),
343
- );
344
- }
345
-
346
-
347
- /**
348
- * Animation dropdown.
349
- *
350
- * @since 3.0.0
351
- *
352
- * @param string $id Element ID.
353
- * @param string $name Element name.
354
- * @param string $value Selected value.
355
- * @param bool $exit Show only exit animations.
356
- */
357
- function wp_review_animations_dropdown( $id = '', $name = '', $value = '', $exit = false ) {
358
- $animations = array( '' => esc_html__( 'No Animation', 'wp-review' ) );
359
-
360
- if ( ! $exit ) {
361
- $animations += wp_review_get_animations_in();
362
- } else {
363
- $animations += wp_review_get_animations_out();
364
- }
365
-
366
- printf( '<select id="%1$s" name="%2$s" class="js-select2">', esc_attr( $id ), esc_attr( $name ) );
367
- wp_review_print_select_options( $animations, $value );
368
- echo '</select>';
369
- }
370
-
371
-
372
- /**
373
- * Prints select options.
374
- *
375
- * @since 3.0.0
376
- *
377
- * @param array $options Options.
378
- * @param string $value Select value.
379
- */
380
- function wp_review_print_select_options( $options, $value ) {
381
- foreach ( $options as $key => $text ) {
382
- if ( is_array( $text ) ) {
383
- printf( '<optgroup label="%s">', esc_attr( $key ) );
384
- wp_review_print_select_options( $text, $value );
385
- echo '</optgroup>';
386
- } else {
387
- printf(
388
- '<option value="%1$s" %3$s>%2$s</option>',
389
- esc_attr( $key ),
390
- esc_html( $text ),
391
- selected( $value, $key, false )
392
- );
393
- }
394
- }
395
- }
396
-
397
-
398
- /**
399
- * Add settings link on plugin page.
400
- *
401
- * @param array $links Plugins setting links.
402
- * @return array
403
- */
404
- function wpreview_plugin_settings_link( $links ) {
405
- $hide = wp_review_network_option( 'hide_global_options_' );
406
- if ( ! $hide ) {
407
- $settings_link = '<a href="options-general.php?page=wp-review/admin/options.php">' . __( 'Settings', 'wp-review' ) . '</a>';
408
- array_unshift( $links, $settings_link );
409
- }
410
- return $links;
411
- }
412
- add_filter( 'plugin_action_links_' . WP_REVIEW_PLUGIN_BASE, 'wpreview_plugin_settings_link' );
413
-
414
-
415
- /**
416
- * Adds editor buttons.
417
- *
418
- * @param array $buttons Editor buttons.
419
- * @return array
420
- */
421
- function wp_review_editor_buttons( $buttons ) {
422
- array_push( $buttons, 'wpreviewpro' );
423
- return $buttons;
424
- }
425
- add_filter( 'mce_buttons', 'wp_review_editor_buttons' );
426
-
427
-
428
- /**
429
- * Adds editor plugin.
430
- *
431
- * @param array $plugin_array Editor plugins.
432
- * @return array
433
- */
434
- function wp_review_editor_js( $plugin_array ) {
435
- if ( is_admin() ) {
436
- $plugin_array['wp_review'] = WP_REVIEW_URI . 'admin/assets/js/editor-plugin.js';
437
- }
438
- return $plugin_array;
439
- }
440
- add_filter( 'mce_external_plugins', 'wp_review_editor_js' );
441
-
442
-
443
- /**
444
- * Normalizes option value
445
- * Convert string as 'true' and 'false' to boolean value.
446
- *
447
- * @since 3.0.0
448
- *
449
- * @param mixed $value Option value.
450
- * @return mixed
451
- */
452
- function wp_review_normalize_option_value( $value ) {
453
- if ( 'true' === $value ) {
454
- return true;
455
- }
456
- if ( 'false' === $value ) {
457
- return false;
458
- }
459
- return $value;
460
- }
461
-
462
-
463
- /**
464
- * Gets plugin options export code.
465
- *
466
- * @since 3.0.0
467
- *
468
- * @return string
469
- */
470
- function wp_review_get_options_export_code() {
471
- $options = get_option( 'wp_review_options', array() );
472
- return wp_json_encode( $options );
473
- }
474
-
475
-
476
- /**
477
- * Imports plugin options.
478
- *
479
- * @since 3.0.0
480
- *
481
- * @param string $code Export code.
482
- * @return bool
483
- */
484
- function wp_review_import_options( $code ) {
485
- $options = json_decode( $code, true );
486
- if ( ! $options ) {
487
- return false;
488
- }
489
- update_option( 'wp_review_options', $options );
490
- return true;
491
- }
492
-
493
-
494
- /**
495
- * Prints pro text.
496
- *
497
- * @param bool $strip_br Strip `<br>` tag.
498
- */
499
- function wp_review_print_pro_text( $strip_br = false ) {
500
- $br = ! $strip_br ? '<br>' : '';
501
- echo $br . '<small class="wp-review-pro-text">' . esc_html__( 'Pro feature', 'wp-review' ) . '</small>'; // WPCS: xss ok.
502
- }
503
-
504
-
505
- /**
506
- * Prints the Pro version popup.
507
- */
508
- function wp_review_print_pro_popup() {
509
- if ( ! wp_script_is( 'wp-review-admin-script', 'enqueued' ) ) return;
510
- ?>
511
- <div id="wp-review-pro-popup-notice" class="mfp-hide">
512
- <div class="pro-popup-title"><?php esc_html_e( 'Buy WP Review Pro', 'wp-review' ); ?></div>
513
- <div class="pro-popup-content">
514
- <a href="https://mythemeshop.com/plugins/wp-review-pro/?utm_source=WP+Review&utm_medium=Popup&utm_content=WP+Review+Pro+LP&utm_campaign=WordPressOrg" target="_blank"><img class="pro-popup-image" src="<?php echo esc_url( WP_REVIEW_URI . 'admin/assets/images/wp-review-pro.jpg' ); ?>" /></a>
515
- <h2 class="pro-notice-header"><?php esc_html_e( 'Like WP Review Plugin? You will LOVE WP Review Pro!', 'wp-review' ); ?></h2>
516
- <p><?php esc_html_e( '15 new review box templates, 15 new Schema types, commment reviews, user can rate each feature, review popups, review notification bars, custom width, 9 new custom widgets, Google reviews, Facebook reviews, Yelp reviews and much more...', 'wp-review' ); ?></p>
517
- <a class="button-primary" href="https://mythemeshop.com/plugins/wp-review-pro/?utm_source=WP+Review&utm_medium=Popup&utm_content=WP+Review+Pro+LP&utm_campaign=WordPressOrg" target="_blank"><?php esc_html_e( 'Buy WP Review Pro', 'wp-review' ); ?></a>
518
- </div>
519
- </div>
520
-
521
- <style>
522
- .mfp-hide { display: none !important; }
523
- #wp-review-pro-popup-notice {
524
- background: #FFF;
525
- width: auto;
526
- max-width: 630px;
527
- margin: 20px auto;
528
- position: relative;
529
- }
530
- #wp-review-pro-popup-notice .mfp-close { background-color: transparent; }
531
- #wp-review-pro-popup-notice .pro-popup-title {
532
- padding: 0 10px;
533
- line-height: 29px;
534
- font-weight: 600;
535
- background: #fcfcfc;
536
- border-bottom: 1px solid #ddd;
537
- }
538
- #wp-review-pro-popup-notice .pro-popup-content {
539
- padding: 2px 15px 15px;
540
- min-height: 195px;
541
- }
542
- #wp-review-pro-popup-notice .pro-popup-content:after {
543
- content: " ";
544
- display: block;
545
- height: 0;
546
- visibility: hidden;
547
- clear: both;
548
- }
549
- #wp-review-pro-popup-notice .pro-popup-image {
550
- width: 150px;
551
- float: right;
552
- margin: 10px;
553
- }
554
- </style>
555
- <?php
556
- }
557
- add_action( 'admin_footer', 'wp_review_print_pro_popup' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin functions for this plugin.
4
+ *
5
+ * @since 1.0
6
+ * @copyright Copyright (c) 2013, MyThemesShop
7
+ * @author MyThemesShop
8
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9
+ * @package WP_Review
10
+ */
11
+
12
+ /**
13
+ * Register custom style for the meta box.
14
+ *
15
+ * @since 1.0
16
+ * @since 3.0.0 Add select2
17
+ *
18
+ * @param string $hook_suffix Admin page hook suffix.
19
+ */
20
+ function wp_review_admin_style( $hook_suffix ) {
21
+ if ( ! in_array( $hook_suffix, array( 'post-new.php', 'edit-comments.php', 'post.php', 'edit.php', 'widgets.php', 'settings_page_wp-review/admin/options' ), true ) ) {
22
+ return;
23
+ }
24
+
25
+ if ( 'customize' === get_current_screen()->id ) {
26
+ return;
27
+ }
28
+
29
+ if ( 'settings_page_wp-review/admin/options' === $hook_suffix ) {
30
+ wp_enqueue_style( 'fontawesome', WP_REVIEW_ASSETS . 'css/font-awesome.min.css', array(), '4.7.0' );
31
+
32
+ wp_enqueue_script( 'js-cookie', WP_REVIEW_ASSETS . 'js/js.cookie.min.js', array(), '2.1.4', true );
33
+
34
+ wp_enqueue_script( 'wp-review-admin-import', WP_REVIEW_URI . 'admin/assets/js/admin.import.js', array( 'jquery', 'wp-util' ), WP_REVIEW_PLUGIN_VERSION, true );
35
+
36
+ wp_localize_script(
37
+ 'wp-review-admin-import',
38
+ 'wprImportVars',
39
+ array(
40
+ // translators: import source.
41
+ 'confirm' => __( 'Are you sure you want to import from %s?', 'wp-review' ),
42
+ 'server_error' => __( 'The server responded with an error. Try again.', 'wp-review' ),
43
+ 'confirmOptionsImport' => __( 'Are you sure you want to import options? All current options will be lost.', 'wp-review' ),
44
+ 'importOptionsNonce' => wp_create_nonce( 'wp-review-import-options' ),
45
+ )
46
+ );
47
+ }
48
+
49
+ if ( in_array( $hook_suffix, array( 'settings_page_wp-review/admin/options', 'post.php', 'post-new.php' ), true ) ) {
50
+ wp_enqueue_style( 'jquery-ui', WP_REVIEW_URI . 'admin/assets/css/jquery-ui.min.css', array(), '1.12.1' );
51
+
52
+ wp_enqueue_script( 'select2', WP_REVIEW_URI . 'admin/assets/js/select2.min.js', array( 'jquery' ), '4.0.6-rc.0', true );
53
+ wp_enqueue_style( 'select2', WP_REVIEW_URI . 'admin/assets/css/select2.min.css', array(), '4.0.6-rc.0' );
54
+ }
55
+
56
+ // Load frontend css but not on the post editor screen.
57
+ if ( stripos( 'post.php', $hook_suffix ) === false ) {
58
+ wp_enqueue_style( 'wp_review-style', trailingslashit( WP_REVIEW_ASSETS ) . 'css/wp-review.css', array(), WP_REVIEW_PLUGIN_VERSION, 'all' );
59
+ }
60
+
61
+ wp_enqueue_style( 'wp-review-admin-style', WP_REVIEW_URI . 'admin/assets/css/admin.css', array( 'wp-color-picker' ), WP_REVIEW_PLUGIN_VERSION );
62
+
63
+ $inline_css = '.column-wp_review_rating .pro-only-notice, .latestPost-review-wrapper .pro-only-notice { display: none; }';
64
+ wp_add_inline_style( 'wp-review-admin-style', $inline_css );
65
+
66
+ wp_enqueue_style( 'magnificPopup', WP_REVIEW_ASSETS . 'css/magnific-popup.css', array(), '1.1.0' );
67
+ wp_enqueue_script( 'magnificPopup', WP_REVIEW_ASSETS . 'js/jquery.magnific-popup.min.js', array( 'jquery' ), '1.1.0', true );
68
+
69
+ if ( in_array( $hook_suffix, array( 'post.php', 'post-new.php' ), true ) ) {
70
+ wp_enqueue_script( 'wp-review-rating-inputs', WP_REVIEW_URI . 'admin/assets/js/rating-inputs.js', array( 'jquery-ui-slider' ), WP_REVIEW_PLUGIN_VERSION, true );
71
+
72
+ wp_enqueue_script(
73
+ 'wp-review-review-items',
74
+ WP_REVIEW_URI . 'admin/assets/js/review-items.js',
75
+ array( 'backbone', 'wp-review-admin-script', 'jquery-ui-sortable' ),
76
+ WP_REVIEW_PLUGIN_VERSION,
77
+ true
78
+ );
79
+ }
80
+
81
+ wp_enqueue_script(
82
+ 'wp-review-admin-script',
83
+ WP_REVIEW_URI . 'admin/assets/js/admin.js',
84
+ array(
85
+ 'wp-color-picker',
86
+ 'jquery',
87
+ 'jquery-ui-core',
88
+ 'jquery-ui-slider',
89
+ 'jquery-ui-sortable',
90
+ 'jquery-ui-datepicker',
91
+ 'wp-util',
92
+ 'magnificPopup',
93
+ 'imagesloaded',
94
+ ),
95
+ WP_REVIEW_PLUGIN_VERSION,
96
+ true
97
+ );
98
+
99
+ wp_localize_script(
100
+ 'wp-review-admin-script',
101
+ 'wprVars',
102
+ array(
103
+ 'ratingPermissionsCommentOnly' => WP_REVIEW_REVIEW_COMMENT_ONLY,
104
+ 'ratingPermissionsBoth' => WP_REVIEW_REVIEW_ALLOW_BOTH,
105
+ 'imgframe_title' => __( 'Select Image', 'wp-review' ),
106
+ 'imgbutton_title' => __( 'Insert Image', 'wp-review' ),
107
+ 'imgremove_title' => __( 'Remove Image', 'wp-review' ),
108
+ 'title' => __( 'Title', 'wp-review' ),
109
+ 'searchTerm' => __( 'Search term', 'wp-review' ),
110
+ 'searchLocation' => __( 'Search location', 'wp-review' ),
111
+ 'limit' => __( 'Limit', 'wp-review' ),
112
+ 'searchRadius' => __( 'Radius', 'wp-review' ),
113
+ 'searchCategories' => __( 'Categories', 'wp-review' ),
114
+ 'searchLocale' => __( 'Locale', 'wp-review' ),
115
+ 'searchOffset' => __( 'Offset', 'wp-review' ),
116
+ 'sort_by' => __( 'SortBy', 'wp-review' ),
117
+ 'searchPrice' => __( 'Price range', 'wp-review' ),
118
+ 'open_now' => __( 'Open now', 'wp-review' ),
119
+ 'attributes' => __( 'Attributes', 'wp-review' ),
120
+ 'businessId' => __( 'Business ID', 'wp-review' ),
121
+ 'locationLookup' => __( 'Location lookup', 'wp-review' ),
122
+ 'placeId' => __( 'Place ID', 'wp-review' ),
123
+ 'placeType' => __( 'Place type', 'wp-review' ),
124
+ 'all' => __( 'All', 'wp-review' ),
125
+ 'establishments' => __( 'Establishments', 'wp-review' ),
126
+ 'addresses' => __( 'Addresses', 'wp-review' ),
127
+ 'geocodes' => __( 'Geocodes', 'wp-review' ),
128
+ 'pageId' => __( 'Page ID', 'wp-review' ),
129
+ 'generateToken' => __( 'Generate token', 'wp-review' ),
130
+ 'reviewIds' => __( 'Review IDs (separate by commas)', 'wp-review' ),
131
+ 'reviewPosts' => __( 'Review posts', 'wp-review' ),
132
+ 'queryType' => __( 'Query type', 'wp-review' ),
133
+ 'recentReviews' => __( 'Recent reviews', 'wp-review' ),
134
+ 'topRated' => __( 'Top rated', 'wp-review' ),
135
+ 'mostVoted' => __( 'Most voted', 'wp-review' ),
136
+ 'categoryReviews' => __( 'Category reviews', 'wp-review' ),
137
+ 'reviewTypesText' => __( 'Review types', 'wp-review' ),
138
+ 'separateByCommas' => __( 'separate by commas', 'wp-review' ),
139
+ 'categoryIds' => __( 'Category IDs', 'wp-review' ),
140
+ 'allowPagination' => __( 'Allow pagination', 'wp-review' ),
141
+ 'numberOfReviews' => __( 'Number of reviews', 'wp-review' ),
142
+ 'titleLength' => __( 'Title length (words)', 'wp-review' ),
143
+ 'thumbSize' => __( 'Thumb size', 'wp-review' ),
144
+ 'small' => __( 'Small', 'wp-review' ),
145
+ 'large' => __( 'Large', 'wp-review' ),
146
+ 'showDate' => __( 'Show date', 'wp-review' ),
147
+ 'reviewBox' => __( 'Review box', 'wp-review' ),
148
+ 'reviewTotal' => __( 'Review total', 'wp-review' ),
149
+ 'visitorRating' => __( 'Visitor rating', 'wp-review' ),
150
+ 'reviewId' => __( 'Review ID', 'wp-review' ),
151
+ 'leaveReviewIdEmpty' => __( 'Leave empty to use current review ID', 'wp-review' ),
152
+ 'insert' => __( 'Insert', 'wp-review' ),
153
+ 'cancel' => __( 'Cancel', 'wp-review' ),
154
+ 'reviewTypes' => wp_review_get_rating_types(),
155
+ 'globalReviewType' => wp_review_option( 'review_type', 'none' ),
156
+ 'assetsUrl' => WP_REVIEW_ASSETS,
157
+ 'boxTemplates' => wp_review_get_box_templates(),
158
+ 'purgeRatingsNonce' => wp_create_nonce( 'wpr_purge_ratings' ),
159
+ 'confirmPurgeRatings' => esc_html__( 'Are you sure you want to do this?', 'wp-review' ),
160
+ 'importDemoConfirm' => __( 'Are you sure you want to import demo?', 'wp-review' ),
161
+ 'importDemoDone' => __( 'Importing proccess finished!', 'wp-review' ),
162
+ )
163
+ );
164
+
165
+ wp_enqueue_script( 'mts-product-upgrade-checkout', 'https://mythemeshop.com/check/check.js', array( 'jquery' ), '1.0.0' );
166
+ }
167
+
168
+ add_action( 'admin_enqueue_scripts', 'wp_review_admin_style' );
169
+
170
+
171
+ /**
172
+ * Gets list of icons.
173
+ *
174
+ * @since 3.0.0
175
+ *
176
+ * @return array
177
+ */
178
+ function wp_review_get_icons() {
179
+ $icons = include WP_REVIEW_ADMIN . 'font-awesome-icons.php';
180
+ /**
181
+ * Filters list of font icons.
182
+ *
183
+ * @since 3.0.0
184
+ *
185
+ * @param array $icons List of icons. View file `wp-review/admin/font-awesome-icons.php
186
+ */
187
+ return apply_filters( 'wp_review_icons', $icons );
188
+ }
189
+
190
+
191
+ /**
192
+ * Gets list of animations in.
193
+ *
194
+ * @since 3.0.0
195
+ *
196
+ * @return array
197
+ */
198
+ function wp_review_get_animations_in() {
199
+ return array(
200
+ __( 'Attention Seekers', 'wp-review' ) => array(
201
+ 'bounce' => __( 'bounce', 'wp-review' ),
202
+ 'flash' => __( 'flash', 'wp-review' ),
203
+ 'pulse' => __( 'pulse', 'wp-review' ),
204
+ 'rubberBand' => __( 'rubberBand', 'wp-review' ),
205
+ 'shake' => __( 'shake', 'wp-review' ),
206
+ 'swing' => __( 'swing', 'wp-review' ),
207
+ 'tada' => __( 'tada', 'wp-review' ),
208
+ 'wobble' => __( 'wobble', 'wp-review' ),
209
+ 'jello' => __( 'jello', 'wp-review' ),
210
+ ),
211
+ __( 'Bouncing Entrances', 'wp-review' ) => array(
212
+ 'bounceIn' => __( 'bounceIn', 'wp-review' ),
213
+ 'bounceInDown' => __( 'bounceInDown', 'wp-review' ),
214
+ 'bounceInLeft' => __( 'bounceInLeft', 'wp-review' ),
215
+ 'bounceInRight' => __( 'bounceInRight', 'wp-review' ),
216
+ 'bounceInUp' => __( 'bounceInUp', 'wp-review' ),
217
+ ),
218
+ __( 'Fading Entrances', 'wp-review' ) => array(
219
+ 'fadeIn' => __( 'fadeIn', 'wp-review' ),
220
+ 'fadeInDown' => __( 'fadeInDown', 'wp-review' ),
221
+ 'fadeInDownBig' => __( 'fadeInDownBig', 'wp-review' ),
222
+ 'fadeInLeft' => __( 'fadeInLeft', 'wp-review' ),
223
+ 'fadeInLeftBig' => __( 'fadeInLeftBig', 'wp-review' ),
224
+ 'fadeInRight' => __( 'fadeInRight', 'wp-review' ),
225
+ 'fadeInRightBig' => __( 'fadeInRightBig', 'wp-review' ),
226
+ 'fadeInUp' => __( 'fadeInUp', 'wp-review' ),
227
+ 'fadeInUpBig' => __( 'fadeInUpBig', 'wp-review' ),
228
+ ),
229
+ __( 'Flippers', 'wp-review' ) => array(
230
+ 'flip' => __( 'flip', 'wp-review' ),
231
+ 'flipInX' => __( 'flipInX', 'wp-review' ),
232
+ 'flipInY' => __( 'flipInY', 'wp-review' ),
233
+ 'flipOutX' => __( 'flipOutX', 'wp-review' ),
234
+ 'flipOutY' => __( 'flipOutY', 'wp-review' ),
235
+ ),
236
+ __( 'Lightspeed', 'wp-review' ) => array(
237
+ 'lightSpeedIn' => __( 'lightSpeedIn', 'wp-review' ),
238
+ 'lightSpeedOut' => __( 'lightSpeedOut', 'wp-review' ),
239
+ ),
240
+ __( 'Rotating Entrances', 'wp-review' ) => array(
241
+ 'rotateIn' => __( 'rotateIn', 'wp-review' ),
242
+ 'rotateInDownLeft' => __( 'rotateInDownLeft', 'wp-review' ),
243
+ 'rotateInDownRight' => __( 'rotateInDownRight', 'wp-review' ),
244
+ 'rotateInUpLeft' => __( 'rotateInUpLeft', 'wp-review' ),
245
+ 'rotateInUpRight' => __( 'rotateInUpRight', 'wp-review' ),
246
+ ),
247
+ __( 'Sliding Entrances', 'wp-review' ) => array(
248
+ 'slideInUp' => __( 'slideInUp', 'wp-review' ),
249
+ 'slideInDown' => __( 'slideInDown', 'wp-review' ),
250
+ 'slideInLeft' => __( 'slideInLeft', 'wp-review' ),
251
+ 'slideInRight' => __( 'slideInRight', 'wp-review' ),
252
+ ),
253
+ __( 'Zoom Entrances', 'wp-review' ) => array(
254
+ 'zoomIn' => __( 'zoomIn', 'wp-review' ),
255
+ 'zoomInDown' => __( 'zoomInDown', 'wp-review' ),
256
+ 'zoomInLeft' => __( 'zoomInLeft', 'wp-review' ),
257
+ 'zoomInRight' => __( 'zoomInRight', 'wp-review' ),
258
+ 'zoomInUp' => __( 'zoomInUp', 'wp-review' ),
259
+ ),
260
+ __( 'Specials', 'wp-review' ) => array(
261
+ 'hinge' => __( 'hinge', 'wp-review' ),
262
+ 'jackInTheBox' => __( 'jackInTheBox', 'wp-review' ),
263
+ 'rollIn' => __( 'rollIn', 'wp-review' ),
264
+ 'rollOut' => __( 'rollOut', 'wp-review' ),
265
+ ),
266
+ );
267
+ }
268
+
269
+
270
+ /**
271
+ * Gets list of animations out.
272
+ *
273
+ * @since 3.0.0
274
+ *
275
+ * @return array
276
+ */
277
+ function wp_review_get_animations_out() {
278
+ return array(
279
+ __( 'Attention Seekers', 'wp-review' ) => array(
280
+ 'bounce' => __( 'bounce', 'wp-review' ),
281
+ 'flash' => __( 'flash', 'wp-review' ),
282
+ 'pulse' => __( 'pulse', 'wp-review' ),
283
+ 'rubberBand' => __( 'rubberBand', 'wp-review' ),
284
+ 'shake' => __( 'shake', 'wp-review' ),
285
+ 'swing' => __( 'swing', 'wp-review' ),
286
+ 'tada' => __( 'tada', 'wp-review' ),
287
+ 'wobble' => __( 'wobble', 'wp-review' ),
288
+ 'jello' => __( 'jello', 'wp-review' ),
289
+ ),
290
+ __( 'Bouncing Exits', 'wp-review' ) => array(
291
+ 'bounceOut' => __( 'bounceOut', 'wp-review' ),
292
+ 'bounceOutDown' => __( 'bounceOutDown', 'wp-review' ),
293
+ 'bounceOutLeft' => __( 'bounceOutLeft', 'wp-review' ),
294
+ 'bounceOutRight' => __( 'bounceOutRight', 'wp-review' ),
295
+ 'bounceOutUp' => __( 'bounceOutUp', 'wp-review' ),
296
+ ),
297
+ __( 'Fading Exits', 'wp-review' ) => array(
298
+ 'fadeOut' => __( 'fadeOut', 'wp-review' ),
299
+ 'fadeOutDown' => __( 'fadeOutDown', 'wp-review' ),
300
+ 'fadeOutDownBig' => __( 'fadeOutDownBig', 'wp-review' ),
301
+ 'fadeOutLeft' => __( 'fadeOutLeft', 'wp-review' ),
302
+ 'fadeOutLeftBig' => __( 'fadeOutLeftBig', 'wp-review' ),
303
+ 'fadeOutRight' => __( 'fadeOutRight', 'wp-review' ),
304
+ 'fadeOutRightBig' => __( 'fadeOutRightBig', 'wp-review' ),
305
+ 'fadeOutUp' => __( 'fadeOutUp', 'wp-review' ),
306
+ 'fadeOutUpBig' => __( 'fadeOutUpBig', 'wp-review' ),
307
+ ),
308
+ __( 'Flippers', 'wp-review' ) => array(
309
+ 'flip' => __( 'flip', 'wp-review' ),
310
+ 'flipInX' => __( 'flipInX', 'wp-review' ),
311
+ 'flipInY' => __( 'flipInY', 'wp-review' ),
312
+ 'flipOutX' => __( 'flipOutX', 'wp-review' ),
313
+ 'flipOutY' => __( 'flipOutY', 'wp-review' ),
314
+ ),
315
+ __( 'Lightspeed', 'wp-review' ) => array(
316
+ 'lightSpeedIn' => __( 'lightSpeedIn', 'wp-review' ),
317
+ 'lightSpeedOut' => __( 'lightSpeedOut', 'wp-review' ),
318
+ ),
319
+ __( 'Rotating Exits', 'wp-review' ) => array(
320
+ 'rotateOut' => __( 'rotateOut', 'wp-review' ),
321
+ 'rotateOutDownLeft' => __( 'rotateOutDownLeft', 'wp-review' ),
322
+ 'rotateOutDownRight' => __( 'rotateOutDownRight', 'wp-review' ),
323
+ 'rotateOutUpLeft' => __( 'rotateOutUpLeft', 'wp-review' ),
324
+ 'rotateOutUpRight' => __( 'rotateOutUpRight', 'wp-review' ),
325
+ ),
326
+ __( 'Sliding Exits', 'wp-review' ) => array(
327
+ 'slideOutUp' => __( 'slideOutUp', 'wp-review' ),
328
+ 'slideOutDown' => __( 'slideOutDown', 'wp-review' ),
329
+ 'slideOutLeft' => __( 'slideOutLeft', 'wp-review' ),
330
+ 'slideOutRight' => __( 'slideOutRight', 'wp-review' ),
331
+ ),
332
+ __( 'Zoom Exits', 'wp-review' ) => array(
333
+ 'zoomOut' => __( 'zoomOut', 'wp-review' ),
334
+ 'zoomOutDown' => __( 'zoomOutDown', 'wp-review' ),
335
+ 'zoomOutLeft' => __( 'zoomOutLeft', 'wp-review' ),
336
+ 'zoomOutRight' => __( 'zoomOutRight', 'wp-review' ),
337
+ 'zoomOutUp' => __( 'zoomOutUp', 'wp-review' ),
338
+ ),
339
+ __( 'Specials', 'wp-review' ) => array(
340
+ 'hinge' => __( 'hinge', 'wp-review' ),
341
+ 'jackInTheBox' => __( 'jackInTheBox', 'wp-review' ),
342
+ 'rollIn' => __( 'rollIn', 'wp-review' ),
343
+ 'rollOut' => __( 'rollOut', 'wp-review' ),
344
+ ),
345
+ );
346
+ }
347
+
348
+
349
+ /**
350
+ * Animation dropdown.
351
+ *
352
+ * @since 3.0.0
353
+ *
354
+ * @param string $id Element ID.
355
+ * @param string $name Element name.
356
+ * @param string $value Selected value.
357
+ * @param bool $exit Show only exit animations.
358
+ */
359
+ function wp_review_animations_dropdown( $id = '', $name = '', $value = '', $exit = false ) {
360
+ $animations = array( '' => esc_html__( 'No Animation', 'wp-review' ) );
361
+
362
+ if ( ! $exit ) {
363
+ $animations += wp_review_get_animations_in();
364
+ } else {
365
+ $animations += wp_review_get_animations_out();
366
+ }
367
+
368
+ printf( '<select id="%1$s" name="%2$s" class="js-select2">', esc_attr( $id ), esc_attr( $name ) );
369
+ wp_review_print_select_options( $animations, $value );
370
+ echo '</select>';
371
+ }
372
+
373
+
374
+ /**
375
+ * Prints select options.
376
+ *
377
+ * @since 3.0.0
378
+ *
379
+ * @param array $options Options.
380
+ * @param string $value Select value.
381
+ */
382
+ function wp_review_print_select_options( $options, $value ) {
383
+ foreach ( $options as $key => $text ) {
384
+ if ( is_array( $text ) ) {
385
+ printf( '<optgroup label="%s">', esc_attr( $key ) );
386
+ wp_review_print_select_options( $text, $value );
387
+ echo '</optgroup>';
388
+ } else {
389
+ printf(
390
+ '<option value="%1$s" %3$s>%2$s</option>',
391
+ esc_attr( $key ),
392
+ esc_html( $text ),
393
+ selected( $value, $key, false )
394
+ );
395
+ }
396
+ }
397
+ }
398
+
399
+
400
+ /**
401
+ * Add settings link on plugin page.
402
+ *
403
+ * @param array $links Plugins setting links.
404
+ * @return array
405
+ */
406
+ function wpreview_plugin_settings_link( $links ) {
407
+ $hide = wp_review_network_option( 'hide_global_options_' );
408
+ if ( ! $hide ) {
409
+ $settings_link = '<a href="options-general.php?page=wp-review/admin/options.php">' . __( 'Settings', 'wp-review' ) . '</a>';
410
+ array_unshift( $links, $settings_link );
411
+ }
412
+ return $links;
413
+ }
414
+ add_filter( 'plugin_action_links_' . WP_REVIEW_PLUGIN_BASE, 'wpreview_plugin_settings_link' );
415
+
416
+
417
+ /**
418
+ * Adds editor buttons.
419
+ *
420
+ * @param array $buttons Editor buttons.
421
+ * @return array
422
+ */
423
+ function wp_review_editor_buttons( $buttons ) {
424
+ array_push( $buttons, 'wpreviewpro' );
425
+ return $buttons;
426
+ }
427
+ add_filter( 'mce_buttons', 'wp_review_editor_buttons' );
428
+
429
+
430
+ /**
431
+ * Adds editor plugin.
432
+ *
433
+ * @param array $plugin_array Editor plugins.
434
+ * @return array
435
+ */
436
+ function wp_review_editor_js( $plugin_array ) {
437
+ if ( is_admin() ) {
438
+ $plugin_array['wp_review'] = WP_REVIEW_URI . 'admin/assets/js/editor-plugin.js';
439
+ }
440
+ return $plugin_array;
441
+ }
442
+ add_filter( 'mce_external_plugins', 'wp_review_editor_js' );
443
+
444
+
445
+ /**
446
+ * Normalizes option value
447
+ * Convert string as 'true' and 'false' to boolean value.
448
+ *
449
+ * @since 3.0.0
450
+ *
451
+ * @param mixed $value Option value.
452
+ * @return mixed
453
+ */
454
+ function wp_review_normalize_option_value( $value ) {
455
+ if ( 'true' === $value ) {
456
+ return true;
457
+ }
458
+ if ( 'false' === $value ) {
459
+ return false;
460
+ }
461
+ return $value;
462
+ }
463
+
464
+
465
+ /**
466
+ * Gets plugin options export code.
467
+ *
468
+ * @since 3.0.0
469
+ *
470
+ * @return string
471
+ */
472
+ function wp_review_get_options_export_code() {
473
+ $options = get_option( 'wp_review_options', array() );
474
+ return wp_json_encode( $options );
475
+ }
476
+
477
+
478
+ /**
479
+ * Imports plugin options.
480
+ *
481
+ * @since 3.0.0
482
+ *
483
+ * @param string $code Export code.
484
+ * @return bool
485
+ */
486
+ function wp_review_import_options( $code ) {
487
+ $options = json_decode( $code, true );
488
+ if ( ! $options ) {
489
+ return false;
490
+ }
491
+ update_option( 'wp_review_options', $options );
492
+ return true;
493
+ }
494
+
495
+
496
+ /**
497
+ * Prints pro text.
498
+ *
499
+ * @param bool $strip_br Strip `<br>` tag.
500
+ */
501
+ function wp_review_print_pro_text( $strip_br = false ) {
502
+ $br = ! $strip_br ? '<br>' : '';
503
+ echo $br . '<small class="wp-review-pro-text">' . esc_html__( 'Pro feature', 'wp-review' ) . '</small>'; // WPCS: xss ok.
504
+ }
505
+
506
+
507
+ /**
508
+ * Prints the Pro version popup.
509
+ */
510
+ function wp_review_print_pro_popup() {
511
+ if ( ! wp_script_is( 'wp-review-admin-script', 'enqueued' ) ) return;
512
+ ?>
513
+ <div id="wp-review-pro-popup-notice" class="mfp-hide">
514
+ <div class="pro-popup-title"><?php esc_html_e( 'Buy WP Review Pro', 'wp-review' ); ?></div>
515
+ <div class="pro-popup-content">
516
+ <a href="https://mythemeshop.com/plugins/wp-review-pro/?utm_source=WP+Review&utm_medium=Popup&utm_content=WP+Review+Pro+LP&utm_campaign=WordPressOrg" target="_blank"><img class="pro-popup-image" src="<?php echo esc_url( WP_REVIEW_URI . 'admin/assets/images/wp-review-pro.jpg' ); ?>" /></a>
517
+ <h2 class="pro-notice-header"><?php esc_html_e( 'Like WP Review Plugin? You will LOVE WP Review Pro!', 'wp-review' ); ?></h2>
518
+ <p><?php esc_html_e( '15 new review box templates, 15 new Schema types, commment reviews, user can rate each feature, review popups, review notification bars, custom width, 9 new custom widgets, Google reviews, Facebook reviews, Yelp reviews and much more...', 'wp-review' ); ?></p>
519
+ <a id="wp-review-pro-purchase-link" class="button-primary" href="#"><?php esc_html_e( 'Buy WP Review Pro', 'wp-review' ); ?></a>
520
+ </div>
521
+ </div>
522
+
523
+ <style>
524
+ .mfp-hide { display: none !important; }
525
+ #wp-review-pro-popup-notice {
526
+ background: #FFF;
527
+ width: auto;
528
+ max-width: 630px;
529
+ margin: 20px auto;
530
+ position: relative;
531
+ }
532
+ #wp-review-pro-popup-notice .mfp-close { background-color: transparent; }
533
+ #wp-review-pro-popup-notice .pro-popup-title {
534
+ padding: 0 10px;
535
+ line-height: 29px;
536
+ font-weight: 600;
537
+ background: #fcfcfc;
538
+ border-bottom: 1px solid #ddd;
539
+ }
540
+ #wp-review-pro-popup-notice .pro-popup-content {
541
+ padding: 2px 15px 15px;
542
+ min-height: 195px;
543
+ }
544
+ #wp-review-pro-popup-notice .pro-popup-content:after {
545
+ content: " ";
546
+ display: block;
547
+ height: 0;
548
+ visibility: hidden;
549
+ clear: both;
550
+ }
551
+ #wp-review-pro-popup-notice .pro-popup-image {
552
+ width: 150px;
553
+ float: right;
554
+ margin: 10px;
555
+ }
556
+ </style>
557
+ <script>
558
+ var WPRPHandler = MTS.Checkout.configure();
559
+ jQuery('#wp-review-pro-purchase-link').on('click', function (e) {
560
+ var $button = jQuery(this);
561
+ e.preventDefault();
562
+ WPRPHandler.open({
563
+ action: 'buy',
564
+ add_to_cart: 8678,
565
+ success: function (response) {
566
+ $button.remove();
567
+ }
568
+ });
569
+ });
570
+ </script>
571
+ <?php
572
+ }
573
+ add_action( 'admin_footer', 'wp_review_print_pro_popup' );
admin/assets/css/admin.css CHANGED
@@ -1 +1 @@
1
- .border-box,.wpr-box-template-images{box-sizing:border-box}.border-box *,.wpr-box-template-images *{box-sizing:border-box}.wpr-flex{display:flex;flex-wrap:wrap}.wpr-flex-wrap{flex-wrap:wrap}.wpr-col-1-2{flex:0 0 50%}.wpr-col-1-3{flex:0 0 33.33%;margin-bottom:12px;padding-bottom:12px}.wpr-col-1-3 label{position:relative;padding-left:20px}.wpr-col-1-3 label input[type=checkbox]{position:absolute;top:0;left:0;box-shadow:none;overflow:hidden;border:2px solid rgba(33,38,44,0.6);border-radius:2px}.wpr-col-1-3 label input[type=checkbox]:checked{border-color:#069de3}.wpr-col-1-3 label input[type=checkbox]:checked:before{line-height:16px;width:17px;height:16px;margin:-2px 0 0 -5px;content:'\f147';text-align:center;color:#fff;border-radius:2px;background:#069de3}.wp-review *{box-sizing:border-box}.wp-review p.submit{text-align:right}.wp-review h1{margin-bottom:15px}.wpr-flex-wrap{justify-content:space-between}.wpr-flex-wrap .wpr-col-1-2{flex:0 0 49%}.wpr-flex-wrap .wpr-col-1-2:last-child{float:right}.wp-review-field{padding:15px 0;border-bottom:1px dashed #ddd;margin-top:1em;margin-bottom:1em;border-bottom:1px dashed #ddd}.wp-review-field,.wp-review-field *{box-sizing:border-box}.postbox .wp-review-field{padding:0;border-bottom:0}@media (min-width: 600px){.wp-review-field:not(.vertical):not(.no-flex){display:flex;flex-wrap:wrap}.wp-review-field:not(.vertical):not(.no-flex) .wp-review-field-label{flex:0 0 25%;padding-right:4%}.wp-review-field:not(.vertical):not(.no-flex) .wp-review-field-label.full-width{flex:0 0 100%;padding-right:0}.wp-review-field:not(.vertical):not(.no-flex) .wp-review-field-option{flex:0 0 75%}.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-icon,.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-image{position:relative}.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-icon.hide,.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-image.hide{display:none}.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-icon a.wpr-toggle-rating,.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-image a.wpr-toggle-rating{position:absolute;top:0;right:0}.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-icon .img-wrapper,.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-image .img-wrapper{padding:2px;width:55px;height:55px;border:1px solid #ddd;position:relative}.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-icon .img-wrapper img,.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-image .img-wrapper img{max-width:100%}.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-icon .img-wrapper i,.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-image .img-wrapper i{position:absolute;top:-6px;right:-6px;color:#444;cursor:pointer}.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-icon .img-wrapper.hide,.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-image .img-wrapper.hide{display:none}.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-icon .set_rating_image.hide,.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-image .set_rating_image.hide{display:none}.postbox .wp-review-field .wp-review-field-label{flex:0 0 20%}.postbox .wp-review-field .wp-review-field-option{flex:0 0 80%}}.wpr_image_upload_field .clear-image{margin-left:10px}.wpr-star-input-wrapper{position:relative;color:#c40000;overflow:hidden;display:inline-block}.wpr-star-input-wrapper .stars-bg{color:#ccc;white-space:nowrap}.wpr-star-input-wrapper .stars-result{white-space:nowrap;position:absolute;left:0;top:0;overflow:hidden}.wpr-input-wrapper.ui-slider .ui-slider-handle{background-color:#fff;box-shadow:0 0px 3px rgba(0,0,0,0.4);border-radius:2px;cursor:pointer}.wpr-vertical-tabs{max-width:880px;position:relative}.wpr-vertical-tabs__titles{width:200px;float:left;border-right:0;margin:0;z-index:10;position:absolute;left:0;top:0}.wpr-vertical-tabs__titles.active{background-color:#fff}.wpr-vertical-tabs__title{margin:0;padding:0;position:relative}.wpr-vertical-tabs__title:first-child a{border-top:1px solid #ccc}.wpr-vertical-tabs__title.active a{background-color:#fff}.wpr-vertical-tabs__title.active a:after{content:"";width:1px;height:40px;position:absolute;right:-1px;top:1px;background:#fff;z-index:10}.wpr-vertical-tabs__title i{font-size:18px;min-width:20px;margin-right:10px;text-align:center;color:#444}.wpr-vertical-tabs__title a{font-size:16px;display:block;box-sizing:border-box;padding:11px 15px;white-space:nowrap;text-decoration:none;color:#555;border:1px solid #ccc;border-top:0;border-right:0;outline:none;background:#e5e5e5;box-shadow:none}.wpr-vertical-tabs__contents{padding-left:200px}.wpr-vertical-tabs__content{padding:15px;min-height:400px;background:#fff;border:1px solid #ccc}.wpr-vertical-tabs__content>h2{margin-top:0}.wpr-vertical-tabs__content .nav-tab-active{background-color:#fff;border-bottom-color:#fff}.clearfix:before,.clearfix:after{content:" ";display:table}.clearfix:after{clear:both}.clearfix{*zoom:1}.wp_review_schema_type_options textarea{width:77%;min-height:80px}.wp-review-field select{width:15em;margin-left:0}.wp-review-field #wp_review_product_price{width:70px}.wp-review-field .wp-color-result{margin:0}.wp-review-field .large-text{width:77%}.wp-review-field input{margin:0;padding:5px 8px}.wp-review-field .wp-picker-container{display:inline-block}.wp-review-field .wp-picker-container label{flex:none;width:auto}.wp-review-field .wp-picker-container input[type="text"].wp-color-picker{padding:4px;width:65px}.wp-review-field .wp-picker-container .iris-picker{box-sizing:initial}.wp-review-field .wp-picker-container .wp-picker-open+.wp-picker-input-wrap{width:140px}#wp-wp_review_pros-wrap textarea.wp-editor-area,#wp-wp_review_cons-wrap textarea.wp-editor-area,#wp-wp_review_desc-wrap textarea.wp-editor-area{border:0}.wp_review_schema_options_label{vertical-align:top;padding-top:5px}.wpr_image_upload_field{display:inline-block}.wp-review-item th{text-align:left}.wp-review-item td:first-child{text-align:center}.wp-review-item .handle{cursor:move}.wp-review-links td:first-child{text-align:center}.wp-review-links .handle{cursor:move}.wp-review-links input[type="text"]{padding:5px 8px}.has-border-bottom{border-bottom:1px solid #ddd;margin-bottom:20px;padding-bottom:20px}.review-total{text-align:right}.wp-review-field-option:not(.pyre_field) .wp-picker-holder{position:absolute;z-index:9}.review-value-incorrect{border-color:#F00 !important}#wp_review_id_hint{margin-left:8px}.wp-review-admin-options .form-table td{padding:20px 10px;vertical-align:top}.wp-review-admin-options p.description{font-weight:normal;font-style:normal}.wp-review-admin-options .wp-review-field>label .description{margin-left:0}.wp-review-admin-options .wp-review-field input{padding:7px;border-radius:2px;margin:0;box-shadow:inset 0 1px 3px rgba(0,0,0,0.1)}.wp-review-admin-options .wp-review-field input[type=radio]{border-radius:50%}.wp-review-admin-options .wp-review-field input[type=checkbox]{border-radius:0}.wp-review-admin-options .wp-review-field .large-text{width:70%}.wp-review-admin-options .wp-review-field .description{display:block;color:#888;font-style:normal;margin-top:5px}.wp-review-admin-options #wp_review_shortcode_hint_field span{display:inline;margin-left:6px}.wp-review-admin-options .wp-review-thumbnail-options label{margin-right:0;width:90%}.wp-review-description label{margin-bottom:-20px;display:block}.wp-review-theme-defaults-msg{position:relative}.wp-review-theme-defaults-msg a.button{display:inline-block;margin-bottom:8px}.wp-review-theme-defaults-msg a.close-notice{position:absolute;top:0;right:0}.edit-ratings-notice.update-nag{background:#fff9e8;margin-right:0}#wp-review-width-slider{width:70%;float:left;margin-top:12px;margin-right:25px;border-radius:0;max-width:600px;border:0;background:#d8d8d8;height:8px}#wp-review-width-slider .ui-slider-handle{background:#fff;box-shadow:0 0px 3px rgba(0,0,0,0.4);border-radius:2px}#wp-review-width-slider.ui-slider-horizontal .ui-slider-range-min{border:0;border-radius:2px;background:#0184bb}#wp_review_width{width:60px}.wrap.wp-review .nav-tab-wrapper{border-bottom:1px solid #ccc;margin-top:16px}.wrap.wp-review .nav-tab-wrapper a:focus{box-shadow:none}.nav-tab-hidden{display:none}.nav-tab-hidden.nav-tab-active{display:block}textarea#wp-review-migrate-log{width:600px;max-width:100%;height:200px;display:none}.already-migrated-msg{display:none}#start-migrate{margin-bottom:12px}#wp-review-settings-tab-contents>div{display:none;max-width:900px}#wp-review-settings-tab-contents .settings-tab-general{display:block}.pros-cons-title{max-width:25%}.column-wp_review_rating,.column-wp_review_comment_rating{text-align:center;position:relative;width:110px}.column-wp_review_rating .review-star,.column-wp_review_comment_rating .review-star{position:relative;letter-spacing:1px}.column-wp_review_rating .no-rating,.column-wp_review_comment_rating .no-rating{color:#aaa;font-style:italic}#editwpreview{overflow:hidden}#editwpreview .inside{float:left;padding:3px 0 2px 5px;margin:0;text-align:left}#editwpreview .inside input{width:180px}#editwpreview label{padding:2px 0}h4.wp-review-comment-title{margin-top:0;margin-bottom:1em}.review-result-wrapper{position:relative;display:inline-block;font-size:0}.postbox .review-result-wrapper a,.postbox .review-result i{cursor:pointer}.review-result{position:absolute;top:0;left:0;height:22px;overflow:hidden;white-space:nowrap}.wp-review-rating-feature{display:inline-block}.wp-review-notice{position:relative}.wpr_image_upload_img{margin:0 0 10px;padding:0;max-width:100%;height:auto;float:left;display:inline-block}.wpr-hide{display:none}.wpr-tabs .tab-title.nav-tab-active{background-color:#fff;border-bottom-color:#fff}.wpr-box-template-images{display:flex;flex-wrap:wrap}.wpr-box-template-images .wpr-box-template-image{flex:0 0 50%;display:block;outline:0;box-shadow:none;text-decoration:none;text-align:center;color:#333;font-weight:700;margin-bottom:5px}.wpr-box-template-images .wpr-box-template-image img{padding:4px;width:100%;height:auto;display:block}.wpr-box-template-images .wpr-box-template-image.active img{background-color:#0073aa}#wpr-review-items-app *{box-sizing:border-box}#wpr-review-items-app .wpr-review-item{background-color:#f7f7f7;padding:10px 10px 10px 30px;margin-bottom:5px}#wpr-review-items-app .wpr-review-item .setting-row:first-of-type .col-2 input{width:100%;padding:5px;background:#fff}#wpr-review-items-app .wpr-review-item .col-3 input{float:right;background:#fff}#wpr-review-items-app .wpr-review-item .wpr-icon-move{cursor:move;position:absolute;left:5px;top:16px}#wpr-review-items-app .setting-row{padding:5px 0}#wpr-review-items-app .final-row .col-3{text-align:right}#wpr-review-items-app .final-row .col-3 input{float:right;min-width:52px}#wpr-review-items-app .final-row .col-3 label{margin:4px 10px 0 0;display:inline-block;font-weight:bold}#wpr-review-items-app .wpr-percentage-input-wrapper{margin-top:10px}#wpr-review-items-app .wp-picker-container{display:inline-block}#wpr-review-items-app .wp-picker-holder *{box-sizing:initial}@media (min-width: 768px){#wpr-review-items-app .wpr-review-item{position:relative}#wpr-review-items-app .delete-item{position:absolute;right:10px;bottom:10px}#wpr-review-items-app .setting-row{display:flex;flex-wrap:wrap}#wpr-review-items-app .col-1{flex:0 0 20%}#wpr-review-items-app .col-2{flex:0 0 60%;padding:0 10px}#wpr-review-items-app .col-3{flex:0 0 20%}}#wp_review_box_template_wrapper{position:relative}#wp_review_box_template_preview{position:absolute;left:250px;top:0px;z-index:1000;padding:3px;box-shadow:0 0 3px rgba(0,0,0,0.2);background:#fff}#wp_review_box_template_preview.loading{background:#eee url(../images/loading.svg) no-repeat center center}#wp_review_box_template_preview.loading img{visibility:hidden}#wp_review_box_template_img,#wp_review_box_template_preview_img{max-width:414px;height:auto}.wpr-switch{display:inline-block}.wpr-switch input{position:absolute !important;clip:rect(0, 0, 0, 0);height:1px;width:1px;border:0;overflow:hidden}.wpr-switch label{float:left;display:inline-block;min-width:45px;background-color:#e4e4e4;color:rgba(0,0,0,0.6);font-size:12px;font-weight:700;line-height:28px;text-align:center;text-shadow:none;border:1px solid rgba(0,0,0,0.2);box-shadow:inset 0 1px 3px rgba(0,0,0,0.3),0 1px rgba(255,255,255,0.1);transition:all 0.1s ease-in-out}.wpr-switch label:hover{cursor:pointer}.wpr-switch label:first-of-type{border-radius:3px 0 0 3px;border-right:0;font-weight:normal}.wpr-switch label:last-of-type{border-radius:0 3px 3px 0;border-left:0;font-weight:normal}input.wpr-switch__on:checked+label,input.wpr-switch__off:checked+label{background:#0085ba;border-color:#0073aa #006799 #006799;box-shadow:0 1px 0 #006799;color:#fff;text-decoration:none;text-shadow:0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;margin-bottom:2px}input.wpr-switch__on:checked+label:hover,input.wpr-switch__off:checked+label:hover{background:#008ec2;border-color:#006799;color:#fff}input.wpr-switch__off:checked+label,input.wpr-switch__off:checked+label:hover{color:#fff;background:#f5786f;border-color:#bd4c44 #bd4c44 #bd4c44;box-shadow:0 1px 0 #bd4c44;text-shadow:none}#wp-review-demo-importer-popup{background:#fff;border:1px solid #eaeaeb;border-radius:3px;box-shadow:0 1px 0 #fff inset,0 1px 5px rgba(0,0,0,0.1);position:relative;width:auto;max-width:600px;margin:50px auto}#wp-review-demo-importer-modal-header{border-bottom:1px solid #eaeaeb;background:#FAFBFD;padding:12px 20px}#wp-review-demo-importer-modal-header .spinner{margin-top:14px}#wp-review-demo-importer-modal-header h2,#wp-review-demo-importer-modal-content h4{padding:0 !important;margin:0 !important}#wp-review-demo-importer-modal-header h2{font-size:1.8em;line-height:2em}#wp-review-demo-importer-modal-content{background:#fff;padding:20px;overflow:auto;height:300px;width:100%;box-sizing:border-box}#wp-review-demo-importer-modal-content p{padding:0;margin:0}#wp-review-demo-importer-modal-footer{border-top:1px solid #eaeaeb;background:#FAFBFD;padding:12px 20px;display:inline-block;width:100%;box-sizing:border-box}#wp-review-demo-importer-modal-footer-info{float:left}#wp-review-demo-importer-modal-footer-button{float:right;display:none;text-transform:uppercase}.wp-admin select.mce-selectbox{padding:0}#wp-review-metabox-userReview .inside>p:first-of-type label,#wp-review-metabox-userReview .inside>p:nth-of-type(2) label,#wp-review-metabox-userReview .inside>p:nth-of-type(3) label,#wp-review-metabox-userReview .inside>p:nth-of-type(4) label{padding-right:0;margin-left:5px}.wp-review-subsite-wrapper{display:none}.wp-review-pro-text{color:#00cc66}.wp-review-disabled{position:relative;cursor:pointer}.wp-review-disabled:before{content:" ";display:block;position:absolute;top:0;left:0;right:0;bottom:0;z-index:100}.wp-review-disabled.inline-block{display:inline-block}.wp-review-disabled.wpr-switch,.wp-review-disabled.has-bg{opacity:0.3}option.disabled{color:#aaa}
1
+ .border-box,.wpr-box-template-images{box-sizing:border-box}.border-box *,.wpr-box-template-images *{box-sizing:border-box}.wpr-flex{display:flex;flex-wrap:wrap}.wpr-flex-wrap{flex-wrap:wrap}.wpr-col-1-2{flex:0 0 50%}.wpr-col-1-3{flex:0 0 33.33%;margin-bottom:12px;padding-bottom:12px}.wpr-col-1-3 label{position:relative;padding-left:20px}.wpr-col-1-3 label input[type=checkbox]{position:absolute;top:0;left:0;box-shadow:none;overflow:hidden;border:2px solid rgba(33,38,44,0.6);border-radius:2px}.wpr-col-1-3 label input[type=checkbox]:checked{border-color:#069de3}.wpr-col-1-3 label input[type=checkbox]:checked:before{line-height:16px;width:17px;height:16px;margin:-2px 0 0 -5px;content:'\f147';text-align:center;color:#fff;border-radius:2px;background:#069de3}.wp-review *{box-sizing:border-box}.wp-review p.submit{text-align:right}.wp-review h1{margin-bottom:15px}.wpr-flex-wrap{justify-content:space-between}.wpr-flex-wrap .wpr-col-1-2{flex:0 0 49%}.wpr-flex-wrap .wpr-col-1-2:last-child{float:right}.wp-review-field{padding:15px 0;border-bottom:1px dashed #ddd;margin-top:1em;margin-bottom:1em;border-bottom:1px dashed #ddd}.wp-review-field,.wp-review-field *{box-sizing:border-box}.postbox .wp-review-field{padding:0;border-bottom:0}@media (min-width: 600px){.wp-review-field:not(.vertical):not(.no-flex){display:flex;flex-wrap:wrap}.wp-review-field:not(.vertical):not(.no-flex) .wp-review-field-label{flex:0 0 25%;padding-right:4%}.wp-review-field:not(.vertical):not(.no-flex) .wp-review-field-label.full-width{flex:0 0 100%;padding-right:0}.wp-review-field:not(.vertical):not(.no-flex) .wp-review-field-option{flex:0 0 75%}.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-icon,.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-image{position:relative}.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-icon.hide,.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-image.hide{display:none}.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-icon a.wpr-toggle-rating,.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-image a.wpr-toggle-rating{position:absolute;top:0;right:0}.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-icon .img-wrapper,.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-image .img-wrapper{padding:2px;width:55px;height:55px;border:1px solid #ddd;position:relative}.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-icon .img-wrapper img,.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-image .img-wrapper img{max-width:100%}.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-icon .img-wrapper i,.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-image .img-wrapper i{position:absolute;top:-6px;right:-6px;color:#444;cursor:pointer}.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-icon .img-wrapper.hide,.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-image .img-wrapper.hide{display:none}.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-icon .set_rating_image.hide,.wp-review-field:not(.vertical):not(.no-flex).wp-review-rating-image .set_rating_image.hide{display:none}.postbox .wp-review-field .wp-review-field-label{flex:0 0 20%}.postbox .wp-review-field .wp-review-field-option{flex:0 0 80%}}.wpr_image_upload_field .clear-image{margin-left:10px}.wpr-star-input-wrapper{position:relative;color:#c40000;overflow:hidden;display:inline-block}.wpr-star-input-wrapper .stars-bg{color:#ccc;white-space:nowrap}.wpr-star-input-wrapper .stars-result{white-space:nowrap;position:absolute;left:0;top:0;overflow:hidden}.wpr-input-wrapper.ui-slider .ui-slider-handle{background-color:#fff;box-shadow:0 0px 3px rgba(0,0,0,0.4);border-radius:2px;cursor:pointer}.wpr-vertical-tabs{max-width:880px;position:relative}.wpr-vertical-tabs__titles{width:200px;float:left;border-right:0;margin:0;z-index:10;position:absolute;left:0;top:0}.wpr-vertical-tabs__titles.active{background-color:#fff}.wpr-vertical-tabs__title{margin:0;padding:0;position:relative}.wpr-vertical-tabs__title:first-child a{border-top:1px solid #ccc}.wpr-vertical-tabs__title.active a{background-color:#fff}.wpr-vertical-tabs__title.active a:after{content:"";width:1px;height:40px;position:absolute;right:-1px;top:1px;background:#fff;z-index:10}.wpr-vertical-tabs__title i{font-size:18px;min-width:20px;margin-right:10px;text-align:center;color:#444}.wpr-vertical-tabs__title a{font-size:16px;display:block;box-sizing:border-box;padding:11px 15px;white-space:nowrap;text-decoration:none;color:#555;border:1px solid #ccc;border-top:0;border-right:0;outline:none;background:#e5e5e5;box-shadow:none}.wpr-vertical-tabs__contents{padding-left:200px}.wpr-vertical-tabs__content{padding:15px;min-height:400px;background:#fff;border:1px solid #ccc}.wpr-vertical-tabs__content>h2{margin-top:0}.wpr-vertical-tabs__content .nav-tab-active{background-color:#fff;border-bottom-color:#fff}.clearfix:before,.clearfix:after{content:" ";display:table}.clearfix:after{clear:both}.clearfix{*zoom:1}.wp_review_schema_type_options textarea{width:77%;min-height:80px}.wp-review-field select{width:15em;margin-left:0}.wp-review-field #wp_review_product_price{width:70px}.wp-review-field .wp-color-result{margin:0}.wp-review-field .large-text{width:77%}.wp-review-field input{margin:0;padding:5px 8px}.wp-review-field .wp-picker-container{display:inline-block}.wp-review-field .wp-picker-container label{flex:none;width:auto}.wp-review-field .wp-picker-container input[type="text"].wp-color-picker{padding:4px;width:65px}.wp-review-field .wp-picker-container .iris-picker{box-sizing:initial}.wp-review-field .wp-picker-container .wp-picker-open+.wp-picker-input-wrap{width:140px}#wp-wp_review_pros-wrap textarea.wp-editor-area,#wp-wp_review_cons-wrap textarea.wp-editor-area,#wp-wp_review_desc-wrap textarea.wp-editor-area{border:0}.wp_review_schema_options_label{vertical-align:top;padding-top:5px}.wpr_image_upload_field{display:inline-block}.wp-review-item th{text-align:left}.wp-review-item td:first-child{text-align:center}.wp-review-item .handle{cursor:move}.wp-review-links td:first-child{text-align:center}.wp-review-links .handle{cursor:move}.wp-review-links input[type="text"]{padding:5px 8px}.has-border-bottom{border-bottom:1px solid #ddd;margin-bottom:20px;padding-bottom:20px}.review-total{text-align:right}.wp-review-field-option:not(.pyre_field) .wp-picker-holder{position:absolute;z-index:9}.review-value-incorrect{border-color:#F00 !important}#wp_review_id_hint{margin-left:8px}.wp-review-admin-options .form-table td{padding:20px 10px;vertical-align:top}.wp-review-admin-options p.description{font-weight:normal;font-style:normal}.wp-review-admin-options .wp-review-field>label .description{margin-left:0}.wp-review-admin-options .wp-review-field input{padding:7px;border-radius:2px;margin:0;box-shadow:inset 0 1px 3px rgba(0,0,0,0.1)}.wp-review-admin-options .wp-review-field input[type=radio]{border-radius:50%}.wp-review-admin-options .wp-review-field input[type=checkbox]{border-radius:0}.wp-review-admin-options .wp-review-field .large-text{width:70%}.wp-review-admin-options .wp-review-field .description{display:block;color:#888;font-style:normal;margin-top:5px}.wp-review-admin-options #wp_review_shortcode_hint_field span{display:inline;margin-left:6px}.wp-review-admin-options .wp-review-thumbnail-options label{margin-right:0;width:90%}.wp-review-description label{margin-bottom:-20px;display:block}.wp-review-theme-defaults-msg{position:relative}.wp-review-theme-defaults-msg a.button{display:inline-block;margin-bottom:8px}.wp-review-theme-defaults-msg a.close-notice{position:absolute;top:0;right:0}.edit-ratings-notice.update-nag{background:#fff9e8;margin-right:0}#wp-review-width-slider{width:70%;float:left;margin-top:12px;margin-right:25px;border-radius:0;max-width:600px;border:0;background:#d8d8d8;height:8px}#wp-review-width-slider .ui-slider-handle{background:#fff;box-shadow:0 0px 3px rgba(0,0,0,0.4);border-radius:2px}#wp-review-width-slider.ui-slider-horizontal .ui-slider-range-min{border:0;border-radius:2px;background:#0184bb}#wp_review_width{width:60px}.wrap.wp-review .nav-tab-wrapper{border-bottom:1px solid #ccc;margin-top:16px}.wrap.wp-review .nav-tab-wrapper a:focus{box-shadow:none}.nav-tab-hidden{display:none}.nav-tab-hidden.nav-tab-active{display:block}textarea#wp-review-migrate-log{width:600px;max-width:100%;height:200px;display:none}.already-migrated-msg{display:none}#start-migrate{margin-bottom:12px}#wp-review-settings-tab-contents>div{display:none;max-width:900px}#wp-review-settings-tab-contents .settings-tab-general{display:block}.pros-cons-title{max-width:25%}.column-wp_review_rating,.column-wp_review_comment_rating{text-align:center;position:relative;width:110px}.column-wp_review_rating .review-star,.column-wp_review_comment_rating .review-star{position:relative;letter-spacing:1px}.column-wp_review_rating .no-rating,.column-wp_review_comment_rating .no-rating{color:#aaa;font-style:italic}#editwpreview{overflow:hidden}#editwpreview .inside{float:left;padding:3px 0 2px 5px;margin:0;text-align:left}#editwpreview .inside input{width:180px}#editwpreview label{padding:2px 0}h4.wp-review-comment-title{margin-top:0;margin-bottom:1em}.review-result-wrapper{position:relative;display:inline-block;font-size:0}.postbox .review-result-wrapper a,.postbox .review-result i{cursor:pointer}.review-result{position:absolute;top:0;left:0;height:22px;overflow:hidden;white-space:nowrap}.wp-review-rating-feature{display:inline-block}.wp-review-notice{position:relative}.wpr_image_upload_img{margin:0 0 10px;padding:0;max-width:100%;height:auto;float:left;display:inline-block}.wpr-hide{display:none}.wpr-tabs .tab-title.nav-tab-active{background-color:#fff;border-bottom-color:#fff}.wpr-box-template-images{display:flex;flex-wrap:wrap}.wpr-box-template-images .wpr-box-template-image{flex:0 0 50%;display:block;outline:0;box-shadow:none;text-decoration:none;text-align:center;color:#333;font-weight:700;margin-bottom:5px}.wpr-box-template-images .wpr-box-template-image img{padding:4px;width:100%;height:auto;display:block}.wpr-box-template-images .wpr-box-template-image.active img{background-color:#0073aa}#wpr-review-items-app *{box-sizing:border-box}#wpr-review-items-app .wpr-review-item{background-color:#f7f7f7;padding:10px 10px 10px 30px;margin-bottom:5px}#wpr-review-items-app .wpr-review-item .setting-row:first-of-type .col-2 input{width:100%;padding:5px;background:#fff}#wpr-review-items-app .wpr-review-item .col-3 input{float:right;background:#fff}#wpr-review-items-app .wpr-review-item .wpr-icon-move{cursor:move;position:absolute;left:5px;top:16px}#wpr-review-items-app .setting-row{padding:5px 0}#wpr-review-items-app .final-row .col-3{text-align:right}#wpr-review-items-app .final-row .col-3 input{float:right;min-width:52px}#wpr-review-items-app .final-row .col-3 label{margin:4px 10px 0 0;display:inline-block;font-weight:bold}#wpr-review-items-app .wpr-percentage-input-wrapper{margin-top:10px}#wpr-review-items-app .wp-picker-container{display:inline-block}#wpr-review-items-app .wp-picker-holder *{box-sizing:initial}@media (min-width: 768px){#wpr-review-items-app .wpr-review-item{position:relative}#wpr-review-items-app .delete-item{position:absolute;right:10px;bottom:10px}#wpr-review-items-app .setting-row{display:flex;flex-wrap:wrap}#wpr-review-items-app .col-1{flex:0 0 20%}#wpr-review-items-app .col-2{flex:0 0 60%;padding:0 10px}#wpr-review-items-app .col-3{flex:0 0 20%}}#wp_review_box_template_wrapper{position:relative}#wp_review_box_template_preview{position:absolute;left:250px;top:0px;z-index:1000;padding:3px;box-shadow:0 0 3px rgba(0,0,0,0.2);background:#fff}#wp_review_box_template_preview.loading{background:#eee url(../images/loading.svg) no-repeat center center}#wp_review_box_template_preview.loading img{visibility:hidden}#wp_review_box_template_img,#wp_review_box_template_preview_img{max-width:414px;height:auto}.wpr-switch{display:inline-block}.wpr-switch input{position:absolute !important;clip:rect(0, 0, 0, 0);height:1px;width:1px;border:0;overflow:hidden}.wpr-switch label{float:left;display:inline-block;min-width:45px;background-color:#e4e4e4;color:rgba(0,0,0,0.6);font-size:12px;font-weight:700;line-height:28px;text-align:center;text-shadow:none;border:1px solid rgba(0,0,0,0.2);box-shadow:inset 0 1px 3px rgba(0,0,0,0.3),0 1px rgba(255,255,255,0.1);transition:all 0.1s ease-in-out}.wpr-switch label:hover{cursor:pointer}.wpr-switch label:first-of-type{border-radius:3px 0 0 3px;border-right:0;font-weight:normal}.wpr-switch label:last-of-type{border-radius:0 3px 3px 0;border-left:0;font-weight:normal}input.wpr-switch__on:checked+label,input.wpr-switch__off:checked+label{background:#0085ba;border-color:#0073aa #006799 #006799;box-shadow:0 1px 0 #006799;color:#fff;text-decoration:none;text-shadow:0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;margin-bottom:2px}input.wpr-switch__on:checked+label:hover,input.wpr-switch__off:checked+label:hover{background:#008ec2;border-color:#006799;color:#fff}input.wpr-switch__off:checked+label,input.wpr-switch__off:checked+label:hover{color:#fff;background:#f5786f;border-color:#bd4c44 #bd4c44 #bd4c44;box-shadow:0 1px 0 #bd4c44;text-shadow:none}#wp-review-demo-importer-popup{background:#fff;border:1px solid #eaeaeb;border-radius:3px;box-shadow:0 1px 0 #fff inset,0 1px 5px rgba(0,0,0,0.1);position:relative;width:auto;max-width:600px;margin:50px auto}#wp-review-demo-importer-modal-header{border-bottom:1px solid #eaeaeb;background:#FAFBFD;padding:12px 20px}#wp-review-demo-importer-modal-header .spinner{margin-top:14px}#wp-review-demo-importer-modal-header h2,#wp-review-demo-importer-modal-content h4{padding:0 !important;margin:0 !important}#wp-review-demo-importer-modal-header h2{font-size:1.8em;line-height:2em}#wp-review-demo-importer-modal-content{background:#fff;padding:20px;overflow:auto;height:300px;width:100%;box-sizing:border-box}#wp-review-demo-importer-modal-content p{padding:0;margin:0}#wp-review-demo-importer-modal-footer{border-top:1px solid #eaeaeb;background:#FAFBFD;padding:12px 20px;display:inline-block;width:100%;box-sizing:border-box}#wp-review-demo-importer-modal-footer-info{float:left}#wp-review-demo-importer-modal-footer-button{float:right;display:none;text-transform:uppercase}.wp-admin select.mce-selectbox{padding:0}#wp-review-metabox-userReview .inside>p:first-of-type label,#wp-review-metabox-userReview .inside>p:nth-of-type(2) label,#wp-review-metabox-userReview .inside>p:nth-of-type(3) label,#wp-review-metabox-userReview .inside>p:nth-of-type(4) label{padding-right:0;margin-left:5px}.wp-review-subsite-wrapper{display:none}.wp-review-pro-text{color:#00cc66}.wp-review-disabled{position:relative;cursor:pointer}.wp-review-disabled:before{content:" ";display:block;position:absolute;top:0;left:0;right:0;bottom:0;z-index:100}.wp-review-disabled.inline-block{display:inline-block}.wp-review-disabled.wpr-switch,.wp-review-disabled.has-bg{opacity:0.3}option.disabled{color:#aaa}
admin/assets/css/jquery-ui.min.css CHANGED
@@ -1,360 +1,360 @@
1
- /*---------------------------
2
- * jQuery UI Slider
3
- *--------------------------*/
4
- .ui-slider { position: relative; text-align: left; }
5
- .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.3em; cursor: default; }
6
- .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
7
- .ui-slider-horizontal { height: .8em; }
8
- .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
9
- .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
10
- .ui-slider-horizontal .ui-slider-range-min { left: 0; }
11
- .ui-slider-horizontal .ui-slider-range-max { right: 0; }
12
- .ui-slider-vertical { width: .8em; height: 100px; }
13
- .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
14
- .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
15
- .ui-slider-vertical .ui-slider-range-min { bottom: 0; }
16
- .ui-slider-vertical .ui-slider-range-max { top: 0; }
17
-
18
- /* Date Picker Default Styles */
19
- .ui-datepicker {
20
- padding: 0;
21
- margin: 0;
22
- -webkit-border-radius: 0;
23
- -moz-border-radius: 0;
24
- border-radius: 0;
25
- background-color: #fff;
26
- border: 1px solid #dfdfdf;
27
- border-top: none;
28
- -webkit-box-shadow: 0 3px 6px rgba(0, 0, 0, 0.075);
29
- box-shadow: 0 3px 6px rgba(0, 0, 0, 0.075);
30
- min-width: 17em;
31
- width: auto;
32
- }
33
-
34
- .ui-datepicker * {
35
- padding: 0;
36
- font-family: "Open Sans", sans-serif;
37
- -webkit-border-radius: 0;
38
- -moz-border-radius: 0;
39
- border-radius: 0;
40
- }
41
-
42
- .ui-datepicker table {
43
- font-size: 13px;
44
- margin: 0;
45
- border: none;
46
- border-collapse: collapse;
47
- }
48
-
49
- .ui-datepicker .ui-widget-header,
50
- .ui-datepicker .ui-datepicker-header {
51
- background-image: none;
52
- border: none;
53
- color: #fff;
54
- font-weight: normal;
55
- }
56
-
57
- .ui-datepicker .ui-datepicker-header .ui-state-hover {
58
- background: transparent;
59
- border-color: transparent;
60
- cursor: pointer;
61
- }
62
-
63
- .ui-datepicker .ui-datepicker-title {
64
- margin: 0;
65
- padding: 10px 0;
66
- color: #fff;
67
- font-size: 14px;
68
- line-height: 14px;
69
- text-align: center;
70
- }
71
-
72
- .ui-datepicker .ui-datepicker-prev,
73
- .ui-datepicker .ui-datepicker-next {
74
- position: relative;
75
- top: 0;
76
- height: 34px;
77
- width: 34px;
78
- }
79
-
80
- .ui-datepicker .ui-state-hover.ui-datepicker-prev,
81
- .ui-datepicker .ui-state-hover.ui-datepicker-next {
82
- border: none;
83
- }
84
-
85
- .ui-datepicker .ui-datepicker-prev,
86
- .ui-datepicker .ui-datepicker-prev-hover {
87
- left: 0;
88
- }
89
-
90
- .ui-datepicker .ui-datepicker-next,
91
- .ui-datepicker .ui-datepicker-next-hover {
92
- right: 0;
93
- }
94
-
95
- .ui-datepicker .ui-datepicker-next span,
96
- .ui-datepicker .ui-datepicker-prev span {
97
- display: none;
98
- }
99
-
100
- .ui-datepicker .ui-datepicker-prev {
101
- float: left;
102
- }
103
-
104
- .ui-datepicker .ui-datepicker-next {
105
- float: right;
106
- }
107
-
108
- .ui-datepicker .ui-datepicker-prev:before,
109
- .ui-datepicker .ui-datepicker-next:before {
110
- font: normal 20px/34px 'dashicons';
111
- padding-left: 7px;
112
- color: #fff;
113
- speak: none;
114
- -webkit-font-smoothing: antialiased;
115
- -moz-osx-font-smoothing: grayscale;
116
- width: 34px;
117
- height: 34px;
118
- }
119
-
120
- .ui-datepicker .ui-datepicker-prev:before {
121
- content: '\f341';
122
- }
123
-
124
- .ui-datepicker .ui-datepicker-next:before {
125
- content: '\f345';
126
- }
127
-
128
- .ui-datepicker .ui-datepicker-prev-hover:before,
129
- .ui-datepicker .ui-datepicker-next-hover:before {
130
- opacity: 0.7;
131
- }
132
-
133
- .ui-datepicker select.ui-datepicker-month,
134
- .ui-datepicker select.ui-datepicker-year {
135
- width: 33%;
136
- }
137
-
138
- .ui-datepicker thead {
139
- color: #fff;
140
- font-weight: 600;
141
- }
142
-
143
- .ui-datepicker th {
144
- padding: 10px;
145
- }
146
-
147
- .ui-datepicker td {
148
- padding: 0;
149
- border: 1px solid #f4f4f4;
150
- }
151
-
152
- .ui-datepicker td.ui-datepicker-other-month {
153
- border: transparent;
154
- }
155
-
156
- .ui-datepicker td.ui-datepicker-week-end {
157
- background-color: #f4f4f4;
158
- border: 1px solid #f4f4f4;
159
- }
160
-
161
- .ui-datepicker td.ui-datepicker-today {
162
- background-color: #f0f0c0;
163
- }
164
-
165
- .ui-datepicker td.ui-datepicker-current-day {
166
- background: #bbdd88;
167
- }
168
-
169
- .ui-datepicker td .ui-state-default {
170
- background: transparent;
171
- border: none;
172
- text-align: center;
173
- text-decoration: none;
174
- width: auto;
175
- display: block;
176
- padding: 5px 10px;
177
- font-weight: normal;
178
- color: #444;
179
- }
180
-
181
- .ui-datepicker td.ui-state-disabled .ui-state-default {
182
- opacity: 0.5;
183
- }
184
-
185
- /* Default Color Scheme */
186
- .ui-datepicker .ui-widget-header,
187
- .ui-datepicker .ui-datepicker-header {
188
- background: #00a0d2;
189
- }
190
-
191
- .ui-datepicker thead {
192
- background: #32373c;
193
- }
194
-
195
- .ui-datepicker td .ui-state-hover {
196
- background: #0073aa;
197
- color: #fff;
198
- }
199
-
200
- /* WordPress Color Schemes */
201
-
202
- /* Fresh */
203
- .admin-color-fresh .ui-datepicker .ui-widget-header,
204
- .admin-color-fresh .ui-datepicker .ui-datepicker-header {
205
- background: #00a0d2;
206
- }
207
-
208
- .admin-color-fresh .ui-datepicker thead {
209
- background: #32373c;
210
- }
211
-
212
- .admin-color-fresh .ui-datepicker td .ui-state-hover {
213
- background: #0073aa;
214
- color: #fff;
215
- }
216
-
217
- /* Blue */
218
- .admin-color-blue .ui-datepicker .ui-widget-header,
219
- .admin-color-blue .ui-datepicker .ui-datepicker-header {
220
- background: #52accc;
221
- }
222
-
223
- .admin-color-blue .ui-datepicker thead {
224
- background: #4796b3;
225
- }
226
-
227
- .admin-color-blue .ui-datepicker td .ui-state-hover {
228
- background: #096484;
229
- color: #fff;
230
- }
231
-
232
- /* Coffee */
233
- .admin-color-coffee .ui-datepicker .ui-widget-header,
234
- .admin-color-coffee .ui-datepicker .ui-datepicker-header {
235
- background: #59524c;
236
- }
237
-
238
- .admin-color-coffee .ui-datepicker thead {
239
- background: #46403c;
240
- }
241
-
242
- .admin-color-coffee .ui-datepicker td .ui-state-hover {
243
- background: #c7a589;
244
- color: #fff;
245
- }
246
-
247
- /* Ectoplasm */
248
- .admin-color-ectoplasm .ui-datepicker .ui-widget-header,
249
- .admin-color-ectoplasm .ui-datepicker .ui-datepicker-header {
250
- background: #523f6d;
251
- }
252
-
253
- .admin-color-ectoplasm .ui-datepicker thead {
254
- background: #413256;
255
- }
256
-
257
- .admin-color-ectoplasm .ui-datepicker td .ui-state-hover {
258
- background: #a3b745;
259
- color: #fff;
260
- }
261
-
262
- /* Midnight */
263
- .admin-color-midnight .ui-datepicker .ui-widget-header,
264
- .admin-color-midnight .ui-datepicker .ui-datepicker-header {
265
- background: #363b3f;
266
- }
267
-
268
- .admin-color-midnight .ui-datepicker thead {
269
- background: #26292c;
270
- }
271
-
272
- .admin-color-midnight .ui-datepicker td .ui-state-hover {
273
- background: #e14d43;
274
- color: #fff;
275
- }
276
-
277
- /* Ocean */
278
- .admin-color-ocean .ui-datepicker .ui-widget-header,
279
- .admin-color-ocean .ui-datepicker .ui-datepicker-header {
280
- background: #738e96;
281
- }
282
-
283
- .admin-color-ocean .ui-datepicker thead {
284
- background: #627c83;
285
- }
286
-
287
- .admin-color-ocean .ui-datepicker td .ui-state-hover {
288
- background: #9ebaa0;
289
- color: #fff;
290
- }
291
-
292
- /* Sunrise */
293
- .admin-color-sunrise .ui-datepicker .ui-widget-header,
294
- .admin-color-sunrise .ui-datepicker .ui-datepicker-header,
295
- .admin-color-sunrise .ui-datepicker .ui-datepicker-header .ui-state-hover {
296
- background: #cf4944;
297
- }
298
-
299
- .admin-color-sunrise .ui-datepicker th {
300
- border-color: #be3631;
301
- background: #be3631;
302
- }
303
-
304
- .admin-color-sunrise .ui-datepicker td .ui-state-hover {
305
- background: #dd823b;
306
- color: #fff;
307
- }
308
-
309
- /* Light */
310
- .admin-color-light .ui-datepicker .ui-widget-header,
311
- .admin-color-light .ui-datepicker .ui-datepicker-header {
312
- background: #e5e5e5;
313
- }
314
-
315
- .admin-color-light .ui-datepicker thead {
316
- background: #888;
317
- }
318
-
319
- .admin-color-light .ui-datepicker .ui-datepicker-title,
320
- .admin-color-light .ui-datepicker td .ui-state-default,
321
- .admin-color-light .ui-datepicker .ui-datepicker-prev:before,
322
- .admin-color-light .ui-datepicker .ui-datepicker-next:before {
323
- color: #555;
324
- }
325
-
326
- .admin-color-light .ui-datepicker td .ui-state-hover {
327
- background: #e5e5e5;
328
- }
329
-
330
- /* bbPress Color Schemes */
331
-
332
- /* Evergreen */
333
- .admin-color-bbp-evergreen .ui-datepicker .ui-widget-header,
334
- .admin-color-bbp-evergreen .ui-datepicker .ui-datepicker-header {
335
- background: #56b274;
336
- }
337
-
338
- .admin-color-bbp-evergreen .ui-datepicker thead {
339
- background: #36533f;
340
- }
341
-
342
- .admin-color-bbp-evergreen .ui-datepicker td .ui-state-hover {
343
- background: #446950;
344
- color: #fff;
345
- }
346
-
347
- /* Mint */
348
- .admin-color-bbp-mint .ui-datepicker .ui-widget-header,
349
- .admin-color-bbp-mint .ui-datepicker .ui-datepicker-header {
350
- background: #4ca26a;
351
- }
352
-
353
- .admin-color-bbp-mint .ui-datepicker thead {
354
- background: #4f6d59;
355
- }
356
-
357
- .admin-color-bbp-mint .ui-datepicker td .ui-state-hover {
358
- background: #5fb37c;
359
- color: #fff;
360
  }
1
+ /*---------------------------
2
+ * jQuery UI Slider
3
+ *--------------------------*/
4
+ .ui-slider { position: relative; text-align: left; }
5
+ .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.3em; cursor: default; }
6
+ .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
7
+ .ui-slider-horizontal { height: .8em; }
8
+ .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
9
+ .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
10
+ .ui-slider-horizontal .ui-slider-range-min { left: 0; }
11
+ .ui-slider-horizontal .ui-slider-range-max { right: 0; }
12
+ .ui-slider-vertical { width: .8em; height: 100px; }
13
+ .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
14
+ .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
15
+ .ui-slider-vertical .ui-slider-range-min { bottom: 0; }
16
+ .ui-slider-vertical .ui-slider-range-max { top: 0; }
17
+
18
+ /* Date Picker Default Styles */
19
+ .ui-datepicker {
20
+ padding: 0;
21
+ margin: 0;
22
+ -webkit-border-radius: 0;
23
+ -moz-border-radius: 0;
24
+ border-radius: 0;
25
+ background-color: #fff;
26
+ border: 1px solid #dfdfdf;
27
+ border-top: none;
28
+ -webkit-box-shadow: 0 3px 6px rgba(0, 0, 0, 0.075);
29
+ box-shadow: 0 3px 6px rgba(0, 0, 0, 0.075);
30
+ min-width: 17em;
31
+ width: auto;
32
+ }
33
+
34
+ .ui-datepicker * {
35
+ padding: 0;
36
+ font-family: "Open Sans", sans-serif;
37
+ -webkit-border-radius: 0;
38
+ -moz-border-radius: 0;
39
+ border-radius: 0;
40
+ }
41
+
42
+ .ui-datepicker table {
43
+ font-size: 13px;
44
+ margin: 0;
45
+ border: none;
46
+ border-collapse: collapse;
47
+ }
48
+
49
+ .ui-datepicker .ui-widget-header,
50
+ .ui-datepicker .ui-datepicker-header {
51
+ background-image: none;
52
+ border: none;
53
+ color: #fff;
54
+ font-weight: normal;
55
+ }
56
+
57
+ .ui-datepicker .ui-datepicker-header .ui-state-hover {
58
+ background: transparent;
59
+ border-color: transparent;
60
+ cursor: pointer;
61
+ }
62
+
63
+ .ui-datepicker .ui-datepicker-title {
64
+ margin: 0;
65
+ padding: 10px 0;
66
+ color: #fff;
67
+ font-size: 14px;
68
+ line-height: 14px;
69
+ text-align: center;
70
+ }
71
+
72
+ .ui-datepicker .ui-datepicker-prev,
73
+ .ui-datepicker .ui-datepicker-next {
74
+ position: relative;
75
+ top: 0;
76
+ height: 34px;
77
+ width: 34px;
78
+ }
79
+
80
+ .ui-datepicker .ui-state-hover.ui-datepicker-prev,
81
+ .ui-datepicker .ui-state-hover.ui-datepicker-next {
82
+ border: none;
83
+ }
84
+
85
+ .ui-datepicker .ui-datepicker-prev,
86
+ .ui-datepicker .ui-datepicker-prev-hover {
87
+ left: 0;
88
+ }
89
+
90
+ .ui-datepicker .ui-datepicker-next,
91
+ .ui-datepicker .ui-datepicker-next-hover {
92
+ right: 0;
93
+ }
94
+
95
+ .ui-datepicker .ui-datepicker-next span,
96
+ .ui-datepicker .ui-datepicker-prev span {
97
+ display: none;
98
+ }
99
+
100
+ .ui-datepicker .ui-datepicker-prev {
101
+ float: left;
102
+ }
103
+
104
+ .ui-datepicker .ui-datepicker-next {
105
+ float: right;
106
+ }
107
+
108
+ .ui-datepicker .ui-datepicker-prev:before,
109
+ .ui-datepicker .ui-datepicker-next:before {
110
+ font: normal 20px/34px 'dashicons';
111
+ padding-left: 7px;
112
+ color: #fff;
113
+ speak: none;
114
+ -webkit-font-smoothing: antialiased;
115
+ -moz-osx-font-smoothing: grayscale;
116
+ width: 34px;
117
+ height: 34px;
118
+ }
119
+
120
+ .ui-datepicker .ui-datepicker-prev:before {
121
+ content: '\f341';
122
+ }
123
+
124
+ .ui-datepicker .ui-datepicker-next:before {
125
+ content: '\f345';
126
+ }
127
+
128
+ .ui-datepicker .ui-datepicker-prev-hover:before,
129
+ .ui-datepicker .ui-datepicker-next-hover:before {
130
+ opacity: 0.7;
131
+ }
132
+
133
+ .ui-datepicker select.ui-datepicker-month,
134
+ .ui-datepicker select.ui-datepicker-year {
135
+ width: 33%;
136
+ }
137
+
138
+ .ui-datepicker thead {
139
+ color: #fff;
140
+ font-weight: 600;
141
+ }
142
+
143
+ .ui-datepicker th {
144
+ padding: 10px;
145
+ }
146
+
147
+ .ui-datepicker td {
148
+ padding: 0;
149
+ border: 1px solid #f4f4f4;
150
+ }
151
+
152
+ .ui-datepicker td.ui-datepicker-other-month {
153
+ border: transparent;
154
+ }
155
+
156
+ .ui-datepicker td.ui-datepicker-week-end {
157
+ background-color: #f4f4f4;
158
+ border: 1px solid #f4f4f4;
159
+ }
160
+
161
+ .ui-datepicker td.ui-datepicker-today {
162
+ background-color: #f0f0c0;
163
+ }
164
+
165
+ .ui-datepicker td.ui-datepicker-current-day {
166
+ background: #bbdd88;
167
+ }
168
+
169
+ .ui-datepicker td .ui-state-default {
170
+ background: transparent;
171
+ border: none;
172
+ text-align: center;
173
+ text-decoration: none;
174
+ width: auto;
175
+ display: block;
176
+ padding: 5px 10px;
177
+ font-weight: normal;
178
+ color: #444;
179
+ }
180
+
181
+ .ui-datepicker td.ui-state-disabled .ui-state-default {
182
+ opacity: 0.5;
183
+ }
184
+
185
+ /* Default Color Scheme */
186
+ .ui-datepicker .ui-widget-header,
187
+ .ui-datepicker .ui-datepicker-header {
188
+ background: #00a0d2;
189
+ }
190
+
191
+ .ui-datepicker thead {
192
+ background: #32373c;
193
+ }
194
+
195
+ .ui-datepicker td .ui-state-hover {
196
+ background: #0073aa;
197
+ color: #fff;
198
+ }
199
+
200
+ /* WordPress Color Schemes */
201
+
202
+ /* Fresh */
203
+ .admin-color-fresh .ui-datepicker .ui-widget-header,
204
+ .admin-color-fresh .ui-datepicker .ui-datepicker-header {
205
+ background: #00a0d2;
206
+ }
207
+
208
+ .admin-color-fresh .ui-datepicker thead {
209
+ background: #32373c;
210
+ }
211
+
212
+ .admin-color-fresh .ui-datepicker td .ui-state-hover {
213
+ background: #0073aa;
214
+ color: #fff;
215
+ }
216
+
217
+ /* Blue */
218
+ .admin-color-blue .ui-datepicker .ui-widget-header,
219
+ .admin-color-blue .ui-datepicker .ui-datepicker-header {
220
+ background: #52accc;
221
+ }
222
+
223
+ .admin-color-blue .ui-datepicker thead {
224
+ background: #4796b3;
225
+ }
226
+
227
+ .admin-color-blue .ui-datepicker td .ui-state-hover {
228
+ background: #096484;
229
+ color: #fff;
230
+ }
231
+
232
+ /* Coffee */
233
+ .admin-color-coffee .ui-datepicker .ui-widget-header,
234
+ .admin-color-coffee .ui-datepicker .ui-datepicker-header {
235
+ background: #59524c;
236
+ }
237
+
238
+ .admin-color-coffee .ui-datepicker thead {
239
+ background: #46403c;
240
+ }
241
+
242
+ .admin-color-coffee .ui-datepicker td .ui-state-hover {
243
+ background: #c7a589;
244
+ color: #fff;
245
+ }
246
+
247
+ /* Ectoplasm */
248
+ .admin-color-ectoplasm .ui-datepicker .ui-widget-header,
249
+ .admin-color-ectoplasm .ui-datepicker .ui-datepicker-header {
250
+ background: #523f6d;
251
+ }
252
+
253
+ .admin-color-ectoplasm .ui-datepicker thead {
254
+ background: #413256;
255
+ }
256
+
257
+ .admin-color-ectoplasm .ui-datepicker td .ui-state-hover {
258
+ background: #a3b745;
259
+ color: #fff;
260
+ }
261
+
262
+ /* Midnight */
263
+ .admin-color-midnight .ui-datepicker .ui-widget-header,
264
+ .admin-color-midnight .ui-datepicker .ui-datepicker-header {
265
+ background: #363b3f;
266
+ }
267
+
268
+ .admin-color-midnight .ui-datepicker thead {
269
+ background: #26292c;
270
+ }
271
+
272
+ .admin-color-midnight .ui-datepicker td .ui-state-hover {
273
+ background: #e14d43;
274
+ color: #fff;
275
+ }
276
+
277
+ /* Ocean */
278
+ .admin-color-ocean .ui-datepicker .ui-widget-header,
279
+ .admin-color-ocean .ui-datepicker .ui-datepicker-header {
280
+ background: #738e96;
281
+ }
282
+
283
+ .admin-color-ocean .ui-datepicker thead {
284
+ background: #627c83;
285
+ }
286
+
287
+ .admin-color-ocean .ui-datepicker td .ui-state-hover {
288
+ background: #9ebaa0;
289
+ color: #fff;
290
+ }
291
+
292
+ /* Sunrise */
293
+ .admin-color-sunrise .ui-datepicker .ui-widget-header,
294
+ .admin-color-sunrise .ui-datepicker .ui-datepicker-header,
295
+ .admin-color-sunrise .ui-datepicker .ui-datepicker-header .ui-state-hover {
296
+ background: #cf4944;
297
+ }
298
+
299
+ .admin-color-sunrise .ui-datepicker th {
300
+ border-color: #be3631;
301
+ background: #be3631;
302
+ }
303
+
304
+ .admin-color-sunrise .ui-datepicker td .ui-state-hover {
305
+ background: #dd823b;
306
+ color: #fff;
307
+ }
308
+
309
+ /* Light */
310
+ .admin-color-light .ui-datepicker .ui-widget-header,
311
+ .admin-color-light .ui-datepicker .ui-datepicker-header {
312
+ background: #e5e5e5;
313
+ }
314
+
315
+ .admin-color-light .ui-datepicker thead {
316
+ background: #888;
317
+ }
318
+
319
+ .admin-color-light .ui-datepicker .ui-datepicker-title,
320
+ .admin-color-light .ui-datepicker td .ui-state-default,
321
+ .admin-color-light .ui-datepicker .ui-datepicker-prev:before,
322
+ .admin-color-light .ui-datepicker .ui-datepicker-next:before {
323
+ color: #555;
324
+ }
325
+
326
+ .admin-color-light .ui-datepicker td .ui-state-hover {
327
+ background: #e5e5e5;
328
+ }
329
+
330
+ /* bbPress Color Schemes */
331
+
332
+ /* Evergreen */
333
+ .admin-color-bbp-evergreen .ui-datepicker .ui-widget-header,
334
+ .admin-color-bbp-evergreen .ui-datepicker .ui-datepicker-header {
335
+ background: #56b274;
336
+ }
337
+
338
+ .admin-color-bbp-evergreen .ui-datepicker thead {
339
+ background: #36533f;
340
+ }
341
+
342
+ .admin-color-bbp-evergreen .ui-datepicker td .ui-state-hover {
343
+ background: #446950;
344
+ color: #fff;
345
+ }
346
+
347
+ /* Mint */
348
+ .admin-color-bbp-mint .ui-datepicker .ui-widget-header,
349
+ .admin-color-bbp-mint .ui-datepicker .ui-datepicker-header {
350
+ background: #4ca26a;
351
+ }
352
+
353
+ .admin-color-bbp-mint .ui-datepicker thead {
354
+ background: #4f6d59;
355
+ }
356
+
357
+ .admin-color-bbp-mint .ui-datepicker td .ui-state-hover {
358
+ background: #5fb37c;
359
+ color: #fff;
360
  }
admin/assets/css/select2.min.css CHANGED
@@ -1 +1 @@
1
- .select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
1
+ .select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
admin/assets/images/loading.svg CHANGED
@@ -1,17 +1,17 @@
1
- <!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL -->
2
- <svg width="38" height="38" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" stroke="#fff">
3
- <g fill="none" fill-rule="evenodd">
4
- <g transform="translate(1 1)" stroke-width="2">
5
- <circle stroke-opacity=".5" cx="18" cy="18" r="18"/>
6
- <path d="M36 18c0-9.94-8.06-18-18-18">
7
- <animateTransform
8
- attributeName="transform"
9
- type="rotate"
10
- from="0 18 18"
11
- to="360 18 18"
12
- dur="1s"
13
- repeatCount="indefinite"/>
14
- </path>
15
- </g>
16
- </g>
17
  </svg>
1
+ <!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL -->
2
+ <svg width="38" height="38" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" stroke="#fff">
3
+ <g fill="none" fill-rule="evenodd">
4
+ <g transform="translate(1 1)" stroke-width="2">
5
+ <circle stroke-opacity=".5" cx="18" cy="18" r="18"/>
6
+ <path d="M36 18c0-9.94-8.06-18-18-18">
7
+ <animateTransform
8
+ attributeName="transform"
9
+ type="rotate"
10
+ from="0 18 18"
11
+ to="360 18 18"
12
+ dur="1s"
13
+ repeatCount="indefinite"/>
14
+ </path>
15
+ </g>
16
+ </g>
17
  </svg>
admin/assets/images/wp-review-pro.jpg CHANGED
File without changes
admin/assets/js/admin.import.js CHANGED
@@ -1,33 +1,33 @@
1
- jQuery( function( $ ) {
2
- 'use strict';
3
-
4
- var $section_header = $( '#import h2' );
5
- var default_error = { message: wprImportVars.server_error };
6
- var source, nonce;
7
-
8
- $( '#wp-review-import-options-btn' ).on( 'click', function( ev ) {
9
- ev.preventDefault();
10
- var $btn, code, check;
11
- $btn = $( this );
12
- code = $( '#wp-review-import-options-code' ).val().trim();
13
- if ( ! code ) {
14
- return;
15
- }
16
- check = confirm( wprImportVars.confirmOptionsImport );
17
- if ( ! check ) {
18
- return;
19
- }
20
- $btn.prop( 'disabled', true );
21
- var request = wp.ajax.post( 'wp_review_import_options', {
22
- code: code,
23
- _ajax_nonce: wprImportVars.importOptionsNonce
24
- });
25
- request.done( function( response ) {
26
- window.location.href = window.location.href;
27
- });
28
- request.fail( function( response ) {
29
- console.error( response );
30
- $btn.prop( 'disabled', false );
31
- });
32
- });
33
- } );
1
+ jQuery( function( $ ) {
2
+ 'use strict';
3
+
4
+ var $section_header = $( '#import h2' );
5
+ var default_error = { message: wprImportVars.server_error };
6
+ var source, nonce;
7
+
8
+ $( '#wp-review-import-options-btn' ).on( 'click', function( ev ) {
9
+ ev.preventDefault();
10
+ var $btn, code, check;
11
+ $btn = $( this );
12
+ code = $( '#wp-review-import-options-code' ).val().trim();
13
+ if ( ! code ) {
14
+ return;
15
+ }
16
+ check = confirm( wprImportVars.confirmOptionsImport );
17
+ if ( ! check ) {
18
+ return;
19
+ }
20
+ $btn.prop( 'disabled', true );
21
+ var request = wp.ajax.post( 'wp_review_import_options', {
22
+ code: code,
23
+ _ajax_nonce: wprImportVars.importOptionsNonce
24
+ });
25
+ request.done( function( response ) {
26
+ window.location.href = window.location.href;
27
+ });
28
+ request.fail( function( response ) {
29
+ console.error( response );
30
+ $btn.prop( 'disabled', false );
31
+ });
32
+ });
33
+ } );
admin/assets/js/admin.js CHANGED
@@ -1,831 +1,831 @@
1
- /*
2
- * Plugin Name: WP Review
3
- * Plugin URI: http://mythemeshop.com/plugins/wp-review/
4
- * Description: Create reviews! Choose from Stars, Percentages, Circles or Points for review scores. Supports Retina Display, WPMU & Unlimited Color Schemes.
5
- * Author: MyThemesShop
6
- * Author URI: http://mythemeshop.com/
7
- */
8
- ( function( $ ) {
9
- "use strict";
10
-
11
- var wpreview = window.wpreview = window.wpreview || {};
12
-
13
- wpreview.initSelect2 = function() {
14
- if ( 'function' !== typeof $.fn.select2 ) {
15
- return;
16
- }
17
-
18
- function addIcon( option ) {
19
- if ( $( option.element ).attr( 'data-icon' ) ) {
20
- return $( '<span><i class="' + $( option.element ).attr( 'data-icon' ) + '"></i> ' + option.text + '</span>' );
21
- }
22
- return option.text;
23
- }
24
-
25
- $( '.js-select2' ).select2({
26
- templateResult: addIcon,
27
- templateSelection: addIcon
28
- });
29
- };
30
-
31
- wpreview.tabs = function( options ) {
32
- var defaults = {
33
- wrapper: '[data-tabs]',
34
- title: '[data-tab-title]',
35
- content: '[data-tab-content]',
36
- activeElement: '',
37
- activeClass: 'active',
38
- active: '',
39
- activate: null
40
- };
41
-
42
- options = $.extend( {}, defaults, options );
43
-
44
- $( options.wrapper + ' ' + options.title ).on( 'click', function( ev ) {
45
- ev.preventDefault();
46
- var href, $tab;
47
- href = $( this ).attr( 'href' );
48
- $tab = $( this ).closest( options.wrapper );
49
-
50
- $tab.find( options.content ).hide();
51
-
52
- if ( ! options.activeElement || options.activeElement == options.title ) {
53
- $tab.find( options.title ).removeClass( options.activeClass );
54
- $( this ).addClass( options.activeClass );
55
- } else {
56
- $tab.find( options.activeElement ).removeClass( options.activeClass );
57
- $( this ).closest( options.activeElement ).addClass( options.activeClass );
58
- }
59
-
60
- if ( typeof options.activate == 'function' ) {
61
- options.activate.call( $( this ), href );
62
- }
63
-
64
- $tab.find( href ).fadeIn();
65
- });
66
-
67
- // Active a tab.
68
- if ( options.active ) {
69
- $( options.wrapper ).find( options.title + '[href="' + options.active + '"]' ).click();
70
- } else {
71
- $( options.wrapper ).find( options.title + ':eq(0)' ).click();
72
- }
73
- };
74
-
75
- wpreview.initTabs = function() {
76
- wpreview.tabs({
77
- wrapper: '.js-tabs',
78
- title: '.tab-title',
79
- content: '.tab-content',
80
- activeClass: 'nav-tab-active'
81
- });
82
-
83
- wpreview.tabs({
84
- wrapper: '[data-vertical-tabs]',
85
- activeElement: 'li',
86
- active: $( '#setting-error-settings_updated' ).length && 'undefined' !== typeof Cookies ? Cookies.get( 'wpr-last-vtab' ) : '',
87
- activate: function( tab ) {
88
- if ( 'undefined' === typeof Cookies ) {
89
- return;
90
- }
91
- Cookies.set( 'wpr-last-vtab', tab );
92
- }
93
- });
94
-
95
- wpreview.tabs({
96
- wrapper: '[data-nav-tabs]',
97
- title: '.nav-tab',
98
- content: '.tab-content',
99
- activeClass: 'nav-tab-active',
100
- active: $( '#setting-error-settings_updated' ).length && 'undefined' !== typeof Cookies ? Cookies.get( 'wpr-last-htab' ) : '',
101
- activate: function( tab ) {
102
- if ( ! $( '#wpr-global-options' ).length ) {
103
- return;
104
- }
105
- if ( 'undefined' === typeof Cookies ) {
106
- return;
107
- }
108
- Cookies.set( 'wpr-last-htab', tab );
109
- }
110
- });
111
- };
112
-
113
- wpreview.pluginOptions = function() {
114
-
115
- // Custom comment color.
116
- $( '#wp_review_custom_comment_colors' ).on( 'switch-on', function() {
117
- $('#wp_review_comment_color_wrapper').show();
118
- });
119
- $( '#wp_review_custom_comment_colors' ).on( 'switch-off', function() {
120
- $('#wp_review_comment_color_wrapper').hide();
121
- });
122
- };
123
-
124
- wpreview.pluginMetaBoxes = function() {
125
-
126
- // Custom location.
127
- $( '#wp_review_custom_location' ).on( 'switch-on', function() {
128
- $('.wp-review-location-options').show();
129
- });
130
- $( '#wp_review_custom_location' ).on( 'switch-off', function() {
131
- $('.wp-review-location-options').hide();
132
- });
133
-
134
- // Custom colors.
135
- $( '#wp_review_custom_colors' ).on( 'switch-on', function() {
136
- $('.wp-review-color-options').show();
137
- });
138
- $( '#wp_review_custom_colors' ).on( 'switch-off', function() {
139
- $('.wp-review-color-options').hide();
140
- });
141
-
142
- // Custom width.
143
- $( '#wp_review_custom_width' ).on( 'switch-on', function() {
144
- $('.wp-review-width-options').show();
145
- });
146
- $( '#wp_review_custom_width' ).on( 'switch-off', function() {
147
- $('.wp-review-width-options').hide();
148
- });
149
-
150
- // Custom author.
151
- $( '#wp_review_custom_author' ).on( 'switch-on', function() {
152
- $('.wp-review-author-options').show();
153
- });
154
- $( '#wp_review_custom_author' ).on( 'switch-off', function() {
155
- $('.wp-review-author-options').hide();
156
- });
157
-
158
- // Hide description.
159
- $( '#wp_review_hide_desc' ).on( 'switch-on', function() {
160
- $( '#wp_review_desc_settings' ).fadeOut();
161
- });
162
- $( '#wp_review_hide_desc' ).on( 'switch-off', function() {
163
- $( '#wp_review_desc_settings' ).fadeIn();
164
- });
165
-
166
- // Disable features.
167
- $( '#wp_review_disable_features' ).on( 'switch-on', function() {
168
- $( '#wpr-review-items-app' ).fadeOut();
169
- });
170
- $( '#wp_review_disable_features' ).on( 'switch-off', function() {
171
- $( '#wpr-review-items-app' ).fadeIn();
172
- });
173
-
174
- // User reviews.
175
- $( '#wp-review-userReview-disable' ).on( 'change', function() {
176
- var $postbox = $( this ).closest( '.postbox' );
177
- if ( $(this)[0].checked ) {
178
- $postbox.find( '.show-if-comment, .show-if-visitor, .show-if-both' ).hide();
179
- $postbox.find( '.show-if-disabled' ).show();
180
- }
181
- });
182
- $( '#wp-review-userReview-visitor' ).on( 'change', function() {
183
- var $postbox = $( this ).closest( '.postbox' );
184
- if ( $(this)[0].checked ) {
185
- $postbox.find( '.show-if-comment, .show-if-disabled' ).hide();
186
- $postbox.find( '.show-if-visitor, .show-if-both' ).show();
187
- }
188
- });
189
- $( '#wp-review-userReview-comment' ).on( 'change', function() {
190
- var $postbox = $( this ).closest( '.postbox' );
191
- if ( $(this)[0].checked ) {
192
- $postbox.find( '.show-if-visitor, .show-if-disabled' ).hide();
193
- $postbox.find( '.show-if-comment, .show-if-both' ).show();
194
- }
195
- });
196
- $( '#wp-review-userReview-both' ).on( 'change', function() {
197
- var $postbox = $( this ).closest( '.postbox' );
198
- if ( $(this)[0].checked ) {
199
- $postbox.find( '.show-if-disabled' ).hide();
200
- $postbox.find( '.show-if-comment, .show-if-visitor, .show-if-both' ).show();
201
- }
202
- });
203
-
204
- $( document ).on( 'change', '#wp_review_rating_schema', function() {
205
- var value = $( this ).val();
206
- if ( 'author' === value ) {
207
- $( '#wp_review_schema_author_wrapper' ).show();
208
- } else {
209
- $( '#wp_review_schema_author_wrapper' ).hide();
210
- }
211
- });
212
-
213
- $( document ).on( 'change', '#wp-review-userReview-disable', function() {
214
- if ( $( this ).prop( 'checked' ) ) {
215
- $( '#wp_review_rating_schema' ).val( 'author' ).trigger( 'change' );
216
- }
217
- });
218
-
219
- /**
220
- * Toggle meta box
221
- */
222
- $( '#wp-review-metabox-item' ).hide();
223
- $( '#wp-review-metabox-heading' ).hide();
224
- $( '#wp-review-metabox-desc' ).hide();
225
- $( '#wp-review-metabox-userReview' ).hide();
226
- $( '#wp_review_shortcode_hint_field' ).hide();
227
- $( '#wp_review_id_hint' ).hide();
228
- $( '#wp_review_heading_group' ).hide();
229
- $( '#wp-review-metabox-reviewLinks' ).hide();
230
- $( '#wp_review_schema_options_wrapper' ).hide();
231
- //$( '#wp_review_schema_rating_group' ).hide();
232
-
233
- $( '#wp_review_type' ).on( 'change', function() {
234
- var none = 'none';
235
- var show = false;
236
- var selected_val = $( this ).val();
237
- var type = wprVars.reviewTypes[ wprVars.globalReviewType ];
238
- var $selected_option = $( this ).find( 'option:selected' );
239
- show = selected_val ? selected_val != none : wprVars.globalReviewType;
240
- $( '#wp-review-metabox-item' ).toggle( show );
241
- $( '#wp-review-metabox-heading' ).toggle( show );
242
- $( '#wp-review-metabox-desc' ).toggle( show );
243
- $( '#wp-review-metabox-userReview' ).toggle( show );
244
- $( '#wp_review_id_hint' ).toggle( show );
245
- $( '#wp_review_schema_options_wrapper' ).toggle( show );
246
- $( '#wp-review-metabox-reviewLinks' ).toggle( show );
247
- $( '#wp_review_heading_group' ).toggle( show );
248
- $( '#wp_review_embed_options_wrapper' ).toggle( show );
249
- $( '#wp_review_show_schema_data_wrapper' ).toggle( show );
250
-
251
- if ( $( this ).attr( 'data-changed' ) != 1 ) {
252
- $( this ).attr( 'data-changed', 1 );
253
- return;
254
- }
255
-
256
- if ( ! $( this ).next( 'input[name="wp_review_type"]' ).length ) {
257
- $( this ).after( '<input type="hidden" name="wp_review_type" value="' + selected_val + '">' );
258
- } else {
259
- $( this ).next( 'input[name="wp_review_type"]' ).val( selected_val );
260
- }
261
- }).change();
262
-
263
- };
264
-
265
- wpreview.linkChoices = function( options ) {
266
- var defaults = {
267
- callback: null
268
- };
269
-
270
- options = $.extend( {}, defaults, options );
271
-
272
- $( '.wpr-link-choice' ).on( 'click', function( ev ) {
273
- ev.preventDefault();
274
- var target, value;
275
- target = $( this ).attr( 'data-target' );
276
- value = $( this ).attr( 'data-value' );
277
- if ( ! $( target ).length ) {
278
- return;
279
- }
280
-
281
- $( target ).val( value );
282
- $( this ).closest( '.wpr-link-choices' ).find( '.wpr-link-choice' ).removeClass( 'active' );
283
- $( this ).addClass( 'active' );
284
-
285
- if ( typeof options.callback == 'function' ) {
286
- options.callback.call( $( this ), value );
287
- }
288
- });
289
- };
290
-
291
- wpreview.boxTemplatesSelect = function() {
292
- if ( 'function' !== typeof $.fn.select2 ) {
293
- return;
294
- }
295
-
296
- var $select = $( 'select#wp_review_box_template' ),
297
- globalColor = $( '#wpr-review-global-color-value' ).val(),
298
- globalInactiveColor = $( '#wpr-review-global-inactive-color-value' ).val(),
299
- postColor, postInactiveColor;
300
-
301
- function onSwitchColor( color ) {
302
- $( '.wpr-review-item .input-color' ).each( function() {
303
- var oldVal;
304
- oldVal = $( this ).val();
305
- if ( oldVal === globalColor || oldVal === postColor ) {
306
- $( this ).iris( 'color', color );
307
- }
308
- });
309
- }
310
-
311
- function onSwitchInactiveColor( color ) {
312
- $( '.wpr-review-item .input-inactive-color' ).each( function() {
313
- var oldVal;
314
- oldVal = $( this ).val();
315
- if ( oldVal === globalInactiveColor || oldVal === postInactiveColor ) {
316
- $( this ).iris( 'color', color );
317
- }
318
- });
319
- }
320
-
321
- function onChange( value ) {
322
- var templates = wprVars.boxTemplates,
323
- template = templates[ value ] || templates['default'];
324
-
325
- postColor = $( '#wp_review_color' ).val();
326
- postInactiveColor = $( '#wp_review_inactive_color' ).val();
327
-
328
- // Change image preview.
329
- $( '#wp_review_box_template_img' ).attr( 'src', template.image );
330
-
331
- // Change style options.
332
- $( '#wp_review_color' ).iris( 'color', template.color );
333
- $( '#wp_review_fontcolor' ).iris( 'color', template.fontcolor );
334
- $( '#wp_review_bgcolor1' ).iris( 'color', template.bgcolor1 );
335
- $( '#wp_review_bgcolor2' ).iris( 'color', template.bgcolor2 );
336
- $( '#wp_review_bordercolor' ).iris( 'color', template.bordercolor );
337
- wpreview.turnSwitch( $( '#wp_review_custom_width' ), template.width != 100 );
338
- $( '#wp_review_width' ).val( template.width ).trigger( 'change' );
339
- $( '#wp-review-align-' + template.align ).prop( 'checked', true );
340
- wpreview.turnSwitch( $( '#wp_review_custom_comment_colors' ), template.custom_comment_colors );
341
- $( '#wp_review_comment_color' ).iris( 'color', template.comment_color );
342
- $( '#wp_review_rating_icon' ).val( template.rating_icon ).trigger( 'change' );
343
- $( '#wp_review_inactive_color' ).iris( 'color', template.inactive_color );
344
- $( '#wp_review_comment_inactive_color' ).iris( 'color', template.comment_inactive_color );
345
- $( '#wpr-review-color-value' ).val( template.color );
346
- $( '#wpr-review-inactive-color-value' ).val( template.inactive_color );
347
-
348
- // Feature colors.
349
- onSwitchColor( template.color );
350
- onSwitchInactiveColor( template.inactive_color );
351
- }
352
-
353
- $( '#wp_review_custom_colors' ).on( 'switch-on', function() {
354
- postColor = $( '#wp_review_color' ).val();
355
- postInactiveColor = $( '#wp_review_inactive_color' ).val();
356
-
357
- onSwitchColor( $( '#wp_review_color' ).val() );
358
- onSwitchInactiveColor( $( '#wp_review_inactive_color' ).val() );
359
- });
360
- $( '#wp_review_custom_colors' ).on( 'switch-off', function() {
361
- postColor = $( '#wp_review_color' ).val();
362
- postInactiveColor = $( '#wp_review_inactive_color' ).val();
363
-
364
- onSwitchColor( $( '#wpr-review-global-color-value' ).val() );
365
- onSwitchInactiveColor( $( '#wpr-review-global-inactive-color-value' ).val() );
366
- });
367
-
368
- $( '#wp_review_color' ).on( 'color-change', function( ev, colorEvent, ui ) {
369
- postColor = $( '#wp_review_color' ).val();
370
- onSwitchColor( ui.color.toString() );
371
- });
372
-
373
- $( '#wp_review_inactive_color' ).on( 'color-change', function( ev, colorEvent, ui ) {
374
- postInactiveColor = $( '#wp_review_inactive_color' ).val();
375
- onSwitchInactiveColor( ui.color.toString() );
376
- });
377
-
378
- // Init select2.
379
- $select.select2({
380
- width: '250px',
381
- templateResult: function( option ) {
382
- if ( ! option.element ) {
383
- return option.text;
384
- }
385
- var value = option.element.value,
386
- templates = wprVars.boxTemplates,
387
- template = templates[ value ] || templates['default'];
388
- return $( '<span data-img="' + template.image + '">' + option.text + '</span>' );
389
- }
390
- });
391
-
392
- // On change option.
393
- $select.on( 'change', function( ev ) {
394
- onChange( ev.target.value );
395
- });
396
-
397
- // On hover option.
398
- $( document ).on( 'mouseenter', '#select2-wp_review_box_template-results li', function() {
399
- $( '#wp_review_box_template_preview' ).addClass( 'loading' ).show();
400
- $( '#wp_review_box_template_preview_img' ).attr( 'src', $( this ).find( 'span' ).attr( 'data-img' ) );
401
- $( '#wp_review_box_template_preview_img' ).imagesLoaded().progress( function( instance, image ) {
402
- if ( image.isLoaded ) {
403
- $( '#wp_review_box_template_preview' ).removeClass( 'loading' );
404
- }
405
- });
406
- });
407
-
408
- $select.on( 'select2:close', function() {
409
- $( '#wp_review_box_template_preview' ).hide();
410
- });
411
- };
412
-
413
- wpreview.formSwitchEvents = function() {
414
- $( document ).on( 'change', '.wpr-switch__on', function() {
415
- if ( $( this )[0].checked ) {
416
- $( this ).closest( '.wpr-switch' ).trigger( 'switch-on' );
417
- }
418
- });
419
-
420
- $( document ).on( 'change', '.wpr-switch__off', function() {
421
- if ( $( this )[0].checked ) {
422
- $( this ).closest( '.wpr-switch' ).trigger( 'switch-off' );
423
- }
424
- });
425
- };
426
-
427
- wpreview.turnSwitch = function( $switch, on ) {
428
- if ( on ) {
429
- $switch.find( '.wpr-switch__on' ).prop( 'checked', true ).trigger( 'change' );
430
- } else {
431
- $switch.find( '.wpr-switch__off' ).prop( 'checked', true ).trigger( 'change' );
432
- }
433
- };
434
-
435
- wpreview.importDemo = function() {
436
- $( '#wp-review-import-demo-button' ).on( 'click', function() {
437
- var check = confirm( wprVars.importDemoConfirm ),
438
- $button = $( this );
439
- if ( ! check ) {
440
- return;
441
- }
442
-
443
- $button.prop( 'disabled', true );
444
-
445
- $.magnificPopup.open({
446
- items: {
447
- src: '#wp-review-demo-importer-popup',
448
- type: 'inline'
449
- },
450
- modal: true
451
- });
452
-
453
- $( '#wp-review-demo-importer-modal-footer-button' ).on( 'click', function() {
454
- $.magnificPopup.close();
455
- });
456
-
457
- var data = {
458
- action: 'wp-review-import-demo',
459
- nonce: $button.attr( 'data-nonce' )
460
- };
461
- $.post( ajaxurl, data, function( response ) {
462
- $( '#wp-review-demo-importer-modal-content' ).html( response );
463
- $( '#wp-review-demo-importer-modal-footer-info' ).text( wprVars.importDemoDone );
464
- $( '#wp-review-demo-importer-modal-header h2' ).text( wprVars.importDemoDone );
465
- $( '#wp-review-demo-importer-modal-footer-button' ).show();
466
- $button.prop( 'disabled', false );
467
- });
468
- });
469
- };
470
-
471
- $( document ).ready( function() {
472
- wpreview.initSelect2();
473
- wpreview.initTabs();
474
- wpreview.pluginOptions();
475
- wpreview.pluginMetaBoxes();
476
- wpreview.boxTemplatesSelect();
477
- wpreview.formSwitchEvents();
478
- wpreview.importDemo();
479
-
480
- $( '[data-remove-ratings]' ).on( 'click', function() {
481
- var check = confirm( wprVars.confirmPurgeRatings );
482
- if ( ! check ) {
483
- return;
484
- }
485
-
486
- var $button = $( this ),
487
- options = $button.data(),
488
- btnText = $button.text();
489
-
490
- $button.text( options.processingText );
491
- options.action = 'wpr-purge-ratings';
492
- options.nonce = wprVars.purgeRatingsNonce;
493
-
494
- $.ajax({
495
- url: ajaxurl,
496
- type: 'post',
497
- data: options,
498
- success: function( res ) {
499
- $button.text( res.data );
500
- setTimeout( function() {
501
- $button.text( btnText );
502
- }, 2000 );
503
- },
504
- error: function( res ) {
505
- console.log( res );
506
- }
507
- })
508
- });
509
-
510
- // Fix conflicts with Blogging theme. See https://github.com/MyThemeShopTeam/wp-review-pro/issues/277.
511
- $( document ).off( 'mousewheel', '**' );
512
- $( document ).on( 'DOMMouseScroll mousewheel', '.select2-results', function( ev ) {
513
- if ( $( this ).children( '#select2-wp_review_box_template-results' ).length ) {
514
- return;
515
- }
516
- if ( $( this ).children( '#select2-wp_review_popup_animation_in-results' ).length ) {
517
- return;
518
- }
519
- if ( $( this ).children( '#select2-wp_review_popup_animation_out-results' ).length ) {
520
- return;
521
- }
522
- var $this = $( this ),
523
- scrollTop = this.scrollTop,
524
- scrollHeight = this.scrollHeight,
525
- height = $this.height(),
526
- delta = ev.type == 'DOMMouseScroll' ? ev.originalEvent.detail * -40 : ev.originalEvent.wheelDelta,
527
- up = delta > 0;
528
-
529
- var prevent = function() {
530
- ev.stopPropagation();
531
- ev.preventDefault();
532
- ev.returnValue = false;
533
- return false;
534
- };
535
-
536
- if ( ! up && -delta > scrollHeight - height - scrollTop ) {
537
- // Scrolling down, but this will take us past the bottom.
538
- $this.scrollTop( scrollHeight );
539
- return prevent();
540
- } else if ( up && delta > scrollTop ) {
541
- // Scrolling up, but this will take us past the top.
542
- $this.scrollTop(0);
543
- return prevent();
544
- }
545
- });
546
-
547
- function showProPopup() {
548
- $.magnificPopup.open({
549
- items: {
550
- src: '#wp-review-pro-popup-notice',
551
- type: 'inline'
552
- }
553
- });
554
- }
555
-
556
- $( document ).on( 'click', '#select2-wp_review_box_template-results li[aria-disabled="true"]', function() {
557
- $( '#wp_review_box_template' ).select2( 'close' );
558
- showProPopup();
559
- });
560
-
561
- $( document ).on( 'click', '#select2-wp_review_rating_icon-results li[aria-disabled="true"]', function() {
562
- $( '#wp_review_rating_icon' ).select2( 'close' );
563
- showProPopup();
564
- });
565
-
566
- // Pro feature popup.
567
- $( document ).on( 'click', '.wp-review-disabled, option[disabled]', function( ev ) {
568
- ev.preventDefault();
569
- showProPopup();
570
- });
571
-
572
- $( 'select:not(.select2-hidden-accessible)' ).each( function() {
573
- $( this ).attr( 'data-old-val', $( this ).val() );
574
- });
575
-
576
- $( document ).on( 'change', 'select:not(.select2-hidden-accessible)', function() {
577
- var selectedIndex = $( this ).prop( 'selectedIndex' ),
578
- selectedOption = $( this ).find( 'option:eq(' + selectedIndex + ')' ),
579
- oldVal = $( this ).attr( 'data-old-val' );
580
- if ( selectedOption.hasClass( 'disabled' ) ) {
581
- $( this ).val( oldVal );
582
- showProPopup();
583
- } else {
584
- $( this ).attr( 'data-old-val', $( this ).val() );
585
- }
586
- });
587
-
588
- // Fix conflict with color picker in Avada theme.
589
- if ( $( '.pyre_field.avada-color' ).length ) {
590
- $( '.wp-review-color' ).closest( '.wp-review-field-option' ).addClass( 'pyre_field' );
591
- $( '.input-color, .input-inactive-color' ).closest( '.col-2' ).addClass( 'pyre_field' );
592
- }
593
- });
594
-
595
- $( window ).load( function() {
596
- // WYSIWYG saving issue when using Gutenberg.
597
- if ( $( 'body.block-editor-page' ).length ) {
598
- window.tinyMCE.editors.forEach( function( editor ) {
599
- editor.on( 'change', function() {
600
- editor.save();
601
- });
602
- });
603
- }
604
-
605
- $( '#wp_review_type' ).trigger( 'change' );
606
- });
607
- })( jQuery );
608
-
609
- jQuery(document).ready(function($) {
610
-
611
- /**
612
- * Repeatable field
613
- */
614
- $('.add-row').on('click', function(e) {
615
- e.preventDefault();
616
- var $target = $($(this).data('target'));
617
- var row = $target.find('.empty-row').clone(true);
618
- var input = row.find('input');
619
- if (typeof input.data('name') !== 'undefined' && input.data('name')) input.prop('name', input.data('name'));
620
- input.filter('[name="wp_review_item_star[]"]').addClass('review-star');
621
- row.removeClass('empty-row screen-reader-text');
622
- row.insertBefore($target.find('tbody>tr:last'));
623
- row.find(".focus-on-add").focus();
624
- });
625
-
626
- $('.remove-row').on('click', function(e) {
627
- e.preventDefault();
628
- $(this).closest('tr').remove();
629
- });
630
-
631
- $('#wp-review-metabox-item tbody').sortable({ handle: '.handle', revert: 100, containment: '#wp-review-metabox-item' });
632
- $('#wp-review-metabox-reviewLinks tbody').sortable({ handle: '.handle', revert: 100, containment: '#wp-review-metabox-reviewLinks' });
633
-
634
- // $('#wp-wp_review_desc-wrap').toggle(! $('#wp_review_hide_desc').is(':checked'));
635
- $('#wp_review_location').on('change', function() {
636
- $('#wp_review_shortcode_hint_field').toggle($(this).val() == 'custom');
637
- });
638
-
639
- if ($('#wp_review_location').val() == 'custom') {
640
- $('#wp_review_shortcode_hint_field').show();
641
- }
642
-
643
- $( '#wp-review-width-slider' ).slider({
644
- range: 'min',
645
- value: $( '#wp_review_width' ).val(),
646
- step: 1,
647
- min: 1,
648
- max: 100,
649
- disabled: true
650
- });
651
-
652
- $('.wp-review-userReview-options').change(function(event) {
653
- $('#wp-review-through-comment-option').toggle(!!parseInt($(this).val()));
654
- });
655
-
656
- /**
657
- * Color picker setup
658
- */
659
- $('.wp-review-color').wpColorPicker({
660
- change: function( event, ui ) {
661
- $( event.target ).trigger( 'color-change', [ event, ui ] );
662
- }
663
- });
664
-
665
- $('.wp-review-theme-defaults-msg .close-notice').click(function() {
666
- $('.wp-review-theme-defaults-msg').remove();
667
- });
668
- $('.wp-review-theme-defaults-msg a.button').click(function() {
669
- return confirm('Are you sure? This may override the current settings.');
670
- });
671
-
672
- $('[name=wp_review_userReview]').change(function(e){
673
- var val = $(this).val();
674
- var $type = $('#wp_review_comment_rating_type');
675
- if(wprVars.ratingPermissionsCommentOnly === val || wprVars.ratingPermissionsBoth === val){
676
- $type.show();
677
- } else {
678
- $type.hide();
679
- }
680
- });
681
-
682
- $('td.wp_review_comment_rating, #wp-review-comment-rating').each(function(){
683
- var $features = $(this).find('.wp-review-rating-feature');
684
- var maxWidth = 0;
685
- $features.each(function(){
686
- var width = $(this).outerWidth();
687
- if ( width > maxWidth ) maxWidth = width;
688
- });
689
- $features.width( maxWidth + 10 );
690
- });
691
-
692
- if ($('#wp-review-migrate-log').length) {
693
- var $migrate_log = $('#wp-review-migrate-log');
694
- var migrate_started = false;
695
- var rows_left = parseInt($('#migrate-items-num').text());
696
- var migrated_rows = $('#start-migrate').data('start');
697
- var migrate_finished = false;
698
- var updatelog = function( text ) {
699
- $migrate_log.css('display', 'block').val(function(index, old) { return text + "\n" + old });
700
- }
701
- var ajax_migrate = function( startindex ) {
702
- $.ajax({
703
- url: ajaxurl,
704
- type: 'POST',
705
- dataType: 'json',
706
- data: { action: 'wp_review_migrate_ratings', start: startindex },
707
- })
708
- .done(function( data ) {
709
- $('#migrate-items-num').text(data.rowsleft);
710
- updatelog( 'Imported ratings: ' + (startindex + 1) + ' - ' + data.lastrow + '...' );
711
- if ( ! data.finished )
712
- ajax_migrate( data.lastrow );
713
- else
714
- updatelog('Import complete.');
715
- });
716
-
717
- }
718
- $('#start-migrate').click(function(event) {
719
- event.preventDefault();
720
- if (migrate_started)
721
- return false;
722
-
723
- migrate_started = true;
724
- updatelog('Import started, please wait...');
725
-
726
- ajax_migrate(migrated_rows);
727
- });
728
-
729
- }
730
-
731
- // Image Uploader
732
- wprImageField = {
733
- uploader : function( id ) {
734
- var frame = wp.media({
735
- title : wprVars.imgframe_title,
736
- multiple : false,
737
- frame: 'post',
738
- library : { type : 'image' },
739
- button : { text : wprVars.imgbutton_title }
740
- });
741
-
742
- frame.on( 'insert', function(selection) {
743
-
744
- var state = frame.state();
745
- selection = selection || state.get('selection');
746
- if (! selection) return;
747
- // We set multiple to false so only get one image from the uploader
748
- var attachment = selection.first();
749
- var display = state.display(attachment).toJSON(); // <-- additional properties
750
- attachment = attachment.toJSON();
751
- // Do something with attachment.id and/or attachment.url here
752
- var imgurl = attachment.sizes[display.size].url;
753
- var attachments = frame.state().get( 'selection' ).toJSON();
754
- if ( attachments[0] ) {
755
- $( '#' + id + '-preview' ).html( '<img src="' + imgurl + '" class="wpr_image_upload_img" />' );
756
- $( '#' + id + '-id' ).val( attachments[0].id );
757
- $( '#' + id + '-url' ).val( imgurl );
758
-
759
- if ( $( '#' + id + '-upload+.clear-image' ).length == 0 ) {
760
- $( '#' + id + '-upload' ).after( '<a href="#" class="button button-link clear-image">' + wprVars.imgremove_title + '</a>' );
761
- }
762
- }
763
- });
764
-
765
- frame.open();
766
- return false;
767
- }
768
- };
769
-
770
- $( document ).on( 'click', '.clear-image', function( e ) {
771
- e.preventDefault();
772
- var $this = $( this ),
773
- id = $this.prev().data( 'id' );
774
-
775
- $( '#' + id + '-preview' ).html( '' );
776
- $( '#' + id + '-id' ).val( '' );
777
- $( '#' + id + '-url' ).val( '' );
778
- $this.remove();
779
- });
780
-
781
- $( '.wpr-datepicker' ).datepicker({
782
- dateFormat: 'yy-mm-dd',
783
- });
784
-
785
- if ( typeof wp !== 'undefined' && wp.media && wp.media.editor) {
786
- $(document).on('click', '.wp-review-rating-image .set_rating_image, .wp-review-rating-image .img-wrapper i', function(e) {
787
- e.preventDefault();
788
- var button = $('.wp-review-rating-image .set_rating_image'),
789
- custom_uploader = wp.media({
790
- title: 'Insert image',
791
- library : {
792
- type : 'image'
793
- },
794
- button: {
795
- text: 'Use this image'
796
- },
797
- multiple: false
798
- }).on('select', function() {
799
- var attachment = custom_uploader.state().get('selection').first().toJSON();
800
- $(button).parent().find('.img-wrapper').removeClass('hide').find('img').attr('src', attachment.url);
801
- $(button).removeClass('button').prev().val(attachment.id).next().show();
802
- $(button).hide();
803
- }).open();
804
- });
805
- }
806
-
807
- if($(document).find('#multisite_settings').length > 0) {
808
- $(document).on('change', '#wp-review-select-site', function(){
809
- var site = $(this).val();
810
- $('.wp-review-subsite-wrapper').hide();
811
- $(document).find('#wp-review-site-'+site+'-fields').show();
812
- });
813
-
814
- // Multisite general settings.
815
- $( '.wp-review-multisite-general-settings div.wpr-switch' ).on( 'switch-on', function() {
816
- $('.wp-review-multisite-global-options').fadeOut();
817
- });
818
- $( '.wp-review-multisite-general-settings div.wpr-switch' ).on( 'switch-off', function() {
819
- $('.wp-review-multisite-global-options').fadeIn();
820
- });
821
-
822
- // Multisite post settings.
823
- $( '.wp-review-multisite-posts-options div.wpr-switch' ).on( 'switch-on', function() {
824
- $(this).parents('.wp-review-multisite-posts-options').next('#wp-review-multisite-posts-options').fadeOut();
825
- });
826
- $( '.wp-review-multisite-posts-options div.wpr-switch' ).on( 'switch-off', function() {
827
- $(this).parents('.wp-review-multisite-posts-options').next('#wp-review-multisite-posts-options').fadeIn();
828
- });
829
- }
830
-
831
- });
1
+ /*
2
+ * Plugin Name: WP Review
3
+ * Plugin URI: http://mythemeshop.com/plugins/wp-review/
4
+ * Description: Create reviews! Choose from Stars, Percentages, Circles or Points for review scores. Supports Retina Display, WPMU & Unlimited Color Schemes.
5
+ * Author: MyThemesShop
6
+ * Author URI: http://mythemeshop.com/
7
+ */
8
+ ( function( $ ) {
9
+ "use strict";
10
+
11
+ var wpreview = window.wpreview = window.wpreview || {};
12
+
13
+ wpreview.initSelect2 = function() {
14
+ if ( 'function' !== typeof $.fn.select2 ) {
15
+ return;
16
+ }
17
+
18
+ function addIcon( option ) {
19
+ if ( $( option.element ).attr( 'data-icon' ) ) {
20
+ return $( '<span><i class="' + $( option.element ).attr( 'data-icon' ) + '"></i> ' + option.text + '</span>' );
21
+ }
22
+ return option.text;
23
+ }
24
+
25
+ $( '.js-select2' ).select2({
26
+ templateResult: addIcon,
27
+ templateSelection: addIcon
28
+ });
29
+ };
30
+
31
+ wpreview.tabs = function( options ) {
32
+ var defaults = {
33
+ wrapper: '[data-tabs]',
34
+ title: '[data-tab-title]',
35
+ content: '[data-tab-content]',
36
+ activeElement: '',
37
+ activeClass: 'active',
38
+ active: '',
39
+ activate: null
40
+ };
41
+
42
+ options = $.extend( {}, defaults, options );
43
+
44
+ $( options.wrapper + ' ' + options.title ).on( 'click', function( ev ) {
45
+ ev.preventDefault();
46
+ var href, $tab;
47
+ href = $( this ).attr( 'href' );
48
+ $tab = $( this ).closest( options.wrapper );
49
+
50
+ $tab.find( options.content ).hide();
51
+
52
+ if ( ! options.activeElement || options.activeElement == options.title ) {
53
+ $tab.find( options.title ).removeClass( options.activeClass );
54
+ $( this ).addClass( options.activeClass );
55
+ } else {
56
+ $tab.find( options.activeElement ).removeClass( options.activeClass );
57
+ $( this ).closest( options.activeElement ).addClass( options.activeClass );
58
+ }
59
+
60
+ if ( typeof options.activate == 'function' ) {
61
+ options.activate.call( $( this ), href );
62
+ }
63
+
64
+ $tab.find( href ).fadeIn();
65
+ });
66
+
67
+ // Active a tab.
68
+ if ( options.active ) {
69
+ $( options.wrapper ).find( options.title + '[href="' + options.active + '"]' ).click();
70
+ } else {
71
+ $( options.wrapper ).find( options.title + ':eq(0)' ).click();
72
+ }
73
+ };
74
+
75
+ wpreview.initTabs = function() {
76
+ wpreview.tabs({
77
+ wrapper: '.js-tabs',
78
+ title: '.tab-title',
79
+ content: '.tab-content',
80
+ activeClass: 'nav-tab-active'
81
+ });
82
+
83
+ wpreview.tabs({
84
+ wrapper: '[data-vertical-tabs]',
85
+ activeElement: 'li',
86
+ active: $( '#setting-error-settings_updated' ).length && 'undefined' !== typeof Cookies ? Cookies.get( 'wpr-last-vtab' ) : '',
87
+ activate: function( tab ) {
88
+ if ( 'undefined' === typeof Cookies ) {
89
+ return;
90
+ }
91
+ Cookies.set( 'wpr-last-vtab', tab );
92
+ }
93
+ });
94
+
95
+ wpreview.tabs({
96
+ wrapper: '[data-nav-tabs]',
97
+ title: '.nav-tab',
98
+ content: '.tab-content',
99
+ activeClass: 'nav-tab-active',
100
+ active: $( '#setting-error-settings_updated' ).length && 'undefined' !== typeof Cookies ? Cookies.get( 'wpr-last-htab' ) : '',
101
+ activate: function( tab ) {
102
+ if ( ! $( '#wpr-global-options' ).length ) {
103
+ return;
104
+ }
105
+ if ( 'undefined' === typeof Cookies ) {
106
+ return;
107
+ }
108
+ Cookies.set( 'wpr-last-htab', tab );
109
+ }
110
+ });
111
+ };
112
+
113
+ wpreview.pluginOptions = function() {
114
+
115
+ // Custom comment color.
116
+ $( '#wp_review_custom_comment_colors' ).on( 'switch-on', function() {
117
+ $('#wp_review_comment_color_wrapper').show();
118
+ });
119
+ $( '#wp_review_custom_comment_colors' ).on( 'switch-off', function() {
120
+ $('#wp_review_comment_color_wrapper').hide();
121
+ });
122
+ };
123
+
124
+ wpreview.pluginMetaBoxes = function() {
125
+
126
+ // Custom location.
127
+ $( '#wp_review_custom_location' ).on( 'switch-on', function() {
128
+ $('.wp-review-location-options').show();
129
+ });
130
+ $( '#wp_review_custom_location' ).on( 'switch-off', function() {
131
+ $('.wp-review-location-options').hide();
132
+ });
133
+
134
+ // Custom colors.
135
+ $( '#wp_review_custom_colors' ).on( 'switch-on', function() {
136
+ $('.wp-review-color-options').show();
137
+ });
138
+ $( '#wp_review_custom_colors' ).on( 'switch-off', function() {
139
+ $('.wp-review-color-options').hide();
140
+ });
141
+
142
+ // Custom width.
143
+ $( '#wp_review_custom_width' ).on( 'switch-on', function() {
144
+ $('.wp-review-width-options').show();
145
+ });
146
+ $( '#wp_review_custom_width' ).on( 'switch-off', function() {
147
+ $('.wp-review-width-options').hide();
148
+ });
149
+
150
+ // Custom author.
151
+ $( '#wp_review_custom_author' ).on( 'switch-on', function() {
152
+ $('.wp-review-author-options').show();
153
+ });
154
+ $( '#wp_review_custom_author' ).on( 'switch-off', function() {
155
+ $('.wp-review-author-options').hide();
156
+ });
157
+
158
+ // Hide description.
159
+ $( '#wp_review_hide_desc' ).on( 'switch-on', function() {
160
+ $( '#wp_review_desc_settings' ).fadeOut();
161
+ });
162
+ $( '#wp_review_hide_desc' ).on( 'switch-off', function() {
163
+ $( '#wp_review_desc_settings' ).fadeIn();
164
+ });
165
+
166
+ // Disable features.
167
+ $( '#wp_review_disable_features' ).on( 'switch-on', function() {
168
+ $( '#wpr-review-items-app' ).fadeOut();
169
+ });
170
+ $( '#wp_review_disable_features' ).on( 'switch-off', function() {
171
+ $( '#wpr-review-items-app' ).fadeIn();
172
+ });
173
+
174
+ // User reviews.
175
+ $( '#wp-review-userReview-disable' ).on( 'change', function() {
176
+ var $postbox = $( this ).closest( '.postbox' );
177
+ if ( $(this)[0].checked ) {
178
+ $postbox.find( '.show-if-comment, .show-if-visitor, .show-if-both' ).hide();
179
+ $postbox.find( '.show-if-disabled' ).show();
180
+ }
181
+ });
182
+ $( '#wp-review-userReview-visitor' ).on( 'change', function() {
183
+ var $postbox = $( this ).closest( '.postbox' );
184
+ if ( $(this)[0].checked ) {
185
+ $postbox.find( '.show-if-comment, .show-if-disabled' ).hide();
186
+ $postbox.find( '.show-if-visitor, .show-if-both' ).show();
187
+ }
188
+ });
189
+ $( '#wp-review-userReview-comment' ).on( 'change', function() {
190
+ var $postbox = $( this ).closest( '.postbox' );
191
+ if ( $(this)[0].checked ) {
192
+ $postbox.find( '.show-if-visitor, .show-if-disabled' ).hide();
193
+ $postbox.find( '.show-if-comment, .show-if-both' ).show();
194
+ }
195
+ });
196
+ $( '#wp-review-userReview-both' ).on( 'change', function() {
197
+ var $postbox = $( this ).closest( '.postbox' );
198
+ if ( $(this)[0].checked ) {
199
+ $postbox.find( '.show-if-disabled' ).hide();
200
+ $postbox.find( '.show-if-comment, .show-if-visitor, .show-if-both' ).show();
201
+ }
202
+ });
203
+
204
+ $( document ).on( 'change', '#wp_review_rating_schema', function() {
205
+ var value = $( this ).val();
206
+ if ( 'author' === value ) {
207
+ $( '#wp_review_schema_author_wrapper' ).show();
208
+ } else {
209
+ $( '#wp_review_schema_author_wrapper' ).hide();
210
+ }
211
+ });
212
+
213
+ $( document ).on( 'change', '#wp-review-userReview-disable', function() {
214
+ if ( $( this ).prop( 'checked' ) ) {
215
+ $( '#wp_review_rating_schema' ).val( 'author' ).trigger( 'change' );
216
+ }
217
+ });
218
+
219
+ /**
220
+ * Toggle meta box
221
+ */
222
+ $( '#wp-review-metabox-item' ).hide();
223
+ $( '#wp-review-metabox-heading' ).hide();
224
+ $( '#wp-review-metabox-desc' ).hide();
225
+ $( '#wp-review-metabox-userReview' ).hide();
226
+ $( '#wp_review_shortcode_hint_field' ).hide();
227
+ $( '#wp_review_id_hint' ).hide();
228
+ $( '#wp_review_heading_group' ).hide();
229
+ $( '#wp-review-metabox-reviewLinks' ).hide();
230
+ $( '#wp_review_schema_options_wrapper' ).hide();
231
+ //$( '#wp_review_schema_rating_group' ).hide();
232
+
233
+ $( '#wp_review_type' ).on( 'change', function() {
234
+ var none = 'none';
235
+ var show = false;
236
+ var selected_val = $( this ).val();
237
+ var type = wprVars.reviewTypes[ wprVars.globalReviewType ];
238
+ var $selected_option = $( this ).find( 'option:selected' );
239
+ show = selected_val ? selected_val != none : wprVars.globalReviewType;
240
+ $( '#wp-review-metabox-item' ).toggle( show );
241
+ $( '#wp-review-metabox-heading' ).toggle( show );
242
+ $( '#wp-review-metabox-desc' ).toggle( show );
243
+ $( '#wp-review-metabox-userReview' ).toggle( show );
244
+ $( '#wp_review_id_hint' ).toggle( show );
245
+ $( '#wp_review_schema_options_wrapper' ).toggle( show );
246
+ $( '#wp-review-metabox-reviewLinks' ).toggle( show );
247
+ $( '#wp_review_heading_group' ).toggle( show );
248
+ $( '#wp_review_embed_options_wrapper' ).toggle( show );
249
+ $( '#wp_review_show_schema_data_wrapper' ).toggle( show );
250
+
251
+ if ( $( this ).attr( 'data-changed' ) != 1 ) {
252
+ $( this ).attr( 'data-changed', 1 );
253
+ return;
254
+ }
255
+
256
+ if ( ! $( this ).next( 'input[name="wp_review_type"]' ).length ) {
257
+ $( this ).after( '<input type="hidden" name="wp_review_type" value="' + selected_val + '">' );
258
+ } else {
259
+ $( this ).next( 'input[name="wp_review_type"]' ).val( selected_val );
260
+ }
261
+ }).change();
262
+
263
+ };
264
+
265
+ wpreview.linkChoices = function( options ) {
266
+ var defaults = {
267
+ callback: null
268
+ };
269
+
270
+ options = $.extend( {}, defaults, options );
271
+
272
+ $( '.wpr-link-choice' ).on( 'click', function( ev ) {
273
+ ev.preventDefault();
274
+ var target, value;
275
+ target = $( this ).attr( 'data-target' );
276
+ value = $( this ).attr( 'data-value' );
277
+ if ( ! $( target ).length ) {
278
+ return;
279
+ }
280
+
281
+ $( target ).val( value );
282
+ $( this ).closest( '.wpr-link-choices' ).find( '.wpr-link-choice' ).removeClass( 'active' );
283
+ $( this ).addClass( 'active' );
284
+
285
+ if ( typeof options.callback == 'function' ) {
286
+ options.callback.call( $( this ), value );
287
+ }
288
+ });
289
+ };
290
+
291
+ wpreview.boxTemplatesSelect = function() {
292
+ if ( 'function' !== typeof $.fn.select2 ) {
293
+ return;
294
+ }
295
+
296
+ var $select = $( 'select#wp_review_box_template' ),
297
+ globalColor = $( '#wpr-review-global-color-value' ).val(),
298
+ globalInactiveColor = $( '#wpr-review-global-inactive-color-value' ).val(),
299
+ postColor, postInactiveColor;
300
+
301
+ function onSwitchColor( color ) {
302
+ $( '.wpr-review-item .input-color' ).each( function() {
303
+ var oldVal;
304
+ oldVal = $( this ).val();
305
+ if ( oldVal === globalColor || oldVal === postColor ) {
306
+ $( this ).iris( 'color', color );
307
+ }
308
+ });
309
+ }
310
+
311
+ function onSwitchInactiveColor( color ) {
312
+ $( '.wpr-review-item .input-inactive-color' ).each( function() {
313
+ var oldVal;
314
+ oldVal = $( this ).val();
315
+ if ( oldVal === globalInactiveColor || oldVal === postInactiveColor ) {
316
+ $( this ).iris( 'color', color );
317
+ }
318
+ });
319
+ }
320
+
321
+ function onChange( value ) {
322
+ var templates = wprVars.boxTemplates,
323
+ template = templates[ value ] || templates['default'];
324
+
325
+ postColor = $( '#wp_review_color' ).val();
326
+ postInactiveColor = $( '#wp_review_inactive_color' ).val();
327
+
328
+ // Change image preview.
329
+ $( '#wp_review_box_template_img' ).attr( 'src', template.image );
330
+
331
+ // Change style options.
332
+ $( '#wp_review_color' ).iris( 'color', template.color );
333
+ $( '#wp_review_fontcolor' ).iris( 'color', template.fontcolor );
334
+ $( '#wp_review_bgcolor1' ).iris( 'color', template.bgcolor1 );
335
+ $( '#wp_review_bgcolor2' ).iris( 'color', template.bgcolor2 );
336
+ $( '#wp_review_bordercolor' ).iris( 'color', template.bordercolor );
337
+ wpreview.turnSwitch( $( '#wp_review_custom_width' ), template.width != 100 );
338
+ $( '#wp_review_width' ).val( template.width ).trigger( 'change' );
339
+ $( '#wp-review-align-' + template.align ).prop( 'checked', true );
340
+ wpreview.turnSwitch( $( '#wp_review_custom_comment_colors' ), template.custom_comment_colors );
341
+ $( '#wp_review_comment_color' ).iris( 'color', template.comment_color );
342
+ $( '#wp_review_rating_icon' ).val( template.rating_icon ).trigger( 'change' );
343
+ $( '#wp_review_inactive_color' ).iris( 'color', template.inactive_color );
344
+ $( '#wp_review_comment_inactive_color' ).iris( 'color', template.comment_inactive_color );
345
+ $( '#wpr-review-color-value' ).val( template.color );
346
+ $( '#wpr-review-inactive-color-value' ).val( template.inactive_color );
347
+
348
+ // Feature colors.
349
+ onSwitchColor( template.color );
350
+ onSwitchInactiveColor( template.inactive_color );
351
+ }
352
+
353
+ $( '#wp_review_custom_colors' ).on( 'switch-on', function() {
354
+ postColor = $( '#wp_review_color' ).val();
355
+ postInactiveColor = $( '#wp_review_inactive_color' ).val();
356
+
357
+ onSwitchColor( $( '#wp_review_color' ).val() );
358
+ onSwitchInactiveColor( $( '#wp_review_inactive_color' ).val() );
359
+ });
360
+ $( '#wp_review_custom_colors' ).on( 'switch-off', function() {
361
+ postColor = $( '#wp_review_color' ).val();
362
+ postInactiveColor = $( '#wp_review_inactive_color' ).val();
363
+
364
+ onSwitchColor( $( '#wpr-review-global-color-value' ).val() );
365
+ onSwitchInactiveColor( $( '#wpr-review-global-inactive-color-value' ).val() );
366
+ });
367
+
368
+ $( '#wp_review_color' ).on( 'color-change', function( ev, colorEvent, ui ) {
369
+ postColor = $( '#wp_review_color' ).val();
370
+ onSwitchColor( ui.color.toString() );
371
+ });
372
+
373
+ $( '#wp_review_inactive_color' ).on( 'color-change', function( ev, colorEvent, ui ) {
374
+ postInactiveColor = $( '#wp_review_inactive_color' ).val();
375
+ onSwitchInactiveColor( ui.color.toString() );
376
+ });
377
+
378
+ // Init select2.
379
+ $select.select2({
380
+ width: '250px',
381
+ templateResult: function( option ) {
382
+ if ( ! option.element ) {
383
+ return option.text;
384
+ }
385
+ var value = option.element.value,
386
+ templates = wprVars.boxTemplates,
387
+ template = templates[ value ] || templates['default'];
388
+ return $( '<span data-img="' + template.image + '">' + option.text + '</span>' );
389
+ }
390
+ });
391
+
392
+ // On change option.
393
+ $select.on( 'change', function( ev ) {
394
+ onChange( ev.target.value );
395
+ });
396
+
397
+ // On hover option.
398
+ $( document ).on( 'mouseenter', '#select2-wp_review_box_template-results li', function() {
399
+ $( '#wp_review_box_template_preview' ).addClass( 'loading' ).show();
400
+ $( '#wp_review_box_template_preview_img' ).attr( 'src', $( this ).find( 'span' ).attr( 'data-img' ) );
401
+ $( '#wp_review_box_template_preview_img' ).imagesLoaded().progress( function( instance, image ) {
402
+ if ( image.isLoaded ) {
403
+ $( '#wp_review_box_template_preview' ).removeClass( 'loading' );
404
+ }
405
+ });
406
+ });
407
+
408
+ $select.on( 'select2:close', function() {
409
+ $( '#wp_review_box_template_preview' ).hide();
410
+ });
411
+ };
412
+
413
+ wpreview.formSwitchEvents = function() {
414
+ $( document ).on( 'change', '.wpr-switch__on', function() {
415
+ if ( $( this )[0].checked ) {
416
+ $( this ).closest( '.wpr-switch' ).trigger( 'switch-on' );
417
+ }
418
+ });
419
+
420
+ $( document ).on( 'change', '.wpr-switch__off', function() {
421
+ if ( $( this )[0].checked ) {
422
+ $( this ).closest( '.wpr-switch' ).trigger( 'switch-off' );
423
+ }
424
+ });
425
+ };
426
+
427
+ wpreview.turnSwitch = function( $switch, on ) {
428
+ if ( on ) {
429
+ $switch.find( '.wpr-switch__on' ).prop( 'checked', true ).trigger( 'change' );
430
+ } else {
431
+ $switch.find( '.wpr-switch__off' ).prop( 'checked', true ).trigger( 'change' );
432
+ }
433
+ };
434
+
435
+ wpreview.importDemo = function() {
436
+ $( '#wp-review-import-demo-button' ).on( 'click', function() {
437
+ var check = confirm( wprVars.importDemoConfirm ),
438
+ $button = $( this );
439
+ if ( ! check ) {
440
+ return;
441
+ }
442
+
443
+ $button.prop( 'disabled', true );
444
+
445
+ $.magnificPopup.open({
446
+ items: {
447
+ src: '#wp-review-demo-importer-popup',
448
+ type: 'inline'
449
+ },
450
+ modal: true
451
+ });
452
+
453
+ $( '#wp-review-demo-importer-modal-footer-button' ).on( 'click', function() {
454
+ $.magnificPopup.close();
455
+ });
456
+
457
+ var data = {
458
+ action: 'wp-review-import-demo',
459
+ nonce: $button.attr( 'data-nonce' )
460
+ };
461
+ $.post( ajaxurl, data, function( response ) {
462
+ $( '#wp-review-demo-importer-modal-content' ).html( response );
463
+ $( '#wp-review-demo-importer-modal-footer-info' ).text( wprVars.importDemoDone );
464
+ $( '#wp-review-demo-importer-modal-header h2' ).text( wprVars.importDemoDone );
465
+ $( '#wp-review-demo-importer-modal-footer-button' ).show();
466
+ $button.prop( 'disabled', false );
467
+ });
468
+ });
469
+ };
470
+
471
+ $( document ).ready( function() {
472
+ wpreview.initSelect2();
473
+ wpreview.initTabs();
474
+ wpreview.pluginOptions();
475
+ wpreview.pluginMetaBoxes();
476
+ wpreview.boxTemplatesSelect();
477
+ wpreview.formSwitchEvents();
478
+ wpreview.importDemo();
479
+
480
+ $( '[data-remove-ratings]' ).on( 'click', function() {
481
+ var check = confirm( wprVars.confirmPurgeRatings );
482
+ if ( ! check ) {
483
+ return;
484
+ }
485
+
486
+ var $button = $( this ),
487
+ options = $button.data(),
488
+ btnText = $button.text();
489
+
490
+ $button.text( options.processingText );
491
+ options.action = 'wpr-purge-ratings';
492
+ options.nonce = wprVars.purgeRatingsNonce;
493
+
494
+ $.ajax({
495
+ url: ajaxurl,
496
+ type: 'post',
497
+ data: options,
498
+ success: function( res ) {
499
+ $button.text( res.data );
500
+ setTimeout( function() {
501
+ $button.text( btnText );
502
+ }, 2000 );
503
+ },
504
+ error: function( res ) {
505
+ console.log( res );
506
+ }
507
+ })
508
+ });
509
+
510
+ // Fix conflicts with Blogging theme. See https://github.com/MyThemeShopTeam/wp-review-pro/issues/277.
511
+ $( document ).off( 'mousewheel', '**' );
512
+ $( document ).on( 'DOMMouseScroll mousewheel', '.select2-results', function( ev ) {
513
+ if ( $( this ).children( '#select2-wp_review_box_template-results' ).length ) {
514
+ return;
515
+ }
516
+ if ( $( this ).children( '#select2-wp_review_popup_animation_in-results' ).length ) {
517
+ return;
518
+ }
519
+ if ( $( this ).children( '#select2-wp_review_popup_animation_out-results' ).length ) {
520
+ return;
521
+ }
522
+ var $this = $( this ),
523
+ scrollTop = this.scrollTop,
524
+ scrollHeight = this.scrollHeight,
525
+ height = $this.height(),
526
+ delta = ev.type == 'DOMMouseScroll' ? ev.originalEvent.detail * -40 : ev.originalEvent.wheelDelta,
527
+ up = delta > 0;
528
+
529
+ var prevent = function() {
530
+ ev.stopPropagation();
531
+ ev.preventDefault();
532
+ ev.returnValue = false;
533
+ return false;
534
+ };
535
+
536
+ if ( ! up && -delta > scrollHeight - height - scrollTop ) {
537
+ // Scrolling down, but this will take us past the bottom.
538
+ $this.scrollTop( scrollHeight );
539
+ return prevent();
540
+ } else if ( up && delta > scrollTop ) {
541
+ // Scrolling up, but this will take us past the top.
542
+ $this.scrollTop(0);
543
+ return prevent();
544
+ }
545
+ });
546
+
547
+ function showProPopup() {
548
+ $.magnificPopup.open({
549
+ items: {
550
+ src: '#wp-review-pro-popup-notice',
551
+ type: 'inline'
552
+ }
553
+ });
554
+ }
555
+
556
+ $( document ).on( 'click', '#select2-wp_review_box_template-results li[aria-disabled="true"]', function() {
557
+ $( '#wp_review_box_template' ).select2( 'close' );
558
+ showProPopup();
559
+ });
560
+
561
+ $( document ).on( 'click', '#select2-wp_review_rating_icon-results li[aria-disabled="true"]', function() {
562
+ $( '#wp_review_rating_icon' ).select2( 'close' );
563
+ showProPopup();
564
+ });
565
+
566
+ // Pro feature popup.
567
+ $( document ).on( 'click', '.wp-review-disabled, option[disabled]', function( ev ) {
568
+ ev.preventDefault();
569
+ showProPopup();
570
+ });
571
+
572
+ $( 'select:not(.select2-hidden-accessible)' ).each( function() {
573
+ $( this ).attr( 'data-old-val', $( this ).val() );
574
+ });
575
+
576
+ $( document ).on( 'change', 'select:not(.select2-hidden-accessible)', function() {
577
+ var selectedIndex = $( this ).prop( 'selectedIndex' ),
578
+ selectedOption = $( this ).find( 'option:eq(' + selectedIndex + ')' ),
579
+ oldVal = $( this ).attr( 'data-old-val' );
580
+ if ( selectedOption.hasClass( 'disabled' ) ) {
581
+ $( this ).val( oldVal );
582
+ showProPopup();
583
+ } else {
584
+ $( this ).attr( 'data-old-val', $( this ).val() );
585
+ }
586
+ });
587
+
588
+ // Fix conflict with color picker in Avada theme.
589
+ if ( $( '.pyre_field.avada-color' ).length ) {
590
+ $( '.wp-review-color' ).closest( '.wp-review-field-option' ).addClass( 'pyre_field' );
591
+ $( '.input-color, .input-inactive-color' ).closest( '.col-2' ).addClass( 'pyre_field' );
592
+ }
593
+ });
594
+
595
+ $( window ).load( function() {
596
+ // WYSIWYG saving issue when using Gutenberg.
597
+ if ( $( 'body.block-editor-page' ).length ) {
598
+ window.tinyMCE.editors.forEach( function( editor ) {
599
+ editor.on( 'change', function() {
600
+ editor.save();
601
+ });
602
+ });
603
+ }
604
+
605
+ $( '#wp_review_type' ).trigger( 'change' );
606
+ });
607
+ })( jQuery );
608
+
609
+ jQuery(document).ready(function($) {
610
+
611
+ /**
612
+ * Repeatable field
613
+ */
614
+ $('.add-row').on('click', function(e) {
615
+ e.preventDefault();
616
+ var $target = $($(this).data('target'));
617
+ var row = $target.find('.empty-row').clone(true);
618
+ var input = row.find('input');
619
+ if (typeof input.data('name') !== 'undefined' && input.data('name')) input.prop('name', input.data('name'));
620
+ input.filter('[name="wp_review_item_star[]"]').addClass('review-star');
621
+ row.removeClass('empty-row screen-reader-text');
622
+ row.insertBefore($target.find('tbody>tr:last'));
623
+ row.find(".focus-on-add").focus();
624
+ });
625
+
626
+ $('.remove-row').on('click', function(e) {
627
+ e.preventDefault();
628
+ $(this).closest('tr').remove();
629
+ });
630
+
631
+ $('#wp-review-metabox-item tbody').sortable({ handle: '.handle', revert: 100, containment: '#wp-review-metabox-item' });
632
+ $('#wp-review-metabox-reviewLinks tbody').sortable({ handle: '.handle', revert: 100, containment: '#wp-review-metabox-reviewLinks' });
633
+
634
+ // $('#wp-wp_review_desc-wrap').toggle(! $('#wp_review_hide_desc').is(':checked'));
635
+ $('#wp_review_location').on('change', function() {
636
+ $('#wp_review_shortcode_hint_field').toggle($(this).val() == 'custom');
637
+ });
638
+
639
+ if ($('#wp_review_location').val() == 'custom') {
640
+ $('#wp_review_shortcode_hint_field').show();
641
+ }
642
+
643
+ $( '#wp-review-width-slider' ).slider({
644
+ range: 'min',
645
+ value: $( '#wp_review_width' ).val(),
646
+ step: 1,
647
+ min: 1,
648
+ max: 100,
649
+ disabled: true
650
+ });
651
+
652
+ $('.wp-review-userReview-options').change(function(event) {
653
+ $('#wp-review-through-comment-option').toggle(!!parseInt($(this).val()));
654
+ });
655
+
656
+ /**
657
+ * Color picker setup
658
+ */
659
+ $('.wp-review-color').wpColorPicker({
660
+ change: function( event, ui ) {
661
+ $( event.target ).trigger( 'color-change', [ event, ui ] );
662
+ }
663
+ });
664
+
665
+ $('.wp-review-theme-defaults-msg .close-notice').click(function() {
666
+ $('.wp-review-theme-defaults-msg').remove();
667
+ });
668
+ $('.wp-review-theme-defaults-msg a.button').click(function() {
669
+ return confirm('Are you sure? This may override the current settings.');
670
+ });
671
+
672
+ $('[name=wp_review_userReview]').change(function(e){
673
+ var val = $(this).val();
674
+ var $type = $('#wp_review_comment_rating_type');
675
+ if(wprVars.ratingPermissionsCommentOnly === val || wprVars.ratingPermissionsBoth === val){
676
+ $type.show();
677
+ } else {
678
+ $type.hide();
679
+ }
680
+ });
681
+
682
+ $('td.wp_review_comment_rating, #wp-review-comment-rating').each(function(){
683
+ var $features = $(this).find('.wp-review-rating-feature');
684
+ var maxWidth = 0;
685
+ $features.each(function(){
686
+ var width = $(this).outerWidth();
687
+ if ( width > maxWidth ) maxWidth = width;
688
+ });
689
+ $features.width( maxWidth + 10 );
690
+ });
691
+
692
+ if ($('#wp-review-migrate-log').length) {
693
+ var $migrate_log = $('#wp-review-migrate-log');
694
+ var migrate_started = false;
695
+ var rows_left = parseInt($('#migrate-items-num').text());
696
+ var migrated_rows = $('#start-migrate').data('start');
697
+ var migrate_finished = false;
698
+ var updatelog = function( text ) {
699
+ $migrate_log.css('display', 'block').val(function(index, old) { return text + "\n" + old });
700
+ }
701
+ var ajax_migrate = function( startindex ) {
702
+ $.ajax({
703
+ url: ajaxurl,
704
+ type: 'POST',
705
+ dataType: 'json',
706
+ data: { action: 'wp_review_migrate_ratings', start: startindex },
707
+ })
708
+ .done(function( data ) {
709
+ $('#migrate-items-num').text(data.rowsleft);
710
+ updatelog( 'Imported ratings: ' + (startindex + 1) + ' - ' + data.lastrow + '...' );
711
+ if ( ! data.finished )
712
+ ajax_migrate( data.lastrow );
713
+ else
714
+ updatelog('Import complete.');
715
+ });
716
+
717
+ }
718
+ $('#start-migrate').click(function(event) {
719
+ event.preventDefault();
720
+ if (migrate_started)
721
+ return false;
722
+
723
+ migrate_started = true;
724
+ updatelog('Import started, please wait...');
725
+
726
+ ajax_migrate(migrated_rows);
727
+ });
728
+
729
+ }
730
+
731
+ // Image Uploader
732
+ wprImageField = {
733
+ uploader : function( id ) {
734
+ var frame = wp.media({
735
+ title : wprVars.imgframe_title,
736
+ multiple : false,
737
+ frame: 'post',
738
+ library : { type : 'image' },
739
+ button : { text : wprVars.imgbutton_title }
740
+ });
741
+
742
+ frame.on( 'insert', function(selection) {
743
+
744
+ var state = frame.state();
745
+ selection = selection || state.get('selection');
746
+ if (! selection) return;
747
+ // We set multiple to false so only get one image from the uploader
748
+ var attachment = selection.first();
749
+ var display = state.display(attachment).toJSON(); // <-- additional properties
750
+ attachment = attachment.toJSON();
751
+ // Do something with attachment.id and/or attachment.url here
752
+ var imgurl = attachment.sizes[display.size].url;
753
+ var attachments = frame.state().get( 'selection' ).toJSON();
754
+ if ( attachments[0] ) {
755
+ $( '#' + id + '-preview' ).html( '<img src="' + imgurl + '" class="wpr_image_upload_img" />' );
756
+ $( '#' + id + '-id' ).val( attachments[0].id );
757
+ $( '#' + id + '-url' ).val( imgurl );
758
+
759
+ if ( $( '#' + id + '-upload+.clear-image' ).length == 0 ) {
760
+ $( '#' + id + '-upload' ).after( '<a href="#" class="button button-link clear-image">' + wprVars.imgremove_title + '</a>' );
761
+ }
762
+ }
763
+ });
764
+
765
+ frame.open();
766
+ return false;
767
+ }
768
+ };
769
+
770
+ $( document ).on( 'click', '.clear-image', function( e ) {
771
+ e.preventDefault();
772
+ var $this = $( this ),
773
+ id = $this.prev().data( 'id' );
774
+
775
+ $( '#' + id + '-preview' ).html( '' );
776
+ $( '#' + id + '-id' ).val( '' );
777
+ $( '#' + id + '-url' ).val( '' );
778
+ $this.remove();
779
+ });
780
+
781
+ $( '.wpr-datepicker' ).datepicker({
782
+ dateFormat: 'yy-mm-dd',
783
+ });
784
+
785
+ if ( typeof wp !== 'undefined' && wp.media && wp.media.editor) {
786
+ $(document).on('click', '.wp-review-rating-image .set_rating_image, .wp-review-rating-image .img-wrapper i', function(e) {
787
+ e.preventDefault();
788
+ var button = $('.wp-review-rating-image .set_rating_image'),
789
+ custom_uploader = wp.media({
790
+ title: 'Insert image',
791
+ library : {
792
+ type : 'image'
793
+ },
794
+ button: {
795
+ text: 'Use this image'
796
+ },
797
+ multiple: false
798
+ }).on('select', function() {
799
+ var attachment = custom_uploader.state().get('selection').first().toJSON();
800
+ $(button).parent().find('.img-wrapper').removeClass('hide').find('img').attr('src', attachment.url);
801
+ $(button).removeClass('button').prev().val(attachment.id).next().show();
802
+ $(button).hide();
803
+ }).open();
804
+ });
805
+ }
806
+
807
+ if($(document).find('#multisite_settings').length > 0) {
808
+ $(document).on('change', '#wp-review-select-site', function(){
809
+ var site = $(this).val();
810
+ $('.wp-review-subsite-wrapper').hide();
811
+ $(document).find('#wp-review-site-'+site+'-fields').show();
812
+ });
813
+
814
+ // Multisite general settings.
815
+ $( '.wp-review-multisite-general-settings div.wpr-switch' ).on( 'switch-on', function() {
816
+ $('.wp-review-multisite-global-options').fadeOut();
817
+ });
818
+ $( '.wp-review-multisite-general-settings div.wpr-switch' ).on( 'switch-off', function() {
819
+ $('.wp-review-multisite-global-options').fadeIn();
820
+ });
821
+
822
+ // Multisite post settings.
823
+ $( '.wp-review-multisite-posts-options div.wpr-switch' ).on( 'switch-on', function() {
824
+ $(this).parents('.wp-review-multisite-posts-options').next('#wp-review-multisite-posts-options').fadeOut();
825
+ });
826
+ $( '.wp-review-multisite-posts-options div.wpr-switch' ).on( 'switch-off', function() {
827
+ $(this).parents('.wp-review-multisite-posts-options').next('#wp-review-multisite-posts-options').fadeIn();
828
+ });
829
+ }
830
+
831
+ });
admin/assets/js/editor-plugin.js CHANGED
@@ -1,195 +1,195 @@
1
- ( function( tinymce, wpreview, $ ) {
2
- "use strict";
3
-
4
- var getShortcode = function( name, attrs ) {
5
- var output = '[' + name;
6
- for ( var k in attrs ) {
7
- if ( ! attrs[ k ] ) {
8
- continue;
9
- }
10
- output += ' ' + k + '="' + attrs[ k ] + '"';
11
- }
12
- output += ']';
13
- return output;
14
- };
15
-
16
- function getWPReviewButton( editor ) {
17
- return {
18
- text: wprVars.reviewBox,
19
- onclick: function() {
20
- var dialog = editor.windowManager.open({
21
- title: wprVars.reviewBox,
22
- body: [
23
- {
24
- type: 'textbox',
25
- name: 'id',
26
- label: wprVars.reviewId,
27
- tooltip: wprVars.leaveReviewIdEmpty
28
- }
29
- ],
30
- buttons: [
31
- {
32
- id: 'wpr-insert-shortcode',
33
- classes: 'widget btn primary first abs-layout-item',
34
- text: wprVars.insert,
35
- onclick: function() {
36
- dialog.submit();
37
- }
38
- },
39
- {
40
- id: 'wpr-cancel-shortcode',
41
- text: wprVars.cancel,
42
- onclick: function() {
43
- dialog.close();
44
- }
45
- }
46
- ],
47
- onsubmit: function( e ) {
48
- var name = 'wp-review',
49
- attrs = e.data;
50
-
51
- editor.insertContent( getShortcode( name, attrs ) );
52
- }
53
- });
54
- }
55
- };
56
- }
57
-
58
- function getReviewTotalButton( editor ) {
59
- return {
60
- text: wprVars.reviewTotal,
61
- onclick: function() {
62
- var dialog = editor.windowManager.open({
63
- title: wprVars.reviewTotal,
64
- body: [
65
- {
66
- type: 'textbox',
67
- name: 'id',
68
- label: wprVars.reviewId,
69
- tooltip: wprVars.leaveReviewIdEmpty
70
- }
71
- ],
72
- buttons: [
73
- {
74
- id: 'wpr-insert-shortcode',
75
- classes: 'widget btn primary first abs-layout-item',
76
- text: wprVars.insert,
77
- onclick: function() {
78
- dialog.submit();
79
- }
80
- },
81
- {
82
- id: 'wpr-cancel-shortcode',
83
- text: wprVars.cancel,
84
- onclick: function() {
85
- dialog.close();
86
- }
87
- }
88
- ],
89
- onsubmit: function( e ) {
90
- var name = 'wp-review-total',
91
- attrs = e.data;
92
-
93
- editor.insertContent( getShortcode( name, attrs ) );
94
- }
95
- });
96
- }
97
- };
98
- }
99
-
100
- function getVisitorRatingButton( editor ) {
101
- return {
102
- text: wprVars.visitorRating,
103
- onclick: function() {
104
- var dialog = editor.windowManager.open({
105
- title: wprVars.visitorRating,
106
- body: [
107
- {
108
- type: 'textbox',
109
- name: 'id',
110
- label: wprVars.reviewId,
111
- tooltip: wprVars.leaveReviewIdEmpty
112
- }
113
- ],
114
- buttons: [
115
- {
116
- id: 'wpr-insert-shortcode',
117
- classes: 'widget btn primary first abs-layout-item',
118
- text: wprVars.insert,
119
- onclick: function() {
120
- dialog.submit();
121
- }
122
- },
123
- {
124
- id: 'wpr-cancel-shortcode',
125
- text: wprVars.cancel,
126
- onclick: function() {
127
- dialog.close();
128
- }
129
- }
130
- ],
131
- onsubmit: function( e ) {
132
- var name = 'wp-review-visitor-rating',
133
- attrs = e.data;
134
-
135
- editor.insertContent( getShortcode( name, attrs ) );
136
- }
137
- });
138
- }
139
- };
140
- }
141
-
142
- tinymce.create( 'tinymce.plugins.WPReviewPro', {
143
- /**
144
- * Initializes the plugin, this will be executed after the plugin has been created.
145
- * This call is done before the editor instance has finished it's initialization so use the onInit event
146
- * of the editor instance to intercept that event.
147
- *
148
- * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
149
- * @param {string} url Absolute URL to where the plugin is located.
150
- */
151
- init : function( ed, url ) {
152
- ed.addButton( 'wpreviewpro', {
153
- type: 'menubutton',
154
- icon: 'dashicons dashicons-before dashicons-star-filled',
155
- menu: [
156
- getWPReviewButton( ed ),
157
- getReviewTotalButton( ed ),
158
- getVisitorRatingButton( ed )
159
- ]
160
- });
161
- },
162
-
163
- /**
164
- * Creates control instances based in the incomming name. This method is normally not
165
- * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
166
- * but you sometimes need to create more complex controls like listboxes, split buttons etc then this
167
- * method can be used to create those.
168
- *
169
- * @param {String} n Name of the control to create.
170
- * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
171
- * @return {tinymce.ui.Control} New control instance or null if no control was created.
172
- */
173
- createControl : function(n, cm) {
174
- return null;
175
- },
176
-
177
- /**
178
- * Returns information about the plugin as a name/value array.
179
- * The current keys are longname, author, authorurl, infourl and version.
180
- *
181
- * @return {Object} Name/value array containing information about the plugin.
182
- */
183
- getInfo : function() {
184
- return {
185
- longname : 'WP Review Buttons',
186
- author : 'MTS',
187
- authorurl : 'https://mythemeshop.com',
188
- version : '3.0.0'
189
- };
190
- }
191
- });
192
-
193
- // Register plugin
194
- tinymce.PluginManager.add( 'wp_review', tinymce.plugins.WPReviewPro );
195
- })( tinymce, wpreview, jQuery );
1
+ ( function( tinymce, wpreview, $ ) {
2
+ "use strict";
3
+
4
+ var getShortcode = function( name, attrs ) {
5
+ var output = '[' + name;
6
+ for ( var k in attrs ) {
7
+ if ( ! attrs[ k ] ) {
8
+ continue;
9
+ }
10
+ output += ' ' + k + '="' + attrs[ k ] + '"';
11
+ }
12
+ output += ']';
13
+ return output;
14
+ };
15
+
16
+ function getWPReviewButton( editor ) {
17
+ return {
18
+ text: wprVars.reviewBox,
19
+ onclick: function() {
20
+ var dialog = editor.windowManager.open({
21
+ title: wprVars.reviewBox,
22
+ body: [
23
+ {
24
+ type: 'textbox',
25
+ name: 'id',
26
+ label: wprVars.reviewId,
27
+ tooltip: wprVars.leaveReviewIdEmpty
28
+ }
29
+ ],
30
+ buttons: [
31
+ {
32
+ id: 'wpr-insert-shortcode',
33
+ classes: 'widget btn primary first abs-layout-item',
34
+ text: wprVars.insert,
35
+ onclick: function() {
36
+ dialog.submit();
37
+ }
38
+ },
39
+ {
40
+ id: 'wpr-cancel-shortcode',
41
+ text: wprVars.cancel,
42
+ onclick: function() {
43
+ dialog.close();
44
+ }
45
+ }
46
+ ],
47
+ onsubmit: function( e ) {
48
+ var name = 'wp-review',
49
+ attrs = e.data;
50
+
51
+ editor.insertContent( getShortcode( name, attrs ) );
52
+ }
53
+ });
54
+ }
55
+ };
56
+ }
57
+
58
+ function getReviewTotalButton( editor ) {
59
+ return {
60
+ text: wprVars.reviewTotal,
61
+ onclick: function() {
62
+ var dialog = editor.windowManager.open({
63
+ title: wprVars.reviewTotal,
64
+ body: [
65
+ {
66
+ type: 'textbox',
67
+ name: 'id',
68
+ label: wprVars.reviewId,
69
+ tooltip: wprVars.leaveReviewIdEmpty
70
+ }
71
+ ],
72
+ buttons: [
73
+ {
74
+ id: 'wpr-insert-shortcode',
75
+ classes: 'widget btn primary first abs-layout-item',
76
+ text: wprVars.insert,
77
+ onclick: function() {
78
+ dialog.submit();
79
+ }
80
+ },
81
+ {
82
+ id: 'wpr-cancel-shortcode',
83
+ text: wprVars.cancel,
84
+ onclick: function() {
85
+ dialog.close();
86
+ }
87
+ }
88
+ ],
89
+ onsubmit: function( e ) {
90
+ var name = 'wp-review-total',
91
+ attrs = e.data;
92
+
93
+ editor.insertContent( getShortcode( name, attrs ) );
94
+ }
95
+ });
96
+ }
97
+ };
98
+ }
99
+
100
+ function getVisitorRatingButton( editor ) {
101
+ return {
102
+ text: wprVars.visitorRating,
103
+ onclick: function() {
104
+ var dialog = editor.windowManager.open({
105
+ title: wprVars.visitorRating,
106
+ body: [
107
+ {
108
+ type: 'textbox',
109
+ name: 'id',
110
+ label: wprVars.reviewId,
111
+ tooltip: wprVars.leaveReviewIdEmpty
112
+ }
113
+ ],
114
+ buttons: [
115
+ {
116
+ id: 'wpr-insert-shortcode',
117
+ classes: 'widget btn primary first abs-layout-item',
118
+ text: wprVars.insert,
119
+ onclick: function() {
120
+ dialog.submit();
121
+ }
122
+ },
123
+ {
124
+ id: 'wpr-cancel-shortcode',
125
+ text: wprVars.cancel,
126
+ onclick: function() {
127
+ dialog.close();
128
+ }
129
+ }
130
+ ],
131
+ onsubmit: function( e ) {
132
+ var name = 'wp-review-visitor-rating',
133
+ attrs = e.data;
134
+
135
+ editor.insertContent( getShortcode( name, attrs ) );
136
+ }
137
+ });
138
+ }
139
+ };
140
+ }
141
+
142
+ tinymce.create( 'tinymce.plugins.WPReviewPro', {
143
+ /**
144
+ * Initializes the plugin, this will be executed after the plugin has been created.
145
+ * This call is done before the editor instance has finished it's initialization so use the onInit event
146
+ * of the editor instance to intercept that event.
147
+ *
148
+ * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
149
+ * @param {string} url Absolute URL to where the plugin is located.
150
+ */
151
+ init : function( ed, url ) {
152
+ ed.addButton( 'wpreviewpro', {
153
+ type: 'menubutton',
154
+ icon: 'dashicons dashicons-before dashicons-star-filled',
155
+ menu: [
156
+ getWPReviewButton( ed ),
157
+ getReviewTotalButton( ed ),
158
+ getVisitorRatingButton( ed )
159
+ ]
160
+ });
161
+ },
162
+
163
+ /**
164
+ * Creates control instances based in the incomming name. This method is normally not
165
+ * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
166
+ * but you sometimes need to create more complex controls like listboxes, split buttons etc then this
167
+ * method can be used to create those.
168
+ *
169
+ * @param {String} n Name of the control to create.
170
+ * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
171
+ * @return {tinymce.ui.Control} New control instance or null if no control was created.
172
+ */
173
+ createControl : function(n, cm) {
174
+ return null;
175
+ },
176
+
177
+ /**
178
+ * Returns information about the plugin as a name/value array.
179
+ * The current keys are longname, author, authorurl, infourl and version.
180
+ *
181
+ * @return {Object} Name/value array containing information about the plugin.
182
+ */
183
+ getInfo : function() {
184
+ return {
185
+ longname : 'WP Review Buttons',
186
+ author : 'MTS',
187
+ authorurl : 'https://mythemeshop.com',
188
+ version : '3.0.0'
189
+ };
190
+ }
191
+ });
192
+
193
+ // Register plugin
194
+ tinymce.PluginManager.add( 'wp_review', tinymce.plugins.WPReviewPro );
195
+ })( tinymce, wpreview, jQuery );
admin/assets/js/rating-inputs.js CHANGED
@@ -1,198 +1,198 @@
1
- ( function( $ ) {
2
- "use strict";
3
-
4
- var defaults = {
5
- value: 0,
6
- color: '',
7
- callback: null
8
- };
9
-
10
- function triggerCallback( options, value ) {
11
- if ( typeof options.callback == 'function' ) {
12
- options.callback.call( options._this, value );
13
- }
14
- }
15
-
16
- // Star input.
17
- $.fn.wprStarInput = function( method ) {
18
- var methods = {
19
- init: function( options ) {
20
- var _this = this, wrapper, html, starHtml, width;
21
- options = $.extend( {}, defaults, this.data(), options );
22
- if ( this.val() ) {
23
- options.value = this.val() ? parseFloat( this.val() ) : 0;
24
- }
25
- options._this = this;
26
-
27
- width = parseFloat( options.value ) * 20;
28
-
29
- starHtml = '';
30
- for ( var i = 0; i < 5; i++ ) {
31
- starHtml += '<span class="star-icon dashicons dashicons-star-filled"></span>';
32
- }
33
-
34
- html = '<div class="wpr-star-input-wrapper wpr-input-wrapper" data-value="' + options.value + '" data-width="' + width + '" style="color: ' + options.color + '">\
35
- <div class="stars-bg" style="color: ' + options.inactiveColor + '">' + starHtml + '</div>\
36
- <div class="stars-result" style="width: ' + width + '%">' + starHtml + '</div>\
37
- </div>';
38
-
39
- wrapper = $( html );
40
- this.before( wrapper );
41
-
42
- if ( typeof options.ready == 'function' ) {
43
- options.ready.call( this, wrapper, options )
44
- }
45
-
46
- wrapper.on( 'mousemove', function( ev ) {
47
- var newWidth;
48
- newWidth = ev.pageX - $( this ).offset().left;
49
- newWidth = newWidth / $( this ).width() * 100;
50
- newWidth = Math.ceil( newWidth / 10 ) * 10;
51
- $( this ).attr( 'data-value', newWidth / 20 ); // width / 100 * 5
52
- $( this ).find( '.stars-result' ).css( 'width', newWidth + '%' );
53
- $( this ).attr( 'data-width', newWidth );
54
- }).on( 'mouseleave', function() {
55
- // Reset to old width.
56
- $( this ).find( '.stars-result' ).css( 'width', width + '%' );
57
- $( this ).attr( 'data-width', width );
58
- $( this ).attr( 'data-value', options.value );
59
- }).on( 'click', function() {
60
- width = $( this ).attr( 'data-width' );
61
- options.value = parseFloat( $( this ).attr( 'data-value' ) );
62
- _this.val( options.value );
63
- triggerCallback( options, options.value );
64
- });
65
-
66
- wrapper.css({ color: options.color });
67
-
68
- this.on( 'change', function() {
69
- var value = $( this ).val() ? parseFloat( $( this ).val() ) : 0;
70
- wrapper.attr( 'data-value', value );
71
- wrapper.attr( 'data-width', value * 20 );
72
- wrapper.find( '.stars-result' ).css( 'width', ( value * 20 ) + '%' );
73
- triggerCallback( options, value );
74
- });
75
- }
76
- };
77
-
78
- if ( ! method || typeof method == 'object' ) {
79
- methods.init.apply( this, arguments );
80
- return;
81
- }
82
- if ( methods[ method ] ) {
83
- methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ) );
84
- return;
85
- }
86
- };
87
-
88
- // Percentage input.
89
- $.fn.wprPercentageInput = function( method ) {
90
- var methods = {
91
- init: function( options ) {
92
- var _this = this, wrapper;
93
- options = $.extend( {}, defaults, this.data(), options );
94
- if ( this.val() ) {
95
- options.value = this.val();
96
- }
97
- options._this = this;
98
-
99
- if ( ! options.inactiveColor ) {
100
- options.inactiveColor = '#ccc';
101
- }
102
-
103
- wrapper = $( '<div class="wpr-percentage-input-wrapper wpr-input-wrapper"></div>' );
104
- this.before( wrapper );
105
-
106
- if ( typeof options.ready == 'function' ) {
107
- options.ready.call( this, wrapper, options )
108
- }
109
-
110
- wrapper.slider({
111
- min: 0,
112
- max: 100,
113
- step: 1,
114
- range: 'min',
115
- value: options.value,
116
- create: function( ev, ui ) {
117
- wrapper.css( 'backgroundColor', options.inactiveColor );
118
- wrapper.find( '.ui-slider-range' ).css( 'backgroundColor', options.color );
119
- },
120
- slide: function( ev, ui ) {
121
- triggerCallback( options, ui.value );
122
- }
123
- });
124
-
125
- this.on( 'change', function() {
126
- var value = $( this ).val();
127
- wrapper.slider( 'value', value );
128
- triggerCallback( options, value );
129
- });
130
- }
131
- };
132
-
133
- if ( ! method || typeof method == 'object' ) {
134
- methods.init.apply( this, arguments );
135
- return;
136
- }
137
- if ( methods[ method ] ) {
138
- methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ) );
139
- return;
140
- }
141
- };
142
-
143
- // Point input.
144
- $.fn.wprPointInput = function( method ) {
145
- var methods = {
146
- init: function( options ) {
147
- var _this = this, wrapper;
148
- options = $.extend( {}, defaults, this.data(), options );
149
- if ( this.val() ) {
150
- options.value = this.val();
151
- }
152
- options._this = this;
153
-
154
- if ( ! options.inactiveColor ) {
155
- options.inactiveColor = '#ccc';
156
- }
157
-
158
- wrapper = $( '<div class="wpr-percentage-input-wrapper wpr-input-wrapper"></div>' );
159
- this.before( wrapper );
160
-
161
- if ( typeof options.ready == 'function' ) {
162
- options.ready.call( this, wrapper, options )
163
- }
164
-
165
- wrapper.slider({
166
- min: 0,
167
- max: 10,
168
- step: 0.1,
169
- range: 'min',
170
- value: options.value,
171
- create: function( ev, ui ) {
172
- wrapper.css( 'backgroundColor', options.inactiveColor );
173
- wrapper.find( '.ui-slider-range' ).css( 'backgroundColor', options.color );
174
- },
175
- slide: function( ev, ui ) {
176
- triggerCallback( options, ui.value );
177
- }
178
- });
179
-
180
- this.on( 'change', function() {
181
- var value = $( this ).val();
182
- wrapper.slider( 'value', value );
183
- triggerCallback( options, value );
184
- });
185
- }
186
- };
187
-
188
- if ( ! method || typeof method == 'object' ) {
189
- methods.init.apply( this, arguments );
190
- return;
191
- }
192
- if ( methods[ method ] ) {
193
- methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ) );
194
- return;
195
- }
196
- };
197
-
198
- })( jQuery );
1
+ ( function( $ ) {
2
+ "use strict";
3
+
4
+ var defaults = {
5
+ value: 0,
6
+ color: '',
7
+ callback: null
8
+ };
9
+
10
+ function triggerCallback( options, value ) {
11
+ if ( typeof options.callback == 'function' ) {
12
+ options.callback.call( options._this, value );
13
+ }
14
+ }
15
+
16
+ // Star input.
17
+ $.fn.wprStarInput = function( method ) {
18
+ var methods = {
19
+ init: function( options ) {
20
+ var _this = this, wrapper, html, starHtml, width;
21
+ options = $.extend( {}, defaults, this.data(), options );
22
+ if ( this.val() ) {
23
+ options.value = this.val() ? parseFloat( this.val() ) : 0;
24
+ }
25
+ options._this = this;
26
+
27
+ width = parseFloat( options.value ) * 20;
28
+
29
+ starHtml = '';
30
+ for ( var i = 0; i < 5; i++ ) {
31
+ starHtml += '<span class="star-icon dashicons dashicons-star-filled"></span>';
32
+ }
33
+
34
+ html = '<div class="wpr-star-input-wrapper wpr-input-wrapper" data-value="' + options.value + '" data-width="' + width + '" style="color: ' + options.color + '">\
35
+ <div class="stars-bg" style="color: ' + options.inactiveColor + '">' + starHtml + '</div>\
36
+ <div class="stars-result" style="width: ' + width + '%">' + starHtml + '</div>\
37
+ </div>';
38
+
39
+ wrapper = $( html );
40
+ this.before( wrapper );
41
+
42
+ if ( typeof options.ready == 'function' ) {
43
+ options.ready.call( this, wrapper, options )
44
+ }
45
+
46
+ wrapper.on( 'mousemove', function( ev ) {
47
+ var newWidth;
48
+ newWidth = ev.pageX - $( this ).offset().left;
49
+ newWidth = newWidth / $( this ).width() * 100;
50
+ newWidth = Math.ceil( newWidth / 10 ) * 10;
51
+ $( this ).attr( 'data-value', newWidth / 20 ); // width / 100 * 5
52
+ $( this ).find( '.stars-result' ).css( 'width', newWidth + '%' );
53
+ $( this ).attr( 'data-width', newWidth );
54
+ }).on( 'mouseleave', function() {
55
+ // Reset to old width.
56
+ $( this ).find( '.stars-result' ).css( 'width', width + '%' );
57
+ $( this ).attr( 'data-width', width );
58
+ $( this ).attr( 'data-value', options.value );
59
+ }).on( 'click', function() {
60
+ width = $( this ).attr( 'data-width' );
61
+ options.value = parseFloat( $( this ).attr( 'data-value' ) );
62
+ _this.val( options.value );
63
+ triggerCallback( options, options.value );
64
+ });
65
+
66
+ wrapper.css({ color: options.color });
67
+
68
+ this.on( 'change', function() {
69
+ var value = $( this ).val() ? parseFloat( $( this ).val() ) : 0;
70
+ wrapper.attr( 'data-value', value );
71
+ wrapper.attr( 'data-width', value * 20 );
72
+ wrapper.find( '.stars-result' ).css( 'width', ( value * 20 ) + '%' );
73
+ triggerCallback( options, value );
74
+ });
75
+ }
76
+ };
77
+
78
+ if ( ! method || typeof method == 'object' ) {
79
+ methods.init.apply( this, arguments );
80
+ return;
81
+ }
82
+ if ( methods[ method ] ) {
83
+ methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ) );
84
+ return;
85
+ }
86
+ };
87
+
88
+ // Percentage input.
89
+ $.fn.wprPercentageInput = function( method ) {
90
+ var methods = {
91
+ init: function( options ) {
92
+ var _this = this, wrapper;
93
+ options = $.extend( {}, defaults, this.data(), options );
94
+ if ( this.val() ) {
95
+ options.value = this.val();
96
+ }
97
+ options._this = this;
98
+
99
+ if ( ! options.inactiveColor ) {
100
+ options.inactiveColor = '#ccc';
101
+ }
102
+
103
+ wrapper = $( '<div class="wpr-percentage-input-wrapper wpr-input-wrapper"></div>' );
104
+ this.before( wrapper );
105
+
106
+ if ( typeof options.ready == 'function' ) {
107
+ options.ready.call( this, wrapper, options )
108
+ }
109
+
110
+ wrapper.slider({
111
+ min: 0,
112
+ max: 100,
113
+ step: 1,
114
+ range: 'min',
115
+ value: options.value,
116
+ create: function( ev, ui ) {
117
+ wrapper.css( 'backgroundColor', options.inactiveColor );
118
+ wrapper.find( '.ui-slider-range' ).css( 'backgroundColor', options.color );
119
+ },
120
+ slide: function( ev, ui ) {
121
+ triggerCallback( options, ui.value );
122
+ }
123
+ });
124
+
125
+ this.on( 'change', function() {
126
+ var value = $( this ).val();
127
+ wrapper.slider( 'value', value );
128
+ triggerCallback( options, value );
129
+ });
130
+ }
131
+ };
132
+
133
+ if ( ! method || typeof method == 'object' ) {
134
+ methods.init.apply( this, arguments );
135
+ return;
136
+ }
137
+ if ( methods[ method ] ) {
138
+ methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ) );
139
+ return;
140
+ }
141
+ };
142
+
143
+ // Point input.
144
+ $.fn.wprPointInput = function( method ) {
145
+ var methods = {
146
+ init: function( options ) {
147
+ var _this = this, wrapper;
148
+ options = $.extend( {}, defaults, this.data(), options );
149
+ if ( this.val() ) {
150
+ options.value = this.val();
151
+ }
152
+ options._this = this;
153
+
154
+ if ( ! options.inactiveColor ) {
155
+ options.inactiveColor = '#ccc';
156
+ }
157
+
158
+ wrapper = $( '<div class="wpr-percentage-input-wrapper wpr-input-wrapper"></div>' );
159
+ this.before( wrapper );
160
+
161
+ if ( typeof options.ready == 'function' ) {
162
+ options.ready.call( this, wrapper, options )
163
+ }
164
+
165
+ wrapper.slider({
166
+ min: 0,
167
+ max: 10,
168
+ step: 0.1,
169
+ range: 'min',
170
+ value: options.value,
171
+ create: function( ev, ui ) {
172
+ wrapper.css( 'backgroundColor', options.inactiveColor );
173
+ wrapper.find( '.ui-slider-range' ).css( 'backgroundColor', options.color );
174
+ },
175
+ slide: function( ev, ui ) {
176
+ triggerCallback( options, ui.value );
177
+ }
178
+ });
179
+
180
+ this.on( 'change', function() {
181
+ var value = $( this ).val();
182
+ wrapper.slider( 'value', value );
183
+ triggerCallback( options, value );
184
+ });
185
+ }
186
+ };
187
+
188
+ if ( ! method || typeof method == 'object' ) {
189
+ methods.init.apply( this, arguments );
190
+ return;
191
+ }
192
+ if ( methods[ method ] ) {
193
+ methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ) );
194
+ return;
195
+ }
196
+ };
197
+
198
+ })( jQuery );
admin/assets/js/review-items.js CHANGED
@@ -1,244 +1,244 @@
1
- ( function( Backbone, $ ) {
2
- "use strict";
3
-
4
- if ( ! $( '#wpr-review-items-app' ).length ) {
5
- return;
6
- }
7
-
8
- var App = {
9
- Models: {},
10
- Collections: {},
11
- Views: {}
12
- };
13
-
14
- App.Models.Item = Backbone.Model.extend({
15
- defaults: function() {
16
- return {
17
- id: '',
18
- item_id: '',
19
- wp_review_item_title: '',
20
- wp_review_item_star: 0,
21
- wp_review_item_color: $( '#wpr-review-color-value' ).val(),
22
- wp_review_item_inactive_color: $( '#wpr-review-inactive-color-value' ).val(),
23
- type: $( '#wpr-review-type-2' ).val() || wprVars.globalReviewType
24
- };
25
- }
26
- });
27
-
28
- App.Collections.Items = Backbone.Collection.extend({
29
- model: App.Models.Item
30
- });
31
-
32
- App.Views.ItemView = Backbone.View.extend({
33
- template: wp.template( 'wpr-review-item' ),
34
-
35
- className: 'wpr-review-item',
36
-
37
- initialize: function() {
38
- this.model.on( 'destroy', this.remove, this );
39
- },
40
-
41
- events: {
42
- 'click .delete-item': 'remove',
43
- 'change .input-title': 'changeTitle',
44
- 'change .input-star': 'changeScore'
45
- },
46
-
47
- render: function() {
48
- var _this = this,
49
- data;
50
-
51
- data = this.model.toJSON();
52
- data.itemNameSetting = wp.template( 'wpr-review-item-name' )( data );
53
- data.itemColorSetting = wp.template( 'wpr-review-item-color' )( data );
54
- data.itemInactiveColorSetting = wp.template( 'wpr-review-item-inactive-color' )( data );
55
- if ( $( '#tmpl-wpr-review-item-' + data.type + '-rating' ).length ) {
56
- data.itemRatingSetting = wp.template( 'wpr-review-item-' + data.type + '-rating' )( data );
57
- } else {
58
- data.itemRatingSetting = wp.template( 'wpr-review-item-rating' )( data );
59
- }
60
- this.$el.html( this.template( data ) );
61
-
62
- this.$( '.input-color' ).wpColorPicker({
63
- change: function( ev, ui ) {
64
- var color = ui.color.toString();
65
- _this.$( '.wpr-star-input-wrapper' ).css({ color: color });
66
- _this.$( '.wpr-input-wrapper.ui-slider .ui-slider-range' ).css({ backgroundColor: color });
67
- _this.model.set( 'wp_review_item_color', color );
68
- }
69
- });
70
-
71
- this.$( '.input-inactive-color' ).wpColorPicker({
72
- change: function( ev, ui ) {
73
- var color = ui.color.toString();
74
- _this.$( '.wpr-star-input-wrapper .stars-bg' ).css({ color: color });
75
- _this.$( '.wpr-input-wrapper.ui-slider' ).css({ backgroundColor: color });
76
- _this.model.set( 'wp_review_item_inactive_color', color );
77
- }
78
- });
79
-
80
- function validateValue( value, min, max ) {
81
- value = parseFloat( value );
82
- if ( isNaN( value ) || min !== undefined && value < min || max !== undefined && value > max ) {
83
- _this.$el.find( '.input-star, .input-star-display' ).addClass( 'review-value-incorrect' );
84
- } else {
85
- _this.$el.find( '.input-star, .input-star-display' ).removeClass( 'review-value-incorrect' );
86
- }
87
- }
88
-
89
- switch ( this.model.get( 'type' ) ) {
90
- case 'star':
91
- var _this = this;
92
-
93
- this.$( '.input-star' ).wprStarInput({
94
- ready: function( wrapper, options ) {
95
- this.appendTo( this.closest( '.col-2' ).next() );
96
- },
97
- callback: function( value ) {
98
- validateValue( value, 0, wprVars.reviewTypes.star.max );
99
- _this.model.set( 'wp_review_item_star', value );
100
- }
101
- });
102
- break;
103
-
104
- case 'percentage':
105
- this.$( '.input-star' ).wprPercentageInput({
106
- ready: function( wrapper, options ) {
107
- this.appendTo( this.closest( '.col-2' ).next() );
108
- },
109
- callback: function( value ) {
110
- this.val( value );
111
- validateValue( value, 0, wprVars.reviewTypes.percentage.max );
112
- _this.model.set( 'wp_review_item_star', value );
113
- }
114
- });
115
- break;
116
-
117
- case 'point':
118
- this.$( '.input-star' ).wprPointInput({
119
- ready: function( wrapper, options ) {
120
- this.appendTo( this.closest( '.col-2' ).next() );
121
- },
122
- callback: function( value ) {
123
- this.val( value );
124
- validateValue( value, 0, wprVars.reviewTypes.point.max );
125
- _this.model.set( 'wp_review_item_star', value );
126
- }
127
- });
128
- break;
129
- }
130
-
131
- this.$el.attr( 'data-id', this.model.get( 'id' ) );
132
- return this;
133
- },
134
-
135
- remove: function() {
136
- collection.remove( this.model );
137
- },
138
-
139
- changeTitle: function( ev ) {
140
- this.model.set( 'wp_review_item_title', ev.target.value );
141
- },
142
-
143
- changeScore: function( ev ) {
144
- this.model.set( 'wp_review_item_star', parseFloat( ev.target.value ) );
145
- }
146
- });
147
-
148
- App.Views.AppView = Backbone.View.extend({
149
- el: '#wpr-review-items-app',
150
-
151
- initialize: function() {
152
- this.render();
153
- this.collection.on( 'add', this.renderOne, this );
154
- this.collection.on( 'remove', this.remove, this );
155
- this.collection.on( 'add', this.calculateTotal, this );
156
- this.collection.on( 'change', this.calculateTotal, this );
157
- this.collection.on( 'remove', this.calculateTotal, this );
158
- this.collection.on( 'add change remove', this.updateAppAttr, this );
159
- },
160
-
161
- events: {
162
- 'click .add-item': 'addItem',
163
- 'change #wpr-review-type-2': 'changeType'
164
- },
165
-
166
- render: function() {
167
- this.$( '.wpr-review-items' ).html( '' );
168
- this.collection.each( this.renderOne, this );
169
- this.calculateTotal();
170
- this.$( '.wpr-review-items' ).sortable({
171
- handle: '.wpr-icon-move'
172
- });
173
- return this;
174
- },
175
-
176
- renderOne: function( item ) {
177
- var view = new App.Views.ItemView({ model: item });
178
- this.$( '.wpr-review-items' ).append( view.render().el );
179
- },
180
-
181
- calculateTotal: function() {
182
- if ( ! this.$el.attr( 'data-changed' ) ) {
183
- return;
184
- }
185
-
186
- var total = 0,
187
- count = this.collection.length;
188
-
189
- if ( count ) {
190
- _.each( this.collection.models, function( item ) {
191
- total += ! isNaN( item.get( 'wp_review_item_star' ) ) ? parseFloat( item.get( 'wp_review_item_star' ) * 1 ) : 0;
192
- });
193
- total = Math.round( total * 100 / count ) / 100;
194
- }
195
-
196
- this.$( '.input-total' ).val( total );
197
- },
198
-
199
- remove: function( item ) {
200
- this.$el.find( '.wpr-review-item[data-id="' + item.get( 'id' ) + '"]' ).remove();
201
- },
202
-
203
- addItem: function() {
204
- var model = new App.Models.Item();
205
- model.set( 'id', 'a' + parseInt( Math.random() * 100 ) );
206
- this.collection.add( model );
207
- },
208
-
209
- changeType: function( ev ) {
210
- var type = ev.target.value;
211
- if ( type == 'none' ) {
212
- return;
213
- }
214
- _.each( this.collection.models, function( item ) {
215
- item.set( 'type', type );
216
- });
217
- this.render();
218
- },
219
-
220
- updateAppAttr: function() {
221
- this.$el.attr( 'data-changed', '1' );
222
- }
223
- });
224
-
225
- function onSelectType() {
226
- $( '#wpr-review-type-2' ).val( $( this ).val() ).trigger( 'change' );
227
- }
228
- $( '#wp_review_type' ).on( 'change', onSelectType );
229
-
230
- // App initialize.
231
- var items = $( '#wpr-review-items-data' ).val();
232
- items = items ? JSON.parse( items ) : [];
233
- items.map( function( item, index ) {
234
- item.item_id = item.id;
235
- item.id = index;
236
- return item;
237
- });
238
-
239
- var collection = new App.Collections.Items( items );
240
-
241
- var appView = new App.Views.AppView({
242
- collection: collection
243
- });
244
- })( Backbone, jQuery );
1
+ ( function( Backbone, $ ) {
2
+ "use strict";
3
+
4
+ if ( ! $( '#wpr-review-items-app' ).length ) {
5
+ return;
6
+ }
7
+
8
+ var App = {
9
+ Models: {},
10
+ Collections: {},
11
+ Views: {}
12
+ };
13
+
14
+ App.Models.Item = Backbone.Model.extend({
15
+ defaults: function() {
16
+ return {
17
+ id: '',
18
+ item_id: '',
19
+ wp_review_item_title: '',
20
+ wp_review_item_star: 0,
21
+ wp_review_item_color: $( '#wpr-review-color-value' ).val(),
22
+ wp_review_item_inactive_color: $( '#wpr-review-inactive-color-value' ).val(),
23
+ type: $( '#wpr-review-type-2' ).val() || wprVars.globalReviewType
24
+ };
25
+ }
26
+ });
27
+
28
+ App.Collections.Items = Backbone.Collection.extend({
29
+ model: App.Models.Item
30
+ });
31
+
32
+ App.Views.ItemView = Backbone.View.extend({
33
+ template: wp.template( 'wpr-review-item' ),
34
+
35
+ className: 'wpr-review-item',
36
+
37
+ initialize: function() {
38
+ this.model.on( 'destroy', this.remove, this );
39
+ },
40
+
41
+ events: {
42
+ 'click .delete-item': 'remove',
43
+ 'change .input-title': 'changeTitle',
44
+ 'change .input-star': 'changeScore'
45
+ },
46
+
47
+ render: function() {
48
+ var _this = this,
49
+ data;
50
+
51
+ data = this.model.toJSON();
52
+ data.itemNameSetting = wp.template( 'wpr-review-item-name' )( data );
53
+ data.itemColorSetting = wp.template( 'wpr-review-item-color' )( data );
54
+ data.itemInactiveColorSetting = wp.template( 'wpr-review-item-inactive-color' )( data );
55
+ if ( $( '#tmpl-wpr-review-item-' + data.type + '-rating' ).length ) {
56
+ data.itemRatingSetting = wp.template( 'wpr-review-item-' + data.type + '-rating' )( data );
57
+ } else {
58
+ data.itemRatingSetting = wp.template( 'wpr-review-item-rating' )( data );
59
+ }
60
+ this.$el.html( this.template( data ) );
61
+
62
+ this.$( '.input-color' ).wpColorPicker({
63
+ change: function( ev, ui ) {
64
+ var color = ui.color.toString();
65
+ _this.$( '.wpr-star-input-wrapper' ).css({ color: color });
66
+ _this.$( '.wpr-input-wrapper.ui-slider .ui-slider-range' ).css({ backgroundColor: color });
67
+ _this.model.set( 'wp_review_item_color', color );
68
+ }
69
+ });
70
+
71
+ this.$( '.input-inactive-color' ).wpColorPicker({
72
+ change: function( ev, ui ) {
73
+ var color = ui.color.toString();
74
+ _this.$( '.wpr-star-input-wrapper .stars-bg' ).css({ color: color });
75
+ _this.$( '.wpr-input-wrapper.ui-slider' ).css({ backgroundColor: color });
76
+ _this.model.set( 'wp_review_item_inactive_color', color );
77
+ }
78
+ });
79
+
80
+ function validateValue( value, min, max ) {
81
+ value = parseFloat( value );
82
+ if ( isNaN( value ) || min !== undefined && value < min || max !== undefined && value > max ) {
83
+ _this.$el.find( '.input-star, .input-star-display' ).addClass( 'review-value-incorrect' );
84
+ } else {
85
+ _this.$el.find( '.input-star, .input-star-display' ).removeClass( 'review-value-incorrect' );
86
+ }
87
+ }
88
+
89
+ switch ( this.model.get( 'type' ) ) {
90
+ case 'star':
91
+ var _this = this;
92
+
93
+ this.$( '.input-star' ).wprStarInput({
94
+ ready: function( wrapper, options ) {
95
+ this.appendTo( this.closest( '.col-2' ).next() );
96
+ },
97
+ callback: function( value ) {
98
+ validateValue( value, 0, wprVars.reviewTypes.star.max );
99
+ _this.model.set( 'wp_review_item_star', value );
100
+ }
101
+ });
102
+ break;
103
+
104
+ case 'percentage':
105
+ this.$( '.input-star' ).wprPercentageInput({
106
+ ready: function( wrapper, options ) {
107
+ this.appendTo( this.closest( '.col-2' ).next() );
108
+ },
109
+ callback: function( value ) {
110
+ this.val( value );
111
+ validateValue( value, 0, wprVars.reviewTypes.percentage.max );
112
+ _this.model.set( 'wp_review_item_star', value );
113
+ }
114
+ });
115
+ break;
116
+
117
+ case 'point':
118
+ this.$( '.input-star' ).wprPointInput({
119
+ ready: function( wrapper, options ) {
120
+ this.appendTo( this.closest( '.col-2' ).next() );
121
+ },
122
+ callback: function( value ) {
123
+ this.val( value );
124
+ validateValue( value, 0, wprVars.reviewTypes.point.max );
125
+ _this.model.set( 'wp_review_item_star', value );
126
+ }
127
+ });
128
+ break;
129
+ }
130
+
131
+ this.$el.attr( 'data-id', this.model.get( 'id' ) );
132
+ return this;
133
+ },
134
+
135
+ remove: function() {
136
+ collection.remove( this.model );
137
+ },
138
+
139
+ changeTitle: function( ev ) {
140
+ this.model.set( 'wp_review_item_title', ev.target.value );
141
+ },
142
+
143
+ changeScore: function( ev ) {
144
+ this.model.set( 'wp_review_item_star', parseFloat( ev.target.value ) );
145
+ }
146
+ });
147
+
148
+ App.Views.AppView = Backbone.View.extend({
149
+ el: '#wpr-review-items-app',
150
+
151
+ initialize: function() {
152
+ this.render();
153
+ this.collection.on( 'add', this.renderOne, this );
154
+ this.collection.on( 'remove', this.remove, this );
155
+ this.collection.on( 'add', this.calculateTotal, this );
156
+ this.collection.on( 'change', this.calculateTotal, this );
157
+ this.collection.on( 'remove', this.calculateTotal, this );
158
+ this.collection.on( 'add change remove', this.updateAppAttr, this );
159
+ },
160
+
161
+ events: {
162
+ 'click .add-item': 'addItem',
163
+ 'change #wpr-review-type-2': 'changeType'
164
+ },
165
+
166
+ render: function() {
167
+ this.$( '.wpr-review-items' ).html( '' );
168
+ this.collection.each( this.renderOne, this );
169
+ this.calculateTotal();
170
+ this.$( '.wpr-review-items' ).sortable({
171
+ handle: '.wpr-icon-move'
172
+ });
173
+ return this;
174
+ },
175
+
176
+ renderOne: function( item ) {
177
+ var view = new App.Views.ItemView({ model: item });
178
+ this.$( '.wpr-review-items' ).append( view.render().el );
179
+ },
180
+
181
+ calculateTotal: function() {
182
+ if ( ! this.$el.attr( 'data-changed' ) ) {
183
+ return;
184
+ }
185
+
186
+ var total = 0,
187
+ count = this.collection.length;
188
+
189
+ if ( count ) {
190
+ _.each( this.collection.models, function( item ) {
191
+ total += ! isNaN( item.get( 'wp_review_item_star' ) ) ? parseFloat( item.get( 'wp_review_item_star' ) * 1 ) : 0;
192
+ });
193
+ total = Math.round( total * 100 / count ) / 100;
194
+ }
195
+
196
+ this.$( '.input-total' ).val( total );
197
+ },
198
+
199
+ remove: function( item ) {
200
+ this.$el.find( '.wpr-review-item[data-id="' + item.get( 'id' ) + '"]' ).remove();
201
+ },
202
+
203
+ addItem: function() {
204
+ var model = new App.Models.Item();
205
+ model.set( 'id', 'a' + parseInt( Math.random() * 100 ) );
206
+ this.collection.add( model );
207
+ },
208
+
209
+ changeType: function( ev ) {
210
+ var type = ev.target.value;
211
+ if ( type == 'none' ) {
212
+ return;
213
+ }
214
+ _.each( this.collection.models, function( item ) {
215
+ item.set( 'type', type );
216
+ });
217
+ this.render();
218
+ },
219
+
220
+ updateAppAttr: function() {
221
+ this.$el.attr( 'data-changed', '1' );
222
+ }
223
+ });
224
+
225
+ function onSelectType() {
226
+ $( '#wpr-review-type-2' ).val( $( this ).val() ).trigger( 'change' );
227
+ }
228
+ $( '#wp_review_type' ).on( 'change', onSelectType );
229
+
230
+ // App initialize.
231
+ var items = $( '#wpr-review-items-data' ).val();
232
+ items = items ? JSON.parse( items ) : [];
233
+ items.map( function( item, index ) {
234
+ item.item_id = item.id;
235
+ item.id = index;
236
+ return item;
237
+ });
238
+
239
+ var collection = new App.Collections.Items( items );
240
+
241
+ var appView = new App.Views.AppView({
242
+ collection: collection
243
+ });
244
+ })( Backbone, jQuery );
admin/assets/js/select2.min.js CHANGED
File without changes
admin/assets/js/wp-review-tab-widget-admin.js CHANGED
@@ -1,39 +1,39 @@
1
- /*
2
- * Plugin Name: WP Review
3
- * Plugin URI: http://mythemeshop.com/plugins/wp-review/
4
- * Description: Create reviews! Choose from Stars, Percentages, Circles or Points for review scores. Supports Retina Display, WPMU & Unlimited Color Schemes.
5
- * Author: MyThemesShop
6
- * Author URI: http://mythemeshop.com/
7
- */
8
- jQuery(document).on('click', function(e) {
9
- var $this = jQuery(e.target);
10
- var $form = $this.closest('.wp_review_tab_options_form');
11
-
12
- if ($this.is('.wp_review_tab_enable_toprated')) {
13
- $form.find('.wp_review_tab_toprated_order').slideToggle($this.is(':checked'));
14
- $form.find('.wp_review_tab_toprated_title').slideToggle($this.is(':checked'));
15
- $form.find('.wp_review_tab_top_rated_filter').slideToggle($this.is(':checked'));
16
- } else if ($this.is('.wp_review_tab_enable_recent')) {
17
- $form.find('.wp_review_tab_recent_order').slideToggle($this.is(':checked'));
18
- $form.find('.wp_review_tab_recent_title').slideToggle($this.is(':checked'));
19
- } else if ($this.is('.wp_review_tab_enable_mostvoted')) {
20
- $form.find('.wp_review_tab_mostvoted_order').slideToggle($this.is(':checked'));
21
- $form.find('.wp_review_tab_mostvoted_title').slideToggle($this.is(':checked'));
22
- } else if ($this.is('.wp_review_tab_enable_recent_ratings')) {
23
- $form.find('.wp_review_tab_recent_ratings_order').slideToggle($this.is(':checked'));
24
- $form.find('.wp_review_tab_recent_ratings_title').slideToggle($this.is(':checked'));
25
- $form.find('.wp_review_restrict_recent_review').slideToggle($this.is(':checked'));
26
- } else if ($this.is('.wp_review_tab_enable_custom')) {
27
- $form.find('.wp_review_tab_custom_order').slideToggle($this.is(':checked'));
28
- $form.find('.wp_review_tab_custom_title').slideToggle($this.is(':checked'));
29
- $form.find('.wp_review_tab_custom_reviews').slideToggle($this.is(':checked'));
30
- } else if ($this.is('.wp_review_tab_order_header')) {
31
- e.preventDefault();
32
- $form.find('.wp_review_tab_order').slideToggle();
33
- $form.find('.wp_review_tab_titles').slideUp();
34
- } else if ($this.is('.wp_review_tab_titles_header')) {
35
- e.preventDefault();
36
- $form.find('.wp_review_tab_titles').slideToggle();
37
- $form.find('.wp_review_tab_order').slideUp();
38
- }
39
- });
1
+ /*
2
+ * Plugin Name: WP Review
3
+ * Plugin URI: http://mythemeshop.com/plugins/wp-review/
4
+ * Description: Create reviews! Choose from Stars, Percentages, Circles or Points for review scores. Supports Retina Display, WPMU & Unlimited Color Schemes.
5
+ * Author: MyThemesShop
6
+ * Author URI: http://mythemeshop.com/
7
+ */
8
+ jQuery(document).on('click', function(e) {
9
+ var $this = jQuery(e.target);
10
+ var $form = $this.closest('.wp_review_tab_options_form');
11
+
12
+ if ($this.is('.wp_review_tab_enable_toprated')) {
13
+ $form.find('.wp_review_tab_toprated_order').slideToggle($this.is(':checked'));
14
+ $form.find('.wp_review_tab_toprated_title').slideToggle($this.is(':checked'));
15
+ $form.find('.wp_review_tab_top_rated_filter').slideToggle($this.is(':checked'));
16
+ } else if ($this.is('.wp_review_tab_enable_recent')) {
17
+ $form.find('.wp_review_tab_recent_order').slideToggle($this.is(':checked'));
18
+ $form.find('.wp_review_tab_recent_title').slideToggle($this.is(':checked'));
19
+ } else if ($this.is('.wp_review_tab_enable_mostvoted')) {
20
+ $form.find('.wp_review_tab_mostvoted_order').slideToggle($this.is(':checked'));
21
+ $form.find('.wp_review_tab_mostvoted_title').slideToggle($this.is(':checked'));
22
+ } else if ($this.is('.wp_review_tab_enable_recent_ratings')) {
23
+ $form.find('.wp_review_tab_recent_ratings_order').slideToggle($this.is(':checked'));
24
+ $form.find('.wp_review_tab_recent_ratings_title').slideToggle($this.is(':checked'));
25
+ $form.find('.wp_review_restrict_recent_review').slideToggle($this.is(':checked'));
26
+ } else if ($this.is('.wp_review_tab_enable_custom')) {
27
+ $form.find('.wp_review_tab_custom_order').slideToggle($this.is(':checked'));
28
+ $form.find('.wp_review_tab_custom_title').slideToggle($this.is(':checked'));
29
+ $form.find('.wp_review_tab_custom_reviews').slideToggle($this.is(':checked'));
30
+ } else if ($this.is('.wp_review_tab_order_header')) {
31
+ e.preventDefault();
32
+ $form.find('.wp_review_tab_order').slideToggle();
33
+ $form.find('.wp_review_tab_titles').slideUp();
34
+ } else if ($this.is('.wp_review_tab_titles_header')) {
35
+ e.preventDefault();
36
+ $form.find('.wp_review_tab_titles').slideToggle();
37
+ $form.find('.wp_review_tab_order').slideUp();
38
+ }
39
+ });
admin/assets/sass/admin.scss DELETED
@@ -1,842 +0,0 @@
1
- @import "../../../public/sass/util";
2
-
3
- .border-box {
4
- box-sizing: border-box;
5
-
6
- * {
7
- box-sizing: border-box;
8
- }
9
- }
10
-
11
- .wpr-flex {
12
- display: flex;
13
- flex-wrap: wrap;
14
- }
15
-
16
- .wpr-flex-wrap {
17
- flex-wrap: wrap;
18
- }
19
-
20
- .wpr-col-1-2 {
21
- flex: 0 0 50%;
22
- }
23
-
24
- .wpr-col-1-3 {
25
- flex: 0 0 33.33%;
26
- margin-bottom: 12px;
27
- padding-bottom: 12px;
28
-
29
- label {
30
- position: relative;
31
- padding-left: 20px;
32
- input[type=checkbox] {
33
- position: absolute;
34
- top: 0;
35
- left: 0;
36
- -webkit-box-shadow: none;
37
- box-shadow: none;
38
- overflow: hidden;
39
- border: 2px solid rgba(33,38,44,0.6);
40
- border-radius: 2px;
41
-
42
- &:checked {
43
- border-color: #069de3;
44
- &:before {
45
- line-height: 16px;
46
- width: 17px;
47
- height: 16px;
48
- margin: -2px 0 0 -5px;
49
- content: '\f147';
50
- text-align: center;
51
- color: #fff;
52
- border-radius: 2px;
53
- background: #069de3;
54
- }
55
- }
56
- }
57
- }
58
- }
59
-
60
- .wp-review {
61
-
62
- * {
63
- box-sizing: border-box;
64
- }
65
-
66
- p.submit { text-align: right; }
67
-
68
- h1 { margin-bottom: 15px; }
69
- }
70
- .wpr-flex-wrap { justify-content: space-between; }
71
- .wpr-flex-wrap .wpr-col-1-2 {
72
- flex: 0 0 49%;
73
- }
74
- .wpr-flex-wrap .wpr-col-1-2:last-child { float: right; }
75
- /*---------------------------
76
- * Fields
77
- *--------------------------*/
78
- .wp-review-field {
79
- &, * {
80
- box-sizing: border-box;
81
- }
82
-
83
- padding: 15px 0;
84
- border-bottom: 1px dashed #ddd;
85
- margin-top: 1em;
86
- margin-bottom: 1em;
87
- border-bottom: 1px dashed #ddd;
88
- }
89
-
90
- .postbox .wp-review-field {
91
- padding: 0;
92
- border-bottom: 0;
93
- }
94
-
95
- @media (min-width: 600px) {
96
- .wp-review-field:not(.vertical):not(.no-flex) {
97
- display: flex;
98
- flex-wrap: wrap;
99
-
100
- .wp-review-field-label {
101
- flex: 0 0 25%;
102
- padding-right: 4%;
103
-
104
- &.full-width {
105
- flex: 0 0 100%;
106
- padding-right: 0;
107
- }
108
- }
109
-
110
- .wp-review-field-option {
111
- flex: 0 0 75%;
112
- }
113
-
114
- &.wp-review-rating-icon, &.wp-review-rating-image {
115
- position: relative;
116
- &.hide {display: none;}
117
- a.wpr-toggle-rating {
118
- position: absolute;
119
- top: 0;
120
- right: 0;
121
- }
122
-
123
- .img-wrapper {
124
- padding: 2px;
125
- width: 55px;
126
- height: 55px;
127
- border: 1px solid #ddd;
128
- position: relative;
129
- img {
130
- max-width: 100%;
131
- }
132
- i {
133
- position: absolute;
134
- top: -6px;
135
- right: -6px;
136
- color: #444;
137
- cursor: pointer;
138
- }
139
- &.hide { display: none; }
140
- }
141
- .set_rating_image.hide {display: none;}
142
- }
143
- }
144
-
145
- .postbox .wp-review-field {
146
- .wp-review-field-label {
147
- flex: 0 0 20%;
148
- }
149
-
150
- .wp-review-field-option {
151
- flex: 0 0 80%;
152
- }
153
- }
154
- }
155
-
156
- .wpr_image_upload_field {
157
- .clear-image {
158
- margin-left: 10px;
159
- }
160
- }
161
-
162
- /*---------------------------
163
- * Review items
164
- *--------------------------*/
165
- .wpr-star-input-wrapper {
166
- position: relative;
167
- color: #c40000;
168
- overflow: hidden;
169
- display: inline-block;
170
-
171
- .star-icon {
172
- // float: left;
173
- }
174
-
175
- .stars-bg {
176
- color: #ccc;
177
- white-space: nowrap;
178
-
179
- // &:after {
180
- // content: " ";
181
- // display: block;
182
- // clear: both;
183
- // height: 0;
184
- // visibility: hidden;
185
- // }
186
- }
187
-
188
- .stars-result {
189
- white-space: nowrap;
190
- position: absolute;
191
- left: 0;
192
- top: 0;
193
- overflow: hidden;
194
- }
195
- }
196
-
197
- .wpr-input-wrapper.ui-slider {
198
- .ui-slider-handle {
199
- background-color: #fff;
200
- box-shadow: 0 0px 3px rgba(0, 0, 0, 0.4);
201
- border-radius: 2px;
202
- cursor: pointer;
203
- }
204
- }
205
-
206
- /*---------------------------
207
- * Options page
208
- *--------------------------*/
209
- .wpr-vertical-tabs {
210
- max-width: 880px;
211
- position: relative;
212
-
213
- &__titles {
214
- width: 200px;
215
- float: left;
216
- border-right: 0;
217
- margin: 0;
218
- z-index: 10;
219
- position: absolute;
220
- left: 0;
221
- top: 0;
222
-
223
- &.active {
224
- background-color: #fff;
225
- }
226
- }
227
-
228
- &__title {
229
- margin: 0;
230
- padding: 0;
231
- position: relative;
232
-
233
- &:first-child a { border-top: 1px solid #ccc; }
234
-
235
- &.active a {
236
- background-color: #fff;
237
- }
238
-
239
- &.active a:after {
240
- content: "";
241
- width: 1px;
242
- height: 40px;
243
- position: absolute;
244
- right: -1px;
245
- top: 1px;
246
- background: #fff;
247
- z-index: 10;
248
- }
249
-
250
- i {
251
- font-size: 18px;
252
- min-width: 20px;
253
- margin-right: 10px;
254
- text-align: center;
255
- color: #444;
256
- }
257
-
258
- a {
259
- font-size: 16px;
260
- display: block;
261
- -webkit-box-sizing: border-box;
262
- box-sizing: border-box;
263
- padding: 11px 15px;
264
- white-space: nowrap;
265
- text-decoration: none;
266
- color: #555;
267
- border: 1px solid #ccc;
268
- border-top: 0;
269
- border-right: 0;
270
- outline: none;
271
- background: #e5e5e5;
272
- -webkit-box-shadow: none;
273
- box-shadow: none;
274
- }
275
- }
276
-
277
- &__contents {
278
- padding-left: 200px;
279
- }
280
-
281
- &__content {
282
- padding: 15px;
283
- min-height: 400px;
284
- background: #fff;
285
- border: 1px solid #ccc;
286
-
287
- > h2 { margin-top: 0; }
288
-
289
- .nav-tab-active {
290
- background-color: #fff;
291
- border-bottom-color: #fff;
292
- }
293
- }
294
- }
295
-
296
- /*.wp-review-field { clear: both; padding-top: 0; }*/
297
- .clearfix:before, .clearfix:after { content: " "; display: table; }
298
- .clearfix:after { clear: both }
299
- .clearfix { *zoom: 1 }
300
- .wp_review_schema_type_options textarea {
301
- width: 77%;
302
- min-height: 80px;
303
- }
304
- .wp-review-field {
305
- select { width: 15em; margin-left: 0; }
306
- #wp_review_product_price { width: 70px; }
307
- .wp-color-result { margin: 0 }
308
- .large-text { width: 77%; }
309
- input { margin: 0; padding: 5px 8px }
310
- }
311
- .wp-review-field {
312
- .wp-picker-container {
313
- display: inline-block;
314
- label { flex: none; width: auto; }
315
- input[type="text"].wp-color-picker { padding: 4px; width: 65px; }
316
- .iris-picker { box-sizing: initial; }
317
- .wp-picker-open+.wp-picker-input-wrap { width: 140px; }
318
- }
319
- }
320
- #wp-wp_review_pros-wrap textarea.wp-editor-area, #wp-wp_review_cons-wrap textarea.wp-editor-area, #wp-wp_review_desc-wrap textarea.wp-editor-area { border: 0; }
321
- .wp_review_schema_options_label{
322
- vertical-align: top;
323
- padding-top: 5px;
324
- }
325
- .wpr_image_upload_field { display: inline-block; }
326
-
327
- .wp-review-item {
328
- th { text-align: left }
329
- td:first-child { text-align: center }
330
- .handle { cursor: move }
331
- }
332
- .wp-review-links {
333
- td:first-child { text-align: center }
334
- .handle { cursor: move }
335
- input[type="text"] { padding: 5px 8px; }
336
- }
337
- .has-border-bottom {
338
- border-bottom: 1px solid #ddd;
339
- margin-bottom: 20px;
340
- padding-bottom: 20px;
341
- }
342
- .review-total { text-align: right }
343
- .wp-review-field-option:not(.pyre_field) .wp-picker-holder {
344
- position: absolute;
345
- z-index: 9;
346
- }
347
-
348
- .review-value-incorrect { border-color: #F00 !important }
349
-
350
- #wp_review_id_hint { margin-left: 8px }
351
-
352
- .wp-review-admin-options {
353
- .form-table td {
354
- padding: 20px 10px;
355
- vertical-align: top;
356
- }
357
- p.description { font-weight: normal; font-style: normal; }
358
- .wp-review-field {
359
- > label {
360
- .description { margin-left: 0; }
361
- }
362
- input {
363
- padding: 7px;
364
- border-radius: 2px;
365
- margin: 0;
366
- -webkit-box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
367
- box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
368
- }
369
- input[type=radio] {
370
- border-radius: 50%;
371
- }
372
- input[type=checkbox] { border-radius: 0; }
373
- .large-text { width: 70%; }
374
- .description { display: block; color: #888; font-style: normal; margin-top: 5px; }
375
- }
376
- #wp_review_shortcode_hint_field span {
377
- display: inline;
378
- margin-left: 6px;
379
- }
380
- .wp-review-thumbnail-options label { margin-right: 0; width: 90%; }
381
- }
382
- .wp-review-description label {
383
- margin-bottom: -20px;
384
- display: block;
385
- }
386
- .wp-review-theme-defaults-msg { position: relative }
387
- .wp-review-theme-defaults-msg a.button {
388
- display: inline-block;
389
- margin-bottom: 8px;
390
- }
391
- .wp-review-theme-defaults-msg a.close-notice {
392
- position: absolute;
393
- top: 0;
394
- right: 0;
395
- }
396
- .edit-ratings-notice.update-nag {
397
- background: #fff9e8;
398
- margin-right: 0;
399
- }
400
- #wp-review-width-slider {
401
- width: 70%;
402
- float: left;
403
- margin-top: 12px;
404
- margin-right: 25px;
405
- border-radius: 0;
406
- max-width: 600px;
407
- border: 0;
408
- background: #d8d8d8;
409
- height: 8px;
410
-
411
- .ui-slider-handle {
412
- background: #fff;
413
- -webkit-box-shadow: 0 0px 3px rgba(0, 0, 0, 0.4);
414
- box-shadow: 0 0px 3px rgba(0, 0, 0, 0.4);
415
- border-radius: 2px;
416
- }
417
- }
418
- #wp-review-width-slider.ui-slider-horizontal .ui-slider-range-min {
419
- border: 0;
420
- border-radius: 2px;
421
- background: #0184bb;
422
- }
423
- #wp_review_width { width: 60px }
424
- .wrap.wp-review .nav-tab-wrapper {
425
- border-bottom: 1px solid #ccc; margin-top: 16px;
426
-
427
- a:focus { box-shadow: none; }
428
- }
429
- .nav-tab-hidden { display: none }
430
- .nav-tab-hidden.nav-tab-active { display: block }
431
- textarea#wp-review-migrate-log {
432
- width: 600px;
433
- max-width: 100%;
434
- height: 200px;
435
- display: none;
436
- }
437
- .already-migrated-msg { display: none }
438
- #start-migrate { margin-bottom: 12px }
439
- #wp-review-settings-tab-contents > div { display: none;max-width: 900px;}
440
- #wp-review-settings-tab-contents .settings-tab-general { display: block }
441
- .pros-cons-title {
442
- max-width: 25%;
443
- }
444
- .column-wp_review_rating,
445
- .column-wp_review_comment_rating {
446
- text-align: center;
447
- position: relative;
448
- width: 110px;
449
- }
450
- .column-wp_review_rating .review-star,
451
- .column-wp_review_comment_rating .review-star {
452
- position: relative;
453
- letter-spacing: 1px;
454
- }
455
- .column-wp_review_rating .no-rating,
456
- .column-wp_review_comment_rating .no-rating {
457
- color: #aaa;
458
- font-style: italic;
459
- }
460
- #editwpreview {
461
- overflow: hidden;
462
- }
463
- #editwpreview .inside {
464
- float: left;
465
- padding: 3px 0 2px 5px;
466
- margin: 0;
467
- text-align: left;
468
- }
469
- #editwpreview .inside input {
470
- width: 180px
471
- }
472
- #editwpreview label {
473
- padding: 2px 0
474
- }
475
- h4.wp-review-comment-title {
476
- margin-top: 0;
477
- margin-bottom: 1em;
478
- }
479
-
480
- .review-result-wrapper {
481
- position: relative;
482
- display: inline-block;
483
- font-size: 0;
484
- }
485
- .postbox .review-result-wrapper a, .postbox .review-result i { cursor: pointer }
486
- .review-result {
487
- position: absolute;
488
- top: 0;
489
- left: 0;
490
- height: 22px;
491
- overflow: hidden;
492
- white-space: nowrap;
493
- }
494
- .wp-review-rating-feature { display: inline-block }
495
- .wp-review-notice {
496
- position: relative;
497
- }
498
- .wpr_image_upload_img {
499
- margin:0 0 10px;
500
- padding:0;
501
- max-width:100%;
502
- height:auto;
503
- float:left;
504
- display:inline-block;
505
- }
506
-
507
- .wpr-hide {
508
- display: none;
509
- }
510
-
511
- .wpr-tabs .tab-title.nav-tab-active {
512
- background-color: #fff;
513
- border-bottom-color: #fff;
514
- }
515
-
516
- .wpr-box-template-images {
517
- @extend .border-box;
518
-
519
- display: flex;
520
- flex-wrap: wrap;
521
-
522
- .wpr-box-template-image {
523
- flex: 0 0 50%;
524
- display: block;
525
- outline: 0;
526
- box-shadow: none;
527
- text-decoration: none;
528
- text-align: center;
529
- color: #333;
530
- font-weight: 700;
531
- margin-bottom: 5px;
532
-
533
- img {
534
- padding: 4px;
535
- width: 100%;
536
- height: auto;
537
- display: block;
538
- }
539
-
540
- &.active {
541
- img {
542
- background-color: #0073aa;
543
- }
544
- }
545
- }
546
- }
547
-
548
- #wpr-review-items-app {
549
- * {
550
- box-sizing: border-box;
551
- }
552
-
553
- .wpr-review-item {
554
- background-color: #f7f7f7;
555
- padding: 10px 10px 10px 30px;
556
- margin-bottom: 5px;
557
-
558
- .setting-row:first-of-type .col-2 input {
559
- width: 100%;
560
- padding: 5px;
561
- background: #fff;
562
- }
563
-
564
- .col-3 input {
565
- float: right;
566
- background: #fff;
567
- }
568
-
569
- .wpr-icon-move {
570
- cursor: move;
571
- position: absolute;
572
- left: 5px;
573
- top: 16px;
574
- }
575
- }
576
-
577
- .setting-row {
578
- padding: 5px 0;
579
- }
580
-
581
- .final-row {
582
- .col-3 {
583
- text-align: right;
584
- input { float: right; min-width: 52px; }
585
- label { margin: 4px 10px 0 0; display: inline-block; font-weight: bold; }
586
- }
587
- }
588
-
589
- .wpr-percentage-input-wrapper {
590
- margin-top: 10px;
591
- }
592
-
593
- .wp-picker-container {
594
- display: inline-block;
595
- }
596
-
597
-
598
- .wp-picker-holder {
599
- * { box-sizing: initial; }
600
- }
601
-
602
- @media (min-width: 768px) {
603
- .wpr-review-item {
604
- position: relative;
605
- }
606
-
607
- .delete-item {
608
- position: absolute;
609
- right: 10px;
610
- bottom: 10px;
611
- }
612
-
613
- .setting-row {
614
- display: flex;
615
- flex-wrap: wrap;
616
- }
617
-
618
- .col-1 {
619
- flex: 0 0 20%;
620
- }
621
-
622
- .col-2 {
623
- flex: 0 0 60%;
624
- padding: 0 10px;
625
- }
626
-
627
- .col-3 {
628
- flex: 0 0 20%;
629
- }
630
- }
631
- }
632
-
633
- #wp_review_box_template_wrapper {
634
- position: relative;
635
- }
636
-
637
- #wp_review_box_template_preview {
638
- position: absolute;
639
- left: 250px;
640
- top: 0px;
641
- z-index: 1000;
642
- padding: 3px;
643
- box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
644
- background: #fff;
645
-
646
- &.loading {
647
- background: #eee url(../images/loading.svg) no-repeat center center;
648
-
649
- img {
650
- visibility: hidden;
651
- }
652
- }
653
- }
654
- #wp_review_box_template_img,
655
- #wp_review_box_template_preview_img {
656
- max-width: 414px;
657
- height: auto;
658
- }
659
-
660
- // Form fields
661
- .wpr-switch {
662
- $border-radius: 3px; // Default 4px
663
- $font-size: 12px; // Default 14px
664
- $button-width: 45px; // Default 50px
665
- $height: 28px;
666
-
667
- display: inline-block;
668
-
669
- input {
670
- position: absolute !important;
671
- clip: rect(0, 0, 0, 0);
672
- height: 1px;
673
- width: 1px;
674
- border: 0;
675
- overflow: hidden;
676
- }
677
-
678
- label {
679
- float: left;
680
- display: inline-block;
681
- min-width: $button-width;
682
- background-color: #e4e4e4;
683
- color: rgba(0, 0, 0, 0.6);
684
- font-size: $font-size;
685
- font-weight: 700;
686
- line-height: $height;
687
- text-align: center;
688
- text-shadow: none;
689
- border: 1px solid rgba(0, 0, 0, 0.2);
690
- box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);
691
- transition: all 0.1s ease-in-out;
692
-
693
- &:hover {
694
- cursor: pointer;
695
- }
696
-
697
- &:first-of-type {
698
- border-radius: $border-radius 0 0 $border-radius;
699
- border-right: 0;
700
- font-weight: normal;
701
- }
702
-
703
- &:last-of-type {
704
- border-radius: 0 $border-radius $border-radius 0;
705
- border-left: 0;
706
- font-weight: normal;
707
- }
708
- }
709
- }
710
-
711
- input.wpr-switch__on:checked + label, input.wpr-switch__off:checked + label {
712
- background: #0085ba;
713
- border-color: #0073aa #006799 #006799;
714
- box-shadow: 0 1px 0 #006799;
715
- color: #fff;
716
- text-decoration: none;
717
- text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;
718
- margin-bottom: 2px;
719
- }
720
- input.wpr-switch__on:checked + label:hover, input.wpr-switch__off:checked + label:hover {
721
- background: #008ec2;
722
- border-color: #006799;
723
- color: #fff;
724
- }
725
- input.wpr-switch__off:checked + label, input.wpr-switch__off:checked + label:hover {
726
- color: #fff;
727
- background: #f5786f;
728
- border-color: #bd4c44 #bd4c44 #bd4c44;
729
- -webkit-box-shadow: 0 1px 0 #bd4c44;
730
- box-shadow: 0 1px 0 #bd4c44;
731
- text-shadow: none;
732
- }
733
-
734
- // Demo importer popup
735
- #wp-review-demo-importer-popup {
736
- background: #fff;
737
- border: 1px solid #eaeaeb;
738
- border-radius: 3px;
739
- box-shadow: 0 1px 0 #FFF inset, 0 1px 5px rgba(0, 0, 0, 0.1);
740
- position: relative;
741
- width: auto;
742
- max-width: 600px;
743
- margin: 50px auto;
744
- }
745
-
746
- #wp-review-demo-importer-modal-header {
747
- border-bottom: 1px solid #eaeaeb;
748
- background: #FAFBFD;
749
- padding: 12px 20px;
750
-
751
- .spinner {
752
- margin-top: 14px;
753
- }
754
- }
755
-
756
- #wp-review-demo-importer-modal-header h2,
757
- #wp-review-demo-importer-modal-content h4 {
758
- padding: 0!important;
759
- margin: 0!important;
760
- }
761
-
762
- #wp-review-demo-importer-modal-header h2 {
763
- font-size: 1.8em;
764
- line-height: 2em;
765
- }
766
-
767
- #wp-review-demo-importer-modal-content {
768
- background: #fff;
769
- padding: 20px;
770
- overflow: auto;
771
- height: 300px;
772
- width: 100%;
773
- box-sizing: border-box;
774
-
775
- p {
776
- padding: 0;
777
- margin: 0;
778
- }
779
- }
780
-
781
- #wp-review-demo-importer-modal-footer {
782
- border-top: 1px solid #eaeaeb;
783
- background: #FAFBFD;
784
- padding: 12px 20px;
785
- display: inline-block;
786
- width: 100%;
787
- box-sizing: border-box;
788
- }
789
-
790
- #wp-review-demo-importer-modal-footer-info {
791
- float: left;
792
- }
793
-
794
- #wp-review-demo-importer-modal-footer-button {
795
- float: right;
796
- display: none;
797
- text-transform: uppercase;
798
- }
799
-
800
- .wp-admin select.mce-selectbox {
801
- padding: 0;
802
- }
803
- #wp-review-metabox-userReview .inside > {
804
- p:first-of-type label, p:nth-of-type(2) label, p:nth-of-type(3) label, p:nth-of-type(4) label { padding-right: 0; margin-left: 5px; }
805
- }
806
-
807
- .wp-review-subsite-wrapper {
808
- display: none;
809
- }
810
-
811
- .wp-review-pro-text {
812
- color: #00cc66;
813
- }
814
-
815
- .wp-review-disabled {
816
- position: relative;
817
- cursor: pointer;
818
-
819
- &:before {
820
- content: " ";
821
- display: block;
822
- position: absolute;
823
- top: 0;
824
- left: 0;
825
- right: 0;
826
- bottom: 0;
827
- z-index: 100;
828
- }
829
-
830
- &.inline-block {
831
- display: inline-block;
832
- }
833
-
834
- &.wpr-switch,
835
- &.has-bg {
836
- opacity: 0.3;
837
- }
838
- }
839
-
840
- option.disabled {
841
- color: #aaa;
842
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/assets/sourcemaps/admin.css.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["admin.scss"],"names":[],"mappings":"AAEA,qCACC,qBAAsB,CADvB,yCAIE,qBAAsB,CACtB,UAID,aACA,cAAe,CACf,eAGA,cAAe,CACf,aAGA,YAAa,CACb,aAGA,gBACA,mBACA,mBAAoB,CAHrB,mBAME,kBACA,iBAAkB,CAPpB,wCASG,kBACA,MACA,OACA,AACA,gBACA,gBACA,oCACA,iBAAkB,CAhBrB,gDAmBI,oBAAqB,CAnBzB,uDAqBK,iBACA,WACA,YACA,qBACA,gBACA,kBACA,WACA,kBACA,kBAAmB,CACnB,aASH,qBAAsB,CAHxB,oBAMY,gBAAiB,CAN7B,cAQM,kBAAmB,CApDzB,eAsDiB,6BAA8B,CAAI,4BAElD,YAAa,CACb,uCACwC,WAAY,CAAI,iBASxD,eACA,8BACA,eACA,kBACA,6BAA8B,CAT/B,oCAEE,qBAAsB,CACtB,0BAUD,UACA,eAAgB,CAChB,0BAGA,8CACC,aACA,cAAe,CAFhB,qEAKE,aACA,gBAAiB,CANnB,gFASG,cACA,eAAgB,CAVnB,sEAeE,YAAa,CAff,yIAmBE,iBAAkB,CAnBpB,mJAoBU,YAAa,CApBvB,iLAsBG,kBACA,MACA,OAAQ,CAxBX,mKA4BG,YACA,WACA,YACA,sBACA,iBAAkB,CAhCrB,2KAkCI,cAAe,CAlCnB,uKAqCI,kBACA,SACA,WACA,WACA,cAAe,CAzCnB,6KA2CY,YAAa,CA3CzB,uLA6C0B,YAAa,CAAG,iDAMxC,YAAa,CAFf,kDAME,YAAa,CACb,CAIH,qCAEE,gBAAiB,CACjB,wBAOD,kBACA,cACA,gBACA,oBAAqB,CAJtB,kCAWE,WACA,kBAAmB,CAZrB,sCAwBE,mBACA,kBACA,OACA,MACA,eAAgB,CAChB,+CAKA,sBACA,qCACA,kBACA,cAAe,CACf,mBAOD,gBACA,iBAAkB,CAElB,2BACC,YACA,WACA,eACA,SACA,WACA,kBACA,OACA,KAAM,CARN,kCAWC,qBAAsB,CACtB,0BAID,SACA,UACA,iBAAkB,CAHlB,wCAKkB,yBAA0B,CAL5C,mCAQC,qBAAsB,CARvB,yCAYC,WACA,UACA,YACA,kBACA,WACA,QACA,gBACA,UAAW,CAnBZ,4BAuBC,eACA,eACA,kBACA,kBACA,UAAW,CA3BZ,4BA+BC,eACA,cACA,AACA,sBACA,kBACA,mBACA,qBACA,WACA,sBACA,aACA,eACA,aACA,mBACA,AACA,eAAgB,CAChB,6BAID,kBAAmB,CACnB,4BAGA,aACA,iBACA,gBACA,qBAAsB,CAJtB,+BAMO,YAAa,CANpB,4CASC,sBACA,wBAAyB,CACzB,iCAKiC,YAAc,aAAc,CAAI,gBAClD,UAAY,CAAE,WACpB,MAAU,CAAE,wCAEvB,UACA,eAAgB,CAChB,wBAES,WAAa,aAAc,CADrC,0CAE4B,UAAW,CAFvC,kCAGoB,QAAU,CAH9B,6BAIe,SAAU,CAJzB,uBAKS,SAAW,eAAiB,CAAE,sCAIrC,oBAAqB,CAFvB,4CAGU,UAAY,UAAW,CAHjC,yEAIuC,YAAc,UAAW,CAJhE,mDAKiB,kBAAmB,CALpC,4EAM0C,WAAY,CAAI,gJAG0F,QAAS,CAAI,gCAEhK,mBACA,eAAgB,CAChB,wBACyB,oBAAqB,CAAI,mBAG7C,eAAiB,CADvB,+BAEkB,iBAAmB,CAFrC,wBAGW,WAAa,CAAE,gCAGR,iBAAmB,CADrC,yBAEW,WAAa,CAFxB,oCAGsB,eAAgB,CAAI,mBAGzC,6BACA,mBACA,mBAAoB,CACpB,cACe,gBAAkB,CAAE,2DAEnC,kBACA,SAAU,CACV,wBAEyB,4BAA8B,CAAE,mBAErC,eAAiB,CAAE,wCAItC,kBACA,kBAAmB,CAHrB,uCAKiB,mBAAqB,iBAAkB,CALxD,6DAQkB,aAAc,CARhC,gDAWG,YACA,kBACA,SACA,AACA,0CAA2C,CAf9C,4DAkBG,iBAAkB,CAlBrB,+DAoByB,eAAgB,CApBzC,sDAqBgB,SAAU,CArB1B,uDAsBiB,cAAgB,WAAa,kBAAoB,cAAe,CAtBjF,8DAyBE,eACA,eAAgB,CA1BlB,4DA4BsC,eAAiB,SAAU,CAAI,6BAGpE,oBACA,aAAc,CACd,8BAC+B,iBAAmB,CAAE,uCAEpD,qBACA,iBAAkB,CAClB,6CAEA,kBACA,MACA,OAAQ,CACR,gCAEA,mBACA,cAAe,CACf,wBAEA,UACA,WACA,gBACA,kBACA,gBACA,gBACA,SACA,mBACA,UAAW,CATZ,0CAYE,gBACA,AACA,qCACA,iBAAkB,CAClB,kEAGD,SACA,kBACA,kBAAmB,CACnB,iBACkB,UAAY,CAAE,iCAEhC,6BAA+B,eAAgB,CADhD,yCAGW,eAAgB,CAAI,gBAEb,YAAc,CAAE,+BACD,aAAe,CAAE,+BAEjD,YACA,eACA,aACA,YAAa,CACb,sBACuB,YAAc,CAAE,eACvB,kBAAoB,CAAE,qCACE,aAAc,eAAgB,CAAG,uDACjB,aAAe,CAAE,iBAEzE,aAAc,CACd,0DAGA,kBACA,kBACA,WAAY,CACZ,oFAGA,kBACA,kBAAmB,CACnB,gFAGA,WACA,iBAAkB,CAClB,cAEA,eAAgB,CAChB,sBAEA,WACA,sBACA,SACA,eAAgB,CAChB,4BAEA,WACD,CAAC,oBAEA,aACD,CAAC,2BAEA,aACA,iBAAkB,CAClB,uBAGA,kBACA,qBACA,WAAY,CACZ,4DAC8D,cAAgB,CAAE,eAEhF,kBACA,MACA,OACA,YACA,gBACA,kBAAmB,CACnB,0BAC2B,oBAAsB,CAAE,kBAEnD,iBAAkB,CAClB,sBAEA,gBACA,UACA,eACA,YACA,WACA,oBAAoB,CACpB,UAGA,YAAa,CACb,oCAGA,sBACA,wBAAyB,CACzB,yBAKA,aACA,cAAe,CAJhB,iDAOE,aACA,cACA,UACA,gBACA,qBACA,kBACA,WACA,gBACA,iBAAkB,CAfpB,qDAkBG,YACA,WACA,YACA,aAAc,CArBjB,4DA0BI,wBAAyB,CACzB,wBAOF,qBAAsB,CAFxB,uCAME,yBACA,4BACA,iBAAkB,CARpB,+EAWG,WACA,YACA,eAAgB,CAbnB,oDAiBG,YACA,eAAgB,CAlBnB,sDAsBG,YACA,kBACA,SACA,QAAS,CAzBZ,mCA8BE,aAAc,CA9BhB,wCAmCG,gBAAiB,CAnCpB,8CAoCW,YAAc,cAAe,CApCxC,8CAqCW,oBAAsB,qBAAuB,gBAAiB,CArCzE,oDA0CE,eAAgB,CA1ClB,2CA8CE,oBAAqB,CA9CvB,0CAmDM,kBAAmB,CAAI,0BAnD7B,uCAwDG,iBAAkB,CAxDrB,mCA4DG,kBACA,WACA,WAAY,CA9Df,mCAkEG,aACA,cAAe,CAnElB,6BAuEG,YAAa,CAvEhB,6BA2EG,aACA,cAAe,CA5ElB,6BAgFG,YAAa,CACb,CAIH,gCACC,iBAAkB,CAClB,gCAGA,kBACA,WACA,QACA,aACA,YACA,mCACA,eAAgB,CAPjB,wCAUE,kEAAmE,CAVrE,4CAaG,iBAAkB,CAClB,gEAKF,gBACA,WAAY,CACZ,YASA,oBAAqB,CANtB,kBASE,6BACA,sBACA,WACA,UACA,SACA,eAAgB,CAdlB,kBAkBE,WACA,qBACA,eACA,yBACA,sBACA,eACA,gBACA,iBACA,kBACA,iBACA,iCACA,uEACA,+BAAgC,CA9BlC,wBAiCG,cAAe,CAjClB,gCAqCG,0BACA,eACA,kBAAmB,CAvCtB,+BA2CG,0BACA,cACA,kBAAmB,CACnB,uEAKF,mBACA,qCACA,2BACA,WACA,qBACA,yFACA,iBAAkB,CAClB,mFAEA,mBACA,qBACA,UAAW,CACX,8EAEA,WACA,mBACA,qCACA,AACA,2BACA,gBAAiB,CACjB,+BAIA,gBACA,yBACA,kBACA,wDACA,kBACA,WACA,gBACA,gBAAiB,CACjB,sCAGA,gCACA,mBACA,iBAAkB,CAHnB,+CAME,eAAgB,CAChB,mFAKD,qBACA,mBAAmB,CACnB,yCAGA,gBACA,eAAgB,CAChB,uCAGA,gBACA,aACA,cACA,aACA,WACA,qBAAsB,CANvB,yCASE,UACA,QAAS,CACT,sCAID,6BACA,mBACA,kBACA,qBACA,WACA,qBAAsB,CACtB,2CAGA,UAAW,CACX,6CAGA,YACA,aACA,wBAAyB,CACzB,+BAGA,SAAU,CACV,mPAEgG,gBAAkB,eAAgB,CAAI,2BAItI,YAAa,CACb,oBAGA,aAAc,CACd,oBAGA,kBACA,cAAe,CAFhB,2BAKE,YACA,cACA,kBACA,MACA,OACA,QACA,SACA,WAAY,CAZd,iCAgBE,oBAAqB,CAhBvB,0DAqBE,WAAY,CACZ,gBAID,UAAW,CACX","file":"../sass/admin.css","sourcesContent":["@import \"../../../public/sass/util\";\r\n\r\n.border-box {\r\n\tbox-sizing: border-box;\r\n\r\n\t* {\r\n\t\tbox-sizing: border-box;\r\n\t}\r\n}\r\n\r\n.wpr-flex {\r\n\tdisplay: flex;\r\n\tflex-wrap: wrap;\r\n}\r\n\r\n.wpr-flex-wrap {\r\n\tflex-wrap: wrap;\r\n}\r\n\r\n.wpr-col-1-2 {\r\n\tflex: 0 0 50%;\r\n}\r\n\r\n.wpr-col-1-3 {\r\n\tflex: 0 0 33.33%;\r\n\tmargin-bottom: 12px;\r\n\tpadding-bottom: 12px;\r\n\r\n\tlabel {\r\n\t\tposition: relative;\r\n\t\tpadding-left: 20px;\r\n\t\tinput[type=checkbox] {\r\n\t\t\tposition: absolute;\r\n\t\t\ttop: 0;\r\n\t\t\tleft: 0;\r\n\t\t\t-webkit-box-shadow: none;\r\n\t\t\tbox-shadow: none;\r\n\t\t\toverflow: hidden;\r\n\t\t\tborder: 2px solid rgba(33,38,44,0.6);\r\n\t\t\tborder-radius: 2px;\r\n\r\n\t\t\t&:checked {\r\n\t\t\t\tborder-color: #069de3;\r\n\t\t\t\t&:before {\r\n\t\t\t\t\tline-height: 16px;\r\n\t\t\t\t\twidth: 17px;\r\n\t\t\t\t\theight: 16px;\r\n\t\t\t\t\tmargin: -2px 0 0 -5px;\r\n\t\t\t\t\tcontent: '\\f147';\r\n\t\t\t\t\ttext-align: center;\r\n\t\t\t\t\tcolor: #fff;\r\n\t\t\t\t\tborder-radius: 2px;\r\n\t\t\t\t\tbackground: #069de3;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n.wp-review {\r\n\r\n\t* {\r\n\t\tbox-sizing: border-box;\r\n\t}\r\n\r\n\tp.submit { text-align: right; }\r\n\r\n\th1 { margin-bottom: 15px; }\r\n}\r\n.wpr-flex-wrap { justify-content: space-between; }\r\n.wpr-flex-wrap .wpr-col-1-2 {\r\n\tflex: 0 0 49%;\r\n}\r\n.wpr-flex-wrap .wpr-col-1-2:last-child { float: right; }\r\n/*---------------------------\r\n * Fields\r\n *--------------------------*/\r\n.wp-review-field {\r\n\t&, * {\r\n\t\tbox-sizing: border-box;\r\n\t}\r\n\r\n\tpadding: 15px 0;\r\n\tborder-bottom: 1px dashed #ddd;\r\n\tmargin-top: 1em;\r\n\tmargin-bottom: 1em;\r\n\tborder-bottom: 1px dashed #ddd;\r\n}\r\n\r\n.postbox .wp-review-field {\r\n\tpadding: 0;\r\n\tborder-bottom: 0;\r\n}\r\n\r\n@media (min-width: 600px) {\r\n\t.wp-review-field:not(.vertical):not(.no-flex) {\r\n\t\tdisplay: flex;\r\n\t\tflex-wrap: wrap;\r\n\r\n\t\t.wp-review-field-label {\r\n\t\t\tflex: 0 0 25%;\r\n\t\t\tpadding-right: 4%;\r\n\r\n\t\t\t&.full-width {\r\n\t\t\t\tflex: 0 0 100%;\r\n\t\t\t\tpadding-right: 0;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t.wp-review-field-option {\r\n\t\t\tflex: 0 0 75%;\r\n\t\t}\r\n\r\n\t\t&.wp-review-rating-icon, &.wp-review-rating-image {\r\n\t\t\tposition: relative;\r\n\t\t\t&.hide {display: none;}\r\n\t\t\ta.wpr-toggle-rating {\r\n\t\t\t\tposition: absolute;\r\n\t\t\t\ttop: 0;\r\n\t\t\t\tright: 0;\r\n\t\t\t}\r\n\r\n\t\t\t.img-wrapper {\r\n\t\t\t\tpadding: 2px;\r\n\t\t\t\twidth: 55px;\r\n\t\t\t\theight: 55px;\r\n\t\t\t\tborder: 1px solid #ddd;\r\n\t\t\t\tposition: relative;\r\n\t\t\t\timg {\r\n\t\t\t\t\tmax-width: 100%;\r\n\t\t\t\t}\r\n\t\t\t\ti {\r\n\t\t\t\t\tposition: absolute;\r\n\t\t\t\t\ttop: -6px;\r\n\t\t\t\t\tright: -6px;\r\n\t\t\t\t\tcolor: #444;\r\n\t\t\t\t\tcursor: pointer;\r\n\t\t\t\t}\r\n\t\t\t\t&.hide { display: none; }\r\n\t\t\t}\r\n\t\t\t.set_rating_image.hide {display: none;}\r\n\t\t}\r\n\t}\r\n\r\n\t.postbox .wp-review-field {\r\n\t\t.wp-review-field-label {\r\n\t\t\tflex: 0 0 20%;\r\n\t\t}\r\n\r\n\t\t.wp-review-field-option {\r\n\t\t\tflex: 0 0 80%;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n.wpr_image_upload_field {\r\n\t.clear-image {\r\n\t\tmargin-left: 10px;\r\n\t}\r\n}\r\n\r\n/*---------------------------\r\n * Review items\r\n *--------------------------*/\r\n.wpr-star-input-wrapper {\r\n\tposition: relative;\r\n\tcolor: #c40000;\r\n\toverflow: hidden;\r\n\tdisplay: inline-block;\r\n\r\n\t.star-icon {\r\n\t\t// float: left;\r\n\t}\r\n\r\n\t.stars-bg {\r\n\t\tcolor: #ccc;\r\n\t\twhite-space: nowrap;\r\n\r\n\t\t// &:after {\r\n\t\t// content: \" \";\r\n\t\t// display: block;\r\n\t\t// clear: both;\r\n\t\t// height: 0;\r\n\t\t// visibility: hidden;\r\n\t\t// }\r\n\t}\r\n\r\n\t.stars-result {\r\n\t\twhite-space: nowrap;\r\n\t\tposition: absolute;\r\n\t\tleft: 0;\r\n\t\ttop: 0;\r\n\t\toverflow: hidden;\r\n\t}\r\n}\r\n\r\n.wpr-input-wrapper.ui-slider {\r\n\t.ui-slider-handle {\r\n\t\tbackground-color: #fff;\r\n\t\tbox-shadow: 0 0px 3px rgba(0, 0, 0, 0.4);\r\n\t\tborder-radius: 2px;\r\n\t\tcursor: pointer;\r\n\t}\r\n}\r\n\r\n/*---------------------------\r\n * Options page\r\n *--------------------------*/\r\n.wpr-vertical-tabs {\r\n\tmax-width: 880px;\r\n\tposition: relative;\r\n\r\n\t&__titles {\r\n\t\twidth: 200px;\r\n\t\tfloat: left;\r\n\t\tborder-right: 0;\r\n\t\tmargin: 0;\r\n\t\tz-index: 10;\r\n\t\tposition: absolute;\r\n\t\tleft: 0;\r\n\t\ttop: 0;\r\n\r\n\t\t&.active {\r\n\t\t\tbackground-color: #fff;\r\n\t\t}\r\n\t}\r\n\r\n\t&__title {\r\n\t\tmargin: 0;\r\n\t\tpadding: 0;\r\n\t\tposition: relative;\r\n\r\n\t\t&:first-child a { border-top: 1px solid #ccc; }\r\n\r\n\t\t&.active a {\r\n\t\t\tbackground-color: #fff;\r\n\t\t}\r\n\r\n\t\t&.active a:after {\r\n\t\t\tcontent: \"\";\r\n\t\t\twidth: 1px;\r\n\t\t\theight: 40px;\r\n\t\t\tposition: absolute;\r\n\t\t\tright: -1px;\r\n\t\t\ttop: 1px;\r\n\t\t\tbackground: #fff;\r\n\t\t\tz-index: 10;\r\n\t\t}\r\n\r\n\t\ti {\r\n\t\t\tfont-size: 18px;\r\n\t\t\tmin-width: 20px;\r\n\t\t\tmargin-right: 10px;\r\n\t\t\ttext-align: center;\r\n\t\t\tcolor: #444;\r\n\t\t}\r\n\r\n\t\ta {\r\n\t\t\tfont-size: 16px;\r\n\t\t\tdisplay: block;\r\n\t\t\t-webkit-box-sizing: border-box;\r\n\t\t\tbox-sizing: border-box;\r\n\t\t\tpadding: 11px 15px;\r\n\t\t\twhite-space: nowrap;\r\n\t\t\ttext-decoration: none;\r\n\t\t\tcolor: #555;\r\n\t\t\tborder: 1px solid #ccc;\r\n\t\t\tborder-top: 0;\r\n\t\t\tborder-right: 0;\r\n\t\t\toutline: none;\r\n\t\t\tbackground: #e5e5e5;\r\n\t\t\t-webkit-box-shadow: none;\r\n\t\t\tbox-shadow: none;\r\n\t\t}\r\n\t}\r\n\r\n\t&__contents {\r\n\t\tpadding-left: 200px;\r\n\t}\r\n\r\n\t&__content {\r\n\t\tpadding: 15px;\r\n\t\tmin-height: 400px;\r\n\t\tbackground: #fff;\r\n\t\tborder: 1px solid #ccc;\r\n\r\n\t\t> h2 { margin-top: 0; }\r\n\r\n\t\t.nav-tab-active {\r\n\t\t\tbackground-color: #fff;\r\n\t\t\tborder-bottom-color: #fff;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/*.wp-review-field { clear: both; padding-top: 0; }*/\r\n.clearfix:before, .clearfix:after { content: \" \"; display: table; }\r\n.clearfix:after { clear: both }\r\n.clearfix { *zoom: 1 }\r\n.wp_review_schema_type_options textarea {\r\n\twidth: 77%;\r\n\tmin-height: 80px;\r\n}\r\n.wp-review-field {\r\n\tselect { width: 15em; margin-left: 0; }\r\n\t#wp_review_product_price { width: 70px; }\r\n\t.wp-color-result { margin: 0 }\r\n\t.large-text { width: 77%; }\r\n\tinput { margin: 0; padding: 5px 8px }\r\n}\r\n.wp-review-field {\r\n\t.wp-picker-container {\r\n\t\tdisplay: inline-block;\r\n\t\tlabel { flex: none; width: auto; }\r\n\t\tinput[type=\"text\"].wp-color-picker { padding: 4px; width: 65px; }\r\n\t\t.iris-picker { box-sizing: initial; }\r\n\t\t.wp-picker-open+.wp-picker-input-wrap { width: 140px; }\r\n\t}\r\n}\r\n#wp-wp_review_pros-wrap textarea.wp-editor-area, #wp-wp_review_cons-wrap textarea.wp-editor-area, #wp-wp_review_desc-wrap textarea.wp-editor-area { border: 0; }\r\n.wp_review_schema_options_label{\r\n\tvertical-align: top;\r\n\tpadding-top: 5px;\r\n}\r\n.wpr_image_upload_field { display: inline-block; }\r\n\r\n.wp-review-item {\r\n\tth { text-align: left }\r\n\ttd:first-child { text-align: center }\r\n\t.handle { cursor: move }\r\n}\r\n.wp-review-links {\r\n\ttd:first-child { text-align: center }\r\n\t.handle { cursor: move }\r\n\tinput[type=\"text\"] { padding: 5px 8px; }\r\n}\r\n.has-border-bottom {\r\n\tborder-bottom: 1px solid #ddd;\r\n\tmargin-bottom: 20px;\r\n\tpadding-bottom: 20px;\r\n}\r\n.review-total { text-align: right }\r\n.wp-review-field-option:not(.pyre_field) .wp-picker-holder {\r\n\tposition: absolute;\r\n\tz-index: 9;\r\n}\r\n\r\n.review-value-incorrect { border-color: #F00 !important }\r\n\r\n#wp_review_id_hint { margin-left: 8px }\r\n\r\n.wp-review-admin-options {\r\n\t.form-table td {\r\n\t\tpadding: 20px 10px;\r\n\t\tvertical-align: top;\r\n\t}\r\n\tp.description { font-weight: normal; font-style: normal; }\r\n\t.wp-review-field {\r\n\t\t> label {\r\n\t\t\t.description { margin-left: 0; }\r\n\t\t}\r\n\t\tinput {\r\n\t\t\tpadding: 7px;\r\n\t\t\tborder-radius: 2px;\r\n\t\t\tmargin: 0;\r\n\t\t\t-webkit-box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);\r\n\t\t\tbox-shadow: inset 0 1px 3px rgba(0,0,0,0.1);\r\n\t\t}\r\n\t\tinput[type=radio] {\r\n\t\t\tborder-radius: 50%;\r\n\t\t}\r\n\t\tinput[type=checkbox] { border-radius: 0; }\r\n\t\t.large-text { width: 70%; }\r\n\t\t.description { display: block; color: #888; font-style: normal; margin-top: 5px; }\r\n\t}\r\n\t#wp_review_shortcode_hint_field span {\r\n\t\tdisplay: inline;\r\n\t\tmargin-left: 6px;\r\n\t}\r\n\t.wp-review-thumbnail-options label { margin-right: 0; width: 90%; }\r\n}\r\n.wp-review-description label {\r\n\tmargin-bottom: -20px;\r\n\tdisplay: block;\r\n}\r\n.wp-review-theme-defaults-msg { position: relative }\r\n.wp-review-theme-defaults-msg a.button {\r\n\tdisplay: inline-block;\r\n\tmargin-bottom: 8px;\r\n}\r\n.wp-review-theme-defaults-msg a.close-notice {\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tright: 0;\r\n}\r\n.edit-ratings-notice.update-nag {\r\n\tbackground: #fff9e8;\r\n\tmargin-right: 0;\r\n}\r\n#wp-review-width-slider {\r\n\twidth: 70%;\r\n\tfloat: left;\r\n\tmargin-top: 12px;\r\n\tmargin-right: 25px;\r\n\tborder-radius: 0;\r\n\tmax-width: 600px;\r\n\tborder: 0;\r\n\tbackground: #d8d8d8;\r\n\theight: 8px;\r\n\r\n\t.ui-slider-handle {\r\n\t\tbackground: #fff;\r\n\t\t-webkit-box-shadow: 0 0px 3px rgba(0, 0, 0, 0.4);\r\n\t\tbox-shadow: 0 0px 3px rgba(0, 0, 0, 0.4);\r\n\t\tborder-radius: 2px;\r\n\t}\r\n}\r\n#wp-review-width-slider.ui-slider-horizontal .ui-slider-range-min {\r\n\tborder: 0;\r\n\tborder-radius: 2px;\r\n\tbackground: #0184bb;\r\n}\r\n#wp_review_width { width: 60px }\r\n.wrap.wp-review .nav-tab-wrapper {\r\n\tborder-bottom: 1px solid #ccc; margin-top: 16px;\r\n\r\n\ta:focus { box-shadow: none; }\r\n}\r\n.nav-tab-hidden { display: none }\r\n.nav-tab-hidden.nav-tab-active { display: block }\r\ntextarea#wp-review-migrate-log {\r\n\twidth: 600px;\r\n\tmax-width: 100%;\r\n\theight: 200px;\r\n\tdisplay: none;\r\n}\r\n.already-migrated-msg { display: none }\r\n#start-migrate { margin-bottom: 12px }\r\n#wp-review-settings-tab-contents > div { display: none;max-width: 900px;}\r\n#wp-review-settings-tab-contents .settings-tab-general { display: block }\r\n.pros-cons-title {\r\n\tmax-width: 25%;\r\n}\r\n.column-wp_review_rating,\r\n.column-wp_review_comment_rating {\r\n\ttext-align: center;\r\n\tposition: relative;\r\n\twidth: 110px;\r\n}\r\n.column-wp_review_rating .review-star,\r\n.column-wp_review_comment_rating .review-star {\r\n\tposition: relative;\r\n\tletter-spacing: 1px;\r\n}\r\n.column-wp_review_rating .no-rating,\r\n.column-wp_review_comment_rating .no-rating {\r\n\tcolor: #aaa;\r\n\tfont-style: italic;\r\n}\r\n#editwpreview {\r\n\toverflow: hidden;\r\n}\r\n#editwpreview .inside {\r\n\tfloat: left;\r\n\tpadding: 3px 0 2px 5px;\r\n\tmargin: 0;\r\n\ttext-align: left;\r\n}\r\n#editwpreview .inside input {\r\n\twidth: 180px\r\n}\r\n#editwpreview label {\r\n\tpadding: 2px 0\r\n}\r\nh4.wp-review-comment-title {\r\n\tmargin-top: 0;\r\n\tmargin-bottom: 1em;\r\n}\r\n\r\n.review-result-wrapper {\r\n\tposition: relative;\r\n\tdisplay: inline-block;\r\n\tfont-size: 0;\r\n}\r\n.postbox .review-result-wrapper a, .postbox .review-result i { cursor: pointer }\r\n.review-result {\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\theight: 22px;\r\n\toverflow: hidden;\r\n\twhite-space: nowrap;\r\n}\r\n.wp-review-rating-feature { display: inline-block }\r\n.wp-review-notice {\r\n\tposition: relative;\r\n}\r\n.wpr_image_upload_img {\r\n\tmargin:0 0 10px;\r\n\tpadding:0;\r\n\tmax-width:100%;\r\n\theight:auto;\r\n\tfloat:left;\r\n\tdisplay:inline-block;\r\n}\r\n\r\n.wpr-hide {\r\n\tdisplay: none;\r\n}\r\n\r\n.wpr-tabs .tab-title.nav-tab-active {\r\n\tbackground-color: #fff;\r\n\tborder-bottom-color: #fff;\r\n}\r\n\r\n.wpr-box-template-images {\r\n\t@extend .border-box;\r\n\r\n\tdisplay: flex;\r\n\tflex-wrap: wrap;\r\n\r\n\t.wpr-box-template-image {\r\n\t\tflex: 0 0 50%;\r\n\t\tdisplay: block;\r\n\t\toutline: 0;\r\n\t\tbox-shadow: none;\r\n\t\ttext-decoration: none;\r\n\t\ttext-align: center;\r\n\t\tcolor: #333;\r\n\t\tfont-weight: 700;\r\n\t\tmargin-bottom: 5px;\r\n\r\n\t\timg {\r\n\t\t\tpadding: 4px;\r\n\t\t\twidth: 100%;\r\n\t\t\theight: auto;\r\n\t\t\tdisplay: block;\r\n\t\t}\r\n\r\n\t\t&.active {\r\n\t\t\timg {\r\n\t\t\t\tbackground-color: #0073aa;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n#wpr-review-items-app {\r\n\t* {\r\n\t\tbox-sizing: border-box;\r\n\t}\r\n\r\n\t.wpr-review-item {\r\n\t\tbackground-color: #f7f7f7;\r\n\t\tpadding: 10px 10px 10px 30px;\r\n\t\tmargin-bottom: 5px;\r\n\r\n\t\t.setting-row:first-of-type .col-2 input {\r\n\t\t\twidth: 100%;\r\n\t\t\tpadding: 5px;\r\n\t\t\tbackground: #fff;\r\n\t\t}\r\n\r\n\t\t.col-3 input {\r\n\t\t\tfloat: right;\r\n\t\t\tbackground: #fff;\r\n\t\t}\r\n\r\n\t\t.wpr-icon-move {\r\n\t\t\tcursor: move;\r\n\t\t\tposition: absolute;\r\n\t\t\tleft: 5px;\r\n\t\t\ttop: 16px;\r\n\t\t}\r\n\t}\r\n\r\n\t.setting-row {\r\n\t\tpadding: 5px 0;\r\n\t}\r\n\r\n\t.final-row {\r\n\t\t.col-3 {\r\n\t\t\ttext-align: right;\r\n\t\t\tinput { float: right; min-width: 52px; }\r\n\t\t\tlabel { margin: 4px 10px 0 0; display: inline-block; font-weight: bold; }\r\n\t\t}\r\n\t}\r\n\r\n\t.wpr-percentage-input-wrapper {\r\n\t\tmargin-top: 10px;\r\n\t}\r\n\r\n\t.wp-picker-container {\r\n\t\tdisplay: inline-block;\r\n\t}\r\n\r\n\r\n\t.wp-picker-holder {\r\n\t\t* { box-sizing: initial; }\r\n\t}\r\n\r\n\t@media (min-width: 768px) {\r\n\t\t.wpr-review-item {\r\n\t\t\tposition: relative;\r\n\t\t}\r\n\r\n\t\t.delete-item {\r\n\t\t\tposition: absolute;\r\n\t\t\tright: 10px;\r\n\t\t\tbottom: 10px;\r\n\t\t}\r\n\r\n\t\t.setting-row {\r\n\t\t\tdisplay: flex;\r\n\t\t\tflex-wrap: wrap;\r\n\t\t}\r\n\r\n\t\t.col-1 {\r\n\t\t\tflex: 0 0 20%;\r\n\t\t}\r\n\r\n\t\t.col-2 {\r\n\t\t\tflex: 0 0 60%;\r\n\t\t\tpadding: 0 10px;\r\n\t\t}\r\n\r\n\t\t.col-3 {\r\n\t\t\tflex: 0 0 20%;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n#wp_review_box_template_wrapper {\r\n\tposition: relative;\r\n}\r\n\r\n#wp_review_box_template_preview {\r\n\tposition: absolute;\r\n\tleft: 250px;\r\n\ttop: 0px;\r\n\tz-index: 1000;\r\n\tpadding: 3px;\r\n\tbox-shadow: 0 0 3px rgba(0, 0, 0, 0.2);\r\n\tbackground: #fff;\r\n\r\n\t&.loading {\r\n\t\tbackground: #eee url(../images/loading.svg) no-repeat center center;\r\n\r\n\t\timg {\r\n\t\t\tvisibility: hidden;\r\n\t\t}\r\n\t}\r\n}\r\n#wp_review_box_template_img,\r\n#wp_review_box_template_preview_img {\r\n\tmax-width: 414px;\r\n\theight: auto;\r\n}\r\n\r\n// Form fields\r\n.wpr-switch {\r\n\t$border-radius: 3px; // Default 4px\r\n\t$font-size: 12px; // Default 14px\r\n\t$button-width: 45px; // Default 50px\r\n\t$height: 28px;\r\n\r\n\tdisplay: inline-block;\r\n\r\n\tinput {\r\n\t\tposition: absolute !important;\r\n\t\tclip: rect(0, 0, 0, 0);\r\n\t\theight: 1px;\r\n\t\twidth: 1px;\r\n\t\tborder: 0;\r\n\t\toverflow: hidden;\r\n\t}\r\n\r\n\tlabel {\r\n\t\tfloat: left;\r\n\t\tdisplay: inline-block;\r\n\t\tmin-width: $button-width;\r\n\t\tbackground-color: #e4e4e4;\r\n\t\tcolor: rgba(0, 0, 0, 0.6);\r\n\t\tfont-size: $font-size;\r\n\t\tfont-weight: 700;\r\n\t\tline-height: $height;\r\n\t\ttext-align: center;\r\n\t\ttext-shadow: none;\r\n\t\tborder: 1px solid rgba(0, 0, 0, 0.2);\r\n\t\tbox-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);\r\n\t\ttransition: all 0.1s ease-in-out;\r\n\r\n\t\t&:hover {\r\n\t\t\tcursor: pointer;\r\n\t\t}\r\n\r\n\t\t&:first-of-type {\r\n\t\t\tborder-radius: $border-radius 0 0 $border-radius;\r\n\t\t\tborder-right: 0;\r\n\t\t\tfont-weight: normal;\r\n\t\t}\r\n\r\n\t\t&:last-of-type {\r\n\t\t\tborder-radius: 0 $border-radius $border-radius 0;\r\n\t\t\tborder-left: 0;\r\n\t\t\tfont-weight: normal;\r\n\t\t}\r\n\t}\r\n}\r\n\r\ninput.wpr-switch__on:checked + label, input.wpr-switch__off:checked + label {\r\n\tbackground: #0085ba;\r\n\tborder-color: #0073aa #006799 #006799;\r\n\tbox-shadow: 0 1px 0 #006799;\r\n\tcolor: #fff;\r\n\ttext-decoration: none;\r\n\ttext-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;\r\n\tmargin-bottom: 2px;\r\n}\r\ninput.wpr-switch__on:checked + label:hover, input.wpr-switch__off:checked + label:hover {\r\n\tbackground: #008ec2;\r\n\tborder-color: #006799;\r\n\tcolor: #fff;\r\n}\r\ninput.wpr-switch__off:checked + label, input.wpr-switch__off:checked + label:hover {\r\n\tcolor: #fff;\r\n\tbackground: #f5786f;\r\n\tborder-color: #bd4c44 #bd4c44 #bd4c44;\r\n\t-webkit-box-shadow: 0 1px 0 #bd4c44;\r\n\tbox-shadow: 0 1px 0 #bd4c44;\r\n\ttext-shadow: none;\r\n}\r\n\r\n// Demo importer popup\r\n#wp-review-demo-importer-popup {\r\n\tbackground: #fff;\r\n\tborder: 1px solid #eaeaeb;\r\n\tborder-radius: 3px;\r\n\tbox-shadow: 0 1px 0 #FFF inset, 0 1px 5px rgba(0, 0, 0, 0.1);\r\n\tposition: relative;\r\n\twidth: auto;\r\n\tmax-width: 600px;\r\n\tmargin: 50px auto;\r\n}\r\n\r\n#wp-review-demo-importer-modal-header {\r\n\tborder-bottom: 1px solid #eaeaeb;\r\n\tbackground: #FAFBFD;\r\n\tpadding: 12px 20px;\r\n\r\n\t.spinner {\r\n\t\tmargin-top: 14px;\r\n\t}\r\n}\r\n\r\n#wp-review-demo-importer-modal-header h2,\r\n#wp-review-demo-importer-modal-content h4 {\r\n\tpadding: 0!important;\r\n\tmargin: 0!important;\r\n}\r\n\r\n#wp-review-demo-importer-modal-header h2 {\r\n\tfont-size: 1.8em;\r\n\tline-height: 2em;\r\n}\r\n\r\n#wp-review-demo-importer-modal-content {\r\n\tbackground: #fff;\r\n\tpadding: 20px;\r\n\toverflow: auto;\r\n\theight: 300px;\r\n\twidth: 100%;\r\n\tbox-sizing: border-box;\r\n\r\n\tp {\r\n\t\tpadding: 0;\r\n\t\tmargin: 0;\r\n\t}\r\n}\r\n\r\n#wp-review-demo-importer-modal-footer {\r\n\tborder-top: 1px solid #eaeaeb;\r\n\tbackground: #FAFBFD;\r\n\tpadding: 12px 20px;\r\n\tdisplay: inline-block;\r\n\twidth: 100%;\r\n\tbox-sizing: border-box;\r\n}\r\n\r\n#wp-review-demo-importer-modal-footer-info {\r\n\tfloat: left;\r\n}\r\n\r\n#wp-review-demo-importer-modal-footer-button {\r\n\tfloat: right;\r\n\tdisplay: none;\r\n\ttext-transform: uppercase;\r\n}\r\n\r\n.wp-admin select.mce-selectbox {\r\n\tpadding: 0;\r\n}\r\n#wp-review-metabox-userReview .inside > {\r\n\tp:first-of-type label, p:nth-of-type(2) label, p:nth-of-type(3) label, p:nth-of-type(4) label { padding-right: 0; margin-left: 5px; }\r\n}\r\n\r\n.wp-review-subsite-wrapper {\r\n\tdisplay: none;\r\n}\r\n\r\n.wp-review-pro-text {\r\n\tcolor: #00cc66;\r\n}\r\n\r\n.wp-review-disabled {\r\n\tposition: relative;\r\n\tcursor: pointer;\r\n\r\n\t&:before {\r\n\t\tcontent: \" \";\r\n\t\tdisplay: block;\r\n\t\tposition: absolute;\r\n\t\ttop: 0;\r\n\t\tleft: 0;\r\n\t\tright: 0;\r\n\t\tbottom: 0;\r\n\t\tz-index: 100;\r\n\t}\r\n\r\n\t&.inline-block {\r\n\t\tdisplay: inline-block;\r\n\t}\r\n\r\n\t&.wpr-switch,\r\n\t&.has-bg {\r\n\t\topacity: 0.3;\r\n\t}\r\n}\r\n\r\noption.disabled {\r\n\tcolor: #aaa;\r\n}\r\n"]}
 
admin/class-wp-review-form-field.php CHANGED
@@ -1,57 +1,57 @@
1
- <?php
2
- /**
3
- * Form fields
4
- *
5
- * @package WP_Review
6
- * @since 3.0.0
7
- */
8
-
9
- /**
10
- * Class WP_Review_Form_Field
11
- */
12
- class WP_Review_Form_Field {
13
-
14
- /**
15
- * Renders switch field.
16
- *
17
- * @param array $args Field arguments.
18
- * @return string
19
- */
20
- public function render_switch( array $args = array() ) {
21
- $args = wp_parse_args(
22
- $args,
23
- array(
24
- 'id' => '',
25
- 'class' => '',
26
- 'name' => '',
27
- 'on_label' => _x( 'Yes', 'switch label', 'wp-review' ),
28
- 'off_label' => _x( 'No', 'switch label', 'wp-review' ),
29
- 'value' => 0,
30
- 'echo' => true,
31
- 'disabled' => false,
32
- )
33
- );
34
-
35
- $switch_id = $args['id'] ? $args['id'] : 'wpr-switch-' . mt_rand( 100, 999 );
36
- $switch_name = $args['name'] ? $args['name'] : $switch_id;
37
- $value = intval( $args['value'] );
38
-
39
- if ( $args['disabled'] ) {
40
- $args['class'] .= ' wp-review-disabled';
41
- }
42
- ob_start();
43
- ?>
44
- <div id="<?php echo esc_attr( $switch_id ); ?>" class="wpr-switch <?php echo esc_attr( $args['class'] ); ?>">
45
- <input type="radio" id="<?php echo esc_attr( $switch_id ); ?>-on" name="<?php echo esc_attr( $switch_name ); ?>" class="wpr-switch__on" value="1" <?php checked( $value, 1 ); ?>>
46
- <label for="<?php echo esc_attr( $switch_id ); ?>-on" class="button button-secondary"><?php echo esc_html( $args['on_label'] ); ?></label>
47
- <input type="radio" id="<?php echo esc_attr( $switch_id ); ?>-off" name="<?php echo esc_attr( $switch_name ); ?>" value="0" class="wpr-switch__off" <?php checked( $value, 0 ); ?>>
48
- <label for="<?php echo esc_attr( $switch_id ); ?>-off" class="button button-secondary"><?php echo esc_html( $args['off_label'] ); ?></label>
49
- </div>
50
- <?php
51
- $output = ob_get_clean();
52
- if ( ! $args['echo'] ) {
53
- return $output;
54
- }
55
- echo $output;
56
- }
57
- }
1
+ <?php
2
+ /**
3
+ * Form fields
4
+ *
5
+ * @package WP_Review
6
+ * @since 3.0.0
7
+ */
8
+
9
+ /**
10
+ * Class WP_Review_Form_Field
11
+ */
12
+ class WP_Review_Form_Field {
13
+
14
+ /**
15
+ * Renders switch field.
16
+ *
17
+ * @param array $args Field arguments.
18
+ * @return string
19
+ */
20
+ public function render_switch( array $args = array() ) {
21
+ $args = wp_parse_args(
22
+ $args,
23
+ array(
24
+ 'id' => '',
25
+ 'class' => '',
26
+ 'name' => '',
27
+ 'on_label' => _x( 'Yes', 'switch label', 'wp-review' ),
28
+ 'off_label' => _x( 'No', 'switch label', 'wp-review' ),
29
+ 'value' => 0,
30
+ 'echo' => true,
31
+ 'disabled' => false,
32
+ )
33
+ );
34
+
35
+ $switch_id = $args['id'] ? $args['id'] : 'wpr-switch-' . mt_rand( 100, 999 );
36
+ $switch_name = $args['name'] ? $args['name'] : $switch_id;
37
+ $value = intval( $args['value'] );
38
+
39
+ if ( $args['disabled'] ) {
40
+ $args['class'] .= ' wp-review-disabled';
41
+ }
42
+ ob_start();
43
+ ?>
44
+ <div id="<?php echo esc_attr( $switch_id ); ?>" class="wpr-switch <?php echo esc_attr( $args['class'] ); ?>">
45
+ <input type="radio" id="<?php echo esc_attr( $switch_id ); ?>-on" name="<?php echo esc_attr( $switch_name ); ?>" class="wpr-switch__on" value="1" <?php checked( $value, 1 ); ?>>
46
+ <label for="<?php echo esc_attr( $switch_id ); ?>-on" class="button button-secondary"><?php echo esc_html( $args['on_label'] ); ?></label>
47
+ <input type="radio" id="<?php echo esc_attr( $switch_id ); ?>-off" name="<?php echo esc_attr( $switch_name ); ?>" value="0" class="wpr-switch__off" <?php checked( $value, 0 ); ?>>
48
+ <label for="<?php echo esc_attr( $switch_id ); ?>-off" class="button button-secondary"><?php echo esc_html( $args['off_label'] ); ?></label>
49
+ </div>
50
+ <?php
51
+ $output = ob_get_clean();
52
+ if ( ! $args['echo'] ) {
53
+ return $output;
54
+ }
55
+ echo $output;
56
+ }
57
+ }
admin/class-wp-review-importer.php CHANGED
@@ -1,57 +1,57 @@
1
- <?php
2
- /**
3
- * Review importer
4
- *
5
- * @package WP_Review
6
- */
7
-
8
- defined( 'ABSPATH' ) || exit;
9
-
10
- /**
11
- * Class WP_Review_Importer
12
- */
13
- class WP_Review_Importer {
14
-
15
- /**
16
- * The number of posts to import per request.
17
- *
18
- * @var int
19
- */
20
- private $numposts;
21
-
22
- /**
23
- * WP_Review_Importer constructor.
24
- */
25
- public function __construct() {
26
- add_action( 'wp_ajax_wp_review_import_options', array( $this, 'import_options' ) );
27
- add_action( 'init', array( $this, 'extra_tasks' ) );
28
-
29
- $this->numposts = apply_filters( 'wp_review_import_numposts', 10 );
30
- }
31
-
32
- /**
33
- * AJAX handler for importing options.
34
- */
35
- public function import_options() {
36
- check_ajax_referer( 'wp-review-import-options' );
37
- if ( empty( $_POST['code'] ) ) {
38
- wp_send_json_error();
39
- }
40
- $code = wp_unslash( $_POST['code'] );
41
- if ( wp_review_import_options( $code ) ) {
42
- wp_send_json_success();
43
- }
44
- wp_send_json_error();
45
- }
46
-
47
- /**
48
- * Runs extra tasks.
49
- */
50
- public function extra_tasks() {
51
- if ( ! function_exists( 'Display_Select_Review' ) ) {
52
- add_shortcode( 'select-review', '__return_empty_string' );
53
- }
54
- }
55
- }
56
-
57
- $plugin_importer = new WP_Review_Importer();
1
+ <?php
2
+ /**
3
+ * Review importer
4
+ *
5
+ * @package WP_Review
6
+ */
7
+
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
+ /**
11
+ * Class WP_Review_Importer
12
+ */
13
+ class WP_Review_Importer {
14
+
15
+ /**
16
+ * The number of posts to import per request.
17
+ *
18
+ * @var int
19
+ */
20
+ private $numposts;
21
+
22
+ /**
23
+ * WP_Review_Importer constructor.
24
+ */
25
+ public function __construct() {
26
+ add_action( 'wp_ajax_wp_review_import_options', array( $this, 'import_options' ) );
27
+ add_action( 'init', array( $this, 'extra_tasks' ) );
28
+
29
+ $this->numposts = apply_filters( 'wp_review_import_numposts', 10 );
30
+ }
31
+
32
+ /**
33
+ * AJAX handler for importing options.
34
+ */
35
+ public function import_options() {
36
+ check_ajax_referer( 'wp-review-import-options' );
37
+ if ( empty( $_POST['code'] ) ) {
38
+ wp_send_json_error();
39
+ }
40
+ $code = wp_unslash( $_POST['code'] );
41
+ if ( wp_review_import_options( $code ) ) {
42
+ wp_send_json_success();
43
+ }
44
+ wp_send_json_error();
45
+ }
46
+
47
+ /**
48
+ * Runs extra tasks.
49
+ */
50
+ public function extra_tasks() {
51
+ if ( ! function_exists( 'Display_Select_Review' ) ) {
52
+ add_shortcode( 'select-review', '__return_empty_string' );
53
+ }
54
+ }
55
+ }
56
+
57
+ $plugin_importer = new WP_Review_Importer();
admin/class-wp-review-options.php CHANGED
@@ -1,200 +1,200 @@
1
- <?php
2
- /**
3
- * Options page
4
- *
5
- * @package WP_Review
6
- */
7
-
8
- /**
9
- * Class WP_Review_Options
10
- */
11
- class WP_Review_Options {
12
-
13
- /**
14
- * Page hook.
15
- *
16
- * @var string
17
- */
18
- protected $hook;
19
-
20
-
21
- /**
22
- * Class init.
23
- */
24
- public function init() {
25
- add_action( 'admin_menu', array( $this, 'register_menu' ) );
26
- add_action( 'admin_init', array( $this, 'register_settings' ) );
27
- }
28
-
29
- /**
30
- * Registers admin menu.
31
- */
32
- public function register_menu() {
33
-
34
- $hide = wp_review_network_option( 'hide_global_options_' );
35
-
36
- if ( ! $hide ) {
37
- $this->hook = add_options_page(
38
- __( 'WP Review', 'wp-review' ),
39
- __( 'WP Review', 'wp-review' ),
40
- 'wp_review_global_options',
41
- 'wp-review/admin/options.php',
42
- array( $this, 'render' )
43
- );
44
-
45
- add_action( "load-{$this->hook}", array( $this, 'load' ) );
46
- }
47
-
48
- }
49
-
50
- /**
51
- * Runs some functions on page load.
52
- */
53
- public function load() {
54
- add_filter( 'admin_body_class', array( $this, 'admin_body_classes' ) );
55
- }
56
-
57
- /**
58
- * Adds classes to body tag.
59
- *
60
- * @param string $classes Body classes.
61
- * @return string
62
- */
63
- public function admin_body_classes( $classes ) {
64
- $classes .= ' wp-review-admin-options';
65
- return $classes;
66
- }
67
-
68
- /**
69
- * Registers settings.
70
- */
71
- public function register_settings() {
72
- register_setting( 'wpreview-settings-group', 'wp_review_options' );
73
- }
74
-
75
- /**
76
- * Gets options page tabs.
77
- *
78
- * @return array
79
- */
80
- protected function get_tabs() {
81
- $tabs_content = array(
82
- 'review' => array(
83
- 'title' => __( 'Global', 'wp-review' ),
84
- 'icon' => 'cogs',
85
- 'capability' => 'wp_review_global_options',
86
- 'multisite_enabled' => 'hide_global_options_',
87
- ),
88
- 'popup' => array(
89
- 'title' => __( 'Popup', 'wp-review' ),
90
- 'icon' => 'sticky-note',
91
- 'capability' => 'manage_options',
92
- 'multisite_enabled' => 'hide_general_popup_',
93
- ),
94
- 'hello-bar' => array(
95
- 'title' => __( 'Notification Bar', 'wp-review' ),
96
- 'icon' => 'warning',
97
- 'capability' => 'manage_options',
98
- 'multisite_enabled' => 'hide_general_bar_',
99
- ),
100
- 'yelp' => array(
101
- 'title' => __( 'Yelp Reviews', 'wp-review' ),
102
- 'icon' => 'yelp',
103
- 'capability' => 'manage_options',
104
- 'multisite_enabled' => 'hide_yelp_reviews_',
105
- ),
106
- 'google' => array(
107
- 'title' => __( 'Google Reviews', 'wp-review' ),
108
- 'icon' => 'google',
109
- 'capability' => 'manage_options',
110
- 'multisite_enabled' => 'hide_google_reviews_',
111
- ),
112
- 'facebook' => array(
113
- 'title' => __( 'Facebook Reviews', 'wp-review' ),
114
- 'icon' => 'facebook',
115
- 'capability' => 'manage_options',
116
- 'multisite_enabled' => 'hide_facebook_reviews_',
117
- ),
118
- 'role-manager' => array(
119
- 'title' => __( 'Role Manager', 'wp-review' ),
120
- 'icon' => 'user',
121
- 'capability' => 'administrator',
122
- 'multisite_enabled' => 'hide_role_manager_',
123
- ),
124
- 'import' => array(
125
- 'title' => __( 'Import Reviews', 'wp-review' ),
126
- 'icon' => 'download',
127
- 'capability' => 'wp_review_import_reviews',
128
- 'multisite_enabled' => 'hide_import_',
129
- ),
130
- 'help' => array(
131
- 'title' => __( 'Help', 'wp-review' ),
132
- 'icon' => 'question-circle',
133
- 'capability' => 'manage_options',
134
- 'multisite_enabled' => 'hide_help_',
135
- ),
136
- );
137
-
138
- $tabs = array();
139
-
140
- foreach ( $tabs_content as $key => $tab ) {
141
- $hide = wp_review_network_option( $tab['multisite_enabled'] );
142
- if ( current_user_can( $tab['capability'] ) && ! $hide ) {
143
- $tabs[] = array(
144
- 'id' => $key,
145
- 'title' => $tab['title'],
146
- 'icon' => 'fa fa-' . $tab['icon'],
147
- 'view' => WP_REVIEW_ADMIN . 'options/' . $key . '.php',
148
- );
149
- }
150
- }
151
-
152
- if ( is_multisite() && is_main_site() && current_user_can( 'administrator' ) ) {
153
- $tabs[] = array(
154
- 'id' => 'multisite_settings',
155
- 'title' => __( 'Multisite Settings', 'wp-review' ),
156
- 'icon' => 'fa fa-sitemap',
157
- 'view' => WP_REVIEW_ADMIN . 'options/multisite.php',
158
- );
159
- }
160
- return $tabs;
161
- }
162
-
163
- /**
164
- * Renders page content.
165
- */
166
- public function render() {
167
- $tabs = $this->get_tabs();
168
- ?>
169
- <div class="wrap wp-review">
170
- <h1><?php esc_html_e( 'WP Review Settings', 'wp-review' ); ?></h1>
171
-
172
- <form method="post" action="options.php">
173
- <?php settings_fields( 'wpreview-settings-group' ); ?>
174
-
175
- <div id="wpr-global-options" class="wpr-vertical-tabs" data-vertical-tabs>
176
- <ul class="wpr-vertical-tabs__titles">
177
- <?php foreach ( $tabs as $tab ) : ?>
178
- <li class="wpr-vertical-tabs__title"><a href="#<?php echo esc_attr( $tab['id'] ); ?>" data-tab-title><i class="<?php echo esc_html( $tab['icon'] ); ?>"></i> <?php echo esc_html( $tab['title'] ); ?></a></li>
179
- <?php endforeach; ?>
180
- </ul>
181
-
182
- <div class="wpr-vertical-tabs__contents">
183
- <?php foreach ( $tabs as $tab ) : ?>
184
- <div id="<?php echo esc_attr( $tab['id'] ); ?>" class="wpr-vertical-tabs__content" data-tab-content>
185
- <h2><?php echo esc_html( $tab['title'] ); ?></h2>
186
-
187
- <?php include $tab['view']; ?>
188
- </div>
189
- <?php endforeach; ?>
190
- </div>
191
- <?php submit_button(); ?>
192
- </div>
193
- </form>
194
- </div>
195
- <?php
196
- }
197
- }
198
-
199
- $options_page = new WP_Review_Options();
200
- $options_page->init();
1
+ <?php
2
+ /**
3
+ * Options page
4
+ *
5
+ * @package WP_Review
6
+ */
7
+
8
+ /**
9
+ * Class WP_Review_Options
10
+ */
11
+ class WP_Review_Options {
12
+
13
+ /**
14
+ * Page hook.
15
+ *
16
+ * @var string
17
+ */
18
+ protected $hook;
19
+
20
+
21
+ /**
22
+ * Class init.
23
+ */
24
+ public function init() {
25
+ add_action( 'admin_menu', array( $this, 'register_menu' ) );
26
+ add_action( 'admin_init', array( $this, 'register_settings' ) );
27
+ }
28
+
29
+ /**
30
+ * Registers admin menu.
31
+ */
32
+ public function register_menu() {
33
+
34
+ $hide = wp_review_network_option( 'hide_global_options_' );
35
+
36
+ if ( ! $hide ) {
37
+ $this->hook = add_options_page(
38
+ __( 'WP Review', 'wp-review' ),
39
+ __( 'WP Review', 'wp-review' ),
40
+ 'wp_review_global_options',
41
+ 'wp-review/admin/options.php',
42
+ array( $this, 'render' )
43
+ );
44
+
45
+ add_action( "load-{$this->hook}", array( $this, 'load' ) );
46
+ }
47
+
48
+ }
49
+
50
+ /**
51
+ * Runs some functions on page load.
52
+ */
53
+ public function load() {
54
+ add_filter( 'admin_body_class', array( $this, 'admin_body_classes' ) );
55
+ }
56
+
57
+ /**
58
+ * Adds classes to body tag.
59
+ *
60
+ * @param string $classes Body classes.
61
+ * @return string
62
+ */
63
+ public function admin_body_classes( $classes ) {
64
+ $classes .= ' wp-review-admin-options';
65
+ return $classes;
66
+ }
67
+
68
+ /**
69
+ * Registers settings.
70
+ */
71
+ public function register_settings() {
72
+ register_setting( 'wpreview-settings-group', 'wp_review_options' );
73
+ }
74
+
75
+ /**
76
+ * Gets options page tabs.
77
+ *
78
+ * @return array
79
+ */
80
+ protected function get_tabs() {
81
+ $tabs_content = array(
82
+ 'review' => array(
83
+ 'title' => __( 'Global', 'wp-review' ),
84
+ 'icon' => 'cogs',
85
+ 'capability' => 'wp_review_global_options',
86
+ 'multisite_enabled' => 'hide_global_options_',
87
+ ),
88
+ 'popup' => array(
89
+ 'title' => __( 'Popup', 'wp-review' ),
90
+ 'icon' => 'sticky-note',
91
+ 'capability' => 'manage_options',
92
+ 'multisite_enabled' => 'hide_general_popup_',
93
+ ),
94
+ 'hello-bar' => array(
95
+ 'title' => __( 'Notification Bar', 'wp-review' ),
96
+ 'icon' => 'warning',
97
+ 'capability' => 'manage_options',
98
+ 'multisite_enabled' => 'hide_general_bar_',
99
+ ),
100
+ 'yelp' => array(
101
+ 'title' => __( 'Yelp Reviews', 'wp-review' ),
102
+ 'icon' => 'yelp',
103
+ 'capability' => 'manage_options',
104
+ 'multisite_enabled' => 'hide_yelp_reviews_',
105
+ ),
106
+ 'google' => array(
107
+ 'title' => __( 'Google Reviews', 'wp-review' ),
108
+ 'icon' => 'google',
109
+ 'capability' => 'manage_options',
110
+ 'multisite_enabled' => 'hide_google_reviews_',
111
+ ),
112
+ 'facebook' => array(
113
+ 'title' => __( 'Facebook Reviews', 'wp-review' ),
114
+ 'icon' => 'facebook',
115
+ 'capability' => 'manage_options',
116
+ 'multisite_enabled' => 'hide_facebook_reviews_',
117
+ ),
118
+ 'role-manager' => array(
119
+ 'title' => __( 'Role Manager', 'wp-review' ),
120
+ 'icon' => 'user',
121
+ 'capability' => 'administrator',
122
+ 'multisite_enabled' => 'hide_role_manager_',
123
+ ),
124
+ 'import' => array(
125
+ 'title' => __( 'Import Reviews', 'wp-review' ),
126
+ 'icon' => 'download',
127
+ 'capability' => 'wp_review_import_reviews',
128
+ 'multisite_enabled' => 'hide_import_',
129
+ ),
130
+ 'help' => array(
131
+ 'title' => __( 'Help', 'wp-review' ),
132
+ 'icon' => 'question-circle',
133
+ 'capability' => 'manage_options',
134
+ 'multisite_enabled' => 'hide_help_',
135
+ ),
136
+ );
137
+
138
+ $tabs = array();
139
+
140
+ foreach ( $tabs_content as $key => $tab ) {
141
+ $hide = wp_review_network_option( $tab['multisite_enabled'] );
142
+ if ( current_user_can( $tab['capability'] ) && ! $hide ) {
143
+ $tabs[] = array(
144
+ 'id' => $key,
145
+ 'title' => $tab['title'],
146
+ 'icon' => 'fa fa-' . $tab['icon'],
147
+ 'view' => WP_REVIEW_ADMIN . 'options/' . $key . '.php',
148
+ );
149
+ }
150
+ }
151
+
152
+ if ( is_multisite() && is_main_site() && current_user_can( 'administrator' ) ) {
153
+ $tabs[] = array(
154
+ 'id' => 'multisite_settings',
155
+ 'title' => __( 'Multisite Settings', 'wp-review' ),
156
+ 'icon' => 'fa fa-sitemap',
157
+ 'view' => WP_REVIEW_ADMIN . 'options/multisite.php',
158
+ );
159
+ }
160
+ return $tabs;
161
+ }
162
+
163
+ /**
164
+ * Renders page content.
165
+ */
166
+ public function render() {
167
+ $tabs = $this->get_tabs();
168
+ ?>
169
+ <div class="wrap wp-review">
170
+ <h1><?php esc_html_e( 'WP Review Settings', 'wp-review' ); ?></h1>
171
+
172
+ <form method="post" action="options.php">
173
+ <?php settings_fields( 'wpreview-settings-group' ); ?>
174
+
175
+ <div id="wpr-global-options" class="wpr-vertical-tabs" data-vertical-tabs>
176
+ <ul class="wpr-vertical-tabs__titles">
177
+ <?php foreach ( $tabs as $tab ) : ?>
178
+ <li class="wpr-vertical-tabs__title"><a href="#<?php echo esc_attr( $tab['id'] ); ?>" data-tab-title><i class="<?php echo esc_html( $tab['icon'] ); ?>"></i> <?php echo esc_html( $tab['title'] ); ?></a></li>
179
+ <?php endforeach; ?>
180
+ </ul>
181
+
182
+ <div class="wpr-vertical-tabs__contents">
183
+ <?php foreach ( $tabs as $tab ) : ?>
184
+ <div id="<?php echo esc_attr( $tab['id'] ); ?>" class="wpr-vertical-tabs__content" data-tab-content>
185
+ <h2><?php echo esc_html( $tab['title'] ); ?></h2>
186
+
187
+ <?php include $tab['view']; ?>
188
+ </div>
189
+ <?php endforeach; ?>
190
+ </div>
191
+ <?php submit_button(); ?>
192
+ </div>
193
+ </form>
194
+ </div>
195
+ <?php
196
+ }
197
+ }
198
+
199
+ $options_page = new WP_Review_Options();
200
+ $options_page->init();
admin/demo-importer.php CHANGED
@@ -1,55 +1,55 @@
1
- <?php
2
- /**
3
- * Demo importer feature
4
- *
5
- * @package WP_Review
6
- * @since 3.0.0
7
- */
8
-
9
- /**
10
- * Require files.
11
- */
12
- require_once WP_REVIEW_ADMIN . 'demo-importer/class-wp-import.php';
13
- require_once WP_REVIEW_ADMIN . 'demo-importer/class-wp-review-demo-importer.php';
14
-
15
-
16
- /**
17
- * Imports demo.
18
- */
19
- function wp_review_import_demo() {
20
- $file = WP_REVIEW_INCLUDES . 'demo/demo-content.xml';
21
- $importer = new WP_Review_Demo_Importer();
22
- $importer->import( $file );
23
- }
24
-
25
- /**
26
- * Prints demo importer popup.
27
- */
28
- function wp_review_print_demo_importer_popup() {
29
- ?>
30
- <div id="wp-review-demo-importer-popup" class="mfp-hide">
31
- <div id="wp-review-demo-importer-modal">
32
- <div id="wp-review-demo-importer-modal-header">
33
- <h2><span class="spinner is-active"></span><?php esc_html_e( 'Processing, please wait&hellip;', 'wp-review' ); ?></h2>
34
- </div>
35
- <div id="wp-review-demo-importer-modal-content">
36
- </div>
37
- <div id="wp-review-demo-importer-modal-footer">
38
- <span id="wp-review-demo-importer-modal-footer-info"><?php esc_html_e( 'Processing, please wait&hellip;', 'wp-review' ); ?></span>
39
- <button id="wp-review-demo-importer-modal-footer-button" class="button button-primary"><?php esc_html_e( 'Ok', 'wp-review' ); ?></button>
40
- </div>
41
- </div>
42
- </div>
43
- <?php
44
- }
45
- add_action( 'admin_footer-settings_page_wp-review/admin/options', 'wp_review_print_demo_importer_popup' );
46
-
47
- /**
48
- * AJAX handler for demo importer.
49
- */
50
- function wp_review_ajax_import_demo() {
51
- check_ajax_referer( 'wp_review_import_demo', 'nonce' );
52
- wp_review_import_demo();
53
- die();
54
- }
55
- add_action( 'wp_ajax_wp-review-import-demo', 'wp_review_ajax_import_demo' );
1
+ <?php
2
+ /**
3
+ * Demo importer feature
4
+ *
5
+ * @package WP_Review
6
+ * @since 3.0.0
7
+ */
8
+
9
+ /**
10
+ * Require files.
11
+ */
12
+ require_once WP_REVIEW_ADMIN . 'demo-importer/class-wp-import.php';
13
+ require_once WP_REVIEW_ADMIN . 'demo-importer/class-wp-review-demo-importer.php';
14
+
15
+
16
+ /**
17
+ * Imports demo.
18
+ */
19
+ function wp_review_import_demo() {
20
+ $file = WP_REVIEW_INCLUDES . 'demo/demo-content.xml';
21
+ $importer = new WP_Review_Demo_Importer();
22
+ $importer->import( $file );
23
+ }
24
+
25
+ /**
26
+ * Prints demo importer popup.
27
+ */
28
+ function wp_review_print_demo_importer_popup() {
29
+ ?>
30
+ <div id="wp-review-demo-importer-popup" class="mfp-hide">
31
+ <div id="wp-review-demo-importer-modal">
32
+ <div id="wp-review-demo-importer-modal-header">
33
+ <h2><span class="spinner is-active"></span><?php esc_html_e( 'Processing, please wait&hellip;', 'wp-review' ); ?></h2>
34
+ </div>
35
+ <div id="wp-review-demo-importer-modal-content">
36
+ </div>
37
+ <div id="wp-review-demo-importer-modal-footer">
38
+ <span id="wp-review-demo-importer-modal-footer-info"><?php esc_html_e( 'Processing, please wait&hellip;', 'wp-review' ); ?></span>
39
+ <button id="wp-review-demo-importer-modal-footer-button" class="button button-primary"><?php esc_html_e( 'Ok', 'wp-review' ); ?></button>
40
+ </div>
41
+ </div>
42
+ </div>
43
+ <?php
44
+ }
45
+ add_action( 'admin_footer-settings_page_wp-review/admin/options', 'wp_review_print_demo_importer_popup' );
46
+
47
+ /**
48
+ * AJAX handler for demo importer.
49
+ */
50
+ function wp_review_ajax_import_demo() {
51
+ check_ajax_referer( 'wp_review_import_demo', 'nonce' );
52
+ wp_review_import_demo();
53
+ die();
54
+ }
55
+ add_action( 'wp_ajax_wp-review-import-demo', 'wp_review_ajax_import_demo' );
admin/demo-importer/class-wp-import.php CHANGED
@@ -1,1198 +1,1198 @@
1
- <?php
2
- /**
3
- * Class WP_Import
4
- *
5
- * @package WP_Review
6
- * @since 3.0.0
7
- */
8
-
9
- if ( ! class_exists( 'WP_Importer' ) ) {
10
- require_once ABSPATH . 'wp-admin/includes/class-wp-importer.php';
11
- }
12
-
13
- if ( ! class_exists( 'WXR_Parser' ) ) {
14
- require_once dirname( __FILE__ ) . '/parsers.php';
15
- }
16
-
17
- if ( ! class_exists( 'WP_Import' ) ) {
18
- /**
19
- * Class WP_Import
20
- */
21
- class WP_Import extends WP_Importer {
22
- var $max_wxr_version = 1.2; // max. supported WXR version
23
-
24
- var $id; // WXR attachment ID
25
-
26
- // information to import from WXR file
27
- var $version;
28
- var $authors = array();
29
- var $posts = array();
30
- var $terms = array();
31
- var $categories = array();
32
- var $tags = array();
33
- var $base_url = '';
34
-
35
- // mappings from old information to new
36
- var $processed_authors = array();
37
- var $author_mapping = array();
38
- var $processed_terms = array();
39
- var $processed_posts = array();
40
- var $post_orphans = array();
41
- var $processed_menu_items = array();
42
- var $menu_item_orphans = array();
43
- var $missing_menu_items = array();
44
-
45
- var $fetch_attachments = false;
46
- var $url_remap = array();
47
- var $featured_images = array();
48
-
49
- /**
50
- * Registered callback function for the WordPress Importer
51
- *
52
- * Manages the three separate stages of the WXR import process
53
- */
54
- function dispatch() {
55
- $this->header();
56
-
57
- $step = empty( $_GET['step'] ) ? 0 : (int) $_GET['step'];
58
- switch ( $step ) {
59
- case 0:
60
- $this->greet();
61
- break;
62
- case 1:
63
- check_admin_referer( 'import-upload' );
64
- if ( $this->handle_upload() )
65
- $this->import_options();
66
- break;
67
- case 2:
68
- check_admin_referer( 'import-wordpress' );
69
- $this->fetch_attachments = ( ! empty( $_POST['fetch_attachments'] ) && $this->allow_fetch_attachments() );
70
- $this->id = (int) $_POST['import_id'];
71
- $file = get_attached_file( $this->id );
72
- set_time_limit(0);
73
- $this->import( $file );
74
- break;
75
- }
76
-
77
- $this->footer();
78
- }
79
-
80
- /**
81
- * The main controller for the actual import stage.
82
- *
83
- * @param string $file Path to the WXR file for importing
84
- */
85
- function import( $file ) {
86
- add_filter( 'import_post_meta_key', array( $this, 'is_valid_meta_key' ) );
87
- add_filter( 'http_request_timeout', array( &$this, 'bump_request_timeout' ) );
88
-
89
- $this->import_start( $file );
90
-
91
- $this->get_author_mapping();
92
-
93
- wp_suspend_cache_invalidation( true );
94
- $this->process_categories();
95
- $this->process_tags();
96
- $this->process_terms();
97
- $this->process_posts();
98
- wp_suspend_cache_invalidation( false );
99
-
100
- // update incorrect/missing information in the DB
101
- $this->backfill_parents();
102
- $this->backfill_attachment_urls();
103
- $this->remap_featured_images();
104
-
105
- $this->import_end();
106
- }
107
-
108
- /**
109
- * Parses the WXR file and prepares us for the task of processing parsed data
110
- *
111
- * @param string $file Path to the WXR file for importing
112
- */
113
- function import_start( $file ) {
114
- if ( ! is_file($file) ) {
115
- echo '<p><strong>' . __( 'Sorry, there has been an error.', 'wordpress-importer' ) . '</strong><br />';
116
- echo __( 'The file does not exist, please try again.', 'wordpress-importer' ) . '</p>';
117
- $this->footer();
118
- die();
119
- }
120
-
121
- $import_data = $this->parse( $file );
122
-
123
- if ( is_wp_error( $import_data ) ) {
124
- echo '<p><strong>' . __( 'Sorry, there has been an error.', 'wordpress-importer' ) . '</strong><br />';
125
- echo esc_html( $import_data->get_error_message() ) . '</p>';
126
- $this->footer();
127
- die();
128
- }
129
-
130
- $this->version = $import_data['version'];
131
- $this->get_authors_from_import( $import_data );
132
- $this->posts = $import_data['posts'];
133
- $this->terms = $import_data['terms'];
134
- $this->categories = $import_data['categories'];
135
- $this->tags = $import_data['tags'];
136
- $this->base_url = esc_url( $import_data['base_url'] );
137
-
138
- wp_defer_term_counting( true );
139
- wp_defer_comment_counting( true );
140
-
141
- do_action( 'import_start' );
142
- }
143
-
144
- /**
145
- * Performs post-import cleanup of files and the cache
146
- */
147
- function import_end() {
148
- wp_import_cleanup( $this->id );
149
-
150
- wp_cache_flush();
151
- foreach ( get_taxonomies() as $tax ) {
152
- delete_option( "{$tax}_children" );
153
- _get_term_hierarchy( $tax );
154
- }
155
-
156
- wp_defer_term_counting( false );
157
- wp_defer_comment_counting( false );
158
-
159
- echo '<p>' . __( 'All done.', 'wordpress-importer' ) . ' <a href="' . admin_url() . '">' . __( 'Have fun!', 'wordpress-importer' ) . '</a>' . '</p>';
160
- echo '<p>' . __( 'Remember to update the passwords and roles of imported users.', 'wordpress-importer' ) . '</p>';
161
-
162
- do_action( 'import_end' );
163
- }
164
-
165
- /**
166
- * Handles the WXR upload and initial parsing of the file to prepare for
167
- * displaying author import options
168
- *
169
- * @return bool False if error uploading or invalid file, true otherwise
170
- */
171
- function handle_upload() {
172
- $file = wp_import_handle_upload();
173
-
174
- if ( isset( $file['error'] ) ) {
175
- echo '<p><strong>' . __( 'Sorry, there has been an error.', 'wordpress-importer' ) . '</strong><br />';
176
- echo esc_html( $file['error'] ) . '</p>';
177
- return false;
178
- } else if ( ! file_exists( $file['file'] ) ) {
179
- echo '<p><strong>' . __( 'Sorry, there has been an error.', 'wordpress-importer' ) . '</strong><br />';
180
- printf( __( 'The export file could not be found at <code>%s</code>. It is likely that this was caused by a permissions problem.', 'wordpress-importer' ), esc_html( $file['file'] ) );
181
- echo '</p>';
182
- return false;
183
- }
184
-
185
- $this->id = (int) $file['id'];
186
- $import_data = $this->parse( $file['file'] );
187
- if ( is_wp_error( $import_data ) ) {
188
- echo '<p><strong>' . __( 'Sorry, there has been an error.', 'wordpress-importer' ) . '</strong><br />';
189
- echo esc_html( $import_data->get_error_message() ) . '</p>';
190
- return false;
191
- }
192
-
193
- $this->version = $import_data['version'];
194
- if ( $this->version > $this->max_wxr_version ) {
195
- echo '<div class="error"><p><strong>';
196
- printf( __( 'This WXR file (version %s) may not be supported by this version of the importer. Please consider updating.', 'wordpress-importer' ), esc_html($import_data['version']) );
197
- echo '</strong></p></div>';
198
- }
199
-
200
- $this->get_authors_from_import( $import_data );
201
-
202
- return true;
203
- }
204
-
205
- /**
206
- * Retrieve authors from parsed WXR data
207
- *
208
- * Uses the provided author information from WXR 1.1 files
209
- * or extracts info from each post for WXR 1.0 files
210
- *
211
- * @param array $import_data Data returned by a WXR parser
212
- */
213
- function get_authors_from_import( $import_data ) {
214
- if ( ! empty( $import_data['authors'] ) ) {
215
- $this->authors = $import_data['authors'];
216
- // no author information, grab it from the posts
217
- } else {
218
- foreach ( $import_data['posts'] as $post ) {
219
- $login = sanitize_user( $post['post_author'], true );
220
- if ( empty( $login ) ) {
221
- printf( __( 'Failed to import author %s. Their posts will be attributed to the current user.', 'wordpress-importer' ), esc_html( $post['post_author'] ) );
222
- echo '<br />';
223
- continue;
224
- }
225
-
226
- if ( ! isset($this->authors[$login]) )
227
- $this->authors[$login] = array(
228
- 'author_login' => $login,
229
- 'author_display_name' => $post['post_author']
230
- );
231
- }
232
- }
233
- }
234
-
235
- /**
236
- * Display pre-import options, author importing/mapping and option to
237
- * fetch attachments
238
- */
239
- function import_options() {
240
- $j = 0;
241
- ?>
242
- <form action="<?php echo admin_url( 'admin.php?import=wordpress&amp;step=2' ); ?>" method="post">
243
- <?php wp_nonce_field( 'import-wordpress' ); ?>
244
- <input type="hidden" name="import_id" value="<?php echo $this->id; ?>" />
245
-
246
- <?php if ( ! empty( $this->authors ) ) : ?>
247
- <h3><?php _e( 'Assign Authors', 'wordpress-importer' ); ?></h3>
248
- <p><?php _e( 'To make it easier for you to edit and save the imported content, you may want to reassign the author of the imported item to an existing user of this site. For example, you may want to import all the entries as <code>admin</code>s entries.', 'wordpress-importer' ); ?></p>
249
- <?php if ( $this->allow_create_users() ) : ?>
250
- <p><?php printf( __( 'If a new user is created by WordPress, a new password will be randomly generated and the new user&#8217;s role will be set as %s. Manually changing the new user&#8217;s details will be necessary.', 'wordpress-importer' ), esc_html( get_option('default_role') ) ); ?></p>
251
- <?php endif; ?>
252
- <ol id="authors">
253
- <?php foreach ( $this->authors as $author ) : ?>
254
- <li><?php $this->author_select( $j++, $author ); ?></li>
255
- <?php endforeach; ?>
256
- </ol>
257
- <?php endif; ?>
258
-
259
- <?php if ( $this->allow_fetch_attachments() ) : ?>
260
- <h3><?php _e( 'Import Attachments', 'wordpress-importer' ); ?></h3>
261
- <p>
262
- <input type="checkbox" value="1" name="fetch_attachments" id="import-attachments" />
263
- <label for="import-attachments"><?php _e( 'Download and import file attachments', 'wordpress-importer' ); ?></label>
264
- </p>
265
- <?php endif; ?>
266
-
267
- <p class="submit"><input type="submit" class="button" value="<?php esc_attr_e( 'Submit', 'wordpress-importer' ); ?>" /></p>
268
- </form>
269
- <?php
270
- }
271
-
272
- /**
273
- * Display import options for an individual author. That is, either create
274
- * a new user based on import info or map to an existing user
275
- *
276
- * @param int $n Index for each author in the form
277
- * @param array $author Author information, e.g. login, display name, email
278
- */
279
- function author_select( $n, $author ) {
280
- _e( 'Import author:', 'wordpress-importer' );
281
- echo ' <strong>' . esc_html( $author['author_display_name'] );
282
- if ( $this->version != '1.0' ) echo ' (' . esc_html( $author['author_login'] ) . ')';
283
- echo '</strong><br />';
284
-
285
- if ( $this->version != '1.0' )
286
- echo '<div style="margin-left:18px">';
287
-
288
- $create_users = $this->allow_create_users();
289
- if ( $create_users ) {
290
- if ( $this->version != '1.0' ) {
291
- _e( 'or create new user with login name:', 'wordpress-importer' );
292
- $value = '';
293
- } else {
294
- _e( 'as a new user:', 'wordpress-importer' );
295
- $value = esc_attr( sanitize_user( $author['author_login'], true ) );
296
- }
297
-
298
- echo ' <input type="text" name="user_new['.$n.']" value="'. $value .'" /><br />';
299
- }
300
-
301
- if ( ! $create_users && $this->version == '1.0' )
302
- _e( 'assign posts to an existing user:', 'wordpress-importer' );
303
- else
304
- _e( 'or assign posts to an existing user:', 'wordpress-importer' );
305
- wp_dropdown_users( array( 'name' => "user_map[$n]", 'multi' => true, 'show_option_all' => __( '- Select -', 'wordpress-importer' ) ) );
306
- echo '<input type="hidden" name="imported_authors['.$n.']" value="' . esc_attr( $author['author_login'] ) . '" />';
307
-
308
- if ( $this->version != '1.0' )
309
- echo '</div>';
310
- }
311
-
312
- /**
313
- * Map old author logins to local user IDs based on decisions made
314
- * in import options form. Can map to an existing user, create a new user
315
- * or falls back to the current user in case of error with either of the previous
316
- */
317
- function get_author_mapping() {
318
- if ( ! isset( $_POST['imported_authors'] ) )
319
- return;
320
-
321
- $create_users = $this->allow_create_users();
322
-
323
- foreach ( (array) $_POST['imported_authors'] as $i => $old_login ) {
324
- // Multisite adds strtolower to sanitize_user. Need to sanitize here to stop breakage in process_posts.
325
- $santized_old_login = sanitize_user( $old_login, true );
326
- $old_id = isset( $this->authors[$old_login]['author_id'] ) ? intval($this->authors[$old_login]['author_id']) : false;
327
-
328
- if ( ! empty( $_POST['user_map'][$i] ) ) {
329
- $user = get_userdata( intval($_POST['user_map'][$i]) );
330
- if ( isset( $user->ID ) ) {
331
- if ( $old_id )
332
- $this->processed_authors[$old_id] = $user->ID;
333
- $this->author_mapping[$santized_old_login] = $user->ID;
334
- }
335
- } else if ( $create_users ) {
336
- if ( ! empty($_POST['user_new'][$i]) ) {
337
- $user_id = wp_create_user( $_POST['user_new'][$i], wp_generate_password() );
338
- } else if ( $this->version != '1.0' ) {
339
- $user_data = array(
340
- 'user_login' => $old_login,
341
- 'user_pass' => wp_generate_password(),
342
- 'user_email' => isset( $this->authors[$old_login]['author_email'] ) ? $this->authors[$old_login]['author_email'] : '',
343
- 'display_name' => $this->authors[$old_login]['author_display_name'],
344
- 'first_name' => isset( $this->authors[$old_login]['author_first_name'] ) ? $this->authors[$old_login]['author_first_name'] : '',
345
- 'last_name' => isset( $this->authors[$old_login]['author_last_name'] ) ? $this->authors[$old_login]['author_last_name'] : '',
346
- );
347
- $user_id = wp_insert_user( $user_data );
348
- }
349
-
350
- if ( ! is_wp_error( $user_id ) ) {
351
- if ( $old_id )
352
- $this->processed_authors[$old_id] = $user_id;
353
- $this->author_mapping[$santized_old_login] = $user_id;
354
- } else {
355
- printf( __( 'Failed to create new user for %s. Their posts will be attributed to the current user.', 'wordpress-importer' ), esc_html($this->authors[$old_login]['author_display_name']) );
356
- if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
357
- echo ' ' . $user_id->get_error_message();
358
- echo '<br />';
359
- }
360
- }
361
-
362
- // failsafe: if the user_id was invalid, default to the current user
363
- if ( ! isset( $this->author_mapping[$santized_old_login] ) ) {
364
- if ( $old_id )
365
- $this->processed_authors[$old_id] = (int) get_current_user_id();
366
- $this->author_mapping[$santized_old_login] = (int) get_current_user_id();
367
- }
368
- }
369
- }
370
-
371
- /**
372
- * Create new categories based on import information
373
- *
374
- * Doesn't create a new category if its slug already exists
375
- */
376
- function process_categories() {
377
- $this->categories = apply_filters( 'wp_import_categories', $this->categories );
378
-
379
- if ( empty( $this->categories ) )
380
- return;
381
-
382
- foreach ( $this->categories as $cat ) {
383
- // if the category already exists leave it alone
384
- $term_id = term_exists( $cat['category_nicename'], 'category' );
385
- if ( $term_id ) {
386
- if ( is_array($term_id) ) $term_id = $term_id['term_id'];
387
- if ( isset($cat['term_id']) )
388
- $this->processed_terms[intval($cat['term_id'])] = (int) $term_id;
389
- continue;
390
- }
391
-
392
- $category_parent = empty( $cat['category_parent'] ) ? 0 : category_exists( $cat['category_parent'] );
393
- $category_description = isset( $cat['category_description'] ) ? $cat['category_description'] : '';
394
- $catarr = array(
395
- 'category_nicename' => $cat['category_nicename'],
396
- 'category_parent' => $category_parent,
397
- 'cat_name' => $cat['cat_name'],
398
- 'category_description' => $category_description
399
- );
400
- $catarr = wp_slash( $catarr );
401
-
402
- $id = wp_insert_category( $catarr );
403
- if ( ! is_wp_error( $id ) ) {
404
- if ( isset($cat['term_id']) )
405
- $this->processed_terms[intval($cat['term_id'])] = $id;
406
- } else {
407
- printf( __( 'Failed to import category %s', 'wordpress-importer' ), esc_html($cat['category_nicename']) );
408
- if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
409
- echo ': ' . $id->get_error_message();
410
- echo '<br />';
411
- continue;
412
- }
413
-
414
- $this->process_termmeta( $cat, $id['term_id'] );
415
- }
416
-
417
- unset( $this->categories );
418
- }
419
-
420
- /**
421
- * Create new post tags based on import information
422
- *
423
- * Doesn't create a tag if its slug already exists
424
- */
425
- function process_tags() {
426
- $this->tags = apply_filters( 'wp_import_tags', $this->tags );
427
-
428
- if ( empty( $this->tags ) )
429
- return;
430
-
431
- foreach ( $this->tags as $tag ) {
432
- // if the tag already exists leave it alone
433
- $term_id = term_exists( $tag['tag_slug'], 'post_tag' );
434
- if ( $term_id ) {
435
- if ( is_array($term_id) ) $term_id = $term_id['term_id'];
436
- if ( isset($tag['term_id']) )
437
- $this->processed_terms[intval($tag['term_id'])] = (int) $term_id;
438
- continue;
439
- }
440
-
441
- $tag = wp_slash( $tag );
442
- $tag_desc = isset( $tag['tag_description'] ) ? $tag['tag_description'] : '';
443
- $tagarr = array( 'slug' => $tag['tag_slug'], 'description' => $tag_desc );
444
-
445
- $id = wp_insert_term( $tag['tag_name'], 'post_tag', $tagarr );
446
- if ( ! is_wp_error( $id ) ) {
447
- if ( isset($tag['term_id']) )
448
- $this->processed_terms[intval($tag['term_id'])] = $id['term_id'];
449
- } else {
450
- printf( __( 'Failed to import post tag %s', 'wordpress-importer' ), esc_html($tag['tag_name']) );
451
- if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
452
- echo ': ' . $id->get_error_message();
453
- echo '<br />';
454
- continue;
455
- }
456
-
457
- $this->process_termmeta( $tag, $id['term_id'] );
458
- }
459
-
460
- unset( $this->tags );
461
- }
462
-
463
- /**
464
- * Create new terms based on import information
465
- *
466
- * Doesn't create a term its slug already exists
467
- */
468
- function process_terms() {
469
- $this->terms = apply_filters( 'wp_import_terms', $this->terms );
470
-
471
- if ( empty( $this->terms ) )
472
- return;
473
-
474
- foreach ( $this->terms as $term ) {
475
- // if the term already exists in the correct taxonomy leave it alone
476
- $term_id = term_exists( $term['slug'], $term['term_taxonomy'] );
477
- if ( $term_id ) {
478
- if ( is_array($term_id) ) $term_id = $term_id['term_id'];
479
- if ( isset($term['term_id']) )
480
- $this->processed_terms[intval($term['term_id'])] = (int) $term_id;
481
- continue;
482
- }
483
-
484
- if ( empty( $term['term_parent'] ) ) {
485
- $parent = 0;
486
- } else {
487
- $parent = term_exists( $term['term_parent'], $term['term_taxonomy'] );
488
- if ( is_array( $parent ) ) $parent = $parent['term_id'];
489
- }
490
- $term = wp_slash( $term );
491
- $description = isset( $term['term_description'] ) ? $term['term_description'] : '';
492
- $termarr = array( 'slug' => $term['slug'], 'description' => $description, 'parent' => intval($parent) );
493
-
494
- $id = wp_insert_term( $term['term_name'], $term['term_taxonomy'], $termarr );
495
- if ( ! is_wp_error( $id ) ) {
496
- if ( isset($term['term_id']) )
497
- $this->processed_terms[intval($term['term_id'])] = $id['term_id'];
498
- } else {
499
- printf( __( 'Failed to import %s %s', 'wordpress-importer' ), esc_html($term['term_taxonomy']), esc_html($term['term_name']) );
500
- if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
501
- echo ': ' . $id->get_error_message();
502
- echo '<br />';
503
- continue;
504
- }
505
-
506
- $this->process_termmeta( $term, $id['term_id'] );
507
- }
508
-
509
- unset( $this->terms );
510
- }
511
-
512
- /**
513
- * Add metadata to imported term.
514
- *
515
- * @since 0.6.2
516
- *
517
- * @param array $term Term data from WXR import.
518
- * @param int $term_id ID of the newly created term.
519
- */
520
- protected function process_termmeta( $term, $term_id ) {
521
- if ( ! isset( $term['termmeta'] ) ) {
522
- $term['termmeta'] = array();
523
- }
524
-
525
- /**
526
- * Filters the metadata attached to an imported term.
527
- *
528
- * @since 0.6.2
529
- *
530
- * @param array $termmeta Array of term meta.
531
- * @param int $term_id ID of the newly created term.
532
- * @param array $term Term data from the WXR import.
533
- */
534
- $term['termmeta'] = apply_filters( 'wp_import_term_meta', $term['termmeta'], $term_id, $term );
535
-
536
- if ( empty( $term['termmeta'] ) ) {
537
- return;
538
- }
539
-
540
- foreach ( $term['termmeta'] as $meta ) {
541
- /**
542
- * Filters the meta key for an imported piece of term meta.
543
- *
544
- * @since 0.6.2
545
- *
546
- * @param string $meta_key Meta key.
547
- * @param int $term_id ID of the newly created term.
548
- * @param array $term Term data from the WXR import.
549
- */
550
- $key = apply_filters( 'import_term_meta_key', $meta['key'], $term_id, $term );
551
- if ( ! $key ) {
552
- continue;
553
- }
554
-
555
- // Export gets meta straight from the DB so could have a serialized string
556
- $value = maybe_unserialize( $meta['value'] );
557
-
558
- add_term_meta( $term_id, $key, $value );
559
-
560
- /**
561
- * Fires after term meta is imported.
562
- *
563
- * @since 0.6.2
564
- *
565
- * @param int $term_id ID of the newly created term.
566
- * @param string $key Meta key.
567
- * @param mixed $value Meta value.
568
- */
569
- do_action( 'import_term_meta', $term_id, $key, $value );
570
- }
571
- }
572
-
573
- /**
574
- * Create new posts based on import information
575
- *
576
- * Posts marked as having a parent which doesn't exist will become top level items.
577
- * Doesn't create a new post if: the post type doesn't exist, the given post ID
578
- * is already noted as imported or a post with the same title and date already exists.
579
- * Note that new/updated terms, comments and meta are imported for the last of the above.
580
- */
581
- function process_posts() {
582
- $this->posts = apply_filters( 'wp_import_posts', $this->posts );
583
-
584
- foreach ( $this->posts as $post ) {
585
- $post = apply_filters( 'wp_import_post_data_raw', $post );
586
-
587
- if ( ! post_type_exists( $post['post_type'] ) ) {
588
- printf( __( 'Failed to import &#8220;%s&#8221;: Invalid post type %s', 'wordpress-importer' ),
589
- esc_html($post['post_title']), esc_html($post['post_type']) );
590
- echo '<br />';
591
- do_action( 'wp_import_post_exists', $post );
592
- continue;
593
- }
594
-
595
- if ( isset( $this->processed_posts[$post['post_id']] ) && ! empty( $post['post_id'] ) )
596
- continue;
597
-
598
- if ( $post['status'] == 'auto-draft' )
599
- continue;
600
-
601
- if ( 'nav_menu_item' == $post['post_type'] ) {
602
- $this->process_menu_item( $post );
603
- continue;
604
- }
605
-
606
- $post_type_object = get_post_type_object( $post['post_type'] );
607
-
608
- $post_exists = post_exists( $post['post_title'], '', $post['post_date'] );
609
-
610
- /**
611
- * Filter ID of the existing post corresponding to post currently importing.
612
- *
613
- * Return 0 to force the post to be imported. Filter the ID to be something else
614
- * to override which existing post is mapped to the imported post.
615
- *
616
- * @see post_exists()
617
- * @since 0.6.2
618
- *
619
- * @param int $post_exists Post ID, or 0 if post did not exist.
620
- * @param array $post The post array to be inserted.
621
- */
622
- $post_exists = apply_filters( 'wp_import_existing_post', $post_exists, $post );
623
-
624
- if ( $post_exists && get_post_type( $post_exists ) == $post['post_type'] ) {
625
- printf( __('%s &#8220;%s&#8221; already exists.', 'wordpress-importer'), $post_type_object->labels->singular_name, esc_html($post['post_title']) );
626
- echo '<br />';
627
- $comment_post_ID = $post_id = $post_exists;
628
- $this->processed_posts[ intval( $post['post_id'] ) ] = intval( $post_exists );
629
- } else {
630
- $post_parent = (int) $post['post_parent'];
631
- if ( $post_parent ) {
632
- // if we already know the parent, map it to the new local ID
633
- if ( isset( $this->processed_posts[$post_parent] ) ) {
634
- $post_parent = $this->processed_posts[$post_parent];
635
- // otherwise record the parent for later
636
- } else {
637
- $this->post_orphans[intval($post['post_id'])] = $post_parent;
638
- $post_parent = 0;
639
- }
640
- }
641
-
642
- // map the post author
643
- $author = sanitize_user( $post['post_author'], true );
644
- if ( isset( $this->author_mapping[$author] ) )
645
- $author = $this->author_mapping[$author];
646
- else
647
- $author = (int) get_current_user_id();
648
-
649
- $postdata = array(
650
- 'import_id' => $post['post_id'], 'post_author' => $author, 'post_date' => $post['post_date'],
651
- 'post_date_gmt' => $post['post_date_gmt'], 'post_content' => $post['post_content'],
652
- 'post_excerpt' => $post['post_excerpt'], 'post_title' => $post['post_title'],
653
- 'post_status' => $post['status'], 'post_name' => $post['post_name'],
654
- 'comment_status' => $post['comment_status'], 'ping_status' => $post['ping_status'],
655
- 'guid' => $post['guid'], 'post_parent' => $post_parent, 'menu_order' => $post['menu_order'],
656
- 'post_type' => $post['post_type'], 'post_password' => $post['post_password']
657
- );
658
-
659
- $original_post_ID = $post['post_id'];
660
- $postdata = apply_filters( 'wp_import_post_data_processed', $postdata, $post );
661
-
662
- $postdata = wp_slash( $postdata );
663
-
664
- if ( 'attachment' == $postdata['post_type'] ) {
665
- $remote_url = ! empty($post['attachment_url']) ? $post['attachment_url'] : $post['guid'];
666
-
667
- // try to use _wp_attached file for upload folder placement to ensure the same location as the export site
668
- // e.g. location is 2003/05/image.jpg but the attachment post_date is 2010/09, see media_handle_upload()
669
- $postdata['upload_date'] = $post['post_date'];
670
- if ( isset( $post['postmeta'] ) ) {
671
- foreach( $post['postmeta'] as $meta ) {
672
- if ( $meta['key'] == '_wp_attached_file' ) {
673
- if ( preg_match( '%^[0-9]{4}/[0-9]{2}%', $meta['value'], $matches ) )
674
- $postdata['upload_date'] = $matches[0];
675
- break;
676
- }
677
- }
678
- }
679
-
680
- $comment_post_ID = $post_id = $this->process_attachment( $postdata, $remote_url );
681
- } else {
682
- $comment_post_ID = $post_id = wp_insert_post( $postdata, true );
683
- do_action( 'wp_import_insert_post', $post_id, $original_post_ID, $postdata, $post );
684
- }
685
-
686
- if ( is_wp_error( $post_id ) ) {
687
- printf( __( 'Failed to import %s &#8220;%s&#8221;', 'wordpress-importer' ),
688
- $post_type_object->labels->singular_name, esc_html($post['post_title']) );
689
- if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
690
- echo ': ' . $post_id->get_error_message();
691
- echo '<br />';
692
- continue;
693
- }
694
-
695
- if ( $post['is_sticky'] == 1 )
696
- stick_post( $post_id );
697
- }
698
-
699
- // map pre-import ID to local ID
700
- $this->processed_posts[intval($post['post_id'])] = (int) $post_id;
701
-
702
- if ( ! isset( $post['terms'] ) )
703
- $post['terms'] = array();
704
-
705
- $post['terms'] = apply_filters( 'wp_import_post_terms', $post['terms'], $post_id, $post );
706
-
707
- // add categories, tags and other terms
708
- if ( ! empty( $post['terms'] ) ) {
709
- $terms_to_set = array();
710
- foreach ( $post['terms'] as $term ) {
711
- // back compat with WXR 1.0 map 'tag' to 'post_tag'
712
- $taxonomy = ( 'tag' == $term['domain'] ) ? 'post_tag' : $term['domain'];
713
- $term_exists = term_exists( $term['slug'], $taxonomy );
714
- $term_id = is_array( $term_exists ) ? $term_exists['term_id'] : $term_exists;
715
- if ( ! $term_id ) {
716
- $t = wp_insert_term( $term['name'], $taxonomy, array( 'slug' => $term['slug'] ) );
717
- if ( ! is_wp_error( $t ) ) {
718
- $term_id = $t['term_id'];
719
- do_action( 'wp_import_insert_term', $t, $term, $post_id, $post );
720
- } else {
721
- printf( __( 'Failed to import %s %s', 'wordpress-importer' ), esc_html($taxonomy), esc_html($term['name']) );
722
- if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
723
- echo ': ' . $t->get_error_message();
724
- echo '<br />';
725
- do_action( 'wp_import_insert_term_failed', $t, $term, $post_id, $post );
726
- continue;
727
- }
728
- }
729
- $terms_to_set[$taxonomy][] = intval( $term_id );
730
- }
731
-
732
- foreach ( $terms_to_set as $tax => $ids ) {
733
- $tt_ids = wp_set_post_terms( $post_id, $ids, $tax );
734
- do_action( 'wp_import_set_post_terms', $tt_ids, $ids, $tax, $post_id, $post );
735
- }
736
- unset( $post['terms'], $terms_to_set );
737
- }
738
-
739
- if ( ! isset( $post['comments'] ) )
740
- $post['comments'] = array();
741
-
742
- $post['comments'] = apply_filters( 'wp_import_post_comments', $post['comments'], $post_id, $post );
743
-
744
- // add/update comments
745
- if ( ! empty( $post['comments'] ) ) {
746
- $num_comments = 0;
747
- $inserted_comments = array();
748
- foreach ( $post['comments'] as $comment ) {
749
- $comment_id = $comment['comment_id'];
750
- $newcomments[$comment_id]['comment_post_ID'] = $comment_post_ID;
751
- $newcomments[$comment_id]['comment_author'] = $comment['comment_author'];
752
- $newcomments[$comment_id]['comment_author_email'] = $comment['comment_author_email'];
753
- $newcomments[$comment_id]['comment_author_IP'] = $comment['comment_author_IP'];
754
- $newcomments[$comment_id]['comment_author_url'] = $comment['comment_author_url'];
755
- $newcomments[$comment_id]['comment_date'] = $comment['comment_date'];
756
- $newcomments[$comment_id]['comment_date_gmt'] = $comment['comment_date_gmt'];
757
- $newcomments[$comment_id]['comment_content'] = $comment['comment_content'];
758
- $newcomments[$comment_id]['comment_approved'] = $comment['comment_approved'];
759
- $newcomments[$comment_id]['comment_type'] = $comment['comment_type'];
760
- $newcomments[$comment_id]['comment_parent'] = $comment['comment_parent'];
761
- $newcomments[$comment_id]['commentmeta'] = isset( $comment['commentmeta'] ) ? $comment['commentmeta'] : array();
762
- if ( isset( $this->processed_authors[$comment['comment_user_id']] ) )
763
- $newcomments[$comment_id]['user_id'] = $this->processed_authors[$comment['comment_user_id']];
764
- }
765
- ksort( $newcomments );
766
-
767
- foreach ( $newcomments as $key => $comment ) {
768
- // if this is a new post we can skip the comment_exists() check
769
- if ( ! $post_exists || ! comment_exists( $comment['comment_author'], $comment['comment_date'] ) ) {
770
- if ( isset( $inserted_comments[$comment['comment_parent']] ) )
771
- $comment['comment_parent'] = $inserted_comments[$comment['comment_parent']];
772
- $comment = wp_slash( $comment );
773
- $comment = wp_filter_comment( $comment );
774
- $inserted_comments[$key] = wp_insert_comment( $comment );
775
- do_action( 'wp_import_insert_comment', $inserted_comments[$key], $comment, $comment_post_ID, $post );
776
-
777
- foreach( $comment['commentmeta'] as $meta ) {
778
- $value = maybe_unserialize( $meta['value'] );
779
- add_comment_meta( $inserted_comments[$key], $meta['key'], $value );
780
- }
781
-
782
- $num_comments++;
783
- }
784
- }
785
- unset( $newcomments, $inserted_comments, $post['comments'] );
786
- }
787
-
788
- if ( ! isset( $post['postmeta'] ) )
789
- $post['postmeta'] = array();
790
-
791
- $post['postmeta'] = apply_filters( 'wp_import_post_meta', $post['postmeta'], $post_id, $post );
792
-
793
- // add/update post meta
794
- if ( ! empty( $post['postmeta'] ) ) {
795
- foreach ( $post['postmeta'] as $meta ) {
796
- $key = apply_filters( 'import_post_meta_key', $meta['key'], $post_id, $post );
797
- $value = false;
798
-
799
- if ( '_edit_last' == $key ) {
800
- if ( isset( $this->processed_authors[intval($meta['value'])] ) )
801
- $value = $this->processed_authors[intval($meta['value'])];
802
- else
803
- $key = false;
804
- }
805
-
806
- if ( $key ) {
807
- // export gets meta straight from the DB so could have a serialized string
808
- if ( ! $value )
809
- $value = maybe_unserialize( $meta['value'] );
810
-
811
- add_post_meta( $post_id, $key, $value );
812
- do_action( 'import_post_meta', $post_id, $key, $value );
813
-
814
- // if the post has a featured image, take note of this in case of remap
815
- if ( '_thumbnail_id' == $key )
816
- $this->featured_images[$post_id] = (int) $value;
817
- }
818
- }
819
- }
820
- }
821
-
822
- unset( $this->posts );
823
- }
824
-
825
- /**
826
- * Attempt to create a new menu item from import data
827
- *
828
- * Fails for draft, orphaned menu items and those without an associated nav_menu
829
- * or an invalid nav_menu term. If the post type or term object which the menu item
830
- * represents doesn't exist then the menu item will not be imported (waits until the
831
- * end of the import to retry again before discarding).
832
- *
833
- * @param array $item Menu item details from WXR file
834
- */
835
- function process_menu_item( $item ) {
836
- // skip draft, orphaned menu items
837
- if ( 'draft' == $item['status'] )
838
- return;
839
-
840
- $menu_slug = false;
841
- if ( isset($item['terms']) ) {
842
- // loop through terms, assume first nav_menu term is correct menu
843
- foreach ( $item['terms'] as $term ) {
844
- if ( 'nav_menu' == $term['domain'] ) {
845
- $menu_slug = $term['slug'];
846
- break;
847
- }
848
- }
849
- }
850
-
851
- // no nav_menu term associated with this menu item
852
- if ( ! $menu_slug ) {
853
- _e( 'Menu item skipped due to missing menu slug', 'wordpress-importer' );
854
- echo '<br />';
855
- return;
856
- }
857
-
858
- $menu_id = term_exists( $menu_slug, 'nav_menu' );
859
- if ( ! $menu_id ) {
860
- printf( __( 'Menu item skipped due to invalid menu slug: %s', 'wordpress-importer' ), esc_html( $menu_slug ) );
861
- echo '<br />';
862
- return;
863
- } else {
864
- $menu_id = is_array( $menu_id ) ? $menu_id['term_id'] : $menu_id;
865
- }
866
-
867
- foreach ( $item['postmeta'] as $meta )
868
- ${$meta['key']} = $meta['value'];
869
-
870
- if ( 'taxonomy' == $_menu_item_type && isset( $this->processed_terms[intval($_menu_item_object_id)] ) ) {
871
- $_menu_item_object_id = $this->processed_terms[intval($_menu_item_object_id)];
872
- } else if ( 'post_type' == $_menu_item_type && isset( $this->processed_posts[intval($_menu_item_object_id)] ) ) {
873
- $_menu_item_object_id = $this->processed_posts[intval($_menu_item_object_id)];
874
- } else if ( 'custom' != $_menu_item_type ) {
875
- // associated object is missing or not imported yet, we'll retry later
876
- $this->missing_menu_items[] = $item;
877
- return;
878
- }
879
-
880
- if ( isset( $this->processed_menu_items[intval($_menu_item_menu_item_parent)] ) ) {
881
- $_menu_item_menu_item_parent = $this->processed_menu_items[intval($_menu_item_menu_item_parent)];
882
- } else if ( $_menu_item_menu_item_parent ) {
883
- $this->menu_item_orphans[intval($item['post_id'])] = (int) $_menu_item_menu_item_parent;
884
- $_menu_item_menu_item_parent = 0;
885
- }
886
-
887
- // wp_update_nav_menu_item expects CSS classes as a space separated string
888
- $_menu_item_classes = maybe_unserialize( $_menu_item_classes );
889
- if ( is_array( $_menu_item_classes ) )
890
- $_menu_item_classes = implode( ' ', $_menu_item_classes );
891
-
892
- $args = array(
893
- 'menu-item-object-id' => $_menu_item_object_id,
894
- 'menu-item-object' => $_menu_item_object,
895
- 'menu-item-parent-id' => $_menu_item_menu_item_parent,
896
- 'menu-item-position' => intval( $item['menu_order'] ),
897
- 'menu-item-type' => $_menu_item_type,
898
- 'menu-item-title' => $item['post_title'],
899
- 'menu-item-url' => $_menu_item_url,
900
- 'menu-item-description' => $item['post_content'],
901
- 'menu-item-attr-title' => $item['post_excerpt'],
902
- 'menu-item-target' => $_menu_item_target,
903
- 'menu-item-classes' => $_menu_item_classes,
904
- 'menu-item-xfn' => $_menu_item_xfn,
905
- 'menu-item-status' => $item['status']
906
- );
907
-
908
- $id = wp_update_nav_menu_item( $menu_id, 0, $args );
909
- if ( $id && ! is_wp_error( $id ) )
910
- $this->processed_menu_items[intval($item['post_id'])] = (int) $id;
911
- }
912
-
913
- /**
914
- * If fetching attachments is enabled then attempt to create a new attachment
915
- *
916
- * @param array $post Attachment post details from WXR
917
- * @param string $url URL to fetch attachment from
918
- * @return int|WP_Error Post ID on success, WP_Error otherwise
919
- */
920
- function process_attachment( $post, $url ) {
921
- if ( ! $this->fetch_attachments )
922
- return new WP_Error( 'attachment_processing_error',
923
- __( 'Fetching attachments is not enabled', 'wordpress-importer' ) );
924
-
925
- // if the URL is absolute, but does not contain address, then upload it assuming base_site_url
926
- if ( preg_match( '|^/[\w\W]+$|', $url ) )
927
- $url = rtrim( $this->base_url, '/' ) . $url;
928
-
929
- $upload = $this->fetch_remote_file( $url, $post );
930
- if ( is_wp_error( $upload ) )
931
- return $upload;
932
-
933
- if ( $info = wp_check_filetype( $upload['file'] ) )
934
- $post['post_mime_type'] = $info['type'];
935
- else
936
- return new WP_Error( 'attachment_processing_error', __('Invalid file type', 'wordpress-importer') );
937
-
938
- $post['guid'] = $upload['url'];
939
-
940
- // as per wp-admin/includes/upload.php
941
- $post_id = wp_insert_attachment( $post, $upload['file'] );
942
- wp_update_attachment_metadata( $post_id, wp_generate_attachment_metadata( $post_id, $upload['file'] ) );
943
-
944
- // remap resized image URLs, works by stripping the extension and remapping the URL stub.
945
- if ( preg_match( '!^image/!', $info['type'] ) ) {
946
- $parts = pathinfo( $url );
947
- $name = basename( $parts['basename'], ".{$parts['extension']}" ); // PATHINFO_FILENAME in PHP 5.2
948
-
949
- $parts_new = pathinfo( $upload['url'] );
950
- $name_new = basename( $parts_new['basename'], ".{$parts_new['extension']}" );
951
-
952
- $this->url_remap[$parts['dirname'] . '/' . $name] = $parts_new['dirname'] . '/' . $name_new;
953
- }
954
-
955
- return $post_id;
956
- }
957
-
958
- /**
959
- * Attempt to download a remote file attachment
960
- *
961
- * @param string $url URL of item to fetch
962
- * @param array $post Attachment details
963
- * @return array|WP_Error Local file location details on success, WP_Error otherwise
964
- */
965
- function fetch_remote_file( $url, $post ) {
966
- // extract the file name and extension from the url
967
- $file_name = basename( $url );
968
-
969
- // get placeholder file in the upload dir with a unique, sanitized filename
970
- $upload = wp_upload_bits( $file_name, 0, '', $post['upload_date'] );
971
- if ( $upload['error'] )
972
- return new WP_Error( 'upload_dir_error', $upload['error'] );
973
-
974
- // fetch the remote url and write it to the placeholder file
975
- $remote_response = wp_safe_remote_get( $url, array(
976
- 'timeout' => 300,
977
- 'stream' => true,
978
- 'filename' => $upload['file'],
979
- ) );
980
-
981
- $headers = wp_remote_retrieve_headers( $remote_response );
982
-
983
- // request failed
984
- if ( ! $headers ) {
985
- @unlink( $upload['file'] );
986
- return new WP_Error( 'import_file_error', __('Remote server did not respond', 'wordpress-importer') );
987
- }
988
-
989
- $remote_response_code = wp_remote_retrieve_response_code( $remote_response );
990
-
991
- // make sure the fetch was successful
992
- if ( $remote_response_code != '200' ) {
993
- @unlink( $upload['file'] );
994
- return new WP_Error( 'import_file_error', sprintf( __('Remote server returned error response %1$d %2$s', 'wordpress-importer'), esc_html($remote_response_code), get_status_header_desc($remote_response_code) ) );
995
- }
996
-
997
- $filesize = filesize( $upload['file'] );
998
-
999
- if ( isset( $headers['content-length'] ) && $filesize != $headers['content-length'] ) {
1000
- @unlink( $upload['file'] );
1001
- return new WP_Error( 'import_file_error', __('Remote file is incorrect size', 'wordpress-importer') );
1002
- }
1003
-
1004
- if ( 0 == $filesize ) {
1005
- @unlink( $upload['file'] );
1006
- return new WP_Error( 'import_file_error', __('Zero size file downloaded', 'wordpress-importer') );
1007
- }
1008
-
1009
- $max_size = (int) $this->max_attachment_size();
1010
- if ( ! empty( $max_size ) && $filesize > $max_size ) {
1011
- @unlink( $upload['file'] );
1012
- return new WP_Error( 'import_file_error', sprintf(__('Remote file is too large, limit is %s', 'wordpress-importer'), size_format($max_size) ) );
1013
- }
1014
-
1015
- // keep track of the old and new urls so we can substitute them later
1016
- $this->url_remap[$url] = $upload['url'];
1017
- $this->url_remap[$post['guid']] = $upload['url']; // r13735, really needed?
1018
- // keep track of the destination if the remote url is redirected somewhere else
1019
- if ( isset($headers['x-final-location']) && $headers['x-final-location'] != $url )
1020
- $this->url_remap[$headers['x-final-location']] = $upload['url'];
1021
-
1022
- return $upload;
1023
- }
1024
-
1025
- /**
1026
- * Attempt to associate posts and menu items with previously missing parents
1027
- *
1028
- * An imported post's parent may not have been imported when it was first created
1029
- * so try again. Similarly for child menu items and menu items which were missing
1030
- * the object (e.g. post) they represent in the menu
1031
- */
1032
- function backfill_parents() {
1033
- global $wpdb;
1034
-
1035
- // find parents for post orphans
1036
- foreach ( $this->post_orphans as $child_id => $parent_id ) {
1037
- $local_child_id = $local_parent_id = false;
1038
- if ( isset( $this->processed_posts[$child_id] ) )
1039
- $local_child_id = $this->processed_posts[$child_id];
1040
- if ( isset( $this->processed_posts[$parent_id] ) )
1041
- $local_parent_id = $this->processed_posts[$parent_id];
1042
-
1043
- if ( $local_child_id && $local_parent_id ) {
1044
- $wpdb->update( $wpdb->posts, array( 'post_parent' => $local_parent_id ), array( 'ID' => $local_child_id ), '%d', '%d' );
1045
- clean_post_cache( $local_child_id );
1046
- }
1047
- }
1048
-
1049
- // all other posts/terms are imported, retry menu items with missing associated object
1050
- $missing_menu_items = $this->missing_menu_items;
1051
- foreach ( $missing_menu_items as $item )
1052
- $this->process_menu_item( $item );
1053
-
1054
- // find parents for menu item orphans
1055
- foreach ( $this->menu_item_orphans as $child_id => $parent_id ) {
1056
- $local_child_id = $local_parent_id = 0;
1057
- if ( isset( $this->processed_menu_items[$child_id] ) )
1058
- $local_child_id = $this->processed_menu_items[$child_id];
1059
- if ( isset( $this->processed_menu_items[$parent_id] ) )
1060
- $local_parent_id = $this->processed_menu_items[$parent_id];
1061
-
1062
- if ( $local_child_id && $local_parent_id )
1063
- update_post_meta( $local_child_id, '_menu_item_menu_item_parent', (int) $local_parent_id );
1064
- }
1065
- }
1066
-
1067
- /**
1068
- * Use stored mapping information to update old attachment URLs
1069
- */
1070
- function backfill_attachment_urls() {
1071
- global $wpdb;
1072
- // make sure we do the longest urls first, in case one is a substring of another
1073
- uksort( $this->url_remap, array(&$this, 'cmpr_strlen') );
1074
-
1075
- foreach ( $this->url_remap as $from_url => $to_url ) {
1076
- // remap urls in post_content
1077
- $wpdb->query( $wpdb->prepare("UPDATE {$wpdb->posts} SET post_content = REPLACE(post_content, %s, %s)", $from_url, $to_url) );
1078
- // remap enclosure urls
1079
- $result = $wpdb->query( $wpdb->prepare("UPDATE {$wpdb->postmeta} SET meta_value = REPLACE(meta_value, %s, %s) WHERE meta_key='enclosure'", $from_url, $to_url) );
1080
- }
1081
- }
1082
-
1083
- /**
1084
- * Update _thumbnail_id meta to new, imported attachment IDs
1085
- */
1086
- function remap_featured_images() {
1087
- // cycle through posts that have a featured image
1088
- foreach ( $this->featured_images as $post_id => $value ) {
1089
- if ( isset( $this->processed_posts[$value] ) ) {
1090
- $new_id = $this->processed_posts[$value];
1091
- // only update if there's a difference
1092
- if ( $new_id != $value )
1093
- update_post_meta( $post_id, '_thumbnail_id', $new_id );
1094
- }
1095
- }
1096
- }
1097
-
1098
- /**
1099
- * Parse a WXR file
1100
- *
1101
- * @param string $file Path to WXR file for parsing
1102
- * @return array Information gathered from the WXR file
1103
- */
1104
- function parse( $file ) {
1105
- $parser = new WXR_Parser();
1106
- return $parser->parse( $file );
1107
- }
1108
-
1109
- // Display import page title
1110
- function header() {
1111
- echo '<div class="wrap">';
1112
- echo '<h2>' . __( 'Import WordPress', 'wordpress-importer' ) . '</h2>';
1113
-
1114
- $updates = get_plugin_updates();
1115
- $basename = plugin_basename(__FILE__);
1116
- if ( isset( $updates[$basename] ) ) {
1117
- $update = $updates[$basename];
1118
- echo '<div class="error"><p><strong>';
1119
- printf( __( 'A new version of this importer is available. Please update to version %s to ensure compatibility with newer export files.', 'wordpress-importer' ), $update->update->new_version );
1120
- echo '</strong></p></div>';
1121
- }
1122
- }
1123
-
1124
- // Close div.wrap
1125
- function footer() {
1126
- echo '</div>';
1127
- }
1128
-
1129
- /**
1130
- * Display introductory text and file upload form
1131
- */
1132
- function greet() {
1133
- echo '<div class="narrow">';
1134
- echo '<p>'.__( 'Howdy! Upload your WordPress eXtended RSS (WXR) file and we&#8217;ll import the posts, pages, comments, custom fields, categories, and tags into this site.', 'wordpress-importer' ).'</p>';
1135
- echo '<p>'.__( 'Choose a WXR (.xml) file to upload, then click Upload file and import.', 'wordpress-importer' ).'</p>';
1136
- wp_import_upload_form( 'admin.php?import=wordpress&amp;step=1' );
1137
- echo '</div>';
1138
- }
1139
-
1140
- /**
1141
- * Decide if the given meta key maps to information we will want to import
1142
- *
1143
- * @param string $key The meta key to check
1144
- * @return string|bool The key if we do want to import, false if not
1145
- */
1146
- function is_valid_meta_key( $key ) {
1147
- // skip attachment metadata since we'll regenerate it from scratch
1148
- // skip _edit_lock as not relevant for import
1149
- if ( in_array( $key, array( '_wp_attached_file', '_wp_attachment_metadata', '_edit_lock' ) ) )
1150
- return false;
1151
- return $key;
1152
- }
1153
-
1154
- /**
1155
- * Decide whether or not the importer is allowed to create users.
1156
- * Default is true, can be filtered via import_allow_create_users
1157
- *
1158
- * @return bool True if creating users is allowed
1159
- */
1160
- function allow_create_users() {
1161
- return apply_filters( 'import_allow_create_users', true );
1162
- }
1163
-
1164
- /**
1165
- * Decide whether or not the importer should attempt to download attachment files.
1166
- * Default is true, can be filtered via import_allow_fetch_attachments. The choice
1167
- * made at the import options screen must also be true, false here hides that checkbox.
1168
- *
1169
- * @return bool True if downloading attachments is allowed
1170
- */
1171
- function allow_fetch_attachments() {
1172
- return apply_filters( 'import_allow_fetch_attachments', true );
1173
- }
1174
-
1175
- /**
1176
- * Decide what the maximum file size for downloaded attachments is.
1177
- * Default is 0 (unlimited), can be filtered via import_attachment_size_limit
1178
- *
1179
- * @return int Maximum attachment file size to import
1180
- */
1181
- function max_attachment_size() {
1182
- return apply_filters( 'import_attachment_size_limit', 0 );
1183
- }
1184
-
1185
- /**
1186
- * Added to http_request_timeout filter to force timeout at 60 seconds during import
1187
- * @return int 60
1188
- */
1189
- function bump_request_timeout( $val ) {
1190
- return 60;
1191
- }
1192
-
1193
- // return the difference in length between two strings
1194
- function cmpr_strlen( $a, $b ) {
1195
- return strlen($b) - strlen($a);
1196
- }
1197
- }
1198
- }
1
+ <?php
2
+ /**
3
+ * Class WP_Import
4
+ *
5
+ * @package WP_Review
6
+ * @since 3.0.0
7
+ */
8
+
9
+ if ( ! class_exists( 'WP_Importer' ) ) {
10
+ require_once ABSPATH . 'wp-admin/includes/class-wp-importer.php';
11
+ }
12
+
13
+ if ( ! class_exists( 'WXR_Parser' ) ) {
14
+ require_once dirname( __FILE__ ) . '/parsers.php';
15
+ }
16
+
17
+ if ( ! class_exists( 'WP_Import' ) ) {
18
+ /**
19
+ * Class WP_Import
20
+ */
21
+ class WP_Import extends WP_Importer {
22
+ var $max_wxr_version = 1.2; // max. supported WXR version
23
+
24
+ var $id; // WXR attachment ID
25
+
26
+ // information to import from WXR file
27
+ var $version;
28
+ var $authors = array();
29
+ var $posts = array();
30
+ var $terms = array();
31
+ var $categories = array();
32
+ var $tags = array();
33
+ var $base_url = '';
34
+
35
+ // mappings from old information to new
36
+ var $processed_authors = array();
37
+ var $author_mapping = array();
38
+ var $processed_terms = array();
39
+ var $processed_posts = array();
40
+ var $post_orphans = array();
41
+ var $processed_menu_items = array();
42
+ var $menu_item_orphans = array();
43
+ var $missing_menu_items = array();
44
+
45
+ var $fetch_attachments = false;
46
+ var $url_remap = array();
47
+ var $featured_images = array();
48
+
49
+ /**
50
+ * Registered callback function for the WordPress Importer
51
+ *
52
+ * Manages the three separate stages of the WXR import process
53
+ */
54
+ function dispatch() {
55
+ $this->header();
56
+
57
+ $step = empty( $_GET['step'] ) ? 0 : (int) $_GET['step'];
58
+ switch ( $step ) {
59
+ case 0:
60
+ $this->greet();
61
+ break;
62
+ case 1:
63
+ check_admin_referer( 'import-upload' );
64
+ if ( $this->handle_upload() )
65
+ $this->import_options();
66
+ break;
67
+ case 2:
68
+ check_admin_referer( 'import-wordpress' );
69
+ $this->fetch_attachments = ( ! empty( $_POST['fetch_attachments'] ) && $this->allow_fetch_attachments() );
70
+ $this->id = (int) $_POST['import_id'];
71
+ $file = get_attached_file( $this->id );
72
+ set_time_limit(0);
73
+ $this->import( $file );
74
+ break;
75
+ }
76
+
77
+ $this->footer();
78
+ }
79
+
80
+ /**
81
+ * The main controller for the actual import stage.
82
+ *
83
+ * @param string $file Path to the WXR file for importing
84
+ */
85
+ function import( $file ) {
86
+ add_filter( 'import_post_meta_key', array( $this, 'is_valid_meta_key' ) );
87
+ add_filter( 'http_request_timeout', array( &$this, 'bump_request_timeout' ) );
88
+
89
+ $this->import_start( $file );
90
+
91
+ $this->get_author_mapping();
92
+
93
+ wp_suspend_cache_invalidation( true );
94
+ $this->process_categories();
95
+ $this->process_tags();
96
+ $this->process_terms();
97
+ $this->process_posts();
98
+ wp_suspend_cache_invalidation( false );
99
+
100
+ // update incorrect/missing information in the DB
101
+ $this->backfill_parents();
102
+ $this->backfill_attachment_urls();
103
+ $this->remap_featured_images();
104
+
105
+ $this->import_end();
106
+ }
107
+
108
+ /**
109
+ * Parses the WXR file and prepares us for the task of processing parsed data
110
+ *
111
+ * @param string $file Path to the WXR file for importing
112
+ */
113
+ function import_start( $file ) {
114
+ if ( ! is_file($file) ) {
115
+ echo '<p><strong>' . __( 'Sorry, there has been an error.', 'wordpress-importer' ) . '</strong><br />';
116
+ echo __( 'The file does not exist, please try again.', 'wordpress-importer' ) . '</p>';
117
+ $this->footer();
118
+ die();
119
+ }
120
+
121
+ $import_data = $this->parse( $file );
122
+
123
+ if ( is_wp_error( $import_data ) ) {
124
+ echo '<p><strong>' . __( 'Sorry, there has been an error.', 'wordpress-importer' ) . '</strong><br />';
125
+ echo esc_html( $import_data->get_error_message() ) . '</p>';
126
+ $this->footer();
127
+ die();
128
+ }
129
+
130
+ $this->version = $import_data['version'];
131
+ $this->get_authors_from_import( $import_data );
132
+ $this->posts = $import_data['posts'];
133
+ $this->terms = $import_data['terms'];
134
+ $this->categories = $import_data['categories'];
135
+ $this->tags = $import_data['tags'];
136
+ $this->base_url = esc_url( $import_data['base_url'] );
137
+
138
+ wp_defer_term_counting( true );
139
+ wp_defer_comment_counting( true );
140
+
141
+ do_action( 'import_start' );
142
+ }
143
+
144
+ /**
145
+ * Performs post-import cleanup of files and the cache
146
+ */
147
+ function import_end() {
148
+ wp_import_cleanup( $this->id );
149
+
150
+ wp_cache_flush();
151
+ foreach ( get_taxonomies() as $tax ) {
152
+ delete_option( "{$tax}_children" );
153
+ _get_term_hierarchy( $tax );
154
+ }
155
+
156
+ wp_defer_term_counting( false );
157
+ wp_defer_comment_counting( false );
158
+
159
+ echo '<p>' . __( 'All done.', 'wordpress-importer' ) . ' <a href="' . admin_url() . '">' . __( 'Have fun!', 'wordpress-importer' ) . '</a>' . '</p>';
160
+ echo '<p>' . __( 'Remember to update the passwords and roles of imported users.', 'wordpress-importer' ) . '</p>';
161
+
162
+ do_action( 'import_end' );
163
+ }
164
+
165
+ /**
166
+ * Handles the WXR upload and initial parsing of the file to prepare for
167
+ * displaying author import options
168
+ *
169
+ * @return bool False if error uploading or invalid file, true otherwise
170
+ */
171
+ function handle_upload() {
172
+ $file = wp_import_handle_upload();
173
+
174
+ if ( isset( $file['error'] ) ) {
175
+ echo '<p><strong>' . __( 'Sorry, there has been an error.', 'wordpress-importer' ) . '</strong><br />';
176
+ echo esc_html( $file['error'] ) . '</p>';
177
+ return false;
178
+ } else if ( ! file_exists( $file['file'] ) ) {
179
+ echo '<p><strong>' . __( 'Sorry, there has been an error.', 'wordpress-importer' ) . '</strong><br />';
180
+ printf( __( 'The export file could not be found at <code>%s</code>. It is likely that this was caused by a permissions problem.', 'wordpress-importer' ), esc_html( $file['file'] ) );
181
+ echo '</p>';
182
+ return false;
183
+ }
184
+
185
+ $this->id = (int) $file['id'];
186
+ $import_data = $this->parse( $file['file'] );
187
+ if ( is_wp_error( $import_data ) ) {
188
+ echo '<p><strong>' . __( 'Sorry, there has been an error.', 'wordpress-importer' ) . '</strong><br />';
189
+ echo esc_html( $import_data->get_error_message() ) . '</p>';
190
+ return false;
191
+ }
192
+
193
+ $this->version = $import_data['version'];
194
+ if ( $this->version > $this->max_wxr_version ) {
195
+ echo '<div class="error"><p><strong>';
196
+ printf( __( 'This WXR file (version %s) may not be supported by this version of the importer. Please consider updating.', 'wordpress-importer' ), esc_html($import_data['version']) );
197
+ echo '</strong></p></div>';
198
+ }
199
+
200
+ $this->get_authors_from_import( $import_data );
201
+
202
+ return true;
203
+ }
204
+
205
+ /**
206
+ * Retrieve authors from parsed WXR data
207
+ *
208
+ * Uses the provided author information from WXR 1.1 files
209
+ * or extracts info from each post for WXR 1.0 files
210
+ *
211
+ * @param array $import_data Data returned by a WXR parser
212
+ */
213
+ function get_authors_from_import( $import_data ) {
214
+ if ( ! empty( $import_data['authors'] ) ) {
215
+ $this->authors = $import_data['authors'];
216
+ // no author information, grab it from the posts
217
+ } else {
218
+ foreach ( $import_data['posts'] as $post ) {
219
+ $login = sanitize_user( $post['post_author'], true );
220
+ if ( empty( $login ) ) {
221
+ printf( __( 'Failed to import author %s. Their posts will be attributed to the current user.', 'wordpress-importer' ), esc_html( $post['post_author'] ) );
222
+ echo '<br />';
223
+ continue;
224
+ }
225
+
226
+ if ( ! isset($this->authors[$login]) )
227
+ $this->authors[$login] = array(
228
+ 'author_login' => $login,
229
+ 'author_display_name' => $post['post_author']
230
+ );
231
+ }
232
+ }
233
+ }
234
+
235
+ /**
236
+ * Display pre-import options, author importing/mapping and option to
237
+ * fetch attachments
238
+ */
239
+ function import_options() {
240
+ $j = 0;
241
+ ?>
242
+ <form action="<?php echo admin_url( 'admin.php?import=wordpress&amp;step=2' ); ?>" method="post">
243
+ <?php wp_nonce_field( 'import-wordpress' ); ?>
244
+ <input type="hidden" name="import_id" value="<?php echo $this->id; ?>" />
245
+
246
+ <?php if ( ! empty( $this->authors ) ) : ?>
247
+ <h3><?php _e( 'Assign Authors', 'wordpress-importer' ); ?></h3>
248
+ <p><?php _e( 'To make it easier for you to edit and save the imported content, you may want to reassign the author of the imported item to an existing user of this site. For example, you may want to import all the entries as <code>admin</code>s entries.', 'wordpress-importer' ); ?></p>
249
+ <?php if ( $this->allow_create_users() ) : ?>
250
+ <p><?php printf( __( 'If a new user is created by WordPress, a new password will be randomly generated and the new user&#8217;s role will be set as %s. Manually changing the new user&#8217;s details will be necessary.', 'wordpress-importer' ), esc_html( get_option('default_role') ) ); ?></p>
251
+ <?php endif; ?>
252
+ <ol id="authors">
253
+ <?php foreach ( $this->authors as $author ) : ?>
254
+ <li><?php $this->author_select( $j++, $author ); ?></li>
255
+ <?php endforeach; ?>
256
+ </ol>
257
+ <?php endif; ?>
258
+
259
+ <?php if ( $this->allow_fetch_attachments() ) : ?>
260
+ <h3><?php _e( 'Import Attachments', 'wordpress-importer' ); ?></h3>
261
+ <p>
262
+ <input type="checkbox" value="1" name="fetch_attachments" id="import-attachments" />
263
+ <label for="import-attachments"><?php _e( 'Download and import file attachments', 'wordpress-importer' ); ?></label>
264
+ </p>
265
+ <?php endif; ?>
266
+
267
+ <p class="submit"><input type="submit" class="button" value="<?php esc_attr_e( 'Submit', 'wordpress-importer' ); ?>" /></p>
268
+ </form>
269
+ <?php
270
+ }
271
+
272
+ /**
273
+ * Display import options for an individual author. That is, either create
274
+ * a new user based on import info or map to an existing user
275
+ *
276
+ * @param int $n Index for each author in the form
277
+ * @param array $author Author information, e.g. login, display name, email
278
+ */
279
+ function author_select( $n, $author ) {
280
+ _e( 'Import author:', 'wordpress-importer' );
281
+ echo ' <strong>' . esc_html( $author['author_display_name'] );
282
+ if ( $this->version != '1.0' ) echo ' (' . esc_html( $author['author_login'] ) . ')';
283
+ echo '</strong><br />';
284
+
285
+ if ( $this->version != '1.0' )
286
+ echo '<div style="margin-left:18px">';
287
+
288
+ $create_users = $this->allow_create_users();
289
+ if ( $create_users ) {
290
+ if ( $this->version != '1.0' ) {
291
+ _e( 'or create new user with login name:', 'wordpress-importer' );
292
+ $value = '';
293
+ } else {
294
+ _e( 'as a new user:', 'wordpress-importer' );
295
+ $value = esc_attr( sanitize_user( $author['author_login'], true ) );
296
+ }
297
+
298
+ echo ' <input type="text" name="user_new['.$n.']" value="'. $value .'" /><br />';
299
+ }
300
+
301
+ if ( ! $create_users && $this->version == '1.0' )
302
+ _e( 'assign posts to an existing user:', 'wordpress-importer' );
303
+ else
304
+ _e( 'or assign posts to an existing user:', 'wordpress-importer' );
305
+ wp_dropdown_users( array( 'name' => "user_map[$n]", 'multi' => true, 'show_option_all' => __( '- Select -', 'wordpress-importer' ) ) );
306
+ echo '<input type="hidden" name="imported_authors['.$n.']" value="' . esc_attr( $author['author_login'] ) . '" />';
307
+
308
+ if ( $this->version != '1.0' )
309
+ echo '</div>';
310
+ }
311
+
312
+ /**
313
+ * Map old author logins to local user IDs based on decisions made
314
+ * in import options form. Can map to an existing user, create a new user
315
+ * or falls back to the current user in case of error with either of the previous
316
+ */
317
+ function get_author_mapping() {
318
+ if ( ! isset( $_POST['imported_authors'] ) )
319
+ return;
320
+
321
+ $create_users = $this->allow_create_users();
322
+
323
+ foreach ( (array) $_POST['imported_authors'] as $i => $old_login ) {
324
+ // Multisite adds strtolower to sanitize_user. Need to sanitize here to stop breakage in process_posts.
325
+ $santized_old_login = sanitize_user( $old_login, true );
326
+ $old_id = isset( $this->authors[$old_login]['author_id'] ) ? intval($this->authors[$old_login]['author_id']) : false;
327
+
328
+ if ( ! empty( $_POST['user_map'][$i] ) ) {
329
+ $user = get_userdata( intval($_POST['user_map'][$i]) );
330
+ if ( isset( $user->ID ) ) {
331
+ if ( $old_id )
332
+ $this->processed_authors[$old_id] = $user->ID;
333
+ $this->author_mapping[$santized_old_login] = $user->ID;
334
+ }
335
+ } else if ( $create_users ) {
336
+ if ( ! empty($_POST['user_new'][$i]) ) {
337
+ $user_id = wp_create_user( $_POST['user_new'][$i], wp_generate_password() );
338
+ } else if ( $this->version != '1.0' ) {
339
+ $user_data = array(
340
+ 'user_login' => $old_login,
341
+ 'user_pass' => wp_generate_password(),
342
+ 'user_email' => isset( $this->authors[$old_login]['author_email'] ) ? $this->authors[$old_login]['author_email'] : '',
343
+ 'display_name' => $this->authors[$old_login]['author_display_name'],
344
+ 'first_name' => isset( $this->authors[$old_login]['author_first_name'] ) ? $this->authors[$old_login]['author_first_name'] : '',
345
+ 'last_name' => isset( $this->authors[$old_login]['author_last_name'] ) ? $this->authors[$old_login]['author_last_name'] : '',
346
+ );
347
+ $user_id = wp_insert_user( $user_data );
348
+ }
349
+
350
+ if ( ! is_wp_error( $user_id ) ) {
351
+ if ( $old_id )
352
+ $this->processed_authors[$old_id] = $user_id;
353
+ $this->author_mapping[$santized_old_login] = $user_id;
354
+ } else {
355
+ printf( __( 'Failed to create new user for %s. Their posts will be attributed to the current user.', 'wordpress-importer' ), esc_html($this->authors[$old_login]['author_display_name']) );
356
+ if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
357
+ echo ' ' . $user_id->get_error_message();
358
+ echo '<br />';
359
+ }
360
+ }
361
+
362
+ // failsafe: if the user_id was invalid, default to the current user
363
+ if ( ! isset( $this->author_mapping[$santized_old_login] ) ) {
364
+ if ( $old_id )
365
+ $this->processed_authors[$old_id] = (int) get_current_user_id();
366
+ $this->author_mapping[$santized_old_login] = (int) get_current_user_id();
367
+ }
368
+ }
369
+ }
370
+
371
+ /**
372
+ * Create new categories based on import information
373
+ *
374
+ * Doesn't create a new category if its slug already exists
375
+ */
376
+ function process_categories() {
377
+ $this->categories = apply_filters( 'wp_import_categories', $this->categories );
378
+
379
+ if ( empty( $this->categories ) )
380
+ return;
381
+
382
+ foreach ( $this->categories as $cat ) {
383
+ // if the category already exists leave it alone
384
+ $term_id = term_exists( $cat['category_nicename'], 'category' );
385
+ if ( $term_id ) {
386
+ if ( is_array($term_id) ) $term_id = $term_id['term_id'];
387
+ if ( isset($cat['term_id']) )
388
+ $this->processed_terms[intval($cat['term_id'])] = (int) $term_id;
389
+ continue;
390
+ }
391
+
392
+ $category_parent = empty( $cat['category_parent'] ) ? 0 : category_exists( $cat['category_parent'] );
393
+ $category_description = isset( $cat['category_description'] ) ? $cat['category_description'] : '';
394
+ $catarr = array(
395
+ 'category_nicename' => $cat['category_nicename'],
396
+ 'category_parent' => $category_parent,
397
+ 'cat_name' => $cat['cat_name'],
398
+ 'category_description' => $category_description
399
+ );
400
+ $catarr = wp_slash( $catarr );
401
+
402
+ $id = wp_insert_category( $catarr );
403
+ if ( ! is_wp_error( $id ) ) {
404
+ if ( isset($cat['term_id']) )
405
+ $this->processed_terms[intval($cat['term_id'])] = $id;
406
+ } else {
407
+ printf( __( 'Failed to import category %s', 'wordpress-importer' ), esc_html($cat['category_nicename']) );
408
+ if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
409
+ echo ': ' . $id->get_error_message();
410
+ echo '<br />';
411
+ continue;
412
+ }
413
+
414
+ $this->process_termmeta( $cat, $id['term_id'] );
415
+ }
416
+
417
+ unset( $this->categories );
418
+ }
419
+
420
+ /**
421
+ * Create new post tags based on import information
422
+ *
423
+ * Doesn't create a tag if its slug already exists
424
+ */
425
+ function process_tags() {
426
+ $this->tags = apply_filters( 'wp_import_tags', $this->tags );
427
+
428
+ if ( empty( $this->tags ) )
429
+ return;
430
+
431
+ foreach ( $this->tags as $tag ) {
432
+ // if the tag already exists leave it alone
433
+ $term_id = term_exists( $tag['tag_slug'], 'post_tag' );
434
+ if ( $term_id ) {
435
+ if ( is_array($term_id) ) $term_id = $term_id['term_id'];
436
+ if ( isset($tag['term_id']) )
437
+ $this->processed_terms[intval($tag['term_id'])] = (int) $term_id;
438
+ continue;
439
+ }
440
+
441
+ $tag = wp_slash( $tag );
442
+ $tag_desc = isset( $tag['tag_description'] ) ? $tag['tag_description'] : '';
443
+ $tagarr = array( 'slug' => $tag['tag_slug'], 'description' => $tag_desc );
444
+
445
+ $id = wp_insert_term( $tag['tag_name'], 'post_tag', $tagarr );
446
+ if ( ! is_wp_error( $id ) ) {
447
+ if ( isset($tag['term_id']) )
448
+ $this->processed_terms[intval($tag['term_id'])] = $id['term_id'];
449
+ } else {
450
+ printf( __( 'Failed to import post tag %s', 'wordpress-importer' ), esc_html($tag['tag_name']) );
451
+ if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
452
+ echo ': ' . $id->get_error_message();
453
+ echo '<br />';
454
+ continue;
455
+ }
456
+
457
+ $this->process_termmeta( $tag, $id['term_id'] );
458
+ }
459
+
460
+ unset( $this->tags );
461
+ }
462
+
463
+ /**
464
+ * Create new terms based on import information
465
+ *
466
+ * Doesn't create a term its slug already exists
467
+ */
468
+ function process_terms() {
469
+ $this->terms = apply_filters( 'wp_import_terms', $this->terms );
470
+
471
+ if ( empty( $this->terms ) )
472
+ return;
473
+
474
+ foreach ( $this->terms as $term ) {
475
+ // if the term already exists in the correct taxonomy leave it alone
476
+ $term_id = term_exists( $term['slug'], $term['term_taxonomy'] );
477
+ if ( $term_id ) {
478
+ if ( is_array($term_id) ) $term_id = $term_id['term_id'];
479
+ if ( isset($term['term_id']) )
480
+ $this->processed_terms[intval($term['term_id'])] = (int) $term_id;
481
+ continue;
482
+ }
483
+
484
+ if ( empty( $term['term_parent'] ) ) {
485
+ $parent = 0;
486
+ } else {
487
+ $parent = term_exists( $term['term_parent'], $term['term_taxonomy'] );
488
+ if ( is_array( $parent ) ) $parent = $parent['term_id'];
489
+ }
490
+ $term = wp_slash( $term );
491
+ $description = isset( $term['term_description'] ) ? $term['term_description'] : '';
492
+ $termarr = array( 'slug' => $term['slug'], 'description' => $description, 'parent' => intval($parent) );
493
+
494
+ $id = wp_insert_term( $term['term_name'], $term['term_taxonomy'], $termarr );
495
+ if ( ! is_wp_error( $id ) ) {
496
+ if ( isset($term['term_id']) )
497
+ $this->processed_terms[intval($term['term_id'])] = $id['term_id'];
498
+ } else {
499
+ printf( __( 'Failed to import %s %s', 'wordpress-importer' ), esc_html($term['term_taxonomy']), esc_html($term['term_name']) );
500
+ if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
501
+ echo ': ' . $id->get_error_message();
502
+ echo '<br />';
503
+ continue;
504
+ }
505
+
506
+ $this->process_termmeta( $term, $id['term_id'] );
507
+ }
508
+
509
+ unset( $this->terms );
510
+ }
511
+
512
+ /**
513
+ * Add metadata to imported term.
514
+ *
515
+ * @since 0.6.2
516
+ *
517
+ * @param array $term Term data from WXR import.
518
+ * @param int $term_id ID of the newly created term.
519
+ */
520
+ protected function process_termmeta( $term, $term_id ) {
521
+ if ( ! isset( $term['termmeta'] ) ) {
522
+ $term['termmeta'] = array();
523
+ }
524
+
525
+ /**
526
+ * Filters the metadata attached to an imported term.
527
+ *
528
+ * @since 0.6.2
529
+ *
530
+ * @param array $termmeta Array of term meta.
531
+ * @param int $term_id ID of the newly created term.
532
+ * @param array $term Term data from the WXR import.
533
+ */
534
+ $term['termmeta'] = apply_filters( 'wp_import_term_meta', $term['termmeta'], $term_id, $term );
535
+
536
+ if ( empty( $term['termmeta'] ) ) {
537
+ return;
538
+ }
539
+
540
+ foreach ( $term['termmeta'] as $meta ) {
541
+ /**
542
+ * Filters the meta key for an imported piece of term meta.
543
+ *
544
+ * @since 0.6.2
545
+ *
546
+ * @param string $meta_key Meta key.
547
+ * @param int $term_id ID of the newly created term.
548
+ * @param array $term Term data from the WXR import.
549
+ */
550
+ $key = apply_filters( 'import_term_meta_key', $meta['key'], $term_id, $term );
551
+ if ( ! $key ) {
552
+ continue;
553
+ }
554
+
555
+ // Export gets meta straight from the DB so could have a serialized string
556
+ $value = maybe_unserialize( $meta['value'] );
557
+
558
+ add_term_meta( $term_id, $key, $value );
559
+
560
+ /**
561
+ * Fires after term meta is imported.
562
+ *
563
+ * @since 0.6.2
564
+ *
565
+ * @param int $term_id ID of the newly created term.
566
+ * @param string $key Meta key.
567
+ * @param mixed $value Meta value.
568
+ */
569
+ do_action( 'import_term_meta', $term_id, $key, $value );
570
+ }
571
+ }
572
+
573
+ /**
574
+ * Create new posts based on import information
575
+ *
576
+ * Posts marked as having a parent which doesn't exist will become top level items.
577
+ * Doesn't create a new post if: the post type doesn't exist, the given post ID
578
+ * is already noted as imported or a post with the same title and date already exists.
579
+ * Note that new/updated terms, comments and meta are imported for the last of the above.
580
+ */
581
+ function process_posts() {
582
+ $this->posts = apply_filters( 'wp_import_posts', $this->posts );
583
+
584
+ foreach ( $this->posts as $post ) {
585
+ $post = apply_filters( 'wp_import_post_data_raw', $post );
586
+
587
+ if ( ! post_type_exists( $post['post_type'] ) ) {
588
+ printf( __( 'Failed to import &#8220;%s&#8221;: Invalid post type %s', 'wordpress-importer' ),
589
+ esc_html($post['post_title']), esc_html($post['post_type']) );
590
+ echo '<br />';
591
+ do_action( 'wp_import_post_exists', $post );
592
+ continue;
593
+ }
594
+
595
+ if ( isset( $this->processed_posts[$post['post_id']] ) && ! empty( $post['post_id'] ) )
596
+ continue;
597
+
598
+ if ( $post['status'] == 'auto-draft' )
599
+ continue;
600
+
601
+ if ( 'nav_menu_item' == $post['post_type'] ) {
602
+ $this->process_menu_item( $post );
603
+ continue;
604
+ }
605
+
606
+ $post_type_object = get_post_type_object( $post['post_type'] );
607
+
608
+ $post_exists = post_exists( $post['post_title'], '', $post['post_date'] );
609
+
610
+ /**
611
+ * Filter ID of the existing post corresponding to post currently importing.
612
+ *
613
+ * Return 0 to force the post to be imported. Filter the ID to be something else
614
+ * to override which existing post is mapped to the imported post.
615
+ *
616
+ * @see post_exists()
617
+ * @since 0.6.2
618
+ *
619
+ * @param int $post_exists Post ID, or 0 if post did not exist.
620
+ * @param array $post The post array to be inserted.
621
+ */
622
+ $post_exists = apply_filters( 'wp_import_existing_post', $post_exists, $post );
623
+
624
+ if ( $post_exists && get_post_type( $post_exists ) == $post['post_type'] ) {
625
+ printf( __('%s &#8220;%s&#8221; already exists.', 'wordpress-importer'), $post_type_object->labels->singular_name, esc_html($post['post_title']) );
626
+ echo '<br />';
627
+ $comment_post_ID = $post_id = $post_exists;
628
+ $this->processed_posts[ intval( $post['post_id'] ) ] = intval( $post_exists );
629
+ } else {
630
+ $post_parent = (int) $post['post_parent'];
631
+ if ( $post_parent ) {
632
+ // if we already know the parent, map it to the new local ID
633
+ if ( isset( $this->processed_posts[$post_parent] ) ) {
634
+ $post_parent = $this->processed_posts[$post_parent];
635
+ // otherwise record the parent for later
636
+ } else {
637
+ $this->post_orphans[intval($post['post_id'])] = $post_parent;
638
+ $post_parent = 0;
639
+ }
640
+ }
641
+
642
+ // map the post author
643
+ $author = sanitize_user( $post['post_author'], true );
644
+ if ( isset( $this->author_mapping[$author] ) )
645
+ $author = $this->author_mapping[$author];
646
+ else
647
+ $author = (int) get_current_user_id();
648
+
649
+ $postdata = array(
650
+ 'import_id' => $post['post_id'], 'post_author' => $author, 'post_date' => $post['post_date'],
651
+ 'post_date_gmt' => $post['post_date_gmt'], 'post_content' => $post['post_content'],
652
+ 'post_excerpt' => $post['post_excerpt'], 'post_title' => $post['post_title'],
653
+ 'post_status' => $post['status'], 'post_name' => $post['post_name'],
654
+ 'comment_status' => $post['comment_status'], 'ping_status' => $post['ping_status'],
655
+ 'guid' => $post['guid'], 'post_parent' => $post_parent, 'menu_order' => $post['menu_order'],
656
+ 'post_type' => $post['post_type'], 'post_password' => $post['post_password']
657
+ );
658
+
659
+ $original_post_ID = $post['post_id'];
660
+ $postdata = apply_filters( 'wp_import_post_data_processed', $postdata, $post );
661
+
662
+ $postdata = wp_slash( $postdata );
663
+
664
+ if ( 'attachment' == $postdata['post_type'] ) {
665
+ $remote_url = ! empty($post['attachment_url']) ? $post['attachment_url'] : $post['guid'];
666
+
667
+ // try to use _wp_attached file for upload folder placement to ensure the same location as the export site
668
+ // e.g. location is 2003/05/image.jpg but the attachment post_date is 2010/09, see media_handle_upload()
669
+ $postdata['upload_date'] = $post['post_date'];
670
+ if ( isset( $post['postmeta'] ) ) {
671
+ foreach( $post['postmeta'] as $meta ) {
672
+ if ( $meta['key'] == '_wp_attached_file' ) {
673
+ if ( preg_match( '%^[0-9]{4}/[0-9]{2}%', $meta['value'], $matches ) )
674
+ $postdata['upload_date'] = $matches[0];
675
+ break;
676
+ }
677
+ }
678
+ }
679
+
680
+ $comment_post_ID = $post_id = $this->process_attachment( $postdata, $remote_url );
681
+ } else {
682
+ $comment_post_ID = $post_id = wp_insert_post( $postdata, true );
683
+ do_action( 'wp_import_insert_post', $post_id, $original_post_ID, $postdata, $post );
684
+ }
685
+
686
+ if ( is_wp_error( $post_id ) ) {
687
+ printf( __( 'Failed to import %s &#8220;%s&#8221;', 'wordpress-importer' ),
688
+ $post_type_object->labels->singular_name, esc_html($post['post_title']) );
689
+ if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
690
+ echo ': ' . $post_id->get_error_message();
691
+ echo '<br />';
692
+ continue;
693
+ }
694
+
695
+ if ( $post['is_sticky'] == 1 )
696
+ stick_post( $post_id );
697
+ }
698
+
699
+ // map pre-import ID to local ID
700
+ $this->processed_posts[intval($post['post_id'])] = (int) $post_id;
701
+
702
+ if ( ! isset( $post['terms'] ) )
703
+ $post['terms'] = array();
704
+
705
+ $post['terms'] = apply_filters( 'wp_import_post_terms', $post['terms'], $post_id, $post );
706
+
707
+ // add categories, tags and other terms
708
+ if ( ! empty( $post['terms'] ) ) {
709
+ $terms_to_set = array();
710
+ foreach ( $post['terms'] as $term ) {
711
+ // back compat with WXR 1.0 map 'tag' to 'post_tag'
712
+ $taxonomy = ( 'tag' == $term['domain'] ) ? 'post_tag' : $term['domain'];
713
+ $term_exists = term_exists( $term['slug'], $taxonomy );
714
+ $term_id = is_array( $term_exists ) ? $term_exists['term_id'] : $term_exists;
715
+ if ( ! $term_id ) {
716
+ $t = wp_insert_term( $term['name'], $taxonomy, array( 'slug' => $term['slug'] ) );
717
+ if ( ! is_wp_error( $t ) ) {
718
+ $term_id = $t['term_id'];
719
+ do_action( 'wp_import_insert_term', $t, $term, $post_id, $post );
720
+ } else {
721
+ printf( __( 'Failed to import %s %s', 'wordpress-importer' ), esc_html($taxonomy), esc_html($term['name']) );
722
+ if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
723
+ echo ': ' . $t->get_error_message();
724
+ echo '<br />';
725
+ do_action( 'wp_import_insert_term_failed', $t, $term, $post_id, $post );
726
+ continue;
727
+ }
728
+ }
729
+ $terms_to_set[$taxonomy][] = intval( $term_id );
730
+ }
731
+
732
+ foreach ( $terms_to_set as $tax => $ids ) {
733
+ $tt_ids = wp_set_post_terms( $post_id, $ids, $tax );
734
+ do_action( 'wp_import_set_post_terms', $tt_ids, $ids, $tax, $post_id, $post );
735
+ }
736
+ unset( $post['terms'], $terms_to_set );
737
+ }
738
+
739
+ if ( ! isset( $post['comments'] ) )
740
+ $post['comments'] = array();
741
+
742
+ $post['comments'] = apply_filters( 'wp_import_post_comments', $post['comments'], $post_id, $post );
743
+
744
+ // add/update comments
745
+ if ( ! empty( $post['comments'] ) ) {
746
+ $num_comments = 0;
747
+ $inserted_comments = array();
748
+ foreach ( $post['comments'] as $comment ) {
749
+ $comment_id = $comment['comment_id'];
750
+ $newcomments[$comment_id]['comment_post_ID'] = $comment_post_ID;
751
+ $newcomments[$comment_id]['comment_author'] = $comment['comment_author'];
752
+ $newcomments[$comment_id]['comment_author_email'] = $comment['comment_author_email'];
753
+ $newcomments[$comment_id]['comment_author_IP'] = $comment['comment_author_IP'];
754
+ $newcomments[$comment_id]['comment_author_url'] = $comment['comment_author_url'];
755
+ $newcomments[$comment_id]['comment_date'] = $comment['comment_date'];
756
+ $newcomments[$comment_id]['comment_date_gmt'] = $comment['comment_date_gmt'];
757
+ $newcomments[$comment_id]['comment_content'] = $comment['comment_content'];
758
+ $newcomments[$comment_id]['comment_approved'] = $comment['comment_approved'];
759
+ $newcomments[$comment_id]['comment_type'] = $comment['comment_type'];
760
+ $newcomments[$comment_id]['comment_parent'] = $comment['comment_parent'];
761
+ $newcomments[$comment_id]['commentmeta'] = isset( $comment['commentmeta'] ) ? $comment['commentmeta'] : array();
762
+ if ( isset( $this->processed_authors[$comment['comment_user_id']] ) )
763
+ $newcomments[$comment_id]['user_id'] = $this->processed_authors[$comment['comment_user_id']];
764
+ }
765
+ ksort( $newcomments );
766
+
767
+ foreach ( $newcomments as $key => $comment ) {
768
+ // if this is a new post we can skip the comment_exists() check
769
+ if ( ! $post_exists || ! comment_exists( $comment['comment_author'], $comment['comment_date'] ) ) {
770
+ if ( isset( $inserted_comments[$comment['comment_parent']] ) )
771
+ $comment['comment_parent'] = $inserted_comments[$comment['comment_parent']];
772
+ $comment = wp_slash( $comment );
773
+ $comment = wp_filter_comment( $comment );
774
+ $inserted_comments[$key] = wp_insert_comment( $comment );
775
+ do_action( 'wp_import_insert_comment', $inserted_comments[$key], $comment, $comment_post_ID, $post );
776
+
777
+ foreach( $comment['commentmeta'] as $meta ) {
778
+ $value = maybe_unserialize( $meta['value'] );
779
+ add_comment_meta( $inserted_comments[$key], $meta['key'], $value );
780
+ }
781
+
782
+ $num_comments++;
783
+ }
784
+ }
785
+ unset( $newcomments, $inserted_comments, $post['comments'] );
786
+ }
787
+
788
+ if ( ! isset( $post['postmeta'] ) )
789
+ $post['postmeta'] = array();
790
+
791
+ $post['postmeta'] = apply_filters( 'wp_import_post_meta', $post['postmeta'], $post_id, $post );
792
+
793
+ // add/update post meta
794
+ if ( ! empty( $post['postmeta'] ) ) {
795
+ foreach ( $post['postmeta'] as $meta ) {
796
+ $key = apply_filters( 'import_post_meta_key', $meta['key'], $post_id, $post );
797
+ $value = false;
798
+
799
+ if ( '_edit_last' == $key ) {
800
+ if ( isset( $this->processed_authors[intval($meta['value'])] ) )
801
+ $value = $this->processed_authors[intval($meta['value'])];
802
+ else
803
+ $key = false;
804
+ }
805
+
806
+ if ( $key ) {
807
+ // export gets meta straight from the DB so could have a serialized string
808
+ if ( ! $value )
809
+ $value = maybe_unserialize( $meta['value'] );
810
+
811
+ add_post_meta( $post_id, $key, $value );
812
+ do_action( 'import_post_meta', $post_id, $key, $value );
813
+
814
+ // if the post has a featured image, take note of this in case of remap
815
+ if ( '_thumbnail_id' == $key )
816
+ $this->featured_images[$post_id] = (int) $value;
817
+ }
818
+ }
819
+ }
820
+ }
821
+
822
+ unset( $this->posts );
823
+ }
824
+
825
+ /**
826
+ * Attempt to create a new menu item from import data
827
+ *
828
+ * Fails for draft, orphaned menu items and those without an associated nav_menu
829
+ * or an invalid nav_menu term. If the post type or term object which the menu item
830
+ * represents doesn't exist then the menu item will not be imported (waits until the
831
+ * end of the import to retry again before discarding).
832
+ *
833
+ * @param array $item Menu item details from WXR file
834
+ */
835
+ function process_menu_item( $item ) {
836
+ // skip draft, orphaned menu items
837
+ if ( 'draft' == $item['status'] )
838
+ return;
839
+
840
+ $menu_slug = false;
841
+ if ( isset($item['terms']) ) {
842
+ // loop through terms, assume first nav_menu term is correct menu
843
+ foreach ( $item['terms'] as $term ) {
844
+ if ( 'nav_menu' == $term['domain'] ) {
845
+ $menu_slug = $term['slug'];
846
+ break;
847
+ }
848
+ }
849
+ }
850
+
851
+ // no nav_menu term associated with this menu item
852
+ if ( ! $menu_slug ) {
853
+ _e( 'Menu item skipped due to missing menu slug', 'wordpress-importer' );
854
+ echo '<br />';
855
+ return;
856
+ }
857
+
858
+ $menu_id = term_exists( $menu_slug, 'nav_menu' );
859
+ if ( ! $menu_id ) {
860
+ printf( __( 'Menu item skipped due to invalid menu slug: %s', 'wordpress-importer' ), esc_html( $menu_slug ) );
861
+ echo '<br />';
862
+ return;
863
+ } else {
864
+ $menu_id = is_array( $menu_id ) ? $menu_id['term_id'] : $menu_id;
865
+ }
866
+
867
+ foreach ( $item['postmeta'] as $meta )
868
+ ${$meta['key']} = $meta['value'];
869
+
870
+ if ( 'taxonomy' == $_menu_item_type && isset( $this->processed_terms[intval($_menu_item_object_id)] ) ) {
871
+ $_menu_item_object_id = $this->processed_terms[intval($_menu_item_object_id)];
872
+ } else if ( 'post_type' == $_menu_item_type && isset( $this->processed_posts[intval($_menu_item_object_id)] ) ) {
873
+ $_menu_item_object_id = $this->processed_posts[intval($_menu_item_object_id)];
874
+ } else if ( 'custom' != $_menu_item_type ) {
875
+ // associated object is missing or not imported yet, we'll retry later
876
+ $this->missing_menu_items[] = $item;
877
+ return;
878
+ }
879
+
880
+ if ( isset( $this->processed_menu_items[intval($_menu_item_menu_item_parent)] ) ) {
881
+ $_menu_item_menu_item_parent = $this->processed_menu_items[intval($_menu_item_menu_item_parent)];
882
+ } else if ( $_menu_item_menu_item_parent ) {
883
+ $this->menu_item_orphans[intval($item['post_id'])] = (int) $_menu_item_menu_item_parent;
884
+ $_menu_item_menu_item_parent = 0;
885
+ }
886
+
887
+ // wp_update_nav_menu_item expects CSS classes as a space separated string
888
+ $_menu_item_classes = maybe_unserialize( $_menu_item_classes );
889
+ if ( is_array( $_menu_item_classes ) )
890
+ $_menu_item_classes = implode( ' ', $_menu_item_classes );
891
+
892
+ $args = array(
893
+ 'menu-item-object-id' => $_menu_item_object_id,
894
+ 'menu-item-object' => $_menu_item_object,
895
+ 'menu-item-parent-id' => $_menu_item_menu_item_parent,
896
+ 'menu-item-position' => intval( $item['menu_order'] ),
897
+ 'menu-item-type' => $_menu_item_type,
898
+ 'menu-item-title' => $item['post_title'],
899
+ 'menu-item-url' => $_menu_item_url,
900
+ 'menu-item-description' => $item['post_content'],
901
+ 'menu-item-attr-title' => $item['post_excerpt'],
902
+ 'menu-item-target' => $_menu_item_target,
903
+ 'menu-item-classes' => $_menu_item_classes,
904
+ 'menu-item-xfn' => $_menu_item_xfn,
905
+ 'menu-item-status' => $item['status']
906
+ );
907
+
908
+ $id = wp_update_nav_menu_item( $menu_id, 0, $args );
909
+ if ( $id && ! is_wp_error( $id ) )
910
+ $this->processed_menu_items[intval($item['post_id'])] = (int) $id;
911
+ }
912
+
913
+ /**
914
+ * If fetching attachments is enabled then attempt to create a new attachment
915
+ *
916
+ * @param array $post Attachment post details from WXR
917
+ * @param string $url URL to fetch attachment from
918
+ * @return int|WP_Error Post ID on success, WP_Error otherwise
919
+ */
920
+ function process_attachment( $post, $url ) {
921
+ if ( ! $this->fetch_attachments )
922
+ return new WP_Error( 'attachment_processing_error',
923
+ __( 'Fetching attachments is not enabled', 'wordpress-importer' ) );
924
+
925
+ // if the URL is absolute, but does not contain address, then upload it assuming base_site_url
926
+ if ( preg_match( '|^/[\w\W]+$|', $url ) )
927
+ $url = rtrim( $this->base_url, '/' ) . $url;
928
+
929
+ $upload = $this->fetch_remote_file( $url, $post );
930
+ if ( is_wp_error( $upload ) )
931
+ return $upload;
932
+
933
+ if ( $info = wp_check_filetype( $upload['file'] ) )
934
+ $post['post_mime_type'] = $info['type'];
935
+ else
936
+ return new WP_Error( 'attachment_processing_error', __('Invalid file type', 'wordpress-importer') );
937
+
938
+ $post['guid'] = $upload['url'];
939
+
940
+ // as per wp-admin/includes/upload.php
941
+ $post_id = wp_insert_attachment( $post, $upload['file'] );
942
+ wp_update_attachment_metadata( $post_id, wp_generate_attachment_metadata( $post_id, $upload['file'] ) );
943
+
944
+ // remap resized image URLs, works by stripping the extension and remapping the URL stub.
945
+ if ( preg_match( '!^image/!', $info['type'] ) ) {
946
+ $parts = pathinfo( $url );
947
+ $name = basename( $parts['basename'], ".{$parts['extension']}" ); // PATHINFO_FILENAME in PHP 5.2
948
+
949
+ $parts_new = pathinfo( $upload['url'] );
950
+ $name_new = basename( $parts_new['basename'], ".{$parts_new['extension']}" );
951
+
952
+ $this->url_remap[$parts['dirname'] . '/' . $name] = $parts_new['dirname'] . '/' . $name_new;
953
+ }
954
+
955
+ return $post_id;
956
+ }
957
+
958
+ /**
959
+ * Attempt to download a remote file attachment
960
+ *
961
+ * @param string $url URL of item to fetch
962
+ * @param array $post Attachment details
963
+ * @return array|WP_Error Local file location details on success, WP_Error otherwise
964
+ */
965
+ function fetch_remote_file( $url, $post ) {
966
+ // extract the file name and extension from the url
967
+ $file_name = basename( $url );
968
+
969
+ // get placeholder file in the upload dir with a unique, sanitized filename
970
+ $upload = wp_upload_bits( $file_name, 0, '', $post['upload_date'] );
971
+ if ( $upload['error'] )
972
+ return new WP_Error( 'upload_dir_error', $upload['error'] );
973
+
974
+ // fetch the remote url and write it to the placeholder file
975
+ $remote_response = wp_safe_remote_get( $url, array(
976
+ 'timeout' => 300,
977
+ 'stream' => true,
978
+ 'filename' => $upload['file'],
979
+ ) );
980
+
981
+ $headers = wp_remote_retrieve_headers( $remote_response );
982
+
983
+ // request failed
984
+ if ( ! $headers ) {
985
+ @unlink( $upload['file'] );
986
+ return new WP_Error( 'import_file_error', __('Remote server did not respond', 'wordpress-importer') );
987
+ }
988
+
989
+ $remote_response_code = wp_remote_retrieve_response_code( $remote_response );
990
+
991
+ // make sure the fetch was successful
992
+ if ( $remote_response_code != '200' ) {
993
+ @unlink( $upload['file'] );
994
+ return new WP_Error( 'import_file_error', sprintf( __('Remote server returned error response %1$d %2$s', 'wordpress-importer'), esc_html($remote_response_code), get_status_header_desc($remote_response_code) ) );
995
+ }
996
+
997
+ $filesize = filesize( $upload['file'] );
998
+
999
+ if ( isset( $headers['content-length'] ) && $filesize != $headers['content-length'] ) {
1000
+ @unlink( $upload['file'] );
1001
+ return new WP_Error( 'import_file_error', __('Remote file is incorrect size', 'wordpress-importer') );
1002
+ }
1003
+
1004
+ if ( 0 == $filesize ) {
1005
+ @unlink( $upload['file'] );
1006
+ return new WP_Error( 'import_file_error', __('Zero size file downloaded', 'wordpress-importer') );
1007
+ }
1008
+
1009
+ $max_size = (int) $this->max_attachment_size();
1010
+ if ( ! empty( $max_size ) && $filesize > $max_size ) {
1011
+ @unlink( $upload['file'] );
1012
+ return new WP_Error( 'import_file_error', sprintf(__('Remote file is too large, limit is %s', 'wordpress-importer'), size_format($max_size) ) );
1013
+ }
1014
+
1015
+ // keep track of the old and new urls so we can substitute them later
1016
+ $this->url_remap[$url] = $upload['url'];
1017
+ $this->url_remap[$post['guid']] = $upload['url']; // r13735, really needed?
1018
+ // keep track of the destination if the remote url is redirected somewhere else
1019
+ if ( isset($headers['x-final-location']) && $headers['x-final-location'] != $url )
1020
+ $this->url_remap[$headers['x-final-location']] = $upload['url'];
1021
+
1022
+ return $upload;
1023
+ }
1024
+
1025
+ /**
1026
+ * Attempt to associate posts and menu items with previously missing parents
1027
+ *
1028
+ * An imported post's parent may not have been imported when it was first created
1029
+ * so try again. Similarly for child menu items and menu items which were missing
1030
+ * the object (e.g. post) they represent in the menu
1031
+ */
1032
+ function backfill_parents() {
1033
+ global $wpdb;
1034
+
1035
+ // find parents for post orphans
1036
+ foreach ( $this->post_orphans as $child_id => $parent_id ) {
1037
+ $local_child_id = $local_parent_id = false;
1038
+ if ( isset( $this->processed_posts[$child_id] ) )
1039
+ $local_child_id = $this->processed_posts[$child_id];
1040
+ if ( isset( $this->processed_posts[$parent_id] ) )
1041
+ $local_parent_id = $this->processed_posts[$parent_id];
1042
+
1043
+ if ( $local_child_id && $local_parent_id ) {
1044
+ $wpdb->update( $wpdb->posts, array( 'post_parent' => $local_parent_id ), array( 'ID' => $local_child_id ), '%d', '%d' );
1045
+ clean_post_cache( $local_child_id );
1046
+ }
1047
+ }
1048
+
1049
+ // all other posts/terms are imported, retry menu items with missing associated object
1050
+ $missing_menu_items = $this->missing_menu_items;
1051
+ foreach ( $missing_menu_items as $item )
1052
+ $this->process_menu_item( $item );
1053
+
1054
+ // find parents for menu item orphans
1055
+ foreach ( $this->menu_item_orphans as $child_id => $parent_id ) {
1056
+ $local_child_id = $local_parent_id = 0;
1057
+ if ( isset( $this->processed_menu_items[$child_id] ) )
1058
+ $local_child_id = $this->processed_menu_items[$child_id];
1059
+ if ( isset( $this->processed_menu_items[$parent_id] ) )
1060
+ $local_parent_id = $this->processed_menu_items[$parent_id];
1061
+
1062
+ if ( $local_child_id && $local_parent_id )
1063
+ update_post_meta( $local_child_id, '_menu_item_menu_item_parent', (int) $local_parent_id );
1064
+ }
1065
+ }
1066
+
1067
+ /**
1068
+ * Use stored mapping information to update old attachment URLs
1069
+ */
1070
+ function backfill_attachment_urls() {
1071
+ global $wpdb;
1072
+ // make sure we do the longest urls first, in case one is a substring of another
1073
+ uksort( $this->url_remap, array(&$this, 'cmpr_strlen') );
1074
+
1075
+ foreach ( $this->url_remap as $from_url => $to_url ) {
1076
+ // remap urls in post_content
1077
+ $wpdb->query( $wpdb->prepare("UPDATE {$wpdb->posts} SET post_content = REPLACE(post_content, %s, %s)", $from_url, $to_url) );
1078
+ // remap enclosure urls
1079
+ $result = $wpdb->query( $wpdb->prepare("UPDATE {$wpdb->postmeta} SET meta_value = REPLACE(meta_value, %s, %s) WHERE meta_key='enclosure'", $from_url, $to_url) );
1080
+ }
1081
+ }
1082
+
1083
+ /**
1084
+ * Update _thumbnail_id meta to new, imported attachment IDs
1085
+ */
1086
+ function remap_featured_images() {
1087
+ // cycle through posts that have a featured image
1088
+ foreach ( $this->featured_images as $post_id => $value ) {
1089
+ if ( isset( $this->processed_posts[$value] ) ) {
1090
+ $new_id = $this->processed_posts[$value];
1091
+ // only update if there's a difference
1092
+ if ( $new_id != $value )
1093
+ update_post_meta( $post_id, '_thumbnail_id', $new_id );
1094
+ }
1095
+ }
1096
+ }
1097
+
1098
+ /**
1099
+ * Parse a WXR file
1100
+ *
1101
+ * @param string $file Path to WXR file for parsing
1102
+ * @return array Information gathered from the WXR file
1103
+ */
1104
+ function parse( $file ) {
1105
+ $parser = new WXR_Parser();
1106
+ return $parser->parse( $file );
1107
+ }
1108
+
1109
+ // Display import page title
1110
+ function header() {
1111
+ echo '<div class="wrap">';
1112
+ echo '<h2>' . __( 'Import WordPress', 'wordpress-importer' ) . '</h2>';
1113
+
1114
+ $updates = get_plugin_updates();
1115
+ $basename = plugin_basename(__FILE__);
1116
+ if ( isset( $updates[$basename] ) ) {
1117
+ $update = $updates[$basename];
1118
+ echo '<div class="error"><p><strong>';
1119
+ printf( __( 'A new version of this importer is available. Please update to version %s to ensure compatibility with newer export files.', 'wordpress-importer' ), $update->update->new_version );
1120
+ echo '</strong></p></div>';
1121
+ }
1122
+ }
1123
+
1124
+ // Close div.wrap
1125
+ function footer() {
1126
+ echo '</div>';
1127
+ }
1128
+
1129
+ /**
1130
+ * Display introductory text and file upload form
1131
+ */
1132
+ function greet() {
1133
+ echo '<div class="narrow">';
1134
+ echo '<p>'.__( 'Howdy! Upload your WordPress eXtended RSS (WXR) file and we&#8217;ll import the posts, pages, comments, custom fields, categories, and tags into this site.', 'wordpress-importer' ).'</p>';
1135
+ echo '<p>'.__( 'Choose a WXR (.xml) file to upload, then click Upload file and import.', 'wordpress-importer' ).'</p>';
1136
+ wp_import_upload_form( 'admin.php?import=wordpress&amp;step=1' );
1137
+ echo '</div>';
1138
+ }
1139
+
1140
+ /**
1141
+ * Decide if the given meta key maps to information we will want to import
1142
+ *
1143
+ * @param string $key The meta key to check
1144
+ * @return string|bool The key if we do want to import, false if not
1145
+ */
1146
+ function is_valid_meta_key( $key ) {
1147
+ // skip attachment metadata since we'll regenerate it from scratch
1148
+ // skip _edit_lock as not relevant for import
1149
+ if ( in_array( $key, array( '_wp_attached_file', '_wp_attachment_metadata', '_edit_lock' ) ) )
1150
+ return false;
1151
+ return $key;
1152
+ }
1153
+
1154
+ /**
1155
+ * Decide whether or not the importer is allowed to create users.
1156
+ * Default is true, can be filtered via import_allow_create_users
1157
+ *
1158
+ * @return bool True if creating users is allowed
1159
+ */
1160
+ function allow_create_users() {
1161
+ return apply_filters( 'import_allow_create_users', true );
1162
+ }
1163
+
1164
+ /**
1165
+ * Decide whether or not the importer should attempt to download attachment files.
1166
+ * Default is true, can be filtered via import_allow_fetch_attachments. The choice
1167
+ * made at the import options screen must also be true, false here hides that checkbox.
1168
+ *
1169
+ * @return bool True if downloading attachments is allowed
1170
+ */
1171
+ function allow_fetch_attachments() {
1172
+ return apply_filters( 'import_allow_fetch_attachments', true );
1173
+ }
1174
+
1175
+ /**
1176
+ * Decide what the maximum file size for downloaded attachments is.
1177
+ * Default is 0 (unlimited), can be filtered via import_attachment_size_limit
1178
+ *
1179
+ * @return int Maximum attachment file size to import
1180
+ */
1181
+ function max_attachment_size() {
1182
+ return apply_filters( 'import_attachment_size_limit', 0 );
1183
+ }
1184
+
1185
+ /**
1186
+ * Added to http_request_timeout filter to force timeout at 60 seconds during import
1187
+ * @return int 60
1188
+ */
1189
+ function bump_request_timeout( $val ) {
1190
+ return 60;
1191
+ }
1192
+
1193
+ // return the difference in length between two strings
1194
+ function cmpr_strlen( $a, $b ) {
1195
+ return strlen($b) - strlen($a);
1196
+ }
1197
+ }
1198
+ }
admin/demo-importer/class-wp-review-demo-importer.php CHANGED
@@ -1,38 +1,38 @@
1
- <?php
2
- /**
3
- * Demo importer
4
- *
5
- * @package WP_Review
6
- * @since 3.0.0
7
- */
8
-
9
- /**
10
- * Class WP_Review_Demo_Importer
11
- */
12
- class WP_Review_Demo_Importer {
13
-
14
- /**
15
- * Imports demo.
16
- *
17
- * @param string $file Import file path.
18
- */
19
- public function import( $file ) {
20
- add_filter( 'wp_import_post_data_processed', array( $this, 'filter_post_data' ) );
21
- $importer = new WP_Import();
22
- $importer->import( $file );
23
- remove_filter( 'wp_import_post_data_processed', array( $this, 'filter_post_data' ) );
24
- }
25
-
26
- /**
27
- * Filters post data before inserting.
28
- *
29
- * @param array $post_data Post data.
30
- * @return array
31
- */
32
- public function filter_post_data( $post_data ) {
33
- if ( 'attachment' !== $post_data['post_type'] ) {
34
- $post_data['post_status'] = 'draft';
35
- }
36
- return $post_data;
37
- }
38
- }
1
+ <?php
2
+ /**
3
+ * Demo importer
4
+ *
5
+ * @package WP_Review
6
+ * @since 3.0.0
7
+ */
8
+
9
+ /**
10
+ * Class WP_Review_Demo_Importer
11
+ */
12
+ class WP_Review_Demo_Importer {
13
+
14
+ /**
15
+ * Imports demo.
16
+ *
17
+ * @param string $file Import file path.
18
+ */
19
+ public function import( $file ) {
20
+ add_filter( 'wp_import_post_data_processed', array( $this, 'filter_post_data' ) );
21
+ $importer = new WP_Import();
22
+ $importer->import( $file );
23
+ remove_filter( 'wp_import_post_data_processed', array( $this, 'filter_post_data' ) );
24
+ }
25
+
26
+ /**
27
+ * Filters post data before inserting.
28
+ *
29
+ * @param array $post_data Post data.
30
+ * @return array
31
+ */
32
+ public function filter_post_data( $post_data ) {
33
+ if ( 'attachment' !== $post_data['post_type'] ) {
34
+ $post_data['post_status'] = 'draft';
35
+ }
36
+ return $post_data;
37
+ }
38
+ }
admin/demo-importer/parsers.php CHANGED
@@ -1,698 +1,698 @@
1
- <?php
2
- /**
3
- * WordPress eXtended RSS file parser implementations
4
- *
5
- * @package WordPress
6
- * @subpackage Importer
7
- */
8
-
9
- /**
10
- * WordPress Importer class for managing parsing of WXR files.
11
- */
12
- class WXR_Parser {
13
- function parse( $file ) {
14
- // Attempt to use proper XML parsers first
15
- if ( extension_loaded( 'simplexml' ) ) {
16
- $parser = new WXR_Parser_SimpleXML;
17
- $result = $parser->parse( $file );
18
-
19
- // If SimpleXML succeeds or this is an invalid WXR file then return the results
20
- if ( ! is_wp_error( $result ) || 'SimpleXML_parse_error' != $result->get_error_code() )
21
- return $result;
22
- } else if ( extension_loaded( 'xml' ) ) {
23
- $parser = new WXR_Parser_XML;
24
- $result = $parser->parse( $file );
25
-
26
- // If XMLParser succeeds or this is an invalid WXR file then return the results
27
- if ( ! is_wp_error( $result ) || 'XML_parse_error' != $result->get_error_code() )
28
- return $result;
29
- }
30
-
31
- // We have a malformed XML file, so display the error and fallthrough to regex
32
- if ( isset($result) && defined('IMPORT_DEBUG') && IMPORT_DEBUG ) {
33
- echo '<pre>';
34
- if ( 'SimpleXML_parse_error' == $result->get_error_code() ) {
35
- foreach ( $result->get_error_data() as $error )
36
- echo $error->line . ':' . $error->column . ' ' . esc_html( $error->message ) . "\n";
37
- } else if ( 'XML_parse_error' == $result->get_error_code() ) {
38
- $error = $result->get_error_data();
39
- echo $error[0] . ':' . $error[1] . ' ' . esc_html( $error[2] );
40
- }
41
- echo '</pre>';
42
- echo '<p><strong>' . __( 'There was an error when reading this WXR file', 'wordpress-importer' ) . '</strong><br />';
43
- echo __( 'Details are shown above. The importer will now try again with a different parser...', 'wordpress-importer' ) . '</p>';
44
- }
45
-
46
- // use regular expressions if nothing else available or this is bad XML
47
- $parser = new WXR_Parser_Regex;
48
- return $parser->parse( $file );
49
- }
50
- }
51
-
52
- /**
53
- * WXR Parser that makes use of the SimpleXML PHP extension.
54
- */
55
- class WXR_Parser_SimpleXML {
56
- function parse( $file ) {
57
- $authors = $posts = $categories = $tags = $terms = array();
58
-
59
- $internal_errors = libxml_use_internal_errors(true);
60
-
61
- $dom = new DOMDocument;
62
- $old_value = null;
63
- if ( function_exists( 'libxml_disable_entity_loader' ) ) {
64
- $old_value = libxml_disable_entity_loader( true );
65
- }
66
- $success = $dom->loadXML( file_get_contents( $file ) );
67
- if ( ! is_null( $old_value ) ) {
68
- libxml_disable_entity_loader( $old_value );
69
- }
70
-
71
- if ( ! $success || isset( $dom->doctype ) ) {
72
- return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this WXR file', 'wordpress-importer' ), libxml_get_errors() );
73
- }
74
-
75
- $xml = simplexml_import_dom( $dom );
76
- unset( $dom );
77
-
78
- // halt if loading produces an error
79
- if ( ! $xml )
80
- return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this WXR file', 'wordpress-importer' ), libxml_get_errors() );
81
-
82
- $wxr_version = $xml->xpath('/rss/channel/wp:wxr_version');
83
- if ( ! $wxr_version )
84
- return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) );
85
-
86
- $wxr_version = (string) trim( $wxr_version[0] );
87
- // confirm that we are dealing with the correct file format
88
- if ( ! preg_match( '/^\d+\.\d+$/', $wxr_version ) )
89
- return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) );
90
-
91
- $base_url = $xml->xpath('/rss/channel/wp:base_site_url');
92
- $base_url = (string) trim( $base_url[0] );
93
-
94
- $namespaces = $xml->getDocNamespaces();
95
- if ( ! isset( $namespaces['wp'] ) )
96
- $namespaces['wp'] = 'http://wordpress.org/export/1.1/';
97
- if ( ! isset( $namespaces['excerpt'] ) )
98
- $namespaces['excerpt'] = 'http://wordpress.org/export/1.1/excerpt/';
99
-
100
- // grab authors
101
- foreach ( $xml->xpath('/rss/channel/wp:author') as $author_arr ) {
102
- $a = $author_arr->children( $namespaces['wp'] );
103
- $login = (string) $a->author_login;
104
- $authors[$login] = array(
105
- 'author_id' => (int) $a->author_id,
106
- 'author_login' => $login,
107
- 'author_email' => (string) $a->author_email,
108
- 'author_display_name' => (string) $a->author_display_name,
109
- 'author_first_name' => (string) $a->author_first_name,
110
- 'author_last_name' => (string) $a->author_last_name
111
- );
112
- }
113
-
114
- // grab cats, tags and terms
115
- foreach ( $xml->xpath('/rss/channel/wp:category') as $term_arr ) {
116
- $t = $term_arr->children( $namespaces['wp'] );
117
- $category = array(
118
- 'term_id' => (int) $t->term_id,
119
- 'category_nicename' => (string) $t->category_nicename,
120
- 'category_parent' => (string) $t->category_parent,
121
- 'cat_name' => (string) $t->cat_name,
122
- 'category_description' => (string) $t->category_description
123
- );
124
-
125
- foreach ( $t->termmeta as $meta ) {
126
- $category['termmeta'][] = array(
127
- 'key' => (string) $meta->meta_key,
128
- 'value' => (string) $meta->meta_value
129
- );
130
- }
131
-
132
- $categories[] = $category;
133
- }
134
-
135
- foreach ( $xml->xpath('/rss/channel/wp:tag') as $term_arr ) {
136
- $t = $term_arr->children( $namespaces['wp'] );
137
- $tag = array(
138
- 'term_id' => (int) $t->term_id,
139
- 'tag_slug' => (string) $t->tag_slug,
140
- 'tag_name' => (string) $t->tag_name,
141
- 'tag_description' => (string) $t->tag_description
142
- );
143
-
144
- foreach ( $t->termmeta as $meta ) {
145
- $tag['termmeta'][] = array(
146
- 'key' => (string) $meta->meta_key,
147
- 'value' => (string) $meta->meta_value
148
- );
149
- }
150
-
151
- $tags[] = $tag;
152
- }
153
-
154
- foreach ( $xml->xpath('/rss/channel/wp:term') as $term_arr ) {
155
- $t = $term_arr->children( $namespaces['wp'] );
156
- $term = array(
157
- 'term_id' => (int) $t->term_id,
158
- 'term_taxonomy' => (string) $t->term_taxonomy,
159
- 'slug' => (string) $t->term_slug,
160
- 'term_parent' => (string) $t->term_parent,
161
- 'term_name' => (string) $t->term_name,
162
- 'term_description' => (string) $t->term_description
163
- );
164
-
165
- foreach ( $t->termmeta as $meta ) {
166
- $term['termmeta'][] = array(
167
- 'key' => (string) $meta->meta_key,
168
- 'value' => (string) $meta->meta_value
169
- );
170
- }
171
-
172
- $terms[] = $term;
173
- }
174
-
175
- // grab posts
176
- foreach ( $xml->channel->item as $item ) {
177
- $post = array(
178
- 'post_title' => (string) $item->title,
179
- 'guid' => (string) $item->guid,
180
- );
181
-
182
- $dc = $item->children( 'http://purl.org/dc/elements/1.1/' );
183
- $post['post_author'] = (string) $dc->creator;
184
-
185
- $content = $item->children( 'http://purl.org/rss/1.0/modules/content/' );
186
- $excerpt = $item->children( $namespaces['excerpt'] );
187
- $post['post_content'] = (string) $content->encoded;
188
- $post['post_excerpt'] = (string) $excerpt->encoded;
189
-
190
- $wp = $item->children( $namespaces['wp'] );
191
- $post['post_id'] = (int) $wp->post_id;
192
- $post['post_date'] = (string) $wp->post_date;
193
- $post['post_date_gmt'] = (string) $wp->post_date_gmt;
194
- $post['comment_status'] = (string) $wp->comment_status;
195
- $post['ping_status'] = (string) $wp->ping_status;
196
- $post['post_name'] = (string) $wp->post_name;
197
- $post['status'] = (string) $wp->status;
198
- $post['post_parent'] = (int) $wp->post_parent;
199
- $post['menu_order'] = (int) $wp->menu_order;
200
- $post['post_type'] = (string) $wp->post_type;
201
- $post['post_password'] = (string) $wp->post_password;
202
- $post['is_sticky'] = (int) $wp->is_sticky;
203
-
204
- if ( isset($wp->attachment_url) )
205
- $post['attachment_url'] = (string) $wp->attachment_url;
206
-
207
- foreach ( $item->category as $c ) {
208
- $att = $c->attributes();
209
- if ( isset( $att['nicename'] ) )
210
- $post['terms'][] = array(
211
- 'name' => (string) $c,
212
- 'slug' => (string) $att['nicename'],
213
- 'domain' => (string) $att['domain']
214
- );
215
- }
216
-
217
- foreach ( $wp->postmeta as $meta ) {
218
- $post['postmeta'][] = array(
219
- 'key' => (string) $meta->meta_key,
220
- 'value' => (string) $meta->meta_value
221
- );
222
- }
223
-
224
- foreach ( $wp->comment as $comment ) {
225
- $meta = array();
226
- if ( isset( $comment->commentmeta ) ) {
227
- foreach ( $comment->commentmeta as $m ) {
228
- $meta[] = array(
229
- 'key' => (string) $m->meta_key,
230
- 'value' => (string) $m->meta_value
231
- );
232
- }
233
- }
234
-
235
- $post['comments'][] = array(
236
- 'comment_id' => (int) $comment->comment_id,
237
- 'comment_author' => (string) $comment->comment_author,
238
- 'comment_author_email' => (string) $comment->comment_author_email,
239
- 'comment_author_IP' => (string) $comment->comment_author_IP,
240
- 'comment_author_url' => (string) $comment->comment_author_url,
241
- 'comment_date' => (string) $comment->comment_date,
242
- 'comment_date_gmt' => (string) $comment->comment_date_gmt,
243
- 'comment_content' => (string) $comment->comment_content,
244
- 'comment_approved' => (string) $comment->comment_approved,
245
- 'comment_type' => (string) $comment->comment_type,
246
- 'comment_parent' => (string) $comment->comment_parent,
247
- 'comment_user_id' => (int) $comment->comment_user_id,
248
- 'commentmeta' => $meta,
249
- );
250
- }
251
-
252
- $posts[] = $post;
253
- }
254
-
255
- return array(
256
- 'authors' => $authors,
257
- 'posts' => $posts,
258
- 'categories' => $categories,
259
- 'tags' => $tags,
260
- 'terms' => $terms,
261
- 'base_url' => $base_url,
262
- 'version' => $wxr_version
263
- );
264
- }
265
- }
266
-
267
- /**
268
- * WXR Parser that makes use of the XML Parser PHP extension.
269
- */
270
- class WXR_Parser_XML {
271
- var $wp_tags = array(
272
- 'wp:post_id', 'wp:post_date', 'wp:post_date_gmt', 'wp:comment_status', 'wp:ping_status', 'wp:attachment_url',
273
- 'wp:status', 'wp:post_name', 'wp:post_parent', 'wp:menu_order', 'wp:post_type', 'wp:post_password',
274
- 'wp:is_sticky', 'wp:term_id', 'wp:category_nicename', 'wp:category_parent', 'wp:cat_name', 'wp:category_description',
275
- 'wp:tag_slug', 'wp:tag_name', 'wp:tag_description', 'wp:term_taxonomy', 'wp:term_parent',
276
- 'wp:term_name', 'wp:term_description', 'wp:author_id', 'wp:author_login', 'wp:author_email', 'wp:author_display_name',
277
- 'wp:author_first_name', 'wp:author_last_name',
278
- );
279
- var $wp_sub_tags = array(
280
- 'wp:comment_id', 'wp:comment_author', 'wp:comment_author_email', 'wp:comment_author_url',
281
- 'wp:comment_author_IP', 'wp:comment_date', 'wp:comment_date_gmt', 'wp:comment_content',
282
- 'wp:comment_approved', 'wp:comment_type', 'wp:comment_parent', 'wp:comment_user_id',
283
- );
284
-
285
- function parse( $file ) {
286
- $this->wxr_version = $this->in_post = $this->cdata = $this->data = $this->sub_data = $this->in_tag = $this->in_sub_tag = false;
287
- $this->authors = $this->posts = $this->term = $this->category = $this->tag = array();
288
-
289
- $xml = xml_parser_create( 'UTF-8' );
290
- xml_parser_set_option( $xml, XML_OPTION_SKIP_WHITE, 1 );
291
- xml_parser_set_option( $xml, XML_OPTION_CASE_FOLDING, 0 );
292
- xml_set_object( $xml, $this );
293
- xml_set_character_data_handler( $xml, 'cdata' );
294
- xml_set_element_handler( $xml, 'tag_open', 'tag_close' );
295
-
296
- if ( ! xml_parse( $xml, file_get_contents( $file ), true ) ) {
297
- $current_line = xml_get_current_line_number( $xml );
298
- $current_column = xml_get_current_column_number( $xml );
299
- $error_code = xml_get_error_code( $xml );
300
- $error_string = xml_error_string( $error_code );
301
- return new WP_Error( 'XML_parse_error', 'There was an error when reading this WXR file', array( $current_line, $current_column, $error_string ) );
302
- }
303
- xml_parser_free( $xml );
304
-
305
- if ( ! preg_match( '/^\d+\.\d+$/', $this->wxr_version ) )
306
- return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) );
307
-
308
- return array(
309
- 'authors' => $this->authors,
310
- 'posts' => $this->posts,
311
- 'categories' => $this->category,
312
- 'tags' => $this->tag,
313
- 'terms' => $this->term,
314
- 'base_url' => $this->base_url,
315
- 'version' => $this->wxr_version
316
- );
317
- }
318
-
319
- function tag_open( $parse, $tag, $attr ) {
320
- if ( in_array( $tag, $this->wp_tags ) ) {
321
- $this->in_tag = substr( $tag, 3 );
322
- return;
323
- }
324
-
325
- if ( in_array( $tag, $this->wp_sub_tags ) ) {
326
- $this->in_sub_tag = substr( $tag, 3 );
327
- return;
328
- }
329
-
330
- switch ( $tag ) {
331
- case 'category':
332
- if ( isset($attr['domain'], $attr['nicename']) ) {
333
- $this->sub_data['domain'] = $attr['domain'];
334
- $this->sub_data['slug'] = $attr['nicename'];
335
- }
336
- break;
337
- case 'item': $this->in_post = true;
338
- case 'title': if ( $this->in_post ) $this->in_tag = 'post_title'; break;
339
- case 'guid': $this->in_tag = 'guid'; break;
340
- case 'dc:creator': $this->in_tag = 'post_author'; break;
341
- case 'content:encoded': $this->in_tag = 'post_content'; break;
342
- case 'excerpt:encoded': $this->in_tag = 'post_excerpt'; break;
343
-
344
- case 'wp:term_slug': $this->in_tag = 'slug'; break;
345
- case 'wp:meta_key': $this->in_sub_tag = 'key'; break;
346
- case 'wp:meta_value': $this->in_sub_tag = 'value'; break;
347
- }
348
- }
349
-
350
- function cdata( $parser, $cdata ) {
351
- if ( ! trim( $cdata ) )
352
- return;
353
-
354
- if ( false !== $this->in_tag || false !== $this->in_sub_tag ) {
355
- $this->cdata .= $cdata;
356
- } else {
357
- $this->cdata .= trim( $cdata );
358
- }
359
- }
360
-
361
- function tag_close( $parser, $tag ) {
362
- switch ( $tag ) {
363
- case 'wp:comment':
364
- unset( $this->sub_data['key'], $this->sub_data['value'] ); // remove meta sub_data
365
- if ( ! empty( $this->sub_data ) )
366
- $this->data['comments'][] = $this->sub_data;
367
- $this->sub_data = false;
368
- break;
369
- case 'wp:commentmeta':
370
- $this->sub_data['commentmeta'][] = array(
371
- 'key' => $this->sub_data['key'],
372
- 'value' => $this->sub_data['value']
373
- );
374
- break;
375
- case 'category':
376
- if ( ! empty( $this->sub_data ) ) {
377
- $this->sub_data['name'] = $this->cdata;
378
- $this->data['terms'][] = $this->sub_data;
379
- }
380
- $this->sub_data = false;
381
- break;
382
- case 'wp:postmeta':
383
- if ( ! empty( $this->sub_data ) )
384
- $this->data['postmeta'][] = $this->sub_data;
385
- $this->sub_data = false;
386
- break;
387
- case 'item':
388
- $this->posts[] = $this->data;
389
- $this->data = false;
390
- break;
391
- case 'wp:category':
392
- case 'wp:tag':
393
- case 'wp:term':
394
- $n = substr( $tag, 3 );
395
- array_push( $this->$n, $this->data );
396
- $this->data = false;
397
- break;
398
- case 'wp:author':
399
- if ( ! empty($this->data['author_login']) )
400
- $this->authors[$this->data['author_login']] = $this->data;
401
- $this->data = false;
402
- break;
403
- case 'wp:base_site_url':
404
- $this->base_url = $this->cdata;
405
- break;
406
- case 'wp:wxr_version':
407
- $this->wxr_version = $this->cdata;
408
- break;
409
-
410
- default:
411
- if ( $this->in_sub_tag ) {
412
- $this->sub_data[$this->in_sub_tag] = ! empty( $this->cdata ) ? $this->cdata : '';
413
- $this->in_sub_tag = false;
414
- } else if ( $this->in_tag ) {
415
- $this->data[$this->in_tag] = ! empty( $this->cdata ) ? $this->cdata : '';
416
- $this->in_tag = false;
417
- }
418
- }
419
-
420
- $this->cdata = false;
421
- }
422
- }
423
-
424
- /**
425
- * WXR Parser that uses regular expressions. Fallback for installs without an XML parser.
426
- */
427
- class WXR_Parser_Regex {
428
- var $authors = array();
429
- var $posts = array();
430
- var $categories = array();
431
- var $tags = array();
432
- var $terms = array();
433
- var $base_url = '';
434
-
435
- function __construct() {
436
- $this->has_gzip = is_callable( 'gzopen' );
437
- }
438
-
439
- function parse( $file ) {
440
- $wxr_version = $in_multiline = false;
441
-
442
- $multiline_content = '';
443
-
444
- $multiline_tags = array(
445
- 'item' => array( 'posts', array( $this, 'process_post' ) ),
446
- 'wp:category' => array( 'categories', array( $this, 'process_category' ) ),
447
- 'wp:tag' => array( 'tags', array( $this, 'process_tag' ) ),
448
- 'wp:term' => array( 'terms', array( $this, 'process_term' ) ),
449
- );
450
-
451
- $fp = $this->fopen( $file, 'r' );
452
- if ( $fp ) {
453
- while ( ! $this->feof( $fp ) ) {
454
- $importline = rtrim( $this->fgets( $fp ) );
455
-
456
- if ( ! $wxr_version && preg_match( '|<wp:wxr_version>(\d+\.\d+)</wp:wxr_version>|', $importline, $version ) )
457
- $wxr_version = $version[1];
458
-
459
- if ( false !== strpos( $importline, '<wp:base_site_url>' ) ) {
460
- preg_match( '|<wp:base_site_url>(.*?)</wp:base_site_url>|is', $importline, $url );
461
- $this->base_url = $url[1];
462
- continue;
463
- }
464
-
465
- if ( false !== strpos( $importline, '<wp:author>' ) ) {
466
- preg_match( '|<wp:author>(.*?)</wp:author>|is', $importline, $author );
467
- $a = $this->process_author( $author[1] );
468
- $this->authors[$a['author_login']] = $a;
469
- continue;
470
- }
471
-
472
- foreach ( $multiline_tags as $tag => $handler ) {
473
- // Handle multi-line tags on a singular line
474
- if ( preg_match( '|<' . $tag . '>(.*?)</' . $tag . '>|is', $importline, $matches ) ) {
475
- $this->{$handler[0]}[] = call_user_func( $handler[1], $matches[1] );
476
-
477
- } elseif ( false !== ( $pos = strpos( $importline, "<$tag>" ) ) ) {
478
- // Take note of any content after the opening tag
479
- $multiline_content = trim( substr( $importline, $pos + strlen( $tag ) + 2 ) );
480
-
481
- // We don't want to have this line added to `$is_multiline` below.
482
- $importline = '';
483
- $in_multiline = $tag;
484
-
485
- } elseif ( false !== ( $pos = strpos( $importline, "</$tag>" ) ) ) {
486
- $in_multiline = false;
487
- $multiline_content .= trim( substr( $importline, 0, $pos ) );
488
-
489
- $this->{$handler[0]}[] = call_user_func( $handler[1], $multiline_content );
490
- }
491
- }
492
-
493
- if ( $in_multiline && $importline ) {
494
- $multiline_content .= $importline . "\n";
495
- }
496
- }
497
-
498
- $this->fclose($fp);
499
- }
500
-
501
- if ( ! $wxr_version )
502
- return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) );
503
-
504
- return array(
505
- 'authors' => $this->authors,
506
- 'posts' => $this->posts,
507
- 'categories' => $this->categories,
508
- 'tags' => $this->tags,
509
- 'terms' => $this->terms,
510
- 'base_url' => $this->base_url,
511
- 'version' => $wxr_version
512
- );
513
- }
514
-
515
- function get_tag( $string, $tag ) {
516
- preg_match( "|<$tag.*?>(.*?)</$tag>|is", $string, $return );
517
- if ( isset( $return[1] ) ) {
518
- if ( substr( $return[1], 0, 9 ) == '<![CDATA[' ) {
519
- if ( strpos( $return[1], ']]]]><![CDATA[>' ) !== false ) {
520
- preg_match_all( '|<!\[CDATA\[(.*?)\]\]>|s', $return[1], $matches );
521
- $return = '';
522
- foreach( $matches[1] as $match )
523
- $return .= $match;
524
- } else {
525
- $return = preg_replace( '|^<!\[CDATA\[(.*)\]\]>$|s', '$1', $return[1] );
526
- }
527
- } else {
528
- $return = $return[1];
529
- }
530
- } else {
531
- $return = '';
532
- }
533
- return $return;
534
- }
535
-
536
- function process_category( $c ) {
537
- return array(
538
- 'term_id' => $this->get_tag( $c, 'wp:term_id' ),
539
- 'cat_name' => $this->get_tag( $c, 'wp:cat_name' ),
540
- 'category_nicename' => $this->get_tag( $c, 'wp:category_nicename' ),
541
- 'category_parent' => $this->get_tag( $c, 'wp:category_parent' ),
542
- 'category_description' => $this->get_tag( $c, 'wp:category_description' ),
543
- );
544
- }
545
-
546
- function process_tag( $t ) {
547
- return array(
548
- 'term_id' => $this->get_tag( $t, 'wp:term_id' ),
549
- 'tag_name' => $this->get_tag( $t, 'wp:tag_name' ),
550
- 'tag_slug' => $this->get_tag( $t, 'wp:tag_slug' ),
551
- 'tag_description' => $this->get_tag( $t, 'wp:tag_description' ),
552
- );
553
- }
554
-
555
- function process_term( $t ) {
556
- return array(
557
- 'term_id' => $this->get_tag( $t, 'wp:term_id' ),
558
- 'term_taxonomy' => $this->get_tag( $t, 'wp:term_taxonomy' ),
559
- 'slug' => $this->get_tag( $t, 'wp:term_slug' ),
560
- 'term_parent' => $this->get_tag( $t, 'wp:term_parent' ),
561
- 'term_name' => $this->get_tag( $t, 'wp:term_name' ),
562
- 'term_description' => $this->get_tag( $t, 'wp:term_description' ),
563
- );
564
- }
565
-
566
- function process_author( $a ) {
567
- return array(
568
- 'author_id' => $this->get_tag( $a, 'wp:author_id' ),
569
- 'author_login' => $this->get_tag( $a, 'wp:author_login' ),
570
- 'author_email' => $this->get_tag( $a, 'wp:author_email' ),
571
- 'author_display_name' => $this->get_tag( $a, 'wp:author_display_name' ),
572
- 'author_first_name' => $this->get_tag( $a, 'wp:author_first_name' ),
573
- 'author_last_name' => $this->get_tag( $a, 'wp:author_last_name' ),
574
- );
575
- }
576
-
577
- function process_post( $post ) {
578
- $post_id = $this->get_tag( $post, 'wp:post_id' );
579
- $post_title = $this->get_tag( $post, 'title' );
580
- $post_date = $this->get_tag( $post, 'wp:post_date' );
581
- $post_date_gmt = $this->get_tag( $post, 'wp:post_date_gmt' );
582
- $comment_status = $this->get_tag( $post, 'wp:comment_status' );
583
- $ping_status = $this->get_tag( $post, 'wp:ping_status' );
584
- $status = $this->get_tag( $post, 'wp:status' );
585
- $post_name = $this->get_tag( $post, 'wp:post_name' );
586
- $post_parent = $this->get_tag( $post, 'wp:post_parent' );
587
- $menu_order = $this->get_tag( $post, 'wp:menu_order' );
588
- $post_type = $this->get_tag( $post, 'wp:post_type' );
589
- $post_password = $this->get_tag( $post, 'wp:post_password' );
590
- $is_sticky = $this->get_tag( $post, 'wp:is_sticky' );
591
- $guid = $this->get_tag( $post, 'guid' );
592
- $post_author = $this->get_tag( $post, 'dc:creator' );
593
-
594
- $post_excerpt = $this->get_tag( $post, 'excerpt:encoded' );
595
- $post_excerpt = preg_replace_callback( '|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_excerpt );
596
- $post_excerpt = str_replace( '<br>', '<br />', $post_excerpt );
597
- $post_excerpt = str_replace( '<hr>', '<hr />', $post_excerpt );
598
-
599
- $post_content = $this->get_tag( $post, 'content:encoded' );
600
- $post_content = preg_replace_callback( '|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_content );
601
- $post_content = str_replace( '<br>', '<br />', $post_content );
602
- $post_content = str_replace( '<hr>', '<hr />', $post_content );
603
-
604
- $postdata = compact( 'post_id', 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_excerpt',
605
- 'post_title', 'status', 'post_name', 'comment_status', 'ping_status', 'guid', 'post_parent',
606
- 'menu_order', 'post_type', 'post_password', 'is_sticky'
607
- );
608
-
609
- $attachment_url = $this->get_tag( $post, 'wp:attachment_url' );
610
- if ( $attachment_url )
611
- $postdata['attachment_url'] = $attachment_url;
612
-
613
- preg_match_all( '|<category domain="([^"]+?)" nicename="([^"]+?)">(.+?)</category>|is', $post, $terms, PREG_SET_ORDER );
614
- foreach ( $terms as $t ) {
615
- $post_terms[] = array(
616
- 'slug' => $t[2],
617
- 'domain' => $t[1],
618
- 'name' => str_replace( array( '<![CDATA[', ']]>' ), '', $t[3] ),
619
- );
620
- }
621
- if ( ! empty( $post_terms ) ) $postdata['terms'] = $post_terms;
622
-
623
- preg_match_all( '|<wp:comment>(.+?)</wp:comment>|is', $post, $comments );
624
- $comments = $comments[1];
625
- if ( $comments ) {
626
- foreach ( $comments as $comment ) {
627
- preg_match_all( '|<wp:commentmeta>(.+?)</wp:commentmeta>|is', $comment, $commentmeta );
628
- $commentmeta = $commentmeta[1];
629
- $c_meta = array();
630
- foreach ( $commentmeta as $m ) {
631
- $c_meta[] = array(
632
- 'key' => $this->get_tag( $m, 'wp:meta_key' ),
633
- 'value' => $this->get_tag( $m, 'wp:meta_value' ),
634
- );
635
- }
636
-
637
- $post_comments[] = array(
638
- 'comment_id' => $this->get_tag( $comment, 'wp:comment_id' ),
639
- 'comment_author' => $this->get_tag( $comment, 'wp:comment_author' ),
640
- 'comment_author_email' => $this->get_tag( $comment, 'wp:comment_author_email' ),
641
- 'comment_author_IP' => $this->get_tag( $comment, 'wp:comment_author_IP' ),
642
- 'comment_author_url' => $this->get_tag( $comment, 'wp:comment_author_url' ),
643
- 'comment_date' => $this->get_tag( $comment, 'wp:comment_date' ),
644
- 'comment_date_gmt' => $this->get_tag( $comment, 'wp:comment_date_gmt' ),
645
- 'comment_content' => $this->get_tag( $comment, 'wp:comment_content' ),
646
- 'comment_approved' => $this->get_tag( $comment, 'wp:comment_approved' ),
647
- 'comment_type' => $this->get_tag( $comment, 'wp:comment_type' ),
648
- 'comment_parent' => $this->get_tag( $comment, 'wp:comment_parent' ),
649
- 'comment_user_id' => $this->get_tag( $comment, 'wp:comment_user_id' ),
650
- 'commentmeta' => $c_meta,
651
- );
652
- }
653
- }
654
- if ( ! empty( $post_comments ) ) $postdata['comments'] = $post_comments;
655
-
656
- preg_match_all( '|<wp:postmeta>(.+?)</wp:postmeta>|is', $post, $postmeta );
657
- $postmeta = $postmeta[1];
658
- if ( $postmeta ) {
659
- foreach ( $postmeta as $p ) {
660
- $post_postmeta[] = array(
661
- 'key' => $this->get_tag( $p, 'wp:meta_key' ),
662
- 'value' => $this->get_tag( $p, 'wp:meta_value' ),
663
- );
664
- }
665
- }
666
- if ( ! empty( $post_postmeta ) ) $postdata['postmeta'] = $post_postmeta;
667
-
668
- return $postdata;
669
- }
670
-
671
- function _normalize_tag( $matches ) {
672
- return '<' . strtolower( $matches[1] );
673
- }
674
-
675
- function fopen( $filename, $mode = 'r' ) {
676
- if ( $this->has_gzip )
677
- return gzopen( $filename, $mode );
678
- return fopen( $filename, $mode );
679
- }
680
-
681
- function feof( $fp ) {
682
- if ( $this->has_gzip )
683
- return gzeof( $fp );
684
- return feof( $fp );
685
- }
686
-
687
- function fgets( $fp, $len = 8192 ) {
688
- if ( $this->has_gzip )
689
- return gzgets( $fp, $len );
690
- return fgets( $fp, $len );
691
- }
692
-
693
- function fclose( $fp ) {
694
- if ( $this->has_gzip )
695
- return gzclose( $fp );
696
- return fclose( $fp );
697
- }
698
- }
1
+ <?php
2
+ /**
3
+ * WordPress eXtended RSS file parser implementations
4
+ *
5
+ * @package WordPress
6
+ * @subpackage Importer
7
+ */
8
+
9
+ /**
10
+ * WordPress Importer class for managing parsing of WXR files.
11
+ */
12
+ class WXR_Parser {
13
+ function parse( $file ) {
14
+ // Attempt to use proper XML parsers first
15
+ if ( extension_loaded( 'simplexml' ) ) {
16
+ $parser = new WXR_Parser_SimpleXML;
17
+ $result = $parser->parse( $file );
18
+
19
+ // If SimpleXML succeeds or this is an invalid WXR file then return the results
20
+ if ( ! is_wp_error( $result ) || 'SimpleXML_parse_error' != $result->get_error_code() )
21
+ return $result;
22
+ } else if ( extension_loaded( 'xml' ) ) {
23
+ $parser = new WXR_Parser_XML;
24
+ $result = $parser->parse( $file );
25
+
26
+ // If XMLParser succeeds or this is an invalid WXR file then return the results
27
+ if ( ! is_wp_error( $result ) || 'XML_parse_error' != $result->get_error_code() )
28
+ return $result;
29
+ }
30
+
31
+ // We have a malformed XML file, so display the error and fallthrough to regex
32
+ if ( isset($result) && defined('IMPORT_DEBUG') && IMPORT_DEBUG ) {
33
+ echo '<pre>';
34
+ if ( 'SimpleXML_parse_error' == $result->get_error_code() ) {
35
+ foreach ( $result->get_error_data() as $error )
36
+ echo $error->line . ':' . $error->column . ' ' . esc_html( $error->message ) . "\n";
37
+ } else if ( 'XML_parse_error' == $result->get_error_code() ) {
38
+ $error = $result->get_error_data();
39
+ echo $error[0] . ':' . $error[1] . ' ' . esc_html( $error[2] );
40
+ }
41
+ echo '</pre>';
42
+ echo '<p><strong>' . __( 'There was an error when reading this WXR file', 'wordpress-importer' ) . '</strong><br />';
43
+ echo __( 'Details are shown above. The importer will now try again with a different parser...', 'wordpress-importer' ) . '</p>';
44
+ }
45
+
46
+ // use regular expressions if nothing else available or this is bad XML
47
+ $parser = new WXR_Parser_Regex;
48
+ return $parser->parse( $file );
49
+ }
50
+ }
51
+
52
+ /**
53
+ * WXR Parser that makes use of the SimpleXML PHP extension.
54
+ */
55
+ class WXR_Parser_SimpleXML {
56
+ function parse( $file ) {
57
+ $authors = $posts = $categories = $tags = $terms = array();
58
+
59
+ $internal_errors = libxml_use_internal_errors(true);
60
+
61
+ $dom = new DOMDocument;
62
+ $old_value = null;
63
+ if ( function_exists( 'libxml_disable_entity_loader' ) ) {
64
+ $old_value = libxml_disable_entity_loader( true );
65
+ }
66
+ $success = $dom->loadXML( file_get_contents( $file ) );
67
+ if ( ! is_null( $old_value ) ) {
68
+ libxml_disable_entity_loader( $old_value );
69
+ }
70
+
71
+ if ( ! $success || isset( $dom->doctype ) ) {
72
+ return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this WXR file', 'wordpress-importer' ), libxml_get_errors() );
73
+ }
74
+
75
+ $xml = simplexml_import_dom( $dom );
76
+ unset( $dom );
77
+
78
+ // halt if loading produces an error
79
+ if ( ! $xml )
80
+ return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this WXR file', 'wordpress-importer' ), libxml_get_errors() );
81
+
82
+ $wxr_version = $xml->xpath('/rss/channel/wp:wxr_version');
83
+ if ( ! $wxr_version )
84
+ return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) );
85
+
86
+ $wxr_version = (string) trim( $wxr_version[0] );
87
+ // confirm that we are dealing with the correct file format
88
+ if ( ! preg_match( '/^\d+\.\d+$/', $wxr_version ) )
89
+ return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) );
90
+
91
+ $base_url = $xml->xpath('/rss/channel/wp:base_site_url');
92
+ $base_url = (string) trim( $base_url[0] );
93
+
94
+ $namespaces = $xml->getDocNamespaces();
95
+ if ( ! isset( $namespaces['wp'] ) )
96
+ $namespaces['wp'] = 'http://wordpress.org/export/1.1/';
97
+ if ( ! isset( $namespaces['excerpt'] ) )
98
+ $namespaces['excerpt'] = 'http://wordpress.org/export/1.1/excerpt/';
99
+
100
+ // grab authors
101
+ foreach ( $xml->xpath('/rss/channel/wp:author') as $author_arr ) {
102
+ $a = $author_arr->children( $namespaces['wp'] );
103
+ $login = (string) $a->author_login;
104
+ $authors[$login] = array(
105
+ 'author_id' => (int) $a->author_id,
106
+ 'author_login' => $login,
107
+ 'author_email' => (string) $a->author_email,
108
+ 'author_display_name' => (string) $a->author_display_name,
109
+ 'author_first_name' => (string) $a->author_first_name,
110
+ 'author_last_name' => (string) $a->author_last_name
111
+ );
112
+ }
113
+
114
+ // grab cats, tags and terms
115
+ foreach ( $xml->xpath('/rss/channel/wp:category') as $term_arr ) {
116
+ $t = $term_arr->children( $namespaces['wp'] );
117
+ $category = array(
118
+ 'term_id' => (int) $t->term_id,
119
+ 'category_nicename' => (string) $t->category_nicename,
120
+ 'category_parent' => (string) $t->category_parent,
121
+ 'cat_name' => (string) $t->cat_name,
122
+ 'category_description' => (string) $t->category_description
123
+ );
124
+
125
+ foreach ( $t->termmeta as $meta ) {
126
+ $category['termmeta'][] = array(
127
+ 'key' => (string) $meta->meta_key,
128
+ 'value' => (string) $meta->meta_value
129
+ );
130
+ }
131
+
132
+ $categories[] = $category;
133
+ }
134
+
135
+ foreach ( $xml->xpath('/rss/channel/wp:tag') as $term_arr ) {
136
+ $t = $term_arr->children( $namespaces['wp'] );
137
+ $tag = array(
138
+ 'term_id' => (int) $t->term_id,
139
+ 'tag_slug' => (string) $t->tag_slug,
140
+ 'tag_name' => (string) $t->tag_name,
141
+ 'tag_description' => (string) $t->tag_description
142
+ );
143
+
144
+ foreach ( $t->termmeta as $meta ) {
145
+ $tag['termmeta'][] = array(
146
+ 'key' => (string) $meta->meta_key,
147
+ 'value' => (string) $meta->meta_value
148
+ );
149
+ }
150
+
151
+ $tags[] = $tag;
152
+ }
153
+
154
+ foreach ( $xml->xpath('/rss/channel/wp:term') as $term_arr ) {
155
+ $t = $term_arr->children( $namespaces['wp'] );
156
+ $term = array(
157
+ 'term_id' => (int) $t->term_id,
158
+ 'term_taxonomy' => (string) $t->term_taxonomy,
159
+ 'slug' => (string) $t->term_slug,
160
+ 'term_parent' => (string) $t->term_parent,
161
+ 'term_name' => (string) $t->term_name,
162
+ 'term_description' => (string) $t->term_description
163
+ );
164
+
165
+ foreach ( $t->termmeta as $meta ) {
166
+ $term['termmeta'][] = array(
167
+ 'key' => (string) $meta->meta_key,
168
+ 'value' => (string) $meta->meta_value
169
+ );
170
+ }
171
+
172
+ $terms[] = $term;
173
+ }
174
+
175
+ // grab posts
176
+ foreach ( $xml->channel->item as $item ) {
177
+ $post = array(
178
+ 'post_title' => (string) $item->title,
179
+ 'guid' => (string) $item->guid,
180
+ );
181
+
182
+ $dc = $item->children( 'http://purl.org/dc/elements/1.1/' );
183
+ $post['post_author'] = (string) $dc->creator;
184
+
185
+ $content = $item->children( 'http://purl.org/rss/1.0/modules/content/' );
186
+ $excerpt = $item->children( $namespaces['excerpt'] );
187
+ $post['post_content'] = (string) $content->encoded;
188
+ $post['post_excerpt'] = (string) $excerpt->encoded;
189
+
190
+ $wp = $item->children( $namespaces['wp'] );
191
+ $post['post_id'] = (int) $wp->post_id;
192
+ $post['post_date'] = (string) $wp->post_date;
193
+ $post['post_date_gmt'] = (string) $wp->post_date_gmt;
194
+ $post['comment_status'] = (string) $wp->comment_status;
195
+ $post['ping_status'] = (string) $wp->ping_status;
196
+ $post['post_name'] = (string) $wp->post_name;
197
+ $post['status'] = (string) $wp->status;
198
+ $post['post_parent'] = (int) $wp->post_parent;
199
+ $post['menu_order'] = (int) $wp->menu_order;
200
+ $post['post_type'] = (string) $wp->post_type;
201
+ $post['post_password'] = (string) $wp->post_password;
202
+ $post['is_sticky'] = (int) $wp->is_sticky;
203
+
204
+ if ( isset($wp->attachment_url) )
205
+ $post['attachment_url'] = (string) $wp->attachment_url;
206
+
207
+ foreach ( $item->category as $c ) {
208
+ $att = $c->attributes();
209
+ if ( isset( $att['nicename'] ) )
210
+ $post['terms'][] = array(
211
+ 'name' => (string) $c,
212
+ 'slug' => (string) $att['nicename'],
213
+ 'domain' => (string) $att['domain']
214
+ );
215
+ }
216
+
217
+ foreach ( $wp->postmeta as $meta ) {
218
+ $post['postmeta'][] = array(
219
+ 'key' => (string) $meta->meta_key,
220
+ 'value' => (string) $meta->meta_value
221
+ );
222
+ }
223
+
224
+ foreach ( $wp->comment as $comment ) {
225
+ $meta = array();
226
+ if ( isset( $comment->commentmeta ) ) {
227
+ foreach ( $comment->commentmeta as $m ) {
228
+ $meta[] = array(
229
+ 'key' => (string) $m->meta_key,
230
+ 'value' => (string) $m->meta_value
231
+ );
232
+ }
233
+ }
234
+
235
+ $post['comments'][] = array(
236
+ 'comment_id' => (int) $comment->comment_id,
237
+ 'comment_author' => (string) $comment->comment_author,
238
+ 'comment_author_email' => (string) $comment->comment_author_email,
239
+ 'comment_author_IP' => (string) $comment->comment_author_IP,
240
+ 'comment_author_url' => (string) $comment->comment_author_url,
241
+ 'comment_date' => (string) $comment->comment_date,
242
+ 'comment_date_gmt' => (string) $comment->comment_date_gmt,
243
+ 'comment_content' => (string) $comment->comment_content,
244
+ 'comment_approved' => (string) $comment->comment_approved,
245
+ 'comment_type' => (string) $comment->comment_type,
246
+ 'comment_parent' => (string) $comment->comment_parent,
247
+ 'comment_user_id' => (int) $comment->comment_user_id,
248
+ 'commentmeta' => $meta,
249
+ );
250
+ }
251
+
252
+ $posts[] = $post;
253
+ }
254
+
255
+ return array(
256
+ 'authors' => $authors,
257
+ 'posts' => $posts,
258
+ 'categories' => $categories,
259
+ 'tags' => $tags,
260
+ 'terms' => $terms,
261
+ 'base_url' => $base_url,
262
+ 'version' => $wxr_version
263
+ );
264
+ }
265
+ }
266
+
267
+ /**
268
+ * WXR Parser that makes use of the XML Parser PHP extension.
269
+ */
270
+ class WXR_Parser_XML {
271
+ var $wp_tags = array(
272
+ 'wp:post_id', 'wp:post_date', 'wp:post_date_gmt', 'wp:comment_status', 'wp:ping_status', 'wp:attachment_url',
273
+ 'wp:status', 'wp:post_name', 'wp:post_parent', 'wp:menu_order', 'wp:post_type', 'wp:post_password',
274
+ 'wp:is_sticky', 'wp:term_id', 'wp:category_nicename', 'wp:category_parent', 'wp:cat_name', 'wp:category_description',
275
+ 'wp:tag_slug', 'wp:tag_name', 'wp:tag_description', 'wp:term_taxonomy', 'wp:term_parent',
276
+ 'wp:term_name', 'wp:term_description', 'wp:author_id', 'wp:author_login', 'wp:author_email', 'wp:author_display_name',
277
+ 'wp:author_first_name', 'wp:author_last_name',
278
+ );
279
+ var $wp_sub_tags = array(
280
+ 'wp:comment_id', 'wp:comment_author', 'wp:comment_author_email', 'wp:comment_author_url',
281
+ 'wp:comment_author_IP', 'wp:comment_date', 'wp:comment_date_gmt', 'wp:comment_content',
282
+ 'wp:comment_approved', 'wp:comment_type', 'wp:comment_parent', 'wp:comment_user_id',
283
+ );
284
+
285
+ function parse( $file ) {
286
+ $this->wxr_version = $this->in_post = $this->cdata = $this->data = $this->sub_data = $this->in_tag = $this->in_sub_tag = false;
287
+ $this->authors = $this->posts = $this->term = $this->category = $this->tag = array();
288
+
289
+ $xml = xml_parser_create( 'UTF-8' );
290
+ xml_parser_set_option( $xml, XML_OPTION_SKIP_WHITE, 1 );
291
+ xml_parser_set_option( $xml, XML_OPTION_CASE_FOLDING, 0 );
292
+ xml_set_object( $xml, $this );
293
+ xml_set_character_data_handler( $xml, 'cdata' );
294
+ xml_set_element_handler( $xml, 'tag_open', 'tag_close' );
295
+
296
+ if ( ! xml_parse( $xml, file_get_contents( $file ), true ) ) {
297
+ $current_line = xml_get_current_line_number( $xml );
298
+ $current_column = xml_get_current_column_number( $xml );
299
+ $error_code = xml_get_error_code( $xml );
300
+ $error_string = xml_error_string( $error_code );
301
+ return new WP_Error( 'XML_parse_error', 'There was an error when reading this WXR file', array( $current_line, $current_column, $error_string ) );
302
+ }
303
+ xml_parser_free( $xml );
304
+
305
+ if ( ! preg_match( '/^\d+\.\d+$/', $this->wxr_version ) )
306
+ return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) );
307
+
308
+ return array(
309
+ 'authors' => $this->authors,
310
+ 'posts' => $this->posts,
311
+ 'categories' => $this->category,
312
+ 'tags' => $this->tag,
313
+ 'terms' => $this->term,
314
+ 'base_url' => $this->base_url,
315
+ 'version' => $this->wxr_version
316
+ );
317
+ }
318
+
319
+ function tag_open( $parse, $tag, $attr ) {
320
+ if ( in_array( $tag, $this->wp_tags ) ) {
321
+ $this->in_tag = substr( $tag, 3 );
322
+ return;
323
+ }
324
+
325
+ if ( in_array( $tag, $this->wp_sub_tags ) ) {
326
+ $this->in_sub_tag = substr( $tag, 3 );
327
+ return;
328
+ }
329
+
330
+ switch ( $tag ) {
331
+ case 'category':
332
+ if ( isset($attr['domain'], $attr['nicename']) ) {
333
+ $this->sub_data['domain'] = $attr['domain'];
334
+ $this->sub_data['slug'] = $attr['nicename'];
335
+ }
336
+ break;
337
+ case 'item': $this->in_post = true;
338
+ case 'title': if ( $this->in_post ) $this->in_tag = 'post_title'; break;
339
+ case 'guid': $this->in_tag = 'guid'; break;
340
+ case 'dc:creator': $this->in_tag = 'post_author'; break;
341
+ case 'content:encoded': $this->in_tag = 'post_content'; break;
342
+ case 'excerpt:encoded': $this->in_tag = 'post_excerpt'; break;
343
+
344
+ case 'wp:term_slug': $this->in_tag = 'slug'; break;
345
+ case 'wp:meta_key': $this->in_sub_tag = 'key'; break;
346
+ case 'wp:meta_value': $this->in_sub_tag = 'value'; break;
347
+ }
348
+ }
349
+
350
+ function cdata( $parser, $cdata ) {
351
+ if ( ! trim( $cdata ) )
352
+ return;
353
+
354
+ if ( false !== $this->in_tag || false !== $this->in_sub_tag ) {
355
+ $this->cdata .= $cdata;
356
+ } else {
357
+ $this->cdata .= trim( $cdata );
358
+ }
359
+ }
360
+
361
+ function tag_close( $parser, $tag ) {
362
+ switch ( $tag ) {
363
+ case 'wp:comment':
364
+ unset( $this->sub_data['key'], $this->sub_data['value'] ); // remove meta sub_data
365
+ if ( ! empty( $this->sub_data ) )
366
+ $this->data['comments'][] = $this->sub_data;
367
+ $this->sub_data = false;
368
+ break;
369
+ case 'wp:commentmeta':
370
+ $this->sub_data['commentmeta'][] = array(
371
+ 'key' => $this->sub_data['key'],
372
+ 'value' => $this->sub_data['value']
373
+ );
374
+ break;
375
+ case 'category':
376
+ if ( ! empty( $this->sub_data ) ) {
377
+ $this->sub_data['name'] = $this->cdata;
378
+ $this->data['terms'][] = $this->sub_data;
379
+ }
380
+ $this->sub_data = false;
381
+ break;
382
+ case 'wp:postmeta':
383
+ if ( ! empty( $this->sub_data ) )
384
+ $this->data['postmeta'][] = $this->sub_data;
385
+ $this->sub_data = false;
386
+ break;
387
+ case 'item':
388
+ $this->posts[] = $this->data;
389
+ $this->data = false;
390
+ break;
391
+ case 'wp:category':
392
+ case 'wp:tag':
393
+ case 'wp:term':
394
+ $n = substr( $tag, 3 );
395
+ array_push( $this->$n, $this->data );
396
+ $this->data = false;
397
+ break;
398
+ case 'wp:author':
399
+ if ( ! empty($this->data['author_login']) )
400
+ $this->authors[$this->data['author_login']] = $this->data;
401
+ $this->data = false;
402
+ break;
403
+ case 'wp:base_site_url':
404
+ $this->base_url = $this->cdata;
405
+ break;
406
+ case 'wp:wxr_version':
407
+ $this->wxr_version = $this->cdata;
408
+ break;
409
+
410
+ default:
411
+ if ( $this->in_sub_tag ) {
412
+ $this->sub_data[$this->in_sub_tag] = ! empty( $this->cdata ) ? $this->cdata : '';
413
+ $this->in_sub_tag = false;
414
+ } else if ( $this->in_tag ) {
415
+ $this->data[$this->in_tag] = ! empty( $this->cdata ) ? $this->cdata : '';
416
+ $this->in_tag = false;
417
+ }
418
+ }
419
+
420
+ $this->cdata = false;
421
+ }
422
+ }
423
+
424
+ /**
425
+ * WXR Parser that uses regular expressions. Fallback for installs without an XML parser.
426
+ */
427
+ class WXR_Parser_Regex {
428
+ var $authors = array();
429
+ var $posts = array();
430
+ var $categories = array();
431
+ var $tags = array();
432
+ var $terms = array();
433
+ var $base_url = '';
434
+
435
+ function __construct() {
436
+ $this->has_gzip = is_callable( 'gzopen' );
437
+ }
438
+
439
+ function parse( $file ) {
440
+ $wxr_version = $in_multiline = false;
441
+
442
+ $multiline_content = '';
443
+
444
+ $multiline_tags = array(
445
+ 'item' => array( 'posts', array( $this, 'process_post' ) ),
446
+ 'wp:category' => array( 'categories', array( $this, 'process_category' ) ),
447
+ 'wp:tag' => array( 'tags', array( $this, 'process_tag' ) ),
448
+ 'wp:term' => array( 'terms', array( $this, 'process_term' ) ),
449
+ );
450
+
451
+ $fp = $this->fopen( $file, 'r' );
452
+ if ( $fp ) {
453
+ while ( ! $this->feof( $fp ) ) {
454
+ $importline = rtrim( $this->fgets( $fp ) );
455
+
456
+ if ( ! $wxr_version && preg_match( '|<wp:wxr_version>(\d+\.\d+)</wp:wxr_version>|', $importline, $version ) )
457
+ $wxr_version = $version[1];
458
+
459
+ if ( false !== strpos( $importline, '<wp:base_site_url>' ) ) {
460
+ preg_match( '|<wp:base_site_url>(.*?)</wp:base_site_url>|is', $importline, $url );
461
+ $this->base_url = $url[1];
462
+ continue;
463
+ }
464
+
465
+ if ( false !== strpos( $importline, '<wp:author>' ) ) {
466
+ preg_match( '|<wp:author>(.*?)</wp:author>|is', $importline, $author );
467
+ $a = $this->process_author( $author[1] );
468
+ $this->authors[$a['author_login']] = $a;
469
+ continue;
470
+ }
471
+
472
+ foreach ( $multiline_tags as $tag => $handler ) {
473
+ // Handle multi-line tags on a singular line
474
+ if ( preg_match( '|<' . $tag . '>(.*?)</' . $tag . '>|is', $importline, $matches ) ) {
475
+ $this->{$handler[0]}[] = call_user_func( $handler[1], $matches[1] );
476
+
477
+ } elseif ( false !== ( $pos = strpos( $importline, "<$tag>" ) ) ) {
478
+ // Take note of any content after the opening tag
479
+ $multiline_content = trim( substr( $importline, $pos + strlen( $tag ) + 2 ) );
480
+
481
+ // We don't want to have this line added to `$is_multiline` below.
482
+ $importline = '';
483
+ $in_multiline = $tag;
484
+
485
+ } elseif ( false !== ( $pos = strpos( $importline, "</$tag>" ) ) ) {
486
+ $in_multiline = false;
487
+ $multiline_content .= trim( substr( $importline, 0, $pos ) );
488
+
489
+ $this->{$handler[0]}[] = call_user_func( $handler[1], $multiline_content );
490
+ }
491
+ }
492
+
493
+ if ( $in_multiline && $importline ) {
494
+ $multiline_content .= $importline . "\n";
495
+ }
496
+ }
497
+
498
+ $this->fclose($fp);
499
+ }
500
+
501
+ if ( ! $wxr_version )
502
+ return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) );
503
+
504
+ return array(
505
+ 'authors' => $this->authors,
506
+ 'posts' => $this->posts,
507
+ 'categories' => $this->categories,
508
+ 'tags' => $this->tags,
509
+ 'terms' => $this->terms,
510
+ 'base_url' => $this->base_url,
511
+ 'version' => $wxr_version
512
+ );
513
+ }
514
+
515
+ function get_tag( $string, $tag ) {
516
+ preg_match( "|<$tag.*?>(.*?)</$tag>|is", $string, $return );
517
+ if ( isset( $return[1] ) ) {
518
+ if ( substr( $return[1], 0, 9 ) == '<![CDATA[' ) {
519
+ if ( strpos( $return[1], ']]]]><![CDATA[>' ) !== false ) {
520
+ preg_match_all( '|<!\[CDATA\[(.*?)\]\]>|s', $return[1], $matches );
521
+ $return = '';
522
+ foreach( $matches[1] as $match )
523
+ $return .= $match;
524
+ } else {
525
+ $return = preg_replace( '|^<!\[CDATA\[(.*)\]\]>$|s', '$1', $return[1] );
526
+ }
527
+ } else {
528
+ $return = $return[1];
529
+ }
530
+ } else {
531
+ $return = '';
532
+ }
533
+ return $return;
534
+ }
535
+
536
+ function process_category( $c ) {
537
+ return array(
538
+ 'term_id' => $this->get_tag( $c, 'wp:term_id' ),
539
+ 'cat_name' => $this->get_tag( $c, 'wp:cat_name' ),
540
+ 'category_nicename' => $this->get_tag( $c, 'wp:category_nicename' ),
541
+ 'category_parent' => $this->get_tag( $c, 'wp:category_parent' ),
542
+ 'category_description' => $this->get_tag( $c, 'wp:category_description' ),
543
+ );
544
+ }
545
+
546
+ function process_tag( $t ) {
547
+ return array(
548
+ 'term_id' => $this->get_tag( $t, 'wp:term_id' ),
549
+ 'tag_name' => $this->get_tag( $t, 'wp:tag_name' ),
550
+ 'tag_slug' => $this->get_tag( $t, 'wp:tag_slug' ),
551
+ 'tag_description' => $this->get_tag( $t, 'wp:tag_description' ),
552
+ );
553
+ }
554
+
555
+ function process_term( $t ) {
556
+ return array(
557
+ 'term_id' => $this->get_tag( $t, 'wp:term_id' ),
558
+ 'term_taxonomy' => $this->get_tag( $t, 'wp:term_taxonomy' ),
559
+ 'slug' => $this->get_tag( $t, 'wp:term_slug' ),
560
+ 'term_parent' => $this->get_tag( $t, 'wp:term_parent' ),
561
+ 'term_name' => $this->get_tag( $t, 'wp:term_name' ),
562
+ 'term_description' => $this->get_tag( $t, 'wp:term_description' ),
563
+ );
564
+ }
565
+
566
+ function process_author( $a ) {
567
+ return array(
568
+ 'author_id' => $this->get_tag( $a, 'wp:author_id' ),
569
+ 'author_login' => $this->get_tag( $a, 'wp:author_login' ),
570
+ 'author_email' => $this->get_tag( $a, 'wp:author_email' ),
571
+ 'author_display_name' => $this->get_tag( $a, 'wp:author_display_name' ),
572
+ 'author_first_name' => $this->get_tag( $a, 'wp:author_first_name' ),
573
+ 'author_last_name' => $this->get_tag( $a, 'wp:author_last_name' ),
574
+ );
575
+ }
576
+
577
+ function process_post( $post ) {
578
+ $post_id = $this->get_tag( $post, 'wp:post_id' );
579
+ $post_title = $this->get_tag( $post, 'title' );
580
+ $post_date = $this->get_tag( $post, 'wp:post_date' );
581
+ $post_date_gmt = $this->get_tag( $post, 'wp:post_date_gmt' );
582
+ $comment_status = $this->get_tag( $post, 'wp:comment_status' );
583
+ $ping_status = $this->get_tag( $post, 'wp:ping_status' );
584
+ $status = $this->get_tag( $post, 'wp:status' );
585
+ $post_name = $this->get_tag( $post, 'wp:post_name' );
586
+ $post_parent = $this->get_tag( $post, 'wp:post_parent' );
587
+ $menu_order = $this->get_tag( $post, 'wp:menu_order' );
588
+ $post_type = $this->get_tag( $post, 'wp:post_type' );
589
+ $post_password = $this->get_tag( $post, 'wp:post_password' );
590
+ $is_sticky = $this->get_tag( $post, 'wp:is_sticky' );
591
+ $guid = $this->get_tag( $post, 'guid' );
592
+ $post_author = $this->get_tag( $post, 'dc:creator' );
593
+
594
+ $post_excerpt = $this->get_tag( $post, 'excerpt:encoded' );
595
+ $post_excerpt = preg_replace_callback( '|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_excerpt );
596
+ $post_excerpt = str_replace( '<br>', '<br />', $post_excerpt );
597
+ $post_excerpt = str_replace( '<hr>', '<hr />', $post_excerpt );
598
+
599
+ $post_content = $this->get_tag( $post, 'content:encoded' );
600
+ $post_content = preg_replace_callback( '|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_content );
601
+ $post_content = str_replace( '<br>', '<br />', $post_content );
602
+ $post_content = str_replace( '<hr>', '<hr />', $post_content );
603
+
604
+ $postdata = compact( 'post_id', 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_excerpt',
605
+ 'post_title', 'status', 'post_name', 'comment_status', 'ping_status', 'guid', 'post_parent',
606
+ 'menu_order', 'post_type', 'post_password', 'is_sticky'
607
+ );
608
+
609
+ $attachment_url = $this->get_tag( $post, 'wp:attachment_url' );
610
+ if ( $attachment_url )
611
+ $postdata['attachment_url'] = $attachment_url;
612
+
613
+ preg_match_all( '|<category domain="([^"]+?)" nicename="([^"]+?)">(.+?)</category>|is', $post, $terms, PREG_SET_ORDER );
614
+ foreach ( $terms as $t ) {
615
+ $post_terms[] = array(
616
+ 'slug' => $t[2],
617
+ 'domain' => $t[1],
618
+ 'name' => str_replace( array( '<![CDATA[', ']]>' ), '', $t[3] ),
619
+ );
620
+ }
621
+ if ( ! empty( $post_terms ) ) $postdata['terms'] = $post_terms;
622
+
623
+ preg_match_all( '|<wp:comment>(.+?)</wp:comment>|is', $post, $comments );
624
+ $comments = $comments[1];
625
+ if ( $comments ) {
626
+ foreach ( $comments as $comment ) {
627
+ preg_match_all( '|<wp:commentmeta>(.+?)</wp:commentmeta>|is', $comment, $commentmeta );
628
+ $commentmeta = $commentmeta[1];
629
+ $c_meta = array();
630
+ foreach ( $commentmeta as $m ) {
631
+ $c_meta[] = array(
632
+ 'key' => $this->get_tag( $m, 'wp:meta_key' ),
633
+ 'value' => $this->get_tag( $m, 'wp:meta_value' ),
634
+ );
635
+ }
636
+
637
+ $post_comments[] = array(
638
+ 'comment_id' => $this->get_tag( $comment, 'wp:comment_id' ),
639
+ 'comment_author' => $this->get_tag( $comment, 'wp:comment_author' ),
640
+ 'comment_author_email' => $this->get_tag( $comment, 'wp:comment_author_email' ),
641
+ 'comment_author_IP' => $this->get_tag( $comment, 'wp:comment_author_IP' ),
642
+ 'comment_author_url' => $this->get_tag( $comment, 'wp:comment_author_url' ),
643
+ 'comment_date' => $this->get_tag( $comment, 'wp:comment_date' ),
644
+ 'comment_date_gmt' => $this->get_tag( $comment, 'wp:comment_date_gmt' ),
645
+ 'comment_content' => $this->get_tag( $comment, 'wp:comment_content' ),
646
+ 'comment_approved' => $this->get_tag( $comment, 'wp:comment_approved' ),
647
+ 'comment_type' => $this->get_tag( $comment, 'wp:comment_type' ),
648
+ 'comment_parent' => $this->get_tag( $comment, 'wp:comment_parent' ),
649
+ 'comment_user_id' => $this->get_tag( $comment, 'wp:comment_user_id' ),
650
+ 'commentmeta' => $c_meta,
651
+ );
652
+ }
653
+ }
654
+ if ( ! empty( $post_comments ) ) $postdata['comments'] = $post_comments;
655
+
656
+ preg_match_all( '|<wp:postmeta>(.+?)</wp:postmeta>|is', $post, $postmeta );
657
+ $postmeta = $postmeta[1];
658
+ if ( $postmeta ) {
659
+ foreach ( $postmeta as $p ) {
660
+ $post_postmeta[] = array(
661
+ 'key' => $this->get_tag( $p, 'wp:meta_key' ),
662
+ 'value' => $this->get_tag( $p, 'wp:meta_value' ),
663
+ );
664
+ }
665
+ }
666
+ if ( ! empty( $post_postmeta ) ) $postdata['postmeta'] = $post_postmeta;
667
+
668
+ return $postdata;
669
+ }
670
+
671
+ function _normalize_tag( $matches ) {
672
+ return '<' . strtolower( $matches[1] );
673
+ }
674
+
675
+ function fopen( $filename, $mode = 'r' ) {
676
+ if ( $this->has_gzip )
677
+ return gzopen( $filename, $mode );
678
+ return fopen( $filename, $mode );
679
+ }
680
+
681
+ function feof( $fp ) {
682
+ if ( $this->has_gzip )
683
+ return gzeof( $fp );
684
+ return feof( $fp );
685
+ }
686
+
687
+ function fgets( $fp, $len = 8192 ) {
688
+ if ( $this->has_gzip )
689
+ return gzgets( $fp, $len );
690
+ return fgets( $fp, $len );
691
+ }
692
+
693
+ function fclose( $fp ) {
694
+ if ( $this->has_gzip )
695
+ return gzclose( $fp );
696
+ return fclose( $fp );
697
+ }
698
+ }
admin/font-awesome-icons.php CHANGED
@@ -1,687 +1,687 @@
1
- <?php
2
- /**
3
- * List of font awesome icons
4
- *
5
- * @package WP_Review
6
- * @since 3.0.0
7
- */
8
-
9
- // phpcs:disable
10
- return array(
11
- 'fa fa-star' => array( 'unicode' => '\f005', 'name' => 'Star' ),
12
- 'fa fa-500px' => array( 'unicode' => '\f26e', 'name' => '500px' ),
13
- 'fa fa-address-book' => array( 'unicode' => '\f2b9', 'name' => 'Address book' ),
14
- 'fa fa-address-book-o' => array( 'unicode' => '\f2ba', 'name' => 'Address book o' ),
15
- 'fa fa-address-card' => array( 'unicode' => '\f2bb', 'name' => 'Address card' ),
16
- 'fa fa-address-card-o' => array( 'unicode' => '\f2bc', 'name' => 'Address card o' ),
17
- 'fa fa-adjust' => array( 'unicode' => '\f042', 'name' => 'Adjust' ),
18
- 'fa fa-adn' => array( 'unicode' => '\f170', 'name' => 'Adn' ),
19
- 'fa fa-align-center' => array( 'unicode' => '\f037', 'name' => 'Align center' ),
20
- 'fa fa-align-justify' => array( 'unicode' => '\f039', 'name' => 'Align justify' ),
21
- 'fa fa-align-left' => array( 'unicode' => '\f036', 'name' => 'Align left' ),
22
- 'fa fa-align-right' => array( 'unicode' => '\f038', 'name' => 'Align right' ),
23
- 'fa fa-amazon' => array( 'unicode' => '\f270', 'name' => 'Amazon' ),
24
- 'fa fa-ambulance' => array( 'unicode' => '\f0f9', 'name' => 'Ambulance' ),
25
- 'fa fa-american-sign-language-interpreting' => array( 'unicode' => '\f2a3', 'name' => 'American sign language interpreting' ),
26
- 'fa fa-anchor' => array( 'unicode' => '\f13d', 'name' => 'Anchor' ),
27
- 'fa fa-android' => array( 'unicode' => '\f17b', 'name' => 'Android' ),
28
- 'fa fa-angellist' => array( 'unicode' => '\f209', 'name' => 'Angellist' ),
29
- 'fa fa-angle-double-down' => array( 'unicode' => '\f103', 'name' => 'Angle double down' ),
30
- 'fa fa-angle-double-left' => array( 'unicode' => '\f100', 'name' => 'Angle double left' ),
31
- 'fa fa-angle-double-right' => array( 'unicode' => '\f101', 'name' => 'Angle double right' ),
32
- 'fa fa-angle-double-up' => array( 'unicode' => '\f102', 'name' => 'Angle double up' ),
33
- 'fa fa-angle-down' => array( 'unicode' => '\f107', 'name' => 'Angle down' ),
34
- 'fa fa-angle-left' => array( 'unicode' => '\f104', 'name' => 'Angle left' ),
35
- 'fa fa-angle-right' => array( 'unicode' => '\f105', 'name' => 'Angle right' ),
36
- 'fa fa-angle-up' => array( 'unicode' => '\f106', 'name' => 'Angle up' ),
37
- 'fa fa-apple' => array( 'unicode' => '\f179', 'name' => 'Apple' ),
38
- 'fa fa-archive' => array( 'unicode' => '\f187', 'name' => 'Archive' ),
39
- 'fa fa-area-chart' => array( 'unicode' => '\f1fe', 'name' => 'Area chart' ),
40
- 'fa fa-arrow-circle-down' => array( 'unicode' => '\f0ab', 'name' => 'Arrow circle down' ),
41
- 'fa fa-arrow-circle-left' => array( 'unicode' => '\f0a8', 'name' => 'Arrow circle left' ),
42
- 'fa fa-arrow-circle-o-down' => array( 'unicode' => '\f01a', 'name' => 'Arrow circle o down' ),
43
- 'fa fa-arrow-circle-o-left' => array( 'unicode' => '\f190', 'name' => 'Arrow circle o left' ),
44
- 'fa fa-arrow-circle-o-right' => array( 'unicode' => '\f18e', 'name' => 'Arrow circle o right' ),
45
- 'fa fa-arrow-circle-o-up' => array( 'unicode' => '\f01b', 'name' => 'Arrow circle o up' ),
46
- 'fa fa-arrow-circle-right' => array( 'unicode' => '\f0a9', 'name' => 'Arrow circle right' ),
47
- 'fa fa-arrow-circle-up' => array( 'unicode' => '\f0aa', 'name' => 'Arrow circle up' ),
48
- 'fa fa-arrow-down' => array( 'unicode' => '\f063', 'name' => 'Arrow down' ),
49
- 'fa fa-arrow-left' => array( 'unicode' => '\f060', 'name' => 'Arrow left' ),
50
- 'fa fa-arrow-right' => array( 'unicode' => '\f061', 'name' => 'Arrow right' ),
51
- 'fa fa-arrow-up' => array( 'unicode' => '\f062', 'name' => 'Arrow up' ),
52
- 'fa fa-arrows' => array( 'unicode' => '\f047', 'name' => 'Arrows' ),
53
- 'fa fa-arrows-alt' => array( 'unicode' => '\f0b2', 'name' => 'Arrows alt' ),
54
- 'fa fa-arrows-h' => array( 'unicode' => '\f07e', 'name' => 'Arrows h' ),
55
- 'fa fa-arrows-v' => array( 'unicode' => '\f07d', 'name' => 'Arrows v' ),
56
- 'fa fa-assistive-listening-systems' => array( 'unicode' => '\f2a2', 'name' => 'Assistive listening systems' ),
57
- 'fa fa-asterisk' => array( 'unicode' => '\f069', 'name' => 'Asterisk' ),
58
- 'fa fa-at' => array( 'unicode' => '\f1fa', 'name' => 'At' ),
59
- 'fa fa-audio-description' => array( 'unicode' => '\f29e', 'name' => 'Audio description' ),
60
- 'fa fa-backward' => array( 'unicode' => '\f04a', 'name' => 'Backward' ),
61
- 'fa fa-balance-scale' => array( 'unicode' => '\f24e', 'name' => 'Balance scale' ),
62
- 'fa fa-ban' => array( 'unicode' => '\f05e', 'name' => 'Ban' ),
63
- 'fa fa-bandcamp' => array( 'unicode' => '\f2d5', 'name' => 'Bandcamp' ),
64
- 'fa fa-bar-chart' => array( 'unicode' => '\f080', 'name' => 'Bar chart' ),
65
- 'fa fa-barcode' => array( 'unicode' => '\f02a', 'name' => 'Barcode' ),
66
- 'fa fa-bars' => array( 'unicode' => '\f0c9', 'name' => 'Bars' ),
67
- 'fa fa-bath' => array( 'unicode' => '\f2cd', 'name' => 'Bath' ),
68
- 'fa fa-battery-empty' => array( 'unicode' => '\f244', 'name' => 'Battery empty' ),
69
- 'fa fa-battery-full' => array( 'unicode' => '\f240', 'name' => 'Battery full' ),
70
- 'fa fa-battery-half' => array( 'unicode' => '\f242', 'name' => 'Battery half' ),
71
- 'fa fa-battery-quarter' => array( 'unicode' => '\f243', 'name' => 'Battery quarter' ),
72
- 'fa fa-battery-three-quarters' => array( 'unicode' => '\f241', 'name' => 'Battery three quarters' ),
73
- 'fa fa-bed' => array( 'unicode' => '\f236', 'name' => 'Bed' ),
74
- 'fa fa-beer' => array( 'unicode' => '\f0fc', 'name' => 'Beer' ),
75
- 'fa fa-behance' => array( 'unicode' => '\f1b4', 'name' => 'Behance' ),
76
- 'fa fa-behance-square' => array( 'unicode' => '\f1b5', 'name' => 'Behance square' ),
77
- 'fa fa-bell' => array( 'unicode' => '\f0f3', 'name' => 'Bell' ),
78
- 'fa fa-bell-o' => array( 'unicode' => '\f0a2', 'name' => 'Bell o' ),
79
- 'fa fa-bell-slash' => array( 'unicode' => '\f1f6', 'name' => 'Bell slash' ),
80
- 'fa fa-bell-slash-o' => array( 'unicode' => '\f1f7', 'name' => 'Bell slash o' ),
81
- 'fa fa-bicycle' => array( 'unicode' => '\f206', 'name' => 'Bicycle' ),
82
- 'fa fa-binoculars' => array( 'unicode' => '\f1e5', 'name' => 'Binoculars' ),
83
- 'fa fa-birthday-cake' => array( 'unicode' => '\f1fd', 'name' => 'Birthday cake' ),
84
- 'fa fa-bitbucket' => array( 'unicode' => '\f171', 'name' => 'Bitbucket' ),
85
- 'fa fa-bitbucket-square' => array( 'unicode' => '\f172', 'name' => 'Bitbucket square' ),
86
- 'fa fa-black-tie' => array( 'unicode' => '\f27e', 'name' => 'Black tie' ),
87
- 'fa fa-blind' => array( 'unicode' => '\f29d', 'name' => 'Blind' ),
88
- 'fa fa-bluetooth' => array( 'unicode' => '\f293', 'name' => 'Bluetooth' ),
89
- 'fa fa-bluetooth-b' => array( 'unicode' => '\f294', 'name' => 'Bluetooth b' ),
90
- 'fa fa-bold' => array( 'unicode' => '\f032', 'name' => 'Bold' ),
91
- 'fa fa-bolt' => array( 'unicode' => '\f0e7', 'name' => 'Bolt' ),
92
- 'fa fa-bomb' => array( 'unicode' => '\f1e2', 'name' => 'Bomb' ),
93
- 'fa fa-book' => array( 'unicode' => '\f02d', 'name' => 'Book' ),
94
- 'fa fa-bookmark' => array( 'unicode' => '\f02e', 'name' => 'Bookmark' ),
95
- 'fa fa-bookmark-o' => array( 'unicode' => '\f097', 'name' => 'Bookmark o' ),
96
- 'fa fa-braille' => array( 'unicode' => '\f2a1', 'name' => 'Braille' ),
97
- 'fa fa-briefcase' => array( 'unicode' => '\f0b1', 'name' => 'Briefcase' ),
98
- 'fa fa-btc' => array( 'unicode' => '\f15a', 'name' => 'Btc' ),
99
- 'fa fa-bug' => array( 'unicode' => '\f188', 'name' => 'Bug' ),
100
- 'fa fa-building' => array( 'unicode' => '\f1ad', 'name' => 'Building' ),
101
- 'fa fa-building-o' => array( 'unicode' => '\f0f7', 'name' => 'Building o' ),
102
- 'fa fa-bullhorn' => array( 'unicode' => '\f0a1', 'name' => 'Bullhorn' ),
103
- 'fa fa-bullseye' => array( 'unicode' => '\f140', 'name' => 'Bullseye' ),
104
- 'fa fa-bus' => array( 'unicode' => '\f207', 'name' => 'Bus' ),
105
- 'fa fa-buysellads' => array( 'unicode' => '\f20d', 'name' => 'Buysellads' ),
106
- 'fa fa-calculator' => array( 'unicode' => '\f1ec', 'name' => 'Calculator' ),
107
- 'fa fa-calendar' => array( 'unicode' => '\f073', 'name' => 'Calendar' ),
108
- 'fa fa-calendar-check-o' => array( 'unicode' => '\f274', 'name' => 'Calendar check o' ),
109
- 'fa fa-calendar-minus-o' => array( 'unicode' => '\f272', 'name' => 'Calendar minus o' ),
110
- 'fa fa-calendar-o' => array( 'unicode' => '\f133', 'name' => 'Calendar o' ),
111
- 'fa fa-calendar-plus-o' => array( 'unicode' => '\f271', 'name' => 'Calendar plus o' ),
112
- 'fa fa-calendar-times-o' => array( 'unicode' => '\f273', 'name' => 'Calendar times o' ),
113
- 'fa fa-camera' => array( 'unicode' => '\f030', 'name' => 'Camera' ),
114
- 'fa fa-camera-retro' => array( 'unicode' => '\f083', 'name' => 'Camera retro' ),
115
- 'fa fa-car' => array( 'unicode' => '\f1b9', 'name' => 'Car' ),
116
- 'fa fa-caret-down' => array( 'unicode' => '\f0d7', 'name' => 'Caret down' ),
117
- 'fa fa-caret-left' => array( 'unicode' => '\f0d9', 'name' => 'Caret left' ),
118
- 'fa fa-caret-right' => array( 'unicode' => '\f0da', 'name' => 'Caret right' ),
119
- 'fa fa-caret-square-o-down' => array( 'unicode' => '\f150', 'name' => 'Caret square o down' ),
120
- 'fa fa-caret-square-o-left' => array( 'unicode' => '\f191', 'name' => 'Caret square o left' ),
121
- 'fa fa-caret-square-o-right' => array( 'unicode' => '\f152', 'name' => 'Caret square o right' ),
122
- 'fa fa-caret-square-o-up' => array( 'unicode' => '\f151', 'name' => 'Caret square o up' ),
123
- 'fa fa-caret-up' => array( 'unicode' => '\f0d8', 'name' => 'Caret up' ),
124
- 'fa fa-cart-arrow-down' => array( 'unicode' => '\f218', 'name' => 'Cart arrow down' ),
125
- 'fa fa-cart-plus' => array( 'unicode' => '\f217', 'name' => 'Cart plus' ),
126
- 'fa fa-cc' => array( 'unicode' => '\f20a', 'name' => 'Cc' ),
127
- 'fa fa-cc-amex' => array( 'unicode' => '\f1f3', 'name' => 'Cc amex' ),
128
- 'fa fa-cc-diners-club' => array( 'unicode' => '\f24c', 'name' => 'Cc diners club' ),
129
- 'fa fa-cc-discover' => array( 'unicode' => '\f1f2', 'name' => 'Cc discover' ),
130
- 'fa fa-cc-jcb' => array( 'unicode' => '\f24b', 'name' => 'Cc jcb' ),
131
- 'fa fa-cc-mastercard' => array( 'unicode' => '\f1f1', 'name' => 'Cc mastercard' ),
132
- 'fa fa-cc-paypal' => array( 'unicode' => '\f1f4', 'name' => 'Cc paypal' ),
133
- 'fa fa-cc-stripe' => array( 'unicode' => '\f1f5', 'name' => 'Cc stripe' ),
134
- 'fa fa-cc-visa' => array( 'unicode' => '\f1f0', 'name' => 'Cc visa' ),
135
- 'fa fa-certificate' => array( 'unicode' => '\f0a3', 'name' => 'Certificate' ),
136
- 'fa fa-chain-broken' => array( 'unicode' => '\f127', 'name' => 'Chain broken' ),
137
- 'fa fa-check' => array( 'unicode' => '\f00c', 'name' => 'Check' ),
138
- 'fa fa-check-circle' => array( 'unicode' => '\f058', 'name' => 'Check circle' ),
139
- 'fa fa-check-circle-o' => array( 'unicode' => '\f05d', 'name' => 'Check circle o' ),
140
- 'fa fa-check-square' => array( 'unicode' => '\f14a', 'name' => 'Check square' ),
141
- 'fa fa-check-square-o' => array( 'unicode' => '\f046', 'name' => 'Check square o' ),
142
- 'fa fa-chevron-circle-down' => array( 'unicode' => '\f13a', 'name' => 'Chevron circle down' ),
143
- 'fa fa-chevron-circle-left' => array( 'unicode' => '\f137', 'name' => 'Chevron circle left' ),
144
- 'fa fa-chevron-circle-right' => array( 'unicode' => '\f138', 'name' => 'Chevron circle right' ),
145
- 'fa fa-chevron-circle-up' => array( 'unicode' => '\f139', 'name' => 'Chevron circle up' ),
146
- 'fa fa-chevron-down' => array( 'unicode' => '\f078', 'name' => 'Chevron down' ),
147
- 'fa fa-chevron-left' => array( 'unicode' => '\f053', 'name' => 'Chevron left' ),
148
- 'fa fa-chevron-right' => array( 'unicode' => '\f054', 'name' => 'Chevron right' ),
149
- 'fa fa-chevron-up' => array( 'unicode' => '\f077', 'name' => 'Chevron up' ),
150
- 'fa fa-child' => array( 'unicode' => '\f1ae', 'name' => 'Child' ),
151
- 'fa fa-chrome' => array( 'unicode' => '\f268', 'name' => 'Chrome' ),
152
- 'fa fa-circle' => array( 'unicode' => '\f111', 'name' => 'Circle' ),
153
- 'fa fa-circle-o' => array( 'unicode' => '\f10c', 'name' => 'Circle o' ),
154
- 'fa fa-circle-o-notch' => array( 'unicode' => '\f1ce', 'name' => 'Circle o notch' ),
155
- 'fa fa-circle-thin' => array( 'unicode' => '\f1db', 'name' => 'Circle thin' ),
156
- 'fa fa-clipboard' => array( 'unicode' => '\f0ea', 'name' => 'Clipboard' ),
157
- 'fa fa-clock-o' => array( 'unicode' => '\f017', 'name' => 'Clock o' ),
158
- 'fa fa-clone' => array( 'unicode' => '\f24d', 'name' => 'Clone' ),
159
- 'fa fa-cloud' => array( 'unicode' => '\f0c2', 'name' => 'Cloud' ),
160
- 'fa fa-cloud-download' => array( 'unicode' => '\f0ed', 'name' => 'Cloud download' ),
161
- 'fa fa-cloud-upload' => array( 'unicode' => '\f0ee', 'name' => 'Cloud upload' ),
162
- 'fa fa-code' => array( 'unicode' => '\f121', 'name' => 'Code' ),
163
- 'fa fa-code-fork' => array( 'unicode' => '\f126', 'name' => 'Code fork' ),
164
- 'fa fa-codepen' => array( 'unicode' => '\f1cb', 'name' => 'Codepen' ),
165
- 'fa fa-codiepie' => array( 'unicode' => '\f284', 'name' => 'Codiepie' ),
166
- 'fa fa-coffee' => array( 'unicode' => '\f0f4', 'name' => 'Coffee' ),
167
- 'fa fa-cog' => array( 'unicode' => '\f013', 'name' => 'Cog' ),
168
- 'fa fa-cogs' => array( 'unicode' => '\f085', 'name' => 'Cogs' ),
169
- 'fa fa-columns' => array( 'unicode' => '\f0db', 'name' => 'Columns' ),
170
- 'fa fa-comment' => array( 'unicode' => '\f075', 'name' => 'Comment' ),
171
- 'fa fa-comment-o' => array( 'unicode' => '\f0e5', 'name' => 'Comment o' ),
172
- 'fa fa-commenting' => array( 'unicode' => '\f27a', 'name' => 'Commenting' ),
173
- 'fa fa-commenting-o' => array( 'unicode' => '\f27b', 'name' => 'Commenting o' ),
174
- 'fa fa-comments' => array( 'unicode' => '\f086', 'name' => 'Comments' ),
175
- 'fa fa-comments-o' => array( 'unicode' => '\f0e6', 'name' => 'Comments o' ),
176
- 'fa fa-compass' => array( 'unicode' => '\f14e', 'name' => 'Compass' ),
177
- 'fa fa-compress' => array( 'unicode' => '\f066', 'name' => 'Compress' ),
178
- 'fa fa-connectdevelop' => array( 'unicode' => '\f20e', 'name' => 'Connectdevelop' ),
179
- 'fa fa-contao' => array( 'unicode' => '\f26d', 'name' => 'Contao' ),
180
- 'fa fa-copyright' => array( 'unicode' => '\f1f9', 'name' => 'Copyright' ),
181
- 'fa fa-creative-commons' => array( 'unicode' => '\f25e', 'name' => 'Creative commons' ),
182
- 'fa fa-credit-card' => array( 'unicode' => '\f09d', 'name' => 'Credit card' ),
183
- 'fa fa-credit-card-alt' => array( 'unicode' => '\f283', 'name' => 'Credit card alt' ),
184
- 'fa fa-crop' => array( 'unicode' => '\f125', 'name' => 'Crop' ),
185
- 'fa fa-crosshairs' => array( 'unicode' => '\f05b', 'name' => 'Crosshairs' ),
186
- 'fa fa-css3' => array( 'unicode' => '\f13c', 'name' => 'Css3' ),
187
- 'fa fa-cube' => array( 'unicode' => '\f1b2', 'name' => 'Cube' ),
188
- 'fa fa-cubes' => array( 'unicode' => '\f1b3', 'name' => 'Cubes' ),
189
- 'fa fa-cutlery' => array( 'unicode' => '\f0f5', 'name' => 'Cutlery' ),
190
- 'fa fa-dashcube' => array( 'unicode' => '\f210', 'name' => 'Dashcube' ),
191
- 'fa fa-database' => array( 'unicode' => '\f1c0', 'name' => 'Database' ),
192
- 'fa fa-deaf' => array( 'unicode' => '\f2a4', 'name' => 'Deaf' ),
193
- 'fa fa-delicious' => array( 'unicode' => '\f1a5', 'name' => 'Delicious' ),
194
- 'fa fa-desktop' => array( 'unicode' => '\f108', 'name' => 'Desktop' ),
195
- 'fa fa-deviantart' => array( 'unicode' => '\f1bd', 'name' => 'Deviantart' ),
196
- 'fa fa-diamond' => array( 'unicode' => '\f219', 'name' => 'Diamond' ),
197
- 'fa fa-digg' => array( 'unicode' => '\f1a6', 'name' => 'Digg' ),
198
- 'fa fa-dot-circle-o' => array( 'unicode' => '\f192', 'name' => 'Dot circle o' ),
199
- 'fa fa-download' => array( 'unicode' => '\f019', 'name' => 'Download' ),
200
- 'fa fa-dribbble' => array( 'unicode' => '\f17d', 'name' => 'Dribbble' ),
201
- 'fa fa-dropbox' => array( 'unicode' => '\f16b', 'name' => 'Dropbox' ),
202
- 'fa fa-drupal' => array( 'unicode' => '\f1a9', 'name' => 'Drupal' ),
203
- 'fa fa-edge' => array( 'unicode' => '\f282', 'name' => 'Edge' ),
204
- 'fa fa-eercast' => array( 'unicode' => '\f2da', 'name' => 'Eercast' ),
205
- 'fa fa-eject' => array( 'unicode' => '\f052', 'name' => 'Eject' ),
206
- 'fa fa-ellipsis-h' => array( 'unicode' => '\f141', 'name' => 'Ellipsis h' ),
207
- 'fa fa-ellipsis-v' => array( 'unicode' => '\f142', 'name' => 'Ellipsis v' ),
208
- 'fa fa-empire' => array( 'unicode' => '\f1d1', 'name' => 'Empire' ),
209
- 'fa fa-envelope' => array( 'unicode' => '\f0e0', 'name' => 'Envelope' ),
210
- 'fa fa-envelope-o' => array( 'unicode' => '\f003', 'name' => 'Envelope o' ),
211
- 'fa fa-envelope-open' => array( 'unicode' => '\f2b6', 'name' => 'Envelope open' ),
212
- 'fa fa-envelope-open-o' => array( 'unicode' => '\f2b7', 'name' => 'Envelope open o' ),
213
- 'fa fa-envelope-square' => array( 'unicode' => '\f199', 'name' => 'Envelope square' ),
214
- 'fa fa-envira' => array( 'unicode' => '\f299', 'name' => 'Envira' ),
215
- 'fa fa-eraser' => array( 'unicode' => '\f12d', 'name' => 'Eraser' ),
216
- 'fa fa-etsy' => array( 'unicode' => '\f2d7', 'name' => 'Etsy' ),
217
- 'fa fa-eur' => array( 'unicode' => '\f153', 'name' => 'Eur' ),
218
- 'fa fa-exchange' => array( 'unicode' => '\f0ec', 'name' => 'Exchange' ),
219
- 'fa fa-exclamation' => array( 'unicode' => '\f12a', 'name' => 'Exclamation' ),
220
- 'fa fa-exclamation-circle' => array( 'unicode' => '\f06a', 'name' => 'Exclamation circle' ),
221
- 'fa fa-exclamation-triangle' => array( 'unicode' => '\f071', 'name' => 'Exclamation triangle' ),
222
- 'fa fa-expand' => array( 'unicode' => '\f065', 'name' => 'Expand' ),
223
- 'fa fa-expeditedssl' => array( 'unicode' => '\f23e', 'name' => 'Expeditedssl' ),
224
- 'fa fa-external-link' => array( 'unicode' => '\f08e', 'name' => 'External link' ),
225
- 'fa fa-external-link-square' => array( 'unicode' => '\f14c', 'name' => 'External link square' ),
226
- 'fa fa-eye' => array( 'unicode' => '\f06e', 'name' => 'Eye' ),
227
- 'fa fa-eye-slash' => array( 'unicode' => '\f070', 'name' => 'Eye slash' ),
228
- 'fa fa-eyedropper' => array( 'unicode' => '\f1fb', 'name' => 'Eyedropper' ),
229
- 'fa fa-facebook' => array( 'unicode' => '\f09a', 'name' => 'Facebook' ),
230
- 'fa fa-facebook-official' => array( 'unicode' => '\f230', 'name' => 'Facebook official' ),
231
- 'fa fa-facebook-square' => array( 'unicode' => '\f082', 'name' => 'Facebook square' ),
232
- 'fa fa-fast-backward' => array( 'unicode' => '\f049', 'name' => 'Fast backward' ),
233
- 'fa fa-fast-forward' => array( 'unicode' => '\f050', 'name' => 'Fast forward' ),
234
- 'fa fa-fax' => array( 'unicode' => '\f1ac', 'name' => 'Fax' ),
235
- 'fa fa-female' => array( 'unicode' => '\f182', 'name' => 'Female' ),
236
- 'fa fa-fighter-jet' => array( 'unicode' => '\f0fb', 'name' => 'Fighter jet' ),
237
- 'fa fa-file' => array( 'unicode' => '\f15b', 'name' => 'File' ),
238
- 'fa fa-file-archive-o' => array( 'unicode' => '\f1c6', 'name' => 'File archive o' ),
239
- 'fa fa-file-audio-o' => array( 'unicode' => '\f1c7', 'name' => 'File audio o' ),
240
- 'fa fa-file-code-o' => array( 'unicode' => '\f1c9', 'name' => 'File code o' ),
241
- 'fa fa-file-excel-o' => array( 'unicode' => '\f1c3', 'name' => 'File excel o' ),
242
- 'fa fa-file-image-o' => array( 'unicode' => '\f1c5', 'name' => 'File image o' ),
243
- 'fa fa-file-o' => array( 'unicode' => '\f016', 'name' => 'File o' ),
244
- 'fa fa-file-pdf-o' => array( 'unicode' => '\f1c1', 'name' => 'File pdf o' ),
245
- 'fa fa-file-powerpoint-o' => array( 'unicode' => '\f1c4', 'name' => 'File powerpoint o' ),
246
- 'fa fa-file-text' => array( 'unicode' => '\f15c', 'name' => 'File text' ),
247
- 'fa fa-file-text-o' => array( 'unicode' => '\f0f6', 'name' => 'File text o' ),
248
- 'fa fa-file-video-o' => array( 'unicode' => '\f1c8', 'name' => 'File video o' ),
249
- 'fa fa-file-word-o' => array( 'unicode' => '\f1c2', 'name' => 'File word o' ),
250
- 'fa fa-files-o' => array( 'unicode' => '\f0c5', 'name' => 'Files o' ),
251
- 'fa fa-film' => array( 'unicode' => '\f008', 'name' => 'Film' ),
252
- 'fa fa-filter' => array( 'unicode' => '\f0b0', 'name' => 'Filter' ),
253
- 'fa fa-fire' => array( 'unicode' => '\f06d', 'name' => 'Fire' ),
254
- 'fa fa-fire-extinguisher' => array( 'unicode' => '\f134', 'name' => 'Fire extinguisher' ),
255
- 'fa fa-firefox' => array( 'unicode' => '\f269', 'name' => 'Firefox' ),
256
- 'fa fa-first-order' => array( 'unicode' => '\f2b0', 'name' => 'First order' ),
257
- 'fa fa-flag' => array( 'unicode' => '\f024', 'name' => 'Flag' ),
258
- 'fa fa-flag-checkered' => array( 'unicode' => '\f11e', 'name' => 'Flag checkered' ),
259
- 'fa fa-flag-o' => array( 'unicode' => '\f11d', 'name' => 'Flag o' ),
260
- 'fa fa-flask' => array( 'unicode' => '\f0c3', 'name' => 'Flask' ),
261
- 'fa fa-flickr' => array( 'unicode' => '\f16e', 'name' => 'Flickr' ),
262
- 'fa fa-floppy-o' => array( 'unicode' => '\f0c7', 'name' => 'Floppy o' ),
263
- 'fa fa-folder' => array( 'unicode' => '\f07b', 'name' => 'Folder' ),
264
- 'fa fa-folder-o' => array( 'unicode' => '\f114', 'name' => 'Folder o' ),
265
- 'fa fa-folder-open' => array( 'unicode' => '\f07c', 'name' => 'Folder open' ),
266
- 'fa fa-folder-open-o' => array( 'unicode' => '\f115', 'name' => 'Folder open o' ),
267
- 'fa fa-font' => array( 'unicode' => '\f031', 'name' => 'Font' ),
268
- 'fa fa-font-awesome' => array( 'unicode' => '\f2b4', 'name' => 'Font awesome' ),
269
- 'fa fa-fonticons' => array( 'unicode' => '\f280', 'name' => 'Fonticons' ),
270
- 'fa fa-fort-awesome' => array( 'unicode' => '\f286', 'name' => 'Fort awesome' ),
271
- 'fa fa-forumbee' => array( 'unicode' => '\f211', 'name' => 'Forumbee' ),
272
- 'fa fa-forward' => array( 'unicode' => '\f04e', 'name' => 'Forward' ),
273
- 'fa fa-foursquare' => array( 'unicode' => '\f180', 'name' => 'Foursquare' ),
274
- 'fa fa-free-code-camp' => array( 'unicode' => '\f2c5', 'name' => 'Free code camp' ),
275
- 'fa fa-frown-o' => array( 'unicode' => '\f119', 'name' => 'Frown o' ),
276
- 'fa fa-futbol-o' => array( 'unicode' => '\f1e3', 'name' => 'Futbol o' ),
277
- 'fa fa-gamepad' => array( 'unicode' => '\f11b', 'name' => 'Gamepad' ),
278
- 'fa fa-gavel' => array( 'unicode' => '\f0e3', 'name' => 'Gavel' ),
279
- 'fa fa-gbp' => array( 'unicode' => '\f154', 'name' => 'Gbp' ),
280
- 'fa fa-genderless' => array( 'unicode' => '\f22d', 'name' => 'Genderless' ),
281
- 'fa fa-get-pocket' => array( 'unicode' => '\f265', 'name' => 'Get pocket' ),
282
- 'fa fa-gg' => array( 'unicode' => '\f260', 'name' => 'Gg' ),
283
- 'fa fa-gg-circle' => array( 'unicode' => '\f261', 'name' => 'Gg circle' ),
284
- 'fa fa-gift' => array( 'unicode' => '\f06b', 'name' => 'Gift' ),
285
- 'fa fa-git' => array( 'unicode' => '\f1d3', 'name' => 'Git' ),
286
- 'fa fa-git-square' => array( 'unicode' => '\f1d2', 'name' => 'Git square' ),
287
- 'fa fa-github' => array( 'unicode' => '\f09b', 'name' => 'Github' ),
288
- 'fa fa-github-alt' => array( 'unicode' => '\f113', 'name' => 'Github alt' ),
289
- 'fa fa-github-square' => array( 'unicode' => '\f092', 'name' => 'Github square' ),
290
- 'fa fa-gitlab' => array( 'unicode' => '\f296', 'name' => 'Gitlab' ),
291
- 'fa fa-glass' => array( 'unicode' => '\f000', 'name' => 'Glass' ),
292
- 'fa fa-glide' => array( 'unicode' => '\f2a5', 'name' => 'Glide' ),
293
- 'fa fa-glide-g' => array( 'unicode' => '\f2a6', 'name' => 'Glide g' ),
294
- 'fa fa-globe' => array( 'unicode' => '\f0ac', 'name' => 'Globe' ),
295
- 'fa fa-google' => array( 'unicode' => '\f1a0', 'name' => 'Google' ),
296
- 'fa fa-google-plus' => array( 'unicode' => '\f0d5', 'name' => 'Google plus' ),
297
- 'fa fa-google-plus-official' => array( 'unicode' => '\f2b3', 'name' => 'Google plus official' ),
298
- 'fa fa-google-plus-square' => array( 'unicode' => '\f0d4', 'name' => 'Google plus square' ),
299
- 'fa fa-google-wallet' => array( 'unicode' => '\f1ee', 'name' => 'Google wallet' ),
300
- 'fa fa-graduation-cap' => array( 'unicode' => '\f19d', 'name' => 'Graduation cap' ),
301
- 'fa fa-gratipay' => array( 'unicode' => '\f184', 'name' => 'Gratipay' ),
302
- 'fa fa-grav' => array( 'unicode' => '\f2d6', 'name' => 'Grav' ),
303
- 'fa fa-h-square' => array( 'unicode' => '\f0fd', 'name' => 'H square' ),
304
- 'fa fa-hacker-news' => array( 'unicode' => '\f1d4', 'name' => 'Hacker news' ),
305
- 'fa fa-hand-lizard-o' => array( 'unicode' => '\f258', 'name' => 'Hand lizard o' ),
306
- 'fa fa-hand-o-down' => array( 'unicode' => '\f0a7', 'name' => 'Hand o down' ),
307
- 'fa fa-hand-o-left' => array( 'unicode' => '\f0a5', 'name' => 'Hand o left' ),
308
- 'fa fa-hand-o-right' => array( 'unicode' => '\f0a4', 'name' => 'Hand o right' ),
309
- 'fa fa-hand-o-up' => array( 'unicode' => '\f0a6', 'name' => 'Hand o up' ),
310
- 'fa fa-hand-paper-o' => array( 'unicode' => '\f256', 'name' => 'Hand paper o' ),
311
- 'fa fa-hand-peace-o' => array( 'unicode' => '\f25b', 'name' => 'Hand peace o' ),
312
- 'fa fa-hand-pointer-o' => array( 'unicode' => '\f25a', 'name' => 'Hand pointer o' ),
313
- 'fa fa-hand-rock-o' => array( 'unicode' => '\f255', 'name' => 'Hand rock o' ),
314
- 'fa fa-hand-scissors-o' => array( 'unicode' => '\f257', 'name' => 'Hand scissors o' ),
315
- 'fa fa-hand-spock-o' => array( 'unicode' => '\f259', 'name' => 'Hand spock o' ),
316
- 'fa fa-handshake-o' => array( 'unicode' => '\f2b5', 'name' => 'Handshake o' ),
317
- 'fa fa-hashtag' => array( 'unicode' => '\f292', 'name' => 'Hashtag' ),
318
- 'fa fa-hdd-o' => array( 'unicode' => '\f0a0', 'name' => 'Hdd o' ),
319
- 'fa fa-header' => array( 'unicode' => '\f1dc', 'name' => 'Header' ),
320
- 'fa fa-headphones' => array( 'unicode' => '\f025', 'name' => 'Headphones' ),
321
- 'fa fa-heart' => array( 'unicode' => '\f004', 'name' => 'Heart' ),
322
- 'fa fa-heart-o' => array( 'unicode' => '\f08a', 'name' => 'Heart o' ),
323
- 'fa fa-heartbeat' => array( 'unicode' => '\f21e', 'name' => 'Heartbeat' ),
324
- 'fa fa-history' => array( 'unicode' => '\f1da', 'name' => 'History' ),
325
- 'fa fa-home' => array( 'unicode' => '\f015', 'name' => 'Home' ),
326
- 'fa fa-hospital-o' => array( 'unicode' => '\f0f8', 'name' => 'Hospital o' ),
327
- 'fa fa-hourglass' => array( 'unicode' => '\f254', 'name' => 'Hourglass' ),
328
- 'fa fa-hourglass-end' => array( 'unicode' => '\f253', 'name' => 'Hourglass end' ),
329
- 'fa fa-hourglass-half' => array( 'unicode' => '\f252', 'name' => 'Hourglass half' ),
330
- 'fa fa-hourglass-o' => array( 'unicode' => '\f250', 'name' => 'Hourglass o' ),
331
- 'fa fa-hourglass-start' => array( 'unicode' => '\f251', 'name' => 'Hourglass start' ),
332
- 'fa fa-houzz' => array( 'unicode' => '\f27c', 'name' => 'Houzz' ),
333
- 'fa fa-html5' => array( 'unicode' => '\f13b', 'name' => 'Html5' ),
334
- 'fa fa-i-cursor' => array( 'unicode' => '\f246', 'name' => 'I cursor' ),
335
- 'fa fa-id-badge' => array( 'unicode' => '\f2c1', 'name' => 'Id badge' ),
336
- 'fa fa-id-card' => array( 'unicode' => '\f2c2', 'name' => 'Id card' ),
337
- 'fa fa-id-card-o' => array( 'unicode' => '\f2c3', 'name' => 'Id card o' ),
338
- 'fa fa-ils' => array( 'unicode' => '\f20b', 'name' => 'Ils' ),
339
- 'fa fa-imdb' => array( 'unicode' => '\f2d8', 'name' => 'Imdb' ),
340
- 'fa fa-inbox' => array( 'unicode' => '\f01c', 'name' => 'Inbox' ),
341
- 'fa fa-indent' => array( 'unicode' => '\f03c', 'name' => 'Indent' ),
342
- 'fa fa-industry' => array( 'unicode' => '\f275', 'name' => 'Industry' ),
343
- 'fa fa-info' => array( 'unicode' => '\f129', 'name' => 'Info' ),
344
- 'fa fa-info-circle' => array( 'unicode' => '\f05a', 'name' => 'Info circle' ),
345
- 'fa fa-inr' => array( 'unicode' => '\f156', 'name' => 'Inr' ),
346
- 'fa fa-instagram' => array( 'unicode' => '\f16d', 'name' => 'Instagram' ),
347
- 'fa fa-internet-explorer' => array( 'unicode' => '\f26b', 'name' => 'Internet explorer' ),
348
- 'fa fa-ioxhost' => array( 'unicode' => '\f208', 'name' => 'Ioxhost' ),
349
- 'fa fa-italic' => array( 'unicode' => '\f033', 'name' => 'Italic' ),
350
- 'fa fa-joomla' => array( 'unicode' => '\f1aa', 'name' => 'Joomla' ),
351
- 'fa fa-jpy' => array( 'unicode' => '\f157', 'name' => 'Jpy' ),
352
- 'fa fa-jsfiddle' => array( 'unicode' => '\f1cc', 'name' => 'Jsfiddle' ),
353
- 'fa fa-key' => array( 'unicode' => '\f084', 'name' => 'Key' ),
354
- 'fa fa-keyboard-o' => array( 'unicode' => '\f11c', 'name' => 'Keyboard o' ),
355
- 'fa fa-krw' => array( 'unicode' => '\f159', 'name' => 'Krw' ),
356
- 'fa fa-language' => array( 'unicode' => '\f1ab', 'name' => 'Language' ),
357
- 'fa fa-laptop' => array( 'unicode' => '\f109', 'name' => 'Laptop' ),
358
- 'fa fa-lastfm' => array( 'unicode' => '\f202', 'name' => 'Lastfm' ),
359
- 'fa fa-lastfm-square' => array( 'unicode' => '\f203', 'name' => 'Lastfm square' ),
360
- 'fa fa-leaf' => array( 'unicode' => '\f06c', 'name' => 'Leaf' ),
361
- 'fa fa-leanpub' => array( 'unicode' => '\f212', 'name' => 'Leanpub' ),
362
- 'fa fa-lemon-o' => array( 'unicode' => '\f094', 'name' => 'Lemon o' ),
363
- 'fa fa-level-down' => array( 'unicode' => '\f149', 'name' => 'Level down' ),
364
- 'fa fa-level-up' => array( 'unicode' => '\f148', 'name' => 'Level up' ),
365
- 'fa fa-life-ring' => array( 'unicode' => '\f1cd', 'name' => 'Life ring' ),
366
- 'fa fa-lightbulb-o' => array( 'unicode' => '\f0eb', 'name' => 'Lightbulb o' ),
367
- 'fa fa-line-chart' => array( 'unicode' => '\f201', 'name' => 'Line chart' ),
368
- 'fa fa-link' => array( 'unicode' => '\f0c1', 'name' => 'Link' ),
369
- 'fa fa-linkedin' => array( 'unicode' => '\f0e1', 'name' => 'Linkedin' ),
370
- 'fa fa-linkedin-square' => array( 'unicode' => '\f08c', 'name' => 'Linkedin square' ),
371
- 'fa fa-linode' => array( 'unicode' => '\f2b8', 'name' => 'Linode' ),
372
- 'fa fa-linux' => array( 'unicode' => '\f17c', 'name' => 'Linux' ),
373
- 'fa fa-list' => array( 'unicode' => '\f03a', 'name' => 'List' ),
374
- 'fa fa-list-alt' => array( 'unicode' => '\f022', 'name' => 'List alt' ),
375
- 'fa fa-list-ol' => array( 'unicode' => '\f0cb', 'name' => 'List ol' ),
376
- 'fa fa-list-ul' => array( 'unicode' => '\f0ca', 'name' => 'List ul' ),
377
- 'fa fa-location-arrow' => array( 'unicode' => '\f124', 'name' => 'Location arrow' ),
378
- 'fa fa-lock' => array( 'unicode' => '\f023', 'name' => 'Lock' ),
379
- 'fa fa-long-arrow-down' => array( 'unicode' => '\f175', 'name' => 'Long arrow down' ),
380
- 'fa fa-long-arrow-left' => array( 'unicode' => '\f177', 'name' => 'Long arrow left' ),
381
- 'fa fa-long-arrow-right' => array( 'unicode' => '\f178', 'name' => 'Long arrow right' ),
382
- 'fa fa-long-arrow-up' => array( 'unicode' => '\f176', 'name' => 'Long arrow up' ),
383
- 'fa fa-low-vision' => array( 'unicode' => '\f2a8', 'name' => 'Low vision' ),
384
- 'fa fa-magic' => array( 'unicode' => '\f0d0', 'name' => 'Magic' ),
385
- 'fa fa-magnet' => array( 'unicode' => '\f076', 'name' => 'Magnet' ),
386
- 'fa fa-male' => array( 'unicode' => '\f183', 'name' => 'Male' ),
387
- 'fa fa-map' => array( 'unicode' => '\f279', 'name' => 'Map' ),
388
- 'fa fa-map-marker' => array( 'unicode' => '\f041', 'name' => 'Map marker' ),
389
- 'fa fa-map-o' => array( 'unicode' => '\f278', 'name' => 'Map o' ),
390
- 'fa fa-map-pin' => array( 'unicode' => '\f276', 'name' => 'Map pin' ),
391
- 'fa fa-map-signs' => array( 'unicode' => '\f277', 'name' => 'Map signs' ),
392
- 'fa fa-mars' => array( 'unicode' => '\f222', 'name' => 'Mars' ),
393
- 'fa fa-mars-double' => array( 'unicode' => '\f227', 'name' => 'Mars double' ),
394
- 'fa fa-mars-stroke' => array( 'unicode' => '\f229', 'name' => 'Mars stroke' ),
395
- 'fa fa-mars-stroke-h' => array( 'unicode' => '\f22b', 'name' => 'Mars stroke h' ),
396
- 'fa fa-mars-stroke-v' => array( 'unicode' => '\f22a', 'name' => 'Mars stroke v' ),
397
- 'fa fa-maxcdn' => array( 'unicode' => '\f136', 'name' => 'Maxcdn' ),
398
- 'fa fa-meanpath' => array( 'unicode' => '\f20c', 'name' => 'Meanpath' ),
399
- 'fa fa-medium' => array( 'unicode' => '\f23a', 'name' => 'Medium' ),
400
- 'fa fa-medkit' => array( 'unicode' => '\f0fa', 'name' => 'Medkit' ),
401
- 'fa fa-meetup' => array( 'unicode' => '\f2e0', 'name' => 'Meetup' ),
402
- 'fa fa-meh-o' => array( 'unicode' => '\f11a', 'name' => 'Meh o' ),
403
- 'fa fa-mercury' => array( 'unicode' => '\f223', 'name' => 'Mercury' ),
404
- 'fa fa-microchip' => array( 'unicode' => '\f2db', 'name' => 'Microchip' ),
405
- 'fa fa-microphone' => array( 'unicode' => '\f130', 'name' => 'Microphone' ),
406
- 'fa fa-microphone-slash' => array( 'unicode' => '\f131', 'name' => 'Microphone slash' ),
407
- 'fa fa-minus' => array( 'unicode' => '\f068', 'name' => 'Minus' ),
408
- 'fa fa-minus-circle' => array( 'unicode' => '\f056', 'name' => 'Minus circle' ),
409
- 'fa fa-minus-square' => array( 'unicode' => '\f146', 'name' => 'Minus square' ),
410
- 'fa fa-minus-square-o' => array( 'unicode' => '\f147', 'name' => 'Minus square o' ),
411
- 'fa fa-mixcloud' => array( 'unicode' => '\f289', 'name' => 'Mixcloud' ),
412
- 'fa fa-mobile' => array( 'unicode' => '\f10b', 'name' => 'Mobile' ),
413
- 'fa fa-modx' => array( 'unicode' => '\f285', 'name' => 'Modx' ),
414
- 'fa fa-money' => array( 'unicode' => '\f0d6', 'name' => 'Money' ),
415
- 'fa fa-moon-o' => array( 'unicode' => '\f186', 'name' => 'Moon o' ),
416
- 'fa fa-motorcycle' => array( 'unicode' => '\f21c', 'name' => 'Motorcycle' ),
417
- 'fa fa-mouse-pointer' => array( 'unicode' => '\f245', 'name' => 'Mouse pointer' ),
418
- 'fa fa-music' => array( 'unicode' => '\f001', 'name' => 'Music' ),
419
- 'fa fa-neuter' => array( 'unicode' => '\f22c', 'name' => 'Neuter' ),
420
- 'fa fa-newspaper-o' => array( 'unicode' => '\f1ea', 'name' => 'Newspaper o' ),
421
- 'fa fa-object-group' => array( 'unicode' => '\f247', 'name' => 'Object group' ),
422
- 'fa fa-object-ungroup' => array( 'unicode' => '\f248', 'name' => 'Object ungroup' ),
423
- 'fa fa-odnoklassniki' => array( 'unicode' => '\f263', 'name' => 'Odnoklassniki' ),
424
- 'fa fa-odnoklassniki-square' => array( 'unicode' => '\f264', 'name' => 'Odnoklassniki square' ),
425
- 'fa fa-opencart' => array( 'unicode' => '\f23d', 'name' => 'Opencart' ),
426
- 'fa fa-openid' => array( 'unicode' => '\f19b', 'name' => 'Openid' ),
427
- 'fa fa-opera' => array( 'unicode' => '\f26a', 'name' => 'Opera' ),
428
- 'fa fa-optin-monster' => array( 'unicode' => '\f23c', 'name' => 'Optin monster' ),
429
- 'fa fa-outdent' => array( 'unicode' => '\f03b', 'name' => 'Outdent' ),
430
- 'fa fa-pagelines' => array( 'unicode' => '\f18c', 'name' => 'Pagelines' ),
431
- 'fa fa-paint-brush' => array( 'unicode' => '\f1fc', 'name' => 'Paint brush' ),
432
- 'fa fa-paper-plane' => array( 'unicode' => '\f1d8', 'name' => 'Paper plane' ),
433
- 'fa fa-paper-plane-o' => array( 'unicode' => '\f1d9', 'name' => 'Paper plane o' ),
434
- 'fa fa-paperclip' => array( 'unicode' => '\f0c6', 'name' => 'Paperclip' ),
435
- 'fa fa-paragraph' => array( 'unicode' => '\f1dd', 'name' => 'Paragraph' ),
436
- 'fa fa-pause' => array( 'unicode' => '\f04c', 'name' => 'Pause' ),
437
- 'fa fa-pause-circle' => array( 'unicode' => '\f28b', 'name' => 'Pause circle' ),
438
- 'fa fa-pause-circle-o' => array( 'unicode' => '\f28c', 'name' => 'Pause circle o' ),
439
- 'fa fa-paw' => array( 'unicode' => '\f1b0', 'name' => 'Paw' ),
440
- 'fa fa-paypal' => array( 'unicode' => '\f1ed', 'name' => 'Paypal' ),
441
- 'fa fa-pencil' => array( 'unicode' => '\f040', 'name' => 'Pencil' ),
442
- 'fa fa-pencil-square' => array( 'unicode' => '\f14b', 'name' => 'Pencil square' ),
443
- 'fa fa-pencil-square-o' => array( 'unicode' => '\f044', 'name' => 'Pencil square o' ),
444
- 'fa fa-percent' => array( 'unicode' => '\f295', 'name' => 'Percent' ),
445
- 'fa fa-phone' => array( 'unicode' => '\f095', 'name' => 'Phone' ),
446
- 'fa fa-phone-square' => array( 'unicode' => '\f098', 'name' => 'Phone square' ),
447
- 'fa fa-picture-o' => array( 'unicode' => '\f03e', 'name' => 'Picture o' ),
448
- 'fa fa-pie-chart' => array( 'unicode' => '\f200', 'name' => 'Pie chart' ),
449
- 'fa fa-pied-piper' => array( 'unicode' => '\f2ae', 'name' => 'Pied piper' ),
450
- 'fa fa-pied-piper-alt' => array( 'unicode' => '\f1a8', 'name' => 'Pied piper alt' ),
451
- 'fa fa-pied-piper-pp' => array( 'unicode' => '\f1a7', 'name' => 'Pied piper pp' ),
452
- 'fa fa-pinterest' => array( 'unicode' => '\f0d2', 'name' => 'Pinterest' ),
453
- 'fa fa-pinterest-p' => array( 'unicode' => '\f231', 'name' => 'Pinterest p' ),
454
- 'fa fa-pinterest-square' => array( 'unicode' => '\f0d3', 'name' => 'Pinterest square' ),
455
- 'fa fa-plane' => array( 'unicode' => '\f072', 'name' => 'Plane' ),
456
- 'fa fa-play' => array( 'unicode' => '\f04b', 'name' => 'Play' ),
457
- 'fa fa-play-circle' => array( 'unicode' => '\f144', 'name' => 'Play circle' ),
458
- 'fa fa-play-circle-o' => array( 'unicode' => '\f01d', 'name' => 'Play circle o' ),
459
- 'fa fa-plug' => array( 'unicode' => '\f1e6', 'name' => 'Plug' ),
460
- 'fa fa-plus' => array( 'unicode' => '\f067', 'name' => 'Plus' ),
461
- 'fa fa-plus-circle' => array( 'unicode' => '\f055', 'name' => 'Plus circle' ),
462
- 'fa fa-plus-square' => array( 'unicode' => '\f0fe', 'name' => 'Plus square' ),
463
- 'fa fa-plus-square-o' => array( 'unicode' => '\f196', 'name' => 'Plus square o' ),
464
- 'fa fa-podcast' => array( 'unicode' => '\f2ce', 'name' => 'Podcast' ),
465
- 'fa fa-power-off' => array( 'unicode' => '\f011', 'name' => 'Power off' ),
466
- 'fa fa-print' => array( 'unicode' => '\f02f', 'name' => 'Print' ),
467
- 'fa fa-product-hunt' => array( 'unicode' => '\f288', 'name' => 'Product hunt' ),
468
- 'fa fa-puzzle-piece' => array( 'unicode' => '\f12e', 'name' => 'Puzzle piece' ),
469
- 'fa fa-qq' => array( 'unicode' => '\f1d6', 'name' => 'Qq' ),
470
- 'fa fa-qrcode' => array( 'unicode' => '\f029', 'name' => 'Qrcode' ),
471
- 'fa fa-question' => array( 'unicode' => '\f128', 'name' => 'Question' ),
472
- 'fa fa-question-circle' => array( 'unicode' => '\f059', 'name' => 'Question circle' ),
473
- 'fa fa-question-circle-o' => array( 'unicode' => '\f29c', 'name' => 'Question circle o' ),
474
- 'fa fa-quora' => array( 'unicode' => '\f2c4', 'name' => 'Quora' ),
475
- 'fa fa-quote-left' => array( 'unicode' => '\f10d', 'name' => 'Quote left' ),
476
- 'fa fa-quote-right' => array( 'unicode' => '\f10e', 'name' => 'Quote right' ),
477
- 'fa fa-random' => array( 'unicode' => '\f074', 'name' => 'Random' ),
478
- 'fa fa-ravelry' => array( 'unicode' => '\f2d9', 'name' => 'Ravelry' ),
479
- 'fa fa-rebel' => array( 'unicode' => '\f1d0', 'name' => 'Rebel' ),
480
- 'fa fa-recycle' => array( 'unicode' => '\f1b8', 'name' => 'Recycle' ),
481
- 'fa fa-reddit' => array( 'unicode' => '\f1a1', 'name' => 'Reddit' ),
482
- 'fa fa-reddit-alien' => array( 'unicode' => '\f281', 'name' => 'Reddit alien' ),
483
- 'fa fa-reddit-square' => array( 'unicode' => '\f1a2', 'name' => 'Reddit square' ),
484
- 'fa fa-refresh' => array( 'unicode' => '\f021', 'name' => 'Refresh' ),
485
- 'fa fa-registered' => array( 'unicode' => '\f25d', 'name' => 'Registered' ),
486
- 'fa fa-renren' => array( 'unicode' => '\f18b', 'name' => 'Renren' ),
487
- 'fa fa-repeat' => array( 'unicode' => '\f01e', 'name' => 'Repeat' ),
488
- 'fa fa-reply' => array( 'unicode' => '\f112', 'name' => 'Reply' ),
489
- 'fa fa-reply-all' => array( 'unicode' => '\f122', 'name' => 'Reply all' ),
490
- 'fa fa-retweet' => array( 'unicode' => '\f079', 'name' => 'Retweet' ),
491
- 'fa fa-road' => array( 'unicode' => '\f018', 'name' => 'Road' ),
492
- 'fa fa-rocket' => array( 'unicode' => '\f135', 'name' => 'Rocket' ),
493
- 'fa fa-rss' => array( 'unicode' => '\f09e', 'name' => 'Rss' ),
494
- 'fa fa-rss-square' => array( 'unicode' => '\f143', 'name' => 'Rss square' ),
495
- 'fa fa-rub' => array( 'unicode' => '\f158', 'name' => 'Rub' ),
496
- 'fa fa-safari' => array( 'unicode' => '\f267', 'name' => 'Safari' ),
497
- 'fa fa-scissors' => array( 'unicode' => '\f0c4', 'name' => 'Scissors' ),
498
- 'fa fa-scribd' => array( 'unicode' => '\f28a', 'name' => 'Scribd' ),
499
- 'fa fa-search' => array( 'unicode' => '\f002', 'name' => 'Search' ),
500
- 'fa fa-search-minus' => array( 'unicode' => '\f010', 'name' => 'Search minus' ),
501
- 'fa fa-search-plus' => array( 'unicode' => '\f00e', 'name' => 'Search plus' ),
502
- 'fa fa-sellsy' => array( 'unicode' => '\f213', 'name' => 'Sellsy' ),
503
- 'fa fa-server' => array( 'unicode' => '\f233', 'name' => 'Server' ),
504
- 'fa fa-share' => array( 'unicode' => '\f064', 'name' => 'Share' ),
505
- 'fa fa-share-alt' => array( 'unicode' => '\f1e0', 'name' => 'Share alt' ),
506
- 'fa fa-share-alt-square' => array( 'unicode' => '\f1e1', 'name' => 'Share alt square' ),
507
- 'fa fa-share-square' => array( 'unicode' => '\f14d', 'name' => 'Share square' ),
508
- 'fa fa-share-square-o' => array( 'unicode' => '\f045', 'name' => 'Share square o' ),
509
- 'fa fa-shield' => array( 'unicode' => '\f132', 'name' => 'Shield' ),
510
- 'fa fa-ship' => array( 'unicode' => '\f21a', 'name' => 'Ship' ),
511
- 'fa fa-shirtsinbulk' => array( 'unicode' => '\f214', 'name' => 'Shirtsinbulk' ),
512
- 'fa fa-shopping-bag' => array( 'unicode' => '\f290', 'name' => 'Shopping bag' ),
513
- 'fa fa-shopping-basket' => array( 'unicode' => '\f291', 'name' => 'Shopping basket' ),
514
- 'fa fa-shopping-cart' => array( 'unicode' => '\f07a', 'name' => 'Shopping cart' ),
515
- 'fa fa-shower' => array( 'unicode' => '\f2cc', 'name' => 'Shower' ),
516
- 'fa fa-sign-in' => array( 'unicode' => '\f090', 'name' => 'Sign in' ),
517
- 'fa fa-sign-language' => array( 'unicode' => '\f2a7', 'name' => 'Sign language' ),
518
- 'fa fa-sign-out' => array( 'unicode' => '\f08b', 'name' => 'Sign out' ),
519
- 'fa fa-signal' => array( 'unicode' => '\f012', 'name' => 'Signal' ),
520
- 'fa fa-simplybuilt' => array( 'unicode' => '\f215', 'name' => 'Simplybuilt' ),
521
- 'fa fa-sitemap' => array( 'unicode' => '\f0e8', 'name' => 'Sitemap' ),
522
- 'fa fa-skyatlas' => array( 'unicode' => '\f216', 'name' => 'Skyatlas' ),
523
- 'fa fa-skype' => array( 'unicode' => '\f17e', 'name' => 'Skype' ),
524
- 'fa fa-slack' => array( 'unicode' => '\f198', 'name' => 'Slack' ),
525
- 'fa fa-sliders' => array( 'unicode' => '\f1de', 'name' => 'Sliders' ),
526
- 'fa fa-slideshare' => array( 'unicode' => '\f1e7', 'name' => 'Slideshare' ),
527
- 'fa fa-smile-o' => array( 'unicode' => '\f118', 'name' => 'Smile o' ),
528
- 'fa fa-snapchat' => array( 'unicode' => '\f2ab', 'name' => 'Snapchat' ),
529
- 'fa fa-snapchat-ghost' => array( 'unicode' => '\f2ac', 'name' => 'Snapchat ghost' ),
530
- 'fa fa-snapchat-square' => array( 'unicode' => '\f2ad', 'name' => 'Snapchat square' ),
531
- 'fa fa-snowflake-o' => array( 'unicode' => '\f2dc', 'name' => 'Snowflake o' ),
532
- 'fa fa-sort' => array( 'unicode' => '\f0dc', 'name' => 'Sort' ),
533
- 'fa fa-sort-alpha-asc' => array( 'unicode' => '\f15d', 'name' => 'Sort alpha asc' ),
534
- 'fa fa-sort-alpha-desc' => array( 'unicode' => '\f15e', 'name' => 'Sort alpha desc' ),
535
- 'fa fa-sort-amount-asc' => array( 'unicode' => '\f160', 'name' => 'Sort amount asc' ),
536
- 'fa fa-sort-amount-desc' => array( 'unicode' => '\f161', 'name' => 'Sort amount desc' ),
537
- 'fa fa-sort-asc' => array( 'unicode' => '\f0de', 'name' => 'Sort asc' ),
538
- 'fa fa-sort-desc' => array( 'unicode' => '\f0dd', 'name' => 'Sort desc' ),
539
- 'fa fa-sort-numeric-asc' => array( 'unicode' => '\f162', 'name' => 'Sort numeric asc' ),
540
- 'fa fa-sort-numeric-desc' => array( 'unicode' => '\f163', 'name' => 'Sort numeric desc' ),
541
- 'fa fa-soundcloud' => array( 'unicode' => '\f1be', 'name' => 'Soundcloud' ),
542
- 'fa fa-space-shuttle' => array( 'unicode' => '\f197', 'name' => 'Space shuttle' ),
543
- 'fa fa-spinner' => array( 'unicode' => '\f110', 'name' => 'Spinner' ),
544
- 'fa fa-spoon' => array( 'unicode' => '\f1b1', 'name' => 'Spoon' ),
545
- 'fa fa-spotify' => array( 'unicode' => '\f1bc', 'name' => 'Spotify' ),
546
- 'fa fa-square' => array( 'unicode' => '\f0c8', 'name' => 'Square' ),
547
- 'fa fa-square-o' => array( 'unicode' => '\f096', 'name' => 'Square o' ),
548
- 'fa fa-stack-exchange' => array( 'unicode' => '\f18d', 'name' => 'Stack exchange' ),
549
- 'fa fa-stack-overflow' => array( 'unicode' => '\f16c', 'name' => 'Stack overflow' ),
550
- 'fa fa-star-half' => array( 'unicode' => '\f089', 'name' => 'Star half' ),
551
- 'fa fa-star-half-o' => array( 'unicode' => '\f123', 'name' => 'Star half o' ),
552
- 'fa fa-star-o' => array( 'unicode' => '\f006', 'name' => 'Star o' ),
553
- 'fa fa-steam' => array( 'unicode' => '\f1b6', 'name' => 'Steam' ),
554
- 'fa fa-steam-square' => array( 'unicode' => '\f1b7', 'name' => 'Steam square' ),
555
- 'fa fa-step-backward' => array( 'unicode' => '\f048', 'name' => 'Step backward' ),
556
- 'fa fa-step-forward' => array( 'unicode' => '\f051', 'name' => 'Step forward' ),
557
- 'fa fa-stethoscope' => array( 'unicode' => '\f0f1', 'name' => 'Stethoscope' ),
558
- 'fa fa-sticky-note' => array( 'unicode' => '\f249', 'name' => 'Sticky note' ),
559
- 'fa fa-sticky-note-o' => array( 'unicode' => '\f24a', 'name' => 'Sticky note o' ),
560
- 'fa fa-stop' => array( 'unicode' => '\f04d', 'name' => 'Stop' ),
561
- 'fa fa-stop-circle' => array( 'unicode' => '\f28d', 'name' => 'Stop circle' ),
562
- 'fa fa-stop-circle-o' => array( 'unicode' => '\f28e', 'name' => 'Stop circle o' ),
563
- 'fa fa-street-view' => array( 'unicode' => '\f21d', 'name' => 'Street view' ),
564
- 'fa fa-strikethrough' => array( 'unicode' => '\f0cc', 'name' => 'Strikethrough' ),
565
- 'fa fa-stumbleupon' => array( 'unicode' => '\f1a4', 'name' => 'Stumbleupon' ),
566
- 'fa fa-stumbleupon-circle' => array( 'unicode' => '\f1a3', 'name' => 'Stumbleupon circle' ),
567
- 'fa fa-subscript' => array( 'unicode' => '\f12c', 'name' => 'Subscript' ),
568
- 'fa fa-subway' => array( 'unicode' => '\f239', 'name' => 'Subway' ),
569
- 'fa fa-suitcase' => array( 'unicode' => '\f0f2', 'name' => 'Suitcase' ),
570
- 'fa fa-sun-o' => array( 'unicode' => '\f185', 'name' => 'Sun o' ),
571
- 'fa fa-superpowers' => array( 'unicode' => '\f2dd', 'name' => 'Superpowers' ),
572
- 'fa fa-superscript' => array( 'unicode' => '\f12b', 'name' => 'Superscript' ),
573
- 'fa fa-table' => array( 'unicode' => '\f0ce', 'name' => 'Table' ),
574
- 'fa fa-tablet' => array( 'unicode' => '\f10a', 'name' => 'Tablet' ),
575
- 'fa fa-tachometer' => array( 'unicode' => '\f0e4', 'name' => 'Tachometer' ),
576
- 'fa fa-tag' => array( 'unicode' => '\f02b', 'name' => 'Tag' ),
577
- 'fa fa-tags' => array( 'unicode' => '\f02c', 'name' => 'Tags' ),
578
- 'fa fa-tasks' => array( 'unicode' => '\f0ae', 'name' => 'Tasks' ),
579
- 'fa fa-taxi' => array( 'unicode' => '\f1ba', 'name' => 'Taxi' ),
580
- 'fa fa-telegram' => array( 'unicode' => '\f2c6', 'name' => 'Telegram' ),
581
- 'fa fa-television' => array( 'unicode' => '\f26c', 'name' => 'Television' ),
582
- 'fa fa-tencent-weibo' => array( 'unicode' => '\f1d5', 'name' => 'Tencent weibo' ),
583
- 'fa fa-terminal' => array( 'unicode' => '\f120', 'name' => 'Terminal' ),
584
- 'fa fa-text-height' => array( 'unicode' => '\f034', 'name' => 'Text height' ),
585
- 'fa fa-text-width' => array( 'unicode' => '\f035', 'name' => 'Text width' ),
586
- 'fa fa-th' => array( 'unicode' => '\f00a', 'name' => 'Th' ),
587
- 'fa fa-th-large' => array( 'unicode' => '\f009', 'name' => 'Th large' ),
588
- 'fa fa-th-list' => array( 'unicode' => '\f00b', 'name' => 'Th list' ),
589
- 'fa fa-themeisle' => array( 'unicode' => '\f2b2', 'name' => 'Themeisle' ),
590
- 'fa fa-thermometer-empty' => array( 'unicode' => '\f2cb', 'name' => 'Thermometer empty' ),
591
- 'fa fa-thermometer-full' => array( 'unicode' => '\f2c7', 'name' => 'Thermometer full' ),
592
- 'fa fa-thermometer-half' => array( 'unicode' => '\f2c9', 'name' => 'Thermometer half' ),
593
- 'fa fa-thermometer-quarter' => array( 'unicode' => '\f2ca', 'name' => 'Thermometer quarter' ),
594
- 'fa fa-thermometer-three-quarters' => array( 'unicode' => '\f2c8', 'name' => 'Thermometer three quarters' ),
595
- 'fa fa-thumb-tack' => array( 'unicode' => '\f08d', 'name' => 'Thumb tack' ),
596
- 'fa fa-thumbs-down' => array( 'unicode' => '\f165', 'name' => 'Thumbs down' ),
597
- 'fa fa-thumbs-o-down' => array( 'unicode' => '\f088', 'name' => 'Thumbs o down' ),
598
- 'fa fa-thumbs-o-up' => array( 'unicode' => '\f087', 'name' => 'Thumbs o up' ),
599
- 'fa fa-thumbs-up' => array( 'unicode' => '\f164', 'name' => 'Thumbs up' ),
600
- 'fa fa-ticket' => array( 'unicode' => '\f145', 'name' => 'Ticket' ),
601
- 'fa fa-times' => array( 'unicode' => '\f00d', 'name' => 'Times' ),
602
- 'fa fa-times-circle' => array( 'unicode' => '\f057', 'name' => 'Times circle' ),
603
- 'fa fa-times-circle-o' => array( 'unicode' => '\f05c', 'name' => 'Times circle o' ),
604
- 'fa fa-tint' => array( 'unicode' => '\f043', 'name' => 'Tint' ),
605
- 'fa fa-toggle-off' => array( 'unicode' => '\f204', 'name' => 'Toggle off' ),
606
- 'fa fa-toggle-on' => array( 'unicode' => '\f205', 'name' => 'Toggle on' ),
607
- 'fa fa-trademark' => array( 'unicode' => '\f25c', 'name' => 'Trademark' ),
608
- 'fa fa-train' => array( 'unicode' => '\f238', 'name' => 'Train' ),
609
- 'fa fa-transgender' => array( 'unicode' => '\f224', 'name' => 'Transgender' ),
610
- 'fa fa-transgender-alt' => array( 'unicode' => '\f225', 'name' => 'Transgender alt' ),
611
- 'fa fa-trash' => array( 'unicode' => '\f1f8', 'name' => 'Trash' ),
612
- 'fa fa-trash-o' => array( 'unicode' => '\f014', 'name' => 'Trash o' ),
613
- 'fa fa-tree' => array( 'unicode' => '\f1bb', 'name' => 'Tree' ),
614
- 'fa fa-trello' => array( 'unicode' => '\f181', 'name' => 'Trello' ),
615
- 'fa fa-tripadvisor' => array( 'unicode' => '\f262', 'name' => 'Tripadvisor' ),
616
- 'fa fa-trophy' => array( 'unicode' => '\f091', 'name' => 'Trophy' ),
617
- 'fa fa-truck' => array( 'unicode' => '\f0d1', 'name' => 'Truck' ),
618
- 'fa fa-try' => array( 'unicode' => '\f195', 'name' => 'Try' ),
619
- 'fa fa-tty' => array( 'unicode' => '\f1e4', 'name' => 'Tty' ),
620
- 'fa fa-tumblr' => array( 'unicode' => '\f173', 'name' => 'Tumblr' ),
621
- 'fa fa-tumblr-square' => array( 'unicode' => '\f174', 'name' => 'Tumblr square' ),
622
- 'fa fa-twitch' => array( 'unicode' => '\f1e8', 'name' => 'Twitch' ),
623
- 'fa fa-twitter' => array( 'unicode' => '\f099', 'name' => 'Twitter' ),
624
- 'fa fa-twitter-square' => array( 'unicode' => '\f081', 'name' => 'Twitter square' ),
625
- 'fa fa-umbrella' => array( 'unicode' => '\f0e9', 'name' => 'Umbrella' ),
626
- 'fa fa-underline' => array( 'unicode' => '\f0cd', 'name' => 'Underline' ),
627
- 'fa fa-undo' => array( 'unicode' => '\f0e2', 'name' => 'Undo' ),
628
- 'fa fa-universal-access' => array( 'unicode' => '\f29a', 'name' => 'Universal access' ),
629
- 'fa fa-university' => array( 'unicode' => '\f19c', 'name' => 'University' ),
630
- 'fa fa-unlock' => array( 'unicode' => '\f09c', 'name' => 'Unlock' ),
631
- 'fa fa-unlock-alt' => array( 'unicode' => '\f13e', 'name' => 'Unlock alt' ),
632
- 'fa fa-upload' => array( 'unicode' => '\f093', 'name' => 'Upload' ),
633
- 'fa fa-usb' => array( 'unicode' => '\f287', 'name' => 'Usb' ),
634
- 'fa fa-usd' => array( 'unicode' => '\f155', 'name' => 'Usd' ),
635
- 'fa fa-user' => array( 'unicode' => '\f007', 'name' => 'User' ),
636
- 'fa fa-user-circle' => array( 'unicode' => '\f2bd', 'name' => 'User circle' ),
637
- 'fa fa-user-circle-o' => array( 'unicode' => '\f2be', 'name' => 'User circle o' ),
638
- 'fa fa-user-md' => array( 'unicode' => '\f0f0', 'name' => 'User md' ),
639
- 'fa fa-user-o' => array( 'unicode' => '\f2c0', 'name' => 'User o' ),
640
- 'fa fa-user-plus' => array( 'unicode' => '\f234', 'name' => 'User plus' ),
641
- 'fa fa-user-secret' => array( 'unicode' => '\f21b', 'name' => 'User secret' ),
642
- 'fa fa-user-times' => array( 'unicode' => '\f235', 'name' => 'User times' ),
643
- 'fa fa-users' => array( 'unicode' => '\f0c0', 'name' => 'Users' ),
644
- 'fa fa-venus' => array( 'unicode' => '\f221', 'name' => 'Venus' ),
645
- 'fa fa-venus-double' => array( 'unicode' => '\f226', 'name' => 'Venus double' ),
646
- 'fa fa-venus-mars' => array( 'unicode' => '\f228', 'name' => 'Venus mars' ),
647
- 'fa fa-viacoin' => array( 'unicode' => '\f237', 'name' => 'Viacoin' ),
648
- 'fa fa-viadeo' => array( 'unicode' => '\f2a9', 'name' => 'Viadeo' ),
649
- 'fa fa-viadeo-square' => array( 'unicode' => '\f2aa', 'name' => 'Viadeo square' ),
650
- 'fa fa-video-camera' => array( 'unicode' => '\f03d', 'name' => 'Video camera' ),
651
- 'fa fa-vimeo' => array( 'unicode' => '\f27d', 'name' => 'Vimeo' ),
652
- 'fa fa-vimeo-square' => array( 'unicode' => '\f194', 'name' => 'Vimeo square' ),
653
- 'fa fa-vine' => array( 'unicode' => '\f1ca', 'name' => 'Vine' ),
654
- 'fa fa-vk' => array( 'unicode' => '\f189', 'name' => 'Vk' ),
655
- 'fa fa-volume-control-phone' => array( 'unicode' => '\f2a0', 'name' => 'Volume control phone' ),
656
- 'fa fa-volume-down' => array( 'unicode' => '\f027', 'name' => 'Volume down' ),
657
- 'fa fa-volume-off' => array( 'unicode' => '\f026', 'name' => 'Volume off' ),
658
- 'fa fa-volume-up' => array( 'unicode' => '\f028', 'name' => 'Volume up' ),
659
- 'fa fa-weibo' => array( 'unicode' => '\f18a', 'name' => 'Weibo' ),
660
- 'fa fa-weixin' => array( 'unicode' => '\f1d7', 'name' => 'Weixin' ),
661
- 'fa fa-whatsapp' => array( 'unicode' => '\f232', 'name' => 'Whatsapp' ),
662
- 'fa fa-wheelchair' => array( 'unicode' => '\f193', 'name' => 'Wheelchair' ),
663
- 'fa fa-wheelchair-alt' => array( 'unicode' => '\f29b', 'name' => 'Wheelchair alt' ),
664
- 'fa fa-wifi' => array( 'unicode' => '\f1eb', 'name' => 'Wifi' ),
665
- 'fa fa-wikipedia-w' => array( 'unicode' => '\f266', 'name' => 'Wikipedia w' ),
666
- 'fa fa-window-close' => array( 'unicode' => '\f2d3', 'name' => 'Window close' ),
667
- 'fa fa-window-close-o' => array( 'unicode' => '\f2d4', 'name' => 'Window close o' ),
668
- 'fa fa-window-maximize' => array( 'unicode' => '\f2d0', 'name' => 'Window maximize' ),
669
- 'fa fa-window-minimize' => array( 'unicode' => '\f2d1', 'name' => 'Window minimize' ),
670
- 'fa fa-window-restore' => array( 'unicode' => '\f2d2', 'name' => 'Window restore' ),
671
- 'fa fa-windows' => array( 'unicode' => '\f17a', 'name' => 'Windows' ),
672
- 'fa fa-wordpress' => array( 'unicode' => '\f19a', 'name' => 'Wordpress' ),
673
- 'fa fa-wpbeginner' => array( 'unicode' => '\f297', 'name' => 'Wpbeginner' ),
674
- 'fa fa-wpexplorer' => array( 'unicode' => '\f2de', 'name' => 'Wpexplorer' ),
675
- 'fa fa-wpforms' => array( 'unicode' => '\f298', 'name' => 'Wpforms' ),
676
- 'fa fa-wrench' => array( 'unicode' => '\f0ad', 'name' => 'Wrench' ),
677
- 'fa fa-xing' => array( 'unicode' => '\f168', 'name' => 'Xing' ),
678
- 'fa fa-xing-square' => array( 'unicode' => '\f169', 'name' => 'Xing square' ),
679
- 'fa fa-y-combinator' => array( 'unicode' => '\f23b', 'name' => 'Y combinator' ),
680
- 'fa fa-yahoo' => array( 'unicode' => '\f19e', 'name' => 'Yahoo' ),
681
- 'fa fa-yelp' => array( 'unicode' => '\f1e9', 'name' => 'Yelp' ),
682
- 'fa fa-yoast' => array( 'unicode' => '\f2b1', 'name' => 'Yoast' ),
683
- 'fa fa-youtube' => array( 'unicode' => '\f167', 'name' => 'Youtube' ),
684
- 'fa fa-youtube-play' => array( 'unicode' => '\f16a', 'name' => 'Youtube play' ),
685
- 'fa fa-youtube-square' => array( 'unicode' => '\f166', 'name' => 'Youtube square' ),
686
- );
687
- // phpcs:enable
1
+ <?php
2
+ /**
3
+ * List of font awesome icons
4
+ *
5
+ * @package WP_Review
6
+ * @since 3.0.0
7
+ */
8
+
9
+ // phpcs:disable
10
+ return array(
11
+ 'fa fa-star' => array( 'unicode' => '\f005', 'name' => 'Star' ),
12
+ 'fa fa-500px' => array( 'unicode' => '\f26e', 'name' => '500px' ),
13
+ 'fa fa-address-book' => array( 'unicode' => '\f2b9', 'name' => 'Address book' ),
14
+ 'fa fa-address-book-o' => array( 'unicode' => '\f2ba', 'name' => 'Address book o' ),
15
+ 'fa fa-address-card' => array( 'unicode' => '\f2bb', 'name' => 'Address card' ),
16
+ 'fa fa-address-card-o' => array( 'unicode' => '\f2bc', 'name' => 'Address card o' ),
17
+ 'fa fa-adjust' => array( 'unicode' => '\f042', 'name' => 'Adjust' ),
18
+ 'fa fa-adn' => array( 'unicode' => '\f170', 'name' => 'Adn' ),
19
+ 'fa fa-align-center' => array( 'unicode' => '\f037', 'name' => 'Align center' ),
20
+ 'fa fa-align-justify' => array( 'unicode' => '\f039', 'name' => 'Align justify' ),
21
+ 'fa fa-align-left' => array( 'unicode' => '\f036', 'name' => 'Align left' ),
22
+ 'fa fa-align-right' => array( 'unicode' => '\f038', 'name' => 'Align right' ),
23
+ 'fa fa-amazon' => array( 'unicode' => '\f270', 'name' => 'Amazon' ),
24
+ 'fa fa-ambulance' => array( 'unicode' => '\f0f9', 'name' => 'Ambulance' ),
25
+ 'fa fa-american-sign-language-interpreting' => array( 'unicode' => '\f2a3', 'name' => 'American sign language interpreting' ),
26
+ 'fa fa-anchor' => array( 'unicode' => '\f13d', 'name' => 'Anchor' ),
27
+ 'fa fa-android' => array( 'unicode' => '\f17b', 'name' => 'Android' ),
28
+ 'fa fa-angellist' => array( 'unicode' => '\f209', 'name' => 'Angellist' ),
29
+ 'fa fa-angle-double-down' => array( 'unicode' => '\f103', 'name' => 'Angle double down' ),
30
+ 'fa fa-angle-double-left' => array( 'unicode' => '\f100', 'name' => 'Angle double left' ),
31
+ 'fa fa-angle-double-right' => array( 'unicode' => '\f101', 'name' => 'Angle double right' ),
32
+ 'fa fa-angle-double-up' => array( 'unicode' => '\f102', 'name' => 'Angle double up' ),
33
+ 'fa fa-angle-down' => array( 'unicode' => '\f107', 'name' => 'Angle down' ),
34
+ 'fa fa-angle-left' => array( 'unicode' => '\f104', 'name' => 'Angle left' ),
35
+ 'fa fa-angle-right' => array( 'unicode' => '\f105', 'name' => 'Angle right' ),
36
+ 'fa fa-angle-up' => array( 'unicode' => '\f106', 'name' => 'Angle up' ),
37
+ 'fa fa-apple' => array( 'unicode' => '\f179', 'name' => 'Apple' ),
38
+ 'fa fa-archive' => array( 'unicode' => '\f187', 'name' => 'Archive' ),
39
+ 'fa fa-area-chart' => array( 'unicode' => '\f1fe', 'name' => 'Area chart' ),
40
+ 'fa fa-arrow-circle-down' => array( 'unicode' => '\f0ab', 'name' => 'Arrow circle down' ),
41
+ 'fa fa-arrow-circle-left' => array( 'unicode' => '\f0a8', 'name' => 'Arrow circle left' ),
42
+ 'fa fa-arrow-circle-o-down' => array( 'unicode' => '\f01a', 'name' => 'Arrow circle o down' ),
43
+ 'fa fa-arrow-circle-o-left' => array( 'unicode' => '\f190', 'name' => 'Arrow circle o left' ),
44
+ 'fa fa-arrow-circle-o-right' => array( 'unicode' => '\f18e', 'name' => 'Arrow circle o right' ),
45
+ 'fa fa-arrow-circle-o-up' => array( 'unicode' => '\f01b', 'name' => 'Arrow circle o up' ),
46
+ 'fa fa-arrow-circle-right' => array( 'unicode' => '\f0a9', 'name' => 'Arrow circle right' ),
47
+ 'fa fa-arrow-circle-up' => array( 'unicode' => '\f0aa', 'name' => 'Arrow circle up' ),
48
+ 'fa fa-arrow-down' => array( 'unicode' => '\f063', 'name' => 'Arrow down' ),
49
+ 'fa fa-arrow-left' => array( 'unicode' => '\f060', 'name' => 'Arrow left' ),
50
+ 'fa fa-arrow-right' => array( 'unicode' => '\f061', 'name' => 'Arrow right' ),
51
+ 'fa fa-arrow-up' => array( 'unicode' => '\f062', 'name' => 'Arrow up' ),
52
+ 'fa fa-arrows' => array( 'unicode' => '\f047', 'name' => 'Arrows' ),
53
+ 'fa fa-arrows-alt' => array( 'unicode' => '\f0b2', 'name' => 'Arrows alt' ),
54
+ 'fa fa-arrows-h' => array( 'unicode' => '\f07e', 'name' => 'Arrows h' ),
55
+ 'fa fa-arrows-v' => array( 'unicode' => '\f07d', 'name' => 'Arrows v' ),
56
+ 'fa fa-assistive-listening-systems' => array( 'unicode' => '\f2a2', 'name' => 'Assistive listening systems' ),
57
+ 'fa fa-asterisk' => array( 'unicode' => '\f069', 'name' => 'Asterisk' ),
58
+ 'fa fa-at' => array( 'unicode' => '\f1fa', 'name' => 'At' ),
59
+ 'fa fa-audio-description' => array( 'unicode' => '\f29e', 'name' => 'Audio description' ),
60
+ 'fa fa-backward' => array( 'unicode' => '\f04a', 'name' => 'Backward' ),
61
+ 'fa fa-balance-scale' => array( 'unicode' => '\f24e', 'name' => 'Balance scale' ),
62
+ 'fa fa-ban' => array( 'unicode' => '\f05e', 'name' => 'Ban' ),
63
+ 'fa fa-bandcamp' => array( 'unicode' => '\f2d5', 'name' => 'Bandcamp' ),
64
+ 'fa fa-bar-chart' => array( 'unicode' => '\f080', 'name' => 'Bar chart' ),
65
+ 'fa fa-barcode' => array( 'unicode' => '\f02a', 'name' => 'Barcode' ),
66
+ 'fa fa-bars' => array( 'unicode' => '\f0c9', 'name' => 'Bars' ),
67
+ 'fa fa-bath' => array( 'unicode' => '\f2cd', 'name' => 'Bath' ),
68
+ 'fa fa-battery-empty' => array( 'unicode' => '\f244', 'name' => 'Battery empty' ),
69
+ 'fa fa-battery-full' => array( 'unicode' => '\f240', 'name' => 'Battery full' ),
70
+ 'fa fa-battery-half' => array( 'unicode' => '\f242', 'name' => 'Battery half' ),
71
+ 'fa fa-battery-quarter' => array( 'unicode' => '\f243', 'name' => 'Battery quarter' ),
72
+ 'fa fa-battery-three-quarters' => array( 'unicode' => '\f241', 'name' => 'Battery three quarters' ),
73
+ 'fa fa-bed' => array( 'unicode' => '\f236', 'name' => 'Bed' ),
74
+ 'fa fa-beer' => array( 'unicode' => '\f0fc', 'name' => 'Beer' ),
75
+ 'fa fa-behance' => array( 'unicode' => '\f1b4', 'name' => 'Behance' ),
76
+ 'fa fa-behance-square' => array( 'unicode' => '\f1b5', 'name' => 'Behance square' ),
77
+ 'fa fa-bell' => array( 'unicode' => '\f0f3', 'name' => 'Bell' ),
78
+ 'fa fa-bell-o' => array( 'unicode' => '\f0a2', 'name' => 'Bell o' ),
79
+ 'fa fa-bell-slash' => array( 'unicode' => '\f1f6', 'name' => 'Bell slash' ),
80
+ 'fa fa-bell-slash-o' => array( 'unicode' => '\f1f7', 'name' => 'Bell slash o' ),
81
+ 'fa fa-bicycle' => array( 'unicode' => '\f206', 'name' => 'Bicycle' ),
82
+ 'fa fa-binoculars' => array( 'unicode' => '\f1e5', 'name' => 'Binoculars' ),
83
+ 'fa fa-birthday-cake' => array( 'unicode' => '\f1fd', 'name' => 'Birthday cake' ),
84
+ 'fa fa-bitbucket' => array( 'unicode' => '\f171', 'name' => 'Bitbucket' ),
85
+ 'fa fa-bitbucket-square' => array( 'unicode' => '\f172', 'name' => 'Bitbucket square' ),
86
+ 'fa fa-black-tie' => array( 'unicode' => '\f27e', 'name' => 'Black tie' ),
87
+ 'fa fa-blind' => array( 'unicode' => '\f29d', 'name' => 'Blind' ),
88
+ 'fa fa-bluetooth' => array( 'unicode' => '\f293', 'name' => 'Bluetooth' ),
89
+ 'fa fa-bluetooth-b' => array( 'unicode' => '\f294', 'name' => 'Bluetooth b' ),
90
+ 'fa fa-bold' => array( 'unicode' => '\f032', 'name' => 'Bold' ),
91
+ 'fa fa-bolt' => array( 'unicode' => '\f0e7', 'name' => 'Bolt' ),
92
+ 'fa fa-bomb' => array( 'unicode' => '\f1e2', 'name' => 'Bomb' ),
93
+ 'fa fa-book' => array( 'unicode' => '\f02d', 'name' => 'Book' ),
94
+ 'fa fa-bookmark' => array( 'unicode' => '\f02e', 'name' => 'Bookmark' ),
95
+ 'fa fa-bookmark-o' => array( 'unicode' => '\f097', 'name' => 'Bookmark o' ),
96
+ 'fa fa-braille' => array( 'unicode' => '\f2a1', 'name' => 'Braille' ),
97
+ 'fa fa-briefcase' => array( 'unicode' => '\f0b1', 'name' => 'Briefcase' ),
98
+ 'fa fa-btc' => array( 'unicode' => '\f15a', 'name' => 'Btc' ),
99
+ 'fa fa-bug' => array( 'unicode' => '\f188', 'name' => 'Bug' ),
100
+ 'fa fa-building' => array( 'unicode' => '\f1ad', 'name' => 'Building' ),
101
+ 'fa fa-building-o' => array( 'unicode' => '\f0f7', 'name' => 'Building o' ),
102
+ 'fa fa-bullhorn' => array( 'unicode' => '\f0a1', 'name' => 'Bullhorn' ),
103
+ 'fa fa-bullseye' => array( 'unicode' => '\f140', 'name' => 'Bullseye' ),
104
+ 'fa fa-bus' => array( 'unicode' => '\f207', 'name' => 'Bus' ),
105
+ 'fa fa-buysellads' => array( 'unicode' => '\f20d', 'name' => 'Buysellads' ),
106
+ 'fa fa-calculator' => array( 'unicode' => '\f1ec', 'name' => 'Calculator' ),
107
+ 'fa fa-calendar' => array( 'unicode' => '\f073', 'name' => 'Calendar' ),
108
+ 'fa fa-calendar-check-o' => array( 'unicode' => '\f274', 'name' => 'Calendar check o' ),
109
+ 'fa fa-calendar-minus-o' => array( 'unicode' => '\f272', 'name' => 'Calendar minus o' ),
110
+ 'fa fa-calendar-o' => array( 'unicode' => '\f133', 'name' => 'Calendar o' ),
111
+ 'fa fa-calendar-plus-o' => array( 'unicode' => '\f271', 'name' => 'Calendar plus o' ),
112
+ 'fa fa-calendar-times-o' => array( 'unicode' => '\f273', 'name' => 'Calendar times o' ),
113
+ 'fa fa-camera' => array( 'unicode' => '\f030', 'name' => 'Camera' ),
114
+ 'fa fa-camera-retro' => array( 'unicode' => '\f083', 'name' => 'Camera retro' ),
115
+ 'fa fa-car' => array( 'unicode' => '\f1b9', 'name' => 'Car' ),
116
+ 'fa fa-caret-down' => array( 'unicode' => '\f0d7', 'name' => 'Caret down' ),
117
+ 'fa fa-caret-left' => array( 'unicode' => '\f0d9', 'name' => 'Caret left' ),
118
+ 'fa fa-caret-right' => array( 'unicode' => '\f0da', 'name' => 'Caret right' ),
119
+ 'fa fa-caret-square-o-down' => array( 'unicode' => '\f150', 'name' => 'Caret square o down' ),
120
+ 'fa fa-caret-square-o-left' => array( 'unicode' => '\f191', 'name' => 'Caret square o left' ),
121
+ 'fa fa-caret-square-o-right' => array( 'unicode' => '\f152', 'name' => 'Caret square o right' ),
122
+ 'fa fa-caret-square-o-up' => array( 'unicode' => '\f151', 'name' => 'Caret square o up' ),
123
+ 'fa fa-caret-up' => array( 'unicode' => '\f0d8', 'name' => 'Caret up' ),
124
+ 'fa fa-cart-arrow-down' => array( 'unicode' => '\f218', 'name' => 'Cart arrow down' ),
125
+ 'fa fa-cart-plus' => array( 'unicode' => '\f217', 'name' => 'Cart plus' ),
126
+ 'fa fa-cc' => array( 'unicode' => '\f20a', 'name' => 'Cc' ),
127
+ 'fa fa-cc-amex' => array( 'unicode' => '\f1f3', 'name' => 'Cc amex' ),
128
+ 'fa fa-cc-diners-club' => array( 'unicode' => '\f24c', 'name' => 'Cc diners club' ),
129
+ 'fa fa-cc-discover' => array( 'unicode' => '\f1f2', 'name' => 'Cc discover' ),
130
+ 'fa fa-cc-jcb' => array( 'unicode' => '\f24b', 'name' => 'Cc jcb' ),
131
+ 'fa fa-cc-mastercard' => array( 'unicode' => '\f1f1', 'name' => 'Cc mastercard' ),
132
+ 'fa fa-cc-paypal' => array( 'unicode' => '\f1f4', 'name' => 'Cc paypal' ),
133
+ 'fa fa-cc-stripe' => array( 'unicode' => '\f1f5', 'name' => 'Cc stripe' ),
134
+ 'fa fa-cc-visa' => array( 'unicode' => '\f1f0', 'name' => 'Cc visa' ),
135
+ 'fa fa-certificate' => array( 'unicode' => '\f0a3', 'name' => 'Certificate' ),
136
+ 'fa fa-chain-broken' => array( 'unicode' => '\f127', 'name' => 'Chain broken' ),
137
+ 'fa fa-check' => array( 'unicode' => '\f00c', 'name' => 'Check' ),
138
+ 'fa fa-check-circle' => array( 'unicode' => '\f058', 'name' => 'Check circle' ),
139
+ 'fa fa-check-circle-o' => array( 'unicode' => '\f05d', 'name' => 'Check circle o' ),
140
+ 'fa fa-check-square' => array( 'unicode' => '\f14a', 'name' => 'Check square' ),
141
+ 'fa fa-check-square-o' => array( 'unicode' => '\f046', 'name' => 'Check square o' ),
142
+ 'fa fa-chevron-circle-down' => array( 'unicode' => '\f13a', 'name' => 'Chevron circle down' ),
143
+ 'fa fa-chevron-circle-left' => array( 'unicode' => '\f137', 'name' => 'Chevron circle left' ),
144
+ 'fa fa-chevron-circle-right' => array( 'unicode' => '\f138', 'name' => 'Chevron circle right' ),
145
+ 'fa fa-chevron-circle-up' => array( 'unicode' => '\f139', 'name' => 'Chevron circle up' ),
146
+ 'fa fa-chevron-down' => array( 'unicode' => '\f078', 'name' => 'Chevron down' ),
147
+ 'fa fa-chevron-left' => array( 'unicode' => '\f053', 'name' => 'Chevron left' ),
148
+ 'fa fa-chevron-right' => array( 'unicode' => '\f054', 'name' => 'Chevron right' ),
149
+ 'fa fa-chevron-up' => array( 'unicode' => '\f077', 'name' => 'Chevron up' ),
150
+ 'fa fa-child' => array( 'unicode' => '\f1ae', 'name' => 'Child' ),
151
+ 'fa fa-chrome' => array( 'unicode' => '\f268', 'name' => 'Chrome' ),
152
+ 'fa fa-circle' => array( 'unicode' => '\f111', 'name' => 'Circle' ),
153
+ 'fa fa-circle-o' => array( 'unicode' => '\f10c', 'name' => 'Circle o' ),
154
+ 'fa fa-circle-o-notch' => array( 'unicode' => '\f1ce', 'name' => 'Circle o notch' ),
155
+ 'fa fa-circle-thin' => array( 'unicode' => '\f1db', 'name' => 'Circle thin' ),
156
+ 'fa fa-clipboard' => array( 'unicode' => '\f0ea', 'name' => 'Clipboard' ),
157
+ 'fa fa-clock-o' => array( 'unicode' => '\f017', 'name' => 'Clock o' ),
158
+ 'fa fa-clone' => array( 'unicode' => '\f24d', 'name' => 'Clone' ),
159
+ 'fa fa-cloud' => array( 'unicode' => '\f0c2', 'name' => 'Cloud' ),
160
+ 'fa fa-cloud-download' => array( 'unicode' => '\f0ed', 'name' => 'Cloud download' ),
161
+ 'fa fa-cloud-upload' => array( 'unicode' => '\f0ee', 'name' => 'Cloud upload' ),
162
+ 'fa fa-code' => array( 'unicode' => '\f121', 'name' => 'Code' ),
163
+ 'fa fa-code-fork' => array( 'unicode' => '\f126', 'name' => 'Code fork' ),
164
+ 'fa fa-codepen' => array( 'unicode' => '\f1cb', 'name' => 'Codepen' ),
165
+ 'fa fa-codiepie' => array( 'unicode' => '\f284', 'name' => 'Codiepie' ),
166
+ 'fa fa-coffee' => array( 'unicode' => '\f0f4', 'name' => 'Coffee' ),
167
+ 'fa fa-cog' => array( 'unicode' => '\f013', 'name' => 'Cog' ),
168
+ 'fa fa-cogs' => array( 'unicode' => '\f085', 'name' => 'Cogs' ),
169
+ 'fa fa-columns' => array( 'unicode' => '\f0db', 'name' => 'Columns' ),
170
+ 'fa fa-comment' => array( 'unicode' => '\f075', 'name' => 'Comment' ),
171
+ 'fa fa-comment-o' => array( 'unicode' => '\f0e5', 'name' => 'Comment o' ),
172
+ 'fa fa-commenting' => array( 'unicode' => '\f27a', 'name' => 'Commenting' ),
173
+ 'fa fa-commenting-o' => array( 'unicode' => '\f27b', 'name' => 'Commenting o' ),
174
+ 'fa fa-comments' => array( 'unicode' => '\f086', 'name' => 'Comments' ),
175
+ 'fa fa-comments-o' => array( 'unicode' => '\f0e6', 'name' => 'Comments o' ),
176
+ 'fa fa-compass' => array( 'unicode' => '\f14e', 'name' => 'Compass' ),
177
+ 'fa fa-compress' => array( 'unicode' => '\f066', 'name' => 'Compress' ),
178
+ 'fa fa-connectdevelop' => array( 'unicode' => '\f20e', 'name' => 'Connectdevelop' ),
179
+ 'fa fa-contao' => array( 'unicode' => '\f26d', 'name' => 'Contao' ),
180
+ 'fa fa-copyright' => array( 'unicode' => '\f1f9', 'name' => 'Copyright' ),
181
+ 'fa fa-creative-commons' => array( 'unicode' => '\f25e', 'name' => 'Creative commons' ),
182
+ 'fa fa-credit-card' => array( 'unicode' => '\f09d', 'name' => 'Credit card' ),
183
+ 'fa fa-credit-card-alt' => array( 'unicode' => '\f283', 'name' => 'Credit card alt' ),
184
+ 'fa fa-crop' => array( 'unicode' => '\f125', 'name' => 'Crop' ),
185
+ 'fa fa-crosshairs' => array( 'unicode' => '\f05b', 'name' => 'Crosshairs' ),
186
+ 'fa fa-css3' => array( 'unicode' => '\f13c', 'name' => 'Css3' ),
187
+ 'fa fa-cube' => array( 'unicode' => '\f1b2', 'name' => 'Cube' ),
188
+ 'fa fa-cubes' => array( 'unicode' => '\f1b3', 'name' => 'Cubes' ),
189
+ 'fa fa-cutlery' => array( 'unicode' => '\f0f5', 'name' => 'Cutlery' ),
190
+ 'fa fa-dashcube' => array( 'unicode' => '\f210', 'name' => 'Dashcube' ),
191
+ 'fa fa-database' => array( 'unicode' => '\f1c0', 'name' => 'Database' ),
192
+ 'fa fa-deaf' => array( 'unicode' => '\f2a4', 'name' => 'Deaf' ),
193
+ 'fa fa-delicious' => array( 'unicode' => '\f1a5', 'name' => 'Delicious' ),
194
+ 'fa fa-desktop' => array( 'unicode' => '\f108', 'name' => 'Desktop' ),
195
+ 'fa fa-deviantart' => array( 'unicode' => '\f1bd', 'name' => 'Deviantart' ),
196
+ 'fa fa-diamond' => array( 'unicode' => '\f219', 'name' => 'Diamond' ),
197
+ 'fa fa-digg' => array( 'unicode' => '\f1a6', 'name' => 'Digg' ),
198
+ 'fa fa-dot-circle-o' => array( 'unicode' => '\f192', 'name' => 'Dot circle o' ),
199
+ 'fa fa-download' => array( 'unicode' => '\f019', 'name' => 'Download' ),
200
+ 'fa fa-dribbble' => array( 'unicode' => '\f17d', 'name' => 'Dribbble' ),
201
+ 'fa fa-dropbox' => array( 'unicode' => '\f16b', 'name' => 'Dropbox' ),
202
+ 'fa fa-drupal' => array( 'unicode' => '\f1a9', 'name' => 'Drupal' ),
203
+ 'fa fa-edge' => array( 'unicode' => '\f282', 'name' => 'Edge' ),
204
+ 'fa fa-eercast' => array( 'unicode' => '\f2da', 'name' => 'Eercast' ),
205
+ 'fa fa-eject' => array( 'unicode' => '\f052', 'name' => 'Eject' ),
206
+ 'fa fa-ellipsis-h' => array( 'unicode' => '\f141', 'name' => 'Ellipsis h' ),
207
+ 'fa fa-ellipsis-v' => array( 'unicode' => '\f142', 'name' => 'Ellipsis v' ),
208
+ 'fa fa-empire' => array( 'unicode' => '\f1d1', 'name' => 'Empire' ),
209
+ 'fa fa-envelope' => array( 'unicode' => '\f0e0', 'name' => 'Envelope' ),
210
+ 'fa fa-envelope-o' => array( 'unicode' => '\f003', 'name' => 'Envelope o' ),
211
+ 'fa fa-envelope-open' => array( 'unicode' => '\f2b6', 'name' => 'Envelope open' ),
212
+ 'fa fa-envelope-open-o' => array( 'unicode' => '\f2b7', 'name' => 'Envelope open o' ),
213
+ 'fa fa-envelope-square' => array( 'unicode' => '\f199', 'name' => 'Envelope square' ),
214
+ 'fa fa-envira' => array( 'unicode' => '\f299', 'name' => 'Envira' ),
215
+ 'fa fa-eraser' => array( 'unicode' => '\f12d', 'name' => 'Eraser' ),
216
+ 'fa fa-etsy' => array( 'unicode' => '\f2d7', 'name' => 'Etsy' ),
217
+ 'fa fa-eur' => array( 'unicode' => '\f153', 'name' => 'Eur' ),
218
+ 'fa fa-exchange' => array( 'unicode' => '\f0ec', 'name' => 'Exchange' ),
219
+ 'fa fa-exclamation' => array( 'unicode' => '\f12a', 'name' => 'Exclamation' ),
220
+ 'fa fa-exclamation-circle' => array( 'unicode' => '\f06a', 'name' => 'Exclamation circle' ),
221
+ 'fa fa-exclamation-triangle' => array( 'unicode' => '\f071', 'name' => 'Exclamation triangle' ),
222
+ 'fa fa-expand' => array( 'unicode' => '\f065', 'name' => 'Expand' ),
223
+ 'fa fa-expeditedssl' => array( 'unicode' => '\f23e', 'name' => 'Expeditedssl' ),
224
+ 'fa fa-external-link' => array( 'unicode' => '\f08e', 'name' => 'External link' ),
225
+ 'fa fa-external-link-square' => array( 'unicode' => '\f14c', 'name' => 'External link square' ),
226
+ 'fa fa-eye' => array( 'unicode' => '\f06e', 'name' => 'Eye' ),
227
+ 'fa fa-eye-slash' => array( 'unicode' => '\f070', 'name' => 'Eye slash' ),
228
+ 'fa fa-eyedropper' => array( 'unicode' => '\f1fb', 'name' => 'Eyedropper' ),
229
+ 'fa fa-facebook' => array( 'unicode' => '\f09a', 'name' => 'Facebook' ),
230
+ 'fa fa-facebook-official' => array( 'unicode' => '\f230', 'name' => 'Facebook official' ),
231
+ 'fa fa-facebook-square' => array( 'unicode' => '\f082', 'name' => 'Facebook square' ),
232
+ 'fa fa-fast-backward' => array( 'unicode' => '\f049', 'name' => 'Fast backward' ),
233
+ 'fa fa-fast-forward' => array( 'unicode' => '\f050', 'name' => 'Fast forward' ),
234
+ 'fa fa-fax' => array( 'unicode' => '\f1ac', 'name' => 'Fax' ),
235
+ 'fa fa-female' => array( 'unicode' => '\f182', 'name' => 'Female' ),
236
+ 'fa fa-fighter-jet' => array( 'unicode' => '\f0fb', 'name' => 'Fighter jet' ),
237
+ 'fa fa-file' => array( 'unicode' => '\f15b', 'name' => 'File' ),
238
+ 'fa fa-file-archive-o' => array( 'unicode' => '\f1c6', 'name' => 'File archive o' ),
239
+ 'fa fa-file-audio-o' => array( 'unicode' => '\f1c7', 'name' => 'File audio o' ),
240
+ 'fa fa-file-code-o' => array( 'unicode' => '\f1c9', 'name' => 'File code o' ),
241
+ 'fa fa-file-excel-o' => array( 'unicode' => '\f1c3', 'name' => 'File excel o' ),
242
+ 'fa fa-file-image-o' => array( 'unicode' => '\f1c5', 'name' => 'File image o' ),
243
+ 'fa fa-file-o' => array( 'unicode' => '\f016', 'name' => 'File o' ),
244
+ 'fa fa-file-pdf-o' => array( 'unicode' => '\f1c1', 'name' => 'File pdf o' ),
245
+ 'fa fa-file-powerpoint-o' => array( 'unicode' => '\f1c4', 'name' => 'File powerpoint o' ),
246
+ 'fa fa-file-text' => array( 'unicode' => '\f15c', 'name' => 'File text' ),
247
+ 'fa fa-file-text-o' => array( 'unicode' => '\f0f6', 'name' => 'File text o' ),
248
+ 'fa fa-file-video-o' => array( 'unicode' => '\f1c8', 'name' => 'File video o' ),
249
+ 'fa fa-file-word-o' => array( 'unicode' => '\f1c2', 'name' => 'File word o' ),
250
+ 'fa fa-files-o' => array( 'unicode' => '\f0c5', 'name' => 'Files o' ),
251
+ 'fa fa-film' => array( 'unicode' => '\f008', 'name' => 'Film' ),
252
+ 'fa fa-filter' => array( 'unicode' => '\f0b0', 'name' => 'Filter' ),
253
+ 'fa fa-fire' => array( 'unicode' => '\f06d', 'name' => 'Fire' ),
254
+ 'fa fa-fire-extinguisher' => array( 'unicode' => '\f134', 'name' => 'Fire extinguisher' ),
255
+ 'fa fa-firefox' => array( 'unicode' => '\f269', 'name' => 'Firefox' ),
256
+ 'fa fa-first-order' => array( 'unicode' => '\f2b0', 'name' => 'First order' ),
257
+ 'fa fa-flag' => array( 'unicode' => '\f024', 'name' => 'Flag' ),
258
+ 'fa fa-flag-checkered' => array( 'unicode' => '\f11e', 'name' => 'Flag checkered' ),
259
+ 'fa fa-flag-o' => array( 'unicode' => '\f11d', 'name' => 'Flag o' ),
260
+ 'fa fa-flask' => array( 'unicode' => '\f0c3', 'name' => 'Flask' ),
261
+ 'fa fa-flickr' => array( 'unicode' => '\f16e', 'name' => 'Flickr' ),
262
+ 'fa fa-floppy-o' => array( 'unicode' => '\f0c7', 'name' => 'Floppy o' ),
263
+ 'fa fa-folder' => array( 'unicode' => '\f07b', 'name' => 'Folder' ),
264
+ 'fa fa-folder-o' => array( 'unicode' => '\f114', 'name' => 'Folder o' ),
265
+ 'fa fa-folder-open' => array( 'unicode' => '\f07c', 'name' => 'Folder open' ),
266
+ 'fa fa-folder-open-o' => array( 'unicode' => '\f115', 'name' => 'Folder open o' ),
267
+ 'fa fa-font' => array( 'unicode' => '\f031', 'name' => 'Font' ),
268
+ 'fa fa-font-awesome' => array( 'unicode' => '\f2b4', 'name' => 'Font awesome' ),
269
+ 'fa fa-fonticons' => array( 'unicode' => '\f280', 'name' => 'Fonticons' ),
270
+ 'fa fa-fort-awesome' => array( 'unicode' => '\f286', 'name' => 'Fort awesome' ),
271
+ 'fa fa-forumbee' => array( 'unicode' => '\f211', 'name' => 'Forumbee' ),
272
+ 'fa fa-forward' => array( 'unicode' => '\f04e', 'name' => 'Forward' ),
273
+ 'fa fa-foursquare' => array( 'unicode' => '\f180', 'name' => 'Foursquare' ),
274
+ 'fa fa-free-code-camp' => array( 'unicode' => '\f2c5', 'name' => 'Free code camp' ),
275
+ 'fa fa-frown-o' => array( 'unicode' => '\f119', 'name' => 'Frown o' ),
276
+ 'fa fa-futbol-o' => array( 'unicode' => '\f1e3', 'name' => 'Futbol o' ),
277
+ 'fa fa-gamepad' => array( 'unicode' => '\f11b', 'name' => 'Gamepad' ),
278
+ 'fa fa-gavel' => array( 'unicode' => '\f0e3', 'name' => 'Gavel' ),
279
+ 'fa fa-gbp' => array( 'unicode' => '\f154', 'name' => 'Gbp' ),
280
+ 'fa fa-genderless' => array( 'unicode' => '\f22d', 'name' => 'Genderless' ),
281
+ 'fa fa-get-pocket' => array( 'unicode' => '\f265', 'name' => 'Get pocket' ),
282
+ 'fa fa-gg' => array( 'unicode' => '\f260', 'name' => 'Gg' ),
283
+ 'fa fa-gg-circle' => array( 'unicode' => '\f261', 'name' => 'Gg circle' ),
284
+ 'fa fa-gift' => array( 'unicode' => '\f06b', 'name' => 'Gift' ),
285
+ 'fa fa-git' => array( 'unicode' => '\f1d3', 'name' => 'Git' ),
286
+ 'fa fa-git-square' => array( 'unicode' => '\f1d2', 'name' => 'Git square' ),
287
+ 'fa fa-github' => array( 'unicode' => '\f09b', 'name' => 'Github' ),
288
+ 'fa fa-github-alt' => array( 'unicode' => '\f113', 'name' => 'Github alt' ),
289
+ 'fa fa-github-square' => array( 'unicode' => '\f092', 'name' => 'Github square' ),
290
+ 'fa fa-gitlab' => array( 'unicode' => '\f296', 'name' => 'Gitlab' ),
291
+ 'fa fa-glass' => array( 'unicode' => '\f000', 'name' => 'Glass' ),
292
+ 'fa fa-glide' => array( 'unicode' => '\f2a5', 'name' => 'Glide' ),
293
+ 'fa fa-glide-g' => array( 'unicode' => '\f2a6', 'name' => 'Glide g' ),
294
+ 'fa fa-globe' => array( 'unicode' => '\f0ac', 'name' => 'Globe' ),
295
+ 'fa fa-google' => array( 'unicode' => '\f1a0', 'name' => 'Google' ),
296
+ 'fa fa-google-plus' => array( 'unicode' => '\f0d5', 'name' => 'Google plus' ),
297
+ 'fa fa-google-plus-official' => array( 'unicode' => '\f2b3', 'name' => 'Google plus official' ),
298
+ 'fa fa-google-plus-square' => array( 'unicode' => '\f0d4', 'name' => 'Google plus square' ),
299
+ 'fa fa-google-wallet' => array( 'unicode' => '\f1ee', 'name' => 'Google wallet' ),
300
+ 'fa fa-graduation-cap' => array( 'unicode' => '\f19d', 'name' => 'Graduation cap' ),
301
+ 'fa fa-gratipay' => array( 'unicode' => '\f184', 'name' => 'Gratipay' ),
302
+ 'fa fa-grav' => array( 'unicode' => '\f2d6', 'name' => 'Grav' ),
303
+ 'fa fa-h-square' => array( 'unicode' => '\f0fd', 'name' => 'H square' ),
304
+ 'fa fa-hacker-news' => array( 'unicode' => '\f1d4', 'name' => 'Hacker news' ),
305
+ 'fa fa-hand-lizard-o' => array( 'unicode' => '\f258', 'name' => 'Hand lizard o' ),
306
+ 'fa fa-hand-o-down' => array( 'unicode' => '\f0a7', 'name' => 'Hand o down' ),
307
+ 'fa fa-hand-o-left' => array( 'unicode' => '\f0a5', 'name' => 'Hand o left' ),
308
+ 'fa fa-hand-o-right' => array( 'unicode' => '\f0a4', 'name' => 'Hand o right' ),
309
+ 'fa fa-hand-o-up' => array( 'unicode' => '\f0a6', 'name' => 'Hand o up' ),
310
+ 'fa fa-hand-paper-o' => array( 'unicode' => '\f256', 'name' => 'Hand paper o' ),
311
+ 'fa fa-hand-peace-o' => array( 'unicode' => '\f25b', 'name' => 'Hand peace o' ),
312
+ 'fa fa-hand-pointer-o' => array( 'unicode' => '\f25a', 'name' => 'Hand pointer o' ),
313
+ 'fa fa-hand-rock-o' => array( 'unicode' => '\f255', 'name' => 'Hand rock o' ),
314
+ 'fa fa-hand-scissors-o' => array( 'unicode' => '\f257', 'name' => 'Hand scissors o' ),
315
+ 'fa fa-hand-spock-o' => array( 'unicode' => '\f259', 'name' => 'Hand spock o' ),
316
+ 'fa fa-handshake-o' => array( 'unicode' => '\f2b5', 'name' => 'Handshake o' ),
317
+ 'fa fa-hashtag' => array( 'unicode' => '\f292', 'name' => 'Hashtag' ),
318
+ 'fa fa-hdd-o' => array( 'unicode' => '\f0a0', 'name' => 'Hdd o' ),
319
+ 'fa fa-header' => array( 'unicode' => '\f1dc', 'name' => 'Header' ),
320
+ 'fa fa-headphones' => array( 'unicode' => '\f025', 'name' => 'Headphones' ),
321
+ 'fa fa-heart' => array( 'unicode' => '\f004', 'name' => 'Heart' ),
322
+ 'fa fa-heart-o' => array( 'unicode' => '\f08a', 'name' => 'Heart o' ),
323
+ 'fa fa-heartbeat' => array( 'unicode' => '\f21e', 'name' => 'Heartbeat' ),
324
+ 'fa fa-history' => array( 'unicode' => '\f1da', 'name' => 'History' ),
325
+ 'fa fa-home' => array( 'unicode' => '\f015', 'name' => 'Home' ),
326
+ 'fa fa-hospital-o' => array( 'unicode' => '\f0f8', 'name' => 'Hospital o' ),
327
+ 'fa fa-hourglass' => array( 'unicode' => '\f254', 'name' => 'Hourglass' ),
328
+ 'fa fa-hourglass-end' => array( 'unicode' => '\f253', 'name' => 'Hourglass end' ),
329
+ 'fa fa-hourglass-half' => array( 'unicode' => '\f252', 'name' => 'Hourglass half' ),
330
+ 'fa fa-hourglass-o' => array( 'unicode' => '\f250', 'name' => 'Hourglass o' ),
331
+ 'fa fa-hourglass-start' => array( 'unicode' => '\f251', 'name' => 'Hourglass start' ),
332
+ 'fa fa-houzz' => array( 'unicode' => '\f27c', 'name' => 'Houzz' ),
333
+ 'fa fa-html5' => array( 'unicode' => '\f13b', 'name' => 'Html5' ),
334
+ 'fa fa-i-cursor' => array( 'unicode' => '\f246', 'name' => 'I cursor' ),
335
+ 'fa fa-id-badge' => array( 'unicode' => '\f2c1', 'name' => 'Id badge' ),
336
+ 'fa fa-id-card' => array( 'unicode' => '\f2c2', 'name' => 'Id card' ),
337
+ 'fa fa-id-card-o' => array( 'unicode' => '\f2c3', 'name' => 'Id card o' ),
338
+ 'fa fa-ils' => array( 'unicode' => '\f20b', 'name' => 'Ils' ),
339
+ 'fa fa-imdb' => array( 'unicode' => '\f2d8', 'name' => 'Imdb' ),
340
+ 'fa fa-inbox' => array( 'unicode' => '\f01c', 'name' => 'Inbox' ),
341
+ 'fa fa-indent' => array( 'unicode' => '\f03c', 'name' => 'Indent' ),
342
+ 'fa fa-industry' => array( 'unicode' => '\f275', 'name' => 'Industry' ),
343
+ 'fa fa-info' => array( 'unicode' => '\f129', 'name' => 'Info' ),
344
+ 'fa fa-info-circle' => array( 'unicode' => '\f05a', 'name' => 'Info circle' ),
345
+ 'fa fa-inr' => array( 'unicode' => '\f156', 'name' => 'Inr' ),
346
+ 'fa fa-instagram' => array( 'unicode' => '\f16d', 'name' => 'Instagram' ),
347
+ 'fa fa-internet-explorer' => array( 'unicode' => '\f26b', 'name' => 'Internet explorer' ),
348
+ 'fa fa-ioxhost' => array( 'unicode' => '\f208', 'name' => 'Ioxhost' ),
349
+ 'fa fa-italic' => array( 'unicode' => '\f033', 'name' => 'Italic' ),
350
+ 'fa fa-joomla' => array( 'unicode' => '\f1aa', 'name' => 'Joomla' ),
351
+ 'fa fa-jpy' => array( 'unicode' => '\f157', 'name' => 'Jpy' ),
352
+ 'fa fa-jsfiddle' => array( 'unicode' => '\f1cc', 'name' => 'Jsfiddle' ),
353
+ 'fa fa-key' => array( 'unicode' => '\f084', 'name' => 'Key' ),
354
+ 'fa fa-keyboard-o' => array( 'unicode' => '\f11c', 'name' => 'Keyboard o' ),
355
+ 'fa fa-krw' => array( 'unicode' => '\f159', 'name' => 'Krw' ),
356
+ 'fa fa-language' => array( 'unicode' => '\f1ab', 'name' => 'Language' ),
357
+ 'fa fa-laptop' => array( 'unicode' => '\f109', 'name' => 'Laptop' ),
358
+ 'fa fa-lastfm' => array( 'unicode' => '\f202', 'name' => 'Lastfm' ),
359
+ 'fa fa-lastfm-square' => array( 'unicode' => '\f203', 'name' => 'Lastfm square' ),
360
+ 'fa fa-leaf' => array( 'unicode' => '\f06c', 'name' => 'Leaf' ),
361
+ 'fa fa-leanpub' => array( 'unicode' => '\f212', 'name' => 'Leanpub' ),
362
+ 'fa fa-lemon-o' => array( 'unicode' => '\f094', 'name' => 'Lemon o' ),
363
+ 'fa fa-level-down' => array( 'unicode' => '\f149', 'name' => 'Level down' ),
364
+ 'fa fa-level-up' => array( 'unicode' => '\f148', 'name' => 'Level up' ),
365
+ 'fa fa-life-ring' => array( 'unicode' => '\f1cd', 'name' => 'Life ring' ),
366
+ 'fa fa-lightbulb-o' => array( 'unicode' => '\f0eb', 'name' => 'Lightbulb o' ),
367
+ 'fa fa-line-chart' => array( 'unicode' => '\f201', 'name' => 'Line chart' ),
368
+ 'fa fa-link' => array( 'unicode' => '\f0c1', 'name' => 'Link' ),
369
+ 'fa fa-linkedin' => array( 'unicode' => '\f0e1', 'name' => 'Linkedin' ),
370
+ 'fa fa-linkedin-square' => array( 'unicode' => '\f08c', 'name' => 'Linkedin square' ),
371
+ 'fa fa-linode' => array( 'unicode' => '\f2b8', 'name' => 'Linode' ),
372
+ 'fa fa-linux' => array( 'unicode' => '\f17c', 'name' => 'Linux' ),
373
+ 'fa fa-list' => array( 'unicode' => '\f03a', 'name' => 'List' ),
374
+ 'fa fa-list-alt' => array( 'unicode' => '\f022', 'name' => 'List alt' ),
375
+ 'fa fa-list-ol' => array( 'unicode' => '\f0cb', 'name' => 'List ol' ),
376
+ 'fa fa-list-ul' => array( 'unicode' => '\f0ca', 'name' => 'List ul' ),
377
+ 'fa fa-location-arrow' => array( 'unicode' => '\f124', 'name' => 'Location arrow' ),
378
+ 'fa fa-lock' => array( 'unicode' => '\f023', 'name' => 'Lock' ),
379
+ 'fa fa-long-arrow-down' => array( 'unicode' => '\f175', 'name' => 'Long arrow down' ),
380
+ 'fa fa-long-arrow-left' => array( 'unicode' => '\f177', 'name' => 'Long arrow left' ),
381
+ 'fa fa-long-arrow-right' => array( 'unicode' => '\f178', 'name' => 'Long arrow right' ),
382
+ 'fa fa-long-arrow-up' => array( 'unicode' => '\f176', 'name' => 'Long arrow up' ),
383
+ 'fa fa-low-vision' => array( 'unicode' => '\f2a8', 'name' => 'Low vision' ),
384
+ 'fa fa-magic' => array( 'unicode' => '\f0d0', 'name' => 'Magic' ),
385
+ 'fa fa-magnet' => array( 'unicode' => '\f076', 'name' => 'Magnet' ),
386
+ 'fa fa-male' => array( 'unicode' => '\f183', 'name' => 'Male' ),
387
+ 'fa fa-map' => array( 'unicode' => '\f279', 'name' => 'Map' ),
388
+ 'fa fa-map-marker' => array( 'unicode' => '\f041', 'name' => 'Map marker' ),
389
+ 'fa fa-map-o' => array( 'unicode' => '\f278', 'name' => 'Map o' ),
390
+ 'fa fa-map-pin' => array( 'unicode' => '\f276', 'name' => 'Map pin' ),
391
+ 'fa fa-map-signs' => array( 'unicode' => '\f277', 'name' => 'Map signs' ),
392
+ 'fa fa-mars' => array( 'unicode' => '\f222', 'name' => 'Mars' ),
393
+ 'fa fa-mars-double' => array( 'unicode' => '\f227', 'name' => 'Mars double' ),
394
+ 'fa fa-mars-stroke' => array( 'unicode' => '\f229', 'name' => 'Mars stroke' ),
395
+ 'fa fa-mars-stroke-h' => array( 'unicode' => '\f22b', 'name' => 'Mars stroke h' ),
396
+ 'fa fa-mars-stroke-v' => array( 'unicode' => '\f22a', 'name' => 'Mars stroke v' ),
397
+ 'fa fa-maxcdn' => array( 'unicode' => '\f136', 'name' => 'Maxcdn' ),
398
+ 'fa fa-meanpath' => array( 'unicode' => '\f20c', 'name' => 'Meanpath' ),
399
+ 'fa fa-medium' => array( 'unicode' => '\f23a', 'name' => 'Medium' ),
400
+ 'fa fa-medkit' => array( 'unicode' => '\f0fa', 'name' => 'Medkit' ),
401
+ 'fa fa-meetup' => array( 'unicode' => '\f2e0', 'name' => 'Meetup' ),
402
+ 'fa fa-meh-o' => array( 'unicode' => '\f11a', 'name' => 'Meh o' ),
403
+ 'fa fa-mercury' => array( 'unicode' => '\f223', 'name' => 'Mercury' ),
404
+ 'fa fa-microchip' => array( 'unicode' => '\f2db', 'name' => 'Microchip' ),
405
+ 'fa fa-microphone' => array( 'unicode' => '\f130', 'name' => 'Microphone' ),
406
+ 'fa fa-microphone-slash' => array( 'unicode' => '\f131', 'name' => 'Microphone slash' ),
407
+ 'fa fa-minus' => array( 'unicode' => '\f068', 'name' => 'Minus' ),
408
+ 'fa fa-minus-circle' => array( 'unicode' => '\f056', 'name' => 'Minus circle' ),
409
+ 'fa fa-minus-square' => array( 'unicode' => '\f146', 'name' => 'Minus square' ),
410
+ 'fa fa-minus-square-o' => array( 'unicode' => '\f147', 'name' => 'Minus square o' ),
411
+ 'fa fa-mixcloud' => array( 'unicode' => '\f289', 'name' => 'Mixcloud' ),
412
+ 'fa fa-mobile' => array( 'unicode' => '\f10b', 'name' => 'Mobile' ),
413
+ 'fa fa-modx' => array( 'unicode' => '\f285', 'name' => 'Modx' ),
414
+ 'fa fa-money' => array( 'unicode' => '\f0d6', 'name' => 'Money' ),
415
+ 'fa fa-moon-o' => array( 'unicode' => '\f186', 'name' => 'Moon o' ),
416
+ 'fa fa-motorcycle' => array( 'unicode' => '\f21c', 'name' => 'Motorcycle' ),
417
+ 'fa fa-mouse-pointer' => array( 'unicode' => '\f245', 'name' => 'Mouse pointer' ),
418
+ 'fa fa-music' => array( 'unicode' => '\f001', 'name' => 'Music' ),
419
+ 'fa fa-neuter' => array( 'unicode' => '\f22c', 'name' => 'Neuter' ),
420
+ 'fa fa-newspaper-o' => array( 'unicode' => '\f1ea', 'name' => 'Newspaper o' ),
421
+ 'fa fa-object-group' => array( 'unicode' => '\f247', 'name' => 'Object group' ),
422
+ 'fa fa-object-ungroup' => array( 'unicode' => '\f248', 'name' => 'Object ungroup' ),
423
+ 'fa fa-odnoklassniki' => array( 'unicode' => '\f263', 'name' => 'Odnoklassniki' ),
424
+ 'fa fa-odnoklassniki-square' => array( 'unicode' => '\f264', 'name' => 'Odnoklassniki square' ),
425
+ 'fa fa-opencart' => array( 'unicode' => '\f23d', 'name' => 'Opencart' ),
426
+ 'fa fa-openid' => array( 'unicode' => '\f19b', 'name' => 'Openid' ),
427
+ 'fa fa-opera' => array( 'unicode' => '\f26a', 'name' => 'Opera' ),
428
+ 'fa fa-optin-monster' => array( 'unicode' => '\f23c', 'name' => 'Optin monster' ),
429
+ 'fa fa-outdent' => array( 'unicode' => '\f03b', 'name' => 'Outdent' ),
430
+ 'fa fa-pagelines' => array( 'unicode' => '\f18c', 'name' => 'Pagelines' ),
431
+ 'fa fa-paint-brush' => array( 'unicode' => '\f1fc', 'name' => 'Paint brush' ),
432
+ 'fa fa-paper-plane' => array( 'unicode' => '\f1d8', 'name' => 'Paper plane' ),
433
+ 'fa fa-paper-plane-o' => array( 'unicode' => '\f1d9', 'name' => 'Paper plane o' ),
434
+ 'fa fa-paperclip' => array( 'unicode' => '\f0c6', 'name' => 'Paperclip' ),
435
+ 'fa fa-paragraph' => array( 'unicode' => '\f1dd', 'name' => 'Paragraph' ),
436
+ 'fa fa-pause' => array( 'unicode' => '\f04c', 'name' => 'Pause' ),
437
+ 'fa fa-pause-circle' => array( 'unicode' => '\f28b', 'name' => 'Pause circle' ),
438
+ 'fa fa-pause-circle-o' => array( 'unicode' => '\f28c', 'name' => 'Pause circle o' ),
439
+ 'fa fa-paw' => array( 'unicode' => '\f1b0', 'name' => 'Paw' ),
440
+ 'fa fa-paypal' => array( 'unicode' => '\f1ed', 'name' => 'Paypal' ),
441
+ 'fa fa-pencil' => array( 'unicode' => '\f040', 'name' => 'Pencil' ),
442
+ 'fa fa-pencil-square' => array( 'unicode' => '\f14b', 'name' => 'Pencil square' ),
443
+ 'fa fa-pencil-square-o' => array( 'unicode' => '\f044', 'name' => 'Pencil square o' ),
444
+ 'fa fa-percent' => array( 'unicode' => '\f295', 'name' => 'Percent' ),
445
+ 'fa fa-phone' => array( 'unicode' => '\f095', 'name' => 'Phone' ),
446
+ 'fa fa-phone-square' => array( 'unicode' => '\f098', 'name' => 'Phone square' ),
447
+ 'fa fa-picture-o' => array( 'unicode' => '\f03e', 'name' => 'Picture o' ),
448
+ 'fa fa-pie-chart' => array( 'unicode' => '\f200', 'name' => 'Pie chart' ),
449
+ 'fa fa-pied-piper' => array( 'unicode' => '\f2ae', 'name' => 'Pied piper' ),
450
+ 'fa fa-pied-piper-alt' => array( 'unicode' => '\f1a8', 'name' => 'Pied piper alt' ),
451
+ 'fa fa-pied-piper-pp' => array( 'unicode' => '\f1a7', 'name' => 'Pied piper pp' ),
452
+ 'fa fa-pinterest' => array( 'unicode' => '\f0d2', 'name' => 'Pinterest' ),
453
+ 'fa fa-pinterest-p' => array( 'unicode' => '\f231', 'name' => 'Pinterest p' ),
454
+ 'fa fa-pinterest-square' => array( 'unicode' => '\f0d3', 'name' => 'Pinterest square' ),
455
+ 'fa fa-plane' => array( 'unicode' => '\f072', 'name' => 'Plane' ),
456
+ 'fa fa-play' => array( 'unicode' => '\f04b', 'name' => 'Play' ),
457
+ 'fa fa-play-circle' => array( 'unicode' => '\f144', 'name' => 'Play circle' ),
458
+ 'fa fa-play-circle-o' => array( 'unicode' => '\f01d', 'name' => 'Play circle o' ),
459
+ 'fa fa-plug' => array( 'unicode' => '\f1e6', 'name' => 'Plug' ),
460
+ 'fa fa-plus' => array( 'unicode' => '\f067', 'name' => 'Plus' ),
461
+ 'fa fa-plus-circle' => array( 'unicode' => '\f055', 'name' => 'Plus circle' ),
462
+ 'fa fa-plus-square' => array( 'unicode' => '\f0fe', 'name' => 'Plus square' ),
463
+ 'fa fa-plus-square-o' => array( 'unicode' => '\f196', 'name' => 'Plus square o' ),
464
+ 'fa fa-podcast' => array( 'unicode' => '\f2ce', 'name' => 'Podcast' ),
465
+ 'fa fa-power-off' => array( 'unicode' => '\f011', 'name' => 'Power off' ),
466
+ 'fa fa-print' => array( 'unicode' => '\f02f', 'name' => 'Print' ),
467
+ 'fa fa-product-hunt' => array( 'unicode' => '\f288', 'name' => 'Product hunt' ),
468
+ 'fa fa-puzzle-piece' => array( 'unicode' => '\f12e', 'name' => 'Puzzle piece' ),
469
+ 'fa fa-qq' => array( 'unicode' => '\f1d6', 'name' => 'Qq' ),
470
+ 'fa fa-qrcode' => array( 'unicode' => '\f029', 'name' => 'Qrcode' ),
471
+ 'fa fa-question' => array( 'unicode' => '\f128', 'name' => 'Question' ),
472
+ 'fa fa-question-circle' => array( 'unicode' => '\f059', 'name' => 'Question circle' ),
473
+ 'fa fa-question-circle-o' => array( 'unicode' => '\f29c', 'name' => 'Question circle o' ),
474
+ 'fa fa-quora' => array( 'unicode' => '\f2c4', 'name' => 'Quora' ),
475
+ 'fa fa-quote-left' => array( 'unicode' => '\f10d', 'name' => 'Quote left' ),
476
+ 'fa fa-quote-right' => array( 'unicode' => '\f10e', 'name' => 'Quote right' ),
477
+ 'fa fa-random' => array( 'unicode' => '\f074', 'name' => 'Random' ),
478
+ 'fa fa-ravelry' => array( 'unicode' => '\f2d9', 'name' => 'Ravelry' ),
479
+ 'fa fa-rebel' => array( 'unicode' => '\f1d0', 'name' => 'Rebel' ),
480
+ 'fa fa-recycle' => array( 'unicode' => '\f1b8', 'name' => 'Recycle' ),
481
+ 'fa fa-reddit' => array( 'unicode' => '\f1a1', 'name' => 'Reddit' ),
482
+ 'fa fa-reddit-alien' => array( 'unicode' => '\f281', 'name' => 'Reddit alien' ),
483
+ 'fa fa-reddit-square' => array( 'unicode' => '\f1a2', 'name' => 'Reddit square' ),
484
+ 'fa fa-refresh' => array( 'unicode' => '\f021', 'name' => 'Refresh' ),
485
+ 'fa fa-registered' => array( 'unicode' => '\f25d', 'name' => 'Registered' ),
486
+ 'fa fa-renren' => array( 'unicode' => '\f18b', 'name' => 'Renren' ),
487
+ 'fa fa-repeat' => array( 'unicode' => '\f01e', 'name' => 'Repeat' ),
488
+ 'fa fa-reply' => array( 'unicode' => '\f112', 'name' => 'Reply' ),
489
+ 'fa fa-reply-all' => array( 'unicode' => '\f122', 'name' => 'Reply all' ),
490
+ 'fa fa-retweet' => array( 'unicode' => '\f079', 'name' => 'Retweet' ),
491
+ 'fa fa-road' => array( 'unicode' => '\f018', 'name' => 'Road' ),
492
+ 'fa fa-rocket' => array( 'unicode' => '\f135', 'name' => 'Rocket' ),
493
+ 'fa fa-rss' => array( 'unicode' => '\f09e', 'name' => 'Rss' ),
494
+ 'fa fa-rss-square' => array( 'unicode' => '\f143', 'name' => 'Rss square' ),
495
+ 'fa fa-rub' => array( 'unicode' => '\f158', 'name' => 'Rub' ),
496
+ 'fa fa-safari' => array( 'unicode' => '\f267', 'name' => 'Safari' ),
497
+ 'fa fa-scissors' => array( 'unicode' => '\f0c4', 'name' => 'Scissors' ),
498
+ 'fa fa-scribd' => array( 'unicode' => '\f28a', 'name' => 'Scribd' ),
499
+ 'fa fa-search' => array( 'unicode' => '\f002', 'name' => 'Search' ),
500
+ 'fa fa-search-minus' => array( 'unicode' => '\f010', 'name' => 'Search minus' ),
501
+ 'fa fa-search-plus' => array( 'unicode' => '\f00e', 'name' => 'Search plus' ),
502
+ 'fa fa-sellsy' => array( 'unicode' => '\f213', 'name' => 'Sellsy' ),
503
+ 'fa fa-server' => array( 'unicode' => '\f233', 'name' => 'Server' ),
504
+ 'fa fa-share' => array( 'unicode' => '\f064', 'name' => 'Share' ),
505
+ 'fa fa-share-alt' => array( 'unicode' => '\f1e0', 'name' => 'Share alt' ),
506
+ 'fa fa-share-alt-square' => array( 'unicode' => '\f1e1', 'name' => 'Share alt square' ),
507
+ 'fa fa-share-square' => array( 'unicode' => '\f14d', 'name' => 'Share square' ),
508
+ 'fa fa-share-square-o' => array( 'unicode' => '\f045', 'name' => 'Share square o' ),
509
+ 'fa fa-shield' => array( 'unicode' => '\f132', 'name' => 'Shield' ),
510
+ 'fa fa-ship' => array( 'unicode' => '\f21a', 'name' => 'Ship' ),
511
+ 'fa fa-shirtsinbulk' => array( 'unicode' => '\f214', 'name' => 'Shirtsinbulk' ),
512
+ 'fa fa-shopping-bag' => array( 'unicode' => '\f290', 'name' => 'Shopping bag' ),
513
+ 'fa fa-shopping-basket' => array( 'unicode' => '\f291', 'name' => 'Shopping basket' ),
514
+ 'fa fa-shopping-cart' => array( 'unicode' => '\f07a', 'name' => 'Shopping cart' ),
515
+ 'fa fa-shower' => array( 'unicode' => '\f2cc', 'name' => 'Shower' ),
516
+ 'fa fa-sign-in' => array( 'unicode' => '\f090', 'name' => 'Sign in' ),
517
+ 'fa fa-sign-language' => array( 'unicode' => '\f2a7', 'name' => 'Sign language' ),
518
+ 'fa fa-sign-out' => array( 'unicode' => '\f08b', 'name' => 'Sign out' ),
519
+ 'fa fa-signal' => array( 'unicode' => '\f012', 'name' => 'Signal' ),
520
+ 'fa fa-simplybuilt' => array( 'unicode' => '\f215', 'name' => 'Simplybuilt' ),
521
+ 'fa fa-sitemap' => array( 'unicode' => '\f0e8', 'name' => 'Sitemap' ),
522
+ 'fa fa-skyatlas' => array( 'unicode' => '\f216', 'name' => 'Skyatlas' ),
523
+ 'fa fa-skype' => array( 'unicode' => '\f17e', 'name' => 'Skype' ),
524
+ 'fa fa-slack' => array( 'unicode' => '\f198', 'name' => 'Slack' ),
525
+ 'fa fa-sliders' => array( 'unicode' => '\f1de', 'name' => 'Sliders' ),
526
+ 'fa fa-slideshare' => array( 'unicode' => '\f1e7', 'name' => 'Slideshare' ),
527
+ 'fa fa-smile-o' => array( 'unicode' => '\f118', 'name' => 'Smile o' ),
528
+ 'fa fa-snapchat' => array( 'unicode' => '\f2ab', 'name' => 'Snapchat' ),
529
+ 'fa fa-snapchat-ghost' => array( 'unicode' => '\f2ac', 'name' => 'Snapchat ghost' ),
530
+ 'fa fa-snapchat-square' => array( 'unicode' => '\f2ad', 'name' => 'Snapchat square' ),
531
+ 'fa fa-snowflake-o' => array( 'unicode' => '\f2dc', 'name' => 'Snowflake o' ),
532
+ 'fa fa-sort' => array( 'unicode' => '\f0dc', 'name' => 'Sort' ),
533
+ 'fa fa-sort-alpha-asc' => array( 'unicode' => '\f15d', 'name' => 'Sort alpha asc' ),
534
+ 'fa fa-sort-alpha-desc' => array( 'unicode' => '\f15e', 'name' => 'Sort alpha desc' ),
535
+ 'fa fa-sort-amount-asc' => array( 'unicode' => '\f160', 'name' => 'Sort amount asc' ),
536
+ 'fa fa-sort-amount-desc' => array( 'unicode' => '\f161', 'name' => 'Sort amount desc' ),
537
+ 'fa fa-sort-asc' => array( 'unicode' => '\f0de', 'name' => 'Sort asc' ),
538
+ 'fa fa-sort-desc' => array( 'unicode' => '\f0dd', 'name' => 'Sort desc' ),
539
+ 'fa fa-sort-numeric-asc' => array( 'unicode' => '\f162', 'name' => 'Sort numeric asc' ),
540
+ 'fa fa-sort-numeric-desc' => array( 'unicode' => '\f163', 'name' => 'Sort numeric desc' ),
541
+ 'fa fa-soundcloud' => array( 'unicode' => '\f1be', 'name' => 'Soundcloud' ),
542
+ 'fa fa-space-shuttle' => array( 'unicode' => '\f197', 'name' => 'Space shuttle' ),
543
+ 'fa fa-spinner' => array( 'unicode' => '\f110', 'name' => 'Spinner' ),
544
+ 'fa fa-spoon' => array( 'unicode' => '\f1b1', 'name' => 'Spoon' ),
545
+ 'fa fa-spotify' => array( 'unicode' => '\f1bc', 'name' => 'Spotify' ),
546
+ 'fa fa-square' => array( 'unicode' => '\f0c8', 'name' => 'Square' ),
547
+ 'fa fa-square-o' => array( 'unicode' => '\f096', 'name' => 'Square o' ),
548
+ 'fa fa-stack-exchange' => array( 'unicode' => '\f18d', 'name' => 'Stack exchange' ),
549
+ 'fa fa-stack-overflow' => array( 'unicode' => '\f16c', 'name' => 'Stack overflow' ),
550
+ 'fa fa-star-half' => array( 'unicode' => '\f089', 'name' => 'Star half' ),
551
+ 'fa fa-star-half-o' => array( 'unicode' => '\f123', 'name' => 'Star half o' ),
552
+ 'fa fa-star-o' => array( 'unicode' => '\f006', 'name' => 'Star o' ),
553
+ 'fa fa-steam' => array( 'unicode' => '\f1b6', 'name' => 'Steam' ),
554
+ 'fa fa-steam-square' => array( 'unicode' => '\f1b7', 'name' => 'Steam square' ),
555
+ 'fa fa-step-backward' => array( 'unicode' => '\f048', 'name' => 'Step backward' ),
556
+ 'fa fa-step-forward' => array( 'unicode' => '\f051', 'name' => 'Step forward' ),
557
+ 'fa fa-stethoscope' => array( 'unicode' => '\f0f1', 'name' => 'Stethoscope' ),
558
+ 'fa fa-sticky-note' => array( 'unicode' => '\f249', 'name' => 'Sticky note' ),
559
+ 'fa fa-sticky-note-o' => array( 'unicode' => '\f24a', 'name' => 'Sticky note o' ),
560
+ 'fa fa-stop' => array( 'unicode' => '\f04d', 'name' => 'Stop' ),
561
+ 'fa fa-stop-circle' => array( 'unicode' => '\f28d', 'name' => 'Stop circle' ),
562
+ 'fa fa-stop-circle-o' => array( 'unicode' => '\f28e', 'name' => 'Stop circle o' ),
563
+ 'fa fa-street-view' => array( 'unicode' => '\f21d', 'name' => 'Street view' ),
564
+ 'fa fa-strikethrough' => array( 'unicode' => '\f0cc', 'name' => 'Strikethrough' ),
565
+ 'fa fa-stumbleupon' => array( 'unicode' => '\f1a4', 'name' => 'Stumbleupon' ),
566
+ 'fa fa-stumbleupon-circle' => array( 'unicode' => '\f1a3', 'name' => 'Stumbleupon circle' ),
567
+ 'fa fa-subscript' => array( 'unicode' => '\f12c', 'name' => 'Subscript' ),
568
+ 'fa fa-subway' => array( 'unicode' => '\f239', 'name' => 'Subway' ),
569
+ 'fa fa-suitcase' => array( 'unicode' => '\f0f2', 'name' => 'Suitcase' ),
570
+ 'fa fa-sun-o' => array( 'unicode' => '\f185', 'name' => 'Sun o' ),
571
+ 'fa fa-superpowers' => array( 'unicode' => '\f2dd', 'name' => 'Superpowers' ),
572
+ 'fa fa-superscript' => array( 'unicode' => '\f12b', 'name' => 'Superscript' ),
573
+ 'fa fa-table' => array( 'unicode' => '\f0ce', 'name' => 'Table' ),
574
+ 'fa fa-tablet' => array( 'unicode' => '\f10a', 'name' => 'Tablet' ),
575
+ 'fa fa-tachometer' => array( 'unicode' => '\f0e4', 'name' => 'Tachometer' ),
576
+ 'fa fa-tag' => array( 'unicode' => '\f02b', 'name' => 'Tag' ),
577
+ 'fa fa-tags' => array( 'unicode' => '\f02c', 'name' => 'Tags' ),
578
+ 'fa fa-tasks' => array( 'unicode' => '\f0ae', 'name' => 'Tasks' ),
579
+ 'fa fa-taxi' => array( 'unicode' => '\f1ba', 'name' => 'Taxi' ),
580
+ 'fa fa-telegram' => array( 'unicode' => '\f2c6', 'name' => 'Telegram' ),
581
+ 'fa fa-television' => array( 'unicode' => '\f26c', 'name' => 'Television' ),
582
+ 'fa fa-tencent-weibo' => array( 'unicode' => '\f1d5', 'name' => 'Tencent weibo' ),
583
+ 'fa fa-terminal' => array( 'unicode' => '\f120', 'name' => 'Terminal' ),
584
+ 'fa fa-text-height' => array( 'unicode' => '\f034', 'name' => 'Text height' ),
585
+ 'fa fa-text-width' => array( 'unicode' => '\f035', 'name' => 'Text width' ),
586
+ 'fa fa-th' => array( 'unicode' => '\f00a', 'name' => 'Th' ),
587
+ 'fa fa-th-large' => array( 'unicode' => '\f009', 'name' => 'Th large' ),
588
+ 'fa fa-th-list' => array( 'unicode' => '\f00b', 'name' => 'Th list' ),
589
+ 'fa fa-themeisle' => array( 'unicode' => '\f2b2', 'name' => 'Themeisle' ),
590
+ 'fa fa-thermometer-empty' => array( 'unicode' => '\f2cb', 'name' => 'Thermometer empty' ),
591
+ 'fa fa-thermometer-full' => array( 'unicode' => '\f2c7', 'name' => 'Thermometer full' ),
592
+ 'fa fa-thermometer-half' => array( 'unicode' => '\f2c9', 'name' => 'Thermometer half' ),
593
+ 'fa fa-thermometer-quarter' => array( 'unicode' => '\f2ca', 'name' => 'Thermometer quarter' ),
594
+ 'fa fa-thermometer-three-quarters' => array( 'unicode' => '\f2c8', 'name' => 'Thermometer three quarters' ),
595
+ 'fa fa-thumb-tack' => array( 'unicode' => '\f08d', 'name' => 'Thumb tack' ),
596
+ 'fa fa-thumbs-down' => array( 'unicode' => '\f165', 'name' => 'Thumbs down' ),
597
+ 'fa fa-thumbs-o-down' => array( 'unicode' => '\f088', 'name' => 'Thumbs o down' ),
598
+ 'fa fa-thumbs-o-up' => array( 'unicode' => '\f087', 'name' => 'Thumbs o up' ),
599
+ 'fa fa-thumbs-up' => array( 'unicode' => '\f164', 'name' => 'Thumbs up' ),
600
+ 'fa fa-ticket' => array( 'unicode' => '\f145', 'name' => 'Ticket' ),
601
+ 'fa fa-times' => array( 'unicode' => '\f00d', 'name' => 'Times' ),
602
+ 'fa fa-times-circle' => array( 'unicode' => '\f057', 'name' => 'Times circle' ),
603
+ 'fa fa-times-circle-o' => array( 'unicode' => '\f05c', 'name' => 'Times circle o' ),
604
+ 'fa fa-tint' => array( 'unicode' => '\f043', 'name' => 'Tint' ),
605
+ 'fa fa-toggle-off' => array( 'unicode' => '\f204', 'name' => 'Toggle off' ),
606
+ 'fa fa-toggle-on' => array( 'unicode' => '\f205', 'name' => 'Toggle on' ),
607
+ 'fa fa-trademark' => array( 'unicode' => '\f25c', 'name' => 'Trademark' ),
608
+ 'fa fa-train' => array( 'unicode' => '\f238', 'name' => 'Train' ),
609
+ 'fa fa-transgender' => array( 'unicode' => '\f224', 'name' => 'Transgender' ),
610
+ 'fa fa-transgender-alt' => array( 'unicode' => '\f225', 'name' => 'Transgender alt' ),
611
+ 'fa fa-trash' => array( 'unicode' => '\f1f8', 'name' => 'Trash' ),
612
+ 'fa fa-trash-o' => array( 'unicode' => '\f014', 'name' => 'Trash o' ),
613
+ 'fa fa-tree' => array( 'unicode' => '\f1bb', 'name' => 'Tree' ),
614
+ 'fa fa-trello' => array( 'unicode' => '\f181', 'name' => 'Trello' ),
615
+ 'fa fa-tripadvisor' => array( 'unicode' => '\f262', 'name' => 'Tripadvisor' ),
616
+ 'fa fa-trophy' => array( 'unicode' => '\f091', 'name' => 'Trophy' ),
617
+ 'fa fa-truck' => array( 'unicode' => '\f0d1', 'name' => 'Truck' ),
618
+ 'fa fa-try' => array( 'unicode' => '\f195', 'name' => 'Try' ),
619
+ 'fa fa-tty' => array( 'unicode' => '\f1e4', 'name' => 'Tty' ),
620
+ 'fa fa-tumblr' => array( 'unicode' => '\f173', 'name' => 'Tumblr' ),
621
+ 'fa fa-tumblr-square' => array( 'unicode' => '\f174', 'name' => 'Tumblr square' ),
622
+ 'fa fa-twitch' => array( 'unicode' => '\f1e8', 'name' => 'Twitch' ),
623
+ 'fa fa-twitter' => array( 'unicode' => '\f099', 'name' => 'Twitter' ),
624
+ 'fa fa-twitter-square' => array( 'unicode' => '\f081', 'name' => 'Twitter square' ),
625
+ 'fa fa-umbrella' => array( 'unicode' => '\f0e9', 'name' => 'Umbrella' ),
626
+ 'fa fa-underline' => array( 'unicode' => '\f0cd', 'name' => 'Underline' ),
627
+ 'fa fa-undo' => array( 'unicode' => '\f0e2', 'name' => 'Undo' ),
628
+ 'fa fa-universal-access' => array( 'unicode' => '\f29a', 'name' => 'Universal access' ),
629
+ 'fa fa-university' => array( 'unicode' => '\f19c', 'name' => 'University' ),
630
+ 'fa fa-unlock' => array( 'unicode' => '\f09c', 'name' => 'Unlock' ),
631
+ 'fa fa-unlock-alt' => array( 'unicode' => '\f13e', 'name' => 'Unlock alt' ),
632
+ 'fa fa-upload' => array( 'unicode' => '\f093', 'name' => 'Upload' ),
633
+ 'fa fa-usb' => array( 'unicode' => '\f287', 'name' => 'Usb' ),
634
+ 'fa fa-usd' => array( 'unicode' => '\f155', 'name' => 'Usd' ),
635
+ 'fa fa-user' => array( 'unicode' => '\f007', 'name' => 'User' ),
636
+ 'fa fa-user-circle' => array( 'unicode' => '\f2bd', 'name' => 'User circle' ),
637
+ 'fa fa-user-circle-o' => array( 'unicode' => '\f2be', 'name' => 'User circle o' ),
638
+ 'fa fa-user-md' => array( 'unicode' => '\f0f0', 'name' => 'User md' ),
639
+ 'fa fa-user-o' => array( 'unicode' => '\f2c0', 'name' => 'User o' ),
640
+ 'fa fa-user-plus' => array( 'unicode' => '\f234', 'name' => 'User plus' ),
641
+ 'fa fa-user-secret' => array( 'unicode' => '\f21b', 'name' => 'User secret' ),
642
+ 'fa fa-user-times' => array( 'unicode' => '\f235', 'name' => 'User times' ),
643
+ 'fa fa-users' => array( 'unicode' => '\f0c0', 'name' => 'Users' ),
644
+ 'fa fa-venus' => array( 'unicode' => '\f221', 'name' => 'Venus' ),
645
+ 'fa fa-venus-double' => array( 'unicode' => '\f226', 'name' => 'Venus double' ),
646
+ 'fa fa-venus-mars' => array( 'unicode' => '\f228', 'name' => 'Venus mars' ),
647
+ 'fa fa-viacoin' => array( 'unicode' => '\f237', 'name' => 'Viacoin' ),
648
+ 'fa fa-viadeo' => array( 'unicode' => '\f2a9', 'name' => 'Viadeo' ),
649
+ 'fa fa-viadeo-square' => array( 'unicode' => '\f2aa', 'name' => 'Viadeo square' ),
650
+ 'fa fa-video-camera' => array( 'unicode' => '\f03d', 'name' => 'Video camera' ),
651
+ 'fa fa-vimeo' => array( 'unicode' => '\f27d', 'name' => 'Vimeo' ),
652
+ 'fa fa-vimeo-square' => array( 'unicode' => '\f194', 'name' => 'Vimeo square' ),
653
+ 'fa fa-vine' => array( 'unicode' => '\f1ca', 'name' => 'Vine' ),
654
+ 'fa fa-vk' => array( 'unicode' => '\f189', 'name' => 'Vk' ),
655
+ 'fa fa-volume-control-phone' => array( 'unicode' => '\f2a0', 'name' => 'Volume control phone' ),
656
+ 'fa fa-volume-down' => array( 'unicode' => '\f027', 'name' => 'Volume down' ),
657
+ 'fa fa-volume-off' => array( 'unicode' => '\f026', 'name' => 'Volume off' ),
658
+ 'fa fa-volume-up' => array( 'unicode' => '\f028', 'name' => 'Volume up' ),
659
+ 'fa fa-weibo' => array( 'unicode' => '\f18a', 'name' => 'Weibo' ),
660
+ 'fa fa-weixin' => array( 'unicode' => '\f1d7', 'name' => 'Weixin' ),
661
+ 'fa fa-whatsapp' => array( 'unicode' => '\f232', 'name' => 'Whatsapp' ),
662
+ 'fa fa-wheelchair' => array( 'unicode' => '\f193', 'name' => 'Wheelchair' ),
663
+ 'fa fa-wheelchair-alt' => array( 'unicode' => '\f29b', 'name' => 'Wheelchair alt' ),
664
+ 'fa fa-wifi' => array( 'unicode' => '\f1eb', 'name' => 'Wifi' ),
665
+ 'fa fa-wikipedia-w' => array( 'unicode' => '\f266', 'name' => 'Wikipedia w' ),
666
+ 'fa fa-window-close' => array( 'unicode' => '\f2d3', 'name' => 'Window close' ),
667
+ 'fa fa-window-close-o' => array( 'unicode' => '\f2d4', 'name' => 'Window close o' ),
668
+ 'fa fa-window-maximize' => array( 'unicode' => '\f2d0', 'name' => 'Window maximize' ),
669
+ 'fa fa-window-minimize' => array( 'unicode' => '\f2d1', 'name' => 'Window minimize' ),
670
+ 'fa fa-window-restore' => array( 'unicode' => '\f2d2', 'name' => 'Window restore' ),
671
+ 'fa fa-windows' => array( 'unicode' => '\f17a', 'name' => 'Windows' ),
672
+ 'fa fa-wordpress' => array( 'unicode' => '\f19a', 'name' => 'Wordpress' ),
673
+ 'fa fa-wpbeginner' => array( 'unicode' => '\f297', 'name' => 'Wpbeginner' ),
674
+ 'fa fa-wpexplorer' => array( 'unicode' => '\f2de', 'name' => 'Wpexplorer' ),
675
+ 'fa fa-wpforms' => array( 'unicode' => '\f298', 'name' => 'Wpforms' ),
676
+ 'fa fa-wrench' => array( 'unicode' => '\f0ad', 'name' => 'Wrench' ),
677
+ 'fa fa-xing' => array( 'unicode' => '\f168', 'name' => 'Xing' ),
678
+ 'fa fa-xing-square' => array( 'unicode' => '\f169', 'name' => 'Xing square' ),
679
+ 'fa fa-y-combinator' => array( 'unicode' => '\f23b', 'name' => 'Y combinator' ),
680
+ 'fa fa-yahoo' => array( 'unicode' => '\f19e', 'name' => 'Yahoo' ),
681
+ 'fa fa-yelp' => array( 'unicode' => '\f1e9', 'name' => 'Yelp' ),
682
+ 'fa fa-yoast' => array( 'unicode' => '\f2b1', 'name' => 'Yoast' ),
683
+ 'fa fa-youtube' => array( 'unicode' => '\f167', 'name' => 'Youtube' ),
684
+ 'fa fa-youtube-play' => array( 'unicode' => '\f16a', 'name' => 'Youtube play' ),
685
+ 'fa fa-youtube-square' => array( 'unicode' => '\f166', 'name' => 'Youtube square' ),
686
+ );
687
+ // phpcs:enable
admin/metaboxes.php CHANGED
@@ -1,1283 +1,1283 @@
1
- <?php
2
- /**
3
- * File for registering meta box.
4
- *
5
- * @since 2.0
6
- * @copyright Copyright (c) 2013, MyThemesShop
7
- * @author MyThemesShop
8
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9
- * @package WP_Review
10
- */
11
-
12
- /* Adds a box to the Posts edit screens. */
13
- add_action( 'add_meta_boxes', 'wp_review_add_meta_boxes' );
14
-
15
- /* Saves the meta box custom data. */
16
- add_action( 'save_post', 'wp_review_save_postdata', 10, 2 );
17
- add_action( 'save_post', 'wp_review_clear_query_cache', 10, 2 );
18
-
19
- require_once plugin_dir_path( __FILE__ ) . 'review-options-meta-box.php';
20
-
21
- /**
22
- * Adds a box to the Post edit screens.
23
- *
24
- * @since 1.0
25
- */
26
- function wp_review_add_meta_boxes() {
27
- $post_types = get_post_types( array( 'public' => true ), 'names' );
28
- $excluded_post_types = apply_filters( 'wp_review_excluded_post_types', array( 'attachment' ) );
29
- $hide_review_box = wp_review_network_option( 'hide_ratings_in_posts_' );
30
- $hide_review_links = wp_review_network_option( 'hide_review_links_' );
31
- $hide_review_desc = wp_review_network_option( 'hide_review_description_' );
32
- $hide_review_features = wp_review_network_option( 'hide_features_' );
33
- $hide_user_reviews = wp_review_network_option( 'hide_user_reviews_' );
34
-
35
- if ( ! $hide_review_box && current_user_can( 'wp_review_single_page' ) ) {
36
- foreach ( $post_types as $post_type ) {
37
- if ( ! in_array( $post_type, $excluded_post_types, true ) ) {
38
- add_meta_box(
39
- 'wp-review-metabox-review',
40
- __( 'Review', 'wp-review' ),
41
- 'wp_review_render_meta_box_review_options',
42
- $post_type,
43
- 'normal',
44
- 'high'
45
- );
46
-
47
- if ( ! $hide_review_features && current_user_can( 'wp_review_features' ) ) {
48
- add_meta_box(
49
- 'wp-review-metabox-item',
50
- __( 'Review Item', 'wp-review' ),
51
- 'wp_review_render_meta_box_item',
52
- $post_type,
53
- 'normal',
54
- 'high'
55
- );
56
- }
57
-
58
- if ( ! $hide_review_links && current_user_can( 'wp_review_links' ) ) {
59
- add_meta_box(
60
- 'wp-review-metabox-reviewLinks',
61
- __( 'Review Links', 'wp-review' ),
62
- 'wp_review_render_meta_box_review_links',
63
- $post_type,
64
- 'normal',
65
- 'high'
66
- );
67
- }
68
- if ( ! $hide_review_desc && current_user_can( 'wp_review_description' ) ) {
69
- add_meta_box(
70
- 'wp-review-metabox-desc',
71
- __( 'Review Description', 'wp-review' ),
72
- 'wp_review_render_meta_box_desc',
73
- $post_type,
74
- 'normal',
75
- 'high'
76
- );
77
- }
78
-
79
- if ( ! $hide_user_reviews && current_user_can( 'wp_review_user_reviews' ) ) {
80
- add_meta_box(
81
- 'wp-review-metabox-userReview',
82
- __( 'User Reviews', 'wp-review' ),
83
- 'wp_review_render_meta_box_user_review',
84
- $post_type,
85
- 'normal',
86
- 'high'
87
- );
88
- }
89
- }
90
- }
91
- }
92
-
93
- }
94
-
95
- /**
96
- * Render the meta box.
97
- *
98
- * @since 1.0
99
- *
100
- * @param WP_Post $post Post object.
101
- */
102
- function wp_review_render_meta_box_item( $post ) {
103
- $form_field = new WP_Review_Form_Field();
104
- $options = get_option( 'wp_review_options' );
105
- $default_location = wp_review_get_default_location();
106
- $default_criteria = wp_review_get_default_criteria();
107
-
108
- $default_items = array();
109
- foreach ( $default_criteria as $index => $item ) {
110
- if ( empty( $item ) ) {
111
- continue;
112
- }
113
- $default_items[ $index ] = array(
114
- 'id' => $index,
115
- 'wp_review_item_title' => $item,
116
- 'wp_review_item_star' => '',
117
- );
118
- }
119
-
120
- $global_colors = wp_review_get_global_colors();
121
- $global_color = $global_colors['color'];
122
- $global_inactive_color = $global_colors['inactive_color'];
123
-
124
- /* Retrieve an existing value from the database. */
125
- $custom_colors = get_post_meta( $post->ID, 'wp_review_custom_colors', true );
126
- $custom_location = get_post_meta( $post->ID, 'wp_review_custom_location', true );
127
-
128
- $items = wp_review_get_review_items( $post->ID );
129
- if ( '' === $items ) {
130
- $items = $default_items;
131
- }
132
- $items = array_values( $items );
133
-
134
- $total = get_post_meta( $post->ID, 'wp_review_total', true );
135
-
136
- $post_color = get_post_meta( $post->ID, 'wp_review_color', true );
137
- $post_inactive_color = get_post_meta( $post->ID, 'wp_review_inactive_color', true );
138
- $color = $post_color;
139
- $inactive_color = $post_inactive_color;
140
-
141
- $location = get_post_meta( $post->ID, 'wp_review_location', true );
142
- $fontcolor = get_post_meta( $post->ID, 'wp_review_fontcolor', true );
143
- $bgcolor1 = get_post_meta( $post->ID, 'wp_review_bgcolor1', true );
144
- $bgcolor2 = get_post_meta( $post->ID, 'wp_review_bgcolor2', true );
145
- $bordercolor = get_post_meta( $post->ID, 'wp_review_bordercolor', true );
146
-
147
- if ( ! $color ) {
148
- $color = $global_color;
149
- }
150
- if ( ! $inactive_color ) {
151
- $inactive_color = $global_inactive_color;
152
- }
153
-
154
- if ( '' === $location ) {
155
- $location = ! empty( $options['location'] ) ? $options['location'] : $default_location;
156
- }
157
- if ( '' === $fontcolor ) {
158
- $fontcolor = $global_colors['fontcolor'];
159
- }
160
- if ( '' === $bgcolor1 ) {
161
- $bgcolor1 = $global_colors['bgcolor1'];
162
- }
163
- if ( '' === $bgcolor2 ) {
164
- $bgcolor2 = $global_colors['bgcolor2'];
165
- }
166
- if ( '' === $bordercolor ) {
167
- $bordercolor = $global_colors['bordercolor'];
168
- }
169
-
170
- $fields = array(
171
- 'location' => true,
172
- 'color' => true,
173
- 'inactive_color' => true,
174
- 'fontcolor' => true,
175
- 'bgcolor1' => true,
176
- 'bgcolor2' => true,
177
- 'bordercolor' => true,
178
- 'fontfamily' => true,
179
- 'custom_colors' => true,
180
- 'custom_location' => true,
181
- 'disable_features' => true,
182
- );
183
- $displayed_fields = apply_filters( 'wp_review_metabox_item_fields', $fields );
184
-
185
- $review_templates = wp_review_get_box_templates();
186
- $box_template = get_post_meta( $post->ID, 'wp_review_box_template', true );
187
-
188
- if ( ! $box_template || ! in_array( $box_template, array( 'default', 'aqua' ), true ) ) {
189
- $box_template = wp_review_option( 'box_template', 'default' );
190
- }
191
- $box_template_img = ! empty( $review_templates[ $box_template ] ) ? $review_templates[ $box_template ]['image'] : WP_REVIEW_ASSETS . 'images/largethumb.png';
192
-
193
- /* Add an nonce field so we can check for it later. */
194
- wp_nonce_field( basename( __FILE__ ), 'wp-review-item-nonce' );
195
- ?>
196
- <input type="hidden" id="wpr-review-color-value" value="<?php echo esc_attr( $color ); ?>">
197
- <input type="hidden" id="wpr-review-inactive-color-value" value="<?php echo esc_attr( $inactive_color ); ?>">
198
- <input type="hidden" id="wpr-review-global-color-value" value="<?php echo esc_attr( $global_color ); ?>">
199
- <input type="hidden" id="wpr-review-global-inactive-color-value" value="<?php echo esc_attr( $global_inactive_color ); ?>">
200
- <input type="hidden" id="wpr-review-items-data" value="<?php echo esc_attr( wp_json_encode( $items ) ); ?>">
201
-
202
- <div id="wpr-review-items-app">
203
- <input type="hidden" id="wpr-review-type-2" value="">
204
- <div class="wpr-review-items"></div>
205
-
206
- <div class="setting-row final-row" style="padding-right: 10px;">
207
- <div class="col-1">
208
- <button type="button" class="button add-item"><?php esc_html_e( 'Add item', 'wp-review' ); ?></button>
209
- </div>
210
- <div class="col-2"></div>
211
- <div class="col-3">
212
- <div class="wpr-review-items-total">
213
- <input type="text" class="input-total" name="wp_review_total" value="<?php echo floatval( $total ); ?>" size="4">
214
- <label><?php esc_html_e( 'Total', 'wp-review' ); ?></label>
215
- </div>
216
- </div>
217
- </div>
218
- </div>
219
-
220
- <script type="text/html" id="tmpl-wpr-review-item">
221
- <span class="wpr-icon-move dashicons dashicons-menu"></span>
222
-
223
- {{{ data.itemNameSetting }}}
224
-
225
- {{{ data.itemRatingSetting }}}
226
-
227
- {{{ data.itemColorSetting }}}
228
-
229
- {{{ data.itemInactiveColorSetting }}}
230
-
231
- <input type="hidden" name="wp_review_item_id[]" value="{{ data.item_id }}">
232
-
233
- <button type="button" class="button delete-item"><?php esc_html_e( 'Delete', 'wp-review' ); ?></button>
234
- </script>
235
-
236
- <script type="text/html" id="tmpl-wpr-review-item-name">
237
- <div class="setting-row">
238
- <div class="col-1">
239
- <label for="wpr-review-item-title-{{ data.id }}"><?php esc_html_e( 'Feature Name', 'wp-review' ); ?></label>
240
- </div>
241
- <div class="col-2">
242
- <input type="text" id="wpr-review-item-title-{{ data.id }}" name="wp_review_item_title[]" class="input-title" value="{{ data.wp_review_item_title }}">
243
- </div>
244
- </div>
245
- </script>
246
-
247
- <script type="text/html" id="tmpl-wpr-review-item-color">
248
- <div class="setting-row">
249
- <div class="col-1">
250
- <label for="wpr-review-item-color-{{ data.id }}"><?php esc_html_e( 'Feature Color', 'wp-review' ); ?></label>
251
- <?php wp_review_print_pro_text(); ?>
252
- </div>
253
- <div class="col-2">
254
- <span class="wp-review-disabled inline-block has-bg">
255
- <input type="text" id="wpr-review-item-color-{{ data.id }}" name="wp_review_item_color[]" class="input-color" value="{{ data.wp_review_item_color }}" data-default-color="{{ data.wp_review_item_color }}" disabled>
256
- </span>
257
- </div>
258
- </div>
259
- </script>
260
-
261
- <script type="text/html" id="tmpl-wpr-review-item-inactive-color">
262
- <div class="setting-row">
263
- <div class="col-1">
264
- <label for="wpr-review-item-inactive-color-{{ data.id }}"><?php esc_html_e( 'Inactive Color', 'wp-review' ); ?></label>
265
- <?php wp_review_print_pro_text(); ?>
266
- </div>
267
- <div class="col-2">
268
- <span class="wp-review-disabled inline-block has-bg">
269
- <input type="text" id="wpr-review-item-inactive-color-{{ data.id }}" name="wp_review_item_inactive_color[]" class="input-inactive-color" value="{{ data.wp_review_item_inactive_color }}" data-default-color="{{ data.wp_review_item_inactive_color }}" disabled>
270
- </span>
271
- </div>
272
- </div>
273
- </script>
274
-
275
- <script type="text/html" id="tmpl-wpr-review-item-rating">
276
- <div class="setting-row">
277
- <div class="col-1">
278
- <label for="wpr-review-item-star-{{ data.id }}"><?php esc_html_e( 'Feature Score', 'wp-review' ); ?></label>
279
- </div>
280
- <div class="col-2">
281
- <input type="text" id="wpr-review-item-star-{{ data.id }}" name="wp_review_item_star[]" class="input-star" value="{{ data.wp_review_item_star }}" data-type="{{ data.type }}" data-color="{{ data.wp_review_item_color }}" data-inactive-color="{{ data.wp_review_item_inactive_color }}" size="4">
282
- </div>
283
- <div class="col-3"></div>
284
- </div>
285
- </script>
286
-
287
- <div class="wp-review-field"<?php if ( empty( $displayed_fields['disable_features'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
288
- <div class="wp-review-field-label">
289
- <label><?php esc_html_e( 'Hide Features', 'wp-review' ); ?></label>
290
- <?php wp_review_print_pro_text(); ?>
291
- </div>
292
-
293
- <div class="wp-review-field-option">
294
- <?php
295
- $form_field->render_switch(
296
- array(
297
- 'id' => 'wp_review_disable_features',
298
- 'name' => 'wp_review_disable_features',
299
- 'disabled' => true,
300
- )
301
- );
302
- ?>
303
- </div>
304
- </div>
305
- <div class="wp-review-field"<?php if ( empty( $displayed_fields['custom_location'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
306
- <div class="wp-review-field-label">
307
- <label><?php esc_html_e( 'Custom Location', 'wp-review' ); ?></label>
308
- </div>
309
-
310
- <div class="wp-review-field-option">
311
- <?php
312
- $form_field->render_switch(
313
- array(
314
- 'id' => 'wp_review_custom_location',
315
- 'name' => 'wp_review_custom_location',
316
- 'value' => $custom_location,
317
- )
318
- );
319
- ?>
320
- </div>
321
- </div>
322
-
323
- <div class="wp-review-location-options"<?php if ( empty( $custom_location ) || empty( $displayed_fields['location'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
324
- <div class="wp-review-field">
325
- <div class="wp-review-field-label">
326
- <label for="wp_review_location"><?php esc_html_e( 'Review Location', 'wp-review' ); ?></label>
327
- </div>
328
-
329
- <div class="wp-review-field-option">
330
- <select name="wp_review_location" id="wp_review_location">
331
- <option value="bottom" <?php selected( $location, 'bottom' ); ?>><?php esc_html_e( 'After Content', 'wp-review' ); ?></option>
332
- <option value="top" <?php selected( $location, 'top' ); ?>><?php esc_html_e( 'Before Content', 'wp-review' ); ?></option>
333
- <option value="custom" <?php selected( $location, 'custom' ); ?>><?php esc_html_e( 'Custom (use shortcode)', 'wp-review' ); ?></option>
334
- </select>
335
-
336
- <p id="wp_review_shortcode_hint_field">
337
- <!-- <label for="wp_review_shortcode_hint"></label> -->
338
- <input id="wp_review_shortcode_hint" type="text" value='[wp-review id="<?php echo intval( trim( $post->ID ) ); ?>"]' readonly="readonly" />
339
- <span class="description"><?php esc_html_e( 'Copy &amp; paste this shortcode in the content.', 'wp-review' ); ?></span>
340
- </p>
341
- </div>
342
- </div>
343
- </div>
344
-
345
- <div class="wp-review-field"<?php if ( empty( $displayed_fields['custom_colors'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
346
- <div class="wp-review-field-label">
347
- <label><?php esc_html_e( 'Custom Layout', 'wp-review' ); ?></label>
348
- </div>
349
-
350
- <div class="wp-review-field-option">
351
- <?php
352
- $form_field->render_switch(
353
- array(
354
- 'id' => 'wp_review_custom_colors',
355
- 'name' => 'wp_review_custom_colors',
356
- 'value' => $custom_colors,
357
- )
358
- );
359
- ?>
360
- </div>
361
- </div>
362
-
363
- <div class="wp-review-color-options"<?php if ( empty( $custom_colors ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
364
- <div class="wp-review-field vertical">
365
- <div class="wp-review-field-label">
366
- <label for="wp_review_box_template"><?php esc_html_e( 'Default', 'wp-review' ); ?></label>
367
- </div>
368
-
369
- <div class="wp-review-field-option">
370
- <div id="wp_review_box_template_wrapper">
371
- <select name="wp_review_box_template" id="wp_review_box_template">
372
- <?php
373
- foreach ( $review_templates as $key => $value ) {
374
- $disabled = 'default' !== $key && 'aqua' !== $key;
375
- printf(
376
- '<option value="%1$s" %2$s %3$s>%4$s</option>',
377
- esc_attr( $key ),
378
- selected( $key, $box_template, false ),
379
- $disabled ? 'disabled' : '',
380
- esc_html( $value['title'] )
381
- );
382
- }
383
- ?>
384
- </select>
385
-
386
- <div id="wp_review_box_template_preview" style="display: none;">
387
- <img src="#" alt="" id="wp_review_box_template_preview_img">
388
- </div>
389
- </div>
390
-
391
- <div style="margin-top: 10px;">
392
- <img src="<?php echo esc_url( $box_template_img ); ?>" alt="" id="wp_review_box_template_img">
393
- </div>
394
- </div>
395
- </div>
396
-
397
- <div class="wp-review-field"<?php if ( empty( $displayed_fields['color'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
398
- <div class="wp-review-field-label">
399
- <label for="wp_review_color"><?php esc_html_e( 'Review Color', 'wp-review' ); ?></label>
400
- </div>
401
-
402
- <div class="wp-review-field-option">
403
- <input type="text" id="wp_review_color" class="wp-review-color" name="wp_review_color" value="<?php echo esc_attr( $color ); ?>" data-default-color="<?php echo esc_attr( $color ); ?>">
404
- </div>
405
- </div>
406
-
407
- <div class="wp-review-field"<?php if ( empty( $displayed_fields['inactive_color'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
408
- <div class="wp-review-field-label">
409
- <label for="wp_review_inactive_color"><?php esc_html_e( 'Inactive Review Color', 'wp-review' ); ?></label>
410
- </div>
411
-
412
- <div class="wp-review-field-option">
413
- <input type="text" id="wp_review_inactive_color" class="wp-review-color" name="wp_review_inactive_color" value="<?php echo esc_attr( $inactive_color ); ?>" data-default-color="<?php echo esc_attr( $inactive_color ); ?>">
414
- </div>
415
- </div>
416
-
417
- <div class="wp-review-field"<?php if ( empty( $displayed_fields['fontcolor'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
418
- <div class="wp-review-field-label">
419
- <label for="wp_review_fontcolor"><?php esc_html_e( 'Font Color', 'wp-review' ); ?></label>
420
- </div>
421
-
422
- <div class="wp-review-field-option">
423
- <input type="text" class="wp-review-color" name="wp_review_fontcolor" id ="wp_review_fontcolor" value="<?php echo esc_attr( $fontcolor ); ?>" data-default-color="<?php echo esc_attr( $fontcolor ); ?>">
424
- </div>
425
- </div>
426
-
427
- <div class="wp-review-field"<?php if ( empty( $displayed_fields['bgcolor1'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
428
- <div class="wp-review-field-label">
429
- <label for="wp_review_bgcolor1"><?php esc_html_e( 'Heading Background Color', 'wp-review' ); ?></label>
430
- </div>
431
-
432
- <div class="wp-review-field-option">
433
- <input type="text" class="wp-review-color" name="wp_review_bgcolor1" id ="wp_review_bgcolor1" value="<?php echo esc_attr( $bgcolor1 ); ?>" data-default-color="<?php echo esc_attr( $bgcolor1 ); ?>">
434
- </div>
435
- </div>
436
-
437
- <div class="wp-review-field"<?php if ( empty( $displayed_fields['bgcolor2'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
438
- <div class="wp-review-field-label">
439
- <label for="wp_review_bgcolor2"><?php esc_html_e( 'Background Color', 'wp-review' ); ?></label>
440
- </div>
441
-
442
- <div class="wp-review-field-option">
443
- <input type="text" class="wp-review-color" name="wp_review_bgcolor2" id="wp_review_bgcolor2" value="<?php echo esc_attr( $bgcolor2 ); ?>" data-default-color="<?php echo esc_attr( $bgcolor2 ); ?>">
444
- </div>
445
- </div>
446
-
447
- <div class="wp-review-field"<?php if ( empty( $displayed_fields['bordercolor'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
448
- <div class="wp-review-field-label">
449
- <label for="wp_review_bordercolor"><?php esc_html_e( 'Border Color', 'wp-review' ); ?></label>
450
- </div>
451
-
452
- <div class="wp-review-field-option">
453
- <input type="text" class="wp-review-color" name="wp_review_bordercolor" id="wp_review_bordercolor" value="<?php echo esc_attr( $bordercolor ); ?>" data-default-color="<?php echo esc_attr( $bordercolor ); ?>">
454
- </div>
455
- </div>
456
-
457
- <div class="wp-review-field"<?php if ( empty( $displayed_fields['fontfamily'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
458
- <div class="wp-review-field-label">
459
- <label><?php esc_html_e( 'Google Font', 'wp-review' ); ?></label>
460
- <?php wp_review_print_pro_text(); ?>
461
- </div>
462
-
463
- <div class="wp-review-field-option">
464
- <?php
465
- $form_field->render_switch(
466
- array(
467
- 'id' => 'wp_review_fontfamily',
468
- 'name' => 'wp_review_fontfamily',
469
- 'disabled' => true,
470
- )
471
- );
472
- ?>
473
- </div>
474
- </div>
475
- </div>
476
-
477
- <div class="wp-review-field">
478
- <div class="wp-review-field-label">
479
- <label><?php esc_html_e( 'Custom Width', 'wp-review' ); ?></label>
480
- </div>
481
-
482
- <div class="wp-review-field-option">
483
- <?php
484
- $form_field->render_switch(
485
- array(
486
- 'id' => 'wp_review_custom_width',
487
- 'name' => 'wp_review_custom_width',
488
- 'disabled' => true,
489
- )
490
- );
491
- ?>
492
- </div>
493
- </div>
494
- <?php
495
- }
496
-
497
-
498
- /**
499
- * Renders desc meta box.
500
- *
501
- * @param WP_Post $post Post object.
502
- */
503
- function wp_review_render_meta_box_desc( $post ) {
504
-
505
- /* Add an nonce field so we can check for it later. */
506
- wp_nonce_field( basename( __FILE__ ), 'wp-review-desc-nonce' );
507
-
508
- /* Retrieve existing values from the database. */
509
- $desc = get_post_meta( $post->ID, 'wp_review_desc', true );
510
- $desc_title = get_post_meta( $post->ID, 'wp_review_desc_title', true );
511
- if ( ! $desc_title ) {
512
- $desc_title = __( 'Summary', 'wp-review' );
513
- }
514
- $form_field = new WP_Review_Form_Field();
515
- $hidden = wp_review_is_hidden_desc( $post->ID ) ? 'hidden' : '';
516
- ?>
517
- <div id="wp_review_desc_settings" class="<?php echo esc_attr( $hidden ); ?>">
518
- <div class="wp-review-field">
519
- <div class="wp-review-field-label">
520
- <label for="wp_review_desc_title"><?php esc_html_e( 'Description title', 'wp-review' ); ?></label>
521
- </div>
522
-
523
- <div class="wp-review-field-option">
524
- <input type="text" name="wp_review_desc_title" id="wp_review_desc_title" class="large-text" value="<?php echo esc_attr( $desc_title ); ?>">
525
- </div>
526
- </div>
527
-
528
- <div class="wp-review-field vertical wp-review-description">
529
- <div class="wp-review-field-label">
530
- <label for="wp_review_desc"><?php esc_html_e( 'Description content', 'wp-review' ); ?></label>
531
- </div>
532
-
533
- <div class="wp-review-field-option">
534
- <?php
535
- /* Display wp editor field. */
536
- wp_editor(
537
- $desc,
538
- 'wp_review_desc',
539
- array(
540
- 'tinymce' => array(
541
- 'toolbar1' => 'bold,italic,underline,bullist,numlist,separator,separator,link,unlink,undo,redo,removeformat',
542
- 'toolbar2' => '',
543
- 'toolbar3' => '',
544
- ),
545
- 'quicktags' => true,
546
- 'media_buttons' => false,
547
- 'textarea_rows' => 6,
548
- )
549
- );
550
- ?>
551
- </div>
552
- </div>
553
-
554
- <div class="wpr-flex wpr-flex-wrap border-box">
555
- <div class="wpr-col-1-2 pr-10">
556
- <p class="pros-cons-title">
557
- <strong><?php esc_html_e( 'Pros', 'wp-review' ); ?></strong>
558
- <?php wp_review_print_pro_text(); ?>
559
- </p>
560
-
561
- <span class="wp-review-disabled inline-block has-bg">
562
- <?php
563
- /* Display wp editor field. */
564
- wp_editor(
565
- '',
566
- 'wp_review_pros',
567
- array(
568
- 'tinymce' => array(
569
- 'toolbar1' => 'bold,italic,underline,bullist,numlist,separator,separator,link,unlink,undo,redo,removeformat',
570
- 'toolbar2' => '',
571
- 'toolbar3' => '',
572
- ),
573
- 'quicktags' => true,
574
- 'media_buttons' => false,
575
- 'textarea_rows' => 6,
576
- )
577
- );
578
- ?>
579
- </span>
580
- </div>
581
-
582
- <div class="wpr-col-1-2 pl-10">
583
- <p class="pros-cons-title">
584
- <strong><?php esc_html_e( 'Cons', 'wp-review' ); ?></strong>
585
- <?php wp_review_print_pro_text(); ?>
586
- </p>
587
-
588
- <span class="wp-review-disabled inline-block has-bg">
589
- <?php
590
- /* Display wp editor field. */
591
- wp_editor(
592
- '',
593
- 'wp_review_cons',
594
- array(
595
- 'tinymce' => array(
596
- 'toolbar1' => 'bold,italic,underline,bullist,numlist,separator,separator,link,unlink,undo,redo,removeformat',
597
- 'toolbar2' => '',
598
- 'toolbar3' => '',
599
- ),
600
- 'quicktags' => true,
601
- 'media_buttons' => false,
602
- 'textarea_rows' => 6,
603
- )
604
- );
605
- ?>
606
- </span>
607
- </div>
608
- </div>
609
- </div>
610
-
611
- <div class="wp-review-field">
612
- <div class="wp-review-field-label">
613
- <label><?php esc_html_e( 'Hide Description, Pros/Cons & Total Rating', 'wp-review' ); ?></label>
614
- <?php wp_review_print_pro_text(); ?>
615
- </div>
616
-
617
- <div class="wp-review-field-option">
618
- <?php
619
- $form_field->render_switch(
620
- array(
621
- 'id' => 'wp_review_hide_desc',
622
- 'name' => 'wp_review_hide_desc',
623
- 'disabled' => true,
624
- )
625
- );
626
- ?>
627
- </div>
628
- </div>
629
- <?php
630
- }
631
-
632
- /**
633
- * Maps default link texts and urls.
634
- *
635
- * @since 5.0.3 Move this function out of `wp_review_render_meta_box_review_links()`
636
- *
637
- * @param string $text Link text.
638
- * @param string $url Link url.
639
- * @return array
640
- */
641
- function wp_review_get_default_links( $text, $url ) {
642
- return array(
643
- 'text' => $text,
644
- 'url' => $url,
645
- );
646
- }
647
-
648
- /**
649
- * Renders review links meta box.
650
- *
651
- * @param WP_Post $post Post object.
652
- */
653
- function wp_review_render_meta_box_review_links( $post ) {
654
-
655
- wp_nonce_field( basename( __FILE__ ), 'wp-review-links-options-nonce' );
656
-
657
- wp_review_switch_to_main();
658
- $options = get_option( 'wp_review_options' );
659
- if ( is_multisite() ) {
660
- restore_current_blog();
661
- }
662
-
663
- $defaults = array_map(
664
- 'wp_review_get_default_links',
665
- empty( $options['default_link_text'] ) ? array() : $options['default_link_text'],
666
- empty( $options['default_link_url'] ) ? array() : $options['default_link_url']
667
- );
668
-
669
- $items = get_post_meta( $post->ID, 'wp_review_links', true );
670
- if ( ! is_array( $items ) ) {
671
- $items = $defaults;
672
- }
673
- ?>
674
- <table id="wp-review-links" class="wp-review-links" width="100%">
675
-
676
- <thead>
677
- <tr>
678
- <th width="5%"></th>
679
- <th width="45%"><?php esc_html_e( 'Text', 'wp-review' ); ?></th>
680
- <th width="40%"><?php esc_html_e( 'URL', 'wp-review' ); ?></th>
681
- <th width="10%"></th>
682
- </tr>
683
- </thead>
684
-
685
- <tbody>
686
- <?php if ( ! empty( $items ) && ( isset( $items[0] ) && ! empty( $items[0]['text'] ) ) ) : ?>
687
-
688
- <?php foreach ( $items as $item ) { ?>
689
-
690
- <?php if ( ! empty( $item['text'] ) && ! empty( $item['url'] ) ) : ?>
691
- <tr>
692
- <td class="handle">
693
- <span class="dashicons dashicons-menu"></span>
694
- </td>
695
- <td>
696
- <input type="text" class="widefat" name="wp_review_link_title[]" value="<?php echo esc_attr( $item['text'] ); ?>" />
697
- </td>
698
- <td>
699
- <input type="text" class="widefat" name="wp_review_link_url[]" value="<?php echo esc_url( $item['url'] ); ?>" />
700
- </td>
701
- <td><a class="button remove-row" href="#"><?php esc_html_e( 'Delete', 'wp-review' ); ?></a></td>
702
- </tr>
703
- <?php endif; ?>
704
-
705
- <?php } ?>
706
-
707
- <?php else : ?>
708
-
709
- <tr>
710
- <td class="handle"><span class="dashicons dashicons-menu"></span></td>
711
- <td><input type="text" class="widefat" name="wp_review_link_title[]" /></td>
712
- <td><input type="text" class="widefat" name="wp_review_link_url[]" /></td>
713
- <td><a class="button remove-row" href="#"><?php esc_html_e( 'Delete', 'wp-review' ); ?></a></td>
714
- </tr>
715
-
716
- <?php endif; ?>
717
-
718
- <!-- empty hidden one for jQuery -->
719
- <tr class="empty-row screen-reader-text">
720
- <td class="handle"><span class="dashicons dashicons-menu"></span></td>
721
- <td><input type="text" class="widefat focus-on-add" name="wp_review_link_title[]" /></td>
722
- <td><input type="text" class="widefat" name="wp_review_link_url[]" /></td>
723
- <td><a class="button remove-row" href="#"><?php esc_html_e( 'Delete', 'wp-review' ); ?></a></td>
724
- </tr>
725
-
726
- </tbody>
727
-
728
- </table>
729
-
730
- <a class="add-row button" data-target="#wp-review-links" href="#"><?php esc_html_e( 'Add another', 'wp-review' ); ?></a>
731
- <?php
732
- }
733
-
734
- /**
735
- * Renders user review meta box.
736
- *
737
- * @param WP_Post $post Post object.
738
- */
739
- function wp_review_render_meta_box_user_review( $post ) {
740
- /* Add an nonce field so we can check for it later. */
741
- wp_nonce_field( basename( __FILE__ ), 'wp-review-userReview-nonce' );
742
- $enabled = wp_review_get_user_rating_setup( $post->ID );
743
-
744
- $type = get_post_meta( $post->ID, 'wp_review_user_review_type', true );
745
- if ( ! $type ) {
746
- $type = wp_review_option( 'review_type', 'none' );
747
- }
748
-
749
- // $available_types = apply_filters( 'wp_review_metabox_user_rating_types', wp_review_get_review_types( 'user' ) );
750
- $available_types = wp_review_get_rating_types();
751
- $product_price = wp_review_get_product_price( $post->ID );
752
-
753
- $form_field = new WP_Review_Form_Field();
754
- ?>
755
- <div class="wp-review-field no-flex">
756
- <p>
757
- <label>
758
- <input type="radio" name="wp_review_userReview" id="wp-review-userReview-disable" value="<?php echo esc_attr( WP_REVIEW_REVIEW_DISABLED ); ?>" <?php checked( WP_REVIEW_REVIEW_DISABLED, $enabled ); ?>>
759
- <?php esc_html_e( 'Disabled', 'wp-review' ); ?>
760
- </label>
761
- </p>
762
-
763
- <p>
764
- <label>
765
- <input type="radio" name="wp_review_userReview" id="wp-review-userReview-visitor" value="<?php echo esc_attr( WP_REVIEW_REVIEW_VISITOR_ONLY ); ?>" <?php checked( WP_REVIEW_REVIEW_VISITOR_ONLY, $enabled ); ?>>
766
- <?php esc_html_e( 'Visitor Rating Only', 'wp-review' ); ?>
767
- </label>
768
- </p>
769
-
770
- <p>
771
- <label class="wp-review-disabled">
772
- <input type="radio" name="wp_review_userReview" id="wp-review-userReview-comment" value="<?php echo esc_attr( WP_REVIEW_REVIEW_COMMENT_ONLY ); ?>" <?php checked( WP_REVIEW_REVIEW_COMMENT_ONLY, $enabled ); ?> disabled />
773
- <?php esc_html_e( 'Comment Rating Only', 'wp-review' ); ?>
774
- <?php wp_review_print_pro_text( true ); ?>
775
- </label>
776
- </p>
777
-
778
- <p>
779
- <label class="wp-review-disabled">
780
- <input type="radio" name="wp_review_userReview" id="wp-review-userReview-both" value="<?php echo esc_attr( WP_REVIEW_REVIEW_ALLOW_BOTH ); ?>" <?php checked( WP_REVIEW_REVIEW_ALLOW_BOTH, $enabled ); ?> disabled/>
781
- <?php esc_html_e( 'Both', 'wp-review' ); ?>
782
- <?php wp_review_print_pro_text( true ); ?>
783
- </label>
784
- </p>
785
- </div>
786
-
787
- <?php $hidden = WP_REVIEW_REVIEW_DISABLED == $enabled ? 'hidden' : ''; ?>
788
- <div class="show-if-both <?php echo esc_attr( $hidden ); ?>">
789
- <div class="edit-ratings-notice update-nag" style="margin-top: 0;"><?php esc_html_e( 'If you are changing User Rating Type & post already have user ratings, please edit or remove existing ratings.', 'wp-review' ); ?></div>
790
-
791
- <div class="wp-review-field" id="wp_review_rating_type">
792
- <div class="wp-review-field-label">
793
- <label for="rating_type"><?php esc_html_e( 'User Rating Type', 'wp-review' ); ?></label>
794
- </div>
795
-
796
- <div class="wp-review-field-option">
797
- <select name="wp_review_user_review_type" id="rating_type">
798
- <?php
799
- foreach ( $available_types as $key => $available_type ) {
800
- // Skip ones that only have output template.
801
- if ( ! $available_type['user_rating'] ) {
802
- continue;
803
- }
804
-
805
- $disabled = 'circle' === $key || 'thumbs' === $key;
806
- printf(
807
- '<option value="%1$s" class="%2$s" %3$s>%4$s</option>',
808
- esc_attr( $key ),
809
- $disabled ? 'disabled' : '',
810
- selected( $type, $key, false ),
811
- esc_html( $available_type['label'] )
812
- );
813
- }
814
- ?>
815
- </select>
816
- </div>
817
- </div>
818
- </div>
819
-
820
- <?php $hidden = WP_REVIEW_REVIEW_DISABLED == $enabled ? 'hidden' : ''; ?>
821
- <div class="show-if-both <?php echo esc_attr( $hidden ); ?>">
822
- <div class="wp-review-field">
823
- <div class="wp-review-field-label">
824
- <label><?php esc_html_e( 'User can:', 'wp-review' ); ?></label>
825
- <?php wp_review_print_pro_text(); ?>
826
- </div>
827
-
828
- <div class="wp-review-field-option">
829
- <span class="wp-review-disabled inline-block has-bg">
830
- <select name="wp_review_user_can_rate_feature" id="wp_review_user_can_rate_feature" disabled>
831
- <option value=""><?php esc_html_e( 'Give Overall Rating', 'wp-review' ); ?></option>
832
- <option value="1"><?php esc_html_e( 'Rate Each Feature', 'wp-review' ); ?></option>
833
- </select>
834
- </span>
835
- </div>
836
- </div>
837
- </div>
838
-
839
- <?php $hidden = in_array( $enabled, array( WP_REVIEW_REVIEW_DISABLED, WP_REVIEW_REVIEW_COMMENT_ONLY ) ) ? 'hidden' : ''; ?>
840
- <div class="show-if-visitor <?php echo esc_attr( $hidden ); ?>">
841
- <div class="wp-review-field">
842
- <div class="wp-review-field-label">
843
- <label><?php esc_html_e( 'Hide Visitors Rating in Review Box', 'wp-review' ); ?></label>
844
- <?php wp_review_print_pro_text(); ?>
845
- </div>
846
-
847
- <div class="wp-review-field-option">
848
- <?php
849
- $form_field->render_switch(
850
- array(
851
- 'id' => 'wp_review_hide_visitors_rating',
852
- 'name' => 'wp_review_hide_visitors_rating',
853
- 'disabled' => true,
854
- )
855
- );
856
- ?>
857
- </div>
858
- </div>
859
- </div>
860
-
861
- <div class="wp-review-field">
862
- <div class="wp-review-field-label">
863
- <label for="wp_review_product_price"><?php esc_html_e( 'Product Price', 'wp-review' ); ?></label>
864
- </div>
865
-
866
- <div class="wp-review-field-option">
867
- <input type="text" name="wp_review_product_price" id="wp_review_product_price" value="<?php echo esc_attr( $product_price ); ?>">
868
- </div>
869
- </div>
870
-
871
- <div class="wp-review-field">
872
- <div class="wp-review-field-label">
873
- <label for="wp_review_allow_comment_feedback"><?php esc_html_e( 'Comment Feedback (helpful/unhelpful)', 'wp-review' ); ?></label>
874
- <?php wp_review_print_pro_text(); ?>
875
- </div>
876
-
877
- <div class="wp-review-field-option">
878
- <span class="wp-review-disabled inline-block has-bg">
879
- <select name="wp_review_allow_comment_feedback" id="wp_review_allow_comment_feedback" disabled>
880
- <option value=""><?php esc_html_e( 'Use global options', 'wp-review' ); ?></option>
881
- <option value="yes"><?php esc_html_e( 'Yes', 'wp-review' ); ?></option>
882
- <option value="no"><?php esc_html_e( 'No', 'wp-review' ); ?></option>
883
- </select>
884
- </span>
885
- </div>
886
- </div>
887
-
888
- <?php
889
- if ( current_user_can( 'wp_review_purge_visitor_ratings' ) ) {
890
- ?>
891
- <p style="margin-top: 50px;">
892
- <button
893
- type="button"
894
- class="button"
895
- data-remove-ratings
896
- data-type="visitor"
897
- data-processing-text="<?php esc_attr_e( 'Processing...', 'wp-review' ); ?>"
898
- data-post-id="<?php echo intval( $post->ID ); ?>"
899
- ><?php esc_html_e( 'Purge visitor ratings', 'wp-review' ); ?></button>
900
- <span class="description"><?php esc_html_e( 'Click to remove all visitor ratings of this post.', 'wp-review' ); ?></span>
901
- </p>
902
- <?php
903
- }
904
- }
905
-
906
- /**
907
- * Saves the meta box.
908
- *
909
- * @since 1.0
910
- *
911
- * @param int $post_id Post ID.
912
- * @param WP_Post $post Post object.
913
- * @return int
914
- */
915
- function wp_review_save_postdata( $post_id, $post ) {
916
-
917
- /* If this is an autosave, our form has not been submitted, so we don't want to do anything. */
918
- if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
919
- return $post_id;
920
- }
921
-
922
- if ( ! isset( $_POST['wp-review-review-options-nonce'] ) || ! wp_verify_nonce( $_POST['wp-review-review-options-nonce'], 'wp-review-meta-box-options' ) ) {
923
- return $post_id;
924
- }
925
-
926
- $hide_desc = false;
927
- $hide_links = false;
928
- $hide_user_reviews = false;
929
- $hide_review_features = false;
930
-
931
- if ( is_multisite() ) {
932
- $hide_desc = wp_review_network_option( 'hide_review_description_' );
933
- $hide_links = wp_review_network_option( 'hide_review_links_' );
934
- $hide_user_reviews = wp_review_network_option( 'hide_user_reviews_' );
935
- $hide_review_features = wp_review_network_option( 'hide_features_' );
936
- }
937
-
938
- if ( ! $hide_desc && ! current_user_can( 'wp_review_description' ) ) {
939
- $hide_desc = true;
940
- }
941
-
942
- if ( ! $hide_links && ! current_user_can( 'wp_review_links' ) ) {
943
- $hide_links = true;
944
- }
945
-
946
- if ( ! $hide_user_reviews && ! current_user_can( 'wp_review_user_reviews' ) ) {
947
- $hide_user_reviews = true;
948
- }
949
-
950
- if ( ! $hide_review_features && ! current_user_can( 'wp_review_features' ) ) {
951
- $hide_review_features = true;
952
- }
953
-
954
- if ( ! $hide_review_features && ( ! isset( $_POST['wp-review-item-nonce'] ) || ! wp_verify_nonce( $_POST['wp-review-item-nonce'], basename( __FILE__ ) ) ) ) {
955
- return $post_id;
956
- }
957
-
958
- if ( ! $hide_desc && ( ! isset( $_POST['wp-review-desc-nonce'] ) || ! wp_verify_nonce( $_POST['wp-review-desc-nonce'], basename( __FILE__ ) ) ) ) {
959
- return $post_id;
960
- }
961
-
962
- if ( ! $hide_links && ( ! isset( $_POST['wp-review-links-options-nonce'] ) || ! wp_verify_nonce( $_POST['wp-review-links-options-nonce'], basename( __FILE__ ) ) ) ) {
963
- return $post_id;
964
- }
965
-
966
- if ( ! $hide_user_reviews && ( ! isset( $_POST['wp-review-userReview-nonce'] ) || ! wp_verify_nonce( $_POST['wp-review-userReview-nonce'], basename( __FILE__ ) ) ) ) {
967
- return $post_id;
968
- }
969
-
970
- /* Check the user's permissions. */
971
- if ( isset( $_POST['post_type'] ) && 'page' === $_POST['post_type'] ) {
972
- if ( ! current_user_can( 'edit_page', $post_id ) ) {
973
- return $post_id;
974
- }
975
- } else {
976
- if ( ! current_user_can( 'edit_post', $post_id ) ) {
977
- return $post_id;
978
- }
979
- }
980
-
981
- $type = filter_input( INPUT_POST, 'wp_review_type', FILTER_SANITIZE_STRING );
982
- if ( ! $type ) {
983
- $type = wp_review_option( 'review_type', 'none' );
984
- }
985
- update_post_meta( $post_id, 'wp_review_type', $type );
986
- // Do not save review data if never enable it.
987
- if ( 'none' === $type && ! get_post_meta( $post_id, 'wp_review_bgcolor1', true ) ) {
988
- return $post_id;
989
- }
990
-
991
- $meta = array(
992
- 'wp_review_custom_location' => filter_input( INPUT_POST, 'wp_review_custom_location', FILTER_SANITIZE_STRING ),
993
- 'wp_review_custom_colors' => filter_input( INPUT_POST, 'wp_review_custom_colors', FILTER_SANITIZE_STRING ),
994
- 'wp_review_custom_author' => filter_input( INPUT_POST, 'wp_review_custom_author', FILTER_SANITIZE_STRING ),
995
- 'wp_review_location' => filter_input( INPUT_POST, 'wp_review_location', FILTER_SANITIZE_STRING ),
996
- 'wp_review_heading' => filter_input( INPUT_POST, 'wp_review_heading', FILTER_SANITIZE_STRING ),
997
- 'wp_review_desc_title' => filter_input( INPUT_POST, 'wp_review_desc_title', FILTER_SANITIZE_STRING ),
998
- 'wp_review_desc' => ! empty( $_POST['wp_review_desc'] ) ? wp_kses_post( wp_unslash( $_POST['wp_review_desc'] ) ) : '',
999
- 'wp_review_hide_desc' => filter_input( INPUT_POST, 'wp_review_hide_desc', FILTER_SANITIZE_STRING ),
1000
- 'wp_review_userReview' => filter_input( INPUT_POST, 'wp_review_userReview', FILTER_SANITIZE_STRING ),
1001
- 'wp_review_total' => filter_input( INPUT_POST, 'wp_review_total', FILTER_SANITIZE_STRING ),
1002
- 'wp_review_color' => filter_input( INPUT_POST, 'wp_review_color', FILTER_SANITIZE_STRING ),
1003
- 'wp_review_inactive_color' => filter_input( INPUT_POST, 'wp_review_inactive_color', FILTER_SANITIZE_STRING ),
1004
- 'wp_review_fontcolor' => filter_input( INPUT_POST, 'wp_review_fontcolor', FILTER_SANITIZE_STRING ),
1005
- 'wp_review_bgcolor1' => filter_input( INPUT_POST, 'wp_review_bgcolor1', FILTER_SANITIZE_STRING ),
1006
- 'wp_review_bgcolor2' => filter_input( INPUT_POST, 'wp_review_bgcolor2', FILTER_SANITIZE_STRING ),
1007
- 'wp_review_bordercolor' => filter_input( INPUT_POST, 'wp_review_bordercolor', FILTER_SANITIZE_STRING ),
1008
- 'wp_review_author' => filter_input( INPUT_POST, 'wp_review_author', FILTER_SANITIZE_STRING ),
1009
- 'wp_review_schema' => filter_input( INPUT_POST, 'wp_review_schema', FILTER_SANITIZE_STRING ),
1010
- 'wp_review_rating_schema' => filter_input( INPUT_POST, 'wp_review_rating_schema', FILTER_SANITIZE_STRING ),
1011
- 'wp_review_show_schema_data' => filter_input( INPUT_POST, 'wp_review_show_schema_data', FILTER_SANITIZE_STRING ),
1012
- 'wp_review_user_review_type' => filter_input( INPUT_POST, 'wp_review_user_review_type', FILTER_SANITIZE_STRING ),
1013
- 'wp_review_product_price' => filter_input( INPUT_POST, 'wp_review_product_price', FILTER_SANITIZE_STRING ),
1014
- 'wp_review_box_template' => filter_input( INPUT_POST, 'wp_review_box_template', FILTER_SANITIZE_STRING ),
1015
- );
1016
-
1017
- $default_colors = wp_review_get_global_colors();
1018
- $default_color = $default_colors['color'];
1019
- $default_inactive = $default_colors['inactive_color'];
1020
-
1021
- if ( $meta['wp_review_color'] === $default_color ) {
1022
- $meta['wp_review_color'] = '';
1023
- }
1024
-
1025
- if ( $meta['wp_review_inactive_color'] === $default_inactive ) {
1026
- $meta['wp_review_inactive_color'] = '';
1027
- }
1028
-
1029
- foreach ( $meta as $meta_key => $new_meta_value ) {
1030
- $new_meta_value = wp_review_normalize_option_value( $new_meta_value );
1031
-
1032
- if ( false === $new_meta_value ) {
1033
- $new_meta_value = '0';
1034
- }
1035
-
1036
- if ( 'wp_review_box_template' === $meta_key && ! in_array( $new_meta_value, array( 'default', 'aqua' ), true ) ) {
1037
- continue;
1038
- }
1039
-
1040
- if ( current_user_can( 'delete_post_meta', $post_id ) && '' === $new_meta_value ) {
1041
- delete_post_meta( $post_id, $meta_key );
1042
- continue;
1043
- }
1044
-
1045
- if ( current_user_can( 'edit_post_meta', $post_id ) ) {
1046
- update_post_meta( $post_id, $meta_key, $new_meta_value );
1047
- }
1048
- }
1049
-
1050
- wp_review_save_review_items_data( $post_id );
1051
-
1052
- $old = get_post_meta( $post_id, 'wp_review_item', true );
1053
- $link_text = (array) filter_input( INPUT_POST, 'wp_review_link_title', FILTER_SANITIZE_STRING, FILTER_FORCE_ARRAY );
1054
- $link_url = (array) filter_input( INPUT_POST, 'wp_review_link_url', FILTER_SANITIZE_STRING, FILTER_FORCE_ARRAY );
1055
- $new_links = array();
1056
-
1057
- if ( ! empty( $link_text ) ) {
1058
- foreach ( $link_text as $key => $text ) {
1059
- if ( ! empty( $text ) && ! empty( $link_url[ $key ] ) ) {
1060
- $new_links[] = array(
1061
- 'text' => $text,
1062
- 'url' => $link_url[ $key ],
1063
- );
1064
- }
1065
- }
1066
- }
1067
-
1068
- if ( empty( $new_links ) ) {
1069
- delete_post_meta( $post_id, 'wp_review_links' );
1070
- } else {
1071
- update_post_meta( $post_id, 'wp_review_links', $new_links );
1072
- }
1073
- if ( isset( $_POST['wp_review_schema_options'] ) ) {
1074
- update_post_meta( $post_id, 'wp_review_schema_options', $_POST['wp_review_schema_options'] );
1075
- }
1076
-
1077
- /**
1078
- * Delete all data when switched to 'No Review' type.
1079
- */
1080
- if ( 'none' === $type ) {
1081
- delete_post_meta( $post_id, 'wp_review_desc', $_POST['wp_review_desc'] );
1082
- delete_post_meta( $post_id, 'wp_review_heading', $_POST['wp_review_heading'] );
1083
- delete_post_meta( $post_id, 'wp_review_userReview', $_POST['wp_review_userReview'] );
1084
- delete_post_meta( $post_id, 'wp_review_item', $old );
1085
- }
1086
- }
1087
-
1088
- /**
1089
- * Clears transients
1090
- *
1091
- * @param int $post_id Post ID.
1092
- * @param WP_Post $post Post object.
1093
- */
1094
- function wp_review_clear_query_cache( $post_id, $post ) {
1095
- global $wpdb;
1096
- $where = $wpdb->prepare( 'WHERE option_name REGEXP %s', '_transient(_timeout)?_wp_review_[0-9a-f]{32}' );
1097
- $wpdb->query( "DELETE FROM {$wpdb->prefix}options {$where}" ); // WPCS: unprepared SQL ok.
1098
- }
1099
-
1100
- /**
1101
- * Saves review items data.
1102
- *
1103
- * @param int $post_id Post ID.
1104
- */
1105
- function wp_review_save_review_items_data( $post_id ) {
1106
- $old = get_post_meta( $post_id, 'wp_review_item', true );
1107
-
1108
- if ( ! empty( $_POST['wp_review_item_title'] ) ) { // WPCS: csrf ok.
1109
- $title = $_POST['wp_review_item_title']; // WPCS: csrf ok.
1110
- $star = $_POST['wp_review_item_star']; // WPCS: csrf ok.
1111
- $ids = $_POST['wp_review_item_id']; // WPCS: csrf ok.
1112
- $new = array();
1113
-
1114
- $count = count( $title );
1115
-
1116
- for ( $i = 0; $i < $count; $i++ ) {
1117
- if ( empty( $star[ $i ] ) ) {
1118
- continue; // Prevent item without score.
1119
- }
1120
-
1121
- $new[ $i ] = array();
1122
- $new[ $i ]['wp_review_item_star'] = floatval( $star[ $i ] );
1123
-
1124
- if ( ! empty( $ids[ $i ] ) ) {
1125
- $new[ $i ]['id'] = sanitize_text_field( wp_unslash( $ids[ $i ] ) );
1126
- }
1127
-
1128
- if ( ! empty( $title[ $i ] ) ) {
1129
- $new[ $i ]['wp_review_item_title'] = sanitize_text_field( wp_unslash( $title[ $i ] ) );
1130
- }
1131
- }
1132
-
1133
- if ( ! empty( $new ) && $new !== $old ) {
1134
- update_post_meta( $post_id, 'wp_review_item', $new );
1135
- } elseif ( empty( $new ) && $old ) {
1136
- delete_post_meta( $post_id, 'wp_review_item', $old );
1137
- }
1138
- } else {
1139
- delete_post_meta( $post_id, 'wp_review_item' );
1140
- }
1141
- }
1142
-
1143
-
1144
- /**
1145
- * Fix for post previews
1146
- * With this code, the review meta data will actually get saved on Preview.
1147
- *
1148
- * @param array $fields Revision fields.
1149
- * @return array
1150
- */
1151
- function add_field_debug_preview( $fields ) {
1152
- $fields['debug_preview'] = 'debug_preview';
1153
- return $fields;
1154
- }
1155
- add_filter( '_wp_post_revision_fields', 'add_field_debug_preview' );
1156
-
1157
-
1158
- /**
1159
- * Adds input debug preview.
1160
- */
1161
- function add_input_debug_preview() {
1162
- echo '<input type="hidden" name="debug_preview" value="debug_preview">';
1163
- }
1164
- add_action( 'edit_form_after_title', 'add_input_debug_preview' );
1165
-
1166
-
1167
- /**
1168
- * Shows schema field.
1169
- *
1170
- * @param array $args Args.
1171
- * @param array $value Schema value.
1172
- * @param string $schema_type Schema type.
1173
- */
1174
- function wp_review_schema_field( $args, $value, $schema_type ) {
1175
- $type = isset( $args['type'] ) ? $args['type'] : '';
1176
- $name = isset( $args['name'] ) ? $args['name'] : '';
1177
- $label = isset( $args['label'] ) ? $args['label'] : '';
1178
- $options = isset( $args['options'] ) ? $args['options'] : array();
1179
- $default = isset( $args['default'] ) ? $args['default'] : '';
1180
- $min = isset( $args['min'] ) ? $args['min'] : '0';
1181
- $max = isset( $args['max'] ) ? $args['max'] : '';
1182
- $info = isset( $args['info'] ) ? $args['info'] : '';
1183
-
1184
- // Option value.
1185
- $opt_val = isset( $value[ $name ] ) ? $value[ $name ] : $default;
1186
- $opt_id_attr = 'wp_review_schema_options_' . $schema_type . '_' . $name;
1187
- $opt_name_attr = 'wp_review_schema_options[' . $schema_type . '][' . $name . ']';
1188
-
1189
- $form_field = new WP_Review_Form_Field();
1190
- ?>
1191
- <div class="wp-review-field-label">
1192
- <label for="<?php echo esc_attr( $opt_id_attr ); ?>" class="wp_review_schema_options_label"><?php echo esc_html( $label ); ?></label>
1193
- </div>
1194
-
1195
- <div class="wp-review-field-option">
1196
- <?php
1197
- switch ( $type ) {
1198
- case 'text':
1199
- ?>
1200
- <input type="text" name="<?php echo esc_attr( $opt_name_attr ); ?>" id="<?php echo esc_attr( $opt_id_attr ); ?>" value="<?php echo esc_attr( $opt_val ); ?>" />
1201
- <?php
1202
- break;
1203
-
1204
- case 'select':
1205
- ?>
1206
- <select name="<?php echo esc_attr( $opt_name_attr ); ?>" id="<?php echo esc_attr( $opt_id_attr ); ?>">
1207
- <?php foreach ( $options as $val => $label ) { ?>
1208
- <option value="<?php echo esc_attr( $val ); ?>" <?php selected( $opt_val, $val, true ); ?>><?php echo esc_html( $label ); ?></option>
1209
- <?php } ?>
1210
- </select>
1211
- <?php
1212
- break;
1213
-
1214
- case 'number':
1215
- ?>
1216
- <input type="number" step="1" min="<?php echo esc_attr( $min ); ?>" max="<?php echo esc_attr( $max ); ?>" name="<?php echo esc_attr( $opt_name_attr ); ?>" id="<?php echo esc_attr( $opt_id_attr ); ?>" value="<?php echo esc_attr( $opt_val ); ?>" class="small-text">
1217
- <?php
1218
- break;
1219
-
1220
- case 'textarea':
1221
- ?>
1222
- <textarea name="<?php echo esc_attr( $opt_name_attr ); ?>" id="<?php echo esc_attr( $opt_id_attr ); ?>"><?php echo esc_textarea( $opt_val ); ?></textarea>
1223
- <?php
1224
- break;
1225
-
1226
- case 'checkbox':
1227
- ?>
1228
- <input type="checkbox" name="<?php echo esc_attr( $opt_name_attr ); ?>" id="<?php echo esc_attr( $opt_id_attr ); ?>" value="1" <?php checked( $opt_val, '1', true ); ?> />
1229
- <?php
1230
- break;
1231
-
1232
- case 'image':
1233
- ?>
1234
- <span class="wpr_image_upload_field">
1235
- <span class="clearfix" id="<?php echo esc_attr( $opt_id_attr ); ?>-preview">
1236
- <?php
1237
- if ( ! empty( $opt_val['url'] ) ) {
1238
- echo '<img class="wpr_image_upload_img" src="' . esc_url( $opt_val['url'] ) . '" />';
1239
- }
1240
- ?>
1241
- </span>
1242
- <input type="hidden" id="<?php echo esc_attr( $opt_id_attr ); ?>-id" name="<?php echo esc_attr( $opt_name_attr ); ?>[id]" value="<?php if ( isset( $opt_val['id'] ) ) echo $opt_val['id']; // phpcs:ignore ?>" />
1243
- <input type="hidden" id="<?php echo esc_attr( $opt_id_attr ); ?>-url" name="<?php echo esc_attr( $opt_name_attr ); ?>[url]" value="<?php if ( isset( $opt_val['url'] ) ) echo $opt_val['url']; // phpcs:ignore ?>" />
1244
- <button class="button" name="<?php echo esc_attr( $opt_id_attr ); ?>-upload" id="<?php echo esc_attr( $opt_id_attr ); ?>-upload" data-id="<?php echo esc_attr( $opt_id_attr ); ?>" onclick="wprImageField.uploader( '<?php echo esc_attr( $opt_id_attr ); ?>' ); return false;"><?php esc_html_e( 'Select Image', 'wp-review' ); ?></button>
1245
- <?php
1246
- if ( ! empty( $opt_val['url'] ) ) {
1247
- echo '<a href="#" class="button button-link clear-image">' . esc_html__( 'Remove Image', 'wp-review' ) . '</a>';
1248
- }
1249
- ?>
1250
- <span class="clear"></span>
1251
- </span>
1252
- <?php
1253
- break;
1254
-
1255
- case 'date':
1256
- ?>
1257
- <input class="wpr-datepicker" type="text" name="<?php echo esc_attr( $opt_name_attr ); ?>" id="<?php echo esc_attr( $opt_id_attr ); ?>" value="<?php echo esc_attr( $opt_val ); ?>" size="30" />
1258
- <?php
1259
- break;
1260
-
1261
- case 'switch':
1262
- $field_args = array(
1263
- 'id' => $opt_id_attr,
1264
- 'name' => $opt_name_attr,
1265
- 'value' => $opt_val,
1266
- );
1267
- if ( ! empty( $args['on_label'] ) ) {
1268
- $field_args['on_label'] = $args['on_label'];
1269
- }
1270
- if ( ! empty( $args['off_label'] ) ) {
1271
- $field_args['off_label'] = $args['off_label'];
1272
- }
1273
- $form_field->render_switch( $field_args );
1274
- break;
1275
- }
1276
-
1277
- if ( ! empty( $info ) ) {
1278
- printf( '<p class="description" style="color: #bbb">%s</p>', wp_kses_post( $info ) );
1279
- }
1280
- ?>
1281
- </div>
1282
- <?php
1283
- }
1
+ <?php
2
+ /**
3
+ * File for registering meta box.
4
+ *
5
+ * @since 2.0
6
+ * @copyright Copyright (c) 2013, MyThemesShop
7
+ * @author MyThemesShop
8
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9
+ * @package WP_Review
10
+ */
11
+
12
+ /* Adds a box to the Posts edit screens. */
13
+ add_action( 'add_meta_boxes', 'wp_review_add_meta_boxes' );
14
+
15
+ /* Saves the meta box custom data. */
16
+ add_action( 'save_post', 'wp_review_save_postdata', 10, 2 );
17
+ add_action( 'save_post', 'wp_review_clear_query_cache', 10, 2 );
18
+
19
+ require_once plugin_dir_path( __FILE__ ) . 'review-options-meta-box.php';
20
+
21
+ /**
22
+ * Adds a box to the Post edit screens.
23
+ *
24
+ * @since 1.0
25
+ */
26
+ function wp_review_add_meta_boxes() {
27
+ $post_types = get_post_types( array( 'public' => true ), 'names' );
28
+ $excluded_post_types = apply_filters( 'wp_review_excluded_post_types', array( 'attachment' ) );
29
+ $hide_review_box = wp_review_network_option( 'hide_ratings_in_posts_' );
30
+ $hide_review_links = wp_review_network_option( 'hide_review_links_' );
31
+ $hide_review_desc = wp_review_network_option( 'hide_review_description_' );
32
+ $hide_review_features = wp_review_network_option( 'hide_features_' );
33
+ $hide_user_reviews = wp_review_network_option( 'hide_user_reviews_' );
34
+
35
+ if ( ! $hide_review_box && current_user_can( 'wp_review_single_page' ) ) {
36
+ foreach ( $post_types as $post_type ) {
37
+ if ( ! in_array( $post_type, $excluded_post_types, true ) ) {
38
+ add_meta_box(
39
+ 'wp-review-metabox-review',
40
+ __( 'Review', 'wp-review' ),
41
+ 'wp_review_render_meta_box_review_options',
42
+ $post_type,
43
+ 'normal',
44
+ 'high'
45
+ );
46
+
47
+ if ( ! $hide_review_features && current_user_can( 'wp_review_features' ) ) {
48
+ add_meta_box(
49
+ 'wp-review-metabox-item',
50
+ __( 'Review Item', 'wp-review' ),
51
+ 'wp_review_render_meta_box_item',
52
+ $post_type,
53
+ 'normal',
54
+ 'high'
55
+ );
56
+ }
57
+
58
+ if ( ! $hide_review_links && current_user_can( 'wp_review_links' ) ) {
59
+ add_meta_box(
60
+ 'wp-review-metabox-reviewLinks',
61
+ __( 'Review Links', 'wp-review' ),
62
+ 'wp_review_render_meta_box_review_links',
63
+ $post_type,
64
+ 'normal',
65
+ 'high'
66
+ );
67
+ }
68
+ if ( ! $hide_review_desc && current_user_can( 'wp_review_description' ) ) {
69
+ add_meta_box(
70
+ 'wp-review-metabox-desc',
71
+ __( 'Review Description', 'wp-review' ),
72
+ 'wp_review_render_meta_box_desc',
73
+ $post_type,
74
+ 'normal',
75
+ 'high'
76
+ );
77
+ }
78
+
79
+ if ( ! $hide_user_reviews && current_user_can( 'wp_review_user_reviews' ) ) {
80
+ add_meta_box(
81
+ 'wp-review-metabox-userReview',
82
+ __( 'User Reviews', 'wp-review' ),
83
+ 'wp_review_render_meta_box_user_review',
84
+ $post_type,
85
+ 'normal',
86
+ 'high'
87
+ );
88
+ }
89
+ }
90
+ }
91
+ }
92
+
93
+ }
94
+
95
+ /**
96
+ * Render the meta box.
97
+ *
98
+ * @since 1.0
99
+ *
100
+ * @param WP_Post $post Post object.
101
+ */
102
+ function wp_review_render_meta_box_item( $post ) {
103
+ $form_field = new WP_Review_Form_Field();
104
+ $options = get_option( 'wp_review_options' );
105
+ $default_location = wp_review_get_default_location();
106
+ $default_criteria = wp_review_get_default_criteria();
107
+
108
+ $default_items = array();
109
+ foreach ( $default_criteria as $index => $item ) {
110
+ if ( empty( $item ) ) {
111
+ continue;
112
+ }
113
+ $default_items[ $index ] = array(
114
+ 'id' => $index,
115
+ 'wp_review_item_title' => $item,
116
+ 'wp_review_item_star' => '',
117
+ );
118
+ }
119
+
120
+ $global_colors = wp_review_get_global_colors();
121
+ $global_color = $global_colors['color'];
122
+ $global_inactive_color = $global_colors['inactive_color'];
123
+
124
+ /* Retrieve an existing value from the database. */
125
+ $custom_colors = get_post_meta( $post->ID, 'wp_review_custom_colors', true );
126
+ $custom_location = get_post_meta( $post->ID, 'wp_review_custom_location', true );
127
+
128
+ $items = wp_review_get_review_items( $post->ID );
129
+ if ( '' === $items ) {
130
+ $items = $default_items;
131
+ }
132
+ $items = array_values( $items );
133
+
134
+ $total = get_post_meta( $post->ID, 'wp_review_total', true );
135
+
136
+ $post_color = get_post_meta( $post->ID, 'wp_review_color', true );
137
+ $post_inactive_color = get_post_meta( $post->ID, 'wp_review_inactive_color', true );
138
+ $color = $post_color;
139
+ $inactive_color = $post_inactive_color;
140
+
141
+ $location = get_post_meta( $post->ID, 'wp_review_location', true );
142
+ $fontcolor = get_post_meta( $post->ID, 'wp_review_fontcolor', true );
143
+ $bgcolor1 = get_post_meta( $post->ID, 'wp_review_bgcolor1', true );
144
+ $bgcolor2 = get_post_meta( $post->ID, 'wp_review_bgcolor2', true );
145
+ $bordercolor = get_post_meta( $post->ID, 'wp_review_bordercolor', true );
146
+
147
+ if ( ! $color ) {
148
+ $color = $global_color;
149
+ }
150
+ if ( ! $inactive_color ) {
151
+ $inactive_color = $global_inactive_color;
152
+ }
153
+
154
+ if ( '' === $location ) {
155
+ $location = ! empty( $options['location'] ) ? $options['location'] : $default_location;
156
+ }
157
+ if ( '' === $fontcolor ) {
158
+ $fontcolor = $global_colors['fontcolor'];
159
+ }
160
+ if ( '' === $bgcolor1 ) {
161
+ $bgcolor1 = $global_colors['bgcolor1'];
162
+ }
163
+ if ( '' === $bgcolor2 ) {
164
+ $bgcolor2 = $global_colors['bgcolor2'];
165
+ }
166
+ if ( '' === $bordercolor ) {
167
+ $bordercolor = $global_colors['bordercolor'];
168
+ }
169
+
170
+ $fields = array(
171
+ 'location' => true,
172
+ 'color' => true,
173
+ 'inactive_color' => true,
174
+ 'fontcolor' => true,
175
+ 'bgcolor1' => true,
176
+ 'bgcolor2' => true,
177
+ 'bordercolor' => true,
178
+ 'fontfamily' => true,
179
+ 'custom_colors' => true,
180
+ 'custom_location' => true,
181
+ 'disable_features' => true,
182
+ );
183
+ $displayed_fields = apply_filters( 'wp_review_metabox_item_fields', $fields );
184
+
185
+ $review_templates = wp_review_get_box_templates();
186
+ $box_template = get_post_meta( $post->ID, 'wp_review_box_template', true );
187
+
188
+ if ( ! $box_template || ! in_array( $box_template, array( 'default', 'aqua' ), true ) ) {
189
+ $box_template = wp_review_option( 'box_template', 'default' );
190
+ }
191
+ $box_template_img = ! empty( $review_templates[ $box_template ] ) ? $review_templates[ $box_template ]['image'] : WP_REVIEW_ASSETS . 'images/largethumb.png';
192
+
193
+ /* Add an nonce field so we can check for it later. */
194
+ wp_nonce_field( basename( __FILE__ ), 'wp-review-item-nonce' );
195
+ ?>
196
+ <input type="hidden" id="wpr-review-color-value" value="<?php echo esc_attr( $color ); ?>">
197
+ <input type="hidden" id="wpr-review-inactive-color-value" value="<?php echo esc_attr( $inactive_color ); ?>">
198
+ <input type="hidden" id="wpr-review-global-color-value" value="<?php echo esc_attr( $global_color ); ?>">
199
+ <input type="hidden" id="wpr-review-global-inactive-color-value" value="<?php echo esc_attr( $global_inactive_color ); ?>">
200
+ <input type="hidden" id="wpr-review-items-data" value="<?php echo esc_attr( wp_json_encode( $items ) ); ?>">
201
+
202
+ <div id="wpr-review-items-app">
203
+ <input type="hidden" id="wpr-review-type-2" value="">
204
+ <div class="wpr-review-items"></div>
205
+
206
+ <div class="setting-row final-row" style="padding-right: 10px;">
207
+ <div class="col-1">
208
+ <button type="button" class="button add-item"><?php esc_html_e( 'Add item', 'wp-review' ); ?></button>
209
+ </div>
210
+ <div class="col-2"></div>
211
+ <div class="col-3">
212
+ <div class="wpr-review-items-total">
213
+ <input type="text" class="input-total" name="wp_review_total" value="<?php echo floatval( $total ); ?>" size="4">
214
+ <label><?php esc_html_e( 'Total', 'wp-review' ); ?></label>
215
+ </div>
216
+ </div>
217
+ </div>
218
+ </div>
219
+
220
+ <script type="text/html" id="tmpl-wpr-review-item">
221
+ <span class="wpr-icon-move dashicons dashicons-menu"></span>
222
+
223
+ {{{ data.itemNameSetting }}}
224
+
225
+ {{{ data.itemRatingSetting }}}
226
+
227
+ {{{ data.itemColorSetting }}}
228
+
229
+ {{{ data.itemInactiveColorSetting }}}
230
+
231
+ <input type="hidden" name="wp_review_item_id[]" value="{{ data.item_id }}">
232
+
233
+ <button type="button" class="button delete-item"><?php esc_html_e( 'Delete', 'wp-review' ); ?></button>
234
+ </script>
235
+
236
+ <script type="text/html" id="tmpl-wpr-review-item-name">
237
+ <div class="setting-row">
238
+ <div class="col-1">
239
+ <label for="wpr-review-item-title-{{ data.id }}"><?php esc_html_e( 'Feature Name', 'wp-review' ); ?></label>
240
+ </div>
241
+ <div class="col-2">
242
+ <input type="text" id="wpr-review-item-title-{{ data.id }}" name="wp_review_item_title[]" class="input-title" value="{{ data.wp_review_item_title }}">
243
+ </div>
244
+ </div>
245
+ </script>
246
+
247
+ <script type="text/html" id="tmpl-wpr-review-item-color">
248
+ <div class="setting-row">
249
+ <div class="wp-review-disabled col-1">
250
+ <label for="wpr-review-item-color-{{ data.id }}"><?php esc_html_e( 'Feature Color', 'wp-review' ); ?></label>
251
+ <?php wp_review_print_pro_text(); ?>
252
+ </div>
253
+ <div class="col-2">
254
+ <span class="wp-review-disabled inline-block has-bg">
255
+ <input type="text" id="wpr-review-item-color-{{ data.id }}" name="wp_review_item_color[]" class="input-color" value="{{ data.wp_review_item_color }}" data-default-color="{{ data.wp_review_item_color }}" disabled>
256
+ </span>
257
+ </div>
258
+ </div>
259
+ </script>
260
+
261
+ <script type="text/html" id="tmpl-wpr-review-item-inactive-color">
262
+ <div class="setting-row">
263
+ <div class="wp-review-disabled col-1">
264
+ <label for="wpr-review-item-inactive-color-{{ data.id }}"><?php esc_html_e( 'Inactive Color', 'wp-review' ); ?></label>
265
+ <?php wp_review_print_pro_text(); ?>
266
+ </div>
267
+ <div class="col-2">
268
+ <span class="wp-review-disabled inline-block has-bg">
269
+ <input type="text" id="wpr-review-item-inactive-color-{{ data.id }}" name="wp_review_item_inactive_color[]" class="input-inactive-color" value="{{ data.wp_review_item_inactive_color }}" data-default-color="{{ data.wp_review_item_inactive_color }}" disabled>
270
+ </span>
271
+ </div>
272
+ </div>
273
+ </script>
274
+
275
+ <script type="text/html" id="tmpl-wpr-review-item-rating">
276
+ <div class="setting-row">
277
+ <div class="col-1">
278
+ <label for="wpr-review-item-star-{{ data.id }}"><?php esc_html_e( 'Feature Score', 'wp-review' ); ?></label>
279
+ </div>
280
+ <div class="col-2">
281
+ <input type="text" id="wpr-review-item-star-{{ data.id }}" name="wp_review_item_star[]" class="input-star" value="{{ data.wp_review_item_star }}" data-type="{{ data.type }}" data-color="{{ data.wp_review_item_color }}" data-inactive-color="{{ data.wp_review_item_inactive_color }}" size="4">
282
+ </div>
283
+ <div class="col-3"></div>
284
+ </div>
285
+ </script>
286
+
287
+ <div class="wp-review-field"<?php if ( empty( $displayed_fields['disable_features'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
288
+ <div class="wp-review-disabled wp-review-field-label">
289
+ <label><?php esc_html_e( 'Hide Features', 'wp-review' ); ?></label>
290
+ <?php wp_review_print_pro_text(); ?>
291
+ </div>
292
+
293
+ <div class="wp-review-field-option">
294
+ <?php
295
+ $form_field->render_switch(
296
+ array(
297
+ 'id' => 'wp_review_disable_features',
298
+ 'name' => 'wp_review_disable_features',
299
+ 'disabled' => true,
300
+ )
301
+ );
302
+ ?>
303
+ </div>
304
+ </div>
305
+ <div class="wp-review-field"<?php if ( empty( $displayed_fields['custom_location'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
306
+ <div class="wp-review-field-label">
307
+ <label><?php esc_html_e( 'Custom Location', 'wp-review' ); ?></label>
308
+ </div>
309
+
310
+ <div class="wp-review-field-option">
311
+ <?php
312
+ $form_field->render_switch(
313
+ array(
314
+ 'id' => 'wp_review_custom_location',
315
+ 'name' => 'wp_review_custom_location',
316
+ 'value' => $custom_location,
317
+ )
318
+ );
319
+ ?>
320
+ </div>
321
+ </div>
322
+
323
+ <div class="wp-review-location-options"<?php if ( empty( $custom_location ) || empty( $displayed_fields['location'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
324
+ <div class="wp-review-field">
325
+ <div class="wp-review-field-label">
326
+ <label for="wp_review_location"><?php esc_html_e( 'Review Location', 'wp-review' ); ?></label>
327
+ </div>
328
+
329
+ <div class="wp-review-field-option">
330
+ <select name="wp_review_location" id="wp_review_location">
331
+ <option value="bottom" <?php selected( $location, 'bottom' ); ?>><?php esc_html_e( 'After Content', 'wp-review' ); ?></option>
332
+ <option value="top" <?php selected( $location, 'top' ); ?>><?php esc_html_e( 'Before Content', 'wp-review' ); ?></option>
333
+ <option value="custom" <?php selected( $location, 'custom' ); ?>><?php esc_html_e( 'Custom (use shortcode)', 'wp-review' ); ?></option>
334
+ </select>
335
+
336
+ <p id="wp_review_shortcode_hint_field">
337
+ <!-- <label for="wp_review_shortcode_hint"></label> -->
338
+ <input id="wp_review_shortcode_hint" type="text" value='[wp-review id="<?php echo intval( trim( $post->ID ) ); ?>"]' readonly="readonly" />
339
+ <span class="description"><?php esc_html_e( 'Copy &amp; paste this shortcode in the content.', 'wp-review' ); ?></span>
340
+ </p>
341
+ </div>
342
+ </div>
343
+ </div>
344
+
345
+ <div class="wp-review-field"<?php if ( empty( $displayed_fields['custom_colors'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
346
+ <div class="wp-review-field-label">
347
+ <label><?php esc_html_e( 'Custom Layout', 'wp-review' ); ?></label>
348
+ </div>
349
+
350
+ <div class="wp-review-field-option">
351
+ <?php
352
+ $form_field->render_switch(
353
+ array(
354
+ 'id' => 'wp_review_custom_colors',
355
+ 'name' => 'wp_review_custom_colors',
356
+ 'value' => $custom_colors,
357
+ )
358
+ );
359
+ ?>
360
+ </div>
361
+ </div>
362
+
363
+ <div class="wp-review-color-options"<?php if ( empty( $custom_colors ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
364
+ <div class="wp-review-field vertical">
365
+ <div class="wp-review-field-label">
366
+ <label for="wp_review_box_template"><?php esc_html_e( 'Default', 'wp-review' ); ?></label>
367
+ </div>
368
+
369
+ <div class="wp-review-field-option">
370
+ <div id="wp_review_box_template_wrapper">
371
+ <select name="wp_review_box_template" id="wp_review_box_template">
372
+ <?php
373
+ foreach ( $review_templates as $key => $value ) {
374
+ $disabled = 'default' !== $key && 'aqua' !== $key;
375
+ printf(
376
+ '<option value="%1$s" %2$s %3$s>%4$s</option>',
377
+ esc_attr( $key ),
378
+ selected( $key, $box_template, false ),
379
+ $disabled ? 'disabled' : '',
380
+ esc_html( $value['title'] )
381
+ );
382
+ }
383
+ ?>
384
+ </select>
385
+
386
+ <div id="wp_review_box_template_preview" style="display: none;">
387
+ <img src="#" alt="" id="wp_review_box_template_preview_img">
388
+ </div>
389
+ </div>
390
+
391
+ <div style="margin-top: 10px;">
392
+ <img src="<?php echo esc_url( $box_template_img ); ?>" alt="" id="wp_review_box_template_img">
393
+ </div>
394
+ </div>
395
+ </div>
396
+
397
+ <div class="wp-review-field"<?php if ( empty( $displayed_fields['color'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
398
+ <div class="wp-review-field-label">
399
+ <label for="wp_review_color"><?php esc_html_e( 'Review Color', 'wp-review' ); ?></label>
400
+ </div>
401
+
402
+ <div class="wp-review-field-option">
403
+ <input type="text" id="wp_review_color" class="wp-review-color" name="wp_review_color" value="<?php echo esc_attr( $color ); ?>" data-default-color="<?php echo esc_attr( $color ); ?>">
404
+ </div>
405
+ </div>
406
+
407
+ <div class="wp-review-field"<?php if ( empty( $displayed_fields['inactive_color'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
408
+ <div class="wp-review-field-label">
409
+ <label for="wp_review_inactive_color"><?php esc_html_e( 'Inactive Review Color', 'wp-review' ); ?></label>
410
+ </div>
411
+
412
+ <div class="wp-review-field-option">
413
+ <input type="text" id="wp_review_inactive_color" class="wp-review-color" name="wp_review_inactive_color" value="<?php echo esc_attr( $inactive_color ); ?>" data-default-color="<?php echo esc_attr( $inactive_color ); ?>">
414
+ </div>
415
+ </div>
416
+
417
+ <div class="wp-review-field"<?php if ( empty( $displayed_fields['fontcolor'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
418
+ <div class="wp-review-field-label">
419
+ <label for="wp_review_fontcolor"><?php esc_html_e( 'Font Color', 'wp-review' ); ?></label>
420
+ </div>
421
+
422
+ <div class="wp-review-field-option">
423
+ <input type="text" class="wp-review-color" name="wp_review_fontcolor" id ="wp_review_fontcolor" value="<?php echo esc_attr( $fontcolor ); ?>" data-default-color="<?php echo esc_attr( $fontcolor ); ?>">
424
+ </div>
425
+ </div>
426
+
427
+ <div class="wp-review-field"<?php if ( empty( $displayed_fields['bgcolor1'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
428
+ <div class="wp-review-field-label">
429
+ <label for="wp_review_bgcolor1"><?php esc_html_e( 'Heading Background Color', 'wp-review' ); ?></label>
430
+ </div>
431
+
432
+ <div class="wp-review-field-option">
433
+ <input type="text" class="wp-review-color" name="wp_review_bgcolor1" id ="wp_review_bgcolor1" value="<?php echo esc_attr( $bgcolor1 ); ?>" data-default-color="<?php echo esc_attr( $bgcolor1 ); ?>">
434
+ </div>
435
+ </div>
436
+
437
+ <div class="wp-review-field"<?php if ( empty( $displayed_fields['bgcolor2'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
438
+ <div class="wp-review-field-label">
439
+ <label for="wp_review_bgcolor2"><?php esc_html_e( 'Background Color', 'wp-review' ); ?></label>
440
+ </div>
441
+
442
+ <div class="wp-review-field-option">
443
+ <input type="text" class="wp-review-color" name="wp_review_bgcolor2" id="wp_review_bgcolor2" value="<?php echo esc_attr( $bgcolor2 ); ?>" data-default-color="<?php echo esc_attr( $bgcolor2 ); ?>">
444
+ </div>
445
+ </div>
446
+
447
+ <div class="wp-review-field"<?php if ( empty( $displayed_fields['bordercolor'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
448
+ <div class="wp-review-field-label">
449
+ <label for="wp_review_bordercolor"><?php esc_html_e( 'Border Color', 'wp-review' ); ?></label>
450
+ </div>
451
+
452
+ <div class="wp-review-field-option">
453
+ <input type="text" class="wp-review-color" name="wp_review_bordercolor" id="wp_review_bordercolor" value="<?php echo esc_attr( $bordercolor ); ?>" data-default-color="<?php echo esc_attr( $bordercolor ); ?>">
454
+ </div>
455
+ </div>
456
+
457
+ <div class="wp-review-field"<?php if ( empty( $displayed_fields['fontfamily'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
458
+ <div class="wp-review-disabled wp-review-field-label">
459
+ <label><?php esc_html_e( 'Google Font', 'wp-review' ); ?></label>
460
+ <?php wp_review_print_pro_text(); ?>
461
+ </div>
462
+
463
+ <div class="wp-review-field-option">
464
+ <?php
465
+ $form_field->render_switch(
466
+ array(
467
+ 'id' => 'wp_review_fontfamily',
468
+ 'name' => 'wp_review_fontfamily',
469
+ 'disabled' => true,
470
+ )
471
+ );
472
+ ?>
473
+ </div>
474
+ </div>
475
+ </div>
476
+
477
+ <div class="wp-review-field">
478
+ <div class="wp-review-field-label">
479
+ <label><?php esc_html_e( 'Custom Width', 'wp-review' ); ?></label>
480
+ </div>
481
+
482
+ <div class="wp-review-field-option">
483
+ <?php
484
+ $form_field->render_switch(
485
+ array(
486
+ 'id' => 'wp_review_custom_width',
487
+ 'name' => 'wp_review_custom_width',
488
+ 'disabled' => true,
489
+ )
490
+ );
491
+ ?>
492
+ </div>
493
+ </div>
494
+ <?php
495
+ }
496
+
497
+
498
+ /**
499
+ * Renders desc meta box.
500
+ *
501
+ * @param WP_Post $post Post object.
502
+ */
503
+ function wp_review_render_meta_box_desc( $post ) {
504
+
505
+ /* Add an nonce field so we can check for it later. */
506
+ wp_nonce_field( basename( __FILE__ ), 'wp-review-desc-nonce' );
507
+
508
+ /* Retrieve existing values from the database. */
509
+ $desc = get_post_meta( $post->ID, 'wp_review_desc', true );
510
+ $desc_title = get_post_meta( $post->ID, 'wp_review_desc_title', true );
511
+ if ( ! $desc_title ) {
512
+ $desc_title = __( 'Summary', 'wp-review' );
513
+ }
514
+ $form_field = new WP_Review_Form_Field();
515
+ $hidden = wp_review_is_hidden_desc( $post->ID ) ? 'hidden' : '';
516
+ ?>
517
+ <div id="wp_review_desc_settings" class="<?php echo esc_attr( $hidden ); ?>">
518
+ <div class="wp-review-field">
519
+ <div class="wp-review-field-label">
520
+ <label for="wp_review_desc_title"><?php esc_html_e( 'Description title', 'wp-review' ); ?></label>
521
+ </div>
522
+
523
+ <div class="wp-review-field-option">
524
+ <input type="text" name="wp_review_desc_title" id="wp_review_desc_title" class="large-text" value="<?php echo esc_attr( $desc_title ); ?>">
525
+ </div>
526
+ </div>
527
+
528
+ <div class="wp-review-field vertical wp-review-description">
529
+ <div class="wp-review-field-label">
530
+ <label for="wp_review_desc"><?php esc_html_e( 'Description content', 'wp-review' ); ?></label>
531
+ </div>
532
+
533
+ <div class="wp-review-field-option">
534
+ <?php
535
+ /* Display wp editor field. */
536
+ wp_editor(
537
+ $desc,
538
+ 'wp_review_desc',
539
+ array(
540
+ 'tinymce' => array(
541
+ 'toolbar1' => 'bold,italic,underline,bullist,numlist,separator,separator,link,unlink,undo,redo,removeformat',
542
+ 'toolbar2' => '',
543
+ 'toolbar3' => '',
544
+ ),
545
+ 'quicktags' => true,
546
+ 'media_buttons' => false,
547
+ 'textarea_rows' => 6,
548
+ )
549
+ );
550
+ ?>
551
+ </div>
552
+ </div>
553
+
554
+ <div class="wpr-flex wpr-flex-wrap border-box">
555
+ <div class="wpr-col-1-2 pr-10">
556
+ <p class="wp-review-disabled pros-cons-title">
557
+ <strong><?php esc_html_e( 'Pros', 'wp-review' ); ?></strong>
558
+ <?php wp_review_print_pro_text(); ?>
559
+ </p>
560
+
561
+ <span class="wp-review-disabled inline-block has-bg">
562
+ <?php
563
+ /* Display wp editor field. */
564
+ wp_editor(
565
+ '',
566
+ 'wp_review_pros',
567
+ array(
568
+ 'tinymce' => array(
569
+ 'toolbar1' => 'bold,italic,underline,bullist,numlist,separator,separator,link,unlink,undo,redo,removeformat',
570
+ 'toolbar2' => '',
571
+ 'toolbar3' => '',
572
+ ),
573
+ 'quicktags' => true,
574
+ 'media_buttons' => false,
575
+ 'textarea_rows' => 6,
576
+ )
577
+ );
578
+ ?>
579
+ </span>
580
+ </div>
581
+
582
+ <div class="wpr-col-1-2 pl-10">
583
+ <p class="wp-review-disabled pros-cons-title">
584
+ <strong><?php esc_html_e( 'Cons', 'wp-review' ); ?></strong>
585
+ <?php wp_review_print_pro_text(); ?>
586
+ </p>
587
+
588
+ <span class="wp-review-disabled inline-block has-bg">
589
+ <?php
590
+ /* Display wp editor field. */
591
+ wp_editor(
592
+ '',
593
+ 'wp_review_cons',
594
+ array(
595
+ 'tinymce' => array(
596
+ 'toolbar1' => 'bold,italic,underline,bullist,numlist,separator,separator,link,unlink,undo,redo,removeformat',
597
+ 'toolbar2' => '',
598
+ 'toolbar3' => '',
599
+ ),
600
+ 'quicktags' => true,
601
+ 'media_buttons' => false,
602
+ 'textarea_rows' => 6,
603
+ )
604
+ );
605
+ ?>
606
+ </span>
607
+ </div>
608
+ </div>
609
+ </div>
610
+
611
+ <div class="wp-review-field">
612
+ <div class="wp-review-disabled wp-review-field-label">
613
+ <label><?php esc_html_e( 'Hide Description, Pros/Cons & Total Rating', 'wp-review' ); ?></label>
614
+ <?php wp_review_print_pro_text(); ?>
615
+ </div>
616
+
617
+ <div class="wp-review-field-option">
618
+ <?php
619
+ $form_field->render_switch(
620
+ array(
621
+ 'id' => 'wp_review_hide_desc',
622
+ 'name' => 'wp_review_hide_desc',
623
+ 'disabled' => true,
624
+ )
625
+ );
626
+ ?>
627
+ </div>
628
+ </div>
629
+ <?php
630
+ }
631
+
632
+ /**
633
+ * Maps default link texts and urls.
634
+ *
635
+ * @since 5.0.3 Move this function out of `wp_review_render_meta_box_review_links()`
636
+ *
637
+ * @param string $text Link text.
638
+ * @param string $url Link url.
639
+ * @return array
640
+ */
641
+ function wp_review_get_default_links( $text, $url ) {
642
+ return array(
643
+ 'text' => $text,
644
+ 'url' => $url,
645
+ );
646
+ }
647
+
648
+ /**
649
+ * Renders review links meta box.
650
+ *
651
+ * @param WP_Post $post Post object.
652
+ */
653
+ function wp_review_render_meta_box_review_links( $post ) {
654
+
655
+ wp_nonce_field( basename( __FILE__ ), 'wp-review-links-options-nonce' );
656
+
657
+ wp_review_switch_to_main();
658
+ $options = get_option( 'wp_review_options' );
659
+ if ( is_multisite() ) {
660
+ restore_current_blog();
661
+ }
662
+
663
+ $defaults = array_map(
664
+ 'wp_review_get_default_links',
665
+ empty( $options['default_link_text'] ) ? array() : $options['default_link_text'],
666
+ empty( $options['default_link_url'] ) ? array() : $options['default_link_url']
667
+ );
668
+
669
+ $items = get_post_meta( $post->ID, 'wp_review_links', true );
670
+ if ( ! is_array( $items ) ) {
671
+ $items = $defaults;
672
+ }
673
+ ?>
674
+ <table id="wp-review-links" class="wp-review-links" width="100%">
675
+
676
+ <thead>
677
+ <tr>
678
+ <th width="5%"></th>
679
+ <th width="45%"><?php esc_html_e( 'Text', 'wp-review' ); ?></th>
680
+ <th width="40%"><?php esc_html_e( 'URL', 'wp-review' ); ?></th>
681
+ <th width="10%"></th>
682
+ </tr>
683
+ </thead>
684
+
685
+ <tbody>
686
+ <?php if ( ! empty( $items ) && ( isset( $items[0] ) && ! empty( $items[0]['text'] ) ) ) : ?>
687
+
688
+ <?php foreach ( $items as $item ) { ?>
689
+
690
+ <?php if ( ! empty( $item['text'] ) && ! empty( $item['url'] ) ) : ?>
691
+ <tr>
692
+ <td class="handle">
693
+ <span class="dashicons dashicons-menu"></span>
694
+ </td>
695
+ <td>
696
+ <input type="text" class="widefat" name="wp_review_link_title[]" value="<?php echo esc_attr( $item['text'] ); ?>" />
697
+ </td>
698
+ <td>
699
+ <input type="text" class="widefat" name="wp_review_link_url[]" value="<?php echo esc_url( $item['url'] ); ?>" />
700
+ </td>
701
+ <td><a class="button remove-row" href="#"><?php esc_html_e( 'Delete', 'wp-review' ); ?></a></td>
702
+ </tr>
703
+ <?php endif; ?>
704
+
705
+ <?php } ?>
706
+
707
+ <?php else : ?>
708
+
709
+ <tr>
710
+ <td class="handle"><span class="dashicons dashicons-menu"></span></td>
711
+ <td><input type="text" class="widefat" name="wp_review_link_title[]" /></td>
712
+ <td><input type="text" class="widefat" name="wp_review_link_url[]" /></td>
713
+ <td><a class="button remove-row" href="#"><?php esc_html_e( 'Delete', 'wp-review' ); ?></a></td>
714
+ </tr>
715
+
716
+ <?php endif; ?>
717
+
718
+ <!-- empty hidden one for jQuery -->
719
+ <tr class="empty-row screen-reader-text">
720
+ <td class="handle"><span class="dashicons dashicons-menu"></span></td>
721
+ <td><input type="text" class="widefat focus-on-add" name="wp_review_link_title[]" /></td>
722
+ <td><input type="text" class="widefat" name="wp_review_link_url[]" /></td>
723
+ <td><a class="button remove-row" href="#"><?php esc_html_e( 'Delete', 'wp-review' ); ?></a></td>
724
+ </tr>
725
+
726
+ </tbody>
727
+
728
+ </table>
729
+
730
+ <a class="add-row button" data-target="#wp-review-links" href="#"><?php esc_html_e( 'Add another', 'wp-review' ); ?></a>
731
+ <?php
732
+ }
733
+
734
+ /**
735
+ * Renders user review meta box.
736
+ *
737
+ * @param WP_Post $post Post object.
738
+ */
739
+ function wp_review_render_meta_box_user_review( $post ) {
740
+ /* Add an nonce field so we can check for it later. */
741
+ wp_nonce_field( basename( __FILE__ ), 'wp-review-userReview-nonce' );
742
+ $enabled = wp_review_get_user_rating_setup( $post->ID );
743
+
744
+ $type = get_post_meta( $post->ID, 'wp_review_user_review_type', true );
745
+ if ( ! $type ) {
746
+ $type = wp_review_option( 'review_type', 'none' );
747
+ }
748
+
749
+ // $available_types = apply_filters( 'wp_review_metabox_user_rating_types', wp_review_get_review_types( 'user' ) );
750
+ $available_types = wp_review_get_rating_types();
751
+ $product_price = wp_review_get_product_price( $post->ID );
752
+
753
+ $form_field = new WP_Review_Form_Field();
754
+ ?>
755
+ <div class="wp-review-field no-flex">
756
+ <p>
757
+ <label>
758
+ <input type="radio" name="wp_review_userReview" id="wp-review-userReview-disable" value="<?php echo esc_attr( WP_REVIEW_REVIEW_DISABLED ); ?>" <?php checked( WP_REVIEW_REVIEW_DISABLED, $enabled ); ?>>
759
+ <?php esc_html_e( 'Disabled', 'wp-review' ); ?>
760
+ </label>
761
+ </p>
762
+
763
+ <p>
764
+ <label>
765
+ <input type="radio" name="wp_review_userReview" id="wp-review-userReview-visitor" value="<?php echo esc_attr( WP_REVIEW_REVIEW_VISITOR_ONLY ); ?>" <?php checked( WP_REVIEW_REVIEW_VISITOR_ONLY, $enabled ); ?>>
766
+ <?php esc_html_e( 'Visitor Rating Only', 'wp-review' ); ?>
767
+ </label>
768
+ </p>
769
+
770
+ <p>
771
+ <label class="wp-review-disabled">
772
+ <input type="radio" name="wp_review_userReview" id="wp-review-userReview-comment" value="<?php echo esc_attr( WP_REVIEW_REVIEW_COMMENT_ONLY ); ?>" <?php checked( WP_REVIEW_REVIEW_COMMENT_ONLY, $enabled ); ?> disabled />
773
+ <?php esc_html_e( 'Comment Rating Only', 'wp-review' ); ?>
774
+ <?php wp_review_print_pro_text( true ); ?>
775
+ </label>
776
+ </p>
777
+
778
+ <p>
779
+ <label class="wp-review-disabled">
780
+ <input type="radio" name="wp_review_userReview" id="wp-review-userReview-both" value="<?php echo esc_attr( WP_REVIEW_REVIEW_ALLOW_BOTH ); ?>" <?php checked( WP_REVIEW_REVIEW_ALLOW_BOTH, $enabled ); ?> disabled/>
781
+ <?php esc_html_e( 'Both', 'wp-review' ); ?>
782
+ <?php wp_review_print_pro_text( true ); ?>
783
+ </label>
784
+ </p>
785
+ </div>
786
+
787
+ <?php $hidden = WP_REVIEW_REVIEW_DISABLED == $enabled ? 'hidden' : ''; ?>
788
+ <div class="show-if-both <?php echo esc_attr( $hidden ); ?>">
789
+ <div class="edit-ratings-notice update-nag" style="margin-top: 0;"><?php esc_html_e( 'If you are changing User Rating Type & post already have user ratings, please edit or remove existing ratings.', 'wp-review' ); ?></div>
790
+
791
+ <div class="wp-review-field" id="wp_review_rating_type">
792
+ <div class="wp-review-field-label">
793
+ <label for="rating_type"><?php esc_html_e( 'User Rating Type', 'wp-review' ); ?></label>
794
+ </div>
795
+
796
+ <div class="wp-review-field-option">
797
+ <select name="wp_review_user_review_type" id="rating_type">
798
+ <?php
799
+ foreach ( $available_types as $key => $available_type ) {
800
+ // Skip ones that only have output template.
801
+ if ( ! $available_type['user_rating'] ) {
802
+ continue;
803
+ }
804
+
805
+ $disabled = 'circle' === $key || 'thumbs' === $key;
806
+ printf(
807
+ '<option value="%1$s" class="%2$s" %3$s>%4$s</option>',
808
+ esc_attr( $key ),
809
+ $disabled ? 'disabled' : '',
810
+ selected( $type, $key, false ),
811
+ esc_html( $available_type['label'] )
812
+ );
813
+ }
814
+ ?>
815
+ </select>
816
+ </div>
817
+ </div>
818
+ </div>
819
+
820
+ <?php $hidden = WP_REVIEW_REVIEW_DISABLED == $enabled ? 'hidden' : ''; ?>
821
+ <div class="show-if-both <?php echo esc_attr( $hidden ); ?>">
822
+ <div class="wp-review-field">
823
+ <div class="wp-review-field-label">
824
+ <label><?php esc_html_e( 'User can:', 'wp-review' ); ?></label>
825
+ <?php wp_review_print_pro_text(); ?>
826
+ </div>
827
+
828
+ <div class="wp-review-field-option">
829
+ <span class="wp-review-disabled inline-block has-bg">
830
+ <select name="wp_review_user_can_rate_feature" id="wp_review_user_can_rate_feature" disabled>
831
+ <option value=""><?php esc_html_e( 'Give Overall Rating', 'wp-review' ); ?></option>
832
+ <option value="1"><?php esc_html_e( 'Rate Each Feature', 'wp-review' ); ?></option>
833
+ </select>
834
+ </span>
835
+ </div>
836
+ </div>
837
+ </div>
838
+
839
+ <?php $hidden = in_array( $enabled, array( WP_REVIEW_REVIEW_DISABLED, WP_REVIEW_REVIEW_COMMENT_ONLY ) ) ? 'hidden' : ''; ?>
840
+ <div class="show-if-visitor <?php echo esc_attr( $hidden ); ?>">
841
+ <div class="wp-review-field">
842
+ <div class="wp-review-field-label">
843
+ <label><?php esc_html_e( 'Hide Visitors Rating in Review Box', 'wp-review' ); ?></label>
844
+ <?php wp_review_print_pro_text(); ?>
845
+ </div>
846
+
847
+ <div class="wp-review-field-option">
848
+ <?php
849
+ $form_field->render_switch(
850
+ array(
851
+ 'id' => 'wp_review_hide_visitors_rating',
852
+ 'name' => 'wp_review_hide_visitors_rating',
853
+ 'disabled' => true,
854
+ )
855
+ );
856
+ ?>
857
+ </div>
858
+ </div>
859
+ </div>
860
+
861
+ <div class="wp-review-field">
862
+ <div class="wp-review-field-label">
863
+ <label for="wp_review_product_price"><?php esc_html_e( 'Product Price', 'wp-review' ); ?></label>
864
+ </div>
865
+
866
+ <div class="wp-review-field-option">
867
+ <input type="text" name="wp_review_product_price" id="wp_review_product_price" value="<?php echo esc_attr( $product_price ); ?>">
868
+ </div>
869
+ </div>
870
+
871
+ <div class="wp-review-field">
872
+ <div class="wp-review-disabled wp-review-field-label">
873
+ <label for="wp_review_allow_comment_feedback"><?php esc_html_e( 'Comment Feedback (helpful/unhelpful)', 'wp-review' ); ?></label>
874
+ <?php wp_review_print_pro_text(); ?>
875
+ </div>
876
+
877
+ <div class="wp-review-field-option">
878
+ <span class="wp-review-disabled inline-block has-bg">
879
+ <select name="wp_review_allow_comment_feedback" id="wp_review_allow_comment_feedback" disabled>
880
+ <option value=""><?php esc_html_e( 'Use global options', 'wp-review' ); ?></option>
881
+ <option value="yes"><?php esc_html_e( 'Yes', 'wp-review' ); ?></option>
882
+ <option value="no"><?php esc_html_e( 'No', 'wp-review' ); ?></option>
883
+ </select>
884
+ </span>
885
+ </div>
886
+ </div>
887
+
888
+ <?php
889
+ if ( current_user_can( 'wp_review_purge_visitor_ratings' ) ) {
890
+ ?>
891
+ <p style="margin-top: 50px;">
892
+ <button
893
+ type="button"
894
+ class="button"
895
+ data-remove-ratings
896
+ data-type="visitor"
897
+ data-processing-text="<?php esc_attr_e( 'Processing...', 'wp-review' ); ?>"
898
+ data-post-id="<?php echo intval( $post->ID ); ?>"
899
+ ><?php esc_html_e( 'Purge visitor ratings', 'wp-review' ); ?></button>
900
+ <span class="description"><?php esc_html_e( 'Click to remove all visitor ratings of this post.', 'wp-review' ); ?></span>
901
+ </p>
902
+ <?php
903
+ }
904
+ }
905
+
906
+ /**
907
+ * Saves the meta box.
908
+ *
909
+ * @since 1.0
910
+ *
911
+ * @param int $post_id Post ID.
912
+ * @param WP_Post $post Post object.
913
+ * @return int
914
+ */
915
+ function wp_review_save_postdata( $post_id, $post ) {
916
+
917
+ /* If this is an autosave, our form has not been submitted, so we don't want to do anything. */
918
+ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
919
+ return $post_id;
920
+ }
921
+
922
+ if ( ! isset( $_POST['wp-review-review-options-nonce'] ) || ! wp_verify_nonce( $_POST['wp-review-review-options-nonce'], 'wp-review-meta-box-options' ) ) {
923
+ return $post_id;
924
+ }
925
+
926
+ $hide_desc = false;
927
+ $hide_links = false;
928
+ $hide_user_reviews = false;
929
+ $hide_review_features = false;
930
+
931
+ if ( is_multisite() ) {
932
+ $hide_desc = wp_review_network_option( 'hide_review_description_' );
933
+ $hide_links = wp_review_network_option( 'hide_review_links_' );
934
+ $hide_user_reviews = wp_review_network_option( 'hide_user_reviews_' );
935
+ $hide_review_features = wp_review_network_option( 'hide_features_' );
936
+ }
937
+
938
+ if ( ! $hide_desc && ! current_user_can( 'wp_review_description' ) ) {
939
+ $hide_desc = true;
940
+ }
941
+
942
+ if ( ! $hide_links && ! current_user_can( 'wp_review_links' ) ) {
943
+ $hide_links = true;
944
+ }
945
+
946
+ if ( ! $hide_user_reviews && ! current_user_can( 'wp_review_user_reviews' ) ) {
947
+ $hide_user_reviews = true;
948
+ }
949
+
950
+ if ( ! $hide_review_features && ! current_user_can( 'wp_review_features' ) ) {
951
+ $hide_review_features = true;
952
+ }
953
+
954
+ if ( ! $hide_review_features && ( ! isset( $_POST['wp-review-item-nonce'] ) || ! wp_verify_nonce( $_POST['wp-review-item-nonce'], basename( __FILE__ ) ) ) ) {
955
+ return $post_id;
956
+ }
957
+
958
+ if ( ! $hide_desc && ( ! isset( $_POST['wp-review-desc-nonce'] ) || ! wp_verify_nonce( $_POST['wp-review-desc-nonce'], basename( __FILE__ ) ) ) ) {
959
+ return $post_id;
960
+ }
961
+
962
+ if ( ! $hide_links && ( ! isset( $_POST['wp-review-links-options-nonce'] ) || ! wp_verify_nonce( $_POST['wp-review-links-options-nonce'], basename( __FILE__ ) ) ) ) {
963
+ return $post_id;
964
+ }
965
+
966
+ if ( ! $hide_user_reviews && ( ! isset( $_POST['wp-review-userReview-nonce'] ) || ! wp_verify_nonce( $_POST['wp-review-userReview-nonce'], basename( __FILE__ ) ) ) ) {
967
+ return $post_id;
968
+ }
969
+
970
+ /* Check the user's permissions. */
971
+ if ( isset( $_POST['post_type'] ) && 'page' === $_POST['post_type'] ) {
972
+ if ( ! current_user_can( 'edit_page', $post_id ) ) {
973
+ return $post_id;
974
+ }
975
+ } else {
976
+ if ( ! current_user_can( 'edit_post', $post_id ) ) {
977
+ return $post_id;
978
+ }
979
+ }
980
+
981
+ $type = filter_input( INPUT_POST, 'wp_review_type', FILTER_SANITIZE_STRING );
982
+ if ( ! $type ) {
983
+ $type = wp_review_option( 'review_type', 'none' );
984
+ }
985
+ update_post_meta( $post_id, 'wp_review_type', $type );
986
+ // Do not save review data if never enable it.
987
+ if ( 'none' === $type && ! get_post_meta( $post_id, 'wp_review_bgcolor1', true ) ) {
988
+ return $post_id;
989
+ }
990
+
991
+ $meta = array(
992
+ 'wp_review_custom_location' => filter_input( INPUT_POST, 'wp_review_custom_location', FILTER_SANITIZE_STRING ),
993
+ 'wp_review_custom_colors' => filter_input( INPUT_POST, 'wp_review_custom_colors', FILTER_SANITIZE_STRING ),
994
+ 'wp_review_custom_author' => filter_input( INPUT_POST, 'wp_review_custom_author', FILTER_SANITIZE_STRING ),
995
+ 'wp_review_location' => filter_input( INPUT_POST, 'wp_review_location', FILTER_SANITIZE_STRING ),
996
+ 'wp_review_heading' => filter_input( INPUT_POST, 'wp_review_heading', FILTER_SANITIZE_STRING ),
997
+ 'wp_review_desc_title' => filter_input( INPUT_POST, 'wp_review_desc_title', FILTER_SANITIZE_STRING ),
998
+ 'wp_review_desc' => ! empty( $_POST['wp_review_desc'] ) ? wp_kses_post( wp_unslash( $_POST['wp_review_desc'] ) ) : '',
999
+ 'wp_review_hide_desc' => filter_input( INPUT_POST, 'wp_review_hide_desc', FILTER_SANITIZE_STRING ),
1000
+ 'wp_review_userReview' => filter_input( INPUT_POST, 'wp_review_userReview', FILTER_SANITIZE_STRING ),
1001
+ 'wp_review_total' => filter_input( INPUT_POST, 'wp_review_total', FILTER_SANITIZE_STRING ),
1002
+ 'wp_review_color' => filter_input( INPUT_POST, 'wp_review_color', FILTER_SANITIZE_STRING ),
1003
+ 'wp_review_inactive_color' => filter_input( INPUT_POST, 'wp_review_inactive_color', FILTER_SANITIZE_STRING ),
1004
+ 'wp_review_fontcolor' => filter_input( INPUT_POST, 'wp_review_fontcolor', FILTER_SANITIZE_STRING ),
1005
+ 'wp_review_bgcolor1' => filter_input( INPUT_POST, 'wp_review_bgcolor1', FILTER_SANITIZE_STRING ),
1006
+ 'wp_review_bgcolor2' => filter_input( INPUT_POST, 'wp_review_bgcolor2', FILTER_SANITIZE_STRING ),
1007
+ 'wp_review_bordercolor' => filter_input( INPUT_POST, 'wp_review_bordercolor', FILTER_SANITIZE_STRING ),
1008
+ 'wp_review_author' => filter_input( INPUT_POST, 'wp_review_author', FILTER_SANITIZE_STRING ),
1009
+ 'wp_review_schema' => filter_input( INPUT_POST, 'wp_review_schema', FILTER_SANITIZE_STRING ),
1010
+ 'wp_review_rating_schema' => filter_input( INPUT_POST, 'wp_review_rating_schema', FILTER_SANITIZE_STRING ),
1011
+ 'wp_review_show_schema_data' => filter_input( INPUT_POST, 'wp_review_show_schema_data', FILTER_SANITIZE_STRING ),
1012
+ 'wp_review_user_review_type' => filter_input( INPUT_POST, 'wp_review_user_review_type', FILTER_SANITIZE_STRING ),
1013
+ 'wp_review_product_price' => filter_input( INPUT_POST, 'wp_review_product_price', FILTER_SANITIZE_STRING ),
1014
+ 'wp_review_box_template' => filter_input( INPUT_POST, 'wp_review_box_template', FILTER_SANITIZE_STRING ),
1015
+ );
1016
+
1017
+ $default_colors = wp_review_get_global_colors();
1018
+ $default_color = $default_colors['color'];
1019
+ $default_inactive = $default_colors['inactive_color'];
1020
+
1021
+ if ( $meta['wp_review_color'] === $default_color ) {
1022
+ $meta['wp_review_color'] = '';
1023
+ }
1024
+
1025
+ if ( $meta['wp_review_inactive_color'] === $default_inactive ) {
1026
+ $meta['wp_review_inactive_color'] = '';
1027
+ }
1028
+
1029
+ foreach ( $meta as $meta_key => $new_meta_value ) {
1030
+ $new_meta_value = wp_review_normalize_option_value( $new_meta_value );
1031
+
1032
+ if ( false === $new_meta_value ) {
1033
+ $new_meta_value = '0';
1034
+ }
1035
+
1036
+ if ( 'wp_review_box_template' === $meta_key && ! in_array( $new_meta_value, array( 'default', 'aqua' ), true ) ) {
1037
+ continue;
1038
+ }
1039
+
1040
+ if ( current_user_can( 'delete_post_meta', $post_id ) && '' === $new_meta_value ) {
1041
+ delete_post_meta( $post_id, $meta_key );
1042
+ continue;
1043
+ }
1044
+
1045
+ if ( current_user_can( 'edit_post_meta', $post_id ) ) {
1046
+ update_post_meta( $post_id, $meta_key, $new_meta_value );
1047
+ }
1048
+ }
1049
+
1050
+ wp_review_save_review_items_data( $post_id );
1051
+
1052
+ $old = get_post_meta( $post_id, 'wp_review_item', true );
1053
+ $link_text = (array) filter_input( INPUT_POST, 'wp_review_link_title', FILTER_SANITIZE_STRING, FILTER_FORCE_ARRAY );
1054
+ $link_url = (array) filter_input( INPUT_POST, 'wp_review_link_url', FILTER_SANITIZE_STRING, FILTER_FORCE_ARRAY );
1055
+ $new_links = array();
1056
+
1057
+ if ( ! empty( $link_text ) ) {
1058
+ foreach ( $link_text as $key => $text ) {
1059
+ if ( ! empty( $text ) && ! empty( $link_url[ $key ] ) ) {
1060
+ $new_links[] = array(
1061
+ 'text' => $text,
1062
+ 'url' => $link_url[ $key ],
1063
+ );
1064
+ }
1065
+ }
1066
+ }
1067
+
1068
+ if ( empty( $new_links ) ) {
1069
+ delete_post_meta( $post_id, 'wp_review_links' );
1070
+ } else {
1071
+ update_post_meta( $post_id, 'wp_review_links', $new_links );
1072
+ }
1073
+ if ( isset( $_POST['wp_review_schema_options'] ) ) {
1074
+ update_post_meta( $post_id, 'wp_review_schema_options', $_POST['wp_review_schema_options'] );
1075
+ }
1076
+
1077
+ /**
1078
+ * Delete all data when switched to 'No Review' type.
1079
+ */
1080
+ if ( 'none' === $type ) {
1081
+ delete_post_meta( $post_id, 'wp_review_desc', $_POST['wp_review_desc'] );
1082
+ delete_post_meta( $post_id, 'wp_review_heading', $_POST['wp_review_heading'] );
1083
+ delete_post_meta( $post_id, 'wp_review_userReview', $_POST['wp_review_userReview'] );
1084
+ delete_post_meta( $post_id, 'wp_review_item', $old );
1085
+ }
1086
+ }
1087
+
1088
+ /**
1089
+ * Clears transients
1090
+ *
1091
+ * @param int $post_id Post ID.
1092
+ * @param WP_Post $post Post object.
1093
+ */
1094
+ function wp_review_clear_query_cache( $post_id, $post ) {
1095
+ global $wpdb;
1096
+ $where = $wpdb->prepare( 'WHERE option_name REGEXP %s', '_transient(_timeout)?_wp_review_[0-9a-f]{32}' );
1097
+ $wpdb->query( "DELETE FROM {$wpdb->prefix}options {$where}" ); // WPCS: unprepared SQL ok.
1098
+ }
1099
+
1100
+ /**
1101
+ * Saves review items data.
1102
+ *
1103
+ * @param int $post_id Post ID.
1104
+ */
1105
+ function wp_review_save_review_items_data( $post_id ) {
1106
+ $old = get_post_meta( $post_id, 'wp_review_item', true );
1107
+
1108
+ if ( ! empty( $_POST['wp_review_item_title'] ) ) { // WPCS: csrf ok.
1109
+ $title = $_POST['wp_review_item_title']; // WPCS: csrf ok.
1110
+ $star = $_POST['wp_review_item_star']; // WPCS: csrf ok.
1111
+ $ids = $_POST['wp_review_item_id']; // WPCS: csrf ok.
1112
+ $new = array();
1113
+
1114
+ $count = count( $title );
1115
+
1116
+ for ( $i = 0; $i < $count; $i++ ) {
1117
+ if ( empty( $star[ $i ] ) ) {
1118
+ continue; // Prevent item without score.
1119
+ }
1120
+
1121
+ $new[ $i ] = array();
1122
+ $new[ $i ]['wp_review_item_star'] = floatval( $star[ $i ] );
1123
+
1124
+ if ( ! empty( $ids[ $i ] ) ) {
1125
+ $new[ $i ]['id'] = sanitize_text_field( wp_unslash( $ids[ $i ] ) );
1126
+ }
1127
+
1128
+ if ( ! empty( $title[ $i ] ) ) {
1129
+ $new[ $i ]['wp_review_item_title'] = sanitize_text_field( wp_unslash( $title[ $i ] ) );
1130
+ }
1131
+ }
1132
+
1133
+ if ( ! empty( $new ) && $new !== $old ) {
1134
+ update_post_meta( $post_id, 'wp_review_item', $new );
1135
+ } elseif ( empty( $new ) && $old ) {
1136
+ delete_post_meta( $post_id, 'wp_review_item', $old );
1137
+ }
1138
+ } else {
1139
+ delete_post_meta( $post_id, 'wp_review_item' );
1140
+ }
1141
+ }
1142
+
1143
+
1144
+ /**
1145
+ * Fix for post previews
1146
+ * With this code, the review meta data will actually get saved on Preview.
1147
+ *
1148
+ * @param array $fields Revision fields.
1149
+ * @return array
1150
+ */
1151
+ function add_field_debug_preview( $fields ) {
1152
+ $fields['debug_preview'] = 'debug_preview';
1153
+ return $fields;
1154
+ }
1155
+ add_filter( '_wp_post_revision_fields', 'add_field_debug_preview' );
1156
+
1157
+
1158
+ /**
1159
+ * Adds input debug preview.
1160
+ */
1161
+ function add_input_debug_preview() {
1162
+ echo '<input type="hidden" name="debug_preview" value="debug_preview">';
1163
+ }
1164
+ add_action( 'edit_form_after_title', 'add_input_debug_preview' );
1165
+
1166
+
1167
+ /**
1168
+ * Shows schema field.
1169
+ *
1170
+ * @param array $args Args.
1171
+ * @param array $value Schema value.
1172
+ * @param string $schema_type Schema type.
1173
+ */
1174
+ function wp_review_schema_field( $args, $value, $schema_type ) {
1175
+ $type = isset( $args['type'] ) ? $args['type'] : '';
1176
+ $name = isset( $args['name'] ) ? $args['name'] : '';
1177
+ $label = isset( $args['label'] ) ? $args['label'] : '';
1178
+ $options = isset( $args['options'] ) ? $args['options'] : array();
1179
+ $default = isset( $args['default'] ) ? $args['default'] : '';
1180
+ $min = isset( $args['min'] ) ? $args['min'] : '0';
1181
+ $max = isset( $args['max'] ) ? $args['max'] : '';
1182
+ $info = isset( $args['info'] ) ? $args['info'] : '';
1183
+
1184
+ // Option value.
1185
+ $opt_val = isset( $value[ $name ] ) ? $value[ $name ] : $default;
1186
+ $opt_id_attr = 'wp_review_schema_options_' . $schema_type . '_' . $name;
1187
+ $opt_name_attr = 'wp_review_schema_options[' . $schema_type . '][' . $name . ']';
1188
+
1189
+ $form_field = new WP_Review_Form_Field();
1190
+ ?>
1191
+ <div class="wp-review-field-label">
1192
+ <label for="<?php echo esc_attr( $opt_id_attr ); ?>" class="wp_review_schema_options_label"><?php echo esc_html( $label ); ?></label>
1193
+ </div>
1194
+
1195
+ <div class="wp-review-field-option">
1196
+ <?php
1197
+ switch ( $type ) {
1198
+ case 'text':
1199
+ ?>
1200
+ <input type="text" name="<?php echo esc_attr( $opt_name_attr ); ?>" id="<?php echo esc_attr( $opt_id_attr ); ?>" value="<?php echo esc_attr( $opt_val ); ?>" />
1201
+ <?php
1202
+ break;
1203
+
1204
+ case 'select':
1205
+ ?>
1206
+ <select name="<?php echo esc_attr( $opt_name_attr ); ?>" id="<?php echo esc_attr( $opt_id_attr ); ?>">
1207
+ <?php foreach ( $options as $val => $label ) { ?>
1208
+ <option value="<?php echo esc_attr( $val ); ?>" <?php selected( $opt_val, $val, true ); ?>><?php echo esc_html( $label ); ?></option>
1209
+ <?php } ?>
1210
+ </select>
1211
+ <?php
1212
+ break;
1213
+
1214
+ case 'number':
1215
+ ?>
1216
+ <input type="number" step="1" min="<?php echo esc_attr( $min ); ?>" max="<?php echo esc_attr( $max ); ?>" name="<?php echo esc_attr( $opt_name_attr ); ?>" id="<?php echo esc_attr( $opt_id_attr ); ?>" value="<?php echo esc_attr( $opt_val ); ?>" class="small-text">
1217
+ <?php
1218
+ break;
1219
+
1220
+ case 'textarea':
1221
+ ?>
1222
+ <textarea name="<?php echo esc_attr( $opt_name_attr ); ?>" id="<?php echo esc_attr( $opt_id_attr ); ?>"><?php echo esc_textarea( $opt_val ); ?></textarea>
1223
+ <?php
1224
+ break;
1225
+
1226
+ case 'checkbox':
1227
+ ?>
1228
+ <input type="checkbox" name="<?php echo esc_attr( $opt_name_attr ); ?>" id="<?php echo esc_attr( $opt_id_attr ); ?>" value="1" <?php checked( $opt_val, '1', true ); ?> />
1229
+ <?php
1230
+ break;
1231
+
1232
+ case 'image':
1233
+ ?>
1234
+ <span class="wpr_image_upload_field">
1235
+ <span class="clearfix" id="<?php echo esc_attr( $opt_id_attr ); ?>-preview">
1236
+ <?php
1237
+ if ( ! empty( $opt_val['url'] ) ) {
1238
+ echo '<img class="wpr_image_upload_img" src="' . esc_url( $opt_val['url'] ) . '" />';
1239
+ }
1240
+ ?>
1241
+ </span>
1242
+ <input type="hidden" id="<?php echo esc_attr( $opt_id_attr ); ?>-id" name="<?php echo esc_attr( $opt_name_attr ); ?>[id]" value="<?php if ( isset( $opt_val['id'] ) ) echo $opt_val['id']; // phpcs:ignore ?>" />
1243
+ <input type="hidden" id="<?php echo esc_attr( $opt_id_attr ); ?>-url" name="<?php echo esc_attr( $opt_name_attr ); ?>[url]" value="<?php if ( isset( $opt_val['url'] ) ) echo $opt_val['url']; // phpcs:ignore ?>" />
1244
+ <button class="button" name="<?php echo esc_attr( $opt_id_attr ); ?>-upload" id="<?php echo esc_attr( $opt_id_attr ); ?>-upload" data-id="<?php echo esc_attr( $opt_id_attr ); ?>" onclick="wprImageField.uploader( '<?php echo esc_attr( $opt_id_attr ); ?>' ); return false;"><?php esc_html_e( 'Select Image', 'wp-review' ); ?></button>
1245
+ <?php
1246
+ if ( ! empty( $opt_val['url'] ) ) {
1247
+ echo '<a href="#" class="button button-link clear-image">' . esc_html__( 'Remove Image', 'wp-review' ) . '</a>';
1248
+ }
1249
+ ?>
1250
+ <span class="clear"></span>
1251
+ </span>
1252
+ <?php
1253
+ break;
1254
+
1255
+ case 'date':
1256
+ ?>
1257
+ <input class="wpr-datepicker" type="text" name="<?php echo esc_attr( $opt_name_attr ); ?>" id="<?php echo esc_attr( $opt_id_attr ); ?>" value="<?php echo esc_attr( $opt_val ); ?>" size="30" />
1258
+ <?php
1259
+ break;
1260
+
1261
+ case 'switch':
1262
+ $field_args = array(
1263
+ 'id' => $opt_id_attr,
1264
+ 'name' => $opt_name_attr,
1265
+ 'value' => $opt_val,
1266
+ );
1267
+ if ( ! empty( $args['on_label'] ) ) {
1268
+ $field_args['on_label'] = $args['on_label'];
1269
+ }
1270
+ if ( ! empty( $args['off_label'] ) ) {
1271
+ $field_args['off_label'] = $args['off_label'];
1272
+ }
1273
+ $form_field->render_switch( $field_args );
1274
+ break;
1275
+ }
1276
+
1277
+ if ( ! empty( $info ) ) {
1278
+ printf( '<p class="description" style="color: #bbb">%s</p>', wp_kses_post( $info ) );
1279
+ }
1280
+ ?>
1281
+ </div>
1282
+ <?php
1283
+ }
admin/options/facebook.php CHANGED
@@ -1,45 +1,45 @@
1
- <?php
2
- /**
3
- * Facebook options
4
- *
5
- * @package WP_Review
6
- */
7
-
8
- ?>
9
- <div class="wp-review-field no-flex">
10
- <?php
11
- printf(
12
- /* translators: Facebook App link. */
13
- esc_html__( '%s to create Facebook App. Remember to add your domain to app.', 'wp-review' ),
14
- '<a href="https://mythemeshop.com/kb/wp-review-pro/facebook-reviews/" target="_blank">' . esc_html__( 'Click here', 'wp-review' ) . '</a>'
15
- );
16
- ?>
17
- </div>
18
-
19
- <div class="wp-review-field">
20
- <div class="wp-review-field-label">
21
- <label for="wp_review_facebook_app_id"><?php esc_html_e( 'App ID', 'wp-review' ); ?></label>
22
- <?php wp_review_print_pro_text(); ?>
23
- </div>
24
-
25
- <div class="wp-review-field-option">
26
- <span class="wp-review-disabled inline-block large-text">
27
- <input name="wp_review_options[facebook_app_id]" id="wp_review_facebook_app_id" type="text" class="widefat" disabled>
28
- </span>
29
- </div>
30
- </div>
31
-
32
- <div class="wp-review-field">
33
- <div class="wp-review-field-label">
34
- <label for="wp_review_facebook_app_secret"><?php esc_html_e( 'App secret', 'wp-review' ); ?></label>
35
- <?php wp_review_print_pro_text(); ?>
36
- </div>
37
-
38
- <div class="wp-review-field-option">
39
- <span class="wp-review-disabled inline-block large-text">
40
- <input name="wp_review_options[facebook_app_secret]" id="wp_review_facebook_app_secret" class="widefat" type="password" disabled>
41
- </span>
42
- </div>
43
- </div>
44
-
45
- <p class="description"><?php esc_html_e( 'Please re-generate access token in shortcodes and widgets each time you change App ID or App secret.', 'wp-review' ); ?></p>
1
+ <?php
2
+ /**
3
+ * Facebook options
4
+ *
5
+ * @package WP_Review
6
+ */
7
+
8
+ ?>
9
+ <div class="wp-review-field no-flex">
10
+ <?php
11
+ printf(
12
+ /* translators: Facebook App link. */
13
+ esc_html__( '%s to create Facebook App. Remember to add your domain to app.', 'wp-review' ),
14
+ '<a href="https://mythemeshop.com/kb/wp-review-pro/facebook-reviews/" target="_blank">' . esc_html__( 'Click here', 'wp-review' ) . '</a>'
15
+ );
16
+ ?>
17
+ </div>
18
+
19
+ <div class="wp-review-field">
20
+ <div class="wp-review-disabled wp-review-field-label">
21
+ <label for="wp_review_facebook_app_id"><?php esc_html_e( 'App ID', 'wp-review' ); ?></label>
22
+ <?php wp_review_print_pro_text(); ?>
23
+ </div>
24
+
25
+ <div class="wp-review-field-option">
26
+ <span class="wp-review-disabled inline-block large-text">
27
+ <input name="wp_review_options[facebook_app_id]" id="wp_review_facebook_app_id" type="text" class="widefat" disabled>
28
+ </span>
29
+ </div>
30
+ </div>
31
+
32
+ <div class="wp-review-field">
33
+ <div class="wp-review-disabled wp-review-field-label">
34
+ <label for="wp_review_facebook_app_secret"><?php esc_html_e( 'App secret', 'wp-review' ); ?></label>
35
+ <?php wp_review_print_pro_text(); ?>
36
+ </div>
37
+
38
+ <div class="wp-review-field-option">
39
+ <span class="wp-review-disabled inline-block large-text">
40
+ <input name="wp_review_options[facebook_app_secret]" id="wp_review_facebook_app_secret" class="widefat" type="password" disabled>
41
+ </span>
42
+ </div>
43
+ </div>
44
+
45
+ <p class="description"><?php esc_html_e( 'Please re-generate access token in shortcodes and widgets each time you change App ID or App secret.', 'wp-review' ); ?></p>
admin/options/google.php CHANGED
@@ -1,30 +1,30 @@
1
- <?php
2
- /**
3
- * Google options
4
- *
5
- * @package WP_Review
6
- */
7
-
8
- ?>
9
- <div class="wp-review-field">
10
- <div class="wp-review-field-label">
11
- <label for="wp_review_google_api_key"><?php esc_html_e( 'API Key', 'wp-review' ); ?></label>
12
- <?php wp_review_print_pro_text(); ?>
13
- </div>
14
-
15
- <div class="wp-review-field-option">
16
- <span class="wp-review-disabled inline-block large-text">
17
- <input name="wp_review_options[google_api_key]" id="wp_review_google_api_key" class="widefat" type="password" disabled>
18
- </span>
19
- </div>
20
-
21
- <span class="description">
22
- <?php
23
- printf(
24
- /* translators: Google API link. */
25
- esc_html__( '%s to get Google API key.', 'wp-review' ),
26
- '<a href="https://mythemeshop.com/kb/wp-review-pro/google-reviews/" target="_blank">' . esc_html__( 'Click here', 'wp-review' ) . '</a>'
27
- );
28
- ?>
29
- </span>
30
- </div>
1
+ <?php
2
+ /**
3
+ * Google options
4
+ *
5
+ * @package WP_Review
6
+ */
7
+
8
+ ?>
9
+ <div class="wp-review-field">
10
+ <div class="wp-review-disabled wp-review-field-label">
11
+ <label for="wp_review_google_api_key"><?php esc_html_e( 'API Key', 'wp-review' ); ?></label>
12
+ <?php wp_review_print_pro_text(); ?>
13
+ </div>
14
+
15
+ <div class="wp-review-field-option">
16
+ <span class="wp-review-disabled inline-block large-text">
17
+ <input name="wp_review_options[google_api_key]" id="wp_review_google_api_key" class="widefat" type="password" disabled>
18
+ </span>
19
+ </div>
20
+
21
+ <span class="description">
22
+ <?php
23
+ printf(
24
+ /* translators: Google API link. */
25
+ esc_html__( '%s to get Google API key.', 'wp-review' ),
26
+ '<a href="https://mythemeshop.com/kb/wp-review-pro/google-reviews/" target="_blank">' . esc_html__( 'Click here', 'wp-review' ) . '</a>'
27
+ );
28
+ ?>
29
+ </span>
30
+ </div>
admin/options/hello-bar.php CHANGED
@@ -1,231 +1,231 @@
1
- <?php
2
- /**
3
- * Notification bar options
4
- *
5
- * @package WP_Review
6
- */
7
-
8
- ?>
9
- <div data-nav-tabs>
10
- <div class="nav-tab-wrapper">
11
- <a href="#hello-bar-content" class="nav-tab nav-tab-active" data-tab="hello-bar-content"><?php esc_html_e( 'Content', 'wp-review' ); ?></a>
12
- <a href="#hello-bar-styling" class="nav-tab" data-tab="hello-bar-styling"><?php esc_html_e( 'Styling', 'wp-review' ); ?></a>
13
- </div>
14
-
15
- <div id="hello-bar-content" class="tab-content">
16
- <h3><?php esc_html_e( 'Content Settings', 'wp-review' ); ?></h3>
17
-
18
- <div class="wp-review-field">
19
- <div class="wp-review-field-label">
20
- <label><?php esc_html_e( 'Enable Global Notification Bar', 'wp-review' ); ?></label>
21
- <?php wp_review_print_pro_text(); ?>
22
- </div>
23
-
24
- <div class="wp-review-field-option">
25
- <?php
26
- $form_field->render_switch(
27
- array(
28
- 'id' => 'wp_review_hello_bar_enable',
29
- 'name' => 'wp_review_hello_bar[enable]',
30
- 'disabled' => true,
31
- )
32
- );
33
- ?>
34
- </div>
35
- </div>
36
-
37
- <div class="hide-if-hello-bar-disable">
38
-
39
- <div class="wp-review-field">
40
- <div class="wp-review-field-label">
41
- <label for="wp_review_text"><?php esc_html_e( 'Text', 'wp-review' ); ?></label>
42
- <?php wp_review_print_pro_text(); ?>
43
- </div>
44
- <div class="wp-review-field-option">
45
- <span class="wp-review-disabled inline-block">
46
- <input name="wp_review_hello_bar[text]" id="wp_review_text" class="large-text" type="text" disabled>
47
- </span>
48
- </div>
49
- </div>
50
-
51
- <div class="wp-review-field">
52
- <div class="wp-review-field-label">
53
- <label for="wp_review_star_rating"><?php esc_html_e( 'Star Rating', 'wp-review' ); ?></label>
54
- <?php wp_review_print_pro_text(); ?>
55
- </div>
56
- <div class="wp-review-field-option">
57
- <span class="wp-review-disabled inline-block">
58
- <input name="wp_review_hello_bar[star_rating]" id="wp_review_star_rating" class="small-text" type="number" min="0.5" max="5" step="0.5" value="5" disabled>
59
- </span>
60
- </div>
61
- </div>
62
-
63
- <div class="wp-review-field">
64
- <div class="wp-review-field-label">
65
- <label for="wp_review_price"><?php esc_html_e( 'Price', 'wp-review' ); ?></label>
66
- <?php wp_review_print_pro_text(); ?>
67
- </div>
68
- <div class="wp-review-field-option">
69
- <span class="wp-review-disabled inline-block">
70
- <input name="wp_review_hello_bar[price]" id="wp_review_price" type="text" value="$20" disabled>
71
- </span>
72
- </div>
73
- </div>
74
-
75
- <div class="wp-review-field">
76
- <div class="wp-review-field-label">
77
- <label for="wp_review_button_label"><?php esc_html_e( 'Button label', 'wp-review' ); ?></label>
78
- <?php wp_review_print_pro_text(); ?>
79
- </div>
80
- <div class="wp-review-field-option">
81
- <span class="wp-review-disabled inline-block">
82
- <input name="wp_review_hello_bar[button_label]" id="wp_review_button_label" type="text" value="<?php esc_attr_e( 'Buy Now', 'wp-review' ); ?>" disabled>
83
- </span>
84
- </div>
85
- </div>
86
-
87
- <div class="wp-review-field">
88
- <div class="wp-review-field-label">
89
- <label for="wp_review_button_url"><?php esc_html_e( 'Button URL', 'wp-review' ); ?></label>
90
- <?php wp_review_print_pro_text(); ?>
91
- </div>
92
- <div class="wp-review-field-option">
93
- <span class="wp-review-disabled inline-block">
94
- <input name="wp_review_hello_bar[button_url]" id="wp_review_button_url" class="large-text" type="text" value="#" disabled>
95
- </span>
96
- </div>
97
- </div>
98
-
99
- <div class="wp-review-field">
100
- <div class="wp-review-field-label">
101
- <label><?php esc_html_e( 'Open link in new tab', 'wp-review' ); ?></label>
102
- <?php wp_review_print_pro_text(); ?>
103
- </div>
104
- <div class="wp-review-field-option">
105
- <?php
106
- $form_field->render_switch(
107
- array(
108
- 'id' => 'wp_review_hello_bar_target_blank',
109
- 'name' => 'wp_review_hello_bar[target_blank]',
110
- 'disabled' => true,
111
- )
112
- );
113
- ?>
114
- </div>
115
- </div>
116
- </div>
117
- </div><!-- End .settings-tab-content -->
118
-
119
- <div id="hello-bar-styling" style="display: none;" class="tab-content">
120
- <h3><?php esc_html_e( 'Styling Settings', 'wp-review' ); ?></h3>
121
-
122
- <div class="wp-review-field">
123
- <div class="wp-review-field-label">
124
- <label for="wp_review_hello_bar_location"><?php esc_html_e( 'Location', 'wp-review' ); ?></label>
125
- <?php wp_review_print_pro_text(); ?>
126
- </div>
127
-
128
- <div class="wp-review-field-option">
129
- <span class="wp-review-disabled inline-block has-bg">
130
- <select name="wp_review_hello_bar[location]" id="wp_review_hello_bar_location" disabled>
131
- <option value="top"><?php esc_html_e( 'Top', 'wp-review' ); ?></option>
132
- <option value="bottom"><?php esc_html_e( 'Bottom', 'wp-review' ); ?></option>
133
- </select>
134
- </span>
135
- </div>
136
- </div>
137
-
138
- <div class="wp-review-field">
139
- <div class="wp-review-field-label">
140
- <label for="wp_review_max_container"><?php esc_html_e( 'Max container(px/%)', 'wp-review' ); ?></label>
141
- <?php wp_review_print_pro_text(); ?>
142
- </div>
143
-
144
- <div class="wp-review-field-option">
145
- <span class="wp-review-disabled inline-block">
146
- <input name="wp_review_hello_bar[max_container]" id="wp_review_max_container" type="text" value="1010px" disabled>
147
- </span>
148
- </div>
149
- </div>
150
-
151
- <div class="wp-review-field">
152
- <div class="wp-review-field-label">
153
- <label for="wp_review_bg_color"><?php esc_html_e( 'Background color', 'wp-review' ); ?></label>
154
- <?php wp_review_print_pro_text(); ?>
155
- </div>
156
-
157
- <div class="wp-review-field-option">
158
- <span class="wp-review-disabled inline-block has-bg">
159
- <input type="text" class="wp-review-color" name="wp_review_hello_bar[bg_color]" id="wp_review_bg_color" disabled>
160
- </span>
161
- </div>
162
- </div>
163
-
164
- <div class="wp-review-field">
165
- <div class="wp-review-field-label">
166
- <label for="wp_review_bg_image"><?php esc_html_e( 'Background image', 'wp-review' ); ?></label>
167
- <?php wp_review_print_pro_text(); ?>
168
- </div>
169
-
170
- <div class="wp-review-field-option">
171
- <span class="wpr_image_upload_field wp-review-disabled">
172
- <span class="clearfix" id="wp_review_bg_image-preview"></span>
173
- <button type="button" class="button" name="wp_review_bg_image-upload" id="wp_review_bg_image-upload" data-id="wp_review_bg_image" disabled><?php esc_html_e( 'Select Image', 'wp-review' ); ?></button>
174
- <span class="clear"></span>
175
- </span>
176
- </div>
177
- </div>
178
-
179
- <div class="wp-review-field">
180
- <div class="wp-review-field-label">
181
- <label for="wp_review_text_color"><?php esc_html_e( 'Text color', 'wp-review' ); ?></label>
182
- <?php wp_review_print_pro_text(); ?>
183
- </div>
184
-
185
- <div class="wp-review-field-option">
186
- <span class="wp-review-disabled inline-block has-bg">
187
- <input type="text" class="wp-review-color" name="wp_review_hello_bar[text_color]" id="wp_review_text_color" disabled>
188
- </span>
189
- </div>
190
- </div>
191
-
192
- <div class="wp-review-field">
193
- <div class="wp-review-field-label">
194
- <label for="wp_review_star_color"><?php esc_html_e( 'Star color', 'wp-review' ); ?></label>
195
- <?php wp_review_print_pro_text(); ?>
196
- </div>
197
-
198
- <div class="wp-review-field-option">
199
- <span class="wp-review-disabled inline-block has-bg">
200
- <input type="text" class="wp-review-color" name="wp_review_hello_bar[star_color]" id="wp_review_star_color" disabled>
201
- </span>
202
- </div>
203
- </div>
204
-
205
- <div class="wp-review-field">
206
- <div class="wp-review-field-label">
207
- <label for="wp_review_button_bg_color"><?php esc_html_e( 'Button background color', 'wp-review' ); ?></label>
208
- <?php wp_review_print_pro_text(); ?>
209
- </div>
210
-
211
- <div class="wp-review-field-option">
212
- <span class="wp-review-disabled inline-block has-bg">
213
- <input type="text" class="wp-review-color" name="wp_review_hello_bar[button_bg_color]" id="wp_review_button_bg_color" disabled>
214
- </span>
215
- </div>
216
- </div>
217
-
218
- <div class="wp-review-field">
219
- <div class="wp-review-field-label">
220
- <label for="wp_review_button_text_color"><?php esc_html_e( 'Button text color', 'wp-review' ); ?></label>
221
- <?php wp_review_print_pro_text(); ?>
222
- </div>
223
-
224
- <div class="wp-review-field-option">
225
- <span class="wp-review-disabled inline-block has-bg">
226
- <input type="text" class="wp-review-color" name="wp_review_hello_bar[button_text_color]" id="wp_review_button_text_color" disabled>
227
- </span>
228
- </div>
229
- </div>
230
- </div><!-- End .settings-tab-styling -->
231
- </div>
1
+ <?php
2
+ /**
3
+ * Notification bar options
4
+ *
5
+ * @package WP_Review
6
+ */
7
+
8
+ ?>
9
+ <div data-nav-tabs>
10
+ <div class="nav-tab-wrapper">
11
+ <a href="#hello-bar-content" class="nav-tab nav-tab-active" data-tab="hello-bar-content"><?php esc_html_e( 'Content', 'wp-review' ); ?></a>
12
+ <a href="#hello-bar-styling" class="nav-tab" data-tab="hello-bar-styling"><?php esc_html_e( 'Styling', 'wp-review' ); ?></a>
13
+ </div>
14
+
15
+ <div id="hello-bar-content" class="tab-content">
16
+ <h3><?php esc_html_e( 'Content Settings', 'wp-review' ); ?></h3>
17
+
18
+ <div class="wp-review-field">
19
+ <div class="wp-review-disabled wp-review-field-label">
20
+ <label><?php esc_html_e( 'Enable Global Notification Bar', 'wp-review' ); ?></label>
21
+ <?php wp_review_print_pro_text(); ?>
22
+ </div>
23
+
24
+ <div class="wp-review-field-option">
25
+ <?php
26
+ $form_field->render_switch(
27
+ array(
28
+ 'id' => 'wp_review_hello_bar_enable',
29
+ 'name' => 'wp_review_hello_bar[enable]',
30
+ 'disabled' => true,
31
+ )
32
+ );
33
+ ?>
34
+ </div>
35
+ </div>
36
+
37
+ <div class="hide-if-hello-bar-disable">
38
+
39
+ <div class="wp-review-field">
40
+ <div class="wp-review-disabled wp-review-field-label">
41
+ <label for="wp_review_text"><?php esc_html_e( 'Text', 'wp-review' ); ?></label>
42
+ <?php wp_review_print_pro_text(); ?>
43
+ </div>
44
+ <div class="wp-review-field-option">
45
+ <span class="wp-review-disabled inline-block">
46
+ <input name="wp_review_hello_bar[text]" id="wp_review_text" class="large-text" type="text" disabled>
47
+ </span>
48
+ </div>
49
+ </div>
50
+
51
+ <div class="wp-review-field">
52
+ <div class="wp-review-disabled wp-review-field-label">
53
+ <label for="wp_review_star_rating"><?php esc_html_e( 'Star Rating', 'wp-review' ); ?></label>
54
+ <?php wp_review_print_pro_text(); ?>
55
+ </div>
56
+ <div class="wp-review-field-option">
57
+ <span class="wp-review-disabled inline-block">
58
+ <input name="wp_review_hello_bar[star_rating]" id="wp_review_star_rating" class="small-text" type="number" min="0.5" max="5" step="0.5" value="5" disabled>
59
+ </span>
60
+ </div>
61
+ </div>
62
+
63
+ <div class="wp-review-field">
64
+ <div class="wp-review-disabled wp-review-field-label">
65
+ <label for="wp_review_price"><?php esc_html_e( 'Price', 'wp-review' ); ?></label>
66
+ <?php wp_review_print_pro_text(); ?>
67
+ </div>
68
+ <div class="wp-review-field-option">
69
+ <span class="wp-review-disabled inline-block">
70
+ <input name="wp_review_hello_bar[price]" id="wp_review_price" type="text" value="$20" disabled>
71
+ </span>
72
+ </div>
73
+ </div>
74
+
75
+ <div class="wp-review-field">
76
+ <div class="wp-review-disabled wp-review-field-label">
77
+ <label for="wp_review_button_label"><?php esc_html_e( 'Button label', 'wp-review' ); ?></label>
78
+ <?php wp_review_print_pro_text(); ?>
79
+ </div>
80
+ <div class="wp-review-field-option">
81
+ <span class="wp-review-disabled inline-block">
82
+ <input name="wp_review_hello_bar[button_label]" id="wp_review_button_label" type="text" value="<?php esc_attr_e( 'Buy Now', 'wp-review' ); ?>" disabled>
83
+ </span>
84
+ </div>
85
+ </div>
86
+
87
+ <div class="wp-review-field">
88
+ <div class="wp-review-disabled wp-review-field-label">
89
+ <label for="wp_review_button_url"><?php esc_html_e( 'Button URL', 'wp-review' ); ?></label>
90
+ <?php wp_review_print_pro_text(); ?>
91
+ </div>
92
+ <div class="wp-review-field-option">
93
+ <span class="wp-review-disabled inline-block">
94
+ <input name="wp_review_hello_bar[button_url]" id="wp_review_button_url" class="large-text" type="text" value="#" disabled>
95
+ </span>
96
+ </div>
97
+ </div>
98
+
99
+ <div class="wp-review-field">
100
+ <div class="wp-review-disabled wp-review-field-label">
101
+ <label><?php esc_html_e( 'Open link in new tab', 'wp-review' ); ?></label>
102
+ <?php wp_review_print_pro_text(); ?>
103
+ </div>
104
+ <div class="wp-review-field-option">
105
+ <?php
106
+ $form_field->render_switch(
107
+ array(
108
+ 'id' => 'wp_review_hello_bar_target_blank',
109
+ 'name' => 'wp_review_hello_bar[target_blank]',
110
+ 'disabled' => true,
111
+ )
112
+ );
113
+ ?>
114
+ </div>
115
+ </div>
116
+ </div>
117
+ </div><!-- End .settings-tab-content -->
118
+
119
+ <div id="hello-bar-styling" style="display: none;" class="tab-content">
120
+ <h3><?php esc_html_e( 'Styling Settings', 'wp-review' ); ?></h3>
121
+
122
+ <div class="wp-review-field">
123
+ <div class="wp-review-disabled wp-review-field-label">
124
+ <label for="wp_review_hello_bar_location"><?php esc_html_e( 'Location', 'wp-review' ); ?></label>
125
+ <?php wp_review_print_pro_text(); ?>
126
+ </div>
127
+
128
+ <div class="wp-review-field-option">
129
+ <span class="wp-review-disabled inline-block has-bg">
130
+ <select name="wp_review_hello_bar[location]" id="wp_review_hello_bar_location" disabled>
131
+ <option value="top"><?php esc_html_e( 'Top', 'wp-review' ); ?></option>
132
+ <option value="bottom"><?php esc_html_e( 'Bottom', 'wp-review' ); ?></option>
133
+ </select>
134
+ </span>
135
+ </div>
136
+ </div>
137
+
138
+ <div class="wp-review-field">
139
+ <div class="wp-review-disabled wp-review-field-label">
140
+ <label for="wp_review_max_container"><?php esc_html_e( 'Max container(px/%)', 'wp-review' ); ?></label>
141
+ <?php wp_review_print_pro_text(); ?>
142
+ </div>
143
+
144
+ <div class="wp-review-field-option">
145
+ <span class="wp-review-disabled inline-block">
146
+ <input name="wp_review_hello_bar[max_container]" id="wp_review_max_container" type="text" value="1010px" disabled>
147
+ </span>
148
+ </div>
149
+ </div>
150
+
151
+ <div class="wp-review-field">
152
+ <div class="wp-review-disabled wp-review-field-label">
153
+ <label for="wp_review_bg_color"><?php esc_html_e( 'Background color', 'wp-review' ); ?></label>
154
+ <?php wp_review_print_pro_text(); ?>
155
+ </div>
156
+
157
+ <div class="wp-review-field-option">
158
+ <span class="wp-review-disabled inline-block has-bg">
159
+ <input type="text" class="wp-review-color" name="wp_review_hello_bar[bg_color]" id="wp_review_bg_color" disabled>
160
+ </span>
161
+ </div>
162
+ </div>
163
+
164
+ <div class="wp-review-field">
165
+ <div class="wp-review-disabled wp-review-field-label">
166
+ <label for="wp_review_bg_image"><?php esc_html_e( 'Background image', 'wp-review' ); ?></label>
167
+ <?php wp_review_print_pro_text(); ?>
168
+ </div>
169
+
170
+ <div class="wp-review-field-option">
171
+ <span class="wpr_image_upload_field wp-review-disabled">
172
+ <span class="clearfix" id="wp_review_bg_image-preview"></span>
173
+ <button type="button" class="button" name="wp_review_bg_image-upload" id="wp_review_bg_image-upload" data-id="wp_review_bg_image" disabled><?php esc_html_e( 'Select Image', 'wp-review' ); ?></button>
174
+ <span class="clear"></span>
175
+ </span>
176
+ </div>
177
+ </div>
178
+
179
+ <div class="wp-review-field">
180
+ <div class="wp-review-disabled wp-review-field-label">
181
+ <label for="wp_review_text_color"><?php esc_html_e( 'Text color', 'wp-review' ); ?></label>
182
+ <?php wp_review_print_pro_text(); ?>
183
+ </div>
184
+
185
+ <div class="wp-review-field-option">
186
+ <span class="wp-review-disabled inline-block has-bg">
187
+ <input type="text" class="wp-review-color" name="wp_review_hello_bar[text_color]" id="wp_review_text_color" disabled>
188
+ </span>
189
+ </div>
190
+ </div>
191
+
192
+ <div class="wp-review-field">
193
+ <div class="wp-review-disabled wp-review-field-label">
194
+ <label for="wp_review_star_color"><?php esc_html_e( 'Star color', 'wp-review' ); ?></label>
195
+ <?php wp_review_print_pro_text(); ?>
196
+ </div>
197
+
198
+ <div class="wp-review-field-option">
199
+ <span class="wp-review-disabled inline-block has-bg">
200
+ <input type="text" class="wp-review-color" name="wp_review_hello_bar[star_color]" id="wp_review_star_color" disabled>
201
+ </span>
202
+ </div>
203
+ </div>
204
+
205
+ <div class="wp-review-field">
206
+ <div class="wp-review-disabled wp-review-field-label">
207
+ <label for="wp_review_button_bg_color"><?php esc_html_e( 'Button background color', 'wp-review' ); ?></label>
208
+ <?php wp_review_print_pro_text(); ?>
209
+ </div>
210
+
211
+ <div class="wp-review-field-option">
212
+ <span class="wp-review-disabled inline-block has-bg">
213
+ <input type="text" class="wp-review-color" name="wp_review_hello_bar[button_bg_color]" id="wp_review_button_bg_color" disabled>
214
+ </span>
215
+ </div>
216
+ </div>
217
+
218
+ <div class="wp-review-field">
219
+ <div class="wp-review-disabled wp-review-field-label">
220
+ <label for="wp_review_button_text_color"><?php esc_html_e( 'Button text color', 'wp-review' ); ?></label>
221
+ <?php wp_review_print_pro_text(); ?>
222
+ </div>
223
+
224
+ <div class="wp-review-field-option">
225
+ <span class="wp-review-disabled inline-block has-bg">
226
+ <input type="text" class="wp-review-color" name="wp_review_hello_bar[button_text_color]" id="wp_review_button_text_color" disabled>
227
+ </span>
228
+ </div>
229
+ </div>
230
+ </div><!-- End .settings-tab-styling -->
231
+ </div>
admin/options/help.php CHANGED
@@ -1,27 +1,27 @@
1
- <?php
2
- /**
3
- * Help tab
4
- *
5
- * @package WP_Review
6
- */
7
-
8
- ?>
9
- <p>
10
- <iframe width="560" height="315" src="https://www.youtube.com/embed/NzMe-QY_WZY" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
11
- </p>
12
- <p>
13
- <?php _e( 'All support for this plugin is provided through our forums. If you have not registered yet, you can do so here for ​<strong>FREE​</strong>: ', 'wp-review' ); ?>
14
- <a target="_blank" href="https://mythemeshop.com/#signup">https://mythemeshop.com/#signup</a>
15
- </p>
16
- <p>
17
- <?php _e( 'Check our free WordPress video tutorials here: ', 'wp-review' ); ?>
18
- <a target="_blank" href="https://mythemeshop.com/wordpress-101/">https://mythemeshop.com/wordpress-101/</a>
19
- <?php _e( '(no registration required)', 'wp-review' ); ?>
20
- </p>
21
- <p>
22
- <?php _e( 'Thank you for using our plugin.', 'wp-review' ); ?>
23
- </p>
24
-
25
- <p class="submit">
26
- <a href="https://mythemeshop.com/#login" target="_blank" class="button-primary"><?php _e( 'Get Support' ); ?></a>
27
- </p>
1
+ <?php
2
+ /**
3
+ * Help tab
4
+ *
5
+ * @package WP_Review
6
+ */
7
+
8
+ ?>
9
+ <p>
10
+ <iframe width="560" height="315" src="https://www.youtube.com/embed/NzMe-QY_WZY" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
11
+ </p>
12
+ <p>
13
+ <?php _e( 'All support for this plugin is provided through our forums. If you have not registered yet, you can do so here for ​<strong>FREE​</strong>: ', 'wp-review' ); ?>
14
+ <a target="_blank" href="https://mythemeshop.com/#signup">https://mythemeshop.com/#signup</a>
15
+ </p>
16
+ <p>
17
+ <?php _e( 'Check our free WordPress video tutorials here: ', 'wp-review' ); ?>
18
+ <a target="_blank" href="https://mythemeshop.com/wordpress-101/">https://mythemeshop.com/wordpress-101/</a>
19
+ <?php _e( '(no registration required)', 'wp-review' ); ?>
20
+ </p>
21
+ <p>
22
+ <?php _e( 'Thank you for using our plugin.', 'wp-review' ); ?>
23
+ </p>
24
+
25
+ <p class="submit">
26
+ <a href="https://mythemeshop.com/#login" target="_blank" class="button-primary"><?php _e( 'Get Support' ); ?></a>
27
+ </p>
admin/options/import.php CHANGED
@@ -1,79 +1,79 @@
1
- <?php
2
- /**
3
- * Import options
4
- *
5
- * @package WP_Review
6
- */
7
-
8
- ?>
9
-
10
- <div class="wp-review-field">
11
- <div class="wp-review-field-label">
12
- <label><?php esc_html_e( 'Demo data import', 'wp-review' ); ?></label>
13
- </div>
14
-
15
- <div class="wp-review-field-option">
16
- <button type="button" id="wp-review-import-demo-button" class="button" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_review_import_demo' ) ); ?>"><?php esc_html_e( 'Import', 'wp-review' ); ?></button>
17
- <p class="description"><?php esc_html_e( 'Click above button to import demo data, imported data will be saved as new draft posts.', 'wp-review' ); ?></p>
18
- </div>
19
- </div>
20
-
21
- <div class="wp-review-field">
22
- <div class="wp-review-field-label">
23
- <label for="wp-review-import-source"><?php esc_html_e( 'Select plugin', 'wp-review' ); ?></label>
24
- </div>
25
-
26
- <div class="wp-review-field-option">
27
- <select id="wp-review-import-source">
28
- <option value="">---</option>
29
- <option value="yet-another-stars-rating">Yasr – Yet Another Stars Rating</option>
30
- <option value="author-hreview">Author hReview</option>
31
- <option value="wp-rich-snippets">WP Rich Snippets</option>
32
- <option value="ultimate-reviews">Reviews</option>
33
- <option value="wp-product-review">WP Product Review</option>
34
- <option value="gd-rating-system">GD Rating System</option>
35
- </select>
36
-
37
- <span class="wp-review-disabled">
38
- <?php submit_button( __( 'Import', 'wp-review' ), 'large', 'wp-review-import', false, array( 'disabled' => 'disabled' ) ); ?>
39
- </span>
40
-
41
- <p class="description">
42
- <?php
43
- printf(
44
- '<strong>%1$s</strong>: %2$s ',
45
- esc_html__( 'Warning', 'wp-review' ),
46
- esc_html__( 'This action is IRREVERSIBLE! Take a backup of your database before proceeding.', 'wp-review' )
47
- );
48
- ?>
49
- </p>
50
-
51
- <input type="hidden" id="wp-review-import-nonce" value="<?php echo esc_attr( wp_create_nonce( 'wp_review_import_rating' ) ); ?>">
52
- </div>
53
- </div>
54
-
55
- <div class="wp-review-field">
56
- <div class="wp-review-field-label">
57
- <label><?php esc_html_e( 'Import settings', 'wp-review' ); ?></label>
58
- </div>
59
-
60
- <div class="wp-review-field-option">
61
- <button type="button" class="button" onclick="jQuery(this).next().slideToggle( 'fast' )"><?php esc_html_e( 'Import code', 'wp-review' ); ?></button>
62
- <div style="display: none;">
63
- <p class="description"><?php esc_html_e( 'Insert your backup code below and hit Import to restore your plugin options from a backup.', 'wp-review' ); ?></p>
64
- <p><textarea id="wp-review-import-options-code" class="widefat" cols="30" rows="10"></textarea></p>
65
- <p><button type="button" class="button button-primary" id="wp-review-import-options-btn"><?php esc_html_e( 'Import', 'wp-review' ); ?></button></p>
66
- </div>
67
- </div>
68
- </div>
69
-
70
- <div class="wp-review-field">
71
- <div class="wp-review-field-label">
72
- <label><?php esc_html_e( 'Export settings', 'wp-review' ); ?></label>
73
- </div>
74
-
75
- <div class="wp-review-field-option">
76
- <button type="button" class="button" onclick="jQuery(this).next().slideToggle( 'fast' )"><?php esc_html_e( 'Show export code', 'wp-review' ); ?></button>
77
- <p style="display: none;"><textarea class="widefat" cols="30" rows="10" onfocus="this.select()"><?php echo esc_textarea( wp_review_get_options_export_code() ); ?></textarea></p>
78
- </div>
79
- </div>
1
+ <?php
2
+ /**
3
+ * Import options
4
+ *
5
+ * @package WP_Review
6
+ */
7
+
8
+ ?>
9
+
10
+ <div class="wp-review-field">
11
+ <div class="wp-review-field-label">
12
+ <label><?php esc_html_e( 'Demo data import', 'wp-review' ); ?></label>
13
+ </div>
14
+
15
+ <div class="wp-review-field-option">
16
+ <button type="button" id="wp-review-import-demo-button" class="button" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_review_import_demo' ) ); ?>"><?php esc_html_e( 'Import', 'wp-review' ); ?></button>
17
+ <p class="description"><?php esc_html_e( 'Click above button to import demo data, imported data will be saved as new draft posts.', 'wp-review' ); ?></p>
18
+ </div>
19
+ </div>
20
+
21
+ <div class="wp-review-field">
22
+ <div class="wp-review-field-label">
23
+ <label for="wp-review-import-source"><?php esc_html_e( 'Select plugin', 'wp-review' ); ?></label>
24
+ </div>
25
+
26
+ <div class="wp-review-field-option">
27
+ <select id="wp-review-import-source">
28
+ <option value="">---</option>
29
+ <option value="yet-another-stars-rating">Yasr – Yet Another Stars Rating</option>
30
+ <option value="author-hreview">Author hReview</option>
31
+ <option value="wp-rich-snippets">WP Rich Snippets</option>
32
+ <option value="ultimate-reviews">Reviews</option>
33
+ <option value="wp-product-review">WP Product Review</option>
34
+ <option value="gd-rating-system">GD Rating System</option>
35
+ </select>
36
+
37
+ <span class="wp-review-disabled">
38
+ <?php submit_button( __( 'Import', 'wp-review' ), 'large', 'wp-review-import', false, array( 'disabled' => 'disabled' ) ); ?>
39
+ </span>
40
+
41
+ <p class="description">
42
+ <?php
43
+ printf(
44
+ '<strong>%1$s</strong>: %2$s ',
45
+ esc_html__( 'Warning', 'wp-review' ),
46
+ esc_html__( 'This action is IRREVERSIBLE! Take a backup of your database before proceeding.', 'wp-review' )
47
+ );
48
+ ?>
49
+ </p>
50
+
51
+ <input type="hidden" id="wp-review-import-nonce" value="<?php echo esc_attr( wp_create_nonce( 'wp_review_import_rating' ) ); ?>">
52
+ </div>
53
+ </div>
54
+
55
+ <div class="wp-review-field">
56
+ <div class="wp-review-field-label">
57
+ <label><?php esc_html_e( 'Import settings', 'wp-review' ); ?></label>
58
+ </div>
59
+
60
+ <div class="wp-review-field-option">
61
+ <button type="button" class="button" onclick="jQuery(this).next().slideToggle( 'fast' )"><?php esc_html_e( 'Import code', 'wp-review' ); ?></button>
62
+ <div style="display: none;">
63
+ <p class="description"><?php esc_html_e( 'Insert your backup code below and hit Import to restore your plugin options from a backup.', 'wp-review' ); ?></p>
64
+ <p><textarea id="wp-review-import-options-code" class="widefat" cols="30" rows="10"></textarea></p>
65
+ <p><button type="button" class="button button-primary" id="wp-review-import-options-btn"><?php esc_html_e( 'Import', 'wp-review' ); ?></button></p>
66
+ </div>
67
+ </div>
68
+ </div>
69
+
70
+ <div class="wp-review-field">
71
+ <div class="wp-review-field-label">
72
+ <label><?php esc_html_e( 'Export settings', 'wp-review' ); ?></label>
73
+ </div>
74
+
75
+ <div class="wp-review-field-option">
76
+ <button type="button" class="button" onclick="jQuery(this).next().slideToggle( 'fast' )"><?php esc_html_e( 'Show export code', 'wp-review' ); ?></button>
77
+ <p style="display: none;"><textarea class="widefat" cols="30" rows="10" onfocus="this.select()"><?php echo esc_textarea( wp_review_get_options_export_code() ); ?></textarea></p>
78
+ </div>
79
+ </div>
admin/options/multisite.php CHANGED
@@ -1,344 +1,344 @@
1
- <?php
2
- /**
3
- * Multisite options
4
- *
5
- * @package WP_Review
6
- */
7
-
8
- ?>
9
- <?php $sites = get_sites(); ?>
10
- <div class="wp-review-field wp-review-select-site">
11
- <div class="wp-review-field-label">
12
- <label for="wp-review-select-site"><strong><?php esc_html_e( 'Site: ', 'wp-review' ); ?></strong></label>
13
- </div>
14
-
15
- <div class="wp-review-field-option">
16
- <select id="wp-review-select-site">
17
- <option value=""><?php esc_html_e( 'Select site', 'wp-review' ); ?></option>
18
- <?php
19
- if ( ! empty( $sites ) ) {
20
- foreach ( $sites as $site ) {
21
- if ( is_main_site( $site->blog_id ) ) {
22
- continue;
23
- }
24
- $blog_details = get_blog_details( $site->blog_id );
25
- ?>
26
- <option value="<?php echo intval( $site->blog_id ); ?>"><?php echo esc_html( $blog_details->blogname ); ?></option>
27
- <?php
28
- }
29
- }
30
- ?>
31
- </select>
32
- </div>
33
- </div>
34
-
35
- <?php
36
- foreach ( $sites as $site ) {
37
- if ( ! is_main_site( $site->blog_id ) ) {
38
- $hide_options = wp_review_option( 'hide_global_options_' . $site->blog_id );
39
- $hide_role_manager = wp_review_option( 'hide_role_manager_' . $site->blog_id );
40
- $hide_import = wp_review_option( 'hide_import_' . $site->blog_id );
41
- ?>
42
- <div class="wp-review-subsite-wrapper" id="wp-review-site-<?php echo intval( $site->blog_id ); ?>-fields">
43
- <h3><?php esc_html_e( 'General Settings', 'wp-review' ); ?></h3>
44
- <div class="wp-review-field wp-review-multisite-general-settings">
45
- <div class="wp-review-field-label">
46
- <label><?php esc_html_e( 'Hide global options panel', 'wp-review' ); ?></label>
47
- </div>
48
-
49
- <div class="wp-review-field-option">
50
- <?php
51
- $form_field->render_switch(
52
- array(
53
- 'id' => 'wp_review_show_global_options_' . $site->blog_id,
54
- 'name' => 'wp_review_options[hide_global_options_' . $site->blog_id . ']',
55
- 'value' => ! empty( $hide_options ),
56
- )
57
- );
58
- ?>
59
- </div>
60
- </div>
61
- <?php $hide = $hide_options ? 'style="display: none;"' : ''; ?>
62
- <div class="wp-review-multisite-global-options" <?php echo $hide; // WPCS: xss ok. ?>>
63
-
64
- <div class="wp-review-field">
65
- <div class="wp-review-field-label">
66
- <label><?php esc_html_e( 'Hide Popup', 'wp-review' ); ?></label>
67
- <?php wp_review_print_pro_text(); ?>
68
- </div>
69
-
70
- <div class="wp-review-field-option">
71
- <?php
72
- $form_field->render_switch(
73
- array(
74
- 'id' => 'wp_review_hide_general_popup_' . $site->blog_id,
75
- 'name' => 'wp_review_options[hide_general_popup_' . $site->blog_id . ']',
76
- 'disabled' => true,
77
- )
78
- );
79
- ?>
80
- </div>
81
- </div>
82
-
83
- <div class="wp-review-field">
84
- <div class="wp-review-field-label">
85
- <label><?php esc_html_e( 'Hide Notification Bar', 'wp-review' ); ?></label>
86
- <?php wp_review_print_pro_text(); ?>
87
- </div>
88
-
89
- <div class="wp-review-field-option">
90
- <?php
91
- $form_field->render_switch(
92
- array(
93
- 'id' => 'wp_review_hide_general_bar_' . $site->blog_id,
94
- 'name' => 'wp_review_options[hide_general_bar_' . $site->blog_id . ']',
95
- 'disabled' => true,
96
- )
97
- );
98
- ?>
99
- </div>
100
- </div>
101
-
102
- <div class="wp-review-field">
103
- <div class="wp-review-field-label">
104
- <label><?php esc_html_e( 'Hide Yelp Reviews', 'wp-review' ); ?></label>
105
- <?php wp_review_print_pro_text(); ?>
106
- </div>
107
-
108
- <div class="wp-review-field-option">
109
- <?php
110
- $form_field->render_switch(
111
- array(
112
- 'id' => 'wp_review_hide_yelp_reviews_' . $site->blog_id,
113
- 'name' => 'wp_review_options[hide_yelp_reviews_' . $site->blog_id . ']',
114
- 'disabled' => true,
115
- )
116
- );
117
- ?>
118
- </div>
119
- </div>
120
-
121
- <div class="wp-review-field">
122
- <div class="wp-review-field-label">
123
- <label><?php esc_html_e( 'Hide Facebook Reviews', 'wp-review' ); ?></label>
124
- <?php wp_review_print_pro_text(); ?>
125
- </div>
126
-
127
- <div class="wp-review-field-option">
128
- <?php
129
- $form_field->render_switch(
130
- array(
131
- 'id' => 'wp_review_hide_facebook_reviews_' . $site->blog_id,
132
- 'name' => 'wp_review_options[hide_facebook_reviews_' . $site->blog_id . ']',
133
- 'disabled' => true,
134
- )
135
- );
136
- ?>
137
- </div>
138
- </div>
139
-
140
- <div class="wp-review-field">
141
- <div class="wp-review-field-label">
142
- <label><?php esc_html_e( 'Hide Google Reviews', 'wp-review' ); ?></label>
143
- <?php wp_review_print_pro_text(); ?>
144
- </div>
145
-
146
- <div class="wp-review-field-option">
147
- <?php
148
- $form_field->render_switch(
149
- array(
150
- 'id' => 'wp_review_hide_google_reviews_' . $site->blog_id,
151
- 'name' => 'wp_review_options[hide_google_reviews_' . $site->blog_id . ']',
152
- 'disabled' => true,
153
- )
154
- );
155
- ?>
156
- </div>
157
- </div>
158
-
159
- <div class="wp-review-field">
160
- <div class="wp-review-field-label">
161
- <label><?php esc_html_e( 'Hide Role Manager', 'wp-review' ); ?></label>
162
- </div>
163
-
164
- <div class="wp-review-field-option">
165
- <?php
166
- $form_field->render_switch(
167
- array(
168
- 'id' => 'wp_review_hide_role_manager_' . $site->blog_id,
169
- 'name' => 'wp_review_options[hide_role_manager_' . $site->blog_id . ']',
170
- 'value' => ! empty( $hide_role_manager ),
171
- )
172
- );
173
- ?>
174
- </div>
175
- </div>
176
-
177
- <div class="wp-review-field">
178
- <div class="wp-review-field-label">
179
- <label><?php esc_html_e( 'Hide Import', 'wp-review' ); ?></label>
180
- </div>
181
-
182
- <div class="wp-review-field-option">
183
- <?php
184
- $form_field->render_switch(
185
- array(
186
- 'id' => 'wp_review_hide_import_' . $site->blog_id,
187
- 'name' => 'wp_review_options[hide_import_' . $site->blog_id . ']',
188
- 'value' => ! empty( $hide_import ),
189
- )
190
- );
191
- ?>
192
- </div>
193
- </div>
194
-
195
- </div>
196
- <br />
197
- <h3><?php esc_html_e( 'Post Settings', 'wp-review' ); ?></h3>
198
- <?php
199
- $hide_in_posts = wp_review_option( 'hide_ratings_in_posts_' . $site->blog_id );
200
-
201
- $hide_review_links = wp_review_option( 'hide_review_links_' . $site->blog_id );
202
- $hide_user_reviews = wp_review_option( 'hide_user_reviews_' . $site->blog_id );
203
- ?>
204
- <div class="wp-review-multisite-posts-options">
205
- <div class="wp-review-field">
206
- <div class="wp-review-field-label">
207
- <label><?php esc_html_e( 'Hide reviews in single editor', 'wp-review' ); ?></label>
208
- </div>
209
-
210
- <div class="wp-review-field-option">
211
- <?php
212
- $form_field->render_switch(
213
- array(
214
- 'id' => 'wp_review_hide_ratings_in_posts_' . $site->blog_id,
215
- 'name' => 'wp_review_options[hide_ratings_in_posts_' . $site->blog_id . ']',
216
- 'value' => ! empty( $hide_in_posts ),
217
- )
218
- );
219
- ?>
220
- </div>
221
- </div>
222
- </div>
223
-
224
- <?php $hide = $hide_in_posts ? 'style="display: none;"' : ''; ?>
225
- <div id="wp-review-multisite-posts-options" <?php echo $hide; // WPCS: xss ok. ?>>
226
-
227
- <div class="wp-review-field">
228
- <div class="wp-review-field-label">
229
- <label><?php esc_html_e( 'Hide Popup Box', 'wp-review' ); ?></label>
230
- <?php wp_review_print_pro_text(); ?>
231
- </div>
232
-
233
- <div class="wp-review-field-option">
234
- <?php
235
- $form_field->render_switch(
236
- array(
237
- 'id' => 'wp_review_hide_popup_box__' . $site->blog_id,
238
- 'name' => 'wp_review_options[hide_popup_box_' . $site->blog_id . ']',
239
- 'disabled' => true,
240
- )
241
- );
242
- ?>
243
- </div>
244
- </div>
245
-
246
- <div class="wp-review-field">
247
- <div class="wp-review-field-label">
248
- <label><?php esc_html_e( 'Hide Notification Bar', 'wp-review' ); ?></label>
249
- <?php wp_review_print_pro_text(); ?>
250
- </div>
251
-
252
- <div class="wp-review-field-option">
253
- <?php
254
- $form_field->render_switch(
255
- array(
256
- 'id' => 'wp_review_hide_notification_bar__' . $site->blog_id,
257
- 'name' => 'wp_review_options[hide_notification_bar_' . $site->blog_id . ']',
258
- 'disabled' => true,
259
- )
260
- );
261
- ?>
262
- </div>
263
- </div>
264
-
265
- <div class="wp-review-field">
266
- <div class="wp-review-field-label">
267
- <label><?php esc_html_e( 'Hide Features', 'wp-review' ); ?></label>
268
- <?php wp_review_print_pro_text(); ?>
269
- </div>
270
-
271
- <div class="wp-review-field-option">
272
- <?php
273
- $form_field->render_switch(
274
- array(
275
- 'id' => 'wp_review_hide_features__' . $site->blog_id,
276
- 'name' => 'wp_review_options[hide_features_' . $site->blog_id . ']',
277
- 'disabled' => true,
278
- )
279
- );
280
- ?>
281
- </div>
282
- </div>
283
-
284
- <div class="wp-review-field">
285
- <div class="wp-review-field-label">
286
- <label><?php esc_html_e( 'Hide Review Links', 'wp-review' ); ?></label>
287
- </div>
288
-
289
- <div class="wp-review-field-option">
290
- <?php
291
- $form_field->render_switch(
292
- array(
293
- 'id' => 'wp_review_hide_review_links__' . $site->blog_id,
294
- 'name' => 'wp_review_options[hide_review_links_' . $site->blog_id . ']',
295
- 'value' => ! empty( $hide_review_links ),
296
- )
297
- );
298
- ?>
299
- </div>
300
- </div>
301
-
302
- <div class="wp-review-field">
303
- <div class="wp-review-field-label">
304
- <label><?php esc_html_e( 'Hide Review Description, Pros/Cons & Total Rating', 'wp-review' ); ?></label>
305
- <?php wp_review_print_pro_text(); ?>
306
- </div>
307
-
308
- <div class="wp-review-field-option">
309
- <?php
310
- $form_field->render_switch(
311
- array(
312
- 'id' => 'wp_review_hide_review_description__' . $site->blog_id,
313
- 'name' => 'wp_review_options[hide_review_description_' . $site->blog_id . ']',
314
- 'disabled' => true,
315
- )
316
- );
317
- ?>
318
- </div>
319
- </div>
320
-
321
- <div class="wp-review-field">
322
- <div class="wp-review-field-label">
323
- <label><?php esc_html_e( 'Hide User Reviews', 'wp-review' ); ?></label>
324
- </div>
325
-
326
- <div class="wp-review-field-option">
327
- <?php
328
- $form_field->render_switch(
329
- array(
330
- 'id' => 'wp_review_hide_user_reviews__' . $site->blog_id,
331
- 'name' => 'wp_review_options[hide_user_reviews_' . $site->blog_id . ']',
332
- 'value' => ! empty( $hide_user_reviews ),
333
- )
334
- );
335
- ?>
336
- </div>
337
- </div>
338
-
339
- </div>
340
-
341
- </div>
342
- <?php
343
- }
344
- } ?>
1
+ <?php
2
+ /**
3
+ * Multisite options
4
+ *
5
+ * @package WP_Review
6
+ */
7
+
8
+ ?>
9
+ <?php $sites = get_sites(); ?>
10
+ <div class="wp-review-field wp-review-select-site">
11
+ <div class="wp-review-field-label">
12
+ <label for="wp-review-select-site"><strong><?php esc_html_e( 'Site: ', 'wp-review' ); ?></strong></label>
13
+ </div>
14
+
15
+ <div class="wp-review-field-option">
16
+ <select id="wp-review-select-site">
17
+ <option value=""><?php esc_html_e( 'Select site', 'wp-review' ); ?></option>
18
+ <?php
19
+ if ( ! empty( $sites ) ) {
20
+ foreach ( $sites as $site ) {
21
+ if ( is_main_site( $site->blog_id ) ) {
22
+ continue;
23
+ }
24
+ $blog_details = get_blog_details( $site->blog_id );
25
+ ?>
26
+ <option value="<?php echo intval( $site->blog_id ); ?>"><?php echo esc_html( $blog_details->blogname ); ?></option>
27
+ <?php
28
+ }
29
+ }
30
+ ?>
31
+ </select>
32
+ </div>
33
+ </div>
34
+
35
+ <?php
36
+ foreach ( $sites as $site ) {
37
+ if ( ! is_main_site( $site->blog_id ) ) {
38
+ $hide_options = wp_review_option( 'hide_global_options_' . $site->blog_id );
39
+ $hide_role_manager = wp_review_option( 'hide_role_manager_' . $site->blog_id );
40
+ $hide_import = wp_review_option( 'hide_import_' . $site->blog_id );
41
+ ?>
42
+ <div class="wp-review-subsite-wrapper" id="wp-review-site-<?php echo intval( $site->blog_id ); ?>-fields">
43
+ <h3><?php esc_html_e( 'General Settings', 'wp-review' ); ?></h3>
44
+ <div class="wp-review-field wp-review-multisite-general-settings">
45
+ <div class="wp-review-field-label">
46
+ <label><?php esc_html_e( 'Hide global options panel', 'wp-review' ); ?></label>
47
+ </div>
48
+
49
+ <div class="wp-review-field-option">
50
+ <?php
51
+ $form_field->render_switch(
52
+ array(
53
+ 'id' => 'wp_review_show_global_options_' . $site->blog_id,
54
+ 'name' => 'wp_review_options[hide_global_options_' . $site->blog_id . ']',
55
+ 'value' => ! empty( $hide_options ),
56
+ )
57
+ );
58
+ ?>
59
+ </div>
60
+ </div>
61
+ <?php $hide = $hide_options ? 'style="display: none;"' : ''; ?>
62
+ <div class="wp-review-multisite-global-options" <?php echo $hide; // WPCS: xss ok. ?>>
63
+
64
+ <div class="wp-review-field">
65
+ <div class="wp-review-field-label">
66
+ <label><?php esc_html_e( 'Hide Popup', 'wp-review' ); ?></label>
67
+ <?php wp_review_print_pro_text(); ?>
68
+ </div>
69
+
70
+ <div class="wp-review-field-option">
71
+ <?php
72
+ $form_field->render_switch(
73
+ array(
74
+ 'id' => 'wp_review_hide_general_popup_' . $site->blog_id,
75
+ 'name' => 'wp_review_options[hide_general_popup_' . $site->blog_id . ']',
76
+ 'disabled' => true,
77
+ )
78
+ );
79
+ ?>
80
+ </div>
81
+ </div>
82
+
83
+ <div class="wp-review-field">
84
+ <div class="wp-review-field-label">
85
+ <label><?php esc_html_e( 'Hide Notification Bar', 'wp-review' ); ?></label>
86
+ <?php wp_review_print_pro_text(); ?>
87
+ </div>
88
+
89
+ <div class="wp-review-field-option">
90
+ <?php
91
+ $form_field->render_switch(
92
+ array(
93
+ 'id' => 'wp_review_hide_general_bar_' . $site->blog_id,
94
+ 'name' => 'wp_review_options[hide_general_bar_' . $site->blog_id . ']',
95
+ 'disabled' => true,
96
+ )
97
+ );
98
+ ?>
99
+ </div>
100
+ </div>
101
+
102
+ <div class="wp-review-field">
103
+ <div class="wp-review-field-label">
104
+ <label><?php esc_html_e( 'Hide Yelp Reviews', 'wp-review' ); ?></label>
105
+ <?php wp_review_print_pro_text(); ?>
106
+ </div>
107
+
108
+ <div class="wp-review-field-option">
109
+ <?php
110
+ $form_field->render_switch(
111
+ array(
112
+ 'id' => 'wp_review_hide_yelp_reviews_' . $site->blog_id,
113
+ 'name' => 'wp_review_options[hide_yelp_reviews_' . $site->blog_id . ']',
114
+ 'disabled' => true,
115
+ )
116
+ );
117
+ ?>
118
+ </div>
119
+ </div>
120
+
121
+ <div class="wp-review-field">
122
+ <div class="wp-review-field-label">
123
+ <label><?php esc_html_e( 'Hide Facebook Reviews', 'wp-review' ); ?></label>
124
+ <?php wp_review_print_pro_text(); ?>
125
+ </div>
126
+
127
+ <div class="wp-review-field-option">
128
+ <?php
129
+ $form_field->render_switch(
130
+ array(
131
+ 'id' => 'wp_review_hide_facebook_reviews_' . $site->blog_id,
132
+ 'name' => 'wp_review_options[hide_facebook_reviews_' . $site->blog_id . ']',
133
+ 'disabled' => true,
134
+ )
135
+ );
136
+ ?>
137
+ </div>
138
+ </div>
139
+
140
+ <div class="wp-review-field">
141
+ <div class="wp-review-field-label">
142
+ <label><?php esc_html_e( 'Hide Google Reviews', 'wp-review' ); ?></label>
143
+ <?php wp_review_print_pro_text(); ?>
144
+ </div>
145
+
146
+ <div class="wp-review-field-option">
147
+ <?php
148
+ $form_field->render_switch(
149
+ array(
150
+ 'id' => 'wp_review_hide_google_reviews_' . $site->blog_id,
151
+ 'name' => 'wp_review_options[hide_google_reviews_' . $site->blog_id . ']',
152
+ 'disabled' => true,
153
+ )
154
+ );
155
+ ?>
156
+ </div>
157
+ </div>
158
+
159
+ <div class="wp-review-field">
160
+ <div class="wp-review-field-label">
161
+ <label><?php esc_html_e( 'Hide Role Manager', 'wp-review' ); ?></label>
162
+ </div>
163
+
164
+ <div class="wp-review-field-option">
165
+ <?php
166
+ $form_field->render_switch(
167
+ array(
168
+ 'id' => 'wp_review_hide_role_manager_' . $site->blog_id,
169
+ 'name' => 'wp_review_options[hide_role_manager_' . $site->blog_id . ']',
170
+ 'value' => ! empty( $hide_role_manager ),
171
+ )
172
+ );
173
+ ?>
174
+ </div>
175
+ </div>
176
+
177
+ <div class="wp-review-field">
178
+ <div class="wp-review-field-label">
179
+ <label><?php esc_html_e( 'Hide Import', 'wp-review' ); ?></label>
180
+ </div>
181
+
182
+ <div class="wp-review-field-option">
183
+ <?php
184
+ $form_field->render_switch(
185
+ array(
186
+ 'id' => 'wp_review_hide_import_' . $site->blog_id,
187
+ 'name' => 'wp_review_options[hide_import_' . $site->blog_id . ']',
188
+ 'value' => ! empty( $hide_import ),
189
+ )
190
+ );
191
+ ?>
192
+ </div>
193
+ </div>
194
+
195
+ </div>
196
+ <br />
197
+ <h3><?php esc_html_e( 'Post Settings', 'wp-review' ); ?></h3>
198
+ <?php
199
+ $hide_in_posts = wp_review_option( 'hide_ratings_in_posts_' . $site->blog_id );
200
+
201
+ $hide_review_links = wp_review_option( 'hide_review_links_' . $site->blog_id );
202
+ $hide_user_reviews = wp_review_option( 'hide_user_reviews_' . $site->blog_id );
203
+ ?>
204
+ <div class="wp-review-multisite-posts-options">
205
+ <div class="wp-review-field">
206
+ <div class="wp-review-field-label">
207
+ <label><?php esc_html_e( 'Hide reviews in single editor', 'wp-review' ); ?></label>
208
+ </div>
209
+
210
+ <div class="wp-review-field-option">
211
+ <?php
212
+ $form_field->render_switch(
213
+ array(
214
+ 'id' => 'wp_review_hide_ratings_in_posts_' . $site->blog_id,
215
+ 'name' => 'wp_review_options[hide_ratings_in_posts_' . $site->blog_id . ']',
216
+ 'value' => ! empty( $hide_in_posts ),
217
+ )
218
+ );
219
+ ?>
220
+ </div>
221
+ </div>
222
+ </div>
223
+
224
+ <?php $hide = $hide_in_posts ? 'style="display: none;"' : ''; ?>
225
+ <div id="wp-review-multisite-posts-options" <?php echo $hide; // WPCS: xss ok. ?>>
226
+
227
+ <div class="wp-review-field">
228
+ <div class="wp-review-field-label">
229
+ <label><?php esc_html_e( 'Hide Popup Box', 'wp-review' ); ?></label>
230
+ <?php wp_review_print_pro_text(); ?>
231
+ </div>
232
+
233
+ <div class="wp-review-field-option">
234
+ <?php
235
+ $form_field->render_switch(
236
+ array(
237
+ 'id' => 'wp_review_hide_popup_box__' . $site->blog_id,
238
+ 'name' => 'wp_review_options[hide_popup_box_' . $site->blog_id . ']',
239
+ 'disabled' => true,
240
+ )
241
+ );
242
+ ?>
243
+ </div>
244
+ </div>
245
+
246
+ <div class="wp-review-field">
247
+ <div class="wp-review-field-label">
248
+ <label><?php esc_html_e( 'Hide Notification Bar', 'wp-review' ); ?></label>
249
+ <?php wp_review_print_pro_text(); ?>
250
+ </div>
251
+
252
+ <div class="wp-review-field-option">
253
+ <?php
254
+ $form_field->render_switch(
255
+ array(
256
+ 'id' => 'wp_review_hide_notification_bar__' . $site->blog_id,
257
+ 'name' => 'wp_review_options[hide_notification_bar_' . $site->blog_id . ']',
258
+ 'disabled' => true,
259
+ )
260
+ );
261
+ ?>
262
+ </div>
263
+ </div>
264
+
265
+ <div class="wp-review-field">
266
+ <div class="wp-review-field-label">
267
+ <label><?php esc_html_e( 'Hide Features', 'wp-review' ); ?></label>
268
+ <?php wp_review_print_pro_text(); ?>
269
+ </div>
270
+
271
+ <div class="wp-review-field-option">
272
+ <?php
273
+ $form_field->render_switch(
274
+ array(
275
+ 'id' => 'wp_review_hide_features__' . $site->blog_id,
276
+ 'name' => 'wp_review_options[hide_features_' . $site->blog_id . ']',
277
+ 'disabled' => true,
278
+ )
279
+ );
280
+ ?>
281
+ </div>
282
+ </div>
283
+
284
+ <div class="wp-review-field">
285
+ <div class="wp-review-field-label">
286
+ <label><?php esc_html_e( 'Hide Review Links', 'wp-review' ); ?></label>
287
+ </div>
288
+
289
+ <div class="wp-review-field-option">
290
+ <?php
291
+ $form_field->render_switch(
292
+ array(
293
+ 'id' => 'wp_review_hide_review_links__' . $site->blog_id,
294
+ 'name' => 'wp_review_options[hide_review_links_' . $site->blog_id . ']',
295
+ 'value' => ! empty( $hide_review_links ),
296
+ )
297
+ );
298
+ ?>
299
+ </div>
300
+ </div>
301
+
302
+ <div class="wp-review-field">
303
+ <div class="wp-review-field-label">
304
+ <label><?php esc_html_e( 'Hide Review Description, Pros/Cons & Total Rating', 'wp-review' ); ?></label>
305
+ <?php wp_review_print_pro_text(); ?>
306
+ </div>
307
+
308
+ <div class="wp-review-field-option">
309
+ <?php
310
+ $form_field->render_switch(
311
+ array(
312
+ 'id' => 'wp_review_hide_review_description__' . $site->blog_id,
313
+ 'name' => 'wp_review_options[hide_review_description_' . $site->blog_id . ']',
314
+ 'disabled' => true,
315
+ )
316
+ );
317
+ ?>
318
+ </div>
319
+ </div>
320
+
321
+ <div class="wp-review-field">
322
+ <div class="wp-review-field-label">
323
+ <label><?php esc_html_e( 'Hide User Reviews', 'wp-review' ); ?></label>
324
+ </div>
325
+
326
+ <div class="wp-review-field-option">
327
+ <?php
328
+ $form_field->render_switch(
329
+ array(
330
+ 'id' => 'wp_review_hide_user_reviews__' . $site->blog_id,
331
+ 'name' => 'wp_review_options[hide_user_reviews_' . $site->blog_id . ']',
332
+ 'value' => ! empty( $hide_user_reviews ),
333
+ )
334
+ );
335
+ ?>
336
+ </div>
337
+ </div>
338
+
339
+ </div>
340
+
341
+ </div>
342
+ <?php
343
+ }
344
+ } ?>
admin/options/popup.php CHANGED
@@ -1,274 +1,274 @@
1
- <?php
2
- /**
3
- * Popup options tab
4
- *
5
- * @package WP_Review
6
- */
7
-
8
- ?>
9
- <div class="wp-review-field">
10
- <div class="wp-review-field-label">
11
- <label><?php esc_html_e( 'Enable Popup', 'wp-review' ); ?></label>
12
- <?php wp_review_print_pro_text(); ?>
13
- </div>
14
-
15
- <div class="wp-review-field-option">
16
- <?php
17
- $form_field->render_switch(
18
- array(
19
- 'id' => 'wp_review_popup_enable',
20
- 'name' => 'wp_review_popup[enable]',
21
- 'disabled' => true,
22
- )
23
- );
24
- ?>
25
- </div>
26
- </div>
27
-
28
- <div id="wp-review-popup-options">
29
-
30
- <div class="wp-review-field">
31
- <div class="wp-review-field-label">
32
- <label for="wp_review_popup_width"><?php esc_html_e( 'Popup width', 'wp-review' ); ?></label>
33
- <?php wp_review_print_pro_text(); ?>
34
- </div>
35
-
36
- <div class="wp-review-field-option">
37
- <span class="wp-review-disabled inline-block">
38
- <input name="wp_review_popup[width]" id="wp_review_popup_width" type="text" value="800px" disabled>
39
- </span>
40
- </div>
41
- </div>
42
-
43
- <div class="wp-review-field">
44
- <div class="wp-review-field-label">
45
- <label for="wp_review_popup_animation_in"><?php esc_html_e( 'Popup animation in', 'wp-review' ); ?></label>
46
- <?php wp_review_print_pro_text(); ?>
47
- </div>
48
-
49
- <div class="wp-review-field-option">
50
- <span class="wp-review-disabled inline-block has-bg">
51
- <?php
52
- wp_review_animations_dropdown(
53
- 'wp_review_popup_animation_in',
54
- 'wp_review_popup[animation_in]'
55
- );
56
- ?>
57
- </span>
58
- </div>
59
- </div>
60
-
61
- <div class="wp-review-field">
62
- <div class="wp-review-field-label">
63
- <label for="wp_review_popup_animation_out"><?php esc_html_e( 'Popup animation out', 'wp-review' ); ?></label>
64
- <?php wp_review_print_pro_text(); ?>
65
- </div>
66
-
67
- <div class="wp-review-field-option">
68
- <span class="wp-review-disabled inline-block has-bg">
69
- <?php
70
- wp_review_animations_dropdown(
71
- 'wp_review_popup_animation_out',
72
- 'wp_review_popup[animation_out]',
73
- true
74
- );
75
- ?>
76
- </span>
77
- </div>
78
- </div>
79
-
80
- <div class="wp-review-field">
81
- <div class="wp-review-field-label">
82
- <label for="wp_review_popup_overlay_color"><?php esc_html_e( 'Popup overlay color', 'wp-review' ); ?></label>
83
- <?php wp_review_print_pro_text(); ?>
84
- </div>
85
-
86
- <div class="wp-review-field-option">
87
- <span class="wp-review-disabled inline-block has-bg">
88
- <input type="text" class="wp-review-color" name="wp_review_popup[overlay_color]" id="wp_review_popup_overlay_color">
89
- </span>
90
- </div>
91
- </div>
92
-
93
- <div class="wp-review-field">
94
- <div class="wp-review-field-label">
95
- <label for="wp_review_popup_overlay_opacity"><?php esc_html_e( 'Popup overlay opacity', 'wp-review' ); ?></label>
96
- <span class="description">(0.1 - 1)</span>
97
- <?php wp_review_print_pro_text(); ?>
98
- </div>
99
-
100
- <div class="wp-review-field-option">
101
- <span class="wp-review-disabled inline-block has-bg">
102
- <input type="text" name="wp_review_popup[overlay_opacity]" id="wp_review_popup_overlay_opacity" class=" small-text" value="0.8">
103
- </span>
104
- </div>
105
- </div>
106
-
107
- <?php $post_types = get_post_types( array( 'public' => true ) ); ?>
108
- <div class="wp-review-field">
109
- <div class="wp-review-field-label">
110
- <label for="wp_review_popup_post_type"><?php esc_html_e( 'Post type', 'wp-review' ); ?></label>
111
- <?php wp_review_print_pro_text(); ?>
112
- </div>
113
-
114
- <div class="wp-review-field-option">
115
- <span class="wp-review-disabled inline-block has-bg">
116
- <select name="wp_review_popup[post_type]" id="wp_review_popup_post_type" disabled>
117
- <option value=""><?php esc_html_e( 'Any', 'wp-review' ); ?></option>
118
- <?php foreach ( $post_types as $key => $value ) : ?>
119
- <option value="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $value ); ?></option>
120
- <?php endforeach; ?>
121
- </select>
122
- </span>
123
- </div>
124
- </div>
125
-
126
- <div class="wp-review-field">
127
- <div class="wp-review-field-label">
128
- <label for="wp_review_popup_queryby"><?php esc_html_e( 'Popup content', 'wp-review' ); ?></label>
129
- <?php wp_review_print_pro_text(); ?>
130
- </div>
131
-
132
- <div class="wp-review-field-option">
133
- <span class="wp-review-disabled inline-block has-bg">
134
- <select name="wp_review_popup[queryby]" id="wp_review_popup_queryby" disabled>
135
- <option value="category"><?php esc_html_e( 'From category', 'wp-review' ); ?></option>
136
- <option value="tag"><?php esc_html_e( 'From tag', 'wp-review' ); ?></option>
137
- <option value="review_type"><?php esc_html_e( 'From review type', 'wp-review' ); ?></option>
138
- <option value="latest"><?php esc_html_e( 'Latest reviews', 'wp-review' ); ?></option>
139
- </select>
140
- </span>
141
- </div>
142
- </div>
143
-
144
- <div class="wp-review-field based-on-queryby" data-value="category">
145
- <div class="wp-review-field-label">
146
- <label for="wp_review_popup_category"><?php esc_html_e( 'Choose category', 'wp-review' ); ?></label>
147
- <?php wp_review_print_pro_text(); ?>
148
- </div>
149
-
150
- <div class="wp-review-field-option">
151
- <span class="wp-review-disabled inline-block has-bg">
152
- <?php
153
- wp_dropdown_categories(
154
- array(
155
- 'show_option_all' => esc_html__( 'All categories', 'wp-review' ),
156
- 'orderby' => 'name',
157
- 'hide_empty' => false,
158
- 'name' => 'wp_review_popup[category]',
159
- 'id' => 'wp_review_popup_category',
160
- )
161
- );
162
- ?>
163
- </span>
164
- </div>
165
- </div>
166
-
167
- <div class="wp-review-field">
168
- <div class="wp-review-field-label">
169
- <label for="wp_review_popup_limit"><?php esc_html_e( 'Number of Reviews', 'wp-review' ); ?></label>
170
- <?php wp_review_print_pro_text(); ?>
171
- </div>
172
-
173
- <div class="wp-review-field-option">
174
- <span class="wp-review-disabled inline-block">
175
- <input type="number" min="-1" step="1" class="small-text" name="wp_review_popup[limit]" id="wp_review_popup_limit" value="6" disabled>
176
- </span>
177
- </div>
178
- </div>
179
-
180
- <div class="wp-review-field">
181
- <div class="wp-review-field-label">
182
- <label for="wp_review_popup_orderby"><?php esc_html_e( 'Popup content order', 'wp-review' ); ?></label>
183
- <?php wp_review_print_pro_text(); ?>
184
- </div>
185
-
186
- <div class="wp-review-field-option">
187
- <span class="wp-review-disabled inline-block has-bg">
188
- <select name="wp_review_popup[orderby]" id="wp_review_popup_orderby" disabled>
189
- <option value="random"><?php esc_html_e( 'Random', 'wp-review' ); ?></option>
190
- <option value="popular"><?php esc_html_e( 'Most popular', 'wp-review' ); ?></option>
191
- <option value="rated"><?php esc_html_e( 'Most rated', 'wp-review' ); ?></option>
192
- <option value="latest"><?php esc_html_e( 'Latest', 'wp-review' ); ?></option>
193
- </select>
194
- </span>
195
- </div>
196
- </div>
197
- </div>
198
-
199
- <div class="wp-review-field">
200
- <div class="wp-review-field-label">
201
- <label for="wp_review_popup_expiration"><?php esc_html_e( 'Hide popup for', 'wp-review' ); ?></label>
202
- <?php wp_review_print_pro_text(); ?>
203
- </div>
204
-
205
- <div class="wp-review-field-option">
206
- <span class="wp-review-disabled inline-block">
207
- <input type="number" min="0" step="1" name="wp_review_popup[expiration]" class="small-text" id="wp_review_popup_expiration" value="30" disabled>
208
- <span><?php esc_html_e( 'day(s).', 'wp-review' ); ?></span>
209
- </span>
210
- </div>
211
-
212
- <div class="description" style="margin-top: 10px;"><?php esc_html_e( 'Set to 0 if you want to show popup on each page load.', 'wp-review' ); ?></div>
213
- </div>
214
-
215
- <div class="wp-review-field no-flex">
216
- <span class="wp-review-disabled inline-block">
217
- <label>
218
- <input type="checkbox" name="wp_review_popup[show_on_load]" value="1" disabled>
219
- <?php
220
- printf(
221
- // translators: number input.
222
- esc_html__( 'Show popup after %s second(s)', 'wp-review' ),
223
- '<input type="number" min="0" step="1" name="wp_review_popup[delay]" class="small-text" id="wp_review_popup_delay" value="0" disabled>'
224
- );
225
- ?>
226
- </label>
227
- </span>
228
-
229
- <?php wp_review_print_pro_text(); ?>
230
-
231
- <p class="description" style="margin-top: 10px;"><?php esc_html_e( 'Set to 0 if you want to show popup instantly.', 'wp-review' ); ?></p>
232
- </div>
233
-
234
- <div class="wp-review-field no-flex">
235
- <span class="wp-review-disabled inline-block">
236
- <label>
237
- <input type="checkbox" name="wp_review_popup[show_on_reach_bottom]" value="1" disabled>
238
- <?php esc_html_e( 'Show popup when visitor reaches the end of the content (only on single posts or pages)', 'wp-review' ); ?>
239
- <?php wp_review_print_pro_text( true ); ?>
240
- </label>
241
- </span>
242
- </div>
243
-
244
- <div class="wp-review-field no-flex">
245
- <span class="wp-review-disabled inline-block">
246
- <label>
247
- <input type="checkbox" name="wp_review_popup[exit_intent]" value="1" disabled>
248
- <?php esc_html_e( 'Show popup when visitor is about to leave (exit intent)', 'wp-review' ); ?>
249
- <?php wp_review_print_pro_text( true ); ?>
250
- </label>
251
- </span>
252
- </div>
253
-
254
- <div class="wp-review-field">
255
- <span class="wp-review-disabled inline-block">
256
- <label>
257
- <input type="checkbox" name="wp_review_popup[screen_size_check]" value="1" disabled>
258
- <?php
259
- printf(
260
- // translators: width input.
261
- esc_html__( 'Show popup on screens larger than %s pixels', 'wp-review' ),
262
- '<input type="number" min="0" step="1" name="wp_review_popup[screen_width]" class="small-text" id="wp_review_popup_screen_width" value="0">'
263
- );
264
- ?>
265
- <?php wp_review_print_pro_text( true ); ?>
266
- </label>
267
- </span>
268
- </div>
269
-
270
- <div class="wp-review-field">
271
- <button type="button" class="button" id="wp_review_generate_popup_cookie" disabled><?php esc_html_e( 'Generate new cookie', 'wp-review' ); ?></button>
272
- <div class="description" style="margin-top: 10px; width: 100%;"><?php esc_html_e( 'Use this option to override old cookie.', 'wp-review' ); ?></div>
273
- <?php wp_review_print_pro_text(); ?>
274
- </div>
1
+ <?php
2
+ /**
3
+ * Popup options tab
4
+ *
5
+ * @package WP_Review
6
+ */
7
+
8
+ ?>
9
+ <div class="wp-review-field">
10
+ <div class="wp-review-disabled wp-review-field-label">
11
+ <label><?php esc_html_e( 'Enable Popup', 'wp-review' ); ?></label>
12
+ <?php wp_review_print_pro_text(); ?>
13
+ </div>
14
+
15
+ <div class="wp-review-field-option">
16
+ <?php
17
+ $form_field->render_switch(
18
+ array(
19
+ 'id' => 'wp_review_popup_enable',
20
+ 'name' => 'wp_review_popup[enable]',
21
+ 'disabled' => true,
22
+ )
23
+ );
24
+ ?>
25
+ </div>
26
+ </div>
27
+
28
+ <div id="wp-review-popup-options">
29
+
30
+ <div class="wp-review-field">
31
+ <div class="wp-review-disabled wp-review-field-label">
32
+ <label for="wp_review_popup_width"><?php esc_html_e( 'Popup width', 'wp-review' ); ?></label>
33
+ <?php wp_review_print_pro_text(); ?>
34
+ </div>
35
+
36
+ <div class="wp-review-field-option">
37
+ <span class="wp-review-disabled inline-block">
38
+ <input name="wp_review_popup[width]" id="wp_review_popup_width" type="text" value="800px" disabled>
39
+ </span>
40
+ </div>
41
+ </div>
42
+
43
+ <div class="wp-review-field">
44
+ <div class="wp-review-disabled wp-review-field-label">
45
+ <label for="wp_review_popup_animation_in"><?php esc_html_e( 'Popup animation in', 'wp-review' ); ?></label>
46
+ <?php wp_review_print_pro_text(); ?>
47
+ </div>
48
+
49
+ <div class="wp-review-field-option">
50
+ <span class="wp-review-disabled inline-block has-bg">
51
+ <?php
52
+ wp_review_animations_dropdown(
53
+ 'wp_review_popup_animation_in',
54
+ 'wp_review_popup[animation_in]'
55
+ );
56
+ ?>
57
+ </span>
58
+ </div>
59
+ </div>
60
+
61
+ <div class="wp-review-field">
62
+ <div class="wp-review-disabled wp-review-field-label">
63
+ <label for="wp_review_popup_animation_out"><?php esc_html_e( 'Popup animation out', 'wp-review' ); ?></label>
64
+ <?php wp_review_print_pro_text(); ?>
65
+ </div>
66
+
67
+ <div class="wp-review-field-option">
68
+ <span class="wp-review-disabled inline-block has-bg">
69
+ <?php
70
+ wp_review_animations_dropdown(
71
+ 'wp_review_popup_animation_out',
72
+ 'wp_review_popup[animation_out]',
73
+ true
74
+ );
75
+ ?>
76
+ </span>
77
+ </div>
78
+ </div>
79
+
80
+ <div class="wp-review-field">
81
+ <div class="wp-review-disabled wp-review-field-label">
82
+ <label for="wp_review_popup_overlay_color"><?php esc_html_e( 'Popup overlay color', 'wp-review' ); ?></label>
83
+ <?php wp_review_print_pro_text(); ?>
84
+ </div>
85
+
86
+ <div class="wp-review-field-option">
87
+ <span class="wp-review-disabled inline-block has-bg">
88
+ <input type="text" class="wp-review-color" name="wp_review_popup[overlay_color]" id="wp_review_popup_overlay_color">
89
+ </span>
90
+ </div>
91
+ </div>
92
+
93
+ <div class="wp-review-field">
94
+ <div class="wp-review-disabled wp-review-field-label">
95
+ <label for="wp_review_popup_overlay_opacity"><?php esc_html_e( 'Popup overlay opacity', 'wp-review' ); ?></label>
96
+ <span class="description">(0.1 - 1)</span>
97
+ <?php wp_review_print_pro_text(); ?>
98
+ </div>
99
+
100
+ <div class="wp-review-field-option">
101
+ <span class="wp-review-disabled inline-block has-bg">
102
+ <input type="text" name="wp_review_popup[overlay_opacity]" id="wp_review_popup_overlay_opacity" class=" small-text" value="0.8">
103
+ </span>
104
+ </div>
105
+ </div>
106
+
107
+ <?php $post_types = get_post_types( array( 'public' => true ) ); ?>
108
+ <div class="wp-review-field">
109
+ <div class="wp-review-disabled wp-review-field-label">
110
+ <label for="wp_review_popup_post_type"><?php esc_html_e( 'Post type', 'wp-review' ); ?></label>
111
+ <?php wp_review_print_pro_text(); ?>
112
+ </div>
113
+
114
+ <div class="wp-review-field-option">
115
+ <span class="wp-review-disabled inline-block has-bg">
116
+ <select name="wp_review_popup[post_type]" id="wp_review_popup_post_type" disabled>
117
+ <option value=""><?php esc_html_e( 'Any', 'wp-review' ); ?></option>
118
+ <?php foreach ( $post_types as $key => $value ) : ?>
119
+ <option value="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $value ); ?></option>
120
+ <?php endforeach; ?>
121
+ </select>
122
+ </span>
123
+ </div>
124
+ </div>
125
+
126
+ <div class="wp-review-field">
127
+ <div class="wp-review-disabled wp-review-field-label">
128
+ <label for="wp_review_popup_queryby"><?php esc_html_e( 'Popup content', 'wp-review' ); ?></label>
129
+ <?php wp_review_print_pro_text(); ?>
130
+ </div>
131
+
132
+ <div class="wp-review-field-option">
133
+ <span class="wp-review-disabled inline-block has-bg">
134
+ <select name="wp_review_popup[queryby]" id="wp_review_popup_queryby" disabled>
135
+ <option value="category"><?php esc_html_e( 'From category', 'wp-review' ); ?></option>
136
+ <option value="tag"><?php esc_html_e( 'From tag', 'wp-review' ); ?></option>
137
+ <option value="review_type"><?php esc_html_e( 'From review type', 'wp-review' ); ?></option>
138
+ <option value="latest"><?php esc_html_e( 'Latest reviews', 'wp-review' ); ?></option>
139
+ </select>
140
+ </span>
141
+ </div>
142
+ </div>
143
+
144
+ <div class="wp-review-field based-on-queryby" data-value="category">
145
+ <div class="wp-review-disabled wp-review-field-label">
146
+ <label for="wp_review_popup_category"><?php esc_html_e( 'Choose category', 'wp-review' ); ?></label>
147
+ <?php wp_review_print_pro_text(); ?>
148
+ </div>
149
+
150
+ <div class="wp-review-field-option">
151
+ <span class="wp-review-disabled inline-block has-bg">
152
+ <?php
153
+ wp_dropdown_categories(
154
+ array(
155
+ 'show_option_all' => esc_html__( 'All categories', 'wp-review' ),
156
+ 'orderby' => 'name',
157
+ 'hide_empty' => false,
158
+ 'name' => 'wp_review_popup[category]',
159
+ 'id' => 'wp_review_popup_category',
160
+ )
161
+ );
162
+ ?>
163
+ </span>
164
+ </div>
165
+ </div>
166
+
167
+ <div class="wp-review-field">
168
+ <div class="wp-review-disabled wp-review-field-label">
169
+ <label for="wp_review_popup_limit"><?php esc_html_e( 'Number of Reviews', 'wp-review' ); ?></label>
170
+ <?php wp_review_print_pro_text(); ?>
171
+ </div>
172
+
173
+ <div class="wp-review-field-option">
174
+ <span class="wp-review-disabled inline-block">
175
+ <input type="number" min="-1" step="1" class="small-text" name="wp_review_popup[limit]" id="wp_review_popup_limit" value="6" disabled>
176
+ </span>
177
+ </div>
178
+ </div>
179
+
180
+ <div class="wp-review-field">
181
+ <div class="wp-review-disabled wp-review-field-label">
182
+ <label for="wp_review_popup_orderby"><?php esc_html_e( 'Popup content order', 'wp-review' ); ?></label>
183
+ <?php wp_review_print_pro_text(); ?>
184
+ </div>
185
+
186
+ <div class="wp-review-field-option">
187
+ <span class="wp-review-disabled inline-block has-bg">
188
+ <select name="wp_review_popup[orderby]" id="wp_review_popup_orderby" disabled>
189
+ <option value="random"><?php esc_html_e( 'Random', 'wp-review' ); ?></option>
190
+ <option value="popular"><?php esc_html_e( 'Most popular', 'wp-review' ); ?></option>
191
+ <option value="rated"><?php esc_html_e( 'Most rated', 'wp-review' ); ?></option>
192
+ <option value="latest"><?php esc_html_e( 'Latest', 'wp-review' ); ?></option>
193
+ </select>
194
+ </span>
195
+ </div>
196
+ </div>
197
+ </div>
198
+
199
+ <div class="wp-review-field">
200
+ <div class="wp-review-disabled wp-review-field-label">
201
+ <label for="wp_review_popup_expiration"><?php esc_html_e( 'Hide popup for', 'wp-review' ); ?></label>
202
+ <?php wp_review_print_pro_text(); ?>
203
+ </div>
204
+
205
+ <div class="wp-review-field-option">
206
+ <span class="wp-review-disabled inline-block">
207
+ <input type="number" min="0" step="1" name="wp_review_popup[expiration]" class="small-text" id="wp_review_popup_expiration" value="30" disabled>
208
+ <span><?php esc_html_e( 'day(s).', 'wp-review' ); ?></span>
209
+ </span>
210
+ </div>
211
+
212
+ <div class="description" style="margin-top: 10px;"><?php esc_html_e( 'Set to 0 if you want to show popup on each page load.', 'wp-review' ); ?></div>
213
+ </div>
214
+
215
+ <div class="wp-review-field no-flex">
216
+ <span class="wp-review-disabled inline-block">
217
+ <label>
218
+ <input type="checkbox" name="wp_review_popup[show_on_load]" value="1" disabled>
219
+ <?php
220
+ printf(
221
+ // translators: number input.
222
+ esc_html__( 'Show popup after %s second(s)', 'wp-review' ),
223
+ '<input type="number" min="0" step="1" name="wp_review_popup[delay]" class="small-text" id="wp_review_popup_delay" value="0" disabled>'
224
+ );
225
+ ?>
226
+ </label>
227
+ </span>
228
+
229
+ <?php wp_review_print_pro_text(); ?>
230
+
231
+ <p class="description" style="margin-top: 10px;"><?php esc_html_e( 'Set to 0 if you want to show popup instantly.', 'wp-review' ); ?></p>
232
+ </div>
233
+
234
+ <div class="wp-review-field no-flex">
235
+ <span class="wp-review-disabled inline-block">
236
+ <label>
237
+ <input type="checkbox" name="wp_review_popup[show_on_reach_bottom]" value="1" disabled>
238
+ <?php esc_html_e( 'Show popup when visitor reaches the end of the content (only on single posts or pages)', 'wp-review' ); ?>
239
+ <?php wp_review_print_pro_text( true ); ?>
240
+ </label>
241
+ </span>
242
+ </div>
243
+
244
+ <div class="wp-review-field no-flex">
245
+ <span class="wp-review-disabled inline-block">
246
+ <label>
247
+ <input type="checkbox" name="wp_review_popup[exit_intent]" value="1" disabled>
248
+ <?php esc_html_e( 'Show popup when visitor is about to leave (exit intent)', 'wp-review' ); ?>
249
+ <?php wp_review_print_pro_text( true ); ?>
250
+ </label>
251
+ </span>
252
+ </div>
253
+
254
+ <div class="wp-review-field">
255
+ <span class="wp-review-disabled inline-block">
256
+ <label>
257
+ <input type="checkbox" name="wp_review_popup[screen_size_check]" value="1" disabled>
258
+ <?php
259
+ printf(
260
+ // translators: width input.
261
+ esc_html__( 'Show popup on screens larger than %s pixels', 'wp-review' ),
262
+ '<input type="number" min="0" step="1" name="wp_review_popup[screen_width]" class="small-text" id="wp_review_popup_screen_width" value="0">'
263
+ );
264
+ ?>
265
+ <?php wp_review_print_pro_text( true ); ?>
266
+ </label>
267
+ </span>
268
+ </div>
269
+
270
+ <div class="wp-review-disabled wp-review-field">
271
+ <button type="button" class="button" id="wp_review_generate_popup_cookie" disabled><?php esc_html_e( 'Generate new cookie', 'wp-review' ); ?></button>
272
+ <div class="description" style="margin-top: 10px; width: 100%;"><?php esc_html_e( 'Use this option to override old cookie.', 'wp-review' ); ?></div>
273
+ <?php wp_review_print_pro_text(); ?>
274
+ </div>
admin/options/review.php CHANGED
@@ -1,1016 +1,1016 @@
1
- <?php
2
- /**
3
- * Review options tab
4
- *
5
- * @package WP_Review
6
- */
7
-
8
- $options = get_option( 'wp_review_options' );
9
-
10
- $default_options = array(
11
- 'colors' => array(
12
- 'color' => '',
13
- 'inactive_color' => '',
14
- 'fontcolor' => '',
15
- 'bgcolor1' => '',
16
- 'bgcolor2' => '',
17
- 'bordercolor' => '',
18
- ),
19
- 'default_features' => array(),
20
- 'default_link_texts' => array(),
21
- 'default_link_urls' => array(),
22
- 'default_schema_type' => 'Thing',
23
- 'default_user_review_type' => WP_REVIEW_REVIEW_DISABLED,
24
- 'image_sizes' => array(),
25
- );
26
- // Set defaults.
27
- if ( empty( $options ) ) {
28
- $options = $default_options;
29
- update_option( 'wp_review_options', $options );
30
- }
31
-
32
- if ( empty( $options['image_sizes'] ) ) {
33
- $options['image_sizes'] = array();
34
- }
35
-
36
- $opt_name = 'wp_review_options_' . wp_get_theme();
37
- $options_updated = get_option( $opt_name );
38
- $suggest_theme_defaults = true;
39
- if ( ! empty( $_GET['wp-review-theme-defaults'] ) && empty( $_GET['settings-updated'] ) ) { // WPCS: csrf ok.
40
- wp_review_theme_defaults( $options_updated, true );
41
- $options = get_option( 'wp_review_options' );
42
- $suggest_theme_defaults = false;
43
- }
44
-
45
- // Test to see if we need to sugges setting theme defaults.
46
- if ( empty( $options_updated ) ) {
47
- $options_updated = array();
48
- }
49
-
50
- $opts_tmp = array_merge( $options, $options_updated );
51
- if ( $opts_tmp === $options ) {
52
- $suggest_theme_defaults = false;
53
- }
54
-
55
- // Migrate.
56
- global $wpdb;
57
- $current_blog_id = get_current_blog_id();
58
- $total_rows = 0;
59
- $rows_left = 0;
60
- $migrated_rows = get_option( 'wp_review_migrated_rows', 0 );
61
- $has_migrated = get_option( 'wp_review_has_migrated', false );
62
- if ( ! $has_migrated && $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->base_prefix}mts_wp_reviews'" ) === "{$wpdb->base_prefix}mts_wp_reviews" ) {
63
- // Table exists and not migrated (fully) yet.
64
- $total_rows = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->base_prefix}mts_wp_reviews WHERE blog_id = {$current_blog_id}" ); // WPCS: unprepared SQL ok.
65
- $rows_left = $total_rows - $migrated_rows;
66
- }
67
-
68
- $comment_form_integration = ( ! empty( $options['comment_form_integration'] ) ? $options['comment_form_integration'] : 'replace' );
69
- if ( 'replace' !== $comment_form_integration ) {
70
- $comment_form_integration = 'extend';
71
- }
72
-
73
- $comments_template = ( ! empty( $options['comments_template'] ) ? $options['comments_template'] : 'theme' );
74
- if ( 'theme' !== $comments_template ) {
75
- $comments_template = 'plugin';
76
- }
77
-
78
- $default_colors = wp_review_get_default_colors();
79
- $default_location = wp_review_get_default_location();
80
- $default_criteria = wp_review_get_default_criteria();
81
-
82
- $default_items = array();
83
- foreach ( $default_criteria as $item ) {
84
- $default_items[] = array(
85
- 'wp_review_item_title' => $item,
86
- 'wp_review_item_star' => '',
87
- );
88
- }
89
- $default_schema = $default_options['default_schema_type'];
90
- $default_user_review_type = empty( $options['default_user_review_type'] ) ? WP_REVIEW_REVIEW_DISABLED : $options['default_user_review_type'];
91
-
92
- $options['colors'] = apply_filters( 'wp_review_colors', $options['colors'], 0 );
93
- if ( ! isset( $options['default'] ) ) {
94
- $options['default'] = array();
95
- }
96
- /* Retrieve an existing value from the database. */
97
- $items = ! empty( $options['default_features'] ) ? $options['default_features'] : '';
98
- $link_texts = ! empty( $options['default_link_text'] ) ? $options['default_link_text'] : array();
99
- $link_urls = ! empty( $options['default_link_url'] ) ? $options['default_link_url'] : array();
100
- $location = wp_review_option( 'review_location' );
101
- $color = ! empty( $options['colors']['color'] ) ? $options['colors']['color'] : '';
102
- $inactive_color = ! empty( $options['colors']['inactive_color'] ) ? $options['colors']['inactive_color'] : '';
103
- $fontcolor = ! empty( $options['colors']['fontcolor'] ) ? $options['colors']['fontcolor'] : '';
104
- $bgcolor1 = ! empty( $options['colors']['bgcolor1'] ) ? $options['colors']['bgcolor1'] : '';
105
- $bgcolor2 = ! empty( $options['colors']['bgcolor2'] ) ? $options['colors']['bgcolor2'] : '';
106
- $bordercolor = ! empty( $options['colors']['bordercolor'] ) ? $options['colors']['bordercolor'] : '';
107
-
108
- $force_user_ratings = wp_review_option( 'force_user_ratings' );
109
-
110
- $rating_icon = wp_review_option( 'rating_icon', apply_filters( 'wp_review_default_rating_icon', 'fa fa-star' ) );
111
- $rating_image = wp_review_option( 'rating_image' );
112
-
113
- $review_templates = wp_review_get_box_templates();
114
- $box_template = wp_review_option( 'box_template', 'default' );
115
- $box_template_img = ! empty( $review_templates[ $box_template ] ) ? $review_templates[ $box_template ]['image'] : WP_REVIEW_ASSETS . 'images/largethumb.png';
116
-
117
- $review_types = wp_review_get_rating_types();
118
- $review_type = wp_review_option( 'review_type', 'none' );
119
-
120
- if ( '' === $items ) {
121
- $items = $default_items;
122
- }
123
- if ( '' === $color ) {
124
- $color = $default_colors['color'];
125
- }
126
- if ( '' === $inactive_color ) {
127
- $inactive_color = $default_colors['inactive_color'];
128
- }
129
- if ( '' === $location ) {
130
- $location = $default_location;
131
- }
132
- if ( '' === $fontcolor ) {
133
- $fontcolor = $default_colors['fontcolor'];
134
- }
135
- if ( '' === $bgcolor1 ) {
136
- $bgcolor1 = $default_colors['bgcolor1'];
137
- }
138
- if ( '' === $bgcolor2 ) {
139
- $bgcolor2 = $default_colors['bgcolor2'];
140
- }
141
- if ( '' === $bordercolor ) {
142
- $bordercolor = $default_colors['bordercolor'];
143
- }
144
- if ( empty( $width ) ) {
145
- $width = 100;
146
- }
147
-
148
- $fields = array(
149
- 'location' => true,
150
- 'color' => true,
151
- 'inactive_color' => true,
152
- 'fontcolor' => true,
153
- 'bgcolor1' => true,
154
- 'bgcolor2' => true,
155
- 'bordercolor' => true,
156
- 'custom_colors' => true,
157
- 'custom_location' => true,
158
- );
159
-
160
- $displayed_fields = apply_filters( 'wp_review_metabox_item_fields', $fields );
161
-
162
- $available_types = apply_filters(
163
- 'wp_review_metabox_types',
164
- array(
165
- 'star' => __( 'Star', 'wp-review' ),
166
- 'point' => __( 'Point', 'wp-review' ),
167
- 'percentage' => __( 'Percentage', 'wp-review' ),
168
- 'circle' => __( 'Circle', 'wp-review' ),
169
- 'thumbs' => __( 'Thumbs', 'wp-review' ),
170
- )
171
- );
172
-
173
- $form_field = new WP_Review_Form_Field();
174
- ?>
175
- <div data-nav-tabs>
176
- <div class="nav-tab-wrapper">
177
- <a href="#review-general" class="nav-tab nav-tab-active"><?php esc_html_e( 'General', 'wp-review' ); ?></a>
178
- <a href="#review-styling" class="nav-tab"><?php esc_html_e( 'Styling', 'wp-review' ); ?></a>
179
- <a href="#review-defaults" class="nav-tab"><?php esc_html_e( 'Defaults', 'wp-review' ); ?></a>
180
- <a href="#review-embed" class="nav-tab"><?php esc_html_e( 'Embed', 'wp-review' ); ?></a>
181
- <?php if ( $rows_left ) : ?>
182
- <a href="#review-migrate" class="nav-tab"><?php esc_html_e( 'Migrate Ratings', 'wp-review' ); ?></a>
183
- <?php endif; ?>
184
- </div>
185
-
186
- <div id="review-general" class="settings-tab-general tab-content">
187
- <h3><?php esc_html_e( 'General Settings', 'wp-review' ); ?></h3>
188
- <?php
189
- $location = apply_filters( 'wp_review_location', $location, 0 );
190
- if ( has_filter( 'wp_review_location' ) ) {
191
- echo '<p class="wp-review-filter-msg"><div class="dashicons dashicons-info"></div>' . esc_html__( 'There is a filter set for the review location that may modify the options below.', 'wp-review' ) . '</p>';
192
- }
193
-
194
- if ( $suggest_theme_defaults ) {
195
- ?>
196
- <div class="wp-review-theme-defaults-msg updated settings-error">
197
- <p class="wp-review-field">
198
- <?php esc_html_e( 'The current theme provides default settings for the plugin.', 'wp-review' ); ?><br />
199
- </p>
200
- <a href="<?php echo admin_url( 'options-general.php?page=wp-review/admin/options.php&wp-review-theme-defaults=1' ); // WPCS: xss ok. ?>" class="button button-primary"><?php esc_html_e( 'Set to theme defaults', 'wp-review' ); ?></a>
201
- <a href="#" class="dashicons dashicons-no-alt close-notice"></a>
202
- </div>
203
- <?php } ?>
204
-
205
- <div class="wp-review-field">
206
- <div class="wp-review-field-label">
207
- <label><?php esc_html_e( 'Restrict rating to registered users only', 'wp-review' ); ?></label>
208
- </div>
209
-
210
- <div class="wp-review-field-option">
211
- <?php
212
- $form_field->render_switch(
213
- array(
214
- 'id' => 'wp_review_registered_only',
215
- 'name' => 'wp_review_options[registered_only]',
216
- 'value' => ! empty( $options['registered_only'] ),
217
- )
218
- );
219
- ?>
220
- </div>
221
- </div>
222
-
223
- <div class="wp-review-field">
224
- <div class="wp-review-field-label">
225
- <label><?php esc_html_e( 'Add total rating to thumbnails', 'wp-review' ); ?></label>
226
- <?php wp_review_print_pro_text(); ?>
227
- </div>
228
-
229
- <div class="wp-review-field-option">
230
- <?php
231
- $form_field->render_switch(
232
- array(
233
- 'id' => 'wp_review_show_on_thumbnails',
234
- 'name' => 'wp_review_options[show_on_thumbnails]',
235
- 'disabled' => true,
236
- )
237
- );
238
- ?>
239
- </div>
240
- </div>
241
-
242
- <div class="wp-review-field">
243
- <div class="wp-review-field-label">
244
- <label><?php esc_html_e( 'Enable User rating in old posts', 'wp-review' ); ?></label>
245
- <?php wp_review_print_pro_text(); ?>
246
- </div>
247
-
248
- <div class="wp-review-field-option">
249
- <?php
250
- $form_field->render_switch(
251
- array(
252
- 'id' => 'wp_review_global_user_rating',
253
- 'name' => 'wp_review_options[global_user_rating]',
254
- 'disabled' => true,
255
- )
256
- );
257
- ?>
258
- </div>
259
- </div>
260
-
261
- <?php if ( class_exists( 'WooCommerce' ) ) : ?>
262
- <div class="wp-review-field">
263
- <div class="wp-review-field-label">
264
- <label><?php esc_html_e( 'Replace WooCommerce rating', 'wp-review' ); ?></label>
265
- <?php wp_review_print_pro_text(); ?>
266
- </div>
267
-
268
- <div class="wp-review-field-option">
269
- <?php
270
- $form_field->render_switch(
271
- array(
272
- 'id' => 'wp_review_replace_wc_rating',
273
- 'name' => 'wp_review_options[replace_wc_rating]',
274
- 'disabled' => true,
275
- )
276
- );
277
- ?>
278
- </div>
279
- </div>
280
- <?php endif; ?>
281
-
282
- <div class="wp-review-field">
283
- <div class="wp-review-field-label">
284
- <label><?php esc_html_e( 'Disable Map Script in the Backend', 'wp-review' ); ?></label>
285
- <?php wp_review_print_pro_text(); ?>
286
- </div>
287
-
288
- <div class="wp-review-field-option">
289
- <?php
290
- $form_field->render_switch(
291
- array(
292
- 'id' => 'wp_review_dequeue_map_backend',
293
- 'name' => 'wp_review_options[dequeue_map_backend]',
294
- 'disabled' => true,
295
- )
296
- );
297
- ?>
298
- </div>
299
-
300
- <p class="description" style="margin-top: 10px;"><?php esc_html_e( 'If map script is conflicting with other plugin in the single post editor, please enable this option.', 'wp-review' ); ?></p>
301
- </div>
302
-
303
- <div class="wp-review-field">
304
- <div class="wp-review-field-label">
305
- <label><?php esc_html_e( 'Comments template', 'wp-review' ); ?></label>
306
- <?php wp_review_print_pro_text(); ?>
307
- </div>
308
-
309
- <div class="wp-review-field-option">
310
- <div class="wpr-flex">
311
- <div class="pr-10 wpr-col-1-2">
312
- <label for="wp_review_comments_template_theme">
313
- <span class="wp-review-disabled inline-block has-bg">
314
- <input name="wp_review_options[comments_template]" id="wp_review_comments_template_theme" type="radio" value="theme" <?php checked( $comments_template, 'theme' ); ?> disabled />
315
- <strong><?php esc_html_e( 'Theme', 'wp-review' ); ?></strong>
316
- </span>
317
- </label>
318
- <br>
319
- <span class="description"><?php esc_html_e( 'Use theme comments template. Might need customization of comments.php', 'wp-review' ); ?></span>
320
- </div>
321
-
322
- <div class="pl-10 wpr-col-1-2">
323
- <label for="wp_review_comments_template_plugin">
324
- <span class="wp-review-disabled inline-block has-bg">
325
- <input name="wp_review_options[comments_template]" id="wp_review_comments_template_plugin" type="radio" value="plugin" <?php checked( $comments_template, 'plugin' ); ?> disabled />
326
- <strong><?php esc_html_e( 'WP Review', 'wp-review' ); ?></strong>
327
- </span>
328
- </label>
329
- <br>
330
- <span class="description"><?php esc_html_e( 'Use WP Review comments template. Better chances for out of the box integration.', 'wp-review' ); ?></span>
331
- </div>
332
- </div>
333
- </div>
334
- </div>
335
-
336
- <div class="wp-review-field">
337
- <div class="wp-review-field-label">
338
- <label><?php esc_html_e( 'Comment form integration', 'wp-review' ); ?></label>
339
- <?php wp_review_print_pro_text(); ?>
340
- </div>
341
-
342
- <div class="wp-review-field-option">
343
- <div class="wpr-flex">
344
- <div class="pr-10 wpr-col-1-2">
345
- <label for="wp_review_comment_form_integration_replace">
346
- <span class="wp-review-disabled inline-block has-bg">
347
- <input name="wp_review_options[comment_form_integration]" id="wp_review_comment_form_integration_replace" type="radio" value="replace" <?php checked( $comment_form_integration, 'replace' ); ?> disabled />
348
- <strong><?php esc_html_e( 'Replace', 'wp-review' ); ?></strong>
349
- </span>
350
- </label>
351
- <br>
352
- <span class="description"><?php esc_html_e( 'Replace form fields.', 'wp-review' ); ?></span>
353
- </div>
354
-
355
- <div class="pl-10 wpr-col-1-2">
356
- <label for="wp_review_comment_form_integration_extend">
357
- <span class="wp-review-disabled inline-block has-bg">
358
- <input name="wp_review_options[comment_form_integration]" id="wp_review_comment_form_integration_extend" type="radio" value="extend" <?php checked( $comment_form_integration, 'extend' ); ?> disabled />
359
- <strong><?php esc_html_e( 'Extend', 'wp-review' ); ?></strong>
360
- </span>
361
- </label>
362
- <br>
363
- <span class="description"><?php esc_html_e( 'Add new fields without modifying the default fields.', 'wp-review' ); ?></span>
364
- </div>
365
- </div>
366
- </div>
367
- </div>
368
-
369
- <div class="wp-review-field">
370
- <div class="wp-review-field-label">
371
- <label><?php esc_html_e( 'Require a rating when commenting', 'wp-review' ); ?></label>
372
- <?php wp_review_print_pro_text(); ?>
373
- </div>
374
-
375
- <div class="wp-review-field-option">
376
- <?php
377
- $form_field->render_switch(
378
- array(
379
- 'id' => 'wp_review_require_rating',
380
- 'name' => 'wp_review_options[require_rating]',
381
- 'disabled' => true,
382
- )
383
- );
384
- ?>
385
- </div>
386
- </div>
387
-
388
- <div class="wp-review-field">
389
- <div class="wp-review-field-label">
390
- <label><?php esc_html_e( 'Allow comment feedback (helpful/unhelpful)', 'wp-review' ); ?></label>
391
- <?php wp_review_print_pro_text(); ?>
392
- </div>
393
-
394
- <div class="wp-review-field-option">
395
- <?php
396
- $form_field->render_switch(
397
- array(
398
- 'id' => 'wp_review_allow_comment_feedback',
399
- 'name' => 'wp_review_options[allow_comment_feedback]',
400
- 'disabled' => true,
401
- )
402
- );
403
- ?>
404
- </div>
405
- </div>
406
-
407
- <div class="wp-review-field">
408
- <div class="wp-review-field-label">
409
- <label for="wp_review_record_ratings_by"><?php esc_html_e( 'Record User Ratings', 'wp-review' ); ?></label>
410
- <?php wp_review_print_pro_text(); ?>
411
- </div>
412
-
413
- <div class="wp-review-field-option">
414
- <span class="wp-review-disabled inline-block has-bg">
415
- <select name="wp_review_options[record_ratings_by]" id="wp_review_record_ratings_by" disabled>
416
- <option value="ip"><?php esc_html_e( 'Based on IP address', 'wp-review' ); ?></option>
417
- <option value="cookie"><?php esc_html_e( 'Based on browser cookie', 'wp-review' ); ?></option>
418
- </select>
419
- </span>
420
- </div>
421
- </div>
422
-
423
- <?php
424
- // phpcs:disable
425
- /*<div class="wp-review-field">
426
- <div class="wp-review-field-label">
427
- <label><?php esc_html_e( 'Show text count with Star ratings', 'wp-review' ); ?></label>
428
- </div>
429
-
430
- <div class="wp-review-field-option">
431
- <?php
432
- $form_field->render_switch( array(
433
- 'id' => 'wp_review_show_star_rating_count',
434
- 'name' => 'wp_review_options[show_star_rating_count]',
435
- 'value' => ! empty( $options['show_star_rating_count'] ),
436
- ) );
437
- ?>
438
- </div>
439
- </div>*/
440
- // phpcs:enable
441
- ?>
442
-
443
- <div class="wp-review-field">
444
- <div class="wp-review-field-label">
445
- <label><?php esc_html_e( 'Allow multiple reviews per account', 'wp-review' ); ?></label>
446
- </div>
447
-
448
- <div class="wp-review-field-option">
449
- <?php
450
- $form_field->render_switch(
451
- array(
452
- 'id' => 'wp_review_multi_reviews_per_account',
453
- 'name' => 'wp_review_options[multi_reviews_per_account]',
454
- 'value' => ! empty( $options['multi_reviews_per_account'] ),
455
- )
456
- );
457
- ?>
458
- </div>
459
- </div>
460
-
461
- <div class="wp-review-field">
462
- <div class="wp-review-field-label">
463
- <label><?php esc_html_e( 'Include Pros/Cons in comment reviews', 'wp-review' ); ?></label>
464
- <?php wp_review_print_pro_text(); ?>
465
- </div>
466
-
467
- <div class="wp-review-field-option">
468
- <?php
469
- $form_field->render_switch(
470
- array(
471
- 'id' => 'wp_review_comment_pros_cons',
472
- 'name' => 'wp_review_options[comment_pros_cons]',
473
- 'disabled' => true,
474
- )
475
- );
476
- ?>
477
- </div>
478
- </div>
479
-
480
- <div class="wp-review-field">
481
- <div class="wp-review-field-label">
482
- <label><?php esc_html_e( 'Approve Comment Reviews without Moderation', 'wp-review' ); ?></label>
483
- <?php wp_review_print_pro_text(); ?>
484
- </div>
485
-
486
- <div class="wp-review-field-option">
487
- <?php
488
- $form_field->render_switch(
489
- array(
490
- 'id' => 'wp_review_approve_ratings',
491
- 'name' => 'wp_review_options[approve_ratings]',
492
- 'disabled' => true,
493
- )
494
- );
495
- ?>
496
- </div>
497
- </div>
498
- <?php
499
- if ( current_user_can( 'wp_review_purge_visitor_ratings' ) ) {
500
- ?>
501
- <p style="margin-top: 50px;">
502
- <button
503
- type="button"
504
- class="button"
505
- data-remove-ratings
506
- data-type="visitor"
507
- data-processing-text="<?php esc_attr_e( 'Processing...', 'wp-review' ); ?>"
508
- ><?php esc_html_e( 'Purge visitor ratings', 'wp-review' ); ?></button>
509
- <span class="description"><?php esc_html_e( 'Click to remove all visitor ratings of all posts.', 'wp-review' ); ?></span>
510
- </p>
511
- <?php } ?>
512
- </div>
513
-
514
- <div id="review-styling" class="settings-tab-styling tab-content" style="display: none;">
515
-
516
- <h3><?php esc_html_e( 'Styling', 'wp-review' ); ?></h3>
517
-
518
- <div class="wp-review-field vertical">
519
- <div class="wp-review-field-label">
520
- <label for="wp_review_box_template"><?php esc_html_e( 'Default', 'wp-review' ); ?></label>
521
- </div>
522
- <div class="wp-review-field-option">
523
- <div id="wp_review_box_template_wrapper">
524
- <select name="wp_review_options[box_template]" id="wp_review_box_template">
525
- <?php
526
- foreach ( $review_templates as $key => $value ) {
527
- $disabled = 'default' !== $key && 'aqua' !== $key;
528
- printf(
529
- '<option value="%1$s" %2$s %3$s>%4$s</option>',
530
- esc_attr( $key ),
531
- selected( $key, $box_template, false ),
532
- $disabled ? 'disabled' : '',
533
- esc_html( $value['title'] )
534
- );
535
- }
536
- ?>
537
- </select>
538
-
539
- <div id="wp_review_box_template_preview" style="display: none;">
540
- <img src="#" alt="" id="wp_review_box_template_preview_img">
541
- </div>
542
- </div>
543
-
544
- <div style="margin-top: 10px;">
545
- <img src="<?php echo esc_url( $box_template_img ); ?>" alt="" id="wp_review_box_template_img">
546
- </div>
547
- </div>
548
- </div>
549
-
550
- <?php
551
- if ( has_filter( 'wp_review_colors' ) ) {
552
- echo '<p class="wp-review-filter-msg"><div class="dashicons dashicons-info"></div>' . esc_html__( 'There is a filter set for the review colors that may modify the options below.', 'wp-review' ) . '</p>';
553
- }
554
- ?>
555
-
556
- <div class="wp-review-color-options">
557
-
558
- <div class="wp-review-field"<?php if ( empty( $displayed_fields['color'] ) ) echo ' style="display: none;"'; // phpcS:ignore ?>>
559
- <div class="wp-review-field-label">
560
- <label for="wp_review_color"><?php esc_html_e( 'Review Color', 'wp-review' ); ?></label>
561
- </div>
562
-
563
- <div class="wp-review-field-option">
564
- <input type="text" id="wp_review_color" class="wp-review-color" name="wp_review_options[colors][color]" value="<?php echo esc_attr( $color ); ?>" data-default-color="<?php echo esc_attr( $color ); ?>">
565
- </div>
566
- </div>
567
-
568
- <div class="wp-review-field"<?php if ( empty( $displayed_fields['inactive_color'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
569
- <div class="wp-review-field-label">
570
- <label for="wp_review_inactive_color"><?php esc_html_e( 'Inactive Review Color', 'wp-review' ); ?></label>
571
- </div>
572
-
573
- <div class="wp-review-field-option">
574
- <input type="text" id="wp_review_inactive_color" class="wp-review-color" name="wp_review_options[colors][inactive_color]" value="<?php echo esc_attr( $inactive_color ); ?>" data-default-color="<?php echo esc_attr( $inactive_color ); ?>">
575
- </div>
576
- </div>
577
-
578
- <div class="wp-review-field"<?php if ( empty( $displayed_fields['fontcolor'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
579
- <div class="wp-review-field-label">
580
- <label for="wp_review_fontcolor"><?php esc_html_e( 'Font Color', 'wp-review' ); ?></label>
581
- </div>
582
-
583
- <div class="wp-review-field-option">
584
- <input type="text" class="wp-review-color" name="wp_review_options[colors][fontcolor]" id ="wp_review_fontcolor" value="<?php echo esc_attr( $fontcolor ); ?>" data-default-color="<?php echo esc_attr( $fontcolor ); ?>">
585
- </div>
586
- </div>
587
-
588
- <div class="wp-review-field"<?php if ( empty( $displayed_fields['bgcolor1'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
589
- <div class="wp-review-field-label">
590
- <label for="wp_review_bgcolor1"><?php esc_html_e( 'Heading Background Color', 'wp-review' ); ?></label>
591
- </div>
592
-
593
- <div class="wp-review-field-option">
594
- <input type="text" class="wp-review-color" name="wp_review_options[colors][bgcolor1]" id ="wp_review_bgcolor1" value="<?php echo esc_attr( $bgcolor1 ); ?>" data-default-color="<?php echo esc_attr( $bgcolor1 ); ?>">
595
- </div>
596
- </div>
597
-
598
- <div class="wp-review-field"<?php if ( empty( $displayed_fields['bgcolor2'] ) ) echo ' style="display: none;"'; //phpcs:ignore ?>>
599
- <div class="wp-review-field-label">
600
- <label for="wp_review_bgcolor2"><?php esc_html_e( 'Background Color', 'wp-review' ); ?></label>
601
- </div>
602
-
603
- <div class="wp-review-field-option">
604
- <input type="text" class="wp-review-color" name="wp_review_options[colors][bgcolor2]" id="wp_review_bgcolor2" value="<?php echo esc_attr( $bgcolor2 ); ?>" data-default-color="<?php echo esc_attr( $bgcolor2 ); ?>">
605
- </div>
606
- </div>
607
-
608
- <div class="wp-review-field"<?php if ( empty( $displayed_fields['bordercolor'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
609
- <div class="wp-review-field-label">
610
- <label for="wp_review_bordercolor"><?php esc_html_e( 'Border Color', 'wp-review' ); ?></label>
611
- </div>
612
-
613
- <div class="wp-review-field-option">
614
- <input type="text" class="wp-review-color" name="wp_review_options[colors][bordercolor]" id="wp_review_bordercolor" value="<?php echo esc_attr( $bordercolor ); ?>" data-default-color="<?php echo esc_attr( $bordercolor ); ?>">
615
- </div>
616
- </div>
617
- </div>
618
-
619
-
620
- <div class="wp-review-field">
621
- <div class="wp-review-field-label">
622
- <label for="wp_review_width"><?php esc_html_e( 'Review Box Width', 'wp-review' ); ?></label>
623
- <?php wp_review_print_pro_text(); ?>
624
- </div>
625
-
626
- <div class="wp-review-field-option wp-review-disabled has-bg">
627
- <input type="number" min="1" max="100" step="1" name="wp_review_options[width]" id="wp_review_width" value="100" disabled /> %
628
- <div id="wp-review-width-slider"></div>
629
- </div>
630
- </div>
631
-
632
- <div class="wp-review-field">
633
- <div class="wp-review-field-label">
634
- <label><?php esc_html_e( 'Google Font', 'wp-review' ); ?></label><br>
635
- <span class="description">
636
- <?php _e( 'Many templates use Google Font, select <code>No</code> to use default theme font.', 'wp-review' ); // WPCS: xss ok. ?>
637
- </span>
638
- <?php wp_review_print_pro_text(); ?>
639
- </div>
640
-
641
- <div class="wp-review-field-option">
642
- <?php
643
- $form_field->render_switch(
644
- array(
645
- 'id' => 'wp_review_fontfamily',
646
- 'name' => 'wp_review_options[fontfamily]',
647
- 'disabled' => true,
648
- )
649
- );
650
- ?>
651
- </div>
652
- </div>
653
-
654
- <div class="wp-review-field">
655
- <div class="wp-review-field-label">
656
- <label><?php esc_html_e( 'Comment Rating Color', 'wp-review' ); ?></label><br>
657
- <span class="description">
658
- <?php esc_html_e( 'Use different color for ratings in comments', 'wp-review' ); ?>
659
- </span>
660
- <?php wp_review_print_pro_text(); ?>
661
- </div>
662
-
663
- <div class="wp-review-field-option">
664
- <?php
665
- $form_field->render_switch(
666
- array(
667
- 'id' => 'wp_review_custom_comment_colors',
668
- 'name' => 'wp_review_options[custom_comment_colors]',
669
- 'disabled' => true,
670
- )
671
- );
672
- ?>
673
- </div>
674
- </div>
675
-
676
- <div class="wp-review-field wp-review-rating-icon">
677
- <div class="wp-review-field-label">
678
- <label for="wp_review_rating_icon"><?php esc_html_e( 'Rating icon', 'wp-review' ); ?></label>
679
- </div>
680
-
681
- <div class="wp-review-field-option">
682
- <select name="wp_review_options[rating_icon]" id="wp_review_rating_icon" class="js-select2">
683
- <?php
684
- $icons = wp_review_get_icons();
685
- foreach ( $icons as $name => $icon ) {
686
- printf(
687
- '<option value="%1$s" data-icon="%1$s" %2$s %3$s>%4$s</option>',
688
- esc_attr( $name ),
689
- selected( $rating_icon, $name, false ),
690
- 'fa fa-star' !== $name ? 'disabled' : '',
691
- esc_html( $icon['name'] )
692
- );
693
- }
694
- ?>
695
- </select>
696
- </div>
697
- <a href="#" class="wpr-toggle-rating wp-review-disabled inline-block has-bg"><?php esc_html_e( 'Use Image', 'wp-review' ); ?></a>
698
- </div>
699
- </div>
700
-
701
- <div id="review-defaults" class="settings-tab-defaults tab-content" style="display: none;">
702
- <h3><?php esc_html_e( 'Defaults', 'wp-review' ); ?></h3>
703
-
704
- <?php $has_criteria_filter = has_filter( 'wp_review_default_criteria' ); ?>
705
- <?php $schemas = wp_review_schema_types(); ?>
706
-
707
- <div class="wp-review-field">
708
- <div class="wp-review-field-label">
709
- <label for="wp_review_type"><?php esc_html_e( 'Review type', 'wp-review' ); ?></label>
710
- </div>
711
-
712
- <div class="wp-review-field-option">
713
- <select name="wp_review_options[review_type]" id="wp_review_type">
714
- <option value="none" <?php selected( $review_type, 'none' ); ?>><?php esc_html_e( 'No Review', 'wp-review' ); ?></option>
715
- <?php
716
- foreach ( $review_types as $key => $value ) {
717
- if ( ! isset( $available_types[ $key ] ) ) {
718
- continue;
719
- }
720
-
721
- $disabled = 'circle' === $key || 'thumbs' === $key;
722
- printf(
723
- '<option value="%1$s" class="%2$s" %3$s>%4$s</option>',
724
- esc_attr( $key ),
725
- $disabled ? 'disabled' : '',
726
- selected( $review_type, $key, false ),
727
- esc_html( $value['label'] )
728
- );
729
- }
730
- ?>
731
- </select>
732
- </div>
733
- </div>
734
-
735
- <div class="wp-review-field"<?php if ( empty( $displayed_fields['location'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
736
- <div class="wp-review-field-label">
737
- <label for="wp_review_location"><?php esc_html_e( 'Review Location', 'wp-review' ); ?></label>
738
- </div>
739
-
740
- <div class="wp-review-field-option">
741
- <select name="wp_review_options[review_location]" id="wp_review_location">
742
- <option value="bottom" <?php selected( $location, 'bottom' ); ?>><?php esc_html_e( 'After Content', 'wp-review' ); ?></option>
743
- <option value="top" <?php selected( $location, 'top' ); ?>><?php esc_html_e( 'Before Content', 'wp-review' ); ?></option>
744
- <option value="custom" <?php selected( $location, 'custom' ); ?>><?php esc_html_e( 'Custom (use shortcode)', 'wp-review' ); ?></option>
745
- </select>
746
-
747
- <p id="wp_review_shortcode_hint_field">
748
- <input id="wp_review_shortcode_hint" type="text" value="[wp-review]" readonly="readonly">
749
- <span><?php esc_html_e( 'Copy & paste this shortcode in the post content.', 'wp-review' ); ?></span>
750
- </p>
751
- </div>
752
- </div>
753
-
754
- <div class="wp-review-field">
755
- <div class="wp-review-field-label">
756
- <label for="wp_review_schema"><?php esc_html_e( 'Review Schema', 'wp-review' ); ?></label>
757
- <?php wp_review_print_pro_text(); ?>
758
- </div>
759
-
760
- <div class="wp-review-field-option">
761
- <select name="wp_review_options[default_schema_type]" id="wp_review_schema">
762
- <?php foreach ( $schemas as $key => $arr ) : ?>
763
- <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $default_schema ); ?> disabled><?php echo esc_html( $arr['label'] ); ?></option>
764
- <?php endforeach; ?>
765
- </select>
766
- </div>
767
- </div>
768
-
769
- <div class="wp-review-field">
770
- <div class="wp-review-field-label">
771
- <label><?php esc_html_e( 'Features', 'wp-review' ); ?></label>
772
- </div>
773
-
774
- <div class="wp-review-field-option">
775
- <table id="wp-review-item">
776
- <?php if ( $has_criteria_filter ) : ?>
777
- <?php foreach ( $default_criteria as $item ) : ?>
778
- <?php if ( ! empty( $item ) ) : ?>
779
- <tr>
780
- <td style="padding:0">
781
- <input type="text" name="wp_review_options[default_features][]" value="<?php if ( ! empty( $item ) ) echo esc_attr( $item ); // phpcs:ignore ?>" <?php echo $has_criteria_filter ? 'disabled="disabled" readonly="readonly"' : ''; ?> />
782
- <?php if ( ! $has_criteria_filter ) : ?>
783
- <a class="button remove-row" href="#"><?php esc_html_e( 'Delete', 'wp-review' ); ?></a>
784
- <?php endif; ?>
785
- </td>
786
- </tr>
787
- <?php endif; ?>
788
- <?php endforeach; ?>
789
- <?php else : ?>
790
- <?php foreach ( $items as $item ) : ?>
791
- <?php if ( ! empty( $item ) ) : ?>
792
- <tr>
793
- <td style="padding:0">
794
- <input type="text" name="wp_review_options[default_features][]" value="<?php if ( ! empty( $item ) ) echo esc_attr( $item ); // phpcs:ignore ?>" <?php echo $has_criteria_filter ? 'disabled="disabled" readonly="readonly"' : ''; ?> />
795
- <?php if ( ! $has_criteria_filter ) : ?>
796
- <a class="button remove-row" href="#"><?php esc_html_e( 'Delete', 'wp-review' ); ?></a>
797
- <?php endif; ?>
798
- </td>
799
- </tr>
800
- <?php endif; ?>
801
- <?php endforeach; ?>
802
- <?php endif; ?>
803
- <tr class="empty-row screen-reader-text">
804
- <td style="padding:0">
805
- <input class="focus-on-add" type="text" name="wp_review_options[default_features][]" />
806
- <a class="button remove-row" href="#"><?php esc_html_e( 'Delete', 'wp-review' ); ?></a>
807
- </td>
808
- </tr>
809
- </table>
810
- <?php if ( $has_criteria_filter ) : ?>
811
- <p class="description"><?php esc_html_e( 'Default features are set by a filter function. Remove it to change.', 'wp-review' ); ?></p>
812
- <?php else : ?>
813
- <a class="add-row button" data-target="#wp-review-item" href="#"><?php esc_html_e( 'Add default feature', 'wp-review' ); ?></a>
814
- <?php endif; ?>
815
- </div>
816
- </div>
817
-
818
- <div class="wp-review-field">
819
- <div class="wp-review-field-label">
820
- <label><?php esc_html_e( 'Links', 'wp-review' ); ?></label>
821
- </div>
822
-
823
- <div class="wp-review-field-option">
824
- <table id="wp-review-link">
825
- <?php if ( ! empty( $link_texts ) ) : ?>
826
- <?php foreach ( $link_texts as $key => $text ) : ?>
827
- <?php if ( ! empty( $text ) && ! empty( $link_urls[ $key ] ) ) : ?>
828
- <tr>
829
- <td style="padding:0">
830
- <input type="text" name="wp_review_options[default_link_text][]" placeholder="Text" value="<?php echo esc_attr( $text ); ?>" />
831
- <input type="text" name="wp_review_options[default_link_url][]" placeholder="URL" value="<?php echo esc_url( $link_urls[ $key ] ); ?>" />
832
- <a class="button remove-row" href="#"><?php esc_html_e( 'Delete', 'wp-review' ); ?></a>
833
- </td>
834
- </tr>
835
- <?php endif; ?>
836
- <?php endforeach; ?>
837
- <?php endif; ?>
838
- <tr class="empty-row screen-reader-text">
839
- <td style="padding:0">
840
- <input class="focus-on-add" type="text" name="wp_review_options[default_link_text][]" placeholder="Text" />
841
- <input type="text" name="wp_review_options[default_link_url][]" placeholder="URL" />
842
- <a class="button remove-row" href="#"><?php esc_html_e( 'Delete', 'wp-review' ); ?></a>
843
- </td>
844
- </tr>
845
- </table>
846
- <a class="add-row button" data-target="#wp-review-link" href="#"><?php esc_html_e( 'Add default link', 'wp-review' ); ?></a>
847
- </div>
848
- </div>
849
-
850
- <div class="wp-review-field">
851
- <div class="wp-review-field-label">
852
- <label><?php esc_html_e( 'User Ratings', 'wp-review' ); ?></label>
853
- </div>
854
-
855
- <div class="wp-review-field-option">
856
- <label>
857
- <input type="radio" name="wp_review_options[default_user_review_type]" id="wp-review-userReview-disable" value="<?php echo esc_attr( WP_REVIEW_REVIEW_DISABLED ); ?>" <?php checked( WP_REVIEW_REVIEW_DISABLED, $default_user_review_type ); ?> />
858
- <?php esc_html_e( 'Disabled', 'wp-review' ); ?>
859
- </label>
860
- <br>
861
- <label>
862
- <input type="radio" name="wp_review_options[default_user_review_type]" id="wp-review-userReview-visitor" value="<?php echo esc_attr( WP_REVIEW_REVIEW_VISITOR_ONLY ); ?>" <?php checked( WP_REVIEW_REVIEW_VISITOR_ONLY, $default_user_review_type ); ?> />
863
- <?php esc_html_e( 'Visitor Rating Only', 'wp-review' ); ?>
864
- </label>
865
- <br>
866
- <label class="wp-review-disabled">
867
- <input type="radio" name="wp_review_options[default_user_review_type]" id="wp-review-userReview-comment" value="<?php echo esc_attr( WP_REVIEW_REVIEW_COMMENT_ONLY ); ?>" <?php checked( WP_REVIEW_REVIEW_COMMENT_ONLY, $default_user_review_type ); ?> disabled />
868
- <?php esc_html_e( 'Comment Rating Only', 'wp-review' ); ?>
869
- <?php wp_review_print_pro_text( true ); ?>
870
- </label>
871
- <br>
872
- <label class="wp-review-disabled">
873
- <input type="radio" name="wp_review_options[default_user_review_type]" id="wp-review-userReview-both" value="<?php echo esc_attr( WP_REVIEW_REVIEW_ALLOW_BOTH ); ?>" <?php checked( WP_REVIEW_REVIEW_ALLOW_BOTH, $default_user_review_type ); ?> disabled />
874
- <?php esc_html_e( 'Both', 'wp-review' ); ?>
875
- <?php wp_review_print_pro_text( true ); ?>
876
- </label>
877
- </div>
878
- </div>
879
- </div>
880
-
881
- <div id="review-embed" class="settings-tab-embed tab-content" style="display: none;">
882
- <h3><?php esc_html_e( 'Embed', 'wp-review' ); ?></h3>
883
- <p class="description"><?php esc_html_e( 'From here you can enable embed feature, which will show embed code in the frontend which site visitors can use to embed review on their site.', 'wp-review' ); ?></p>
884
-
885
- <div class="wp-review-field">
886
- <div class="wp-review-field-label">
887
- <label><?php esc_html_e( 'Enable Embed', 'wp-review' ); ?></label>
888
- <?php wp_review_print_pro_text(); ?>
889
- </div>
890
-
891
- <div class="wp-review-field-option">
892
- <?php
893
- $form_field->render_switch(
894
- array(
895
- 'id' => 'wp_review_enable_embed',
896
- 'name' => 'wp_review_options[enable_embed]',
897
- 'disabled' => true,
898
- )
899
- );
900
- ?>
901
- </div>
902
- </div>
903
-
904
- <div class="wp-review-field">
905
- <div class="wp-review-field-label">
906
- <label><?php esc_html_e( 'Show Title', 'wp-review' ); ?></label>
907
- <?php wp_review_print_pro_text(); ?>
908
- </div>
909
-
910
- <div class="wp-review-field-option">
911
- <?php
912
- $form_field->render_switch(
913
- array(
914
- 'id' => 'wp_review_embed_show_title',
915
- 'name' => 'wp_review_options[embed_show_title]',
916
- 'disabled' => true,
917
- )
918
- );
919
- ?>
920
- </div>
921
- </div>
922
-
923
- <div class="wp-review-field">
924
- <div class="wp-review-field-label">
925
- <label><?php esc_html_e( 'Show Thumbnail', 'wp-review' ); ?></label>
926
- <?php wp_review_print_pro_text(); ?>
927
- </div>
928
-
929
- <div class="wp-review-field-option">
930
- <?php
931
- $form_field->render_switch(
932
- array(
933
- 'id' => 'wp_review_embed_show_thumbnail',
934
- 'name' => 'wp_review_options[embed_show_thumbnail]',
935
- 'disabled' => true,
936
- )
937
- );
938
- ?>
939
- </div>
940
- </div>
941
-
942
- <div class="wp-review-field">
943
- <div class="wp-review-field-label">
944
- <label><?php esc_html_e( 'Show Excerpt', 'wp-review' ); ?></label>
945
- <?php wp_review_print_pro_text(); ?>
946
- </div>
947
-
948
- <div class="wp-review-field-option">
949
- <?php
950
- $form_field->render_switch(
951
- array(
952
- 'id' => 'wp_review_embed_show_excerpt',
953
- 'name' => 'wp_review_options[embed_show_excerpt]',
954
- 'disabled' => true,
955
- )
956
- );
957
- ?>
958
- </div>
959
- </div>
960
-
961
- <div class="wp-review-field">
962
- <div class="wp-review-field-label">
963
- <label><?php esc_html_e( 'Show Rating Box', 'wp-review' ); ?></label>
964
- <?php wp_review_print_pro_text(); ?>
965
- </div>
966
-
967
- <div class="wp-review-field-option">
968
- <?php
969
- $form_field->render_switch(
970
- array(
971
- 'id' => 'wp_review_embed_show_rating_box',
972
- 'name' => 'wp_review_options[embed_show_rating_box]',
973
- 'disabled' => true,
974
- )
975
- );
976
- ?>
977
- </div>
978
- </div>
979
-
980
- <div class="wp-review-field">
981
- <div class="wp-review-field-label">
982
- <label><?php esc_html_e( 'Show Credit', 'wp-review' ); ?></label>
983
- <?php wp_review_print_pro_text(); ?>
984
- </div>
985
-
986
- <div class="wp-review-field-option">
987
- <?php
988
- $form_field->render_switch(
989
- array(
990
- 'id' => 'wp_review_embed_show_credit',
991
- 'name' => 'wp_review_options[embed_show_credit]',
992
- 'disabled' => true,
993
- )
994
- );
995
- ?>
996
- </div>
997
- </div>
998
- </div>
999
-
1000
- <?php if ( $rows_left ) : ?>
1001
- <div id="review-migrate" class="settings-tab-migrate tab-content" style="display: none;">
1002
- <div id="settings-allow-migrate">
1003
- <p><?php esc_html_e( 'Here you can import your existing user ratings from WP Review 1.x and WP Review Pro 1.x.', 'wp-review' ); ?></p>
1004
- <p class="migrate-items">
1005
- <?php
1006
- // translators: number of rows left.
1007
- printf( esc_html__( '%s ratings left to import.', 'wp-review' ), '<span id="migrate-items-num">' . intval( $rows_left ) . '</span>' );
1008
- ?>
1009
- </p>
1010
- <a href="#" class="button button-secondary" id="start-migrate" data-start="<?php echo esc_attr( $migrated_rows ); ?>"><?php esc_html_e( 'Start import', 'wp-review' ); ?></a>
1011
- <textarea id="wp-review-migrate-log"></textarea>
1012
- </div>
1013
- <p class="already-migrated-msg"><?php esc_html_e( 'Ratings have already been migrated.', 'wp-review' ); ?></p>
1014
- </div>
1015
- <?php endif; ?>
1016
- </div>
1
+ <?php
2
+ /**
3
+ * Review options tab
4
+ *
5
+ * @package WP_Review
6
+ */
7
+
8
+ $options = get_option( 'wp_review_options' );
9
+
10
+ $default_options = array(
11
+ 'colors' => array(
12
+ 'color' => '',
13
+ 'inactive_color' => '',
14
+ 'fontcolor' => '',
15
+ 'bgcolor1' => '',
16
+ 'bgcolor2' => '',
17
+ 'bordercolor' => '',
18
+ ),
19
+ 'default_features' => array(),
20
+ 'default_link_texts' => array(),
21
+ 'default_link_urls' => array(),
22
+ 'default_schema_type' => 'Thing',
23
+ 'default_user_review_type' => WP_REVIEW_REVIEW_DISABLED,
24
+ 'image_sizes' => array(),
25
+ );
26
+ // Set defaults.
27
+ if ( empty( $options ) ) {
28
+ $options = $default_options;
29
+ update_option( 'wp_review_options', $options );
30
+ }
31
+
32
+ if ( empty( $options['image_sizes'] ) ) {
33
+ $options['image_sizes'] = array();
34
+ }
35
+
36
+ $opt_name = 'wp_review_options_' . wp_get_theme();
37
+ $options_updated = get_option( $opt_name );
38
+ $suggest_theme_defaults = true;
39
+ if ( ! empty( $_GET['wp-review-theme-defaults'] ) && empty( $_GET['settings-updated'] ) ) { // WPCS: csrf ok.
40
+ wp_review_theme_defaults( $options_updated, true );
41
+ $options = get_option( 'wp_review_options' );
42
+ $suggest_theme_defaults = false;
43
+ }
44
+
45
+ // Test to see if we need to sugges setting theme defaults.
46
+ if ( empty( $options_updated ) ) {
47
+ $options_updated = array();
48
+ }
49
+
50
+ $opts_tmp = array_merge( $options, $options_updated );
51
+ if ( $opts_tmp === $options ) {
52
+ $suggest_theme_defaults = false;
53
+ }
54
+
55
+ // Migrate.
56
+ global $wpdb;
57
+ $current_blog_id = get_current_blog_id();
58
+ $total_rows = 0;
59
+ $rows_left = 0;
60
+ $migrated_rows = get_option( 'wp_review_migrated_rows', 0 );
61
+ $has_migrated = get_option( 'wp_review_has_migrated', false );
62
+ if ( ! $has_migrated && $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->base_prefix}mts_wp_reviews'" ) === "{$wpdb->base_prefix}mts_wp_reviews" ) {
63
+ // Table exists and not migrated (fully) yet.
64
+ $total_rows = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->base_prefix}mts_wp_reviews WHERE blog_id = {$current_blog_id}" ); // WPCS: unprepared SQL ok.
65
+ $rows_left = $total_rows - $migrated_rows;
66
+ }
67
+
68
+ $comment_form_integration = ( ! empty( $options['comment_form_integration'] ) ? $options['comment_form_integration'] : 'replace' );
69
+ if ( 'replace' !== $comment_form_integration ) {
70
+ $comment_form_integration = 'extend';
71
+ }
72
+
73
+ $comments_template = ( ! empty( $options['comments_template'] ) ? $options['comments_template'] : 'theme' );
74
+ if ( 'theme' !== $comments_template ) {
75
+ $comments_template = 'plugin';
76
+ }
77
+
78
+ $default_colors = wp_review_get_default_colors();
79
+ $default_location = wp_review_get_default_location();
80
+ $default_criteria = wp_review_get_default_criteria();
81
+
82
+ $default_items = array();
83
+ foreach ( $default_criteria as $item ) {
84
+ $default_items[] = array(
85
+ 'wp_review_item_title' => $item,
86
+ 'wp_review_item_star' => '',
87
+ );
88
+ }
89
+ $default_schema = $default_options['default_schema_type'];
90
+ $default_user_review_type = empty( $options['default_user_review_type'] ) ? WP_REVIEW_REVIEW_DISABLED : $options['default_user_review_type'];
91
+
92
+ $options['colors'] = apply_filters( 'wp_review_colors', $options['colors'], 0 );
93
+ if ( ! isset( $options['default'] ) ) {
94
+ $options['default'] = array();
95
+ }
96
+ /* Retrieve an existing value from the database. */
97
+ $items = ! empty( $options['default_features'] ) ? $options['default_features'] : '';
98
+ $link_texts = ! empty( $options['default_link_text'] ) ? $options['default_link_text'] : array();
99
+ $link_urls = ! empty( $options['default_link_url'] ) ? $options['default_link_url'] : array();
100
+ $location = wp_review_option( 'review_location' );
101
+ $color = ! empty( $options['colors']['color'] ) ? $options['colors']['color'] : '';
102
+ $inactive_color = ! empty( $options['colors']['inactive_color'] ) ? $options['colors']['inactive_color'] : '';
103
+ $fontcolor = ! empty( $options['colors']['fontcolor'] ) ? $options['colors']['fontcolor'] : '';
104
+ $bgcolor1 = ! empty( $options['colors']['bgcolor1'] ) ? $options['colors']['bgcolor1'] : '';
105
+ $bgcolor2 = ! empty( $options['colors']['bgcolor2'] ) ? $options['colors']['bgcolor2'] : '';
106
+ $bordercolor = ! empty( $options['colors']['bordercolor'] ) ? $options['colors']['bordercolor'] : '';
107
+
108
+ $force_user_ratings = wp_review_option( 'force_user_ratings' );
109
+
110
+ $rating_icon = wp_review_option( 'rating_icon', apply_filters( 'wp_review_default_rating_icon', 'fa fa-star' ) );
111
+ $rating_image = wp_review_option( 'rating_image' );
112
+
113
+ $review_templates = wp_review_get_box_templates();
114
+ $box_template = wp_review_option( 'box_template', 'default' );
115
+ $box_template_img = ! empty( $review_templates[ $box_template ] ) ? $review_templates[ $box_template ]['image'] : WP_REVIEW_ASSETS . 'images/largethumb.png';
116
+
117
+ $review_types = wp_review_get_rating_types();
118
+ $review_type = wp_review_option( 'review_type', 'none' );
119
+
120
+ if ( '' === $items ) {
121
+ $items = $default_items;
122
+ }
123
+ if ( '' === $color ) {
124
+ $color = $default_colors['color'];
125
+ }
126
+ if ( '' === $inactive_color ) {
127
+ $inactive_color = $default_colors['inactive_color'];
128
+ }
129
+ if ( '' === $location ) {
130
+ $location = $default_location;
131
+ }
132
+ if ( '' === $fontcolor ) {
133
+ $fontcolor = $default_colors['fontcolor'];
134
+ }
135
+ if ( '' === $bgcolor1 ) {
136
+ $bgcolor1 = $default_colors['bgcolor1'];
137
+ }
138
+ if ( '' === $bgcolor2 ) {
139
+ $bgcolor2 = $default_colors['bgcolor2'];
140
+ }
141
+ if ( '' === $bordercolor ) {
142
+ $bordercolor = $default_colors['bordercolor'];
143
+ }
144
+ if ( empty( $width ) ) {
145
+ $width = 100;
146
+ }
147
+
148
+ $fields = array(
149
+ 'location' => true,
150
+ 'color' => true,
151
+ 'inactive_color' => true,
152
+ 'fontcolor' => true,
153
+ 'bgcolor1' => true,
154
+ 'bgcolor2' => true,
155
+ 'bordercolor' => true,
156
+ 'custom_colors' => true,
157
+ 'custom_location' => true,
158
+ );
159
+
160
+ $displayed_fields = apply_filters( 'wp_review_metabox_item_fields', $fields );
161
+
162
+ $available_types = apply_filters(
163
+ 'wp_review_metabox_types',
164
+ array(
165
+ 'star' => __( 'Star', 'wp-review' ),
166
+ 'point' => __( 'Point', 'wp-review' ),
167
+ 'percentage' => __( 'Percentage', 'wp-review' ),
168
+ 'circle' => __( 'Circle', 'wp-review' ),
169
+ 'thumbs' => __( 'Thumbs', 'wp-review' ),
170
+ )
171
+ );
172
+
173
+ $form_field = new WP_Review_Form_Field();
174
+ ?>
175
+ <div data-nav-tabs>
176
+ <div class="nav-tab-wrapper">
177
+ <a href="#review-general" class="nav-tab nav-tab-active"><?php esc_html_e( 'General', 'wp-review' ); ?></a>
178
+ <a href="#review-styling" class="nav-tab"><?php esc_html_e( 'Styling', 'wp-review' ); ?></a>
179
+ <a href="#review-defaults" class="nav-tab"><?php esc_html_e( 'Defaults', 'wp-review' ); ?></a>
180
+ <a href="#review-embed" class="nav-tab"><?php esc_html_e( 'Embed', 'wp-review' ); ?></a>
181
+ <?php if ( $rows_left ) : ?>
182
+ <a href="#review-migrate" class="nav-tab"><?php esc_html_e( 'Migrate Ratings', 'wp-review' ); ?></a>
183
+ <?php endif; ?>
184
+ </div>
185
+
186
+ <div id="review-general" class="settings-tab-general tab-content">
187
+ <h3><?php esc_html_e( 'General Settings', 'wp-review' ); ?></h3>
188
+ <?php
189
+ $location = apply_filters( 'wp_review_location', $location, 0 );
190
+ if ( has_filter( 'wp_review_location' ) ) {
191
+ echo '<p class="wp-review-filter-msg"><div class="dashicons dashicons-info"></div>' . esc_html__( 'There is a filter set for the review location that may modify the options below.', 'wp-review' ) . '</p>';
192
+ }
193
+
194
+ if ( $suggest_theme_defaults ) {
195
+ ?>
196
+ <div class="wp-review-theme-defaults-msg updated settings-error">
197
+ <p class="wp-review-field">
198
+ <?php esc_html_e( 'The current theme provides default settings for the plugin.', 'wp-review' ); ?><br />
199
+ </p>
200
+ <a href="<?php echo admin_url( 'options-general.php?page=wp-review/admin/options.php&wp-review-theme-defaults=1' ); // WPCS: xss ok. ?>" class="button button-primary"><?php esc_html_e( 'Set to theme defaults', 'wp-review' ); ?></a>
201
+ <a href="#" class="dashicons dashicons-no-alt close-notice"></a>
202
+ </div>
203
+ <?php } ?>
204
+
205
+ <div class="wp-review-field">
206
+ <div class="wp-review-field-label">
207
+ <label><?php esc_html_e( 'Restrict rating to registered users only', 'wp-review' ); ?></label>
208
+ </div>
209
+
210
+ <div class="wp-review-field-option">
211
+ <?php
212
+ $form_field->render_switch(
213
+ array(
214
+ 'id' => 'wp_review_registered_only',
215
+ 'name' => 'wp_review_options[registered_only]',
216
+ 'value' => ! empty( $options['registered_only'] ),
217
+ )
218
+ );
219
+ ?>
220
+ </div>
221
+ </div>
222
+
223
+ <div class="wp-review-field">
224
+ <div class="wp-review-disabled wp-review-field-label">
225
+ <label><?php esc_html_e( 'Add total rating to thumbnails', 'wp-review' ); ?></label>
226
+ <?php wp_review_print_pro_text(); ?>
227
+ </div>
228
+
229
+ <div class="wp-review-field-option">
230
+ <?php
231
+ $form_field->render_switch(
232
+ array(
233
+ 'id' => 'wp_review_show_on_thumbnails',
234
+ 'name' => 'wp_review_options[show_on_thumbnails]',
235
+ 'disabled' => true,
236
+ )
237
+ );
238
+ ?>
239
+ </div>
240
+ </div>
241
+
242
+ <div class="wp-review-field">
243
+ <div class="wp-review-disabled wp-review-field-label">
244
+ <label><?php esc_html_e( 'Enable User rating in old posts', 'wp-review' ); ?></label>
245
+ <?php wp_review_print_pro_text(); ?>
246
+ </div>
247
+
248
+ <div class="wp-review-field-option">
249
+ <?php
250
+ $form_field->render_switch(
251
+ array(
252
+ 'id' => 'wp_review_global_user_rating',
253
+ 'name' => 'wp_review_options[global_user_rating]',
254
+ 'disabled' => true,
255
+ )
256
+ );
257
+ ?>
258
+ </div>
259
+ </div>
260
+
261
+ <?php if ( class_exists( 'WooCommerce' ) ) : ?>
262
+ <div class="wp-review-field">
263
+ <div class="wp-review-disabled wp-review-field-label">
264
+ <label><?php esc_html_e( 'Replace WooCommerce rating', 'wp-review' ); ?></label>
265
+ <?php wp_review_print_pro_text(); ?>
266
+ </div>
267
+
268
+ <div class="wp-review-field-option">
269
+ <?php
270
+ $form_field->render_switch(
271
+ array(
272
+ 'id' => 'wp_review_replace_wc_rating',
273
+ 'name' => 'wp_review_options[replace_wc_rating]',
274
+ 'disabled' => true,
275
+ )
276
+ );
277
+ ?>
278
+ </div>
279
+ </div>
280
+ <?php endif; ?>
281
+
282
+ <div class="wp-review-field">
283
+ <div class="wp-review-disabled wp-review-field-label">
284
+ <label><?php esc_html_e( 'Disable Map Script in the Backend', 'wp-review' ); ?></label>
285
+ <?php wp_review_print_pro_text(); ?>
286
+ </div>
287
+
288
+ <div class="wp-review-field-option">
289
+ <?php
290
+ $form_field->render_switch(
291
+ array(
292
+ 'id' => 'wp_review_dequeue_map_backend',
293
+ 'name' => 'wp_review_options[dequeue_map_backend]',
294
+ 'disabled' => true,
295
+ )
296
+ );
297
+ ?>
298
+ </div>
299
+
300
+ <p class="description" style="margin-top: 10px;"><?php esc_html_e( 'If map script is conflicting with other plugin in the single post editor, please enable this option.', 'wp-review' ); ?></p>
301
+ </div>
302
+
303
+ <div class="wp-review-field">
304
+ <div class="wp-review-disabled wp-review-field-label">
305
+ <label><?php esc_html_e( 'Comments template', 'wp-review' ); ?></label>
306
+ <?php wp_review_print_pro_text(); ?>
307
+ </div>
308
+
309
+ <div class="wp-review-field-option">
310
+ <div class="wpr-flex">
311
+ <div class="pr-10 wpr-col-1-2">
312
+ <label for="wp_review_comments_template_theme">
313
+ <span class="wp-review-disabled inline-block has-bg">
314
+ <input name="wp_review_options[comments_template]" id="wp_review_comments_template_theme" type="radio" value="theme" <?php checked( $comments_template, 'theme' ); ?> disabled />
315
+ <strong><?php esc_html_e( 'Theme', 'wp-review' ); ?></strong>
316
+ </span>
317
+ </label>
318
+ <br>
319
+ <span class="description"><?php esc_html_e( 'Use theme comments template. Might need customization of comments.php', 'wp-review' ); ?></span>
320
+ </div>
321
+
322
+ <div class="pl-10 wpr-col-1-2">
323
+ <label for="wp_review_comments_template_plugin">
324
+ <span class="wp-review-disabled inline-block has-bg">
325
+ <input name="wp_review_options[comments_template]" id="wp_review_comments_template_plugin" type="radio" value="plugin" <?php checked( $comments_template, 'plugin' ); ?> disabled />
326
+ <strong><?php esc_html_e( 'WP Review', 'wp-review' ); ?></strong>
327
+ </span>
328
+ </label>
329
+ <br>
330
+ <span class="description"><?php esc_html_e( 'Use WP Review comments template. Better chances for out of the box integration.', 'wp-review' ); ?></span>
331
+ </div>
332
+ </div>
333
+ </div>
334
+ </div>
335
+
336
+ <div class="wp-review-field">
337
+ <div class="wp-review-disabled wp-review-field-label">
338
+ <label><?php esc_html_e( 'Comment form integration', 'wp-review' ); ?></label>
339
+ <?php wp_review_print_pro_text(); ?>
340
+ </div>
341
+
342
+ <div class="wp-review-field-option">
343
+ <div class="wpr-flex">
344
+ <div class="pr-10 wpr-col-1-2">
345
+ <label for="wp_review_comment_form_integration_replace">
346
+ <span class="wp-review-disabled inline-block has-bg">
347
+ <input name="wp_review_options[comment_form_integration]" id="wp_review_comment_form_integration_replace" type="radio" value="replace" <?php checked( $comment_form_integration, 'replace' ); ?> disabled />
348
+ <strong><?php esc_html_e( 'Replace', 'wp-review' ); ?></strong>
349
+ </span>
350
+ </label>
351
+ <br>
352
+ <span class="description"><?php esc_html_e( 'Replace form fields.', 'wp-review' ); ?></span>
353
+ </div>
354
+
355
+ <div class="pl-10 wpr-col-1-2">
356
+ <label for="wp_review_comment_form_integration_extend">
357
+ <span class="wp-review-disabled inline-block has-bg">
358
+ <input name="wp_review_options[comment_form_integration]" id="wp_review_comment_form_integration_extend" type="radio" value="extend" <?php checked( $comment_form_integration, 'extend' ); ?> disabled />
359
+ <strong><?php esc_html_e( 'Extend', 'wp-review' ); ?></strong>
360
+ </span>
361
+ </label>
362
+ <br>
363
+ <span class="description"><?php esc_html_e( 'Add new fields without modifying the default fields.', 'wp-review' ); ?></span>
364
+ </div>
365
+ </div>
366
+ </div>
367
+ </div>
368
+
369
+ <div class="wp-review-field">
370
+ <div class="wp-review-disabled wp-review-field-label">
371
+ <label><?php esc_html_e( 'Require a rating when commenting', 'wp-review' ); ?></label>
372
+ <?php wp_review_print_pro_text(); ?>
373
+ </div>
374
+
375
+ <div class="wp-review-field-option">
376
+ <?php
377
+ $form_field->render_switch(
378
+ array(
379
+ 'id' => 'wp_review_require_rating',
380
+ 'name' => 'wp_review_options[require_rating]',
381
+ 'disabled' => true,
382
+ )
383
+ );
384
+ ?>
385
+ </div>
386
+ </div>
387
+
388
+ <div class="wp-review-field">
389
+ <div class="wp-review-disabled wp-review-field-label">
390
+ <label><?php esc_html_e( 'Allow comment feedback (helpful/unhelpful)', 'wp-review' ); ?></label>
391
+ <?php wp_review_print_pro_text(); ?>
392
+ </div>
393
+
394
+ <div class="wp-review-field-option">
395
+ <?php
396
+ $form_field->render_switch(
397
+ array(
398
+ 'id' => 'wp_review_allow_comment_feedback',
399
+ 'name' => 'wp_review_options[allow_comment_feedback]',
400
+ 'disabled' => true,
401
+ )
402
+ );
403
+ ?>
404
+ </div>
405
+ </div>
406
+
407
+ <div class="wp-review-field">
408
+ <div class="wp-review-disabled wp-review-field-label">
409
+ <label for="wp_review_record_ratings_by"><?php esc_html_e( 'Record User Ratings', 'wp-review' ); ?></label>
410
+ <?php wp_review_print_pro_text(); ?>
411
+ </div>
412
+
413
+ <div class="wp-review-field-option">
414
+ <span class="wp-review-disabled inline-block has-bg">
415
+ <select name="wp_review_options[record_ratings_by]" id="wp_review_record_ratings_by" disabled>
416
+ <option value="ip"><?php esc_html_e( 'Based on IP address', 'wp-review' ); ?></option>
417
+ <option value="cookie"><?php esc_html_e( 'Based on browser cookie', 'wp-review' ); ?></option>
418
+ </select>
419
+ </span>
420
+ </div>
421
+ </div>
422
+
423
+ <?php
424
+ // phpcs:disable
425
+ /*<div class="wp-review-field">
426
+ <div class="wp-review-field-label">
427
+ <label><?php esc_html_e( 'Show text count with Star ratings', 'wp-review' ); ?></label>
428
+ </div>
429
+
430
+ <div class="wp-review-field-option">
431
+ <?php
432
+ $form_field->render_switch( array(
433
+ 'id' => 'wp_review_show_star_rating_count',
434
+ 'name' => 'wp_review_options[show_star_rating_count]',
435
+ 'value' => ! empty( $options['show_star_rating_count'] ),
436
+ ) );
437
+ ?>
438
+ </div>
439
+ </div>*/
440
+ // phpcs:enable
441
+ ?>
442
+
443
+ <div class="wp-review-field">
444
+ <div class="wp-review-field-label">
445
+ <label><?php esc_html_e( 'Allow multiple reviews per account', 'wp-review' ); ?></label>
446
+ </div>
447
+
448
+ <div class="wp-review-field-option">
449
+ <?php
450
+ $form_field->render_switch(
451
+ array(
452
+ 'id' => 'wp_review_multi_reviews_per_account',
453
+ 'name' => 'wp_review_options[multi_reviews_per_account]',
454
+ 'value' => ! empty( $options['multi_reviews_per_account'] ),
455
+ )
456
+ );
457
+ ?>
458
+ </div>
459
+ </div>
460
+
461
+ <div class="wp-review-field">
462
+ <div class="wp-review-disabled wp-review-field-label">
463
+ <label><?php esc_html_e( 'Include Pros/Cons in comment reviews', 'wp-review' ); ?></label>
464
+ <?php wp_review_print_pro_text(); ?>
465
+ </div>
466
+
467
+ <div class="wp-review-field-option">
468
+ <?php
469
+ $form_field->render_switch(
470
+ array(
471
+ 'id' => 'wp_review_comment_pros_cons',
472
+ 'name' => 'wp_review_options[comment_pros_cons]',
473
+ 'disabled' => true,
474
+ )
475
+ );
476
+ ?>
477
+ </div>
478
+ </div>
479
+
480
+ <div class="wp-review-field">
481
+ <div class="wp-review-disabled wp-review-field-label">
482
+ <label><?php esc_html_e( 'Approve Comment Reviews without Moderation', 'wp-review' ); ?></label>
483
+ <?php wp_review_print_pro_text(); ?>
484
+ </div>
485
+
486
+ <div class="wp-review-field-option">
487
+ <?php
488
+ $form_field->render_switch(
489
+ array(
490
+ 'id' => 'wp_review_approve_ratings',
491
+ 'name' => 'wp_review_options[approve_ratings]',
492
+ 'disabled' => true,
493
+ )
494
+ );
495
+ ?>
496
+ </div>
497
+ </div>
498
+ <?php
499
+ if ( current_user_can( 'wp_review_purge_visitor_ratings' ) ) {
500
+ ?>
501
+ <p style="margin-top: 50px;">
502
+ <button
503
+ type="button"
504
+ class="button"
505
+ data-remove-ratings
506
+ data-type="visitor"
507
+ data-processing-text="<?php esc_attr_e( 'Processing...', 'wp-review' ); ?>"
508
+ ><?php esc_html_e( 'Purge visitor ratings', 'wp-review' ); ?></button>
509
+ <span class="description"><?php esc_html_e( 'Click to remove all visitor ratings of all posts.', 'wp-review' ); ?></span>
510
+ </p>
511
+ <?php } ?>
512
+ </div>
513
+
514
+ <div id="review-styling" class="settings-tab-styling tab-content" style="display: none;">
515
+
516
+ <h3><?php esc_html_e( 'Styling', 'wp-review' ); ?></h3>
517
+
518
+ <div class="wp-review-field vertical">
519
+ <div class="wp-review-field-label">
520
+ <label for="wp_review_box_template"><?php esc_html_e( 'Default', 'wp-review' ); ?></label>
521
+ </div>
522
+ <div class="wp-review-field-option">
523
+ <div id="wp_review_box_template_wrapper">
524
+ <select name="wp_review_options[box_template]" id="wp_review_box_template">
525
+ <?php
526
+ foreach ( $review_templates as $key => $value ) {
527
+ $disabled = 'default' !== $key && 'aqua' !== $key;
528
+ printf(
529
+ '<option value="%1$s" %2$s %3$s>%4$s</option>',
530
+ esc_attr( $key ),
531
+ selected( $key, $box_template, false ),
532
+ $disabled ? 'disabled' : '',
533
+ esc_html( $value['title'] )
534
+ );
535
+ }
536
+ ?>
537
+ </select>
538
+
539
+ <div id="wp_review_box_template_preview" style="display: none;">
540
+ <img src="#" alt="" id="wp_review_box_template_preview_img">
541
+ </div>
542
+ </div>
543
+
544
+ <div style="margin-top: 10px;">
545
+ <img src="<?php echo esc_url( $box_template_img ); ?>" alt="" id="wp_review_box_template_img">
546
+ </div>
547
+ </div>
548
+ </div>
549
+
550
+ <?php
551
+ if ( has_filter( 'wp_review_colors' ) ) {
552
+ echo '<p class="wp-review-filter-msg"><div class="dashicons dashicons-info"></div>' . esc_html__( 'There is a filter set for the review colors that may modify the options below.', 'wp-review' ) . '</p>';
553
+ }
554
+ ?>
555
+
556
+ <div class="wp-review-color-options">
557
+
558
+ <div class="wp-review-field"<?php if ( empty( $displayed_fields['color'] ) ) echo ' style="display: none;"'; // phpcS:ignore ?>>
559
+ <div class="wp-review-field-label">
560
+ <label for="wp_review_color"><?php esc_html_e( 'Review Color', 'wp-review' ); ?></label>
561
+ </div>
562
+
563
+ <div class="wp-review-field-option">
564
+ <input type="text" id="wp_review_color" class="wp-review-color" name="wp_review_options[colors][color]" value="<?php echo esc_attr( $color ); ?>" data-default-color="<?php echo esc_attr( $color ); ?>">
565
+ </div>
566
+ </div>
567
+
568
+ <div class="wp-review-field"<?php if ( empty( $displayed_fields['inactive_color'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
569
+ <div class="wp-review-field-label">
570
+ <label for="wp_review_inactive_color"><?php esc_html_e( 'Inactive Review Color', 'wp-review' ); ?></label>
571
+ </div>
572
+
573
+ <div class="wp-review-field-option">
574
+ <input type="text" id="wp_review_inactive_color" class="wp-review-color" name="wp_review_options[colors][inactive_color]" value="<?php echo esc_attr( $inactive_color ); ?>" data-default-color="<?php echo esc_attr( $inactive_color ); ?>">
575
+ </div>
576
+ </div>
577
+
578
+ <div class="wp-review-field"<?php if ( empty( $displayed_fields['fontcolor'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
579
+ <div class="wp-review-field-label">
580
+ <label for="wp_review_fontcolor"><?php esc_html_e( 'Font Color', 'wp-review' ); ?></label>
581
+ </div>
582
+
583
+ <div class="wp-review-field-option">
584
+ <input type="text" class="wp-review-color" name="wp_review_options[colors][fontcolor]" id ="wp_review_fontcolor" value="<?php echo esc_attr( $fontcolor ); ?>" data-default-color="<?php echo esc_attr( $fontcolor ); ?>">
585
+ </div>
586
+ </div>
587
+
588
+ <div class="wp-review-field"<?php if ( empty( $displayed_fields['bgcolor1'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
589
+ <div class="wp-review-field-label">
590
+ <label for="wp_review_bgcolor1"><?php esc_html_e( 'Heading Background Color', 'wp-review' ); ?></label>
591
+ </div>
592
+
593
+ <div class="wp-review-field-option">
594
+ <input type="text" class="wp-review-color" name="wp_review_options[colors][bgcolor1]" id ="wp_review_bgcolor1" value="<?php echo esc_attr( $bgcolor1 ); ?>" data-default-color="<?php echo esc_attr( $bgcolor1 ); ?>">
595
+ </div>
596
+ </div>
597
+
598
+ <div class="wp-review-field"<?php if ( empty( $displayed_fields['bgcolor2'] ) ) echo ' style="display: none;"'; //phpcs:ignore ?>>
599
+ <div class="wp-review-field-label">
600
+ <label for="wp_review_bgcolor2"><?php esc_html_e( 'Background Color', 'wp-review' ); ?></label>
601
+ </div>
602
+
603
+ <div class="wp-review-field-option">
604
+ <input type="text" class="wp-review-color" name="wp_review_options[colors][bgcolor2]" id="wp_review_bgcolor2" value="<?php echo esc_attr( $bgcolor2 ); ?>" data-default-color="<?php echo esc_attr( $bgcolor2 ); ?>">
605
+ </div>
606
+ </div>
607
+
608
+ <div class="wp-review-field"<?php if ( empty( $displayed_fields['bordercolor'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
609
+ <div class="wp-review-field-label">
610
+ <label for="wp_review_bordercolor"><?php esc_html_e( 'Border Color', 'wp-review' ); ?></label>
611
+ </div>
612
+
613
+ <div class="wp-review-field-option">
614
+ <input type="text" class="wp-review-color" name="wp_review_options[colors][bordercolor]" id="wp_review_bordercolor" value="<?php echo esc_attr( $bordercolor ); ?>" data-default-color="<?php echo esc_attr( $bordercolor ); ?>">
615
+ </div>
616
+ </div>
617
+ </div>
618
+
619
+
620
+ <div class="wp-review-field">
621
+ <div class="wp-review-disabled wp-review-field-label">
622
+ <label for="wp_review_width"><?php esc_html_e( 'Review Box Width', 'wp-review' ); ?></label>
623
+ <?php wp_review_print_pro_text(); ?>
624
+ </div>
625
+
626
+ <div class="wp-review-field-option wp-review-disabled has-bg">
627
+ <input type="number" min="1" max="100" step="1" name="wp_review_options[width]" id="wp_review_width" value="100" disabled /> %
628
+ <div id="wp-review-width-slider"></div>
629
+ </div>
630
+ </div>
631
+
632
+ <div class="wp-review-field">
633
+ <div class="wp-review-disabled wp-review-field-label">
634
+ <label><?php esc_html_e( 'Google Font', 'wp-review' ); ?></label><br>
635
+ <span class="description">
636
+ <?php _e( 'Many templates use Google Font, select <code>No</code> to use default theme font.', 'wp-review' ); // WPCS: xss ok. ?>
637
+ </span>
638
+ <?php wp_review_print_pro_text(); ?>
639
+ </div>
640
+
641
+ <div class="wp-review-field-option">
642
+ <?php
643
+ $form_field->render_switch(
644
+ array(
645
+ 'id' => 'wp_review_fontfamily',
646
+ 'name' => 'wp_review_options[fontfamily]',
647
+ 'disabled' => true,
648
+ )
649
+ );
650
+ ?>
651
+ </div>
652
+ </div>
653
+
654
+ <div class="wp-review-field">
655
+ <div class="wp-review-disabled wp-review-field-label">
656
+ <label><?php esc_html_e( 'Comment Rating Color', 'wp-review' ); ?></label><br>
657
+ <span class="description">
658
+ <?php esc_html_e( 'Use different color for ratings in comments', 'wp-review' ); ?>
659
+ </span>
660
+ <?php wp_review_print_pro_text(); ?>
661
+ </div>
662
+
663
+ <div class="wp-review-field-option">
664
+ <?php
665
+ $form_field->render_switch(
666
+ array(
667
+ 'id' => 'wp_review_custom_comment_colors',
668
+ 'name' => 'wp_review_options[custom_comment_colors]',
669
+ 'disabled' => true,
670
+ )
671
+ );
672
+ ?>
673
+ </div>
674
+ </div>
675
+
676
+ <div class="wp-review-field wp-review-rating-icon">
677
+ <div class="wp-review-field-label">
678
+ <label for="wp_review_rating_icon"><?php esc_html_e( 'Rating icon', 'wp-review' ); ?></label>
679
+ </div>
680
+
681
+ <div class="wp-review-field-option">
682
+ <select name="wp_review_options[rating_icon]" id="wp_review_rating_icon" class="js-select2">
683
+ <?php
684
+ $icons = wp_review_get_icons();
685
+ foreach ( $icons as $name => $icon ) {
686
+ printf(
687
+ '<option value="%1$s" data-icon="%1$s" %2$s %3$s>%4$s</option>',
688
+ esc_attr( $name ),
689
+ selected( $rating_icon, $name, false ),
690
+ 'fa fa-star' !== $name ? 'disabled' : '',
691
+ esc_html( $icon['name'] )
692
+ );
693
+ }
694
+ ?>
695
+ </select>
696
+ </div>
697
+ <a href="#" class="wpr-toggle-rating wp-review-disabled inline-block has-bg"><?php esc_html_e( 'Use Image', 'wp-review' ); ?></a>
698
+ </div>
699
+ </div>
700
+
701
+ <div id="review-defaults" class="settings-tab-defaults tab-content" style="display: none;">
702
+ <h3><?php esc_html_e( 'Defaults', 'wp-review' ); ?></h3>
703
+
704
+ <?php $has_criteria_filter = has_filter( 'wp_review_default_criteria' ); ?>
705
+ <?php $schemas = wp_review_schema_types(); ?>
706
+
707
+ <div class="wp-review-field">
708
+ <div class="wp-review-field-label">
709
+ <label for="wp_review_type"><?php esc_html_e( 'Review type', 'wp-review' ); ?></label>
710
+ </div>
711
+
712
+ <div class="wp-review-field-option">
713
+ <select name="wp_review_options[review_type]" id="wp_review_type">
714
+ <option value="none" <?php selected( $review_type, 'none' ); ?>><?php esc_html_e( 'No Review', 'wp-review' ); ?></option>
715
+ <?php
716
+ foreach ( $review_types as $key => $value ) {
717
+ if ( ! isset( $available_types[ $key ] ) ) {
718
+ continue;
719
+ }
720
+
721
+ $disabled = 'circle' === $key || 'thumbs' === $key;
722
+ printf(
723
+ '<option value="%1$s" class="%2$s" %3$s>%4$s</option>',
724
+ esc_attr( $key ),
725
+ $disabled ? 'disabled' : '',
726
+ selected( $review_type, $key, false ),
727
+ esc_html( $value['label'] )
728
+ );
729
+ }
730
+ ?>
731
+ </select>
732
+ </div>
733
+ </div>
734
+
735
+ <div class="wp-review-field"<?php if ( empty( $displayed_fields['location'] ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
736
+ <div class="wp-review-field-label">
737
+ <label for="wp_review_location"><?php esc_html_e( 'Review Location', 'wp-review' ); ?></label>
738
+ </div>
739
+
740
+ <div class="wp-review-field-option">
741
+ <select name="wp_review_options[review_location]" id="wp_review_location">
742
+ <option value="bottom" <?php selected( $location, 'bottom' ); ?>><?php esc_html_e( 'After Content', 'wp-review' ); ?></option>
743
+ <option value="top" <?php selected( $location, 'top' ); ?>><?php esc_html_e( 'Before Content', 'wp-review' ); ?></option>
744
+ <option value="custom" <?php selected( $location, 'custom' ); ?>><?php esc_html_e( 'Custom (use shortcode)', 'wp-review' ); ?></option>
745
+ </select>
746
+
747
+ <p id="wp_review_shortcode_hint_field">
748
+ <input id="wp_review_shortcode_hint" type="text" value="[wp-review]" readonly="readonly">
749
+ <span><?php esc_html_e( 'Copy & paste this shortcode in the post content.', 'wp-review' ); ?></span>
750
+ </p>
751
+ </div>
752
+ </div>
753
+
754
+ <div class="wp-review-field">
755
+ <div class="wp-review-disabled wp-review-field-label">
756
+ <label for="wp_review_schema"><?php esc_html_e( 'Review Schema', 'wp-review' ); ?></label>
757
+ <?php wp_review_print_pro_text(); ?>
758
+ </div>
759
+
760
+ <div class="wp-review-field-option">
761
+ <select name="wp_review_options[default_schema_type]" id="wp_review_schema">
762
+ <?php foreach ( $schemas as $key => $arr ) : ?>
763
+ <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $default_schema ); ?> disabled><?php echo esc_html( $arr['label'] ); ?></option>
764
+ <?php endforeach; ?>
765
+ </select>
766
+ </div>
767
+ </div>
768
+
769
+ <div class="wp-review-field">
770
+ <div class="wp-review-field-label">
771
+ <label><?php esc_html_e( 'Features', 'wp-review' ); ?></label>
772
+ </div>
773
+
774
+ <div class="wp-review-field-option">
775
+ <table id="wp-review-item">
776
+ <?php if ( $has_criteria_filter ) : ?>
777
+ <?php foreach ( $default_criteria as $item ) : ?>
778
+ <?php if ( ! empty( $item ) ) : ?>
779
+ <tr>
780
+ <td style="padding:0">
781
+ <input type="text" name="wp_review_options[default_features][]" value="<?php if ( ! empty( $item ) ) echo esc_attr( $item ); // phpcs:ignore ?>" <?php echo $has_criteria_filter ? 'disabled="disabled" readonly="readonly"' : ''; ?> />
782
+ <?php if ( ! $has_criteria_filter ) : ?>
783
+ <a class="button remove-row" href="#"><?php esc_html_e( 'Delete', 'wp-review' ); ?></a>
784
+ <?php endif; ?>
785
+ </td>
786
+ </tr>
787
+ <?php endif; ?>
788
+ <?php endforeach; ?>
789
+ <?php else : ?>
790
+ <?php foreach ( $items as $item ) : ?>
791
+ <?php if ( ! empty( $item ) ) : ?>
792
+ <tr>
793
+ <td style="padding:0">
794
+ <input type="text" name="wp_review_options[default_features][]" value="<?php if ( ! empty( $item ) ) echo esc_attr( $item ); // phpcs:ignore ?>" <?php echo $has_criteria_filter ? 'disabled="disabled" readonly="readonly"' : ''; ?> />
795
+ <?php if ( ! $has_criteria_filter ) : ?>
796
+ <a class="button remove-row" href="#"><?php esc_html_e( 'Delete', 'wp-review' ); ?></a>
797
+ <?php endif; ?>
798
+ </td>
799
+ </tr>
800
+ <?php endif; ?>
801
+ <?php endforeach; ?>
802
+ <?php endif; ?>
803
+ <tr class="empty-row screen-reader-text">
804
+ <td style="padding:0">
805
+ <input class="focus-on-add" type="text" name="wp_review_options[default_features][]" />
806
+ <a class="button remove-row" href="#"><?php esc_html_e( 'Delete', 'wp-review' ); ?></a>
807
+ </td>
808
+ </tr>
809
+ </table>
810
+ <?php if ( $has_criteria_filter ) : ?>
811
+ <p class="description"><?php esc_html_e( 'Default features are set by a filter function. Remove it to change.', 'wp-review' ); ?></p>
812
+ <?php else : ?>
813
+ <a class="add-row button" data-target="#wp-review-item" href="#"><?php esc_html_e( 'Add default feature', 'wp-review' ); ?></a>
814
+ <?php endif; ?>
815
+ </div>
816
+ </div>
817
+
818
+ <div class="wp-review-field">
819
+ <div class="wp-review-field-label">
820
+ <label><?php esc_html_e( 'Links', 'wp-review' ); ?></label>
821
+ </div>
822
+
823
+ <div class="wp-review-field-option">
824
+ <table id="wp-review-link">
825
+ <?php if ( ! empty( $link_texts ) ) : ?>
826
+ <?php foreach ( $link_texts as $key => $text ) : ?>
827
+ <?php if ( ! empty( $text ) && ! empty( $link_urls[ $key ] ) ) : ?>
828
+ <tr>
829
+ <td style="padding:0">
830
+ <input type="text" name="wp_review_options[default_link_text][]" placeholder="Text" value="<?php echo esc_attr( $text ); ?>" />
831
+ <input type="text" name="wp_review_options[default_link_url][]" placeholder="URL" value="<?php echo esc_url( $link_urls[ $key ] ); ?>" />
832
+ <a class="button remove-row" href="#"><?php esc_html_e( 'Delete', 'wp-review' ); ?></a>
833
+ </td>
834
+ </tr>
835
+ <?php endif; ?>
836
+ <?php endforeach; ?>
837
+ <?php endif; ?>
838
+ <tr class="empty-row screen-reader-text">
839
+ <td style="padding:0">
840
+ <input class="focus-on-add" type="text" name="wp_review_options[default_link_text][]" placeholder="Text" />
841
+ <input type="text" name="wp_review_options[default_link_url][]" placeholder="URL" />
842
+ <a class="button remove-row" href="#"><?php esc_html_e( 'Delete', 'wp-review' ); ?></a>
843
+ </td>
844
+ </tr>
845
+ </table>
846
+ <a class="add-row button" data-target="#wp-review-link" href="#"><?php esc_html_e( 'Add default link', 'wp-review' ); ?></a>
847
+ </div>
848
+ </div>
849
+
850
+ <div class="wp-review-field">
851
+ <div class="wp-review-field-label">
852
+ <label><?php esc_html_e( 'User Ratings', 'wp-review' ); ?></label>
853
+ </div>
854
+
855
+ <div class="wp-review-field-option">
856
+ <label>
857
+ <input type="radio" name="wp_review_options[default_user_review_type]" id="wp-review-userReview-disable" value="<?php echo esc_attr( WP_REVIEW_REVIEW_DISABLED ); ?>" <?php checked( WP_REVIEW_REVIEW_DISABLED, $default_user_review_type ); ?> />
858
+ <?php esc_html_e( 'Disabled', 'wp-review' ); ?>
859
+ </label>
860
+ <br>
861
+ <label>
862
+ <input type="radio" name="wp_review_options[default_user_review_type]" id="wp-review-userReview-visitor" value="<?php echo esc_attr( WP_REVIEW_REVIEW_VISITOR_ONLY ); ?>" <?php checked( WP_REVIEW_REVIEW_VISITOR_ONLY, $default_user_review_type ); ?> />
863
+ <?php esc_html_e( 'Visitor Rating Only', 'wp-review' ); ?>
864
+ </label>
865
+ <br>
866
+ <label class="wp-review-disabled">
867
+ <input type="radio" name="wp_review_options[default_user_review_type]" id="wp-review-userReview-comment" value="<?php echo esc_attr( WP_REVIEW_REVIEW_COMMENT_ONLY ); ?>" <?php checked( WP_REVIEW_REVIEW_COMMENT_ONLY, $default_user_review_type ); ?> disabled />
868
+ <?php esc_html_e( 'Comment Rating Only', 'wp-review' ); ?>
869
+ <?php wp_review_print_pro_text( true ); ?>
870
+ </label>
871
+ <br>
872
+ <label class="wp-review-disabled">
873
+ <input type="radio" name="wp_review_options[default_user_review_type]" id="wp-review-userReview-both" value="<?php echo esc_attr( WP_REVIEW_REVIEW_ALLOW_BOTH ); ?>" <?php checked( WP_REVIEW_REVIEW_ALLOW_BOTH, $default_user_review_type ); ?> disabled />
874
+ <?php esc_html_e( 'Both', 'wp-review' ); ?>
875
+ <?php wp_review_print_pro_text( true ); ?>
876
+ </label>
877
+ </div>
878
+ </div>
879
+ </div>
880
+
881
+ <div id="review-embed" class="settings-tab-embed tab-content" style="display: none;">
882
+ <h3><?php esc_html_e( 'Embed', 'wp-review' ); ?></h3>
883
+ <p class="description"><?php esc_html_e( 'From here you can enable embed feature, which will show embed code in the frontend which site visitors can use to embed review on their site.', 'wp-review' ); ?></p>
884
+
885
+ <div class="wp-review-field">
886
+ <div class="wp-review-disabled wp-review-field-label">
887
+ <label><?php esc_html_e( 'Enable Embed', 'wp-review' ); ?></label>
888
+ <?php wp_review_print_pro_text(); ?>
889
+ </div>
890
+
891
+ <div class="wp-review-field-option">
892
+ <?php
893
+ $form_field->render_switch(
894
+ array(
895
+ 'id' => 'wp_review_enable_embed',
896
+ 'name' => 'wp_review_options[enable_embed]',
897
+ 'disabled' => true,
898
+ )
899
+ );
900
+ ?>
901
+ </div>
902
+ </div>
903
+
904
+ <div class="wp-review-field">
905
+ <div class="wp-review-disabled wp-review-field-label">
906
+ <label><?php esc_html_e( 'Show Title', 'wp-review' ); ?></label>
907
+ <?php wp_review_print_pro_text(); ?>
908
+ </div>
909
+
910
+ <div class="wp-review-field-option">
911
+ <?php
912
+ $form_field->render_switch(
913
+ array(
914
+ 'id' => 'wp_review_embed_show_title',
915
+ 'name' => 'wp_review_options[embed_show_title]',
916
+ 'disabled' => true,
917
+ )
918
+ );
919
+ ?>
920
+ </div>
921
+ </div>
922
+
923
+ <div class="wp-review-field">
924
+ <div class="wp-review-disabled wp-review-field-label">
925
+ <label><?php esc_html_e( 'Show Thumbnail', 'wp-review' ); ?></label>
926
+ <?php wp_review_print_pro_text(); ?>
927
+ </div>
928
+
929
+ <div class="wp-review-field-option">
930
+ <?php
931
+ $form_field->render_switch(
932
+ array(
933
+ 'id' => 'wp_review_embed_show_thumbnail',
934
+ 'name' => 'wp_review_options[embed_show_thumbnail]',
935
+ 'disabled' => true,
936
+ )
937
+ );
938
+ ?>
939
+ </div>
940
+ </div>
941
+
942
+ <div class="wp-review-field">
943
+ <div class="wp-review-disabled wp-review-field-label">
944
+ <label><?php esc_html_e( 'Show Excerpt', 'wp-review' ); ?></label>
945
+ <?php wp_review_print_pro_text(); ?>
946
+ </div>
947
+
948
+ <div class="wp-review-field-option">
949
+ <?php
950
+ $form_field->render_switch(
951
+ array(
952
+ 'id' => 'wp_review_embed_show_excerpt',
953
+ 'name' => 'wp_review_options[embed_show_excerpt]',
954
+ 'disabled' => true,
955
+ )
956
+ );
957
+ ?>
958
+ </div>
959
+ </div>
960
+
961
+ <div class="wp-review-field">
962
+ <div class="wp-review-disabled wp-review-field-label">
963
+ <label><?php esc_html_e( 'Show Rating Box', 'wp-review' ); ?></label>
964
+ <?php wp_review_print_pro_text(); ?>
965
+ </div>
966
+
967
+ <div class="wp-review-field-option">
968
+ <?php
969
+ $form_field->render_switch(
970
+ array(
971
+ 'id' => 'wp_review_embed_show_rating_box',
972
+ 'name' => 'wp_review_options[embed_show_rating_box]',
973
+ 'disabled' => true,
974
+ )
975
+ );
976
+ ?>
977
+ </div>
978
+ </div>
979
+
980
+ <div class="wp-review-field">
981
+ <div class="wp-review-disabled wp-review-field-label">
982
+ <label><?php esc_html_e( 'Show Credit', 'wp-review' ); ?></label>
983
+ <?php wp_review_print_pro_text(); ?>
984
+ </div>
985
+
986
+ <div class="wp-review-field-option">
987
+ <?php
988
+ $form_field->render_switch(
989
+ array(
990
+ 'id' => 'wp_review_embed_show_credit',
991
+ 'name' => 'wp_review_options[embed_show_credit]',
992
+ 'disabled' => true,
993
+ )
994
+ );
995
+ ?>
996
+ </div>
997
+ </div>
998
+ </div>
999
+
1000
+ <?php if ( $rows_left ) : ?>
1001
+ <div id="review-migrate" class="settings-tab-migrate tab-content" style="display: none;">
1002
+ <div id="settings-allow-migrate">
1003
+ <p><?php esc_html_e( 'Here you can import your existing user ratings from WP Review 1.x and WP Review Pro 1.x.', 'wp-review' ); ?></p>
1004
+ <p class="migrate-items">
1005
+ <?php
1006
+ // translators: number of rows left.
1007
+ printf( esc_html__( '%s ratings left to import.', 'wp-review' ), '<span id="migrate-items-num">' . intval( $rows_left ) . '</span>' );
1008
+ ?>
1009
+ </p>
1010
+ <a href="#" class="button button-secondary" id="start-migrate" data-start="<?php echo esc_attr( $migrated_rows ); ?>"><?php esc_html_e( 'Start import', 'wp-review' ); ?></a>
1011
+ <textarea id="wp-review-migrate-log"></textarea>
1012
+ </div>
1013
+ <p class="already-migrated-msg"><?php esc_html_e( 'Ratings have already been migrated.', 'wp-review' ); ?></p>
1014
+ </div>
1015
+ <?php endif; ?>
1016
+ </div>
admin/options/role-manager.php CHANGED
@@ -1,42 +1,42 @@
1
- <?php
2
- /**
3
- * Role Manager options
4
- *
5
- * @package WP_Review
6
- */
7
-
8
- ?>
9
-
10
- <div class="wp-review-role-manager-wrap">
11
-
12
- <?php
13
- $roles = get_editable_roles();
14
- foreach ( $roles as $slug => $role ) {
15
- $role_caps = $role['capabilities'];
16
- ?>
17
- <div class="wp-review-field">
18
- <div class="wp-review-field-label">
19
- <label><strong><?php echo esc_html( $role['name'] ); ?></strong></label>
20
- <?php wp_review_print_pro_text(); ?>
21
- </div>
22
-
23
- <div class="wp-review-field-option">
24
- <div class="wpr-flex">
25
- <?php
26
- foreach ( wp_review_get_capabilities() as $cap => $capability ) {
27
- $checked = isset( $role_caps[ $cap ] ) ? 'checked="checked"' : '';
28
- ?>
29
- <div class="pr-10 wpr-col-1-3">
30
- <span class="wp-review-disabled inline-block">
31
- <label for="wp_review_<?php echo esc_attr( $slug . '_' . $cap ); ?>">
32
- <input name="wp_review_capabilities[<?php echo esc_attr( $slug ); ?>][<?php echo esc_attr( $cap ); ?>]" id="wp_review_<?php echo esc_attr( $slug . '_' . $cap ); ?>" type="checkbox" value="<?php echo esc_attr( $cap ); ?>" <?php echo $checked; ?> disabled>
33
- <?php echo $capability; ?>
34
- </label>
35
- </span>
36
- </div>
37
- <?php } ?>
38
- </div>
39
- </div>
40
- </div>
41
- <?php } ?>
42
- </div>
1
+ <?php
2
+ /**
3
+ * Role Manager options
4
+ *
5
+ * @package WP_Review
6
+ */
7
+
8
+ ?>
9
+
10
+ <div class="wp-review-role-manager-wrap">
11
+
12
+ <?php
13
+ $roles = get_editable_roles();
14
+ foreach ( $roles as $slug => $role ) {
15
+ $role_caps = $role['capabilities'];
16
+ ?>
17
+ <div class="wp-review-field">
18
+ <div class="wp-review-disabled wp-review-field-label">
19
+ <label><strong><?php echo esc_html( $role['name'] ); ?></strong></label>
20
+ <?php wp_review_print_pro_text(); ?>
21
+ </div>
22
+
23
+ <div class="wp-review-field-option">
24
+ <div class="wpr-flex">
25
+ <?php
26
+ foreach ( wp_review_get_capabilities() as $cap => $capability ) {
27
+ $checked = isset( $role_caps[ $cap ] ) ? 'checked="checked"' : '';
28
+ ?>
29
+ <div class="pr-10 wpr-col-1-3">
30
+ <span class="wp-review-disabled inline-block">
31
+ <label for="wp_review_<?php echo esc_attr( $slug . '_' . $cap ); ?>">
32
+ <input name="wp_review_capabilities[<?php echo esc_attr( $slug ); ?>][<?php echo esc_attr( $cap ); ?>]" id="wp_review_<?php echo esc_attr( $slug . '_' . $cap ); ?>" type="checkbox" value="<?php echo esc_attr( $cap ); ?>" <?php echo $checked; ?> disabled>
33
+ <?php echo $capability; ?>
34
+ </label>
35
+ </span>
36
+ </div>
37
+ <?php } ?>
38
+ </div>
39
+ </div>
40
+ </div>
41
+ <?php } ?>
42
+ </div>
admin/options/yelp.php CHANGED
@@ -1,31 +1,31 @@
1
- <?php
2
- /**
3
- * Yelp options
4
- *
5
- * @package WP_Review
6
- */
7
-
8
- ?>
9
-
10
- <div class="wp-review-field">
11
- <div class="wp-review-field-label">
12
- <label for="wp_review_yelp_api_key"><?php esc_html_e( 'API Key', 'wp-review' ); ?></label>
13
- <?php wp_review_print_pro_text(); ?>
14
- </div>
15
-
16
- <div class="wp-review-field-option">
17
- <span class="wp-review-disabled inline-block large-text">
18
- <input name="wp_review_options[yelp_api_key]" id="wp_review_yelp_api_key" class="widefat" type="password" disabled>
19
- </span>
20
- </div>
21
-
22
- <span class="description">
23
- <?php
24
- printf(
25
- /* translators: Yelp App link. */
26
- esc_html__( '%s to get Yelp API Key.', 'wp-review' ),
27
- '<a href="https://mythemeshop.com/kb/wp-review-pro/yelp-reviews/" target="_blank">' . esc_html__( 'Click here', 'wp-review' ) . '</a>'
28
- );
29
- ?>
30
- </span>
31
- </div>
1
+ <?php
2
+ /**
3
+ * Yelp options
4
+ *
5
+ * @package WP_Review
6
+ */
7
+
8
+ ?>
9
+
10
+ <div class="wp-review-field">
11
+ <div class="wp-review-disabled wp-review-field-label">
12
+ <label for="wp_review_yelp_api_key"><?php esc_html_e( 'API Key', 'wp-review' ); ?></label>
13
+ <?php wp_review_print_pro_text(); ?>
14
+ </div>
15
+
16
+ <div class="wp-review-field-option">
17
+ <span class="wp-review-disabled inline-block large-text">
18
+ <input name="wp_review_options[yelp_api_key]" id="wp_review_yelp_api_key" class="widefat" type="password" disabled>
19
+ </span>
20
+ </div>
21
+
22
+ <span class="description">
23
+ <?php
24
+ printf(
25
+ /* translators: Yelp App link. */
26
+ esc_html__( '%s to get Yelp API Key.', 'wp-review' ),
27
+ '<a href="https://mythemeshop.com/kb/wp-review-pro/yelp-reviews/" target="_blank">' . esc_html__( 'Click here', 'wp-review' ) . '</a>'
28
+ );
29
+ ?>
30
+ </span>
31
+ </div>
admin/review-options-meta-box.php CHANGED
@@ -1,243 +1,243 @@
1
- <?php
2
- /**
3
- * Review options meta box
4
- *
5
- * @package WP_Review
6
- */
7
-
8
- /**
9
- * Render the meta box.
10
- *
11
- * @since 1.0
12
- *
13
- * @param WP_Post $post Post object.
14
- */
15
- function wp_review_render_meta_box_review_options( $post ) {
16
- global $post;
17
-
18
- /* Add an nonce field so we can check for it later. */
19
- wp_nonce_field( 'wp-review-meta-box-options', 'wp-review-review-options-nonce' );
20
-
21
- /* Retrieve an existing value from the database. */
22
- $type_post_value = get_post_meta( $post->ID, 'wp_review_type', true );
23
- if ( '' === $type_post_value ) {
24
- // Default value when create post.
25
- $type_post_value = wp_review_option( 'review_type', 'none' );
26
- }
27
- $type = $type_post_value;
28
-
29
- $heading = get_post_meta( $post->ID, 'wp_review_heading', true );
30
- // $available_types = apply_filters('wp_review_metabox_types', wp_review_get_review_types() );
31
- $available_types = wp_review_get_rating_types();
32
- $schemas = wp_review_schema_types();
33
-
34
- $rating_schema = wp_review_get_rating_schema( $post->ID );
35
- $custom_author = get_post_meta( $post->ID, 'wp_review_custom_author', true );
36
- $author = get_post_meta( $post->ID, 'wp_review_author', true );
37
-
38
- $form_field = new WP_Review_Form_Field();
39
- ?>
40
-
41
- <div class="js-tabs wpr-tabs">
42
- <div class="nav-tab-wrapper tab-titles">
43
- <a href="#review-box" class="nav-tab tab-title nav-tab-active"><?php esc_html_e( 'Review Box', 'wp-review' ); ?></a>
44
- <?php if ( ! wp_review_network_option( 'hide_popup_box_' ) && current_user_can( 'wp_review_popup' ) ) { ?>
45
- <a href="#popup" class="nav-tab tab-title"><?php esc_html_e( 'Popup', 'wp-review' ); ?></a>
46
- <?php } ?>
47
- <?php if ( ! wp_review_network_option( 'hide_notification_bar_' ) && current_user_can( 'wp_review_notification_bar' ) ) { ?>
48
- <a href="#hello-bar" class="nav-tab tab-title"><?php esc_html_e( 'Notification Bar', 'wp-review' ); ?></a>
49
- <?php } ?>
50
- </div>
51
-
52
- <div id="review-box" class="tab-content">
53
- <div class="wp-review-field">
54
- <div class="wp-review-field-label">
55
- <label for="wp_review_type"><?php esc_html_e( 'Review Type', 'wp-review' ); ?></label>
56
- </div>
57
-
58
- <div class="wp-review-field-option">
59
- <select id="wp_review_type">
60
- <option value="none" <?php selected( $type, 'none' ); ?>><?php esc_html_e( 'No review', 'wp-review' ); ?></option>
61
- <?php
62
- foreach ( $available_types as $key => $available_type ) {
63
- $disabled = 'circle' === $key || 'thumbs' === $key;
64
- printf(
65
- '<option value="%1$s" data-max="%2$s" data-decimals="%3$s" class="%4$s" %5$s>%6$s</option>',
66
- esc_attr( $key ),
67
- intval( $available_type['max'] ),
68
- intval( $available_type['decimals'] ),
69
- $disabled ? 'disabled' : '',
70
- selected( $type, $key, false ),
71
- esc_html( $available_type['label'] )
72
- );
73
- }
74
- ?>
75
- </select>
76
- <input type="hidden" name="wp_review_type" value="<?php echo esc_attr( $type_post_value ); ?>">
77
-
78
- <span id="wp_review_id_hint">
79
- <?php
80
- // translators: review ID.
81
- printf( esc_html__( 'Review ID: %s', 'wp-review' ), '<strong>' . intval( $post->ID ) . '</strong>' );
82
- ?>
83
- </span>
84
- </div>
85
- </div>
86
-
87
- <div class="wp-review-field" id="wp_review_heading_group">
88
- <div class="wp-review-field-label">
89
- <label for="wp_review_heading"><?php esc_html_e( 'Review Heading', 'wp-review' ); ?></label>
90
- </div>
91
-
92
- <div class="wp-review-field-option">
93
- <input type="text" name="wp_review_heading" id="wp_review_heading" class="large-text" value="<?php echo esc_attr( $heading ); ?>" />
94
- </div>
95
- </div>
96
-
97
- <div id="wp_review_schema_options_wrapper">
98
-
99
- <div class="wp-review-field" id="wp_review_schema_group">
100
- <div class="wp-review-field-label">
101
- <label for="wp_review_schema"><?php esc_html_e( 'Reviewed Item Schema', 'wp-review' ); ?></label>
102
- <?php wp_review_print_pro_text(); ?>
103
- </div>
104
-
105
- <div class="wp-review-field-option">
106
- <select name="wp_review_schema" id="wp_review_schema">
107
- <?php foreach ( $schemas as $key => $arr ) : ?>
108
- <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, 'Thing' ); ?> disabled><?php echo esc_html( $arr['label'] ); ?></option>
109
- <?php endforeach; ?>
110
- </select>
111
- </div>
112
- </div>
113
-
114
- <div id="wp_review_schema_type_options_wrap">
115
- <div class="wp-review-field" id="wp_review_schema_rating_group">
116
- <div class="wp-review-field-label">
117
- <label for="wp_review_rating_schema"><?php esc_html_e( 'Rating Schema', 'wp-review' ); ?></label>
118
- </div>
119
- <div class="wp-review-field-option">
120
- <select name="wp_review_rating_schema" id="wp_review_rating_schema">
121
- <option value="author" <?php selected( 'author', $rating_schema ); ?>><?php esc_html_e( 'Author Review Rating', 'wp-review' ); ?></option>
122
- <option value="visitors" <?php selected( 'visitors', $rating_schema ); ?>><?php esc_html_e( 'Visitors Aggregate Rating (if enabled)', 'wp-review' ); ?></option>
123
- <option value="comments" class="disabled"><?php esc_html_e( 'Comments Reviews Aggregate Rating (if enabled)', 'wp-review' ); ?></option>
124
- </select>
125
- </div>
126
- </div>
127
- <div id="wp_review_schema_author_wrapper"<?php if ( 'author' !== $rating_schema ) echo ' style="display: none;"'; // phpcs:ignore ?>>
128
- <div class="wp-review-field">
129
- <div class="wp-review-field-label">
130
- <label><?php esc_html_e( 'Custom Author', 'wp-review' ); ?></label>
131
- </div>
132
- <div class="wp-review-field-option">
133
- <?php
134
- $form_field->render_switch(
135
- array(
136
- 'id' => 'wp_review_custom_author',
137
- 'name' => 'wp_review_custom_author',
138
- 'value' => $custom_author,
139
- )
140
- );
141
- ?>
142
- </div>
143
- </div>
144
-
145
- <div class="wp-review-author-options"<?php if ( empty( $custom_author ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
146
- <div class="wp-review-field">
147
- <div class="wp-review-field-label">
148
- <label for="wp_review_author"><?php esc_html_e( 'Review Author', 'wp-review' ); ?></label>
149
- </div>
150
- <div class="wp-review-field-option">
151
- <input type="text" name="wp_review_author" id="wp_review_author" value="<?php echo esc_attr( $author ); ?>">
152
- </div>
153
- </div>
154
- </div>
155
- </div>
156
- </div>
157
- </div><!-- End #wp_review_schema_options_wrapper -->
158
-
159
- <div class="wp-review-field" id="wp_review_show_schema_data_wrapper">
160
- <div class="wp-review-field-label">
161
- <label><?php esc_html_e( 'Display Schema Data in the Box (if available)', 'wp-review' ); ?></label>
162
- <?php wp_review_print_pro_text(); ?>
163
- </div>
164
-
165
- <div class="wp-review-field-option">
166
- <?php
167
- $form_field->render_switch(
168
- array(
169
- 'id' => 'wp_review_show_schema_data',
170
- 'name' => 'wp_review_show_schema_data',
171
- 'disabled' => true,
172
- )
173
- );
174
- ?>
175
- </div>
176
- </div>
177
-
178
- <div id="wp_review_embed_options_wrapper">
179
- <div class="wp-review-field">
180
- <div class="wp-review-field-label">
181
- <label><?php esc_html_e( 'Show Embed Code', 'wp-review' ); ?></label>
182
- <?php wp_review_print_pro_text(); ?>
183
- </div>
184
-
185
- <div class="wp-review-field-option">
186
- <?php
187
- $form_field->render_switch(
188
- array(
189
- 'id' => 'wp_review_enable_embed',
190
- 'name' => 'wp_review_enable_embed',
191
- 'disabled' => true,
192
- )
193
- );
194
- ?>
195
- </div>
196
- </div>
197
- </div>
198
- </div><!-- End #review-box -->
199
-
200
- <?php if ( ! wp_review_network_option( 'hide_popup_box_' ) && current_user_can( 'wp_review_popup' ) ) { ?>
201
- <div id="popup" class="tab-content wp-review-popup" style="display: none;">
202
- <div class="wp-review-field">
203
- <div class="wp-review-field-label">
204
- <label for="wp_review_popup_enable"><?php esc_html_e( 'Enable', 'wp-review' ); ?></label>
205
- <?php wp_review_print_pro_text(); ?>
206
- </div>
207
-
208
- <div class="wp-review-field-option">
209
- <span class="wp-review-disabled inline-block has-bg">
210
- <select name="wp_review_popup[enable]" id="wp_review_popup_enable" disabled>
211
- <option value="default"><?php esc_html_e( 'Use global options', 'wp-review' ); ?></option>
212
- <option value="custom"><?php esc_html_e( 'Use custom options', 'wp-review' ); ?></option>
213
- <option value="none"><?php esc_html_e( 'None', 'wp-review' ); ?></option>
214
- </select>
215
- </span>
216
- </div>
217
- </div>
218
- </div><!-- End #popup -->
219
- <?php } ?>
220
-
221
- <?php if ( ! wp_review_network_option( 'hide_notification_bar_' ) && current_user_can( 'wp_review_notification_bar' ) ) { ?>
222
- <div id="hello-bar" class="tab-content wp-review-hello-bar" style="display: none;">
223
- <div class="wp-review-field">
224
- <div class="wp-review-field-label">
225
- <label for="wp_review_hello_bar_enable"><?php esc_html_e( 'Enable', 'wp-review' ); ?></label>
226
- <?php wp_review_print_pro_text(); ?>
227
- </div>
228
-
229
- <div class="wp-review-field-option">
230
- <span class="wp-review-disabled inline-block has-bg">
231
- <select name="wp_review_hello_bar[enable]" id="wp_review_hello_bar_enable" disabled>
232
- <option value="default"><?php esc_html_e( 'Use global options', 'wp-review' ); ?></option>
233
- <option value="custom"><?php esc_html_e( 'Use custom options', 'wp-review' ); ?></option>
234
- <option value="none"><?php esc_html_e( 'None', 'wp-review' ); ?></option>
235
- </select>
236
- </span>
237
- </div>
238
- </div>
239
- </div><!-- End #hello-bar -->
240
- <?php } ?>
241
- </div>
242
- <?php
243
- }
1
+ <?php
2
+ /**
3
+ * Review options meta box
4
+ *
5
+ * @package WP_Review
6
+ */
7
+
8
+ /**
9
+ * Render the meta box.
10
+ *
11
+ * @since 1.0
12
+ *
13
+ * @param WP_Post $post Post object.
14
+ */
15
+ function wp_review_render_meta_box_review_options( $post ) {
16
+ global $post;
17
+
18
+ /* Add an nonce field so we can check for it later. */
19
+ wp_nonce_field( 'wp-review-meta-box-options', 'wp-review-review-options-nonce' );
20
+
21
+ /* Retrieve an existing value from the database. */
22
+ $type_post_value = get_post_meta( $post->ID, 'wp_review_type', true );
23
+ if ( '' === $type_post_value ) {
24
+ // Default value when create post.
25
+ $type_post_value = wp_review_option( 'review_type', 'none' );
26
+ }
27
+ $type = $type_post_value;
28
+
29
+ $heading = get_post_meta( $post->ID, 'wp_review_heading', true );
30
+ // $available_types = apply_filters('wp_review_metabox_types', wp_review_get_review_types() );
31
+ $available_types = wp_review_get_rating_types();
32
+ $schemas = wp_review_schema_types();
33
+
34
+ $rating_schema = wp_review_get_rating_schema( $post->ID );
35
+ $custom_author = get_post_meta( $post->ID, 'wp_review_custom_author', true );
36
+ $author = get_post_meta( $post->ID, 'wp_review_author', true );
37
+
38
+ $form_field = new WP_Review_Form_Field();
39
+ ?>
40
+
41
+ <div class="js-tabs wpr-tabs">
42
+ <div class="nav-tab-wrapper tab-titles">
43
+ <a href="#review-box" class="nav-tab tab-title nav-tab-active"><?php esc_html_e( 'Review Box', 'wp-review' ); ?></a>
44
+ <?php if ( ! wp_review_network_option( 'hide_popup_box_' ) && current_user_can( 'wp_review_popup' ) ) { ?>
45
+ <a href="#popup" class="nav-tab tab-title"><?php esc_html_e( 'Popup', 'wp-review' ); ?></a>
46
+ <?php } ?>
47
+ <?php if ( ! wp_review_network_option( 'hide_notification_bar_' ) && current_user_can( 'wp_review_notification_bar' ) ) { ?>
48
+ <a href="#hello-bar" class="nav-tab tab-title"><?php esc_html_e( 'Notification Bar', 'wp-review' ); ?></a>
49
+ <?php } ?>
50
+ </div>
51
+
52
+ <div id="review-box" class="tab-content">
53
+ <div class="wp-review-field">
54
+ <div class="wp-review-field-label">
55
+ <label for="wp_review_type"><?php esc_html_e( 'Review Type', 'wp-review' ); ?></label>
56
+ </div>
57
+
58
+ <div class="wp-review-field-option">
59
+ <select id="wp_review_type">
60
+ <option value="none" <?php selected( $type, 'none' ); ?>><?php esc_html_e( 'No review', 'wp-review' ); ?></option>
61
+ <?php
62
+ foreach ( $available_types as $key => $available_type ) {
63
+ $disabled = 'circle' === $key || 'thumbs' === $key;
64
+ printf(
65
+ '<option value="%1$s" data-max="%2$s" data-decimals="%3$s" class="%4$s" %5$s>%6$s</option>',
66
+ esc_attr( $key ),
67
+ intval( $available_type['max'] ),
68
+ intval( $available_type['decimals'] ),
69
+ $disabled ? 'disabled' : '',
70
+ selected( $type, $key, false ),
71
+ esc_html( $available_type['label'] )
72
+ );
73
+ }
74
+ ?>
75
+ </select>
76
+ <input type="hidden" name="wp_review_type" value="<?php echo esc_attr( $type_post_value ); ?>">
77
+
78
+ <span id="wp_review_id_hint">
79
+ <?php
80
+ // translators: review ID.
81
+ printf( esc_html__( 'Review ID: %s', 'wp-review' ), '<strong>' . intval( $post->ID ) . '</strong>' );
82
+ ?>
83
+ </span>
84
+ </div>
85
+ </div>
86
+
87
+ <div class="wp-review-field" id="wp_review_heading_group">
88
+ <div class="wp-review-field-label">
89
+ <label for="wp_review_heading"><?php esc_html_e( 'Review Heading', 'wp-review' ); ?></label>
90
+ </div>
91
+
92
+ <div class="wp-review-field-option">
93
+ <input type="text" name="wp_review_heading" id="wp_review_heading" class="large-text" value="<?php echo esc_attr( $heading ); ?>" />
94
+ </div>
95
+ </div>
96
+
97
+ <div id="wp_review_schema_options_wrapper">
98
+
99
+ <div class="wp-review-field" id="wp_review_schema_group">
100
+ <div class="wp-review-disabled wp-review-field-label">
101
+ <label for="wp_review_schema"><?php esc_html_e( 'Reviewed Item Schema', 'wp-review' ); ?></label>
102
+ <?php wp_review_print_pro_text(); ?>
103
+ </div>
104
+
105
+ <div class="wp-review-field-option">
106
+ <select name="wp_review_schema" id="wp_review_schema">
107
+ <?php foreach ( $schemas as $key => $arr ) : ?>
108
+ <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, 'Thing' ); ?> disabled><?php echo esc_html( $arr['label'] ); ?></option>
109
+ <?php endforeach; ?>
110
+ </select>
111
+ </div>
112
+ </div>
113
+
114
+ <div id="wp_review_schema_type_options_wrap">
115
+ <div class="wp-review-field" id="wp_review_schema_rating_group">
116
+ <div class="wp-review-field-label">
117
+ <label for="wp_review_rating_schema"><?php esc_html_e( 'Rating Schema', 'wp-review' ); ?></label>
118
+ </div>
119
+ <div class="wp-review-field-option">
120
+ <select name="wp_review_rating_schema" id="wp_review_rating_schema">
121
+ <option value="author" <?php selected( 'author', $rating_schema ); ?>><?php esc_html_e( 'Author Review Rating', 'wp-review' ); ?></option>
122
+ <option value="visitors" <?php selected( 'visitors', $rating_schema ); ?>><?php esc_html_e( 'Visitors Aggregate Rating (if enabled)', 'wp-review' ); ?></option>
123
+ <option value="comments" class="disabled"><?php esc_html_e( 'Comments Reviews Aggregate Rating (if enabled)', 'wp-review' ); ?></option>
124
+ </select>
125
+ </div>
126
+ </div>
127
+ <div id="wp_review_schema_author_wrapper"<?php if ( 'author' !== $rating_schema ) echo ' style="display: none;"'; // phpcs:ignore ?>>
128
+ <div class="wp-review-field">
129
+ <div class="wp-review-field-label">
130
+ <label><?php esc_html_e( 'Custom Author', 'wp-review' ); ?></label>
131
+ </div>
132
+ <div class="wp-review-field-option">
133
+ <?php
134
+ $form_field->render_switch(
135
+ array(
136
+ 'id' => 'wp_review_custom_author',
137
+ 'name' => 'wp_review_custom_author',
138
+ 'value' => $custom_author,
139
+ )
140
+ );
141
+ ?>
142
+ </div>
143
+ </div>
144
+
145
+ <div class="wp-review-author-options"<?php if ( empty( $custom_author ) ) echo ' style="display: none;"'; // phpcs:ignore ?>>
146
+ <div class="wp-review-field">
147
+ <div class="wp-review-field-label">
148
+ <label for="wp_review_author"><?php esc_html_e( 'Review Author', 'wp-review' ); ?></label>
149
+ </div>
150
+ <div class="wp-review-field-option">
151
+ <input type="text" name="wp_review_author" id="wp_review_author" value="<?php echo esc_attr( $author ); ?>">
152
+ </div>
153
+ </div>
154
+ </div>
155
+ </div>
156
+ </div>
157
+ </div><!-- End #wp_review_schema_options_wrapper -->
158
+
159
+ <div class="wp-review-field" id="wp_review_show_schema_data_wrapper">
160
+ <div class="wp-review-disabled wp-review-field-label">
161
+ <label><?php esc_html_e( 'Display Schema Data in the Box (if available)', 'wp-review' ); ?></label>
162
+ <?php wp_review_print_pro_text(); ?>
163
+ </div>
164
+
165
+ <div class="wp-review-field-option">
166
+ <?php
167
+ $form_field->render_switch(
168
+ array(
169
+ 'id' => 'wp_review_show_schema_data',
170
+ 'name' => 'wp_review_show_schema_data',
171
+ 'disabled' => true,
172
+ )
173
+ );
174
+ ?>
175
+ </div>
176
+ </div>
177
+
178
+ <div id="wp_review_embed_options_wrapper">
179
+ <div class="wp-review-field">
180
+ <div class="wp-review-disabled wp-review-field-label">
181
+ <label><?php esc_html_e( 'Show Embed Code', 'wp-review' ); ?></label>
182
+ <?php wp_review_print_pro_text(); ?>
183
+ </div>
184
+
185
+ <div class="wp-review-field-option">
186
+ <?php
187
+ $form_field->render_switch(
188
+ array(
189
+ 'id' => 'wp_review_enable_embed',
190
+ 'name' => 'wp_review_enable_embed',
191
+ 'disabled' => true,
192
+ )
193
+ );
194
+ ?>
195
+ </div>
196
+ </div>
197
+ </div>
198
+ </div><!-- End #review-box -->
199
+
200
+ <?php if ( ! wp_review_network_option( 'hide_popup_box_' ) && current_user_can( 'wp_review_popup' ) ) { ?>
201
+ <div id="popup" class="tab-content wp-review-popup" style="display: none;">
202
+ <div class="wp-review-field">
203
+ <div class="wp-review-field-label">
204
+ <label for="wp_review_popup_enable"><?php esc_html_e( 'Enable', 'wp-review' ); ?></label>
205
+ <?php wp_review_print_pro_text(); ?>
206
+ </div>
207
+
208
+ <div class="wp-review-field-option">
209
+ <span class="wp-review-disabled inline-block has-bg">
210
+ <select name="wp_review_popup[enable]" id="wp_review_popup_enable" disabled>
211
+ <option value="default"><?php esc_html_e( 'Use global options', 'wp-review' ); ?></option>
212
+ <option value="custom"><?php esc_html_e( 'Use custom options', 'wp-review' ); ?></option>
213
+ <option value="none"><?php esc_html_e( 'None', 'wp-review' ); ?></option>
214
+ </select>
215
+ </span>
216
+ </div>
217
+ </div>
218
+ </div><!-- End #popup -->
219
+ <?php } ?>
220
+
221
+ <?php if ( ! wp_review_network_option( 'hide_notification_bar_' ) && current_user_can( 'wp_review_notification_bar' ) ) { ?>
222
+ <div id="hello-bar" class="tab-content wp-review-hello-bar" style="display: none;">
223
+ <div class="wp-review-field">
224
+ <div class="wp-review-field-label">
225
+ <label for="wp_review_hello_bar_enable"><?php esc_html_e( 'Enable', 'wp-review' ); ?></label>
226
+ <?php wp_review_print_pro_text(); ?>
227
+ </div>
228
+
229
+ <div class="wp-review-field-option">
230
+ <span class="wp-review-disabled inline-block has-bg">
231
+ <select name="wp_review_hello_bar[enable]" id="wp_review_hello_bar_enable" disabled>
232
+ <option value="default"><?php esc_html_e( 'Use global options', 'wp-review' ); ?></option>
233
+ <option value="custom"><?php esc_html_e( 'Use custom options', 'wp-review' ); ?></option>
234
+ <option value="none"><?php esc_html_e( 'None', 'wp-review' ); ?></option>
235
+ </select>
236
+ </span>
237
+ </div>
238
+ </div>
239
+ </div><!-- End #hello-bar -->
240
+ <?php } ?>
241
+ </div>
242
+ <?php
243
+ }
box-templates/aqua.php CHANGED
@@ -1,471 +1,471 @@
1
- <?php
2
- /**
3
- * WP Review: Aqua
4
- * Description: Aqua Review Box template for WP Review
5
- * Version: 1.0.0
6
- * Author: MyThemesShop
7
- * Author URI: http://mythemeshop.com/
8
- *
9
- * @package WP_Review
10
- * @since 3.0.0
11
- * @copyright Copyright (c) 2017, MyThemesShop
12
- * @author MyThemesShop
13
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
14
- */
15
-
16
- /*
17
- * Available items in $review array:
18
- *
19
- * 'post_id',
20
- 'type',
21
- 'heading',
22
- 'author',
23
- 'items',
24
- 'hide_desc',
25
- 'desc',
26
- 'desc_title',
27
- 'pros',
28
- 'cons',
29
- 'total',
30
- 'colors',
31
- 'width',
32
- 'align',
33
- 'schema',
34
- 'schema_data',
35
- 'show_schema_data',
36
- 'rating_schema',
37
- 'links',
38
- 'user_review',
39
- 'user_review_type',
40
- 'user_review_total',
41
- 'user_review_count',
42
- 'user_has_reviewed',
43
- 'comments_review'
44
- *
45
- */
46
-
47
- // Exit if accessed directly.
48
- if ( ! defined( 'ABSPATH' ) ) {
49
- exit;
50
- }
51
-
52
- $rating_types = wp_review_get_rating_types();
53
-
54
- $classes = implode( ' ', $review['css_classes'] );
55
-
56
- ?>
57
-
58
- <link href="https://fonts.googleapis.com/css?family=Comfortaa:400,700" rel="stylesheet">
59
- <style type="text/css">
60
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper { font-family: 'Comfortaa', cursive; }
61
- </style>
62
-
63
- <div id="review" class="<?php echo esc_attr( $classes ); ?>">
64
- <?php if ( empty( $review['heading'] ) ) : ?>
65
- <?php echo esc_html( apply_filters( 'wp_review_item_title_fallback', '' ) ); ?>
66
- <?php else : ?>
67
- <div class="review-heading">
68
- <h5 class="review-title">
69
- <?php echo esc_html( $review['heading'] ); ?>
70
-
71
- <?php if ( ! empty( $review['product_price'] ) ) : ?>
72
- <span class="review-price"><?php echo esc_html( $review['product_price'] ); ?></span>
73
- <?php endif; ?>
74
- </h5>
75
- </div>
76
- <?php endif; ?>
77
-
78
- <?php wp_review_load_template( 'global/partials/review-schema.php', compact( 'review' ) ); ?>
79
-
80
- <?php if ( ! empty( $review['total'] && ! $review['hide_desc'] ) ) :
81
- $total_text = $review['total'];
82
- if ( 'star' != $review['type'] ) {
83
- $total_text = sprintf( $rating_types[ $review['type'] ]['value_text'], $total_text );
84
- }
85
- ?>
86
- <div class="review-total-wrapper">
87
- <span class="review-total-box">
88
- <h5><?php esc_html_e( 'Overall', 'wp-review' ); ?></h5>
89
- <div><?php echo $total_text; ?></div>
90
- </span>
91
- <?php
92
- echo wp_review_rating( $review['total'], $review['post_id'], array(
93
- 'review_total' => true,
94
- 'class' => 'review-total',
95
- ) );
96
- ?>
97
- </div>
98
- <?php endif; ?>
99
-
100
- <?php if ( $review['items'] && is_array( $review['items'] ) ) : ?>
101
- <ul class="review-list">
102
- <?php foreach ( $review['items'] as $item ) :
103
- $item = wp_parse_args( $item, array(
104
- 'wp_review_item_star' => '',
105
- 'wp_review_item_title' => '',
106
- 'wp_review_item_color' => '',
107
- 'wp_review_item_inactive_color' => '',
108
- ) );
109
- $value_text = '';
110
- if ( 'star' != $review['type'] ) {
111
- $value_text = ' - <span>' . sprintf( $rating_types[ $review['type'] ]['value_text'], $item['wp_review_item_star'] ) . '</span>';
112
- }
113
- ?>
114
- <li>
115
- <span><?php echo wp_kses_post( $item['wp_review_item_title'] ); ?><?php echo $value_text; ?></span>
116
- <?php
117
- echo wp_review_rating(
118
- $item['wp_review_item_star'],
119
- $review['post_id'],
120
- array(
121
- 'color' => $item['wp_review_item_color'],
122
- 'inactive_color' => $item['wp_review_item_inactive_color'],
123
- )
124
- );
125
- ?>
126
- </li>
127
- <?php endforeach; ?>
128
- </ul>
129
- <?php endif; ?>
130
-
131
- <?php if ( $review['user_review'] ) : ?>
132
- <div class="user-review-area visitors-review-area">
133
- <?php echo wp_review_user_rating( $review['post_id'] ); ?>
134
- <div class="user-total-wrapper">
135
- <h5 class="user-review-title"><?php esc_html_e( 'User Review', 'wp-review' ); ?></h5>
136
- <span class="review-total-box">
137
- <?php
138
- $usertotal_text = $review['user_review_total'];
139
- if ( 'star' != $review['user_review_type'] ) {
140
- $usertotal_text = sprintf( $rating_types[ $review['user_review_type'] ]['value_text'], $review['user_review_total'] );
141
- }
142
- ?>
143
- <span class="wp-review-user-rating-total"><?php echo esc_html( $usertotal_text ); ?></span>
144
- <small>(<span class="wp-review-user-rating-counter"><?php echo esc_html( $review['user_review_count'] ); ?></span> <?php echo esc_html( _n( 'vote', 'votes', $review['user_review_count'], 'wp-review' ) ); ?>)</small>
145
- </span>
146
- </div>
147
- </div>
148
- <?php endif; // $review['user_review'] ?>
149
-
150
- <?php if ( ! $review['hide_desc'] ) : ?>
151
-
152
- <?php if ( $review['desc'] ) : ?>
153
- <div class="review-desc">
154
- <p class="review-summary-title"><strong><?php echo $review['desc_title']; ?></strong></p>
155
- <?php // echo do_shortcode( shortcode_unautop( wp_kses_post( wpautop( $review['desc'] ) ) ) ); ?>
156
- <?php echo apply_filters( 'wp_review_desc', $review['desc'], $review['post_id'] ); ?>
157
- </div>
158
- <?php endif; ?>
159
-
160
- <?php endif; ?>
161
-
162
- <?php wp_review_load_template( 'global/partials/review-links.php', compact( 'review' ) ); ?>
163
- </div>
164
-
165
- <?php
166
- if ( ! function_exists( 'color_luminance' ) ) {
167
- /**
168
- * Lightens/darkens a given colour (hex format), returning the altered colour in hex format.
169
- *
170
- * @param string $hex Colour as hexadecimal (with or without hash).
171
- * @param float $percent Decimal ( 0.2 = lighten by 20%(), -0.4 = darken by 40%() ).
172
- * @return string Lightened/Darkend colour as hexadecimal (with hash);
173
- */
174
- function color_luminance( $hex, $percent ) {
175
- // Validate hex string.
176
- $hex = preg_replace( '/[^0-9a-f]/i', '', $hex );
177
- $new_hex = '#';
178
-
179
- if ( strlen( $hex ) < 6 ) {
180
- $hex = $hex[0] + $hex[0] + $hex[1] + $hex[1] + $hex[2] + $hex[2];
181
- }
182
-
183
- // Convert to decimal and change luminosity.
184
- for ( $i = 0; $i < 3; $i++ ) {
185
- $dec = hexdec( substr( $hex, $i * 2, 2 ) );
186
- $dec = min( max( 0, $dec + $dec * $percent ), 255 );
187
- $new_hex .= str_pad( dechex( $dec ), 2, 0, STR_PAD_LEFT );
188
- }
189
-
190
- return $new_hex;
191
- }
192
- }
193
- $colors = $review['colors'];
194
- $dark_color = color_luminance( $colors['color'], '-0.2' );
195
-
196
- ob_start();
197
- // phpcs:disable
198
- ?>
199
- <style type="text/css">
200
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper {
201
- width: <?php echo $review['width']; ?>%;
202
- float: <?php echo $review['align']; ?>;
203
- border: 1px solid <?php echo $colors['bordercolor']; ?>;
204
- }
205
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-desc {
206
- padding: 25px 30px 25px 30px;
207
- line-height: 26px;
208
- clear: both;
209
- border-bottom: 1px solid;
210
- }
211
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper,
212
- .wp-review-<?php echo $review['post_id']; ?> .review-title,
213
- .wp-review-<?php echo $review['post_id']; ?> .review-desc p,
214
- .wp-review-<?php echo $review['post_id']; ?> .reviewed-item p {
215
- color: <?php echo $colors['fontcolor']; ?>;
216
- }
217
- .wp-review-<?php echo $review['post_id']; ?> .review-links a {
218
- background: <?php echo $colors['color']; ?>;
219
- padding: 9px 20px 6px 20px;
220
- box-shadow: 0 2px <?php echo $dark_color; ?>, inset 0 1px rgba(255,255,255,0.2);
221
- border: none;
222
- color: #fff;
223
- border: 1px solid <?php echo $dark_color; ?>;
224
- cursor: pointer;
225
- }
226
- .wp-review-<?php echo $review['post_id']; ?> .review-list li,
227
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper {
228
- background: <?php echo $colors['bgcolor2']; ?>;
229
- }
230
- .wp-review-<?php echo $review['post_id']; ?> .review-list li {
231
- padding: 30px 30px 20px 30px;
232
- width: 50%;
233
- float: left;
234
- border-right: 1px solid <?php echo $colors['bordercolor']; ?>;
235
- box-sizing: border-box;
236
- }
237
- .wp-review-<?php echo $review['post_id']; ?>.wp-review-star-type .wpr-user-features-rating .review-list {
238
- width: 100%;
239
- }
240
- .wp-review-<?php echo $review['post_id']; ?>.wp-review-point-type .review-list li,
241
- .wp-review-<?php echo $review['post_id']; ?>.wp-review-percentage-type .review-list li {
242
- width: 100%;
243
- padding: 15px 30px;
244
- }
245
- .wp-review-<?php echo $review['post_id']; ?>.wp-review-point-type .review-list li > span,
246
- .wp-review-<?php echo $review['post_id']; ?>.wp-review-percentage-type .review-list li > span {
247
- display: inline-block;
248
- position: absolute;
249
- z-index: 1;
250
- top: 23px;
251
- left: 45px;
252
- font-size: 14px;
253
- line-height: 1;
254
- color: <?php echo $colors['bgcolor2']; ?>;
255
- -webkit-touch-callout: none;
256
- -webkit-user-select: none;
257
- -khtml-user-select: none;
258
- -moz-user-select: none;
259
- -ms-user-select: none;
260
- user-select: none;
261
- }
262
- .wp-review-<?php echo $review['post_id']; ?>.wp-review-point-type .wpr-user-features-rating .review-list li > span,
263
- .wp-review-<?php echo $review['post_id']; ?>.wp-review-percentage-type .wpr-user-features-rating .review-list li > span {
264
- color: inherit;
265
- }
266
- .wp-review-<?php echo $review['post_id']; ?>.wp-review-point-type .wpr-user-features-rating .review-list li .wp-review-input-set + span,
267
- .wp-review-<?php echo $review['post_id']; ?>.wp-review-percentage-type .wpr-user-features-rating .review-list li .wp-review-input-set + span,
268
- .wp-review-<?php echo $review['post_id']; ?>.wp-review-point-type .wpr-user-features-rating .review-list li .wp-review-user-rating:hover + span,
269
- .wp-review-<?php echo $review['post_id']; ?>.wp-review-percentage-type .wpr-user-features-rating .review-list li .wp-review-user-rating:hover + span {
270
- color: #fff;
271
- }
272
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper.wp-review-star-type .review-list li:nth-child(2n+1) { clear: left; border-right: 1px solid <?php echo $colors['bordercolor']; ?>; }
273
- .wp-review-<?php echo $review['post_id']; ?> .review-links {
274
- padding: 30px 30px 20px 30px;
275
- }
276
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper.wp-review-point-type .review-result,
277
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper.wp-review-percentage-type .review-result,
278
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-point .review-result-wrapper,
279
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-percentage .review-result-wrapper {
280
- height: 28px;
281
- }
282
- .wp-review-comment-<?php echo $review['post_id']; ?> .wp-review-comment-rating .review-point .review-result-wrapper .review-result,
283
- .wp-review-comment-<?php echo $review['post_id']; ?> .wp-review-comment-rating .review-percentage .review-result-wrapper .review-result {
284
- height: 22px;
285
- }
286
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-result-wrapper i {
287
- font-size: 18px;
288
- }
289
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .mb-5 {
290
- text-transform: uppercase;
291
- }
292
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .wpr-user-features-rating {
293
- margin-top: -1px;
294
- clear: both;
295
- float: left;
296
- width: 100%;
297
- }
298
- .wp-review-<?php echo $review['post_id']; ?> .user-review-area {
299
- padding: 18px 30px;
300
- border-top: 1px solid;
301
- margin-top: -1px;
302
- float: left;
303
- width: 100%;
304
- }
305
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-title {
306
- letter-spacing: 1px;
307
- font-weight: 700;
308
- padding: 15px 30px;
309
- text-transform: none;
310
- background: <?php echo $colors['bgcolor1']; ?>;
311
- color: #fff;
312
- }
313
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-total-wrapper {
314
- width: 40%;
315
- margin: 0;
316
- padding: 42px 0;
317
- color: #fff;
318
- text-align: center;
319
- }
320
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-list {
321
- clear: none;
322
- width: 60%;
323
- }
324
- <?php if( $review['hide_desc'] ) { ?>
325
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-list {
326
- width: 100%;
327
- }
328
- <?php } ?>
329
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-list .review-star,
330
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-list .wp-review-user-feature-rating-star {
331
- float: left;
332
- display: block;
333
- margin: 10px 0 0 0;
334
- }
335
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-list .wp-review-user-feature-rating-star + span { clear: left; display: block; }
336
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-list .wp-review-user-rating.wp-review-user-feature-rating-star,
337
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-list .wp-review-user-rating.wp-review-user-feature-rating-star .review-star {
338
- margin: 0;
339
- }
340
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-list .wp-review-user-rating.wp-review-user-feature-rating-star .review-result-wrapper {
341
- margin-left: -5px;
342
- margin-bottom: 6px;
343
- }
344
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-list .wp-review-user-feature-rating-star .review-result { letter-spacing: -2.2px; }
345
- .wp-review-<?php echo $review['post_id']; ?> .review-total-wrapper .review-point.review-total,
346
- .wp-review-<?php echo $review['post_id']; ?> .review-total-wrapper .review-percentage.review-total {
347
- width: 70%;
348
- display: inline-block;
349
- margin: 20px auto 0 auto;
350
- }
351
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-total-wrapper span.review-total-box {
352
- float: left;
353
- text-align: center;
354
- padding: 0;
355
- color: <?php echo $colors['fontcolor']; ?>;
356
- line-height: 1.5;
357
- }
358
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-total-wrapper span.review-total-box h5 {
359
- margin-top: 6px;
360
- color: inherit;
361
- }
362
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper.wp-review-point-type .review-total-wrapper span.review-total-box,
363
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper.wp-review-percentage-type .review-total-wrapper span.review-total-box,
364
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .wpr-user-features-rating .review-list {
365
- width: 100%;
366
- }
367
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .wpr-user-features-rating .review-list li {
368
- border-right: 0;
369
- }
370
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-star.review-total {
371
- color: #fff;
372
- margin-top: 10px;
373
- }
374
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .user-review-title {
375
- color: inherit;
376
- padding: 18px 30px 16px;
377
- margin: 0;
378
- border-bottom: 1px solid;
379
- border-top: 1px solid;
380
- }
381
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .user-total-wrapper .user-review-title {
382
- display: inline-block;
383
- color: inherit;
384
- text-transform: uppercase;
385
- letter-spacing: 1px;
386
- padding: 0;
387
- border: 0;
388
- margin-top: 3px;
389
- }
390
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .reviewed-item {
391
- padding: 30px;
392
- }
393
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .user-review-area .review-percentage,
394
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .user-review-area .review-point {
395
- width: 20%;
396
- float: right;
397
- margin-top: -2px;
398
- }
399
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper,
400
- .wp-review-<?php echo $review['post_id']; ?> .review-title,
401
- .wp-review-<?php echo $review['post_id']; ?> .review-list li,
402
- .wp-review-<?php echo $review['post_id']; ?> .review-list li:last-child,
403
- .wp-review-<?php echo $review['post_id']; ?> .user-review-area,
404
- .wp-review-<?php echo $review['post_id']; ?> .reviewed-item,
405
- .wp-review-<?php echo $review['post_id']; ?> .review-links,
406
- .wp-review-<?php echo $review['post_id']; ?> .wpr-user-features-rating,
407
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .user-review-title,
408
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-total-wrapper,
409
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-desc {
410
- border-color: <?php echo $colors['bordercolor']; ?>;
411
- }
412
- .wp-review-<?php echo $review['post_id']; ?> .wpr-rating-accept-btn {
413
- background: <?php echo $colors['color']; ?>;
414
- margin: 10px 30px;
415
- width: -moz-calc(100% - 60px);
416
- width: -webkit-calc(100% - 60px);
417
- width: -o-calc(100% - 60px);
418
- width: calc(100% - 60px);
419
- border-radius: 3px;
420
- }
421
- @media screen and (max-width:570px) {
422
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-list {
423
- width: 100%;
424
- }
425
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-total-wrapper {
426
- width: 100%;
427
- border-bottom: 1px solid <?php echo $colors['bordercolor']; ?>;
428
- border-left: 0;
429
- padding: 15px 0;
430
- }
431
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper.wp-review-star-type .review-list li:nth-child(2n+1) { clear: none; border-right: 0; }
432
- }
433
- @media screen and (max-width:480px) {
434
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-title,
435
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .reviewed-item,
436
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-desc,
437
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .user-review-area { padding: 15px; }
438
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-list li,
439
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .user-review-title { padding: 12px 15px; border-right: 0; }
440
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .ui-tabs-nav { padding: 0 15px; }
441
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-links { padding: 15px 15px 5px; }
442
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .user-total-wrapper { max-width: 60%; font-size: 14px; }
443
- .wp-review-<?php echo $review['post_id']; ?>.wp-review-point-type .review-list li > span,
444
- .wp-review-<?php echo $review['post_id']; ?>.wp-review-percentage-type .review-list li > span {
445
- top: 12px;
446
- left: 30px;
447
- }
448
- }
449
- </style>
450
- <?php
451
- $color_output = ob_get_clean();
452
-
453
- // Apply legacy filter.
454
- $color_output = apply_filters( 'wp_review_color_output', $color_output, $review['post_id'], $colors );
455
-
456
- /**
457
- * Filters style output of aqua template.
458
- *
459
- * @since 3.0.0
460
- *
461
- * @param string $style Style output (include <style> tag).
462
- * @param int $post_id Current post ID.
463
- * @param array $colors Color data.
464
- */
465
- $color_output = apply_filters( 'wp_review_box_template_aqua_style', $color_output, $review['post_id'], $colors );
466
-
467
- echo $color_output;
468
-
469
- // Schema json-dl.
470
- echo wp_review_get_schema( $review );
471
- // phpcs:enable
1
+ <?php
2
+ /**
3
+ * WP Review: Aqua
4
+ * Description: Aqua Review Box template for WP Review
5
+ * Version: 1.0.0
6
+ * Author: MyThemesShop
7
+ * Author URI: http://mythemeshop.com/
8
+ *
9
+ * @package WP_Review
10
+ * @since 3.0.0
11
+ * @copyright Copyright (c) 2017, MyThemesShop
12
+ * @author MyThemesShop
13
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
14
+ */
15
+
16
+ /*
17
+ * Available items in $review array:
18
+ *
19
+ * 'post_id',
20
+ 'type',
21
+ 'heading',
22
+ 'author',
23
+ 'items',
24
+ 'hide_desc',
25
+ 'desc',
26
+ 'desc_title',
27
+ 'pros',
28
+ 'cons',
29
+ 'total',
30
+ 'colors',
31
+ 'width',
32
+ 'align',
33
+ 'schema',
34
+ 'schema_data',
35
+ 'show_schema_data',
36
+ 'rating_schema',
37
+ 'links',
38
+ 'user_review',
39
+ 'user_review_type',
40
+ 'user_review_total',
41
+ 'user_review_count',
42
+ 'user_has_reviewed',
43
+ 'comments_review'
44
+ *
45
+ */
46
+
47
+ // Exit if accessed directly.
48
+ if ( ! defined( 'ABSPATH' ) ) {
49
+ exit;
50
+ }
51
+
52
+ $rating_types = wp_review_get_rating_types();
53
+
54
+ $classes = implode( ' ', $review['css_classes'] );
55
+
56
+ ?>
57
+
58
+ <link href="https://fonts.googleapis.com/css?family=Comfortaa:400,700" rel="stylesheet">
59
+ <style type="text/css">
60
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper { font-family: 'Comfortaa', cursive; }
61
+ </style>
62
+
63
+ <div id="review" class="<?php echo esc_attr( $classes ); ?>">
64
+ <?php if ( empty( $review['heading'] ) ) : ?>
65
+ <?php echo esc_html( apply_filters( 'wp_review_item_title_fallback', '' ) ); ?>
66
+ <?php else : ?>
67
+ <div class="review-heading">
68
+ <h5 class="review-title">
69
+ <?php echo esc_html( $review['heading'] ); ?>
70
+
71
+ <?php if ( ! empty( $review['product_price'] ) ) : ?>
72
+ <span class="review-price"><?php echo esc_html( $review['product_price'] ); ?></span>
73
+ <?php endif; ?>
74
+ </h5>
75
+ </div>
76
+ <?php endif; ?>
77
+
78
+ <?php wp_review_load_template( 'global/partials/review-schema.php', compact( 'review' ) ); ?>
79
+
80
+ <?php if ( ! empty( $review['total'] && ! $review['hide_desc'] ) ) :
81
+ $total_text = $review['total'];
82
+ if ( 'star' != $review['type'] ) {
83
+ $total_text = sprintf( $rating_types[ $review['type'] ]['value_text'], $total_text );
84
+ }
85
+ ?>
86
+ <div class="review-total-wrapper">
87
+ <span class="review-total-box">
88
+ <h5><?php esc_html_e( 'Overall', 'wp-review' ); ?></h5>
89
+ <div><?php echo $total_text; ?></div>
90
+ </span>
91
+ <?php
92
+ echo wp_review_rating( $review['total'], $review['post_id'], array(
93
+ 'review_total' => true,
94
+ 'class' => 'review-total',
95
+ ) );
96
+ ?>
97
+ </div>
98
+ <?php endif; ?>
99
+
100
+ <?php if ( $review['items'] && is_array( $review['items'] ) ) : ?>
101
+ <ul class="review-list">
102
+ <?php foreach ( $review['items'] as $item ) :
103
+ $item = wp_parse_args( $item, array(
104
+ 'wp_review_item_star' => '',
105
+ 'wp_review_item_title' => '',
106
+ 'wp_review_item_color' => '',
107
+ 'wp_review_item_inactive_color' => '',
108
+ ) );
109
+ $value_text = '';
110
+ if ( 'star' != $review['type'] ) {
111
+ $value_text = ' - <span>' . sprintf( $rating_types[ $review['type'] ]['value_text'], $item['wp_review_item_star'] ) . '</span>';
112
+ }
113
+ ?>
114
+ <li>
115
+ <span><?php echo wp_kses_post( $item['wp_review_item_title'] ); ?><?php echo $value_text; ?></span>
116
+ <?php
117
+ echo wp_review_rating(
118
+ $item['wp_review_item_star'],
119
+ $review['post_id'],
120
+ array(
121
+ 'color' => $item['wp_review_item_color'],
122
+ 'inactive_color' => $item['wp_review_item_inactive_color'],
123
+ )
124
+ );
125
+ ?>
126
+ </li>
127
+ <?php endforeach; ?>
128
+ </ul>
129
+ <?php endif; ?>
130
+
131
+ <?php if ( $review['user_review'] ) : ?>
132
+ <div class="user-review-area visitors-review-area">
133
+ <?php echo wp_review_user_rating( $review['post_id'] ); ?>
134
+ <div class="user-total-wrapper">
135
+ <h5 class="user-review-title"><?php esc_html_e( 'User Review', 'wp-review' ); ?></h5>
136
+ <span class="review-total-box">
137
+ <?php
138
+ $usertotal_text = $review['user_review_total'];
139
+ if ( 'star' != $review['user_review_type'] ) {
140
+ $usertotal_text = sprintf( $rating_types[ $review['user_review_type'] ]['value_text'], $review['user_review_total'] );
141
+ }
142
+ ?>
143
+ <span class="wp-review-user-rating-total"><?php echo esc_html( $usertotal_text ); ?></span>
144
+ <small>(<span class="wp-review-user-rating-counter"><?php echo esc_html( $review['user_review_count'] ); ?></span> <?php echo esc_html( _n( 'vote', 'votes', $review['user_review_count'], 'wp-review' ) ); ?>)</small>
145
+ </span>
146
+ </div>
147
+ </div>
148
+ <?php endif; // $review['user_review'] ?>
149
+
150
+ <?php if ( ! $review['hide_desc'] ) : ?>
151
+
152
+ <?php if ( $review['desc'] ) : ?>
153
+ <div class="review-desc">
154
+ <p class="review-summary-title"><strong><?php echo $review['desc_title']; ?></strong></p>
155
+ <?php // echo do_shortcode( shortcode_unautop( wp_kses_post( wpautop( $review['desc'] ) ) ) ); ?>
156
+ <?php echo apply_filters( 'wp_review_desc', $review['desc'], $review['post_id'] ); ?>
157
+ </div>
158
+ <?php endif; ?>
159
+
160
+ <?php endif; ?>
161
+
162
+ <?php wp_review_load_template( 'global/partials/review-links.php', compact( 'review' ) ); ?>
163
+ </div>
164
+
165
+ <?php
166
+ if ( ! function_exists( 'color_luminance' ) ) {
167
+ /**
168
+ * Lightens/darkens a given colour (hex format), returning the altered colour in hex format.
169
+ *
170
+ * @param string $hex Colour as hexadecimal (with or without hash).
171
+ * @param float $percent Decimal ( 0.2 = lighten by 20%(), -0.4 = darken by 40%() ).
172
+ * @return string Lightened/Darkend colour as hexadecimal (with hash);
173
+ */
174
+ function color_luminance( $hex, $percent ) {
175
+ // Validate hex string.
176
+ $hex = preg_replace( '/[^0-9a-f]/i', '', $hex );
177
+ $new_hex = '#';
178
+
179
+ if ( strlen( $hex ) < 6 ) {
180
+ $hex = $hex[0] + $hex[0] + $hex[1] + $hex[1] + $hex[2] + $hex[2];
181
+ }
182
+
183
+ // Convert to decimal and change luminosity.
184
+ for ( $i = 0; $i < 3; $i++ ) {
185
+ $dec = hexdec( substr( $hex, $i * 2, 2 ) );
186
+ $dec = min( max( 0, $dec + $dec * $percent ), 255 );
187
+ $new_hex .= str_pad( dechex( $dec ), 2, 0, STR_PAD_LEFT );
188
+ }
189
+
190
+ return $new_hex;
191
+ }
192
+ }
193
+ $colors = $review['colors'];
194
+ $dark_color = color_luminance( $colors['color'], '-0.2' );
195
+
196
+ ob_start();
197
+ // phpcs:disable
198
+ ?>
199
+ <style type="text/css">
200
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper {
201
+ width: <?php echo $review['width']; ?>%;
202
+ float: <?php echo $review['align']; ?>;
203
+ border: 1px solid <?php echo $colors['bordercolor']; ?>;
204
+ }
205
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-desc {
206
+ padding: 25px 30px 25px 30px;
207
+ line-height: 26px;
208
+ clear: both;
209
+ border-bottom: 1px solid;
210
+ }
211
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper,
212
+ .wp-review-<?php echo $review['post_id']; ?> .review-title,
213
+ .wp-review-<?php echo $review['post_id']; ?> .review-desc p,
214
+ .wp-review-<?php echo $review['post_id']; ?> .reviewed-item p {
215
+ color: <?php echo $colors['fontcolor']; ?>;
216
+ }
217
+ .wp-review-<?php echo $review['post_id']; ?> .review-links a {
218
+ background: <?php echo $colors['color']; ?>;
219
+ padding: 9px 20px 6px 20px;
220
+ box-shadow: 0 2px <?php echo $dark_color; ?>, inset 0 1px rgba(255,255,255,0.2);
221
+ border: none;
222
+ color: #fff;
223
+ border: 1px solid <?php echo $dark_color; ?>;
224
+ cursor: pointer;
225
+ }
226
+ .wp-review-<?php echo $review['post_id']; ?> .review-list li,
227
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper {
228
+ background: <?php echo $colors['bgcolor2']; ?>;
229
+ }
230
+ .wp-review-<?php echo $review['post_id']; ?> .review-list li {
231
+ padding: 30px 30px 20px 30px;
232
+ width: 50%;
233
+ float: left;
234
+ border-right: 1px solid <?php echo $colors['bordercolor']; ?>;
235
+ box-sizing: border-box;
236
+ }
237
+ .wp-review-<?php echo $review['post_id']; ?>.wp-review-star-type .wpr-user-features-rating .review-list {
238
+ width: 100%;
239
+ }
240
+ .wp-review-<?php echo $review['post_id']; ?>.wp-review-point-type .review-list li,
241
+ .wp-review-<?php echo $review['post_id']; ?>.wp-review-percentage-type .review-list li {
242
+ width: 100%;
243
+ padding: 15px 30px;
244
+ }
245
+ .wp-review-<?php echo $review['post_id']; ?>.wp-review-point-type .review-list li > span,
246
+ .wp-review-<?php echo $review['post_id']; ?>.wp-review-percentage-type .review-list li > span {
247
+ display: inline-block;
248
+ position: absolute;
249
+ z-index: 1;
250
+ top: 23px;
251
+ left: 45px;
252
+ font-size: 14px;
253
+ line-height: 1;
254
+ color: <?php echo $colors['bgcolor2']; ?>;
255
+ -webkit-touch-callout: none;
256
+ -webkit-user-select: none;
257
+ -khtml-user-select: none;
258
+ -moz-user-select: none;
259
+ -ms-user-select: none;
260
+ user-select: none;
261
+ }
262
+ .wp-review-<?php echo $review['post_id']; ?>.wp-review-point-type .wpr-user-features-rating .review-list li > span,
263
+ .wp-review-<?php echo $review['post_id']; ?>.wp-review-percentage-type .wpr-user-features-rating .review-list li > span {
264
+ color: inherit;
265
+ }
266
+ .wp-review-<?php echo $review['post_id']; ?>.wp-review-point-type .wpr-user-features-rating .review-list li .wp-review-input-set + span,
267
+ .wp-review-<?php echo $review['post_id']; ?>.wp-review-percentage-type .wpr-user-features-rating .review-list li .wp-review-input-set + span,
268
+ .wp-review-<?php echo $review['post_id']; ?>.wp-review-point-type .wpr-user-features-rating .review-list li .wp-review-user-rating:hover + span,
269
+ .wp-review-<?php echo $review['post_id']; ?>.wp-review-percentage-type .wpr-user-features-rating .review-list li .wp-review-user-rating:hover + span {
270
+ color: #fff;
271
+ }
272
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper.wp-review-star-type .review-list li:nth-child(2n+1) { clear: left; border-right: 1px solid <?php echo $colors['bordercolor']; ?>; }
273
+ .wp-review-<?php echo $review['post_id']; ?> .review-links {
274
+ padding: 30px 30px 20px 30px;
275
+ }
276
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper.wp-review-point-type .review-result,
277
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper.wp-review-percentage-type .review-result,
278
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-point .review-result-wrapper,
279
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-percentage .review-result-wrapper {
280
+ height: 28px;
281
+ }
282
+ .wp-review-comment-<?php echo $review['post_id']; ?> .wp-review-comment-rating .review-point .review-result-wrapper .review-result,
283
+ .wp-review-comment-<?php echo $review['post_id']; ?> .wp-review-comment-rating .review-percentage .review-result-wrapper .review-result {
284
+ height: 22px;
285
+ }
286
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-result-wrapper i {
287
+ font-size: 18px;
288
+ }
289
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .mb-5 {
290
+ text-transform: uppercase;
291
+ }
292
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .wpr-user-features-rating {
293
+ margin-top: -1px;
294
+ clear: both;
295
+ float: left;
296
+ width: 100%;
297
+ }
298
+ .wp-review-<?php echo $review['post_id']; ?> .user-review-area {
299
+ padding: 18px 30px;
300
+ border-top: 1px solid;
301
+ margin-top: -1px;
302
+ float: left;
303
+ width: 100%;
304
+ }
305
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-title {
306
+ letter-spacing: 1px;
307
+ font-weight: 700;
308
+ padding: 15px 30px;
309
+ text-transform: none;
310
+ background: <?php echo $colors['bgcolor1']; ?>;
311
+ color: #fff;
312
+ }
313
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-total-wrapper {
314
+ width: 40%;
315
+ margin: 0;
316
+ padding: 42px 0;
317
+ color: #fff;
318
+ text-align: center;
319
+ }
320
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-list {
321
+ clear: none;
322
+ width: 60%;
323
+ }
324
+ <?php if( $review['hide_desc'] ) { ?>
325
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-list {
326
+ width: 100%;
327
+ }
328
+ <?php } ?>
329
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-list .review-star,
330
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-list .wp-review-user-feature-rating-star {
331
+ float: left;
332
+ display: block;
333
+ margin: 10px 0 0 0;
334
+ }
335
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-list .wp-review-user-feature-rating-star + span { clear: left; display: block; }
336
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-list .wp-review-user-rating.wp-review-user-feature-rating-star,
337
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-list .wp-review-user-rating.wp-review-user-feature-rating-star .review-star {
338
+ margin: 0;
339
+ }
340
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-list .wp-review-user-rating.wp-review-user-feature-rating-star .review-result-wrapper {
341
+ margin-left: -5px;
342
+ margin-bottom: 6px;
343
+ }
344
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-list .wp-review-user-feature-rating-star .review-result { letter-spacing: -2.2px; }
345
+ .wp-review-<?php echo $review['post_id']; ?> .review-total-wrapper .review-point.review-total,
346
+ .wp-review-<?php echo $review['post_id']; ?> .review-total-wrapper .review-percentage.review-total {
347
+ width: 70%;
348
+ display: inline-block;
349
+ margin: 20px auto 0 auto;
350
+ }
351
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-total-wrapper span.review-total-box {
352
+ float: left;
353
+ text-align: center;
354
+ padding: 0;
355
+ color: <?php echo $colors['fontcolor']; ?>;
356
+ line-height: 1.5;
357
+ }
358
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-total-wrapper span.review-total-box h5 {
359
+ margin-top: 6px;
360
+ color: inherit;
361
+ }
362
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper.wp-review-point-type .review-total-wrapper span.review-total-box,
363
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper.wp-review-percentage-type .review-total-wrapper span.review-total-box,
364
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .wpr-user-features-rating .review-list {
365
+ width: 100%;
366
+ }
367
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .wpr-user-features-rating .review-list li {
368
+ border-right: 0;
369
+ }
370
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-star.review-total {
371
+ color: #fff;
372
+ margin-top: 10px;
373
+ }
374
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .user-review-title {
375
+ color: inherit;
376
+ padding: 18px 30px 16px;
377
+ margin: 0;
378
+ border-bottom: 1px solid;
379
+ border-top: 1px solid;
380
+ }
381
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .user-total-wrapper .user-review-title {
382
+ display: inline-block;
383
+ color: inherit;
384
+ text-transform: uppercase;
385
+ letter-spacing: 1px;
386
+ padding: 0;
387
+ border: 0;
388
+ margin-top: 3px;
389
+ }
390
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .reviewed-item {
391
+ padding: 30px;
392
+ }
393
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .user-review-area .review-percentage,
394
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .user-review-area .review-point {
395
+ width: 20%;
396
+ float: right;
397
+ margin-top: -2px;
398
+ }
399
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper,
400
+ .wp-review-<?php echo $review['post_id']; ?> .review-title,
401
+ .wp-review-<?php echo $review['post_id']; ?> .review-list li,
402
+ .wp-review-<?php echo $review['post_id']; ?> .review-list li:last-child,
403
+ .wp-review-<?php echo $review['post_id']; ?> .user-review-area,
404
+ .wp-review-<?php echo $review['post_id']; ?> .reviewed-item,
405
+ .wp-review-<?php echo $review['post_id']; ?> .review-links,
406
+ .wp-review-<?php echo $review['post_id']; ?> .wpr-user-features-rating,
407
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .user-review-title,
408
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-total-wrapper,
409
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-desc {
410
+ border-color: <?php echo $colors['bordercolor']; ?>;
411
+ }
412
+ .wp-review-<?php echo $review['post_id']; ?> .wpr-rating-accept-btn {
413
+ background: <?php echo $colors['color']; ?>;
414
+ margin: 10px 30px;
415
+ width: -moz-calc(100% - 60px);
416
+ width: -webkit-calc(100% - 60px);
417
+ width: -o-calc(100% - 60px);
418
+ width: calc(100% - 60px);
419
+ border-radius: 3px;
420
+ }
421
+ @media screen and (max-width:570px) {
422
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-list {
423
+ width: 100%;
424
+ }
425
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-total-wrapper {
426
+ width: 100%;
427
+ border-bottom: 1px solid <?php echo $colors['bordercolor']; ?>;
428
+ border-left: 0;
429
+ padding: 15px 0;
430
+ }
431
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper.wp-review-star-type .review-list li:nth-child(2n+1) { clear: none; border-right: 0; }
432
+ }
433
+ @media screen and (max-width:480px) {
434
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-title,
435
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .reviewed-item,
436
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-desc,
437
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .user-review-area { padding: 15px; }
438
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-list li,
439
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .user-review-title { padding: 12px 15px; border-right: 0; }
440
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .ui-tabs-nav { padding: 0 15px; }
441
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .review-links { padding: 15px 15px 5px; }
442
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .user-total-wrapper { max-width: 60%; font-size: 14px; }
443
+ .wp-review-<?php echo $review['post_id']; ?>.wp-review-point-type .review-list li > span,
444
+ .wp-review-<?php echo $review['post_id']; ?>.wp-review-percentage-type .review-list li > span {
445
+ top: 12px;
446
+ left: 30px;
447
+ }
448
+ }
449
+ </style>
450
+ <?php
451
+ $color_output = ob_get_clean();
452
+
453
+ // Apply legacy filter.
454
+ $color_output = apply_filters( 'wp_review_color_output', $color_output, $review['post_id'], $colors );
455
+
456
+ /**
457
+ * Filters style output of aqua template.
458
+ *
459
+ * @since 3.0.0
460
+ *
461
+ * @param string $style Style output (include <style> tag).
462
+ * @param int $post_id Current post ID.
463
+ * @param array $colors Color data.
464
+ */
465
+ $color_output = apply_filters( 'wp_review_box_template_aqua_style', $color_output, $review['post_id'], $colors );
466
+
467
+ echo $color_output;
468
+
469
+ // Schema json-dl.
470
+ echo wp_review_get_schema( $review );
471
+ // phpcs:enable
box-templates/default.php CHANGED
@@ -1,234 +1,234 @@
1
- <?php
2
- /**
3
- * WP Review: Default
4
- * Description: Default Review Box template for WP Review
5
- * Version: 1.0.2
6
- * Author: MyThemesShop
7
- * Author URI: http://mythemeshop.com/
8
- *
9
- * @package WP_Review
10
- * @since 2.0
11
- * @copyright Copyright (c) 2017, MyThemesShop
12
- * @author MyThemesShop
13
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
14
- */
15
-
16
- /*
17
- * Available items in $review array:
18
- *
19
- * 'post_id',
20
- 'type',
21
- 'heading',
22
- 'author',
23
- 'items',
24
- 'hide_desc',
25
- 'desc',
26
- 'desc_title',
27
- 'pros',
28
- 'cons',
29
- 'total',
30
- 'colors',
31
- 'width',
32
- 'align',
33
- 'schema',
34
- 'schema_data',
35
- 'show_schema_data',
36
- 'rating_schema',
37
- 'links',
38
- 'user_review',
39
- 'user_review_type',
40
- 'user_review_total',
41
- 'user_review_count',
42
- 'user_has_reviewed',
43
- 'comments_review'
44
- *
45
- */
46
-
47
- // Exit if accessed directly.
48
- if ( ! defined( 'ABSPATH' ) ) {
49
- exit;
50
- }
51
-
52
- $rating_types = wp_review_get_rating_types();
53
-
54
- $classes = implode( ' ', $review['css_classes'] );
55
-
56
- if ( ! empty( $review['fontfamily'] ) ) : ?>
57
- <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700" rel="stylesheet">
58
- <style type="text/css">
59
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper { font-family: 'Open Sans', sans-serif; }
60
- </style>
61
- <?php endif; ?>
62
-
63
- <div id="review" class="<?php echo esc_attr( $classes ); ?>">
64
- <?php if ( empty( $review['heading'] ) ) : ?>
65
- <?php echo esc_html( apply_filters( 'wp_review_item_title_fallback', '' ) ); ?>
66
- <?php else : ?>
67
- <div class="review-heading">
68
- <h5 class="review-title">
69
- <?php echo esc_html( $review['heading'] ); ?>
70
-
71
- <?php if ( ! empty( $review['product_price'] ) ) : ?>
72
- <span class="review-price"><?php echo esc_html( $review['product_price'] ); ?></span>
73
- <?php endif; ?>
74
- </h5>
75
- </div>
76
- <?php endif; ?>
77
-
78
- <?php wp_review_load_template( 'global/partials/review-schema.php', compact( 'review' ) ); ?>
79
-
80
- <?php if ( $review['items'] && is_array( $review['items'] ) ) : ?>
81
- <ul class="review-list">
82
- <?php foreach ( $review['items'] as $item ) :
83
- $item = wp_parse_args( $item, array(
84
- 'wp_review_item_star' => '',
85
- 'wp_review_item_title' => '',
86
- 'wp_review_item_color' => '',
87
- 'wp_review_item_inactive_color' => '',
88
- ) );
89
- $value_text = '';
90
- if ( 'star' != $review['type'] ) {
91
- $value_text = ' - <span>' . sprintf( $rating_types[ $review['type'] ]['value_text'], $item['wp_review_item_star'] ) . '</span>';
92
- }
93
- ?>
94
- <li>
95
- <?php
96
- echo wp_review_rating(
97
- $item['wp_review_item_star'],
98
- $review['post_id'],
99
- array(
100
- 'color' => $item['wp_review_item_color'],
101
- 'inactive_color' => $item['wp_review_item_inactive_color'],
102
- )
103
- );
104
- ?>
105
- <span><?php echo wp_kses_post( $item['wp_review_item_title'] ); ?><?php echo $value_text; ?></span>
106
- </li>
107
- <?php endforeach; ?>
108
- </ul>
109
- <?php endif; ?>
110
-
111
- <?php if ( ! $review['hide_desc'] ) : ?>
112
- <?php if ( ! empty( $review['total'] ) ) :
113
- $total_text = $review['total'];
114
- if ( 'star' != $review['type'] ) {
115
- $total_text = sprintf( $rating_types[ $review['type'] ]['value_text'], $total_text );
116
- }
117
- ?>
118
- <div class="review-total-wrapper">
119
- <span class="review-total-box"><?php echo $total_text; ?></span>
120
- <?php if ( 'point' != $review['type'] && 'percentage' != $review['type'] ) :
121
- echo wp_review_rating( $review['total'], $review['post_id'], array(
122
- 'review_total' => true,
123
- 'class' => 'review-total',
124
- ) );
125
- endif; ?>
126
- </div>
127
- <?php endif; ?>
128
-
129
- <?php if ( $review['desc'] ) : ?>
130
- <div class="review-desc">
131
- <p class="review-summary-title"><strong><?php echo $review['desc_title']; ?></strong></p>
132
- <?php // echo do_shortcode( shortcode_unautop( wp_kses_post( wpautop( $review['desc'] ) ) ) ); ?>
133
- <?php echo apply_filters( 'wp_review_desc', $review['desc'], $review['post_id'] ); ?>
134
- </div>
135
- <?php endif; ?>
136
- <?php endif; ?>
137
-
138
- <?php if ( $review['user_review'] ) : ?>
139
- <div class="user-review-area visitors-review-area">
140
- <?php echo wp_review_user_rating( $review['post_id'] ); ?>
141
- <div class="user-total-wrapper">
142
- <h5 class="user-review-title"><?php esc_html_e( 'User Review', 'wp-review' ); ?></h5>
143
- <span class="review-total-box">
144
- <?php
145
- $usertotal_text = $review['user_review_total'];
146
- if ( 'star' != $review['user_review_type'] ) {
147
- $usertotal_text = sprintf( $rating_types[ $review['user_review_type'] ]['value_text'], $review['user_review_total'] );
148
- }
149
- ?>
150
- <span class="wp-review-user-rating-total"><?php echo esc_html( $usertotal_text ); ?></span>
151
- <small>(<span class="wp-review-user-rating-counter"><?php echo esc_html( $review['user_review_count'] ); ?></span> <?php echo esc_html( _n( 'vote', 'votes', $review['user_review_count'], 'wp-review' ) ); ?>)</small>
152
- </span>
153
- </div>
154
- </div>
155
- <?php endif; // $review['user_review'] ?>
156
-
157
- <?php wp_review_load_template( 'global/partials/review-links.php', compact( 'review' ) ); ?>
158
- </div>
159
-
160
- <?php
161
- $colors = $review['colors'];
162
- ob_start();
163
- // phpcs:disable
164
- ?>
165
- <style type="text/css">
166
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper {
167
- width: <?php echo $review['width']; ?>%;
168
- float: <?php echo $review['align']; ?>;
169
- }
170
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper,
171
- .wp-review-<?php echo $review['post_id']; ?> .review-title,
172
- .wp-review-<?php echo $review['post_id']; ?> .review-desc p,
173
- .wp-review-<?php echo $review['post_id']; ?> .reviewed-item p {
174
- color: <?php echo $colors['fontcolor']; ?>;
175
- }
176
- .wp-review-<?php echo $review['post_id']; ?> .review-title {
177
- padding-top: 15px;
178
- font-weight: bold;
179
- }
180
- .wp-review-<?php echo $review['post_id']; ?> .review-links a {
181
- color: <?php echo $colors['color'] ?>;
182
- }
183
- .wp-review-<?php echo $review['post_id']; ?> .review-links a:hover {
184
- background: <?php echo $colors['color']; ?>;
185
- color: #fff;
186
- }
187
- .wp-review-<?php echo $review['post_id']; ?> .review-list li,
188
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper {
189
- background: <?php echo $colors['bgcolor2'] ?>;
190
- }
191
- .wp-review-<?php echo $review['post_id']; ?> .review-title,
192
- .wp-review-<?php echo $review['post_id']; ?> .review-list li:nth-child(2n),
193
- .wp-review-<?php echo $review['post_id']; ?> .wpr-user-features-rating .user-review-title {
194
- background: <?php echo $colors['bgcolor1']; ?>;
195
- }
196
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper,
197
- .wp-review-<?php echo $review['post_id']; ?> .review-title,
198
- .wp-review-<?php echo $review['post_id']; ?> .review-list li,
199
- .wp-review-<?php echo $review['post_id']; ?> .review-list li:last-child,
200
- .wp-review-<?php echo $review['post_id']; ?> .user-review-area,
201
- .wp-review-<?php echo $review['post_id']; ?> .reviewed-item,
202
- .wp-review-<?php echo $review['post_id']; ?> .review-links,
203
- .wp-review-<?php echo $review['post_id']; ?> .wpr-user-features-rating {
204
- border-color: <?php echo $colors['bordercolor']; ?>;
205
- }
206
- .wp-review-<?php echo $review['post_id']; ?> .wpr-rating-accept-btn {
207
- background: <?php echo $colors['color']; ?>;
208
- }
209
- .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .user-review-title {
210
- color: inherit;
211
- }
212
- </style>
213
- <?php
214
- $color_output = ob_get_clean();
215
-
216
- // Apply legacy filter.
217
- $color_output = apply_filters( 'wp_review_color_output', $color_output, $review['post_id'], $colors );
218
-
219
- /**
220
- * Filters style output of default template.
221
- *
222
- * @since 3.0.0
223
- *
224
- * @param string $style Style output (include <style> tag).
225
- * @param int $post_id Current post ID.
226
- * @param array $colors Color data.
227
- */
228
- $color_output = apply_filters( 'wp_review_box_template_default_style', $color_output, $review['post_id'], $colors );
229
-
230
- echo $color_output;
231
-
232
- // Schema json-dl.
233
- echo wp_review_get_schema( $review );
234
- // phpcs:enable
1
+ <?php
2
+ /**
3
+ * WP Review: Default
4
+ * Description: Default Review Box template for WP Review
5
+ * Version: 1.0.2
6
+ * Author: MyThemesShop
7
+ * Author URI: http://mythemeshop.com/
8
+ *
9
+ * @package WP_Review
10
+ * @since 2.0
11
+ * @copyright Copyright (c) 2017, MyThemesShop
12
+ * @author MyThemesShop
13
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
14
+ */
15
+
16
+ /*
17
+ * Available items in $review array:
18
+ *
19
+ * 'post_id',
20
+ 'type',
21
+ 'heading',
22
+ 'author',
23
+ 'items',
24
+ 'hide_desc',
25
+ 'desc',
26
+ 'desc_title',
27
+ 'pros',
28
+ 'cons',
29
+ 'total',
30
+ 'colors',
31
+ 'width',
32
+ 'align',
33
+ 'schema',
34
+ 'schema_data',
35
+ 'show_schema_data',
36
+ 'rating_schema',
37
+ 'links',
38
+ 'user_review',
39
+ 'user_review_type',
40
+ 'user_review_total',
41
+ 'user_review_count',
42
+ 'user_has_reviewed',
43
+ 'comments_review'
44
+ *
45
+ */
46
+
47
+ // Exit if accessed directly.
48
+ if ( ! defined( 'ABSPATH' ) ) {
49
+ exit;
50
+ }
51
+
52
+ $rating_types = wp_review_get_rating_types();
53
+
54
+ $classes = implode( ' ', $review['css_classes'] );
55
+
56
+ if ( ! empty( $review['fontfamily'] ) ) : ?>
57
+ <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700" rel="stylesheet">
58
+ <style type="text/css">
59
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper { font-family: 'Open Sans', sans-serif; }
60
+ </style>
61
+ <?php endif; ?>
62
+
63
+ <div id="review" class="<?php echo esc_attr( $classes ); ?>">
64
+ <?php if ( empty( $review['heading'] ) ) : ?>
65
+ <?php echo esc_html( apply_filters( 'wp_review_item_title_fallback', '' ) ); ?>
66
+ <?php else : ?>
67
+ <div class="review-heading">
68
+ <h5 class="review-title">
69
+ <?php echo esc_html( $review['heading'] ); ?>
70
+
71
+ <?php if ( ! empty( $review['product_price'] ) ) : ?>
72
+ <span class="review-price"><?php echo esc_html( $review['product_price'] ); ?></span>
73
+ <?php endif; ?>
74
+ </h5>
75
+ </div>
76
+ <?php endif; ?>
77
+
78
+ <?php wp_review_load_template( 'global/partials/review-schema.php', compact( 'review' ) ); ?>
79
+
80
+ <?php if ( $review['items'] && is_array( $review['items'] ) ) : ?>
81
+ <ul class="review-list">
82
+ <?php foreach ( $review['items'] as $item ) :
83
+ $item = wp_parse_args( $item, array(
84
+ 'wp_review_item_star' => '',
85
+ 'wp_review_item_title' => '',
86
+ 'wp_review_item_color' => '',
87
+ 'wp_review_item_inactive_color' => '',
88
+ ) );
89
+ $value_text = '';
90
+ if ( 'star' != $review['type'] ) {
91
+ $value_text = ' - <span>' . sprintf( $rating_types[ $review['type'] ]['value_text'], $item['wp_review_item_star'] ) . '</span>';
92
+ }
93
+ ?>
94
+ <li>
95
+ <?php
96
+ echo wp_review_rating(
97
+ $item['wp_review_item_star'],
98
+ $review['post_id'],
99
+ array(
100
+ 'color' => $item['wp_review_item_color'],
101
+ 'inactive_color' => $item['wp_review_item_inactive_color'],
102
+ )
103
+ );
104
+ ?>
105
+ <span><?php echo wp_kses_post( $item['wp_review_item_title'] ); ?><?php echo $value_text; ?></span>
106
+ </li>
107
+ <?php endforeach; ?>
108
+ </ul>
109
+ <?php endif; ?>
110
+
111
+ <?php if ( ! $review['hide_desc'] ) : ?>
112
+ <?php if ( ! empty( $review['total'] ) ) :
113
+ $total_text = $review['total'];
114
+ if ( 'star' != $review['type'] ) {
115
+ $total_text = sprintf( $rating_types[ $review['type'] ]['value_text'], $total_text );
116
+ }
117
+ ?>
118
+ <div class="review-total-wrapper">
119
+ <span class="review-total-box"><?php echo $total_text; ?></span>
120
+ <?php if ( 'point' != $review['type'] && 'percentage' != $review['type'] ) :
121
+ echo wp_review_rating( $review['total'], $review['post_id'], array(
122
+ 'review_total' => true,
123
+ 'class' => 'review-total',
124
+ ) );
125
+ endif; ?>
126
+ </div>
127
+ <?php endif; ?>
128
+
129
+ <?php if ( $review['desc'] ) : ?>
130
+ <div class="review-desc">
131
+ <p class="review-summary-title"><strong><?php echo $review['desc_title']; ?></strong></p>
132
+ <?php // echo do_shortcode( shortcode_unautop( wp_kses_post( wpautop( $review['desc'] ) ) ) ); ?>
133
+ <?php echo apply_filters( 'wp_review_desc', $review['desc'], $review['post_id'] ); ?>
134
+ </div>
135
+ <?php endif; ?>
136
+ <?php endif; ?>
137
+
138
+ <?php if ( $review['user_review'] ) : ?>
139
+ <div class="user-review-area visitors-review-area">
140
+ <?php echo wp_review_user_rating( $review['post_id'] ); ?>
141
+ <div class="user-total-wrapper">
142
+ <h5 class="user-review-title"><?php esc_html_e( 'User Review', 'wp-review' ); ?></h5>
143
+ <span class="review-total-box">
144
+ <?php
145
+ $usertotal_text = $review['user_review_total'];
146
+ if ( 'star' != $review['user_review_type'] ) {
147
+ $usertotal_text = sprintf( $rating_types[ $review['user_review_type'] ]['value_text'], $review['user_review_total'] );
148
+ }
149
+ ?>
150
+ <span class="wp-review-user-rating-total"><?php echo esc_html( $usertotal_text ); ?></span>
151
+ <small>(<span class="wp-review-user-rating-counter"><?php echo esc_html( $review['user_review_count'] ); ?></span> <?php echo esc_html( _n( 'vote', 'votes', $review['user_review_count'], 'wp-review' ) ); ?>)</small>
152
+ </span>
153
+ </div>
154
+ </div>
155
+ <?php endif; // $review['user_review'] ?>
156
+
157
+ <?php wp_review_load_template( 'global/partials/review-links.php', compact( 'review' ) ); ?>
158
+ </div>
159
+
160
+ <?php
161
+ $colors = $review['colors'];
162
+ ob_start();
163
+ // phpcs:disable
164
+ ?>
165
+ <style type="text/css">
166
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper {
167
+ width: <?php echo $review['width']; ?>%;
168
+ float: <?php echo $review['align']; ?>;
169
+ }
170
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper,
171
+ .wp-review-<?php echo $review['post_id']; ?> .review-title,
172
+ .wp-review-<?php echo $review['post_id']; ?> .review-desc p,
173
+ .wp-review-<?php echo $review['post_id']; ?> .reviewed-item p {
174
+ color: <?php echo $colors['fontcolor']; ?>;
175
+ }
176
+ .wp-review-<?php echo $review['post_id']; ?> .review-title {
177
+ padding-top: 15px;
178
+ font-weight: bold;
179
+ }
180
+ .wp-review-<?php echo $review['post_id']; ?> .review-links a {
181
+ color: <?php echo $colors['color'] ?>;
182
+ }
183
+ .wp-review-<?php echo $review['post_id']; ?> .review-links a:hover {
184
+ background: <?php echo $colors['color']; ?>;
185
+ color: #fff;
186
+ }
187
+ .wp-review-<?php echo $review['post_id']; ?> .review-list li,
188
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper {
189
+ background: <?php echo $colors['bgcolor2'] ?>;
190
+ }
191
+ .wp-review-<?php echo $review['post_id']; ?> .review-title,
192
+ .wp-review-<?php echo $review['post_id']; ?> .review-list li:nth-child(2n),
193
+ .wp-review-<?php echo $review['post_id']; ?> .wpr-user-features-rating .user-review-title {
194
+ background: <?php echo $colors['bgcolor1']; ?>;
195
+ }
196
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper,
197
+ .wp-review-<?php echo $review['post_id']; ?> .review-title,
198
+ .wp-review-<?php echo $review['post_id']; ?> .review-list li,
199
+ .wp-review-<?php echo $review['post_id']; ?> .review-list li:last-child,
200
+ .wp-review-<?php echo $review['post_id']; ?> .user-review-area,
201
+ .wp-review-<?php echo $review['post_id']; ?> .reviewed-item,
202
+ .wp-review-<?php echo $review['post_id']; ?> .review-links,
203
+ .wp-review-<?php echo $review['post_id']; ?> .wpr-user-features-rating {
204
+ border-color: <?php echo $colors['bordercolor']; ?>;
205
+ }
206
+ .wp-review-<?php echo $review['post_id']; ?> .wpr-rating-accept-btn {
207
+ background: <?php echo $colors['color']; ?>;
208
+ }
209
+ .wp-review-<?php echo $review['post_id']; ?>.review-wrapper .user-review-title {
210
+ color: inherit;
211
+ }
212
+ </style>
213
+ <?php
214
+ $color_output = ob_get_clean();
215
+
216
+ // Apply legacy filter.
217
+ $color_output = apply_filters( 'wp_review_color_output', $color_output, $review['post_id'], $colors );
218
+
219
+ /**
220
+ * Filters style output of default template.
221
+ *
222
+ * @since 3.0.0
223
+ *
224
+ * @param string $style Style output (include <style> tag).
225
+ * @param int $post_id Current post ID.
226
+ * @param array $colors Color data.
227
+ */
228
+ $color_output = apply_filters( 'wp_review_box_template_default_style', $color_output, $review['post_id'], $colors );
229
+
230
+ echo $color_output;
231
+
232
+ // Schema json-dl.
233
+ echo wp_review_get_schema( $review );
234
+ // phpcs:enable
box-templates/global/partials/review-links.php CHANGED
@@ -1,34 +1,34 @@
1
- <?php
2
- /**
3
- * Template for review links
4
- *
5
- * @since 3.0.0
6
- *
7
- * @package WP_Review
8
- * @var array $review
9
- */
10
-
11
- if ( empty( $review['links'] ) || ! is_array( $review['links'] ) ) {
12
- return;
13
- }
14
- ?>
15
- <ul class="review-links">
16
- <?php
17
- foreach ( $review['links'] as $review_link ) :
18
- $review_link = wp_parse_args(
19
- $review_link,
20
- array(
21
- 'url' => '',
22
- 'text' => '',
23
- )
24
- );
25
-
26
- if ( empty( $review_link['text'] ) ) {
27
- continue;
28
- }
29
- ?>
30
- <li>
31
- <a href="<?php echo esc_url( $review_link['url'] ); ?>" target="_blank"><?php echo wp_kses_post( $review_link['text'] ); ?></a>
32
- </li>
33
- <?php endforeach; ?>
34
- </ul>
1
+ <?php
2
+ /**
3
+ * Template for review links
4
+ *
5
+ * @since 3.0.0
6
+ *
7
+ * @package WP_Review
8
+ * @var array $review
9
+ */
10
+
11
+ if ( empty( $review['links'] ) || ! is_array( $review['links'] ) ) {
12
+ return;
13
+ }
14
+ ?>
15
+ <ul class="review-links">
16
+ <?php
17
+ foreach ( $review['links'] as $review_link ) :
18
+ $review_link = wp_parse_args(
19
+ $review_link,
20
+ array(
21
+ 'url' => '',
22
+ 'text' => '',
23
+ )
24
+ );
25
+
26
+ if ( empty( $review_link['text'] ) ) {
27
+ continue;
28
+ }
29
+ ?>
30
+ <li>
31
+ <a href="<?php echo esc_url( $review_link['url'] ); ?>" target="_blank"><?php echo wp_kses_post( $review_link['text'] ); ?></a>
32
+ </li>
33
+ <?php endforeach; ?>
34
+ </ul>
box-templates/global/partials/review-schema.php CHANGED
@@ -1,69 +1,69 @@
1
- <?php
2
- /**
3
- * Template for review schema
4
- *
5
- * @since 3.0.0
6
- * @package WP_Review
7
- * @var array $review
8
- */
9
-
10
- if ( empty( $review['show_schema_data'] ) || empty( $review['schema'] ) || 'Thing' === $review['schema'] || 'none' === $review['schema'] ) {
11
- return;
12
- }
13
- $schema = wp_review_get_schema_type_data( $review['schema'] );
14
- if ( ! $schema ) {
15
- return;
16
- }
17
- $fields = wp_review_get_schema_fields( $schema );
18
- $image = $reviewed_item_data = $url = '';
19
- $schema_data = ! empty( $review['schema_data'][ $review['schema'] ] ) ? (array) $review['schema_data'][ $review['schema'] ] : array();
20
- ?>
21
- <div class="reviewed-item">
22
-
23
- <?php
24
- foreach ( $fields as $key => $data ) {
25
- if ( ! empty( $data['omit'] ) || empty( $schema_data[ $data['name'] ] ) ) {
26
- continue;
27
- }
28
-
29
- if ( ! empty( $data['multiline'] ) ) {
30
- $reviewed_item_data .= '<p><strong class="reviewed-item-data-label">' . $data['label'] . ':</strong> ' . preg_replace( '/\r\n|[\r\n]/', ', ', $schema_data[ $data['name'] ] ) . '</p>';
31
- continue;
32
- }
33
-
34
- if ( 'image' === $data['name'] && ! isset( $data['part_of'] ) ) {
35
-
36
- if ( ! empty( $schema_data['image']['id'] ) ) {
37
- $image = wp_get_attachment_image( $schema_data['image']['id'], apply_filters( 'wp_review_item_reviewed_image_size', 'medium' ) );
38
- }
39
- continue;
40
- }
41
-
42
- if ( 'image' === $data['type'] ) {
43
- $reviewed_item_data .= '<p><strong class="reviewed-item-data-label">' . $data['label'] . ':</strong> ' . wp_get_attachment_image( $schema_data[ $data['name'] ]['id'] ) . '</p>';
44
- continue;
45
- }
46
-
47
- if ( 'url' === $data['name'] && ! isset( $data['part_of'] ) ) {
48
- if ( ! empty( $schema_data['url'] ) ) {
49
- $more_text = ! empty( $schema_data['more_text'] ) ? $schema_data['more_text'] : __( '[ More ]', 'wp-review' );
50
- $link = '<a href="' . esc_url( $schema_data['url'] ) . '" class="reviewed-item-link">' . esc_html( $more_text ) . '</a>';
51
- if ( ! empty( $schema_data['use_button_style'] ) ) {
52
- $url = '<ul class="review-links" style="padding-left: 0; padding-right: 0;"><li>' . $link . '</li></ul>';
53
- } else {
54
- $url = '<p>' . $link . '</p>';
55
- }
56
- }
57
- continue;
58
- }
59
-
60
- $reviewed_item_data .= '<p><strong class="reviewed-item-data-label">' . $data['label'] . ':</strong> ' . $schema_data[ $data['name'] ] . '</p>';
61
- }
62
- if ( ! empty( $image ) ) {
63
- echo '<div class="reviewed-item-image">' . $image . '</div>';
64
- }
65
- if ( ! empty( $reviewed_item_data ) ) {
66
- echo '<div class="reviewed-item-data">' . $reviewed_item_data . $url . '</div>';
67
- }
68
- ?>
69
- </div>
1
+ <?php
2
+ /**
3
+ * Template for review schema
4
+ *
5
+ * @since 3.0.0
6
+ * @package WP_Review
7
+ * @var array $review
8
+ */
9
+
10
+ if ( empty( $review['show_schema_data'] ) || empty( $review['schema'] ) || 'Thing' === $review['schema'] || 'none' === $review['schema'] ) {
11
+ return;
12
+ }
13
+ $schema = wp_review_get_schema_type_data( $review['schema'] );
14
+ if ( ! $schema ) {
15
+ return;
16
+ }
17
+ $fields = wp_review_get_schema_fields( $schema );
18
+ $image = $reviewed_item_data = $url = '';
19
+ $schema_data = ! empty( $review['schema_data'][ $review['schema'] ] ) ? (array) $review['schema_data'][ $review['schema'] ] : array();
20
+ ?>
21
+ <div class="reviewed-item">
22
+
23
+ <?php
24
+ foreach ( $fields as $key => $data ) {
25
+ if ( ! empty( $data['omit'] ) || empty( $schema_data[ $data['name'] ] ) ) {
26
+ continue;
27
+ }
28
+
29
+ if ( ! empty( $data['multiline'] ) ) {
30
+ $reviewed_item_data .= '<p><strong class="reviewed-item-data-label">' . $data['label'] . ':</strong> ' . preg_replace( '/\r\n|[\r\n]/', ', ', $schema_data[ $data['name'] ] ) . '</p>';
31
+ continue;
32
+ }
33
+
34
+ if ( 'image' === $data['name'] && ! isset( $data['part_of'] ) ) {
35
+
36
+ if ( ! empty( $schema_data['image']['id'] ) ) {
37
+ $image = wp_get_attachment_image( $schema_data['image']['id'], apply_filters( 'wp_review_item_reviewed_image_size', 'medium' ) );
38
+ }
39
+ continue;
40
+ }
41
+
42
+ if ( 'image' === $data['type'] ) {
43
+ $reviewed_item_data .= '<p><strong class="reviewed-item-data-label">' . $data['label'] . ':</strong> ' . wp_get_attachment_image( $schema_data[ $data['name'] ]['id'] ) . '</p>';
44
+ continue;
45
+ }
46
+
47
+ if ( 'url' === $data['name'] && ! isset( $data['part_of'] ) ) {
48
+ if ( ! empty( $schema_data['url'] ) ) {
49
+ $more_text = ! empty( $schema_data['more_text'] ) ? $schema_data['more_text'] : __( '[ More ]', 'wp-review' );
50
+ $link = '<a href="' . esc_url( $schema_data['url'] ) . '" class="reviewed-item-link">' . esc_html( $more_text ) . '</a>';
51
+ if ( ! empty( $schema_data['use_button_style'] ) ) {
52
+ $url = '<ul class="review-links" style="padding-left: 0; padding-right: 0;"><li>' . $link . '</li></ul>';
53
+ } else {
54
+ $url = '<p>' . $link . '</p>';
55
+ }
56
+ }
57
+ continue;
58
+ }
59
+
60
+ $reviewed_item_data .= '<p><strong class="reviewed-item-data-label">' . $data['label'] . ':</strong> ' . $schema_data[ $data['name'] ] . '</p>';
61
+ }
62
+ if ( ! empty( $image ) ) {
63
+ echo '<div class="reviewed-item-image">' . $image . '</div>';
64
+ }
65
+ if ( ! empty( $reviewed_item_data ) ) {
66
+ echo '<div class="reviewed-item-data">' . $reviewed_item_data . $url . '</div>';
67
+ }
68
+ ?>
69
+ </div>
comments/comments.php CHANGED
@@ -1,74 +1,74 @@
1
- <?php
2
- /**
3
- * The template for displaying the comments.
4
- *
5
- * This contains both the comments and the comment form.
6
- *
7
- * @package WP_Review
8
- */
9
-
10
- // Do not delete these lines.
11
- if ( ! empty( $_SERVER['SCRIPT_FILENAME'] ) && 'comments.php' == basename( $_SERVER['SCRIPT_FILENAME'] ) ) {
12
- die( __( 'Please do not load this page directly. Thanks!', 'wp-review' ) );
13
- }
14
-
15
- if ( post_password_required() ) { ?>
16
- <p class="nocomments"><?php _e( 'This post is password protected. Enter the password to view comments.', 'wp-review' ); ?></p>
17
- <?php
18
- return;
19
- }
20
- ?>
21
- <!-- You can start editing here. -->
22
- <?php if ( have_comments() ) : ?>
23
- <div id="comments">
24
- <h4 class="total-comments"><?php comments_number( __( 'No Responses', 'wp-review' ), __( 'One Response', 'wp-review' ), __( '% Comments', 'wp-review' ) ); ?></h4>
25
- <ol class="commentlist">
26
- <?php
27
- if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) { // Are there comments to navigate through.
28
- ?>
29
- <div class="navigation">
30
- <div class="alignleft"><?php previous_comments_link(); ?></div>
31
- <div class="alignright"><?php next_comments_link(); ?></div>
32
- </div>
33
- <?php
34
- }
35
-
36
- wp_list_comments( 'callback=wp_review_comments' );
37
-
38
- if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) { // Are there comments to navigate through.
39
- ?>
40
- <div class="navigation">
41
- <div class="alignleft"><?php previous_comments_link(); ?></div>
42
- <div class="alignright"><?php next_comments_link(); ?></div>
43
- </div>
44
- <?php } ?>
45
- </ol>
46
- </div>
47
- <?php endif; ?>
48
-
49
- <?php if ( comments_open() ) : ?>
50
- <div id="commentsAdd">
51
- <div id="respond" class="box m-t-6">
52
- <?php
53
- global $aria_req;
54
- $comments_args = array(
55
- 'title_reply' => '<h4>' . __( 'Leave a Reply', 'wp-review' ) . '</h4>',
56
- 'comment_notes_before' => '',
57
- 'comment_notes_after' => '',
58
- 'label_submit' => __( 'Post Comment', 'wp-review' ),
59
- 'comment_field' => '<p class="comment-form-comment"><label for="comment" class="review-comment-field-msg">' . __( 'Comment*', 'wp-review' ) . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
60
- 'fields' => apply_filters(
61
- 'comment_form_default_fields',
62
- array(
63
- 'author' => '<p class="comment-form-author">' . ( $req ? '' : '' ) . '<label for="author" class="review-comment-field-msg">' . __( 'Name*', 'wp-review' ) . '</label><input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
64
- 'email' => '<p class="comment-form-email">' . ( $req ? '' : '' ) . '<label for="email" class="review-comment-field-msg">' . __( 'Email*', 'wp-review' ) . '</label><input id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>',
65
- 'url' => '<p class="comment-form-url"><label for="url" class="review-comment-field-msg">' . __( 'Website', 'wp-review' ) . '</label><input id="url" name="url" type="text" value="' . esc_url( $commenter['comment_author_url'] ) . '" size="30" /></p>',
66
- 'cookies' => '<p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes" /><label for="wp-comment-cookies-consent">' . __( 'Save my name, email, and website in this browser for the next time I comment.' ) . '</label></p>',
67
- )
68
- ),
69
- );
70
- comment_form( $comments_args );
71
- ?>
72
- </div>
73
- </div>
74
- <?php endif; // if you delete this the sky will fall on your head. ?>
1
+ <?php
2
+ /**
3
+ * The template for displaying the comments.
4
+ *
5
+ * This contains both the comments and the comment form.
6
+ *
7
+ * @package WP_Review
8
+ */
9
+
10
+ // Do not delete these lines.
11
+ if ( ! empty( $_SERVER['SCRIPT_FILENAME'] ) && 'comments.php' == basename( $_SERVER['SCRIPT_FILENAME'] ) ) {
12
+ die( __( 'Please do not load this page directly. Thanks!', 'wp-review' ) );
13
+ }
14
+
15
+ if ( post_password_required() ) { ?>
16
+ <p class="nocomments"><?php _e( 'This post is password protected. Enter the password to view comments.', 'wp-review' ); ?></p>
17
+ <?php
18
+ return;
19
+ }
20
+ ?>
21
+ <!-- You can start editing here. -->
22
+ <?php if ( have_comments() ) : ?>
23
+ <div id="comments">
24
+ <h4 class="total-comments"><?php comments_number( __( 'No Responses', 'wp-review' ), __( 'One Response', 'wp-review' ), __( '% Comments', 'wp-review' ) ); ?></h4>
25
+ <ol class="commentlist">
26
+ <?php
27
+ if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) { // Are there comments to navigate through.
28
+ ?>
29
+ <div class="navigation">
30
+ <div class="alignleft"><?php previous_comments_link(); ?></div>
31
+ <div class="alignright"><?php next_comments_link(); ?></div>
32
+ </div>
33
+ <?php
34
+ }
35
+
36
+ wp_list_comments( 'callback=wp_review_comments' );
37
+
38
+ if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) { // Are there comments to navigate through.
39
+ ?>
40
+ <div class="navigation">
41
+ <div class="alignleft"><?php previous_comments_link(); ?></div>
42
+ <div class="alignright"><?php next_comments_link(); ?></div>
43
+ </div>
44
+ <?php } ?>
45
+ </ol>
46
+ </div>
47
+ <?php endif; ?>
48
+
49
+ <?php if ( comments_open() ) : ?>
50
+ <div id="commentsAdd">
51
+ <div id="respond" class="box m-t-6">
52
+ <?php
53
+ global $aria_req;
54
+ $comments_args = array(
55
+ 'title_reply' => '<h4>' . __( 'Leave a Reply', 'wp-review' ) . '</h4>',
56
+ 'comment_notes_before' => '',
57
+ 'comment_notes_after' => '',
58
+ 'label_submit' => __( 'Post Comment', 'wp-review' ),
59
+ 'comment_field' => '<p class="comment-form-comment"><label for="comment" class="review-comment-field-msg">' . __( 'Comment*', 'wp-review' ) . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
60
+ 'fields' => apply_filters(
61
+ 'comment_form_default_fields',
62
+ array(
63
+ 'author' => '<p class="comment-form-author">' . ( $req ? '' : '' ) . '<label for="author" class="review-comment-field-msg">' . __( 'Name*', 'wp-review' ) . '</label><input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
64
+ 'email' => '<p class="comment-form-email">' . ( $req ? '' : '' ) . '<label for="email" class="review-comment-field-msg">' . __( 'Email*', 'wp-review' ) . '</label><input id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>',
65
+ 'url' => '<p class="comment-form-url"><label for="url" class="review-comment-field-msg">' . __( 'Website', 'wp-review' ) . '</label><input id="url" name="url" type="text" value="' . esc_url( $commenter['comment_author_url'] ) . '" size="30" /></p>',
66
+ 'cookies' => '<p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes" /><label for="wp-comment-cookies-consent">' . __( 'Save my name, email, and website in this browser for the next time I comment.' ) . '</label></p>',
67
+ )
68
+ ),
69
+ );
70
+ comment_form( $comments_args );
71
+ ?>
72
+ </div>
73
+ </div>
74
+ <?php endif; // if you delete this the sky will fall on your head. ?>
filter-list.php CHANGED
@@ -1,543 +1,543 @@
1
- <?php
2
- /*
3
- List of available filters in WP Review plugin.
4
- You can use these filterns in your theme in funtions.php file
5
- and set different default settings.
6
- */
7
-
8
- /**
9
- * Changes number of posts to import per request.
10
- *
11
- * @param int $numposts Number of posts.
12
- * @return int
13
- */
14
- function mts_wp_review_import_numposts( $numposts ) {
15
- return 20;
16
- }
17
- add_filter( 'wp_review_import_numposts', 'mts_wp_review_import_numposts' );
18
-
19
- /**
20
- * Excludes post types from review.
21
- *
22
- * @param array $excluded List of post types.
23
- * @return array
24
- */
25
- function mts_wp_review_exclude_post_types( $excluded ) {
26
- // default: $excluded = array('attachment');
27
- $excluded[] = 'page'; // Don't allow reviews on pages.
28
- return $excluded;
29
- }
30
- add_filter( 'wp_review_excluded_post_types', 'mts_wp_review_exclude_post_types' );
31
-
32
- /**
33
- * Hides fields in meta box.
34
- *
35
- * @param array $fields List of displayed fields.
36
- * @return array
37
- */
38
- function mts_wp_review_hide_item_metabox_fields( $fields ) {
39
- unset( $fields['location'], $fields['fontcolor'], $fields['bordercolor'] );
40
- // Or remove all (except features which can't be removed) with:
41
- // $fields = array();
42
- return $fields;
43
- }
44
- add_filter( 'wp_review_metabox_item_fields', 'mts_wp_review_hide_item_metabox_fields' );
45
-
46
- /**
47
- * Hides rating types.
48
- *
49
- * @param array $types List of available types.
50
- * @return array
51
- */
52
- function mts_wp_review_hide_rating_types( $types ) {
53
- unset( $types['point'] );
54
- return $types;
55
- }
56
- add_filter( 'wp_review_rating_types', 'mts_wp_review_hide_rating_types' );
57
-
58
- /**
59
- * Set colors for selected or all reviews.
60
- *
61
- * @param array $colors Color data.
62
- * @param int $id Post ID.
63
- * @return array
64
- */
65
- function mts_wp_review_new_review_colors($colors, $id) {
66
- $colors['bgcolor1'] = '#ff0000';
67
- return $colors;
68
- }
69
- add_filter( 'wp_review_colors', 'mts_wp_review_new_review_colors', 10, 2 );
70
-
71
- /**
72
- * Sets location for selected or all reviews.
73
- *
74
- * @param string $location Review location.
75
- * @param int $id Post ID.
76
- * @return string
77
- */
78
- function mts_new_review_location( $location, $id ) {
79
- $location = 'bottom';
80
- return $location;
81
- }
82
- add_filter( 'wp_review_location', 'mts_new_review_location', 10, 2 );
83
-
84
- /**
85
- * Shows post title as review heading when the review heading field is empty.
86
- */
87
- function mts_wp_review_item_title_fallback( $title ) {
88
- return '<h5 class="review-title">' . get_the_title() . '</h5>';
89
- }
90
- add_filter( 'wp_review_item_title_fallback', 'mts_wp_review_item_title_fallback' );
91
-
92
- /**
93
- * Filters review description.
94
- *
95
- * @param string $desc Review description.
96
- * @return string
97
- */
98
- function mts_wp_review_desc( $desc, $review_id = '' ) {
99
- $desc .= '<br>Thank you';
100
- return $desc;
101
- }
102
- add_filter( 'wp_review_desc', 'mts_wp_review_desc', 10, 2 );
103
-
104
-
105
- /**
106
- * Changes color css output for all templates.
107
- *
108
- * @param string $output CSS output, includes `<style` tag.
109
- * @param int $review_id Review ID.
110
- * @param array $colors Review colors data.
111
- * @return string
112
- */
113
- function mts_wp_review_color_output( $output, $review_id, $colors ) {
114
- $css = ".wp-review-{$review_id} { color: {$colors['color']}; }";
115
- // $output = str_replace( '<style type="text/css">', '<style type="text/css">' . $css, $output ); // Add to the top.
116
- $output = str_replace( '</style>', $css . '</style>', $output ); // Add to the bottom.
117
- return $output;
118
- }
119
- apply_filters( 'wp_review_color_output', 'mts_wp_review_color_output', 10, 3 );
120
-
121
- /**
122
- * Changes color css output for a specific template
123
- * Replace `aqua` with template name
124
- * Eg: wp_review_box_template_dash_style.
125
- *
126
- * @param string $output CSS output, includes `<style` tag.
127
- * @param int $review_id Review ID.
128
- * @param array $colors Review colors data.
129
- * @return string
130
- */
131
- function mts_wp_review_box_template_aqua_style( $output, $review_id, $colors ) {
132
- $css = ".wp-review-{$review_id} { color: {$colors['color']}; }";
133
- // $output = str_replace( '<style type="text/css">', '<style type="text/css">' . $css, $output ); // Add to the top.
134
- $output = str_replace( '</style>', $css . '</style>', $output ); // Add to the bottom.
135
- return $output;
136
- }
137
- apply_filters( 'wp_review_box_template_aqua_style', 'mts_wp_review_box_template_aqua_style', 10, 3 );
138
-
139
- /**
140
- * Changes review item image size.
141
- *
142
- * @param string $size Image size.
143
- * @return string
144
- */
145
- function mts_wp_review_item_reviewed_image_size( $size ) {
146
- return 'thumbnail';
147
- }
148
- add_filter( 'wp_review_item_reviewed_image_size', 'mts_wp_review_item_reviewed_image_size' );
149
-
150
- // Hides review comments from comments list.
151
- add_filter( 'wp_review_to_comment_type_list', '__return_false' );
152
-
153
- /**
154
- * Filters value of an option
155
- * Hook: wp_review_option_{$option_name}.
156
- *
157
- * @param mixed $value Option value.
158
- * @return mixed
159
- */
160
- function mts_wp_review_option_rating_icon( $value ) {
161
- $value = 'fa fa-thumbs-up';
162
- return $value;
163
- }
164
- add_filter( 'wp_review_option_rating_icon', 'mts_wp_review_option_rating_icon' );
165
-
166
- /**
167
- * Filters value of any options
168
- *
169
- * @param mixed $value Option value.
170
- * @param string $option_name Option name.
171
- * @return mixed
172
- */
173
- function mts_wp_review_option( $value, $option_name ) {
174
- if ( 'rating_icon' == $option_name ) {
175
- $value = 'fa fa-thumbs-up';
176
- }
177
- return $value;
178
- }
179
- add_filter( 'wp_review_option', 'mts_wp_review_option', 10, 2 );
180
-
181
- /**
182
- * Filters default review colors.
183
- *
184
- * @param array $colors Review colors.
185
- * @return array
186
- */
187
- function mts_wp_review_default_colors( $colors ) {
188
- $colors = array(
189
- 'color' => '#1e73be',
190
- 'inactive_color' => '',
191
- 'fontcolor' => '#555555',
192
- 'bgcolor1' => '#e7e7e7',
193
- 'bgcolor2' => '#ffffff',
194
- 'bordercolor' => '#e7e7e7',
195
- );
196
-
197
- return $colors;
198
- }
199
- add_filter( 'wp_review_default_colors', 'mts_wp_review_default_colors' );
200
-
201
- /**
202
- * Filters default location of review.
203
- *
204
- * @param string $location Review location.
205
- * @return string
206
- */
207
- function mts_wp_review_default_location( $location ) {
208
- $location = 'top'; // accepts 'top', 'bottom', 'custom'. Default is 'bottom'.
209
-
210
- return $location;
211
- }
212
- add_filter( 'wp_review_default_location', 'mts_wp_review_default_location' );
213
-
214
- /**
215
- * Adds default items.
216
- *
217
- * @param array $items List of default items.
218
- * @return array
219
- */
220
- function mts_add_default_items( $items ) {
221
- $items = array(
222
- __( 'Audio', 'theme-slug' ),
223
- __( 'Visual', 'theme-slug' ),
224
- __( 'UX', 'theme-slug' ),
225
- __( 'Price', 'theme-slug' ),
226
- );
227
- return $items;
228
- }
229
- add_filter( 'wp_review_default_criteria', 'mts_add_default_items' );
230
-
231
- /**
232
- * Customizes wp_review_show_total() output.
233
- *
234
- * @param string $output The output.
235
- * @param int $id Post ID.
236
- * @param string $type Rating type.
237
- * @param float $total Total value.
238
- * @return string
239
- */
240
- function mts_wp_review_custom_review_total( $output, $id, $type, $total ) {
241
- if ( get_the_title( $id ) == 'Special Post With Blue Rating' ) {
242
- $color = '#0000FF';
243
- $output = preg_replace( '/"review-type-[^"]+"/', '$0 style="background-color: ' . $color . ';"', $output );
244
- }
245
- return $output;
246
- }
247
- add_filter( 'wp_review_show_total', 'mts_wp_review_custom_review_total', 10, 4 );
248
-
249
- /**
250
- * Filters review total output.
251
- *
252
- * @param string $review Review total output.
253
- * @param int $post_id Post ID.
254
- * @param string $type Review type.
255
- * @param float $total Review total value.
256
- * @param string $class CSS class.
257
- * @param array $args Custom arguments.
258
- * @return string
259
- */
260
- function mts_wp_review_total_output( $review, $post_id, $type, $total, $class, $args ) {
261
- $review = '<p>Total:</p>' . $review;
262
- return $review;
263
- }
264
- add_filter( 'wp_review_total_output', 'mts_wp_review_total_output', 10, 6 );
265
-
266
- /**
267
- * Filters post review type.
268
- *
269
- * @param string $type Review type.
270
- * @param int $post_id Post ID.
271
- * @return string
272
- */
273
- function mts_wp_review_get_review_type( $type, $post_id ) {
274
- $type = 'star'; // Force using star.
275
- return $type;
276
- }
277
- add_filter( 'wp_review_get_review_type', 'mts_wp_review_get_review_type', 10, 2 );
278
-
279
- /**
280
- * Filters user review type.
281
- *
282
- * @param string $type Review type.
283
- * @param int $post_id Post ID.
284
- * @return string
285
- */
286
- function mts_wp_review_get_user_review_type( $type, $post_id ) {
287
- $type = 'star'; // Force using star.
288
- return $type;
289
- }
290
- add_filter( 'wp_review_get_user_review_type', 'mts_wp_review_get_user_review_type', 10, 2 );
291
-
292
- /**
293
- * Editing/overriding the review box template
294
- *
295
- * Create a 'wp-review' directory in your (child) theme folder,
296
- * and make a copy there of /wp-review/box-templates/default.php
297
- * to override it.
298
- *
299
- * Use different file name to add new template, which can be applied using filter:
300
- *
301
- */
302
- function mts_wp_review_select_box_template( $template, $post_id ) {
303
- // Change box template for specific post
304
- if ( $post_id == '128' ) {
305
- $template = 'new-box.php';
306
- // "new-box.php" must be present in one of the template path folders (see below)
307
- }
308
- return $template;
309
- }
310
- add_filter( 'wp_review_get_box_template', 'mts_wp_review_select_box_template', 10, 2 );
311
-
312
- /**
313
- * Template Path Directories
314
- *
315
- * By default the plugin looks for box templates in:
316
- * 1. wp-review/box-templates
317
- * 2. theme_dir/wp-review
318
- * 3. childtheme_dir/wp-review
319
- * 4... Use filter to add more
320
- *
321
- */
322
- function mts_wp_review_add_template_path( $paths ) {
323
- // Add a new path where we look for review box template files
324
- // The $paths holds default paths in reversed
325
- $paths[] = '/absolute/path/to/additional/templates/dir';
326
- return $paths;
327
- }
328
- add_filter( 'wp_review_box_template_paths', 'mts_wp_review_add_template_path' );
329
-
330
- /**
331
- * Filters review data. This data is passed to template.
332
- *
333
- * @param array $data Review data.
334
- * @param array $args Custom arguments.
335
- * @return array
336
- */
337
- function mts_wp_review_get_review_data( $data, $args ) {
338
- $data['type'] = 'circle';
339
- return $data;
340
- }
341
- add_filter( 'wp_review_get_review_data', 'mts_wp_review_get_review_data', 10, 2 );
342
-
343
- /**
344
- * Filters review box output.
345
- *
346
- * @param string $review Review box output.
347
- * @param int $post_id Post ID.
348
- * @param string $type Review type.
349
- * @param float $total Review total.
350
- * @param array $items Review items.
351
- * @return string
352
- */
353
- function mts_wp_review_get_data( $review, $post_id, $type, $total, $items ) {
354
- $review .= '<p>Custom content</p>';
355
- return $review;
356
- }
357
- add_filter( 'wp_review_get_data', 'mts_wp_review_get_data', 10, 5 );
358
-
359
- /**
360
- * Changes reviewed item name.
361
- *
362
- * @param string $item_name Item name.
363
- * @param array $review Review data.
364
- * @return string
365
- */
366
- function mts_wp_review_get_reviewed_item_name( $item_name, $review ) {
367
- // Modify the $item_name.
368
- return $item_name;
369
- }
370
- add_filter( 'wp_review_get_reviewed_item_name', 'mts_wp_review_get_reviewed_item_name', 10, 2 );
371
-
372
- /**
373
- * Changes transient expired time.
374
- *
375
- * @param int $time Transient expired time.
376
- * @return int
377
- */
378
- function mts_wp_review_transient_expired_time( $time ) {
379
- $time = MONTH_IN_SECONDS;
380
- return $time;
381
- }
382
- add_filter( 'wp_review_transient_expired_time', 'mts_wp_review_transient_expired_time' );
383
-
384
- /**
385
- * Filters reviews query args.
386
- *
387
- * @param array $query_args Query args.
388
- * @param array $options Query options.
389
- * @return array
390
- */
391
- function mts_wp_review_reviews_query_args( $query_args, $options ) {
392
- $query_args['post_type'] = 'post'; // Only show post reviews.
393
- return $query_args;
394
- }
395
- add_filter( 'wp_review_reviews_query_args', 'mts_wp_review_reviews_query_args' );
396
-
397
- /**
398
- * Hide selected review types in metabox dropdown.
399
- *
400
- * @deprecated 3.0.0 Now use `wp_review_rating_types` filter.
401
- *
402
- * @param array $types List of rating types.
403
- * @return array
404
- */
405
- function mts_hide_review_types( $types ) {
406
- unset( $types['point'], $types['percentage'] ); // remove types.
407
- $types['star'] = __( 'Enable Reviews' ); // Change label.
408
- return $types;
409
- }
410
- add_filter( 'wp_review_metabox_types', 'mts_hide_review_types' );
411
-
412
- /**
413
- * Add new rating types with wp_review_register_rating_type()
414
- *
415
- * Refer to existing rating template files, e.g.
416
- * point-output.php, point-input.php
417
- *
418
- * This is an alternative way to add new rating type instead of using `wp_review_rating_types` hook.
419
- */
420
- function wp_review_register_additional_rating_types() {
421
- wp_review_register_rating_type( 'star10', array(
422
- 'label' => __( '10 Stars', 'wp-review' ),
423
- 'max' => 10,
424
- 'decimals' => 1,
425
- 'value_text' => __( '%s Stars', 'wp-review' ),
426
- 'value_text_singular' => __( '%s Star', 'wp-review' ),
427
- 'input_template' => WP_REVIEW_DIR . 'rating-types/star10-input.php', // Replace with path to input template
428
- 'output_template' => WP_REVIEW_DIR . 'rating-types/star10-output.php', // Replace with path to output template
429
- ) );
430
- }
431
- add_action( 'init', 'wp_review_register_additional_rating_types' );
432
-
433
- /**
434
- * Adds new box template.
435
- *
436
- * @param array $templates Review box templates.
437
- * @return array
438
- */
439
- function mts_wp_review_box_templates( $templates ) {
440
- $templates['custom-template'] = array(
441
- 'title' => __( 'Custom template', 'wp-review' ),
442
- 'image' => WP_REVIEW_ASSETS . 'images/largethumb.png',
443
- 'color' => '#1e73be',
444
- 'fontcolor' => '#555',
445
- 'bgcolor1' => '#e7e7e7',
446
- 'bgcolor2' => '#fff',
447
- 'bordercolor' => '#e7e7e7',
448
- 'width' => 100, // In percentage.
449
- 'align' => 'left',
450
- 'custom_comment_colors' => 0,
451
- 'comment_color' => '#ffb300',
452
- 'rating_icon' => 'fa fa-star',
453
- );
454
- return $templates;
455
- }
456
- add_filter( 'wp_review_box_templates', 'mts_wp_review_box_templates' );
457
-
458
-
459
- /**
460
- * Changes the output of [wp-review] shortcode.
461
- *
462
- * @param string $output Shortcode output.
463
- * @param array $atts Shortcode attributes.
464
- * @return string
465
- */
466
- function mts_wp_review_shortcode( $output, $atts ) {
467
- // Modify the output.
468
- return $output;
469
- }
470
- add_filter( 'wp_review_shortcode', 'mts_wp_review_shortcode', 10, 2 );
471
-
472
-
473
- /**
474
- * Changes the output of [wp-review-total] shortcode.
475
- *
476
- * @param string $output Shortcode output.
477
- * @param array $atts Shortcode attributes.
478
- * @return string
479
- */
480
- function mts_wp_review_total_shortcode( $output, $atts ) {
481
- // Modify the output.
482
- return $output;
483
- }
484
- add_filter( 'wp_review_total_shortcode', 'mts_wp_review_total_shortcode', 10, 2 );
485
-
486
-
487
- /**
488
- * Changes the output of [wp-review-visitor-rating] shortcode.
489
- *
490
- * @param string $output Shortcode output.
491
- * @param array $atts Shortcode attributes.
492
- * @return string
493
- */
494
- function mts_wp_review_visitor_rating_shortcode( $output, $atts ) {
495
- // Modify the output.
496
- return $output;
497
- }
498
- add_filter( 'wp_review_visitor_rating_shortcode', 'mts_wp_review_visitor_rating_shortcode', 10, 2 );
499
-
500
-
501
- /**
502
- * Changes the output of [wp-review-comments-rating] shortcode.
503
- *
504
- * @param string $output Shortcode output.
505
- * @param array $atts Shortcode attributes.
506
- * @return string
507
- */
508
- function mts_wp_review_comments_rating_shortcode( $output, $atts ) {
509
- // Modify the output.
510
- return $output;
511
- }
512
- add_filter( 'wp_review_comments_rating_shortcode', 'mts_wp_review_comments_rating_shortcode', 10, 2 );
513
-
514
-
515
- /**
516
- * Changes the default length of review title in WP Review Widget.
517
- *
518
- * @param int $length Title length.
519
- * @return int
520
- */
521
- function mts_wpt_title_length_default( $length ) {
522
- $length = 10;
523
- return $length;
524
- }
525
- add_filter( 'wpt_title_length_default', 'mts_wpt_title_length_default' );
526
-
527
- printf( '<script type="application/ld+json">%s</script>', wp_json_encode( $markup ) );
528
-
529
- // Set the review options in your theme
530
- // These will be set as the global options for the plugin upon theme activation
531
- $new_options = array(
532
- 'colors' => array(
533
- 'color' => '#dd3333',
534
- 'inactive_color' => '#dd3333',
535
- 'fontcolor' => '#555555',
536
- 'bgcolor1' => '#e7e7e7',
537
- 'bgcolor2' => '#ffffff',
538
- 'bordercolor' => '#e7e7e7',
539
- ),
540
- );
541
- if ( function_exists( 'wp_review_theme_defaults' ) ) {
542
- wp_review_theme_defaults( $new_options );
543
- }
1
+ <?php
2
+ /*
3
+ List of available filters in WP Review plugin.
4
+ You can use these filterns in your theme in funtions.php file
5
+ and set different default settings.
6
+ */
7
+
8
+ /**
9
+ * Changes number of posts to import per request.
10
+ *
11
+ * @param int $numposts Number of posts.
12
+ * @return int
13
+ */
14
+ function mts_wp_review_import_numposts( $numposts ) {
15
+ return 20;
16
+ }
17
+ add_filter( 'wp_review_import_numposts', 'mts_wp_review_import_numposts' );
18
+
19
+ /**
20
+ * Excludes post types from review.
21
+ *
22
+ * @param array $excluded List of post types.
23
+ * @return array
24
+ */
25
+ function mts_wp_review_exclude_post_types( $excluded ) {
26
+ // default: $excluded = array('attachment');
27
+ $excluded[] = 'page'; // Don't allow reviews on pages.
28
+ return $excluded;
29
+ }
30
+ add_filter( 'wp_review_excluded_post_types', 'mts_wp_review_exclude_post_types' );
31
+
32
+ /**
33
+ * Hides fields in meta box.
34
+ *
35
+ * @param array $fields List of displayed fields.
36
+ * @return array
37
+ */
38
+ function mts_wp_review_hide_item_metabox_fields( $fields ) {
39
+ unset( $fields['location'], $fields['fontcolor'], $fields['bordercolor'] );
40
+ // Or remove all (except features which can't be removed) with:
41
+ // $fields = array();
42
+ return $fields;
43
+ }
44
+ add_filter( 'wp_review_metabox_item_fields', 'mts_wp_review_hide_item_metabox_fields' );
45
+
46
+ /**
47
+ * Hides rating types.
48
+ *
49
+ * @param array $types List of available types.
50
+ * @return array
51
+ */
52
+ function mts_wp_review_hide_rating_types( $types ) {
53
+ unset( $types['point'] );
54
+ return $types;
55
+ }
56
+ add_filter( 'wp_review_rating_types', 'mts_wp_review_hide_rating_types' );
57
+
58
+ /**
59
+ * Set colors for selected or all reviews.
60
+ *
61
+ * @param array $colors Color data.
62
+ * @param int $id Post ID.
63
+ * @return array
64
+ */
65
+ function mts_wp_review_new_review_colors($colors, $id) {
66
+ $colors['bgcolor1'] = '#ff0000';
67
+ return $colors;
68
+ }
69
+ add_filter( 'wp_review_colors', 'mts_wp_review_new_review_colors', 10, 2 );
70
+
71
+ /**
72
+ * Sets location for selected or all reviews.
73
+ *
74
+ * @param string $location Review location.
75
+ * @param int $id Post ID.
76
+ * @return string
77
+ */
78
+ function mts_new_review_location( $location, $id ) {
79
+ $location = 'bottom';
80
+ return $location;
81
+ }
82
+ add_filter( 'wp_review_location', 'mts_new_review_location', 10, 2 );
83
+
84
+ /**
85
+ * Shows post title as review heading when the review heading field is empty.
86
+ */
87
+ function mts_wp_review_item_title_fallback( $title ) {
88
+ return '<h5 class="review-title">' . get_the_title() . '</h5>';
89
+ }
90
+ add_filter( 'wp_review_item_title_fallback', 'mts_wp_review_item_title_fallback' );
91
+
92
+ /**
93
+ * Filters review description.
94
+ *
95
+ * @param string $desc Review description.
96
+ * @return string
97
+ */
98
+ function mts_wp_review_desc( $desc, $review_id = '' ) {
99
+ $desc .= '<br>Thank you';
100
+ return $desc;
101
+ }
102
+ add_filter( 'wp_review_desc', 'mts_wp_review_desc', 10, 2 );
103
+
104
+
105
+ /**
106
+ * Changes color css output for all templates.
107
+ *
108
+ * @param string $output CSS output, includes `<style` tag.
109
+ * @param int $review_id Review ID.
110
+ * @param array $colors Review colors data.
111
+ * @return string
112
+ */
113
+ function mts_wp_review_color_output( $output, $review_id, $colors ) {
114
+ $css = ".wp-review-{$review_id} { color: {$colors['color']}; }";
115
+ // $output = str_replace( '<style type="text/css">', '<style type="text/css">' . $css, $output ); // Add to the top.
116
+ $output = str_replace( '</style>', $css . '</style>', $output ); // Add to the bottom.
117
+ return $output;
118
+ }
119
+ apply_filters( 'wp_review_color_output', 'mts_wp_review_color_output', 10, 3 );
120
+
121
+ /**
122
+ * Changes color css output for a specific template
123
+ * Replace `aqua` with template name
124
+ * Eg: wp_review_box_template_dash_style.
125
+ *
126
+ * @param string $output CSS output, includes `<style` tag.
127
+ * @param int $review_id Review ID.
128
+ * @param array $colors Review colors data.
129
+ * @return string
130
+ */
131
+ function mts_wp_review_box_template_aqua_style( $output, $review_id, $colors ) {
132
+ $css = ".wp-review-{$review_id} { color: {$colors['color']}; }";
133
+ // $output = str_replace( '<style type="text/css">', '<style type="text/css">' . $css, $output ); // Add to the top.
134
+ $output = str_replace( '</style>', $css . '</style>', $output ); // Add to the bottom.
135
+ return $output;
136
+ }
137
+ apply_filters( 'wp_review_box_template_aqua_style', 'mts_wp_review_box_template_aqua_style', 10, 3 );
138
+
139
+ /**
140
+ * Changes review item image size.
141
+ *
142
+ * @param string $size Image size.
143
+ * @return string
144
+ */
145
+ function mts_wp_review_item_reviewed_image_size( $size ) {
146
+ return 'thumbnail';
147
+ }
148
+ add_filter( 'wp_review_item_reviewed_image_size', 'mts_wp_review_item_reviewed_image_size' );
149
+
150
+ // Hides review comments from comments list.
151
+ add_filter( 'wp_review_to_comment_type_list', '__return_false' );
152
+
153
+ /**
154
+ * Filters value of an option
155
+ * Hook: wp_review_option_{$option_name}.
156
+ *
157
+ * @param mixed $value Option value.
158
+ * @return mixed
159
+ */
160
+ function mts_wp_review_option_rating_icon( $value ) {
161
+ $value = 'fa fa-thumbs-up';
162
+ return $value;
163
+ }
164
+ add_filter( 'wp_review_option_rating_icon', 'mts_wp_review_option_rating_icon' );
165
+
166
+ /**
167
+ * Filters value of any options
168
+ *
169
+ * @param mixed $value Option value.
170
+ * @param string $option_name Option name.
171
+ * @return mixed
172
+ */
173
+ function mts_wp_review_option( $value, $option_name ) {
174
+ if ( 'rating_icon' == $option_name ) {
175
+ $value = 'fa fa-thumbs-up';
176
+ }
177
+ return $value;
178
+ }
179
+ add_filter( 'wp_review_option', 'mts_wp_review_option', 10, 2 );
180
+
181
+ /**
182
+ * Filters default review colors.
183
+ *
184
+ * @param array $colors Review colors.
185
+ * @return array
186
+ */
187
+ function mts_wp_review_default_colors( $colors ) {
188
+ $colors = array(
189
+ 'color' => '#1e73be',
190
+ 'inactive_color' => '',
191
+ 'fontcolor' => '#555555',
192
+ 'bgcolor1' => '#e7e7e7',
193
+ 'bgcolor2' => '#ffffff',
194
+ 'bordercolor' => '#e7e7e7',
195
+ );
196
+
197
+ return $colors;
198
+ }
199
+ add_filter( 'wp_review_default_colors', 'mts_wp_review_default_colors' );
200
+
201
+ /**
202
+ * Filters default location of review.
203
+ *
204
+ * @param string $location Review location.
205
+ * @return string
206
+ */
207
+ function mts_wp_review_default_location( $location ) {
208
+ $location = 'top'; // accepts 'top', 'bottom', 'custom'. Default is 'bottom'.
209
+
210
+ return $location;
211
+ }
212
+ add_filter( 'wp_review_default_location', 'mts_wp_review_default_location' );
213
+
214
+ /**
215
+ * Adds default items.
216
+ *
217
+ * @param array $items List of default items.
218
+ * @return array
219
+ */
220
+ function mts_add_default_items( $items ) {
221
+ $items = array(
222
+ __( 'Audio', 'theme-slug' ),
223
+ __( 'Visual', 'theme-slug' ),
224
+ __( 'UX', 'theme-slug' ),
225
+ __( 'Price', 'theme-slug' ),
226
+ );
227
+ return $items;
228
+ }
229
+ add_filter( 'wp_review_default_criteria', 'mts_add_default_items' );
230
+
231
+ /**
232
+ * Customizes wp_review_show_total() output.
233
+ *
234
+ * @param string $output The output.
235
+ * @param int $id Post ID.
236
+ * @param string $type Rating type.
237
+ * @param float $total Total value.
238
+ * @return string
239
+ */
240
+ function mts_wp_review_custom_review_total( $output, $id, $type, $total ) {
241
+ if ( get_the_title( $id ) == 'Special Post With Blue Rating' ) {
242
+ $color = '#0000FF';
243
+ $output = preg_replace( '/"review-type-[^"]+"/', '$0 style="background-color: ' . $color . ';"', $output );
244
+ }
245
+ return $output;
246
+ }
247
+ add_filter( 'wp_review_show_total', 'mts_wp_review_custom_review_total', 10, 4 );
248
+
249
+ /**
250
+ * Filters review total output.
251
+ *
252
+ * @param string $review Review total output.
253
+ * @param int $post_id Post ID.
254
+ * @param string $type Review type.
255
+ * @param float $total Review total value.
256
+ * @param string $class CSS class.
257
+ * @param array $args Custom arguments.
258
+ * @return string
259
+ */
260
+ function mts_wp_review_total_output( $review, $post_id, $type, $total, $class, $args ) {
261
+ $review = '<p>Total:</p>' . $review;
262
+ return $review;
263
+ }
264
+ add_filter( 'wp_review_total_output', 'mts_wp_review_total_output', 10, 6 );
265
+
266
+ /**
267
+ * Filters post review type.
268
+ *
269
+ * @param string $type Review type.
270
+ * @param int $post_id Post ID.
271
+ * @return string
272
+ */
273
+ function mts_wp_review_get_review_type( $type, $post_id ) {
274
+ $type = 'star'; // Force using star.
275
+ return $type;
276
+ }
277
+ add_filter( 'wp_review_get_review_type', 'mts_wp_review_get_review_type', 10, 2 );
278
+
279
+ /**
280
+ * Filters user review type.
281
+ *
282
+ * @param string $type Review type.
283
+ * @param int $post_id Post ID.
284
+ * @return string
285
+ */
286
+ function mts_wp_review_get_user_review_type( $type, $post_id ) {
287
+ $type = 'star'; // Force using star.
288
+ return $type;
289
+ }
290
+ add_filter( 'wp_review_get_user_review_type', 'mts_wp_review_get_user_review_type', 10, 2 );
291
+
292
+ /**
293
+ * Editing/overriding the review box template
294
+ *
295
+ * Create a 'wp-review' directory in your (child) theme folder,
296
+ * and make a copy there of /wp-review/box-templates/default.php
297
+ * to override it.
298
+ *
299
+ * Use different file name to add new template, which can be applied using filter:
300
+ *
301
+ */
302
+ function mts_wp_review_select_box_template( $template, $post_id ) {
303
+ // Change box template for specific post
304
+ if ( $post_id == '128' ) {
305
+ $template = 'new-box.php';
306
+ // "new-box.php" must be present in one of the template path folders (see below)
307
+ }
308
+ return $template;
309
+ }
310
+ add_filter( 'wp_review_get_box_template', 'mts_wp_review_select_box_template', 10, 2 );
311
+
312
+ /**
313
+ * Template Path Directories
314
+ *
315
+ * By default the plugin looks for box templates in:
316
+ * 1. wp-review/box-templates
317
+ * 2. theme_dir/wp-review
318
+ * 3. childtheme_dir/wp-review
319
+ * 4... Use filter to add more
320
+ *
321
+ */
322
+ function mts_wp_review_add_template_path( $paths ) {
323
+ // Add a new path where we look for review box template files
324
+ // The $paths holds default paths in reversed
325
+ $paths[] = '/absolute/path/to/additional/templates/dir';
326
+ return $paths;
327
+ }
328
+ add_filter( 'wp_review_box_template_paths', 'mts_wp_review_add_template_path' );
329
+
330
+ /**
331
+ * Filters review data. This data is passed to template.
332
+ *
333
+ * @param array $data Review data.
334
+ * @param array $args Custom arguments.
335
+ * @return array
336
+ */
337
+ function mts_wp_review_get_review_data( $data, $args ) {
338
+ $data['type'] = 'circle';
339
+ return $data;
340
+ }
341
+ add_filter( 'wp_review_get_review_data', 'mts_wp_review_get_review_data', 10, 2 );
342
+
343
+ /**
344
+ * Filters review box output.
345
+ *
346
+ * @param string $review Review box output.
347
+ * @param int $post_id Post ID.
348
+ * @param string $type Review type.
349
+ * @param float $total Review total.
350
+ * @param array $items Review items.
351
+ * @return string
352
+ */
353
+ function mts_wp_review_get_data( $review, $post_id, $type, $total, $items ) {
354
+ $review .= '<p>Custom content</p>';
355
+ return $review;
356
+ }
357
+ add_filter( 'wp_review_get_data', 'mts_wp_review_get_data', 10, 5 );
358
+
359
+ /**
360
+ * Changes reviewed item name.
361
+ *
362
+ * @param string $item_name Item name.
363
+ * @param array $review Review data.
364
+ * @return string
365
+ */
366
+ function mts_wp_review_get_reviewed_item_name( $item_name, $review ) {
367
+ // Modify the $item_name.
368
+ return $item_name;
369
+ }
370
+ add_filter( 'wp_review_get_reviewed_item_name', 'mts_wp_review_get_reviewed_item_name', 10, 2 );
371
+
372
+ /**
373
+ * Changes transient expired time.
374
+ *
375
+ * @param int $time Transient expired time.
376
+ * @return int
377
+ */
378
+ function mts_wp_review_transient_expired_time( $time ) {
379
+ $time = MONTH_IN_SECONDS;
380
+ return $time;
381
+ }
382
+ add_filter( 'wp_review_transient_expired_time', 'mts_wp_review_transient_expired_time' );
383
+
384
+ /**
385
+ * Filters reviews query args.
386
+ *
387
+ * @param array $query_args Query args.
388
+ * @param array $options Query options.
389
+ * @return array
390
+ */
391
+ function mts_wp_review_reviews_query_args( $query_args, $options ) {
392
+ $query_args['post_type'] = 'post'; // Only show post reviews.
393
+ return $query_args;
394
+ }
395
+ add_filter( 'wp_review_reviews_query_args', 'mts_wp_review_reviews_query_args' );
396
+
397
+ /**
398
+ * Hide selected review types in metabox dropdown.
399
+ *
400
+ * @deprecated 3.0.0 Now use `wp_review_rating_types` filter.
401
+ *
402
+ * @param array $types List of rating types.
403
+ * @return array
404
+ */
405
+ function mts_hide_review_types( $types ) {
406
+ unset( $types['point'], $types['percentage'] ); // remove types.
407
+ $types['star'] = __( 'Enable Reviews' ); // Change label.
408
+ return $types;
409
+ }
410
+ add_filter( 'wp_review_metabox_types', 'mts_hide_review_types' );
411
+
412
+ /**
413
+ * Add new rating types with wp_review_register_rating_type()
414
+ *
415
+ * Refer to existing rating template files, e.g.
416
+ * point-output.php, point-input.php
417
+ *
418
+ * This is an alternative way to add new rating type instead of using `wp_review_rating_types` hook.
419
+ */
420
+ function wp_review_register_additional_rating_types() {
421
+ wp_review_register_rating_type( 'star10', array(
422
+ 'label' => __( '10 Stars', 'wp-review' ),
423
+ 'max' => 10,
424
+ 'decimals' => 1,
425
+ 'value_text' => __( '%s Stars', 'wp-review' ),
426
+ 'value_text_singular' => __( '%s Star', 'wp-review' ),
427
+ 'input_template' => WP_REVIEW_DIR . 'rating-types/star10-input.php', // Replace with path to input template
428
+ 'output_template' => WP_REVIEW_DIR . 'rating-types/star10-output.php', // Replace with path to output template
429
+ ) );
430
+ }
431
+ add_action( 'init', 'wp_review_register_additional_rating_types' );
432
+
433
+ /**
434
+ * Adds new box template.
435
+ *
436
+ * @param array $templates Review box templates.
437
+ * @return array
438
+ */
439
+ function mts_wp_review_box_templates( $templates ) {
440
+ $templates['custom-template'] = array(
441
+ 'title' => __( 'Custom template', 'wp-review' ),
442
+ 'image' => WP_REVIEW_ASSETS . 'images/largethumb.png',
443
+ 'color' => '#1e73be',
444
+ 'fontcolor' => '#555',
445
+ 'bgcolor1' => '#e7e7e7',
446
+ 'bgcolor2' => '#fff',
447
+ 'bordercolor' => '#e7e7e7',
448
+ 'width' => 100, // In percentage.
449
+ 'align' => 'left',
450
+ 'custom_comment_colors' => 0,
451
+ 'comment_color' => '#ffb300',
452
+ 'rating_icon' => 'fa fa-star',
453
+ );
454
+ return $templates;
455
+ }
456
+ add_filter( 'wp_review_box_templates', 'mts_wp_review_box_templates' );
457
+
458
+
459
+ /**
460
+ * Changes the output of [wp-review] shortcode.
461
+ *
462
+ * @param string $output Shortcode output.
463
+ * @param array $atts Shortcode attributes.
464
+ * @return string
465
+ */
466
+ function mts_wp_review_shortcode( $output, $atts ) {
467
+ // Modify the output.
468
+ return $output;
469
+ }
470
+ add_filter( 'wp_review_shortcode', 'mts_wp_review_shortcode', 10, 2 );
471
+
472
+
473
+ /**
474
+ * Changes the output of [wp-review-total] shortcode.
475
+ *
476
+ * @param string $output Shortcode output.
477
+ * @param array $atts Shortcode attributes.
478
+ * @return string
479
+ */
480
+ function mts_wp_review_total_shortcode( $output, $atts ) {
481
+ // Modify the output.
482
+ return $output;
483
+ }
484
+ add_filter( 'wp_review_total_shortcode', 'mts_wp_review_total_shortcode', 10, 2 );
485
+
486
+
487
+ /**
488
+ * Changes the output of [wp-review-visitor-rating] shortcode.
489
+ *
490
+ * @param string $output Shortcode output.
491
+ * @param array $atts Shortcode attributes.
492
+ * @return string
493
+ */
494
+ function mts_wp_review_visitor_rating_shortcode( $output, $atts ) {
495
+ // Modify the output.
496
+ return $output;
497
+ }
498
+ add_filter( 'wp_review_visitor_rating_shortcode', 'mts_wp_review_visitor_rating_shortcode', 10, 2 );
499
+
500
+
501
+ /**
502
+ * Changes the output of [wp-review-comments-rating] shortcode.
503
+ *
504
+ * @param string $output Shortcode output.
505
+ * @param array $atts Shortcode attributes.
506
+ * @return string
507
+ */
508
+ function mts_wp_review_comments_rating_shortcode( $output, $atts ) {
509
+ // Modify the output.
510
+ return $output;
511
+ }
512
+ add_filter( 'wp_review_comments_rating_shortcode', 'mts_wp_review_comments_rating_shortcode', 10, 2 );
513
+
514
+
515
+ /**
516
+ * Changes the default length of review title in WP Review Widget.
517
+ *
518
+ * @param int $length Title length.
519
+ * @return int
520
+ */
521
+ function mts_wpt_title_length_default( $length ) {
522
+ $length = 10;
523
+ return $length;
524
+ }
525
+ add_filter( 'wpt_title_length_default', 'mts_wpt_title_length_default' );
526
+
527
+ printf( '<script type="application/ld+json">%s</script>', wp_json_encode( $markup ) );
528
+
529
+ // Set the review options in your theme
530
+ // These will be set as the global options for the plugin upon theme activation
531
+ $new_options = array(
532
+ 'colors' => array(
533
+ 'color' => '#dd3333',
534
+ 'inactive_color' => '#dd3333',
535
+ 'fontcolor' => '#555555',
536
+ 'bgcolor1' => '#e7e7e7',
537
+ 'bgcolor2' => '#ffffff',
538
+ 'bordercolor' => '#e7e7e7',
539
+ ),
540
+ );
541
+ if ( function_exists( 'wp_review_theme_defaults' ) ) {
542
+ wp_review_theme_defaults( $new_options );
543
+ }
includes/ajax.php CHANGED
@@ -1,432 +1,432 @@
1
- <?php
2
- /**
3
- * Ajax handles
4
- *
5
- * @package WP_Review
6
- * @since 3.0.0
7
- */
8
-
9
- /* Get review with Ajax */
10
-
11
- /* add_action('wp_ajax_mts_review_get_review', 'mts_review_get_review'); */
12
-
13
- /* add_action('wp_ajax_nopriv_mts_review_get_review', 'mts_review_get_review'); */
14
-
15
- add_action( 'wp_ajax_wp_review_rate', 'wp_review_ajax_rate' );
16
- add_action( 'wp_ajax_nopriv_wp_review_rate', 'wp_review_ajax_rate' );
17
-
18
- add_action( 'wp_ajax_wp_review_migrate_ratings', 'wp_review_ajax_migrate_ratings' );
19
-
20
- add_action( 'wp_ajax_wp-review-load-reviews', 'wp_review_ajax_load_reviews' );
21
- add_action( 'wp_ajax_nopriv_wp-review-load-reviews', 'wp_review_ajax_load_reviews' );
22
-
23
- add_action( 'wp_ajax_wpr-visitor-features-rating', 'wp_review_ajax_visitor_features_rating' );
24
- add_action( 'wp_ajax_nopriv_wpr-visitor-features-rating', 'wp_review_ajax_visitor_features_rating' );
25
-
26
- add_action( 'wp_ajax_wpr-purge-ratings', 'wp_review_ajax_purge_ratings' );
27
-
28
- add_action( 'wp_ajax_wpr-upload-comment-image', 'wp_review_upload_comment_image' );
29
- add_action( 'wp_ajax_nopriv_wpr-upload-comment-image', 'wp_review_upload_comment_image' );
30
-
31
- /**
32
- * Upload Comment Image with Ajax.
33
- */
34
- function wp_review_upload_comment_image() {
35
-
36
- $files = array_filter( $_FILES['files'] );
37
- $attachment_id = '';
38
- if ( ! empty( $files ) ) {
39
- $file_data['name'] = $files['name'][0];
40
- $file_data['type'] = $files['type'][0];
41
- $file_data['tmp_name'] = $files['tmp_name'][0];
42
- $file_data['error'] = $files['error'][0];
43
- $file_data['size'] = $files['size'][0];
44
-
45
- // These files need to be included as dependencies when on the front end.
46
- require_once ABSPATH . 'wp-admin/includes/image.php';
47
- require_once ABSPATH . 'wp-admin/includes/file.php';
48
- require_once ABSPATH . 'wp-admin/includes/media.php';
49
-
50
- $attachment_id = media_handle_sideload( $file_data, 0 );
51
- if ( is_wp_error( $attachment_id ) ) {
52
- $attachment_id = false;
53
- }
54
- }
55
- echo $attachment_id;
56
- die();
57
- }
58
-
59
- /**
60
- * Get review with Ajax.
61
- */
62
- function mts_review_get_review() {
63
- // Security.
64
- check_ajax_referer( 'wp-review-security', 'nonce' );
65
-
66
- $post_id = intval( $_POST['post_id'] );
67
- $user_id = is_user_logged_in() ? get_current_user_id() : 0;
68
- $review = round( abs( filter_input( INPUT_POST, 'review' ) ), 2 );
69
-
70
- $review_text = $review;
71
-
72
- $uip = wp_review_get_user_ip();
73
-
74
- if ( ! function_exists( 'wp_review_comment_duplicate_trigger' ) ) {
75
- /**
76
- * Shows comment duplicate message.
77
- */
78
- function wp_review_comment_duplicate_trigger() {
79
- echo 'MTS_REVIEW_DUP_ERROR';
80
- exit;
81
- }
82
- }
83
- add_action( 'comment_duplicate_trigger', 'wp_review_comment_duplicate_trigger' );
84
-
85
- if (
86
- $review > 0 &&
87
- ! wp_review_has_reviewed( $post_id, $user_id, $uip, WP_REVIEW_COMMENT_TYPE_VISITOR ) &&
88
- ( is_user_logged_in() || ! wp_review_option( 'registered_only' ) )
89
- ) {
90
- $insert = wp_insert_comment(
91
- array(
92
- 'user_id' => $user_id,
93
- 'comment_type' => WP_REVIEW_COMMENT_TYPE_VISITOR,
94
- 'comment_post_ID' => $post_id,
95
- 'comment_parent' => 0,
96
- 'comment_author_IP' => $uip,
97
- // translators: review text.
98
- 'comment_content' => sprintf( __( 'Visitor Rating: %s', 'wp-review' ), $review_text ),
99
- 'comment_agent' => isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '',
100
- 'comment_date' => current_time( 'mysql' ),
101
- 'comment_date_gmt' => current_time( 'mysql', 1 ),
102
- 'comment_approved' => 1,
103
- )
104
- );
105
-
106
- if ( $insert ) {
107
- if ( update_comment_meta( $insert, WP_REVIEW_VISITOR_RATING_METAKEY, $review ) ) {
108
- $post_reviews = mts_get_post_reviews( $post_id, true );
109
-
110
- echo $post_reviews['rating'] . '|' . $post_reviews['count'];
111
- exit;
112
- } else {
113
- wp_delete_comment( $insert );
114
- }
115
- }
116
- }
117
-
118
- echo 'MTS_REVIEW_DB_ERROR';
119
- exit;
120
- }
121
-
122
-
123
- /**
124
- * AJAX User review rating
125
- * Replaces mts_review_get_review().
126
- */
127
- function wp_review_ajax_rate() {
128
- check_ajax_referer( 'wp-review-security', 'nonce' );
129
- $post_id = intval( $_POST['post_id'] );
130
- $review = filter_input( INPUT_POST, 'review' );
131
- $review = round( $review, 2 );
132
- $review_data = array(
133
- 'total' => $review,
134
- );
135
- wp_review_visitor_rate( $post_id, $review_data );
136
- exit;
137
- }
138
-
139
-
140
- /**
141
- * Migrates ratings.
142
- */
143
- function wp_review_ajax_migrate_ratings() {
144
- $start = isset( $_POST['start'] ) ? intval( $_POST['start'] ) : 0;
145
- $limit = 100;
146
-
147
- if ( get_option( 'wp_review_has_migrated', false ) ) {
148
- return;
149
- }
150
-
151
- global $wpdb;
152
-
153
- $current_blog_id = get_current_blog_id();
154
-
155
- $query = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->base_prefix . 'mts_wp_reviews WHERE blog_id = ' . $current_blog_id . ' LIMIT ' . $limit . ' OFFSET ' . $start ); // WPCS: unprepared SQL ok.
156
-
157
- foreach ( $query as $review ) {
158
-
159
- if ( 0 == $review->rate ) {
160
- continue; // Skip 0-star ratings.
161
- }
162
-
163
- $insert = wp_insert_comment(
164
- array(
165
- 'user_id' => $review->user_id,
166
- 'comment_type' => WP_REVIEW_COMMENT_TYPE_VISITOR,
167
- 'comment_post_ID' => $review->post_id,
168
- 'comment_parent' => 0,
169
- 'comment_content' => sprintf(
170
- // translators: visitors rating.
171
- __( 'Visitor Rating: %s', 'wp-review' ),
172
- sprintf(
173
- // translators: review rate.
174
- __( '%s Stars', 'wp-review' ),
175
- $review->rate
176
- )
177
- ),
178
- 'comment_author_IP' => $review->user_ip,
179
- 'comment_date' => gmdate( 'Y-m-d H:i:s', ( strtotime( $review->date ) + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) ),
180
- 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', strtotime( $review->date ) ),
181
- 'comment_approved' => 1,
182
- )
183
- );
184
-
185
- if ( $insert ) {
186
- if ( update_comment_meta( $insert, WP_REVIEW_VISITOR_RATING_METAKEY, $review->rate ) ) {
187
- // Purge cache.
188
- mts_get_post_reviews( $review->post_id, true );
189
- } else {
190
- wp_delete_comment( $insert );
191
- }
192
- }
193
- }
194
-
195
- $end = $start + count( $query ); // $wpdb->num_rows;
196
- // $migrated_rows = get_option( 'wp_review_migrated_rows', 0 );
197
- update_option( 'wp_review_migrated_rows', $end );
198
-
199
- $total_rows = $wpdb->get_var( 'SELECT COUNT(*) FROM ' . $wpdb->base_prefix . 'mts_wp_reviews WHERE blog_id = ' . $current_blog_id ); // WPCS: unprepared SQL ok.
200
- $migration_finished = 0;
201
- if ( $total_rows == $end ) {
202
- update_option( 'wp_review_has_migrated', 1 );
203
- $migration_finished = 1;
204
- }
205
-
206
- echo wp_json_encode(
207
- array(
208
- 'start' => $start,
209
- 'lastrow' => $end,
210
- 'rowsleft' => $total_rows - $end,
211
- 'finished' => $migration_finished,
212
- )
213
- );
214
-
215
- die();
216
- }
217
-
218
-
219
- /**
220
- * Ajax handle for loading reviews.
221
- */
222
- function wp_review_ajax_load_reviews() {
223
- $options = $_POST; // WPCS: csrf ok.
224
-
225
- // Options are same as widgets args to keep compatibility.
226
- $options = wp_parse_args(
227
- $options,
228
- array(
229
- 'post_num' => 5,
230
- 'page' => 1,
231
- 'review_type' => '',
232
- 'thumb_size' => 'small',
233
- 'cat' => '',
234
- 'number_of_days' => '',
235
- )
236
- );
237
-
238
- $type = ! empty( $options['_type'] ) ? $options['_type'] : 'recent';
239
-
240
- $query = wp_review_get_reviews_query( $type, $options );
241
-
242
- if ( ! $query->have_posts() ) {
243
- wp_send_json_success( '' );
244
- }
245
-
246
- $page = ! empty( $options['page'] ) ? intval( $options['page'] ) : 1;
247
- $last_page = $query->max_num_pages;
248
- $in_widget = ! empty( $options['widget_id'] );
249
- $GLOBALS['in_widget'] = $in_widget;
250
-
251
- ob_start();
252
- echo '<ul>';
253
- while ( $query->have_posts() ) {
254
- $query->the_post();
255
- $classes = array( 'thumbnail' );
256
- $classes[] = 'thumb_' . $options['thumb_size'];
257
- if ( ! has_post_thumbnail() ) {
258
- $classes[] = 'wp-review-no-thumbnail';
259
- }
260
- $classes = implode( ' ', $classes );
261
- ?>
262
- <li class="item">
263
- <a title="<?php the_title(); ?>" rel="nofollow" href="<?php the_permalink(); ?>">
264
- <div class="<?php echo esc_attr( $classes ); ?>">
265
- <?php if ( has_post_thumbnail() ) : ?>
266
- <?php the_post_thumbnail( 'wp_review_' . $options['thumb_size'] ); ?>
267
- <?php else : ?>
268
- <img src="<?php echo esc_url( WP_REVIEW_ASSETS . 'images/' . $options['thumb_size'] . 'thumb.png' ); ?>" alt="<?php the_title(); ?>" class="wp-post-image">
269
- <?php endif; ?>
270
- </div>
271
- </a>
272
- <div class="title-right">
273
- <div class="entry-title">
274
- <a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>">
275
- <?php
276
- if ( $options['title_length'] ) {
277
- echo esc_html( wp_trim_words( get_the_title(), $options['title_length'], '&hellip;' ) );
278
- } else {
279
- the_title();
280
- }
281
- ?>
282
- </a>
283
- <div class="review-count">
284
- <?php
285
- if ( $in_widget ) {
286
- $args = array(
287
- 'in_widget' => $in_widget,
288
- 'color' => '#fff',
289
- 'inactive_color' => '#dedcdc',
290
- );
291
- } else {
292
- $args = array();
293
- }
294
- wp_review_show_total( true, 'review-total-only ' . $options['thumb_size'] . '-thumb', null, $args );
295
- ?>
296
- </div>
297
-
298
- <?php wp_review_extra_info( get_the_ID(), intval( $options['show_date'] ) ); // Using `show_date` to keep compatibility. ?>
299
- </div>
300
- </div>
301
- </li>
302
- <?php
303
- }
304
- echo '</ul><!-- End Reviews -->';
305
- wp_reset_postdata();
306
-
307
- if ( intval( $options['allow_pagination'] ) && -1 != $options['post_num'] ) {
308
- wp_review_ajax_pagination( $page, $last_page );
309
- }
310
- $output = ob_get_clean();
311
- unset( $GLOBALS['in_widget'] );
312
-
313
- wp_send_json_success( $output );
314
- }
315
-
316
-
317
- /**
318
- * Shows review extra information like post date, reviews count.
319
- *
320
- * @since 3.0.8
321
- *
322
- * @param int $post_id Post ID.
323
- * @param int $extra_info Extra info. 1 for date, 2 for reviews count, 0 for none.
324
- * @param array $args Custom args.
325
- */
326
- function wp_review_extra_info( $post_id, $extra_info, array $args = array() ) {
327
- if ( ! $extra_info ) {
328
- return;
329
- }
330
-
331
- $args = wp_parse_args(
332
- $args,
333
- array(
334
- 'class' => 'postmeta',
335
- 'date_format' => get_option( 'date_format' ),
336
- )
337
- );
338
-
339
- if ( 1 === $extra_info ) {
340
- ?>
341
- <div class="<?php echo esc_attr( $args['class'] ); ?>">
342
- <?php the_time( $args['date_format'] ); // Hard coded to prevent styling issue. ?>
343
- </div> <!-- End .<?php echo esc_attr( $args['class'] ); ?>-->
344
- <?php
345
- return;
346
- }
347
-
348
- $post_reviews = mts_get_post_reviews( $post_id );
349
- ?>
350
- <div class="<?php echo esc_attr( $args['class'] ); ?>">
351
- <?php
352
- if ( ! $post_reviews['count'] ) {
353
- // translators: number of reviews.
354
- printf( __( '%s review', 'wp-review' ), 0 );
355
- } else {
356
- // translators: number of reviews.
357
- printf( _n( '%s review', '%s reviews', $post_reviews['count'], 'wp-review' ), $post_reviews['count'] );
358
- }
359
- ?>
360
- </div> <!-- End .<?php echo esc_attr( $args['class'] ); ?>-->
361
- <?php
362
- }
363
-
364
-
365
- /**
366
- * Ajax handler for visitor features rating.
367
- *
368
- * @since 3.0.0
369
- */
370
- function wp_review_ajax_visitor_features_rating() {
371
- check_ajax_referer( 'wpr_user_features_rating', 'nonce' );
372
- if ( empty( $_POST['post_id'] ) ) {
373
- wp_send_json_error( __( 'Empty post ID', 'wp-review' ) );
374
- }
375
- if ( empty( $_POST['rating'] ) ) {
376
- wp_send_json_error( __( 'Empty rating data', 'wp-review' ) );
377
- }
378
- if ( empty( $_POST['type'] ) ) {
379
- wp_send_json_error( __( 'Empty type data', 'wp-review' ) );
380
- }
381
- $post_id = intval( $_POST['post_id'] );
382
- $rating = $_POST['rating']; // WPCS: sanitization ok.
383
- $type = wp_kses( wp_unslash( $_POST['type'] ), array() );
384
-
385
- $total = 0;
386
- $count = 0;
387
- foreach ( $rating as $value ) {
388
- $total += $value;
389
- $count++;
390
- }
391
-
392
- $review_data = array(
393
- 'total' => $total / $count,
394
- 'type' => $type,
395
- 'features' => $rating,
396
- );
397
- wp_review_visitor_rate( $post_id, $review_data );
398
- }
399
-
400
-
401
- /**
402
- * Ajax handler for purging ratings.
403
- *
404
- * @since 3.0.0
405
- */
406
- function wp_review_ajax_purge_ratings() {
407
- check_ajax_referer( 'wpr_purge_ratings', 'nonce' );
408
- $query_args = array();
409
- if ( ! empty( $_POST['type'] ) ) {
410
- $query_args['type'] = 'visitor' === $_POST['type'] ? WP_REVIEW_COMMENT_TYPE_VISITOR : WP_REVIEW_COMMENT_TYPE_COMMENT;
411
- } else {
412
- $query_args['type_in'] = array( WP_REVIEW_COMMENT_TYPE_VISITOR, WP_REVIEW_COMMENT_TYPE_COMMENT );
413
- }
414
- if ( ! empty( $_POST['postId'] ) ) {
415
- $query_args['post_id'] = intval( $_POST['postId'] );
416
- }
417
- $comments = get_comments( $query_args );
418
- if ( ! $comments ) {
419
- wp_send_json_success( esc_html__( 'Completed!', 'wp-review' ) );
420
- }
421
-
422
- $processed = array();
423
- foreach ( $comments as $comment ) {
424
- wp_delete_comment( $comment->comment_ID, false );
425
- if ( in_array( $comment->comment_post_ID, $processed ) ) {
426
- continue;
427
- }
428
- wp_review_clear_cached_reviews( $comment );
429
- $processed[] = $comment->comment_post_ID;
430
- }
431
- wp_send_json_success( esc_html__( 'Completed!', 'wp-review' ) );
432
- }
1
+ <?php
2
+ /**
3
+ * Ajax handles
4
+ *
5
+ * @package WP_Review
6
+ * @since 3.0.0
7
+ */
8
+
9
+ /* Get review with Ajax */
10
+
11
+ /* add_action('wp_ajax_mts_review_get_review', 'mts_review_get_review'); */
12
+
13
+ /* add_action('wp_ajax_nopriv_mts_review_get_review', 'mts_review_get_review'); */
14
+
15
+ add_action( 'wp_ajax_wp_review_rate', 'wp_review_ajax_rate' );
16
+ add_action( 'wp_ajax_nopriv_wp_review_rate', 'wp_review_ajax_rate' );
17
+
18
+ add_action( 'wp_ajax_wp_review_migrate_ratings', 'wp_review_ajax_migrate_ratings' );
19
+
20
+ add_action( 'wp_ajax_wp-review-load-reviews', 'wp_review_ajax_load_reviews' );
21
+ add_action( 'wp_ajax_nopriv_wp-review-load-reviews', 'wp_review_ajax_load_reviews' );
22
+
23
+ add_action( 'wp_ajax_wpr-visitor-features-rating', 'wp_review_ajax_visitor_features_rating' );
24
+ add_action( 'wp_ajax_nopriv_wpr-visitor-features-rating', 'wp_review_ajax_visitor_features_rating' );
25
+
26
+ add_action( 'wp_ajax_wpr-purge-ratings', 'wp_review_ajax_purge_ratings' );
27
+
28
+ add_action( 'wp_ajax_wpr-upload-comment-image', 'wp_review_upload_comment_image' );
29
+ add_action( 'wp_ajax_nopriv_wpr-upload-comment-image', 'wp_review_upload_comment_image' );
30
+
31
+ /**
32
+ * Upload Comment Image with Ajax.
33
+ */
34
+ function wp_review_upload_comment_image() {
35
+
36
+ $files = array_filter( $_FILES['files'] );
37
+ $attachment_id = '';
38
+ if ( ! empty( $files ) ) {
39
+ $file_data['name'] = $files['name'][0];
40
+ $file_data['type'] = $files['type'][0];
41
+ $file_data['tmp_name'] = $files['tmp_name'][0];
42
+ $file_data['error'] = $files['error'][0];
43
+ $file_data['size'] = $files['size'][0];
44
+
45
+ // These files need to be included as dependencies when on the front end.
46
+ require_once ABSPATH . 'wp-admin/includes/image.php';
47
+ require_once ABSPATH . 'wp-admin/includes/file.php';
48
+ require_once ABSPATH . 'wp-admin/includes/media.php';
49
+
50
+ $attachment_id = media_handle_sideload( $file_data, 0 );
51
+ if ( is_wp_error( $attachment_id ) ) {
52
+ $attachment_id = false;
53
+ }
54
+ }
55
+ echo $attachment_id;
56
+ die();
57
+ }
58
+
59
+ /**
60
+ * Get review with Ajax.
61
+ */
62
+ function mts_review_get_review() {
63
+ // Security.
64
+ check_ajax_referer( 'wp-review-security', 'nonce' );
65
+
66
+ $post_id = intval( $_POST['post_id'] );
67
+ $user_id = is_user_logged_in() ? get_current_user_id() : 0;
68
+ $review = round( abs( filter_input( INPUT_POST, 'review' ) ), 2 );
69
+
70
+ $review_text = $review;
71
+
72
+ $uip = wp_review_get_user_ip();
73
+
74
+ if ( ! function_exists( 'wp_review_comment_duplicate_trigger' ) ) {
75
+ /**
76
+ * Shows comment duplicate message.
77
+ */
78
+ function wp_review_comment_duplicate_trigger() {
79
+ echo 'MTS_REVIEW_DUP_ERROR';
80
+ exit;
81
+ }
82
+ }
83
+ add_action( 'comment_duplicate_trigger', 'wp_review_comment_duplicate_trigger' );
84
+
85
+ if (
86
+ $review > 0 &&
87
+ ! wp_review_has_reviewed( $post_id, $user_id, $uip, WP_REVIEW_COMMENT_TYPE_VISITOR ) &&
88
+ ( is_user_logged_in() || ! wp_review_option( 'registered_only' ) )
89
+ ) {
90
+ $insert = wp_insert_comment(
91
+ array(
92
+ 'user_id' => $user_id,
93
+ 'comment_type' => WP_REVIEW_COMMENT_TYPE_VISITOR,
94
+ 'comment_post_ID' => $post_id,
95
+ 'comment_parent' => 0,
96
+ 'comment_author_IP' => $uip,
97
+ // translators: review text.
98
+ 'comment_content' => sprintf( __( 'Visitor Rating: %s', 'wp-review' ), $review_text ),
99
+ 'comment_agent' => isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '',
100
+ 'comment_date' => current_time( 'mysql' ),
101
+ 'comment_date_gmt' => current_time( 'mysql', 1 ),
102
+ 'comment_approved' => 1,
103
+ )
104
+ );
105
+
106
+ if ( $insert ) {
107
+ if ( update_comment_meta( $insert, WP_REVIEW_VISITOR_RATING_METAKEY, $review ) ) {
108
+ $post_reviews = mts_get_post_reviews( $post_id, true );
109
+
110
+ echo $post_reviews['rating'] . '|' . $post_reviews['count'];
111
+ exit;
112
+ } else {
113
+ wp_delete_comment( $insert );
114
+ }
115
+ }
116
+ }
117
+
118
+ echo 'MTS_REVIEW_DB_ERROR';
119
+ exit;
120
+ }
121
+
122
+
123
+ /**
124
+ * AJAX User review rating
125
+ * Replaces mts_review_get_review().
126
+ */
127
+ function wp_review_ajax_rate() {
128
+ check_ajax_referer( 'wp-review-security', 'nonce' );
129
+ $post_id = intval( $_POST['post_id'] );
130
+ $review = filter_input( INPUT_POST, 'review' );
131
+ $review = round( $review, 2 );
132
+ $review_data = array(
133
+ 'total' => $review,
134
+ );
135
+ wp_review_visitor_rate( $post_id, $review_data );
136
+ exit;
137
+ }
138
+
139
+
140
+ /**
141
+ * Migrates ratings.
142
+ */
143
+ function wp_review_ajax_migrate_ratings() {
144
+ $start = isset( $_POST['start'] ) ? intval( $_POST['start'] ) : 0;
145
+ $limit = 100;
146
+
147
+ if ( get_option( 'wp_review_has_migrated', false ) ) {
148
+ return;
149
+ }
150
+
151
+ global $wpdb;
152
+
153
+ $current_blog_id = get_current_blog_id();
154
+
155
+ $query = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->base_prefix . 'mts_wp_reviews WHERE blog_id = ' . $current_blog_id . ' LIMIT ' . $limit . ' OFFSET ' . $start ); // WPCS: unprepared SQL ok.
156
+
157
+ foreach ( $query as $review ) {
158
+
159
+ if ( 0 == $review->rate ) {
160
+ continue; // Skip 0-star ratings.
161
+ }
162
+
163
+ $insert = wp_insert_comment(
164
+ array(
165
+ 'user_id' => $review->user_id,
166
+ 'comment_type' => WP_REVIEW_COMMENT_TYPE_VISITOR,
167
+ 'comment_post_ID' => $review->post_id,
168
+ 'comment_parent' => 0,
169
+ 'comment_content' => sprintf(
170
+ // translators: visitors rating.
171
+ __( 'Visitor Rating: %s', 'wp-review' ),
172
+ sprintf(
173
+ // translators: review rate.
174
+ __( '%s Stars', 'wp-review' ),
175
+ $review->rate
176
+ )
177
+ ),
178
+ 'comment_author_IP' => $review->user_ip,
179
+ 'comment_date' => gmdate( 'Y-m-d H:i:s', ( strtotime( $review->date ) + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) ),
180
+ 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', strtotime( $review->date ) ),
181
+ 'comment_approved' => 1,
182
+ )
183
+ );
184
+
185
+ if ( $insert ) {
186
+ if ( update_comment_meta( $insert, WP_REVIEW_VISITOR_RATING_METAKEY, $review->rate ) ) {
187
+ // Purge cache.
188
+ mts_get_post_reviews( $review->post_id, true );
189
+ } else {
190
+ wp_delete_comment( $insert );
191
+ }
192
+ }
193
+ }
194
+
195
+ $end = $start + count( $query ); // $wpdb->num_rows;
196
+ // $migrated_rows = get_option( 'wp_review_migrated_rows', 0 );
197
+ update_option( 'wp_review_migrated_rows', $end );
198
+
199
+ $total_rows = $wpdb->get_var( 'SELECT COUNT(*) FROM ' . $wpdb->base_prefix . 'mts_wp_reviews WHERE blog_id = ' . $current_blog_id ); // WPCS: unprepared SQL ok.
200
+ $migration_finished = 0;
201
+ if ( $total_rows == $end ) {
202
+ update_option( 'wp_review_has_migrated', 1 );
203
+ $migration_finished = 1;
204
+ }
205
+
206
+ echo wp_json_encode(
207
+ array(
208
+ 'start' => $start,
209
+ 'lastrow' => $end,
210
+ 'rowsleft' => $total_rows - $end,
211
+ 'finished' => $migration_finished,
212
+ )
213
+ );
214
+
215
+ die();
216
+ }
217
+
218
+
219
+ /**
220
+ * Ajax handle for loading reviews.
221
+ */
222
+ function wp_review_ajax_load_reviews() {
223
+ $options = $_POST; // WPCS: csrf ok.
224
+
225
+ // Options are same as widgets args to keep compatibility.
226
+ $options = wp_parse_args(
227
+ $options,
228
+ array(
229
+ 'post_num' => 5,
230
+ 'page' => 1,
231
+ 'review_type' => '',
232
+ 'thumb_size' => 'small',
233
+ 'cat' => '',
234
+ 'number_of_days' => '',
235
+ )
236
+ );
237
+
238
+ $type = ! empty( $options['_type'] ) ? $options['_type'] : 'recent';
239
+
240
+ $query = wp_review_get_reviews_query( $type, $options );
241
+
242
+ if ( ! $query->have_posts() ) {
243
+ wp_send_json_success( '' );
244
+ }
245
+
246
+ $page = ! empty( $options['page'] ) ? intval( $options['page'] ) : 1;
247
+ $last_page = $query->max_num_pages;
248
+ $in_widget = ! empty( $options['widget_id'] );
249
+ $GLOBALS['in_widget'] = $in_widget;
250
+
251
+ ob_start();
252
+ echo '<ul>';
253
+ while ( $query->have_posts() ) {
254
+ $query->the_post();
255
+ $classes = array( 'thumbnail' );
256
+ $classes[] = 'thumb_' . $options['thumb_size'];
257
+ if ( ! has_post_thumbnail() ) {
258
+ $classes[] = 'wp-review-no-thumbnail';
259
+ }
260
+ $classes = implode( ' ', $classes );
261
+ ?>
262
+ <li class="item">
263
+ <a title="<?php the_title(); ?>" rel="nofollow" href="<?php the_permalink(); ?>">
264
+ <div class="<?php echo esc_attr( $classes ); ?>">
265
+ <?php if ( has_post_thumbnail() ) : ?>
266
+ <?php the_post_thumbnail( 'wp_review_' . $options['thumb_size'] ); ?>
267
+ <?php else : ?>
268
+ <img src="<?php echo esc_url( WP_REVIEW_ASSETS . 'images/' . $options['thumb_size'] . 'thumb.png' ); ?>" alt="<?php the_title(); ?>" class="wp-post-image">
269
+ <?php endif; ?>
270
+ </div>
271
+ </a>
272
+ <div class="title-right">
273
+ <div class="entry-title">
274
+ <a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>">
275
+ <?php
276
+ if ( $options['title_length'] ) {
277
+ echo esc_html( wp_trim_words( get_the_title(), $options['title_length'], '&hellip;' ) );
278
+ } else {
279
+ the_title();
280
+ }
281
+ ?>
282
+ </a>
283
+ <div class="review-count">
284
+ <?php
285
+ if ( $in_widget ) {
286
+ $args = array(
287
+ 'in_widget' => $in_widget,
288
+ 'color' => '#fff',
289
+ 'inactive_color' => '#dedcdc',
290
+ );
291
+ } else {
292
+ $args = array();
293
+ }
294
+ wp_review_show_total( true, 'review-total-only ' . $options['thumb_size'] . '-thumb', null, $args );
295
+ ?>
296
+ </div>
297
+
298
+ <?php wp_review_extra_info( get_the_ID(), intval( $options['show_date'] ) ); // Using `show_date` to keep compatibility. ?>
299
+ </div>
300
+ </div>
301
+ </li>
302
+ <?php
303
+ }
304
+ echo '</ul><!-- End Reviews -->';
305
+ wp_reset_postdata();
306
+
307
+ if ( intval( $options['allow_pagination'] ) && -1 != $options['post_num'] ) {
308
+ wp_review_ajax_pagination( $page, $last_page );
309
+ }
310
+ $output = ob_get_clean();
311
+ unset( $GLOBALS['in_widget'] );
312
+
313
+ wp_send_json_success( $output );
314
+ }
315
+
316
+
317
+ /**
318
+ * Shows review extra information like post date, reviews count.
319
+ *
320
+ * @since 3.0.8
321
+ *
322
+ * @param int $post_id Post ID.
323
+ * @param int $extra_info Extra info. 1 for date, 2 for reviews count, 0 for none.
324
+ * @param array $args Custom args.
325
+ */
326
+ function wp_review_extra_info( $post_id, $extra_info, array $args = array() ) {
327
+ if ( ! $extra_info ) {
328
+ return;
329
+ }
330
+
331
+ $args = wp_parse_args(
332
+ $args,
333
+ array(
334
+ 'class' => 'postmeta',
335
+ 'date_format' => get_option( 'date_format' ),
336
+ )
337
+ );
338
+
339
+ if ( 1 === $extra_info ) {
340
+ ?>
341
+ <div class="<?php echo esc_attr( $args['class'] ); ?>">
342
+ <?php the_time( $args['date_format'] ); // Hard coded to prevent styling issue. ?>
343
+ </div> <!-- End .<?php echo esc_attr( $args['class'] ); ?>-->
344
+ <?php
345
+ return;
346
+ }
347
+
348
+ $post_reviews = mts_get_post_reviews( $post_id );
349
+ ?>
350
+ <div class="<?php echo esc_attr( $args['class'] ); ?>">
351
+ <?php
352
+ if ( ! $post_reviews['count'] ) {
353
+ // translators: number of reviews.
354
+ printf( __( '%s review', 'wp-review' ), 0 );
355
+ } else {
356
+ // translators: number of reviews.
357
+ printf( _n( '%s review', '%s reviews', $post_reviews['count'], 'wp-review' ), $post_reviews['count'] );
358
+ }
359
+ ?>
360
+ </div> <!-- End .<?php echo esc_attr( $args['class'] ); ?>-->
361
+ <?php
362
+ }
363
+
364
+
365
+ /**
366
+ * Ajax handler for visitor features rating.
367
+ *
368
+ * @since 3.0.0
369
+ */
370
+ function wp_review_ajax_visitor_features_rating() {
371
+ check_ajax_referer( 'wpr_user_features_rating', 'nonce' );
372
+ if ( empty( $_POST['post_id'] ) ) {
373
+ wp_send_json_error( __( 'Empty post ID', 'wp-review' ) );
374
+ }
375
+ if ( empty( $_POST['rating'] ) ) {
376
+ wp_send_json_error( __( 'Empty rating data', 'wp-review' ) );
377
+ }
378
+ if ( empty( $_POST['type'] ) ) {
379
+ wp_send_json_error( __( 'Empty type data', 'wp-review' ) );
380
+ }
381
+ $post_id = intval( $_POST['post_id'] );
382
+ $rating = $_POST['rating']; // WPCS: sanitization ok.
383
+ $type = wp_kses( wp_unslash( $_POST['type'] ), array() );
384
+
385
+ $total = 0;
386
+ $count = 0;
387
+ foreach ( $rating as $value ) {
388
+ $total += $value;
389
+ $count++;
390
+ }
391
+
392
+ $review_data = array(
393
+ 'total' => $total / $count,
394
+ 'type' => $type,
395
+ 'features' => $rating,
396
+ );
397
+ wp_review_visitor_rate( $post_id, $review_data );
398
+ }
399
+
400
+
401
+ /**
402
+ * Ajax handler for purging ratings.
403
+ *
404
+ * @since 3.0.0
405
+ */
406
+ function wp_review_ajax_purge_ratings() {
407
+ check_ajax_referer( 'wpr_purge_ratings', 'nonce' );
408
+ $query_args = array();
409
+ if ( ! empty( $_POST['type'] ) ) {
410
+ $query_args['type'] = 'visitor' === $_POST['type'] ? WP_REVIEW_COMMENT_TYPE_VISITOR : WP_REVIEW_COMMENT_TYPE_COMMENT;
411
+ } else {
412
+ $query_args['type_in'] = array( WP_REVIEW_COMMENT_TYPE_VISITOR, WP_REVIEW_COMMENT_TYPE_COMMENT );
413
+ }
414
+ if ( ! empty( $_POST['postId'] ) ) {
415
+ $query_args['post_id'] = intval( $_POST['postId'] );
416
+ }
417
+ $comments = get_comments( $query_args );
418
+ if ( ! $comments ) {
419
+ wp_send_json_success( esc_html__( 'Completed!', 'wp-review' ) );
420
+ }
421
+
422
+ $processed = array();
423
+ foreach ( $comments as $comment ) {
424
+ wp_delete_comment( $comment->comment_ID, false );
425
+ if ( in_array( $comment->comment_post_ID, $processed ) ) {
426
+ continue;
427
+ }
428
+ wp_review_clear_cached_reviews( $comment );
429
+ $processed[] = $comment->comment_post_ID;
430
+ }
431
+ wp_send_json_success( esc_html__( 'Completed!', 'wp-review' ) );
432
+ }
includes/comments.php CHANGED
@@ -1,376 +1,376 @@
1
- <?php
2
- /**
3
- * Comments related functions
4
- *
5
- * @package WP_Review
6
- */
7
-
8
- /**
9
- * Overrides comments count.
10
- */
11
- function wp_review_override_comments_count() {
12
- remove_filter( 'get_comments_number', 'mts_comment_count', 0 );
13
- add_filter( 'get_comments_number', 'wp_review_comment_count', 0 );
14
- }
15
- add_action( 'after_setup_theme', 'wp_review_override_comments_count', 30 );
16
-
17
- /**
18
- * Filters comment count.
19
- *
20
- * @param int $count Comment count.
21
- * @return int
22
- */
23
- function wp_review_comment_count( $count ) {
24
- if ( ! is_admin() ) {
25
- $comments = get_comments( 'status=approve&post_id=' . get_the_ID() );
26
- $comments_by_type = separate_comments( $comments );
27
- if ( isset( $comments_by_type['comment'] ) ) {
28
- $wp_review_comments_count = isset( $comments_by_type['wp_review_comment'] ) ? count( $comments_by_type['wp_review_comment'] ) : 0;
29
- return count( $comments_by_type['comment'] ) + $wp_review_comments_count;
30
- } else {
31
- return $count;
32
- }
33
- }
34
-
35
- return $count;
36
- }
37
-
38
-
39
- /**
40
- * Add the title to our admin area, for editing, etc
41
- */
42
- function wp_review_comment_add_meta_box() {
43
- global $wp_review_rating_types, $comment;
44
- $type = wp_review_get_post_user_review_type( $comment->comment_post_ID );
45
- if ( ! $type ) {
46
- $type = 'star';
47
- }
48
- add_meta_box(
49
- 'wp-review-comment-rating',
50
- // translators: rating label.
51
- sprintf( __( 'WP Review Rating (%s)', 'wp-review' ), $wp_review_rating_types[ $type ]['label'] ),
52
- 'wp_review_comment_meta_box_fields',
53
- 'comment',
54
- 'normal',
55
- 'high'
56
- );
57
- }
58
- add_action( 'add_meta_boxes_comment', 'wp_review_comment_add_meta_box' );
59
-
60
- /**
61
- * Shows comment meta box fields.
62
- *
63
- * @param object $comment Comment object.
64
- */
65
- function wp_review_comment_meta_box_fields( $comment ) {
66
- $comment_id = $comment->comment_ID;
67
- if ( WP_REVIEW_COMMENT_TYPE_COMMENT === get_comment_type( $comment_id ) ) {
68
- $rating = get_comment_meta( $comment_id, WP_REVIEW_COMMENT_RATING_METAKEY, true );
69
- } else {
70
- $rating = get_comment_meta( $comment_id, WP_REVIEW_VISITOR_RATING_METAKEY, true );
71
- }
72
- $title = get_comment_meta( $comment_id, WP_REVIEW_COMMENT_TITLE_METAKEY, true );
73
- $rating_items = get_comment_meta( $comment_id, WP_REVIEW_COMMENT_FEATURES_RATING_METAKEY, true );
74
- wp_nonce_field( 'wp_review_comment_rating_update', 'wp_review_comment_rating_update', false );
75
- ?>
76
- <div class="wp-review-field">
77
- <div class="wp-review-field-label">
78
- <label for="wp_review_comment_rating"><?php esc_html_e( 'Review total', 'wp-review' ); ?></label>
79
- </div>
80
- <div class="wp-review-field-option">
81
- <input type="text" class="small-text" name="wp_review_comment_rating" value="<?php echo esc_attr( $rating ); ?>" id="wp_review_comment_rating">
82
- </div>
83
- </div>
84
-
85
- <?php
86
- if ( ! empty( $rating_items ) ) :
87
- $items = wp_review_get_review_items( $comment->comment_post_ID );
88
- foreach ( $items as $item_id => $item ) :
89
- $value = ! empty( $rating_items[ $item_id ] ) ? $rating_items[ $item_id ] : 0;
90
- ?>
91
- <div class="wp-review-field">
92
- <div class="wp-review-field-label">
93
- <label for="wp_review_comment_rating_item-<?php echo esc_attr( $item_id ); ?>"><?php echo esc_html( $item['wp_review_item_title'] ); ?></label>
94
- </div>
95
- <div class="wp-review-field-option">
96
- <input type="text" class="small-text" name="wp-review-comment-feature-rating[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( $value ); ?>" id="wp_review_comment_rating_item-<?php echo esc_attr( $item_id ); ?>">
97
- </div>
98
- </div>
99
- <?php endforeach; ?>
100
- <?php endif; ?>
101
-
102
- <?php
103
- $comment_qualifier = get_comment_meta( $comment_id, 'wp_review_comment_qualifier', true );
104
- $comment_image = get_comment_meta( $comment_id, 'wp_review_comment_attachment_url', true );
105
- $comment_image_name = 'wp_review_comment_attachment_url';
106
- if ( ! $comment_image ) {
107
- $comment_image = get_comment_meta( $comment_id, 'wp_review_comment_attachment_src', true );
108
- if ( $comment_image ) {
109
- $comment_image_name = 'wp_review_comment_attachment_src';
110
- }
111
- }
112
-
113
- if ( $comment_qualifier ) {
114
- ?>
115
- <div class="wp-review-field">
116
- <div class="wp-review-field-label">
117
- <label for="wp_review_comment_qualifier"><?php echo apply_filters( 'wp_review_comment_qualifier', __( 'Does Product Matches the Description?', 'wp-review' ) ); ?></label>
118
- </div>
119
- <div class="wp-review-field-option">
120
- <select id="wp_review_comment_qualifier" name="wp_review_comment_qualifier">
121
- <option value=""><?php _e( 'Select', 'wp-review' ); ?></option>
122
- <option value="yes" <?php selected( $comment_qualifier, 'yes', true ); ?>><?php _e( 'Yes', 'wp-review' ); ?></option>
123
- <option value="no" <?php selected( $comment_qualifier, 'no', true ); ?>><?php _e( 'No', 'wp-review' ); ?></option>
124
- </select>
125
- </div>
126
- </div>
127
- <?php
128
- }
129
-
130
- if ( $comment_image ) {
131
- if ( is_numeric( $comment_image ) ) {
132
- $comment_image = wp_get_attachment_url( $comment_image );
133
- }
134
- ?>
135
- <div class="wp-review-field">
136
- <div class="wp-review-field-label">
137
- <label for="wp_review_comment_image"><?php esc_html_e( 'Comment Image', 'wp-review' ); ?></label>
138
- </div>
139
- <div class="wp-review-field-option">
140
- <input type="text" name="<?php echo esc_attr( $comment_image_name ); ?>" value="<?php echo esc_attr( $comment_image ); ?>" />
141
- </div>
142
- </div>
143
- <?php } ?>
144
- <style>.wp-review-field { margin-bottom: 1em; }</style>
145
- <?php
146
- }
147
-
148
- /**
149
- * Save our comment (from the admin area).
150
- *
151
- * @param int $comment_id Comment ID.
152
- */
153
- function wp_review_comment_edit_comment( $comment_id ) {
154
- if (
155
- ! isset( $_POST['wp_review_comment_rating'] ) && ! isset( $_POST['wp-review-comment-feature-rating'] )
156
- || ! isset( $_POST['wp_review_comment_rating_update'] )
157
- || ! wp_verify_nonce( $_POST['wp_review_comment_rating_update'], 'wp_review_comment_rating_update' )
158
- ) {
159
- return;
160
- }
161
-
162
- if ( WP_REVIEW_COMMENT_TYPE_COMMENT === get_comment_type( $comment_id ) ) {
163
- $meta_key = WP_REVIEW_COMMENT_RATING_METAKEY;
164
- } else {
165
- $meta_key = WP_REVIEW_VISITOR_RATING_METAKEY;
166
- }
167
-
168
- $rating = filter_input( INPUT_POST, 'wp_review_comment_rating', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION );
169
-
170
- $comment = get_comment( $comment_id );
171
- update_comment_meta( $comment_id, $meta_key, $rating );
172
- wp_review_clear_cached_reviews( $comment );
173
-
174
- if ( ! empty( $_POST['wp_review_comment_pros'] ) ) {
175
- update_comment_meta( $comment_id, 'wp_review_comment_pros', wp_kses_post( wp_unslash( $_POST['wp_review_comment_pros'] ) ) );
176
- }
177
- if ( ! empty( $_POST['wp_review_comment_cons'] ) ) {
178
- update_comment_meta( $comment_id, 'wp_review_comment_cons', wp_kses_post( wp_unslash( $_POST['wp_review_comment_cons'] ) ) );
179
- }
180
- if ( ! empty( $_POST['wp_review_comment_qualifier'] ) ) {
181
- update_comment_meta( $comment_id, 'wp_review_comment_qualifier', wp_kses_post( wp_unslash( $_POST['wp_review_comment_qualifier'] ) ) );
182
- }
183
-
184
- if ( ! empty( $_POST['wp-review-comment-feature-rating'] ) ) {
185
- $rating = ! is_array( $_POST['wp-review-comment-feature-rating'] ) ? json_decode( wp_unslash( $_POST['wp-review-comment-feature-rating'] ), true ) : $_POST['wp-review-comment-feature-rating'];
186
- update_comment_meta( $comment_id, WP_REVIEW_COMMENT_FEATURES_RATING_METAKEY, $rating );
187
-
188
- $total = 0;
189
- foreach ( $rating as $value ) {
190
- $total += floatval( $value );
191
- }
192
-
193
- update_comment_meta( $comment_id, $meta_key, $total / count( $rating ) );
194
- wp_review_clear_cached_reviews( $comment );
195
- }
196
- }
197
- add_action( 'edit_comment', 'wp_review_comment_edit_comment' );
198
-
199
-
200
- /**
201
- * Script for Comments quick edit
202
- */
203
- function wp_review_comment_quick_edit_javascript() {
204
- ?>
205
- <script type="text/html" id="tmpl-wpr-comment-review-quick-edit">
206
- <# if ( ! data.features ) { #>
207
- <div class="inside">
208
- <label for="wp_review_comment_rating"><?php esc_html_e( 'Review Total', 'wp-review' ); ?></label>
209
- <input type="text" name="wp_review_comment_rating" size="50" value="{{ data.rating }}" id="wp_review_comment_rating">
210
- </div>
211
- <# } else { #>
212
-
213
- <# for ( var i = 0; i < data.features.length; i++ ) { #>
214
- <# var feature = data.features[ i ]; #>
215
- <div class="inside">
216
- <label for="wp_review_comment_feature_{{ feature.id }}">{{ feature.wp_review_item_title }}</label>
217
- <input type="text" name="wp-review-comment-feature-rating[{{ feature.id }}]" size="50" value="{{ feature.comment_rating }}" id="wp_review_comment_feature_{{ feature.id }}" />
218
- </div>
219
- <# } #>
220
-
221
- <# } #>
222
- </script>
223
-
224
- <script type="text/javascript">
225
- function wpreview_expandedOpen( id ) {
226
- var tmpl, editRow, rowData, type, features, tmplData;
227
- tmpl = wp.template( 'wpr-comment-review-quick-edit' );
228
- editRow = jQuery( '#replyrow' );
229
- rowData = jQuery( '#inline-commentreview-' + id );
230
- type = jQuery( '.comment-review-type', rowData ).val();
231
-
232
- if ( 'wp_review_comment' !== type && 'wp_review_visitor' !== type ) {
233
- return;
234
- }
235
-
236
- if ( jQuery( '.comment-review-feature-rating', rowData ).length ) {
237
- features = jQuery( '.comment-review-feature-rating', rowData ).val();
238
- features = JSON.parse( features );
239
- }
240
-
241
- tmplData = {
242
- title: jQuery( '.comment-review-title', rowData ).val(),
243
- rating: jQuery( '.comment-review-rating', rowData ).val(),
244
- type: type,
245
- features: features,
246
- pros: jQuery( '.comment-review-pros', rowData ).val(),
247
- cons: jQuery( '.comment-review-cons', rowData ).val()
248
- };
249
-
250
- jQuery( '#editwpreview', editRow ).html( tmpl( tmplData ) );
251
- }
252
- </script>
253
- <?php
254
- }
255
- add_action( 'admin_footer-edit-comments.php', 'wp_review_comment_quick_edit_javascript' );
256
-
257
- /**
258
- * Filters comment quick edit link.
259
- *
260
- * @param array $actions Comments list table actions.
261
- * @param object $comment Comment object.
262
- * @return array
263
- */
264
- function wp_review_comment_quick_edit_action( $actions, $comment ) {
265
- $actions['quickedit'] = sprintf(
266
- '<span class="quickedit hide-if-no-js"><a onclick="if (typeof(wpreview_expandedOpen) == \'function\') wpreview_expandedOpen(%1$s);" data-comment-id="%1$s" data-post-id="%2$s" data-action="edit" class="vim-q comment-inline" title="%3$s" href="#">%4$s</a></span>',
267
- $comment->comment_ID,
268
- $comment->comment_post_ID,
269
- __( 'Edit this item inline', 'wp-review' ),
270
- __( 'Quick Edit', 'wp-review' )
271
- );
272
- return $actions;
273
- }
274
- add_filter( 'comment_row_actions', 'wp_review_comment_quick_edit_action', 10, 2 );
275
-
276
- /**
277
- * Gets comments rating template.
278
- *
279
- * @param float $value Rating value.
280
- * @param int $comment_id Comment ID.
281
- * @param array $args Custom args.
282
- * @return string
283
- */
284
- function wp_review_comment_rating( $value, $comment_id = null, $args = array() ) {
285
- global $post;
286
-
287
- if ( ! empty( $comment_id ) ) {
288
- $comment = get_comment( $comment_id );
289
- $post_id = $comment->comment_post_ID;
290
-
291
- $rating_items = get_comment_meta( $comment_id, WP_REVIEW_COMMENT_FEATURES_RATING_METAKEY, true );
292
- if ( $rating_items && is_array( $rating_items ) ) {
293
- return wp_review_comment_rating_items( $rating_items, $comment );
294
- }
295
- } else {
296
- $post_id = $post->ID;
297
- }
298
-
299
- $type = wp_review_get_post_user_review_type( $post_id );
300
-
301
- if ( empty( $type ) ) {
302
- return '';
303
- }
304
-
305
- $rating_type = wp_review_get_rating_type_data( $type );
306
-
307
- $colors = wp_review_get_colors( $post_id );
308
-
309
- $color = $colors['color'];
310
- // don't allow higher rating than max.
311
- if ( $value > $rating_type['max'] ) {
312
- $value = $rating_type['max'];
313
- }
314
- $template = $rating_type['output_template'];
315
- $comment_rating = true;
316
- $args['show_one'] = true;
317
- set_query_var( 'rating', compact( 'value', 'type', 'args', 'comment_rating', 'post_id', 'color', 'colors' ) );
318
- ob_start();
319
- load_template( $template, false );
320
- $review = '<div class="wp-review-usercomment-rating wp-review-usercomment-rating-' . $type . '">' . ob_get_contents() . '</div>';
321
- ob_end_clean();
322
- return $review;
323
- }
324
-
325
-
326
- /**
327
- * Update user ratings total if comment status is changed.
328
- *
329
- * @param string $new_status New status.
330
- * @param string $old_status Old status.
331
- * @param object $comment Comment object.
332
- */
333
- function wp_review_update_comment_ratings( $new_status, $old_status, $comment ) {
334
- if ( WP_REVIEW_COMMENT_TYPE_VISITOR === $comment->comment_type ) {
335
- mts_get_post_reviews( $comment->comment_post_ID, true );
336
- }
337
- }
338
- add_action( 'transition_comment_status', 'wp_review_update_comment_ratings', 10, 3 );
339
-
340
-
341
- /**
342
- * Adds view links in comments list page.
343
- *
344
- * @since 3.0.0
345
- *
346
- * @param array $views View links.
347
- * @return array
348
- */
349
- function wp_review_add_comments_list_view( $views ) {
350
- foreach ( $views as $key => $view ) {
351
- $view = str_replace( 'comment_type=' . WP_REVIEW_COMMENT_TYPE_COMMENT . '&', '', $view );
352
- $view = str_replace( 'comment_type=' . WP_REVIEW_COMMENT_TYPE_VISITOR . '&', '', $view );
353
- $views[ $key ] = $view;
354
- }
355
-
356
- // Visitor reviews.
357
- $url = add_query_arg( 'comment_type', WP_REVIEW_COMMENT_TYPE_VISITOR );
358
- $url = remove_query_arg( 'comment_status', $url );
359
- $count = get_comments(
360
- array(
361
- 'count' => true,
362
- 'type' => WP_REVIEW_COMMENT_TYPE_VISITOR,
363
- )
364
- );
365
-
366
- $views['visitor_reviews'] = sprintf(
367
- '<a href="%1$s" class="%2$s" aria-current="page">%3$s <span class="count">(<span class="all-count">%4$s</span>)</span></a>',
368
- esc_url( $url ),
369
- isset( $_GET['comment_type'] ) && WP_REVIEW_COMMENT_TYPE_VISITOR === $_GET['comment_type'] ? 'current' : '',
370
- esc_html__( 'Visitor reviews', 'wp-review' ),
371
- $count
372
- );
373
-
374
- return $views;
375
- }
376
- add_filter( 'views_edit-comments', 'wp_review_add_comments_list_view' );
1
+ <?php
2
+ /**
3
+ * Comments related functions
4
+ *
5
+ * @package WP_Review
6
+ */
7
+
8
+ /**
9
+ * Overrides comments count.
10
+ */
11
+ function wp_review_override_comments_count() {
12
+ remove_filter( 'get_comments_number', 'mts_comment_count', 0 );
13
+ add_filter( 'get_comments_number', 'wp_review_comment_count', 0 );
14
+ }
15
+ add_action( 'after_setup_theme', 'wp_review_override_comments_count', 30 );
16
+
17
+ /**
18
+ * Filters comment count.
19
+ *
20
+ * @param int $count Comment count.
21
+ * @return int
22
+ */
23
+ function wp_review_comment_count( $count ) {
24
+ if ( ! is_admin() ) {
25
+ $comments = get_comments( 'status=approve&post_id=' . get_the_ID() );
26
+ $comments_by_type = separate_comments( $comments );
27
+ if ( isset( $comments_by_type['comment'] ) ) {
28
+ $wp_review_comments_count = isset( $comments_by_type['wp_review_comment'] ) ? count( $comments_by_type['wp_review_comment'] ) : 0;
29
+ return count( $comments_by_type['comment'] ) + $wp_review_comments_count;
30
+ } else {
31
+ return $count;
32
+ }
33
+ }
34
+
35
+ return $count;
36
+ }
37
+
38
+
39
+ /**
40
+ * Add the title to our admin area, for editing, etc
41
+ */
42
+ function wp_review_comment_add_meta_box() {
43
+ global $wp_review_rating_types, $comment;
44
+ $type = wp_review_get_post_user_review_type( $comment->comment_post_ID );
45
+ if ( ! $type ) {
46
+ $type = 'star';
47
+ }
48
+ add_meta_box(
49
+ 'wp-review-comment-rating',
50
+ // translators: rating label.
51
+ sprintf( __( 'WP Review Rating (%s)', 'wp-review' ), $wp_review_rating_types[ $type ]['label'] ),
52
+ 'wp_review_comment_meta_box_fields',
53
+ 'comment',
54
+ 'normal',
55
+ 'high'
56
+ );
57
+ }
58
+ add_action( 'add_meta_boxes_comment', 'wp_review_comment_add_meta_box' );
59
+
60
+ /**
61
+ * Shows comment meta box fields.
62
+ *
63
+ * @param object $comment Comment object.
64
+ */
65
+ function wp_review_comment_meta_box_fields( $comment ) {
66
+ $comment_id = $comment->comment_ID;
67
+ if ( WP_REVIEW_COMMENT_TYPE_COMMENT === get_comment_type( $comment_id ) ) {
68
+ $rating = get_comment_meta( $comment_id, WP_REVIEW_COMMENT_RATING_METAKEY, true );
69
+ } else {
70
+ $rating = get_comment_meta( $comment_id, WP_REVIEW_VISITOR_RATING_METAKEY, true );
71
+ }
72
+ $title = get_comment_meta( $comment_id, WP_REVIEW_COMMENT_TITLE_METAKEY, true );
73
+ $rating_items = get_comment_meta( $comment_id, WP_REVIEW_COMMENT_FEATURES_RATING_METAKEY, true );
74
+ wp_nonce_field( 'wp_review_comment_rating_update', 'wp_review_comment_rating_update', false );
75
+ ?>
76
+ <div class="wp-review-field">
77
+ <div class="wp-review-field-label">
78
+ <label for="wp_review_comment_rating"><?php esc_html_e( 'Review total', 'wp-review' ); ?></label>
79
+ </div>
80
+ <div class="wp-review-field-option">
81
+ <input type="text" class="small-text" name="wp_review_comment_rating" value="<?php echo esc_attr( $rating ); ?>" id="wp_review_comment_rating">
82
+ </div>
83
+ </div>
84
+
85
+ <?php
86
+ if ( ! empty( $rating_items ) ) :
87
+ $items = wp_review_get_review_items( $comment->comment_post_ID );
88
+ foreach ( $items as $item_id => $item ) :
89
+ $value = ! empty( $rating_items[ $item_id ] ) ? $rating_items[ $item_id ] : 0;
90
+ ?>
91
+ <div class="wp-review-field">
92
+ <div class="wp-review-field-label">
93
+ <label for="wp_review_comment_rating_item-<?php echo esc_attr( $item_id ); ?>"><?php echo esc_html( $item['wp_review_item_title'] ); ?></label>
94
+ </div>
95
+ <div class="wp-review-field-option">
96
+ <input type="text" class="small-text" name="wp-review-comment-feature-rating[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( $value ); ?>" id="wp_review_comment_rating_item-<?php echo esc_attr( $item_id ); ?>">
97
+ </div>
98
+ </div>
99
+ <?php endforeach; ?>
100
+ <?php endif; ?>
101
+
102
+ <?php
103
+ $comment_qualifier = get_comment_meta( $comment_id, 'wp_review_comment_qualifier', true );
104
+ $comment_image = get_comment_meta( $comment_id, 'wp_review_comment_attachment_url', true );
105
+ $comment_image_name = 'wp_review_comment_attachment_url';
106
+ if ( ! $comment_image ) {
107
+ $comment_image = get_comment_meta( $comment_id, 'wp_review_comment_attachment_src', true );
108
+ if ( $comment_image ) {
109
+ $comment_image_name = 'wp_review_comment_attachment_src';
110
+ }
111
+ }
112
+
113
+ if ( $comment_qualifier ) {
114
+ ?>
115
+ <div class="wp-review-field">
116
+ <div class="wp-review-field-label">
117
+ <label for="wp_review_comment_qualifier"><?php echo apply_filters( 'wp_review_comment_qualifier', __( 'Does Product Matches the Description?', 'wp-review' ) ); ?></label>
118
+ </div>
119
+ <div class="wp-review-field-option">
120
+ <select id="wp_review_comment_qualifier" name="wp_review_comment_qualifier">
121
+ <option value=""><?php _e( 'Select', 'wp-review' ); ?></option>
122
+ <option value="yes" <?php selected( $comment_qualifier, 'yes', true ); ?>><?php _e( 'Yes', 'wp-review' ); ?></option>
123
+ <option value="no" <?php selected( $comment_qualifier, 'no', true ); ?>><?php _e( 'No', 'wp-review' ); ?></option>
124
+ </select>
125
+ </div>
126
+ </div>
127
+ <?php
128
+ }
129
+
130
+ if ( $comment_image ) {
131
+ if ( is_numeric( $comment_image ) ) {
132
+ $comment_image = wp_get_attachment_url( $comment_image );
133
+ }
134
+ ?>
135
+ <div class="wp-review-field">
136
+ <div class="wp-review-field-label">
137
+ <label for="wp_review_comment_image"><?php esc_html_e( 'Comment Image', 'wp-review' ); ?></label>
138
+ </div>
139
+ <div class="wp-review-field-option">
140
+ <input type="text" name="<?php echo esc_attr( $comment_image_name ); ?>" value="<?php echo esc_attr( $comment_image ); ?>" />
141
+ </div>
142
+ </div>
143
+ <?php } ?>
144
+ <style>.wp-review-field { margin-bottom: 1em; }</style>
145
+ <?php
146
+ }
147
+
148
+ /**
149
+ * Save our comment (from the admin area).
150
+ *
151
+ * @param int $comment_id Comment ID.
152
+ */
153
+ function wp_review_comment_edit_comment( $comment_id ) {
154
+ if (
155
+ ! isset( $_POST['wp_review_comment_rating'] ) && ! isset( $_POST['wp-review-comment-feature-rating'] )
156
+ || ! isset( $_POST['wp_review_comment_rating_update'] )
157
+ || ! wp_verify_nonce( $_POST['wp_review_comment_rating_update'], 'wp_review_comment_rating_update' )
158
+ ) {
159
+ return;
160
+ }
161
+
162
+ if ( WP_REVIEW_COMMENT_TYPE_COMMENT === get_comment_type( $comment_id ) ) {
163
+ $meta_key = WP_REVIEW_COMMENT_RATING_METAKEY;
164
+ } else {
165
+ $meta_key = WP_REVIEW_VISITOR_RATING_METAKEY;
166
+ }
167
+
168
+ $rating = filter_input( INPUT_POST, 'wp_review_comment_rating', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION );
169
+
170
+ $comment = get_comment( $comment_id );
171
+ update_comment_meta( $comment_id, $meta_key, $rating );
172
+ wp_review_clear_cached_reviews( $comment );
173
+
174
+ if ( ! empty( $_POST['wp_review_comment_pros'] ) ) {
175
+ update_comment_meta( $comment_id, 'wp_review_comment_pros', wp_kses_post( wp_unslash( $_POST['wp_review_comment_pros'] ) ) );
176
+ }
177
+ if ( ! empty( $_POST['wp_review_comment_cons'] ) ) {
178
+ update_comment_meta( $comment_id, 'wp_review_comment_cons', wp_kses_post( wp_unslash( $_POST['wp_review_comment_cons'] ) ) );
179
+ }
180
+ if ( ! empty( $_POST['wp_review_comment_qualifier'] ) ) {
181
+ update_comment_meta( $comment_id, 'wp_review_comment_qualifier', wp_kses_post( wp_unslash( $_POST['wp_review_comment_qualifier'] ) ) );
182
+ }
183
+
184
+ if ( ! empty( $_POST['wp-review-comment-feature-rating'] ) ) {
185
+ $rating = ! is_array( $_POST['wp-review-comment-feature-rating'] ) ? json_decode( wp_unslash( $_POST['wp-review-comment-feature-rating'] ), true ) : $_POST['wp-review-comment-feature-rating'];
186
+ update_comment_meta( $comment_id, WP_REVIEW_COMMENT_FEATURES_RATING_METAKEY, $rating );
187
+
188
+ $total = 0;
189
+ foreach ( $rating as $value ) {
190
+ $total += floatval( $value );
191
+ }
192
+
193
+ update_comment_meta( $comment_id, $meta_key, $total / count( $rating ) );
194
+ wp_review_clear_cached_reviews( $comment );
195
+ }
196
+ }
197
+ add_action( 'edit_comment', 'wp_review_comment_edit_comment' );
198
+
199
+
200
+ /**
201
+ * Script for Comments quick edit
202
+ */
203
+ function wp_review_comment_quick_edit_javascript() {
204
+ ?>
205
+ <script type="text/html" id="tmpl-wpr-comment-review-quick-edit">
206
+ <# if ( ! data.features ) { #>
207
+ <div class="inside">
208
+ <label for="wp_review_comment_rating"><?php esc_html_e( 'Review Total', 'wp-review' ); ?></label>
209
+ <input type="text" name="wp_review_comment_rating" size="50" value="{{ data.rating }}" id="wp_review_comment_rating">
210
+ </div>
211
+ <# } else { #>
212
+
213
+ <# for ( var i = 0; i < data.features.length; i++ ) { #>
214
+ <# var feature = data.features[ i ]; #>
215
+ <div class="inside">
216
+ <label for="wp_review_comment_feature_{{ feature.id }}">{{ feature.wp_review_item_title }}</label>
217
+ <input type="text" name="wp-review-comment-feature-rating[{{ feature.id }}]" size="50" value="{{ feature.comment_rating }}" id="wp_review_comment_feature_{{ feature.id }}" />
218
+ </div>
219
+ <# } #>
220
+
221
+ <# } #>
222
+ </script>
223
+
224
+ <script type="text/javascript">
225
+ function wpreview_expandedOpen( id ) {
226
+ var tmpl, editRow, rowData, type, features, tmplData;
227
+ tmpl = wp.template( 'wpr-comment-review-quick-edit' );
228
+ editRow = jQuery( '#replyrow' );
229
+ rowData = jQuery( '#inline-commentreview-' + id );
230
+ type = jQuery( '.comment-review-type', rowData ).val();
231
+
232
+ if ( 'wp_review_comment' !== type && 'wp_review_visitor' !== type ) {
233
+ return;
234
+ }
235
+
236
+ if ( jQuery( '.comment-review-feature-rating', rowData ).length ) {
237
+ features = jQuery( '.comment-review-feature-rating', rowData ).val();
238
+ features = JSON.parse( features );
239
+ }
240
+
241
+ tmplData = {
242
+ title: jQuery( '.comment-review-title', rowData ).val(),
243
+ rating: jQuery( '.comment-review-rating', rowData ).val(),
244
+ type: type,
245
+ features: features,
246
+ pros: jQuery( '.comment-review-pros', rowData ).val(),
247
+ cons: jQuery( '.comment-review-cons', rowData ).val()
248
+ };
249
+
250
+ jQuery( '#editwpreview', editRow ).html( tmpl( tmplData ) );
251
+ }
252
+ </script>
253
+ <?php
254
+ }
255
+ add_action( 'admin_footer-edit-comments.php', 'wp_review_comment_quick_edit_javascript' );
256
+
257
+ /**
258
+ * Filters comment quick edit link.
259
+ *
260
+ * @param array $actions Comments list table actions.
261
+ * @param object $comment Comment object.
262
+ * @return array
263
+ */
264
+ function wp_review_comment_quick_edit_action( $actions, $comment ) {
265
+ $actions['quickedit'] = sprintf(
266
+ '<span class="quickedit hide-if-no-js"><a onclick="if (typeof(wpreview_expandedOpen) == \'function\') wpreview_expandedOpen(%1$s);" data-comment-id="%1$s" data-post-id="%2$s" data-action="edit" class="vim-q comment-inline" title="%3$s" href="#">%4$s</a></span>',
267
+ $comment->comment_ID,
268
+ $comment->comment_post_ID,
269
+ __( 'Edit this item inline', 'wp-review' ),
270
+ __( 'Quick Edit', 'wp-review' )
271
+ );
272
+ return $actions;
273
+ }
274
+ add_filter( 'comment_row_actions', 'wp_review_comment_quick_edit_action', 10, 2 );
275
+
276
+ /**
277
+ * Gets comments rating template.
278
+ *
279
+ * @param float $value Rating value.
280
+ * @param int $comment_id Comment ID.
281
+ * @param array $args Custom args.
282
+ * @return string
283
+ */
284
+ function wp_review_comment_rating( $value, $comment_id = null, $args = array() ) {
285
+ global $post;
286
+
287
+ if ( ! empty( $comment_id ) ) {
288
+ $comment = get_comment( $comment_id );
289
+ $post_id = $comment->comment_post_ID;
290
+
291
+ $rating_items = get_comment_meta( $comment_id, WP_REVIEW_COMMENT_FEATURES_RATING_METAKEY, true );
292
+ if ( $rating_items && is_array( $rating_items ) ) {
293
+ return wp_review_comment_rating_items( $rating_items, $comment );
294
+ }
295
+ } else {
296
+ $post_id = $post->ID;
297
+ }
298
+
299
+ $type = wp_review_get_post_user_review_type( $post_id );
300
+
301
+ if ( empty( $type ) ) {
302
+ return '';
303
+ }
304
+
305
+ $rating_type = wp_review_get_rating_type_data( $type );
306
+
307
+ $colors = wp_review_get_colors( $post_id );
308
+
309
+ $color = $colors['color'];
310
+ // don't allow higher rating than max.
311
+ if ( $value > $rating_type['max'] ) {
312
+ $value = $rating_type['max'];
313
+ }
314
+ $template = $rating_type['output_template'];
315
+ $comment_rating = true;
316
+ $args['show_one'] = true;
317
+ set_query_var( 'rating', compact( 'value', 'type', 'args', 'comment_rating', 'post_id', 'color', 'colors' ) );
318
+ ob_start();
319
+ load_template( $template, false );
320
+ $review = '<div class="wp-review-usercomment-rating wp-review-usercomment-rating-' . $type . '">' . ob_get_contents() . '</div>';
321
+ ob_end_clean();
322
+ return $review;
323
+ }
324
+
325
+
326
+ /**
327
+ * Update user ratings total if comment status is changed.
328
+ *
329
+ * @param string $new_status New status.
330
+ * @param string $old_status Old status.
331
+ * @param object $comment Comment object.
332
+ */
333
+ function wp_review_update_comment_ratings( $new_status, $old_status, $comment ) {
334
+ if ( WP_REVIEW_COMMENT_TYPE_VISITOR === $comment->comment_type ) {
335
+ mts_get_post_reviews( $comment->comment_post_ID, true );
336
+ }
337
+ }
338
+ add_action( 'transition_comment_status', 'wp_review_update_comment_ratings', 10, 3 );
339
+
340
+
341
+ /**
342
+ * Adds view links in comments list page.
343
+ *
344
+ * @since 3.0.0
345
+ *
346
+ * @param array $views View links.
347
+ * @return array
348
+ */
349
+ function wp_review_add_comments_list_view( $views ) {
350
+ foreach ( $views as $key => $view ) {
351
+ $view = str_replace( 'comment_type=' . WP_REVIEW_COMMENT_TYPE_COMMENT . '&', '', $view );
352
+ $view = str_replace( 'comment_type=' . WP_REVIEW_COMMENT_TYPE_VISITOR . '&', '', $view );
353
+ $views[ $key ] = $view;
354
+ }
355
+
356
+ // Visitor reviews.
357
+ $url = add_query_arg( 'comment_type', WP_REVIEW_COMMENT_TYPE_VISITOR );
358
+ $url = remove_query_arg( 'comment_status', $url );
359
+ $count = get_comments(
360
+ array(
361
+ 'count' => true,
362
+ 'type' => WP_REVIEW_COMMENT_TYPE_VISITOR,
363
+ )
364
+ );
365
+
366
+ $views['visitor_reviews'] = sprintf(
367
+ '<a href="%1$s" class="%2$s" aria-current="page">%3$s <span class="count">(<span class="all-count">%4$s</span>)</span></a>',
368
+ esc_url( $url ),
369
+ isset( $_GET['comment_type'] ) && WP_REVIEW_COMMENT_TYPE_VISITOR === $_GET['comment_type'] ? 'current' : '',
370
+ esc_html__( 'Visitor reviews', 'wp-review' ),
371
+ $count
372
+ );
373
+
374
+ return $views;
375
+ }
376
+ add_filter( 'views_edit-comments', 'wp_review_add_comments_list_view' );
includes/demo/demo-content.xml CHANGED
@@ -1,7124 +1,7124 @@
1
- <?xml version="1.0" encoding="UTF-8" ?>
2
- <!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
3
- <!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
4
- <!-- You may use this file to transfer that content from one site to another. -->
5
- <!-- This file is not intended to serve as a complete backup of your site. -->
6
-
7
- <!-- To import this information into a WordPress site follow these steps: -->
8
- <!-- 1. Log in to that site as an administrator. -->
9
- <!-- 2. Go to Tools: Import in the WordPress admin panel. -->
10
- <!-- 3. Install the "WordPress" importer from the list. -->
11
- <!-- 4. Activate & Run Importer. -->
12
- <!-- 5. Upload this file using the form provided on that page. -->
13
- <!-- 6. You will first be asked to map the authors in this export file to users -->
14
- <!-- on the site. For each author, you may choose to map to an -->
15
- <!-- existing user on the site or to create a new user. -->
16
- <!-- 7. WordPress will then import each of the posts, pages, comments, categories, etc. -->
17
- <!-- contained in this file into your site. -->
18
-
19
- <!-- generator="WordPress/4.9.5" created="2018-04-16 16:42" -->
20
- <rss version="2.0"
21
- xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/"
22
- xmlns:content="http://purl.org/rss/1.0/modules/content/"
23
- xmlns:wfw="http://wellformedweb.org/CommentAPI/"
24
- xmlns:dc="http://purl.org/dc/elements/1.1/"
25
- xmlns:wp="http://wordpress.org/export/1.2/"
26
- >
27
-
28
- <channel>
29
- <title>WP Review Pro</title>
30
- <link>http://demo.mythemeshop.com/wp-review-pro</link>
31
- <description>Just another MyThemeShop Playground site</description>
32
- <pubDate>Mon, 16 Apr 2018 16:42:46 +0000</pubDate>
33
- <language>en-US</language>
34
- <wp:wxr_version>1.2</wp:wxr_version>
35
- <wp:base_site_url>http://demo.mythemeshop.com/</wp:base_site_url>
36
- <wp:base_blog_url>http://demo.mythemeshop.com/wp-review-pro</wp:base_blog_url>
37
-
38
- <wp:author><wp:author_id>1</wp:author_id><wp:author_login><![CDATA[N8FnGO1Y]]></wp:author_login><wp:author_email><![CDATA[admin@mythemeshop.com]]></wp:author_email><wp:author_display_name><![CDATA[MyThemeShop]]></wp:author_display_name><wp:author_first_name><![CDATA[MyThemeShop]]></wp:author_first_name><wp:author_last_name><![CDATA[Staff]]></wp:author_last_name></wp:author>
39
-
40
- <wp:category>
41
- <wp:term_id>18</wp:term_id>
42
- <wp:category_nicename><![CDATA[aqua]]></wp:category_nicename>
43
- <wp:category_parent><![CDATA[]]></wp:category_parent>
44
- <wp:cat_name><![CDATA[Aqua]]></wp:cat_name>
45
- </wp:category>
46
- <wp:category>
47
- <wp:term_id>16</wp:term_id>
48
- <wp:category_nicename><![CDATA[default]]></wp:category_nicename>
49
- <wp:category_parent><![CDATA[]]></wp:category_parent>
50
- <wp:cat_name><![CDATA[Default]]></wp:cat_name>
51
- </wp:category>
52
- <wp:category>
53
- <wp:term_id>1</wp:term_id>
54
- <wp:category_nicename><![CDATA[uncategorized]]></wp:category_nicename>
55
- <wp:category_parent><![CDATA[]]></wp:category_parent>
56
- <wp:cat_name><![CDATA[Uncategorized]]></wp:cat_name>
57
- </wp:category>
58
- <wp:term>
59
- <wp:term_id><![CDATA[37]]></wp:term_id>
60
- <wp:term_taxonomy><![CDATA[product_visibility]]></wp:term_taxonomy>
61
- <wp:term_slug><![CDATA[exclude-from-catalog]]></wp:term_slug>
62
- <wp:term_parent><![CDATA[]]></wp:term_parent>
63
- <wp:term_name><![CDATA[exclude-from-catalog]]></wp:term_name>
64
- </wp:term>
65
- <wp:term>
66
- <wp:term_id><![CDATA[36]]></wp:term_id>
67
- <wp:term_taxonomy><![CDATA[product_visibility]]></wp:term_taxonomy>
68
- <wp:term_slug><![CDATA[exclude-from-search]]></wp:term_slug>
69
- <wp:term_parent><![CDATA[]]></wp:term_parent>
70
- <wp:term_name><![CDATA[exclude-from-search]]></wp:term_name>
71
- </wp:term>
72
- <wp:term>
73
- <wp:term_id><![CDATA[35]]></wp:term_id>
74
- <wp:term_taxonomy><![CDATA[product_type]]></wp:term_taxonomy>
75
- <wp:term_slug><![CDATA[external]]></wp:term_slug>
76
- <wp:term_parent><![CDATA[]]></wp:term_parent>
77
- <wp:term_name><![CDATA[external]]></wp:term_name>
78
- </wp:term>
79
- <wp:term>
80
- <wp:term_id><![CDATA[38]]></wp:term_id>
81
- <wp:term_taxonomy><![CDATA[product_visibility]]></wp:term_taxonomy>
82
- <wp:term_slug><![CDATA[featured]]></wp:term_slug>
83
- <wp:term_parent><![CDATA[]]></wp:term_parent>
84
- <wp:term_name><![CDATA[featured]]></wp:term_name>
85
- </wp:term>
86
- <wp:term>
87
- <wp:term_id><![CDATA[33]]></wp:term_id>
88
- <wp:term_taxonomy><![CDATA[product_type]]></wp:term_taxonomy>
89
- <wp:term_slug><![CDATA[grouped]]></wp:term_slug>
90
- <wp:term_parent><![CDATA[]]></wp:term_parent>
91
- <wp:term_name><![CDATA[grouped]]></wp:term_name>
92
- </wp:term>
93
- <wp:term>
94
- <wp:term_id><![CDATA[39]]></wp:term_id>
95
- <wp:term_taxonomy><![CDATA[product_visibility]]></wp:term_taxonomy>
96
- <wp:term_slug><![CDATA[outofstock]]></wp:term_slug>
97
- <wp:term_parent><![CDATA[]]></wp:term_parent>
98
- <wp:term_name><![CDATA[outofstock]]></wp:term_name>
99
- </wp:term>
100
- <wp:term>
101
- <wp:term_id><![CDATA[45]]></wp:term_id>
102
- <wp:term_taxonomy><![CDATA[product_cat]]></wp:term_taxonomy>
103
- <wp:term_slug><![CDATA[phones]]></wp:term_slug>
104
- <wp:term_parent><![CDATA[]]></wp:term_parent>
105
- <wp:term_name><![CDATA[Phones]]></wp:term_name>
106
- <wp:termmeta>
107
- <wp:meta_key><![CDATA[product_count_product_cat]]></wp:meta_key>
108
- <wp:meta_value><![CDATA[1]]></wp:meta_value>
109
- </wp:termmeta>
110
- </wp:term>
111
- <wp:term>
112
- <wp:term_id><![CDATA[40]]></wp:term_id>
113
- <wp:term_taxonomy><![CDATA[product_visibility]]></wp:term_taxonomy>
114
- <wp:term_slug><![CDATA[rated-1]]></wp:term_slug>
115
- <wp:term_parent><![CDATA[]]></wp:term_parent>
116
- <wp:term_name><![CDATA[rated-1]]></wp:term_name>
117
- </wp:term>
118
- <wp:term>
119
- <wp:term_id><![CDATA[41]]></wp:term_id>
120
- <wp:term_taxonomy><![CDATA[product_visibility]]></wp:term_taxonomy>
121
- <wp:term_slug><![CDATA[rated-2]]></wp:term_slug>
122
- <wp:term_parent><![CDATA[]]></wp:term_parent>
123
- <wp:term_name><![CDATA[rated-2]]></wp:term_name>
124
- </wp:term>
125
- <wp:term>
126
- <wp:term_id><![CDATA[42]]></wp:term_id>
127
- <wp:term_taxonomy><![CDATA[product_visibility]]></wp:term_taxonomy>
128
- <wp:term_slug><![CDATA[rated-3]]></wp:term_slug>
129
- <wp:term_parent><![CDATA[]]></wp:term_parent>
130
- <wp:term_name><![CDATA[rated-3]]></wp:term_name>
131
- </wp:term>
132
- <wp:term>
133
- <wp:term_id><![CDATA[43]]></wp:term_id>
134
- <wp:term_taxonomy><![CDATA[product_visibility]]></wp:term_taxonomy>
135
- <wp:term_slug><![CDATA[rated-4]]></wp:term_slug>
136
- <wp:term_parent><![CDATA[]]></wp:term_parent>
137
- <wp:term_name><![CDATA[rated-4]]></wp:term_name>
138
- </wp:term>
139
- <wp:term>
140
- <wp:term_id><![CDATA[44]]></wp:term_id>
141
- <wp:term_taxonomy><![CDATA[product_visibility]]></wp:term_taxonomy>
142
- <wp:term_slug><![CDATA[rated-5]]></wp:term_slug>
143
- <wp:term_parent><![CDATA[]]></wp:term_parent>
144
- <wp:term_name><![CDATA[rated-5]]></wp:term_name>
145
- </wp:term>
146
- <wp:term>
147
- <wp:term_id><![CDATA[32]]></wp:term_id>
148
- <wp:term_taxonomy><![CDATA[product_type]]></wp:term_taxonomy>
149
- <wp:term_slug><![CDATA[simple]]></wp:term_slug>
150
- <wp:term_parent><![CDATA[]]></wp:term_parent>
151
- <wp:term_name><![CDATA[simple]]></wp:term_name>
152
- </wp:term>
153
- <wp:term>
154
- <wp:term_id><![CDATA[34]]></wp:term_id>
155
- <wp:term_taxonomy><![CDATA[product_type]]></wp:term_taxonomy>
156
- <wp:term_slug><![CDATA[variable]]></wp:term_slug>
157
- <wp:term_parent><![CDATA[]]></wp:term_parent>
158
- <wp:term_name><![CDATA[variable]]></wp:term_name>
159
- </wp:term>
160
- <wp:term><wp:term_id>15</wp:term_id><wp:term_taxonomy>nav_menu</wp:term_taxonomy><wp:term_slug><![CDATA[menu]]></wp:term_slug><wp:term_name><![CDATA[Menu]]></wp:term_name>
161
- </wp:term>
162
-
163
- <generator>https://wordpress.org/?v=4.9.5</generator>
164
-
165
- <item>
166
- <title>fashion-glasses-go-pro-female-157888</title>
167
- <link>http://demo.mythemeshop.com/wp-review-pro/fashion-glasses-go-pro-female-157888/</link>
168
- <pubDate>Thu, 12 Jan 2017 06:22:28 +0000</pubDate>
169
- <dc:creator><![CDATA[N8FnGO1Y]]></dc:creator>
170
- <guid isPermaLink="false">https://demo.mythemeshop.com/wp-review-pro-new/files/2016/03/fashion-glasses-go-pro-female-157888.jpeg</guid>
171
- <description></description>
172
- <content:encoded><![CDATA[]]></content:encoded>
173
- <excerpt:encoded><![CDATA[]]></excerpt:encoded>
174
- <wp:post_id>296</wp:post_id>
175
- <wp:post_date><![CDATA[2017-01-12 06:22:28]]></wp:post_date>
176
- <wp:post_date_gmt><![CDATA[2017-01-12 06:22:28]]></wp:post_date_gmt>
177
- <wp:comment_status><![CDATA[open]]></wp:comment_status>
178
- <wp:ping_status><![CDATA[closed]]></wp:ping_status>
179
- <wp:post_name><![CDATA[fashion-glasses-go-pro-female-157888]]></wp:post_name>
180
- <wp:status><![CDATA[inherit]]></wp:status>
181
- <wp:post_parent>0</wp:post_parent>
182
- <wp:menu_order>0</wp:menu_order>
183
- <wp:post_type><![CDATA[attachment]]></wp:post_type>
184
- <wp:post_password><![CDATA[]]></wp:post_password>
185
- <wp:is_sticky>0</wp:is_sticky>
186
- <wp:attachment_url><![CDATA[https://demo.mythemeshop.com/wp-review-pro/files/2016/03/fashion-glasses-go-pro-female-157888-e1522931222905.jpeg]]></wp:attachment_url>
187
- <wp:postmeta>
188
- <wp:meta_key><![CDATA[_wp_attached_file]]></wp:meta_key>
189
- <wp:meta_value><![CDATA[2016/03/fashion-glasses-go-pro-female-157888-e1522931222905.jpeg]]></wp:meta_value>
190
- </wp:postmeta>
191
- <wp:postmeta>
192
- <wp:meta_key><![CDATA[_wp_attachment_metadata]]></wp:meta_key>
193
- <wp:meta_value><![CDATA[a:5:{s:5:"width";i:400;s:6:"height";i:267;s:4:"file";s:64:"2016/03/fashion-glasses-go-pro-female-157888-e1522931222905.jpeg";s:5:"sizes";a:21:{s:15:"wp_review_large";a:4:{s:4:"file";s:49:"fashion-glasses-go-pro-female-157888-370x210.jpeg";s:5:"width";i:370;s:6:"height";i:210;s:9:"mime-type";s:10:"image/jpeg";}s:15:"wp_review_small";a:4:{s:4:"file";s:48:"fashion-glasses-go-pro-female-157888-100x65.jpeg";s:5:"width";i:100;s:6:"height";i:65;s:9:"mime-type";s:10:"image/jpeg";}s:14:"post-thumbnail";a:4:{s:4:"file";s:49:"fashion-glasses-go-pro-female-157888-223x137.jpeg";s:5:"width";i:223;s:6:"height";i:137;s:9:"mime-type";s:10:"image/jpeg";}s:17:"blogging-featured";a:4:{s:4:"file";s:49:"fashion-glasses-go-pro-female-157888-370x210.jpeg";s:5:"width";i:370;s:6:"height";i:210;s:9:"mime-type";s:10:"image/jpeg";}s:21:"blogging-featuredfull";a:4:{s:4:"file";s:49:"fashion-glasses-go-pro-female-157888-634x304.jpeg";s:5:"width";i:634;s:6:"height";i:304;s:9:"mime-type";s:10:"image/jpeg";}s:20:"blogging-widgetthumb";a:4:{s:4:"file";s:48:"fashion-glasses-go-pro-female-157888-100x65.jpeg";s:5:"width";i:100;s:6:"height";i:65;s:9:"mime-type";s:10:"image/jpeg";}s:19:"blogging-widgetfull";a:4:{s:4:"file";s:49:"fashion-glasses-go-pro-female-157888-370x210.jpeg";s:5:"width";i:370;s:6:"height";i:210;s:9:"mime-type";s:10:"image/jpeg";}s:16:"blogging-slider1";a:4:{s:4:"file";s:49:"fashion-glasses-go-pro-female-157888-770x430.jpeg";s:5:"width";i:770;s:6:"height";i:430;s:9:"mime-type";s:10:"image/jpeg";}s:16:"blogging-slider2";a:4:{s:4:"file";s:49:"fashion-glasses-go-pro-female-157888-370x430.jpeg";s:5:"width";i:370;s:6:"height";i:430;s:9:"mime-type";s:10:"image/jpeg";}s:9:"thumbnail";a:4:{s:4:"file";s:49:"fashion-glasses-go-pro-female-157888-150x150.jpeg";s:5:"width";i:150;s:6:"height";i:150;s:9:"mime-type";s:10:"image/jpeg";}s:6:"medium";a:4:{s:4:"file";s:49:"fashion-glasses-go-pro-female-157888-300x200.jpeg";s:5:"width";i:300;s:6:"height";i:200;s:9:"mime-type";s:10:"image/jpeg";}s:12:"medium_large";a:4:{s:4:"file";s:49:"fashion-glasses-go-pro-female-157888-768x512.jpeg";s:5:"width";i:768;s:6:"height";i:512;s:9:"mime-type";s:10:"image/jpeg";}s:5:"large";a:4:{s:4:"file";s:50:"fashion-glasses-go-pro-female-157888-1024x683.jpeg";s:5:"width";i:1024;s:6:"height";i:683;s:9:"mime-type";s:10:"image/jpeg";}s:26:"post-thumbnail_old_203x150";a:4:{s:4:"file";s:49:"fashion-glasses-go-pro-female-157888-203x150.jpeg";s:5:"width";i:203;s:6:"height";i:150;s:9:"mime-type";s:10:"image/jpeg";}s:14:"magxp-featured";a:4:{s:4:"file";s:49:"fashion-glasses-go-pro-female-157888-203x150.jpeg";s:5:"width";i:203;s:6:"height";i:150;s:9:"mime-type";s:10:"image/jpeg";}s:19:"magxp-featured-blog";a:4:{s:4:"file";s:49:"fashion-glasses-go-pro-female-157888-634x280.jpeg";s:5:"width";i:634;s:6:"height";i:280;s:9:"mime-type";s:10:"image/jpeg";}s:17:"magxp-widgetthumb";a:4:{s:4:"file";s:47:"fashion-glasses-go-pro-female-157888-65x65.jpeg";s:5:"width";i:65;s:6:"height";i:65;s:9:"mime-type";s:10:"image/jpeg";}s:16:"magxp-widgetfull";a:4:{s:4:"file";s:49:"fashion-glasses-go-pro-female-157888-300x180.jpeg";s:5:"width";i:300;s:6:"height";i:180;s:9:"mime-type";s:10:"image/jpeg";}s:12:"magxp-slider";a:4:{s:4:"file";s:49:"fashion-glasses-go-pro-female-157888-960x472.jpeg";s:5:"width";i:960;s:6:"height";i:472;s:9:"mime-type";s:10:"image/jpeg";}s:17:"magxp-sliderthumb";a:4:{s:4:"file";s:48:"fashion-glasses-go-pro-female-157888-124x74.jpeg";s:5:"width";i:124;s:6:"height";i:74;s:9:"mime-type";s:10:"image/jpeg";}s:23:"magxp-widgetsliderthumb";a:4:{s:4:"file";s:49:"fashion-glasses-go-pro-female-157888-125x125.jpeg";s:5:"width";i:125;s:6:"height";i:125;s:9:"mime-type";s:10:"image/jpeg";}}s:10:"image_meta";a:12:{s:8:"aperture";s:1:"0";s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";s:1:"0";s:9:"copyright";s:0:"";s:12:"focal_length";s:1:"0";s:3:"iso";s:1:"0";s:13:"shutter_speed";s:1:"0";s:5:"title";s:0:"";s:11:"orientation";s:1:"0";s:8:"keywords";a:0:{}}}]]></wp:meta_value>
194
- </wp:postmeta>
195
- <wp:postmeta>
196
- <wp:meta_key><![CDATA[_mts_demo_post]]></wp:meta_key>
197
- <wp:meta_value><![CDATA[1]]></wp:meta_value>
198
- </wp:postmeta>
199
- <wp:postmeta>
200
- <wp:meta_key><![CDATA[_wp_attachment_backup_sizes]]></wp:meta_key>
201
- <wp:meta_value><![CDATA[a:1:{s:9:"full-orig";a:3:{s:5:"width";i:1920;s:6:"height";i:1280;s:4:"file";s:41:"fashion-glasses-go-pro-female-157888.jpeg";}}]]></wp:meta_value>
202
- </wp:postmeta>
203
- </item>
204
- <item>
205
- <title>pexels-photo-icecream</title>
206
- <link>http://demo.mythemeshop.com/wp-review-pro/pexels-photo-icecream/</link>
207
- <pubDate>Thu, 12 Jan 2017 06:26:53 +0000</pubDate>
208
- <dc:creator><![CDATA[N8FnGO1Y]]></dc:creator>
209
- <guid isPermaLink="false">https://demo.mythemeshop.com/wp-review-pro-new/files/2016/03/pexels-photo-icecream.jpg</guid>
210
- <description></description>
211
- <content:encoded><![CDATA[]]></content:encoded>
212
- <excerpt:encoded><![CDATA[]]></excerpt:encoded>
213
- <wp:post_id>298</wp:post_id>
214
- <wp:post_date><![CDATA[2017-01-12 06:26:53]]></wp:post_date>
215
- <wp:post_date_gmt><![CDATA[2017-01-12 06:26:53]]></wp:post_date_gmt>
216
- <wp:comment_status><![CDATA[open]]></wp:comment_status>
217
- <wp:ping_status><![CDATA[closed]]></wp:ping_status>
218
- <wp:post_name><![CDATA[pexels-photo-icecream]]></wp:post_name>
219
- <wp:status><![CDATA[inherit]]></wp:status>
220
- <wp:post_parent>0</wp:post_parent>
221
- <wp:menu_order>0</wp:menu_order>
222
- <wp:post_type><![CDATA[attachment]]></wp:post_type>
223
- <wp:post_password><![CDATA[]]></wp:post_password>
224
- <wp:is_sticky>0</wp:is_sticky>
225
- <wp:attachment_url><![CDATA[https://demo.mythemeshop.com/wp-review-pro/files/2016/03/pexels-photo-icecream-e1522931205322.jpg]]></wp:attachment_url>
226
- <wp:postmeta>
227
- <wp:meta_key><![CDATA[_wp_attached_file]]></wp:meta_key>
228
- <wp:meta_value><![CDATA[2016/03/pexels-photo-icecream-e1522931205322.jpg]]></wp:meta_value>
229
- </wp:postmeta>
230
- <wp:postmeta>
231
- <wp:meta_key><![CDATA[_wp_attachment_metadata]]></wp:meta_key>
232
- <wp:meta_value><![CDATA[a:5:{s:5:"width";i:400;s:6:"height";i:266;s:4:"file";s:48:"2016/03/pexels-photo-icecream-e1522931205322.jpg";s:5:"sizes";a:21:{s:15:"wp_review_large";a:4:{s:4:"file";s:33:"pexels-photo-icecream-370x210.jpg";s:5:"width";i:370;s:6:"height";i:210;s:9:"mime-type";s:10:"image/jpeg";}s:15:"wp_review_small";a:4:{s:4:"file";s:32:"pexels-photo-icecream-100x65.jpg";s:5:"width";i:100;s:6:"height";i:65;s:9:"mime-type";s:10:"image/jpeg";}s:14:"post-thumbnail";a:4:{s:4:"file";s:33:"pexels-photo-icecream-223x137.jpg";s:5:"width";i:223;s:6:"height";i:137;s:9:"mime-type";s:10:"image/jpeg";}s:17:"blogging-featured";a:4:{s:4:"file";s:33:"pexels-photo-icecream-370x210.jpg";s:5:"width";i:370;s:6:"height";i:210;s:9:"mime-type";s:10:"image/jpeg";}s:21:"blogging-featuredfull";a:4:{s:4:"file";s:33:"pexels-photo-icecream-634x304.jpg";s:5:"width";i:634;s:6:"height";i:304;s:9:"mime-type";s:10:"image/jpeg";}s:20:"blogging-widgetthumb";a:4:{s:4:"file";s:32:"pexels-photo-icecream-100x65.jpg";s:5:"width";i:100;s:6:"height";i:65;s:9:"mime-type";s:10:"image/jpeg";}s:19:"blogging-widgetfull";a:4:{s:4:"file";s:33:"pexels-photo-icecream-370x210.jpg";s:5:"width";i:370;s:6:"height";i:210;s:9:"mime-type";s:10:"image/jpeg";}s:16:"blogging-slider1";a:4:{s:4:"file";s:33:"pexels-photo-icecream-770x430.jpg";s:5:"width";i:770;s:6:"height";i:430;s:9:"mime-type";s:10:"image/jpeg";}s:16:"blogging-slider2";a:4:{s:4:"file";s:33:"pexels-photo-icecream-370x430.jpg";s:5:"width";i:370;s:6:"height";i:430;s:9:"mime-type";s:10:"image/jpeg";}s:9:"thumbnail";a:4:{s:4:"file";s:33:"pexels-photo-icecream-150x150.jpg";s:5:"width";i:150;s:6:"height";i:150;s:9:"mime-type";s:10:"image/jpeg";}s:6:"medium";a:4:{s:4:"file";s:33:"pexels-photo-icecream-300x199.jpg";s:5:"width";i:300;s:6:"height";i:199;s:9:"mime-type";s:10:"image/jpeg";}s:12:"medium_large";a:4:{s:4:"file";s:33:"pexels-photo-icecream-768x510.jpg";s:5:"width";i:768;s:6:"height";i:510;s:9:"mime-type";s:10:"image/jpeg";}s:5:"large";a:4:{s:4:"file";s:34:"pexels-photo-icecream-1024x681.jpg";s:5:"width";i:1024;s:6:"height";i:681;s:9:"mime-type";s:10:"image/jpeg";}s:26:"post-thumbnail_old_203x150";a:4:{s:4:"file";s:33:"pexels-photo-icecream-203x150.jpg";s:5:"width";i:203;s:6:"height";i:150;s:9:"mime-type";s:10:"image/jpeg";}s:14:"magxp-featured";a:4:{s:4:"file";s:33:"pexels-photo-icecream-203x150.jpg";s:5:"width";i:203;s:6:"height";i:150;s:9:"mime-type";s:10:"image/jpeg";}s:19:"magxp-featured-blog";a:4:{s:4:"file";s:33:"pexels-photo-icecream-634x280.jpg";s:5:"width";i:634;s:6:"height";i:280;s:9:"mime-type";s:10:"image/jpeg";}s:17:"magxp-widgetthumb";a:4:{s:4:"file";s:31:"pexels-photo-icecream-65x65.jpg";s:5:"width";i:65;s:6:"height";i:65;s:9:"mime-type";s:10:"image/jpeg";}s:16:"magxp-widgetfull";a:4:{s:4:"file";s:33:"pexels-photo-icecream-300x180.jpg";s:5:"width";i:300;s:6:"height";i:180;s:9:"mime-type";s:10:"image/jpeg";}s:12:"magxp-slider";a:4:{s:4:"file";s:33:"pexels-photo-icecream-960x472.jpg";s:5:"width";i:960;s:6:"height";i:472;s:9:"mime-type";s:10:"image/jpeg";}s:17:"magxp-sliderthumb";a:4:{s:4:"file";s:32:"pexels-photo-icecream-124x74.jpg";s:5:"width";i:124;s:6:"height";i:74;s:9:"mime-type";s:10:"image/jpeg";}s:23:"magxp-widgetsliderthumb";a:4:{s:4:"file";s:33:"pexels-photo-icecream-125x125.jpg";s:5:"width";i:125;s:6:"height";i:125;s:9:"mime-type";s:10:"image/jpeg";}}s:10:"image_meta";a:12:{s:8:"aperture";s:1:"0";s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";s:1:"0";s:9:"copyright";s:0:"";s:12:"focal_length";s:1:"0";s:3:"iso";s:1:"0";s:13:"shutter_speed";s:1:"0";s:5:"title";s:0:"";s:11:"orientation";s:1:"0";s:8:"keywords";a:0:{}}}]]></wp:meta_value>
233
- </wp:postmeta>
234
- <wp:postmeta>
235
- <wp:meta_key><![CDATA[_mts_demo_post]]></wp:meta_key>
236
- <wp:meta_value><![CDATA[1]]></wp:meta_value>
237
- </wp:postmeta>
238
- <wp:postmeta>
239
- <wp:meta_key><![CDATA[_wp_attachment_backup_sizes]]></wp:meta_key>
240
- <wp:meta_value><![CDATA[a:1:{s:9:"full-orig";a:3:{s:5:"width";i:1920;s:6:"height";i:1276;s:4:"file";s:25:"pexels-photo-icecream.jpg";}}]]></wp:meta_value>
241
- </wp:postmeta>
242
- </item>
243
- <item>
244
- <title>pexels-photo-211342</title>
245
- <link>http://demo.mythemeshop.com/wp-review-pro/pexels-photo-211342/</link>
246
- <pubDate>Thu, 12 Jan 2017 07:15:43 +0000</pubDate>
247
- <dc:creator><![CDATA[N8FnGO1Y]]></dc:creator>
248
- <guid isPermaLink="false">https://demo.mythemeshop.com/wp-review-pro-new/files/2016/03/pexels-photo-211342.jpeg</guid>
249
- <description></description>
250
- <content:encoded><![CDATA[]]></content:encoded>
251
- <excerpt:encoded><![CDATA[]]></excerpt:encoded>
252
- <wp:post_id>301</wp:post_id>
253
- <wp:post_date><![CDATA[2017-01-12 07:15:43]]></wp:post_date>
254
- <wp:post_date_gmt><![CDATA[2017-01-12 07:15:43]]></wp:post_date_gmt>
255
- <wp:comment_status><![CDATA[open]]></wp:comment_status>
256
- <wp:ping_status><![CDATA[closed]]></wp:ping_status>
257
- <wp:post_name><![CDATA[pexels-photo-211342]]></wp:post_name>
258
- <wp:status><![CDATA[inherit]]></wp:status>
259
- <wp:post_parent>0</wp:post_parent>
260
- <wp:menu_order>0</wp:menu_order>
261
- <wp:post_type><![CDATA[attachment]]></wp:post_type>
262
- <wp:post_password><![CDATA[]]></wp:post_password>
263
- <wp:is_sticky>0</wp:is_sticky>
264
- <wp:attachment_url><![CDATA[https://demo.mythemeshop.com/wp-review-pro/files/2016/03/pexels-photo-211342-e1522931178155.jpeg]]></wp:attachment_url>
265
- <wp:postmeta>
266
- <wp:meta_key><![CDATA[_wp_attached_file]]></wp:meta_key>
267
- <wp:meta_value><![CDATA[2016/03/pexels-photo-211342-e1522931178155.jpeg]]></wp:meta_value>
268
- </wp:postmeta>
269
- <wp:postmeta>
270
- <wp:meta_key><![CDATA[_wp_attachment_metadata]]></wp:meta_key>
271
- <wp:meta_value><![CDATA[a:5:{s:5:"width";i:400;s:6:"height";i:239;s:4:"file";s:47:"2016/03/pexels-photo-211342-e1522931178155.jpeg";s:5:"sizes";a:21:{s:15:"wp_review_large";a:4:{s:4:"file";s:32:"pexels-photo-211342-370x210.jpeg";s:5:"width";i:370;s:6:"height";i:210;s:9:"mime-type";s:10:"image/jpeg";}s:15:"wp_review_small";a:4:{s:4:"file";s:31:"pexels-photo-211342-100x65.jpeg";s:5:"width";i:100;s:6:"height";i:65;s:9:"mime-type";s:10:"image/jpeg";}s:14:"post-thumbnail";a:4:{s:4:"file";s:32:"pexels-photo-211342-223x137.jpeg";s:5:"width";i:223;s:6:"height";i:137;s:9:"mime-type";s:10:"image/jpeg";}s:17:"blogging-featured";a:4:{s:4:"file";s:32:"pexels-photo-211342-370x210.jpeg";s:5:"width";i:370;s:6:"height";i:210;s:9:"mime-type";s:10:"image/jpeg";}s:21:"blogging-featuredfull";a:4:{s:4:"file";s:32:"pexels-photo-211342-634x304.jpeg";s:5:"width";i:634;s:6:"height";i:304;s:9:"mime-type";s:10:"image/jpeg";}s:20:"blogging-widgetthumb";a:4:{s:4:"file";s:31:"pexels-photo-211342-100x65.jpeg";s:5:"width";i:100;s:6:"height";i:65;s:9:"mime-type";s:10:"image/jpeg";}s:19:"blogging-widgetfull";a:4:{s:4:"file";s:32:"pexels-photo-211342-370x210.jpeg";s:5:"width";i:370;s:6:"height";i:210;s:9:"mime-type";s:10:"image/jpeg";}s:16:"blogging-slider1";a:4:{s:4:"file";s:32:"pexels-photo-211342-770x430.jpeg";s:5:"width";i:770;s:6:"height";i:430;s:9:"mime-type";s:10:"image/jpeg";}s:16:"blogging-slider2";a:4:{s:4:"file";s:32:"pexels-photo-211342-370x430.jpeg";s:5:"width";i:370;s:6:"height";i:430;s:9:"mime-type";s:10:"image/jpeg";}s:9:"thumbnail";a:4:{s:4:"file";s:32:"pexels-photo-211342-150x150.jpeg";s:5:"width";i:150;s:6:"height";i:150;s:9:"mime-type";s:10:"image/jpeg";}s:6:"medium";a:4:{s:4:"file";s:32:"pexels-photo-211342-300x179.jpeg";s:5:"width";i:300;s:6:"height";i:179;s:9:"mime-type";s:10:"image/jpeg";}s:12:"medium_large";a:4:{s:4:"file";s:32:"pexels-photo-211342-768x458.jpeg";s:5:"width";i:768;s:6:"height";i:458;s:9:"mime-type";s:10:"image/jpeg";}s:5:"large";a:4:{s:4:"file";s:33:"pexels-photo-211342-1024x611.jpeg";s:5:"width";i:1024;s:6:"height";i:611;s:9:"mime-type";s:10:"image/jpeg";}s:26:"post-thumbnail_old_203x150";a:4:{s:4:"file";s:32:"pexels-photo-211342-203x150.jpeg";s:5:"width";i:203;s:6:"height";i:150;s:9:"mime-type";s:10:"image/jpeg";}s:14:"magxp-featured";a:4:{s:4:"file";s:32:"pexels-photo-211342-203x150.jpeg";s:5:"width";i:203;s:6:"height";i:150;s:9:"mime-type";s:10:"image/jpeg";}s:19:"magxp-featured-blog";a:4:{s:4:"file";s:32:"pexels-photo-211342-634x280.jpeg";s:5:"width";i:634;s:6:"height";i:280;s:9:"mime-type";s:10:"image/jpeg";}s:17:"magxp-widgetthumb";a:4:{s:4:"file";s:30:"pexels-photo-211342-65x65.jpeg";s:5:"width";i:65;s:6:"height";i:65;s:9:"mime-type";s:10:"image/jpeg";}s:16:"magxp-widgetfull";a:4:{s:4:"file";s:32:"pexels-photo-211342-300x180.jpeg";s:5:"width";i:300;s:6:"height";i:180;s:9:"mime-type";s:10:"image/jpeg";}s:12:"magxp-slider";a:4:{s:4:"file";s:32:"pexels-photo-211342-960x472.jpeg";s:5:"width";i:960;s:6:"height";i:472;s:9:"mime-type";s:10:"image/jpeg";}s:17:"magxp-sliderthumb";a:4:{s:4:"file";s:31:"pexels-photo-211342-124x74.jpeg";s:5:"width";i:124;s:6:"height";i:74;s:9:"mime-type";s:10:"image/jpeg";}s:23:"magxp-widgetsliderthumb";a:4:{s:4:"file";s:32:"pexels-photo-211342-125x125.jpeg";s:5:"width";i:125;s:6:"height";i:125;s:9:"mime-type";s:10:"image/jpeg";}}s:10:"image_meta";a:12:{s:8:"aperture";s:1:"0";s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";s:1:"0";s:9:"copyright";s:0:"";s:12:"focal_length";s:1:"0";s:3:"iso";s:1:"0";s:13:"shutter_speed";s:1:"0";s:5:"title";s:0:"";s:11:"orientation";s:1:"0";s:8:"keywords";a:0:{}}}]]></wp:meta_value>
272
- </wp:postmeta>
273
- <wp:postmeta>
274
- <wp:meta_key><![CDATA[_mts_demo_post]]></wp:meta_key>
275
- <wp:meta_value><![CDATA[1]]></wp:meta_value>
276
- </wp:postmeta>
277
- <wp:postmeta>
278
- <wp:meta_key><![CDATA[_wp_attachment_backup_sizes]]></wp:meta_key>
279
- <wp:meta_value><![CDATA[a:1:{s:9:"full-orig";a:3:{s:5:"width";i:1920;s:6:"height";i:1146;s:4:"file";s:24:"pexels-photo-211342.jpeg";}}]]></wp:meta_value>
280
- </wp:postmeta>
281
- </item>
282
- <item>
283
- <title>iphone-game-pad-gaming</title>
284
- <link>http://demo.mythemeshop.com/wp-review-pro/iphone-game-pad-gaming/</link>
285
- <pubDate>Thu, 12 Jan 2017 07:19:07 +0000</pubDate>
286
- <dc:creator><![CDATA[N8FnGO1Y]]></dc:creator>
287
- <guid isPermaLink="false">https://demo.mythemeshop.com/wp-review-pro-new/files/2016/03/iphone-game-pad-gaming.jpg</guid>
288
- <description></description>
289
- <content:encoded><![CDATA[]]></content:encoded>
290
- <excerpt:encoded><![CDATA[]]></excerpt:encoded>
291
- <wp:post_id>304</wp:post_id>
292
- <wp:post_date><![CDATA[2017-01-12 07:19:07]]></wp:post_date>
293
- <wp:post_date_gmt><![CDATA[2017-01-12 07:19:07]]></wp:post_date_gmt>
294
- <wp:comment_status><![CDATA[open]]></wp:comment_status>
295
- <wp:ping_status><![CDATA[closed]]></wp:ping_status>
296
- <wp:post_name><![CDATA[iphone-game-pad-gaming]]></wp:post_name>
297
- <wp:status><![CDATA[inherit]]></wp:status>
298
- <wp:post_parent>0</wp:post_parent>
299
- <wp:menu_order>0</wp:menu_order>
300
- <wp:post_type><![CDATA[attachment]]></wp:post_type>
301
- <wp:post_password><![CDATA[]]></wp:post_password>
302
- <wp:is_sticky>0</wp:is_sticky>
303
- <wp:attachment_url><![CDATA[https://demo.mythemeshop.com/wp-review-pro/files/2016/03/iphone-game-pad-gaming-e1522931146673.jpg]]></wp:attachment_url>
304
- <wp:postmeta>
305
- <wp:meta_key><![CDATA[_wp_attached_file]]></wp:meta_key>
306
- <wp:meta_value><![CDATA[2016/03/iphone-game-pad-gaming-e1522931146673.jpg]]></wp:meta_value>
307
- </wp:postmeta>
308
- <wp:postmeta>
309
- <wp:meta_key><![CDATA[_wp_attachment_metadata]]></wp:meta_key>
310
- <wp:meta_value><![CDATA[a:5:{s:5:"width";i:400;s:6:"height";i:267;s:4:"file";s:49:"2016/03/iphone-game-pad-gaming-e1522931146673.jpg";s:5:"sizes";a:21:{s:15:"wp_review_large";a:4:{s:4:"file";s:34:"iphone-game-pad-gaming-370x210.jpg";s:5:"width";i:370;s:6:"height";i:210;s:9:"mime-type";s:10:"image/jpeg";}s:15:"wp_review_small";a:4:{s:4:"file";s:33:"iphone-game-pad-gaming-100x65.jpg";s:5:"width";i:100;s:6:"height";i:65;s:9:"mime-type";s:10:"image/jpeg";}s:14:"post-thumbnail";a:4:{s:4:"file";s:34:"iphone-game-pad-gaming-223x137.jpg";s:5:"width";i:223;s:6:"height";i:137;s:9:"mime-type";s:10:"image/jpeg";}s:17:"blogging-featured";a:4:{s:4:"file";s:34:"iphone-game-pad-gaming-370x210.jpg";s:5:"width";i:370;s:6:"height";i:210;s:9:"mime-type";s:10:"image/jpeg";}s:21:"blogging-featuredfull";a:4:{s:4:"file";s:34:"iphone-game-pad-gaming-634x304.jpg";s:5:"width";i:634;s:6:"height";i:304;s:9:"mime-type";s:10:"image/jpeg";}s:20:"blogging-widgetthumb";a:4:{s:4:"file";s:33:"iphone-game-pad-gaming-100x65.jpg";s:5:"width";i:100;s:6:"height";i:65;s:9:"mime-type";s:10:"image/jpeg";}s:19:"blogging-widgetfull";a:4:{s:4:"file";s:34:"iphone-game-pad-gaming-370x210.jpg";s:5:"width";i:370;s:6:"height";i:210;s:9:"mime-type";s:10:"image/jpeg";}s:16:"blogging-slider1";a:4:{s:4:"file";s:34:"iphone-game-pad-gaming-770x430.jpg";s:5:"width";i:770;s:6:"height";i:430;s:9:"mime-type";s:10:"image/jpeg";}s:16:"blogging-slider2";a:4:{s:4:"file";s:34:"iphone-game-pad-gaming-370x430.jpg";s:5:"width";i:370;s:6:"height";i:430;s:9:"mime-type";s:10:"image/jpeg";}s:9:"thumbnail";a:4:{s:4:"file";s:34:"iphone-game-pad-gaming-150x150.jpg";s:5:"width";i:150;s:6:"height";i:150;s:9:"mime-type";s:10:"image/jpeg";}s:6:"medium";a:4:{s:4:"file";s:34:"