Popups – WordPress Popup - Version 1.0.1

Version Description

  • Fixed mobile/tablets display rule and splitted in two new rules
  • Changed cookie script to a small one
  • Now public js is server minified
  • Removed min-width from the popup
Download this release

Release Info

Developer timersys
Plugin Icon 128x128 Popups – WordPress Popup
Version 1.0.1
Comparing to
See all releases

Version 1.0.1

LICENSE.txt ADDED
@@ -0,0 +1,339 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Lesser General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
+
284
+ If you develop a new program, and you want it to be of the greatest
285
+ possible use to the public, the best way to achieve this is to make it
286
+ free software which everyone can redistribute and change under these terms.
287
+
288
+ To do so, attach the following notices to the program. It is safest
289
+ to attach them to the start of each source file to most effectively
290
+ convey the exclusion of warranty; and each file should have at least
291
+ the "copyright" line and a pointer to where the full notice is found.
292
+
293
+ <one line to give the program's name and a brief idea of what it does.>
294
+ Copyright (C) <year> <name of author>
295
+
296
+ This program is free software; you can redistribute it and/or modify
297
+ it under the terms of the GNU General Public License as published by
298
+ the Free Software Foundation; either version 2 of the License, or
299
+ (at your option) any later version.
300
+
301
+ This program is distributed in the hope that it will be useful,
302
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
+ GNU General Public License for more details.
305
+
306
+ You should have received a copy of the GNU General Public License along
307
+ with this program; if not, write to the Free Software Foundation, Inc.,
308
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
+
310
+ Also add information on how to contact you by electronic and paper mail.
311
+
312
+ If the program is interactive, make it output a short notice like this
313
+ when it starts in an interactive mode:
314
+
315
+ Gnomovision version 69, Copyright (C) year name of author
316
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
+ This is free software, and you are welcome to redistribute it
318
+ under certain conditions; type `show c' for details.
319
+
320
+ The hypothetical commands `show w' and `show c' should show the appropriate
321
+ parts of the General Public License. Of course, the commands you use may
322
+ be called something other than `show w' and `show c'; they could even be
323
+ mouse-clicks or menu items--whatever suits your program.
324
+
325
+ You should also get your employer (if you work as a programmer) or your
326
+ school, if any, to sign a "copyright disclaimer" for the program, if
327
+ necessary. Here is a sample; alter the names:
328
+
329
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
+
332
+ <signature of Ty Coon>, 1 April 1989
333
+ Ty Coon, President of Vice
334
+
335
+ This General Public License does not permit incorporating your program into
336
+ proprietary programs. If your program is a subroutine library, you may
337
+ consider it more useful to permit linking proprietary applications with the
338
+ library. If this is what you want to do, use the GNU Lesser General
339
+ Public License instead of this License.
README.txt ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Popups - Wordpress Popups ===
2
+ Contributors: timersys
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=K4T6L69EV9G2Q
4
+ Tags: twitter,google+, facebook,Popups, twitter follow, facebook like, google plus,social boost, social splash, popup, facebook popup, scroll popups, popups, wordpress popup, wp popups
5
+ Requires at least: 3.6
6
+ Tested up to: 3.9.1
7
+ Stable tag: 1.0.1
8
+ Text Domain: spucpt
9
+ License: GPLv2 or later
10
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
+
12
+ Increase your followers ratio 40% with the new Popups - Multiple popup options, scroll triggered popups with multiple options
13
+
14
+ == Description ==
15
+
16
+ The new Popups plugin can display multiple popups. Is the perfect solution to increase your social followers, your mailing lists by adding a form like mailchimp or to display any important message.
17
+
18
+
19
+ There are multiple display filters that can be combined:
20
+
21
+ * Show popup on specific pages, templates, posts, etc
22
+ * Filter user from search engines
23
+ * Filter users that never commented
24
+ * Filter users via specific referrer
25
+ * Filter users via roles
26
+ * Show popup to logged / non logged users
27
+ * Show or not to mobile and tablet users
28
+
29
+
30
+ = Available Settings =
31
+
32
+ * Choose from 5 different popup locations
33
+ * Trigger popup after X seconds or after scrolling % of page
34
+ * Auto hide the popup if the user scroll up
35
+ * Change font color, background, borders, etc
36
+ * You can also configure background opacity.
37
+ * Days until popup shows again
38
+
39
+
40
+
41
+ = Plugin's Official Site =
42
+
43
+ Popups ([http://wp.timersys.com/free-plugins/social-popup/](http://wp.timersys.com/free-plugins/popups/))
44
+
45
+ = Github =
46
+
47
+ Fork me in https://github.com/timersys/popups/
48
+
49
+ = Increase your twitter followers =
50
+
51
+ Increase your Twitter followers with Twitter likebox Plugin ([http://wordpress.org/extend/plugins/twitter-like-box-reloaded/](http://wordpress.org/extend/plugins/twitter-like-box-reloaded/))
52
+
53
+ = Wordpress Social Invitations =
54
+
55
+ Enhance your site by letting your users send Social Invitations ([http://wp.timersys.com/wordpress-social-invitations/](http://wp.timersys.com/wordpress-social-invitations/?utm_source=social-popup&utm_medium=readme))
56
+
57
+ == Installation ==
58
+
59
+ 1. Unzip and Upload the directory 'social-popup' to the '/wp-content/plugins/' directory
60
+
61
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
62
+
63
+ 3. Go to Popups menu and add as many popups as needed
64
+
65
+
66
+ == Changelog ==
67
+
68
+ = 1.0.1 =
69
+
70
+ * Fixed mobile/tablets display rule and splitted in two new rules
71
+ * Changed cookie script to a small one
72
+ * Now public js is server minified
73
+ * Removed min-width from the popup
74
+
75
+ = 1.0.0 =
76
+
77
+ * Recoded from scratch. This is a totally new plugin
78
+ * Multiple popups are available now handled with custom post types
79
+
80
+
81
+
82
+ == Screenshots ==
83
+
84
+ 1. Popups Front end
85
+ 2. Popups Back end
admin/assets/css/admin.css ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* This stylesheet is used to style the admin option form of the plugin. */
2
+ /*---------------------------------------------------------------------------------------------
3
+ Tables
4
+ ---------------------------------------------------------------------------------------------*/
5
+ #spu-rules > .inside {
6
+ padding: 0;
7
+ }
8
+ table.spu_table {
9
+ border: 0 none;
10
+ background: #fff;
11
+ }
12
+
13
+ table.spu_table tbody tr td {
14
+ padding: 13px 15px;
15
+ border-top: 1px solid #f5f5f5;
16
+ border-bottom: 0 none;
17
+ }
18
+
19
+ table.spu_table tbody tr td.label {
20
+ width: 24%;
21
+ vertical-align: top;
22
+ background: #F9F9F9;
23
+ border-top: 1px solid #f0f0f0;
24
+ border-right: 1px solid #E1E1E1;
25
+ }
26
+
27
+ table.spu_table > tbody > tr:first-child > td,
28
+ table.spu_table > tbody > tr:first-child > td.label {
29
+ border-top: 0 none;
30
+ }
31
+
32
+ table.spu_table td.label ul.hl {
33
+ margin: 20px 0 0;
34
+ }
35
+ table.spu_table td.label ul.hl li {
36
+ margin: 0 3px 0 0;
37
+
38
+ }
39
+
40
+ table.spu_table td.label ul.hl li a.acf-button {
41
+ font-size: 12px;
42
+ padding: 6px 10px;
43
+ font-weight: normal;
44
+ }
45
+
46
+ table.spu_table tbody tr td.label label {
47
+ display: block;
48
+ font-size: 13px;
49
+ line-height: 1.4em;
50
+ font-weight: bold;
51
+ padding: 0;
52
+ margin: 0 0 3px;
53
+ color: #333;
54
+ }
55
+
56
+ table.spu_table tbody tr td.label label span.required {
57
+ color: #f00;
58
+ display: inline;
59
+ margin-left: 3px;
60
+ }
61
+
62
+
63
+ table.spu_table tbody tr td.label p {
64
+ display: block;
65
+ font-size: 12px;
66
+ line-height: 1.4em;
67
+ padding: 0 !important;
68
+ margin: 3px 0 0 !important;
69
+ font-style: normal;
70
+ line-height: 16px;
71
+ color: #899194;
72
+ }
73
+
74
+ table.spu_table input[type="text"],
75
+ table.spu_table input[type="number"],
76
+ table.spu_table textarea,
77
+ table.spu_table select{
78
+ width: 99.95%;
79
+ padding: 3px 5px;
80
+ outline: none;
81
+ }
82
+
83
+ table.spu_table select {
84
+ padding: 2px;
85
+ }
86
+
87
+ table.spu_table select option {
88
+ padding: 3px;
89
+ }
90
+
91
+ table.spu_table input[type="text"]:focus,
92
+ table.spu_table textarea:focus,
93
+ table.spu_table select:focus {
94
+ border-color:#98B6CB;
95
+ }
96
+ #spu-options .no-top-margin{
97
+ margin-top:0 !important;
98
+ }
99
+
100
+ #spu-options .wp-picker-clear, #spu-options div.wp-picker-holder, #spu-options .wp-picker-input-wrap {
101
+ background:white;
102
+ z-index: 999 !important;
103
+ position: absolute !important;
104
+ }
105
+ .spu-label {
106
+ display: block;
107
+ font-weight: bold;
108
+ margin-bottom: 6px;
109
+ }
110
+ #spu-options .wp-picker-container{ white-space: nowrap; }
111
+ input#spu-width {
112
+ width: 90px;
113
+ }
114
+ /*---------------------------------------------------------------------------------------------
115
+ *
116
+ * Rules
117
+ *
118
+ *---------------------------------------------------------------------------------------------*/
119
+
120
+ #spu-rules .inside {
121
+ margin: 0;
122
+ padding: 0;
123
+ }
124
+
125
+ #spu-rules .rules-groups {
126
+ padding: 5px 0;
127
+ }
128
+
129
+ #spu-rules h4 {
130
+ margin: 15px 0 5px;
131
+ }
132
+
133
+ #spu-rules .rules-group {
134
+ margin: 0 0 15px;
135
+ }
136
+
137
+ #spu-rules .rules-group h4 {
138
+ margin: 0 0 3px;;
139
+ }
140
+
141
+ #spu-rules .rules-group table.spu_table tbody tr td {
142
+ padding: 4px;
143
+ border: 0 none;
144
+ }
145
+
146
+ #spu-rules .rules-group td.param {
147
+ width: 40%;
148
+ }
149
+
150
+ #spu-rules .rules-group td.operator {
151
+ width: 20%;
152
+ }
153
+
154
+ #spu-rules .rules-group td.add {
155
+ width: 40px;
156
+ }
157
+
158
+ #spu-rules .rules-group td.remove {
159
+ width: 18px;
160
+ vertical-align: middle;
161
+ }
162
+
163
+ #spu-rules .rules-group tr .rules-remove-rule {
164
+ display: none;
165
+ }
166
+
167
+ #spu-rules .rules-group tr:hover .rules-remove-rule {
168
+ display: block;
169
+ }
170
+
171
+ .spu-loading{
172
+ height: 16px;
173
+ margin: 10px auto;
174
+ padding: 6px;
175
+ width: 16px;
176
+ }
177
+
178
+
179
+ /* Don't allow user to delete the first field group */
180
+ #spu-rules .rules-group:first-child tr:first-child:hover .rules-remove-rule {
181
+ display: none;
182
+ }
admin/assets/css/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
admin/assets/js/admin.js ADDED
@@ -0,0 +1,246 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var spu = {
2
+ // module
3
+ rules : null
4
+ };
5
+
6
+ SPU_ADMIN = (function ( $ ) {
7
+
8
+
9
+ $(document).ready(function(){
10
+
11
+ spu.rules.init();
12
+ //Thanks to scoll triggered boxes plugin for this piece of javascript
13
+ $('#spu-options input.spu-color-field').wpColorPicker({ change: applyStyles, clear: applyStyles });
14
+ $("#spu-options :input").not(".spu-color-field").change(applyStyles);
15
+
16
+ });
17
+
18
+
19
+ // functions
20
+ function getPxValue($el, retval)
21
+ {
22
+ if($el.val()) {
23
+ return parseInt($el.val());
24
+ } else {
25
+ return (retval !== undefined) ? retval + "px" : 0;
26
+ }
27
+ }
28
+
29
+ function getColor($el, retval)
30
+ {
31
+ if($el.val().length > 0) {
32
+ return $el.wpColorPicker('color');
33
+ } else {
34
+ return (retval !== undefined) ? retval : '';
35
+ }
36
+ }
37
+
38
+ function applyStyles()
39
+ {
40
+ var $editor = $("#content_ifr").contents().find('html');
41
+
42
+ $editor.css({
43
+ 'background': 'white'
44
+ });
45
+
46
+ $editor.find("#tinymce").css({
47
+ 'padding': '25px',
48
+ 'background-color': getColor($("#spu-background-color")),
49
+ 'border-color': getColor($("#spu-border-color")),
50
+ 'border-width': getPxValue($("#spu-border-width")),
51
+ 'border-style': 'solid',
52
+ 'display': "inline-block",
53
+ 'width': $("#spu-width").val(),
54
+ 'color': getColor($("#spu-color")),
55
+ 'height': 'auto',
56
+ 'min-width': '200px'
57
+ });
58
+ }
59
+
60
+
61
+ /*
62
+ * Rules
63
+ *
64
+ * Js for needed for rules
65
+ *
66
+ * @since: 1.0.0
67
+ * Thanks to advanced custom fields plugin for part of this code
68
+ */
69
+
70
+ spu.rules = {
71
+ $el : null,
72
+ init : function(){
73
+
74
+ // vars
75
+ var _this = this;
76
+
77
+
78
+ // $el
79
+ _this.$el = $('#spu-rules');
80
+
81
+
82
+ // add rule
83
+ _this.$el.on('click', '.rules-add-rule', function(){
84
+
85
+ _this.add_rule( $(this).closest('tr') );
86
+
87
+ return false;
88
+
89
+ });
90
+
91
+
92
+ // remove rule
93
+ _this.$el.on('click', '.rules-remove-rule', function(){
94
+
95
+ _this.remove_rule( $(this).closest('tr') );
96
+
97
+ return false;
98
+
99
+ });
100
+
101
+
102
+ // add rule
103
+ _this.$el.on('click', '.rules-add-group', function(){
104
+
105
+ _this.add_group();
106
+
107
+ return false;
108
+
109
+ });
110
+
111
+
112
+ // change rule
113
+ _this.$el.on('change', '.param select', function(){
114
+
115
+ // vars
116
+ var $tr = $(this).closest('tr'),
117
+ rule_id = $tr.attr('data-id'),
118
+ $group = $tr.closest('.rules-group'),
119
+ group_id = $group.attr('data-id'),
120
+ ajax_data = {
121
+ 'action' : "spu/field_group/render_rules",
122
+ 'nonce' : spu_js.nonce,
123
+ 'rule_id' : rule_id,
124
+ 'group_id' : group_id,
125
+ 'value' : '',
126
+ 'param' : $(this).val()
127
+ };
128
+
129
+
130
+ // add loading gif
131
+ var div = $('<div class="spu-loading"><img src="'+spu_js.admin_url+'/images/wpspin_light.gif"/> </div>');
132
+ $tr.find('td.value').html( div );
133
+
134
+
135
+ // load rules html
136
+ $.ajax({
137
+ url: ajaxurl,
138
+ data: ajax_data,
139
+ type: 'post',
140
+ dataType: 'html',
141
+ success: function(html){
142
+
143
+ div.replaceWith(html);
144
+
145
+ }
146
+ });
147
+
148
+
149
+ });
150
+
151
+ },
152
+ add_rule : function( $tr ){
153
+
154
+ // vars
155
+ var $tr2 = $tr.clone(),
156
+ old_id = $tr2.attr('data-id'),
157
+ new_id = 'rule_' + ( parseInt( old_id.replace('rule_', ''), 10 ) + 1);
158
+
159
+
160
+ // update names
161
+ $tr2.find('[name]').each(function(){
162
+
163
+ $(this).attr('name', $(this).attr('name').replace( old_id, new_id ));
164
+ $(this).attr('id', $(this).attr('id').replace( old_id, new_id ));
165
+
166
+ });
167
+
168
+
169
+ // update data-i
170
+ $tr2.attr( 'data-id', new_id );
171
+
172
+
173
+ // add tr
174
+ $tr.after( $tr2 );
175
+
176
+
177
+ return false;
178
+
179
+ },
180
+ remove_rule : function( $tr ){
181
+
182
+ // vars
183
+ var siblings = $tr.siblings('tr').length;
184
+
185
+
186
+ if( siblings == 0 )
187
+ {
188
+ // remove group
189
+ this.remove_group( $tr.closest('.rules-group') );
190
+ }
191
+ else
192
+ {
193
+ // remove tr
194
+ $tr.remove();
195
+ }
196
+
197
+ },
198
+ add_group : function(){
199
+
200
+ // vars
201
+ var $group = this.$el.find('.rules-group:last'),
202
+ $group2 = $group.clone(),
203
+ old_id = $group2.attr('data-id'),
204
+ new_id = 'group_' + ( parseInt( old_id.replace('group_', ''), 10 ) + 1);
205
+
206
+
207
+ // update names
208
+ $group2.find('[name]').each(function(){
209
+
210
+ $(this).attr('name', $(this).attr('name').replace( old_id, new_id ));
211
+ $(this).attr('id', $(this).attr('id').replace( old_id, new_id ));
212
+
213
+ });
214
+
215
+
216
+ // update data-i
217
+ $group2.attr( 'data-id', new_id );
218
+
219
+
220
+ // update h4
221
+ $group2.find('h4').text( spu_js.l10n.or );
222
+
223
+
224
+ // remove all tr's except the first one
225
+ $group2.find('tr:not(:first)').remove();
226
+
227
+
228
+ // add tr
229
+ $group.after( $group2 );
230
+
231
+
232
+
233
+ },
234
+ remove_group : function( $group ){
235
+
236
+ $group.remove();
237
+
238
+ }
239
+ };
240
+
241
+ return {
242
+ onTinyMceInit: function() {
243
+ applyStyles();
244
+ }
245
+ }
246
+ }(jQuery));
admin/assets/js/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
admin/class-social-popup-admin.php ADDED
@@ -0,0 +1,511 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Popups.
4
+ *
5
+ * @package SocialPopup_Admin
6
+ * @author Damian Logghe <info@timersys.com>
7
+ * @license GPL-2.0+
8
+ * @link http://wp.timersys.com
9
+ * @copyright 2014 Timersys
10
+ */
11
+
12
+
13
+ define( SPU_ADMIN_DIR , plugin_dir_path(__FILE__) );
14
+
15
+ // Include Helper class
16
+ include_once( SPU_PLUGIN_DIR . 'includes/class-spu-helper.php' );
17
+
18
+
19
+ /**
20
+ * Admin Class of the plugin
21
+ *
22
+ * @package SocialPopup_Admin
23
+ * @author Damian Logghe <info@timersys.com>
24
+ */
25
+ class SocialPopup_Admin {
26
+
27
+ /**
28
+ * Instance of this class.
29
+ *
30
+ * @since 1.0.0
31
+ *
32
+ * @var object
33
+ */
34
+ protected static $instance = null;
35
+
36
+ /**
37
+ * Slug of the plugin screen.
38
+ *
39
+ * @since 1.0.0
40
+ *
41
+ * @var string
42
+ */
43
+ protected $plugin_screen_hook_suffix = null;
44
+
45
+ /**
46
+ * Initialize the plugin by loading admin scripts & styles and adding a
47
+ * settings page and menu.
48
+ *
49
+ * @since 1.0.0
50
+ */
51
+ private function __construct() {
52
+
53
+
54
+ $plugin = SocialPopup::get_instance();
55
+ $this->plugin_slug = $plugin->get_plugin_slug();
56
+
57
+ //settings name
58
+ $this->options_name = $this->plugin_slug .'_settings';
59
+
60
+
61
+ //Register cpt
62
+ add_action( 'init', array( $this, 'register_cpt' ) );
63
+
64
+ //Add our metaboxes
65
+ add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
66
+ //Save metaboxes
67
+ add_action( 'save_post', array( $this, 'save_meta_options' ), 20 );
68
+
69
+ // Load admin style sheet and JavaScript.
70
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
71
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
72
+
73
+ // Add an action link pointing to the options page.
74
+ $plugin_basename = plugin_basename( plugin_dir_path( realpath( dirname( __FILE__ ) ) ) . $this->plugin_slug . '.php' );
75
+ add_filter( 'plugin_action_links_' . $plugin_basename, array( $this, 'add_action_links' ) );
76
+
77
+ //Filters for rules
78
+ add_filter('spu/get_post_types', array($this, 'get_post_types'), 1, 3);
79
+ add_filter('spu/get_taxonomies', array($this, 'get_taxonomies'), 1, 3);
80
+
81
+ //AJAX Actions
82
+ add_action('wp_ajax_spu/field_group/render_rules', array( 'Spu_Helper', 'ajax_render_rules' ) );
83
+
84
+ //Tinymce
85
+ add_filter( 'tiny_mce_before_init', array($this, 'tinymce_init') );
86
+
87
+ }
88
+
89
+ /**
90
+ * Return an instance of this class.
91
+ *
92
+ * @since 1.0.0
93
+ *
94
+ * @return object A single instance of this class.
95
+ */
96
+ public static function get_instance() {
97
+
98
+
99
+ // If the single instance hasn't been set, set it now.
100
+ if ( null == self::$instance ) {
101
+ self::$instance = new self;
102
+ }
103
+
104
+ return self::$instance;
105
+ }
106
+
107
+
108
+ /**
109
+ * Register custom post types
110
+ * @return void
111
+ */
112
+ function register_cpt() {
113
+
114
+ $labels = array(
115
+ 'name' => _x( 'Popups', 'post type general name', $this->plugin_slug ),
116
+ 'singular_name' => _x( 'Popups', 'post type singular name', $this->plugin_slug ),
117
+ 'menu_name' => _x( 'Popups', 'admin menu', $this->plugin_slug ),
118
+ 'name_admin_bar' => _x( 'Popups', 'add new on admin bar', $this->plugin_slug ),
119
+ 'add_new' => _x( 'Add New', 'Popups', $this->plugin_slug ),
120
+ 'add_new_item' => __( 'Add New Popups', $this->plugin_slug ),
121
+ 'new_item' => __( 'New Popups', $this->plugin_slug ),
122
+ 'edit_item' => __( 'Edit Popups', $this->plugin_slug ),
123
+ 'view_item' => __( 'View Popups', $this->plugin_slug ),
124
+ 'all_items' => __( 'All Popups', $this->plugin_slug ),
125
+ 'search_items' => __( 'Search Popups', $this->plugin_slug ),
126
+ 'parent_item_colon' => __( 'Parent Popups:', $this->plugin_slug ),
127
+ 'not_found' => __( 'No Popups found.', $this->plugin_slug ),
128
+ 'not_found_in_trash' => __( 'No Popups found in Trash.', $this->plugin_slug )
129
+ );
130
+
131
+ $args = array(
132
+ 'labels' => $labels,
133
+ 'public' => false,
134
+ 'publicly_queryable' => true,
135
+ 'show_ui' => true,
136
+ 'show_in_menu' => true,
137
+ 'query_var' => true,
138
+ 'rewrite' => array( 'slug' => 'spucpt' ),
139
+ 'capability_type' => 'post',
140
+ 'has_archive' => false,
141
+ 'hierarchical' => false,
142
+ 'menu_position' => null,
143
+ 'menu_icon' => 'dashicons-share-alt',
144
+ 'supports' => array( 'title', 'editor' )
145
+ );
146
+
147
+ register_post_type( 'spucpt', $args );
148
+
149
+ }
150
+
151
+ /**
152
+ * Register the metaboxes for our cpt and remove others
153
+ */
154
+ public function add_meta_boxes() {
155
+
156
+ add_meta_box(
157
+ 'spu-help',
158
+ __( 'PopUp Shortcodes', $this->plugin_slug ),
159
+ array( $this, 'popup_help' ),
160
+ 'spucpt',
161
+ 'normal',
162
+ 'core'
163
+ );
164
+
165
+ add_meta_box(
166
+ 'spu-rules',
167
+ __( 'PopUp Display Rules', $this->plugin_slug ),
168
+ array( $this, 'popup_rules' ),
169
+ 'spucpt',
170
+ 'normal',
171
+ 'core'
172
+ );
173
+
174
+ add_meta_box(
175
+ 'spu-options',
176
+ __( 'Display Options', $this->plugin_slug ),
177
+ array( $this, 'popup_options' ),
178
+ 'spucpt',
179
+ 'normal',
180
+ 'core'
181
+ );
182
+
183
+ add_meta_box(
184
+ 'spu-support',
185
+ __( 'Need support?', $this->plugin_slug ),
186
+ array( $this, 'metabox_support' ),
187
+ 'spucpt',
188
+ 'side'
189
+ );
190
+
191
+ add_meta_box(
192
+ 'spu-donate',
193
+ __( 'Donate $10, $20 or $50', $this->plugin_slug ),
194
+ array( $this, 'metabox_donate' ),
195
+ 'spucpt',
196
+ 'side'
197
+ );
198
+
199
+ add_meta_box(
200
+ 'spu-links',
201
+ __( 'About the developer', $this->plugin_slug ),
202
+ array( $this, 'metabox_links' ),
203
+ 'spucpt',
204
+ 'side'
205
+ );
206
+ }
207
+
208
+ /**
209
+ * Include the metabox view for popup help
210
+ * @param object $post spucpt post object
211
+ * @param array $metabox full metabox items array
212
+ * @since 2.0
213
+ */
214
+ public function popup_help( $post, $metabox ) {
215
+
216
+ include 'views/metabox-help.php';
217
+ }
218
+ /**
219
+ * Include the metabox view for popup rules
220
+ * @param object $post spucpt post object
221
+ * @param array $metabox full metabox items array
222
+ * @since 2.0
223
+ */
224
+ public function popup_rules( $post, $metabox ) {
225
+
226
+ $groups = apply_filters('spu/metaboxes/get_box_rules', Spu_Helper::get_box_rules( $post->ID ), $post->ID);
227
+
228
+ include 'views/metabox-rules.php';
229
+ }
230
+ /**
231
+ * Include the metabox view for popup options
232
+ * @param object $post spucpt post object
233
+ * @param array $metabox full metabox items array
234
+ * @since 2.0
235
+ */
236
+ public function popup_options( $post, $metabox ) {
237
+
238
+ $opts = apply_filters('spu/metaboxes/get_box_options', Spu_Helper::get_box_options( $post->ID ), $post->ID );
239
+
240
+ include 'views/metabox-options.php';
241
+ }
242
+
243
+ /**
244
+ * Include the metabox view for donate box
245
+ * @param object $post spucpt post object
246
+ * @param array $metabox full metabox items array
247
+ * @since 2.0
248
+ */
249
+ public function metabox_donate( $post, $metabox ) {
250
+ include 'views/metabox-donate.php';
251
+ }
252
+ /**
253
+ * Include the metabox view for support box
254
+ * @param object $post spucpt post object
255
+ * @param array $metabox full metabox items array
256
+ * @since 2.0
257
+ */
258
+ public function metabox_support( $post, $metabox ) {
259
+ include 'views/metabox-support.php';
260
+ }
261
+
262
+ /**
263
+ * Include the metabox view for links box
264
+ * @param object $post spucpt post object
265
+ * @param array $metabox full metabox items array
266
+ * @since 2.0
267
+ */
268
+ public function metabox_links( $post, $metabox ) {
269
+ include 'views/metabox-links.php';
270
+ }
271
+
272
+ /**
273
+ * Saves popup options and rules
274
+ */
275
+ public function save_meta_options( $post_id ) {
276
+ // Verify that the nonce is set and valid.
277
+ if ( !isset( $_POST['spu_options_nonce'] ) || ! wp_verify_nonce( $_POST['spu_options_nonce'], 'spu_options' ) ) {
278
+ return $post_id;
279
+ }
280
+
281
+ // If this is an autosave, our form has not been submitted, so we don't want to do anything.
282
+ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
283
+ return $post_id;
284
+ }
285
+ // same for ajax
286
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
287
+ return $post_id;
288
+ }
289
+ // same for cron
290
+ if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
291
+ return $post_id;
292
+ }
293
+ // same for posts revisions
294
+ if ( wp_is_post_revision( $post_id ) ) {
295
+ return $post_id;
296
+ }
297
+
298
+ // can user edit this post?
299
+ if ( ! current_user_can( 'edit_post', $post_id ) ) {
300
+ return $post_id;
301
+ }
302
+
303
+ $post = get_post( $post_id );
304
+ $opts = $_POST['spu'];
305
+ unset( $_POST['spu'] );
306
+
307
+ // sanitize settings
308
+ $opts['css']['bgopacity'] = sanitize_text_field( $opts['css']['bgopacity'] );
309
+ $opts['css']['border_width'] = absint( sanitize_text_field( $opts['css']['border_width'] ) );
310
+ $opts['cookie'] = absint( sanitize_text_field( $opts['cookie'] ) );
311
+ $opts['trigger_number'] = absint( sanitize_text_field( $opts['trigger_number'] ) );
312
+
313
+
314
+ // save box settings
315
+ update_post_meta( $post_id, 'spu_options', $opts );
316
+
317
+ // Start with rules
318
+ if( isset($_POST['spu_rules']) && is_array($_POST['spu_rules']) )
319
+ {
320
+
321
+
322
+ // clean array keys
323
+ $groups = array_values( $_POST['spu_rules'] );
324
+ foreach($groups as $group_id => $group )
325
+ {
326
+ if( is_array($group) )
327
+ {
328
+ // clean array keys
329
+ $groups_a[] = array_values( $group );
330
+
331
+ }
332
+ }
333
+
334
+ update_post_meta( $post_id, 'spu_rules', $groups_a );
335
+ unset( $_POST['spu_rules'] );
336
+ }
337
+
338
+ #$this->flush_rules();
339
+ }
340
+ /**
341
+ * Register and enqueue admin-specific style sheet.
342
+ *
343
+ * @TODO:
344
+ *
345
+ * - Rename "Plugin_Name" to the name your plugin
346
+ *
347
+ * @since 1.0.0
348
+ *
349
+ * @return null Return early if no settings page is registered.
350
+ */
351
+ public function enqueue_admin_styles() {
352
+
353
+ global $pagenow;
354
+
355
+ if ( get_post_type() !== 'spucpt' || !in_array( $pagenow, array( 'post-new.php', 'post.php' ) ) ) {
356
+ return;
357
+ }
358
+ wp_enqueue_style( 'spu-admin-css', plugins_url( 'assets/css/admin.css', __FILE__ ) , '', SocialPopup::VERSION );
359
+
360
+ }
361
+
362
+ /**
363
+ * Register and enqueue admin-specific JavaScript.
364
+ *
365
+ * @TODO:
366
+ *
367
+ * - Rename "Plugin_Name" to the name your plugin
368
+ *
369
+ * @since 1.0.0
370
+ *
371
+ * @return null Return early if no settings page is registered.
372
+ */
373
+ public function enqueue_admin_scripts() {
374
+ global $pagenow;
375
+
376
+ if ( get_post_type() !== 'spucpt' || !in_array( $pagenow, array( 'post-new.php', 'post.php' ) ) ) {
377
+ return;
378
+ }
379
+ wp_enqueue_script( 'spu-admin-js', plugins_url( 'assets/js/admin.js', __FILE__ ) , '', SocialPopup::VERSION );
380
+ wp_localize_script( 'spu-admin-js', 'spu_js',
381
+ array(
382
+ 'admin_url' => admin_url( ),
383
+ 'nonce' => wp_create_nonce( 'spu_nonce' ),
384
+ 'l10n' => array (
385
+ 'or' => __('or', $this->plugin_slug )
386
+ )
387
+ )
388
+ );
389
+ }
390
+
391
+
392
+
393
+
394
+ /**
395
+ * Add settings action link to the plugins page.
396
+ *
397
+ * @since 1.0.0
398
+ */
399
+ public function add_action_links( $links ) {
400
+
401
+ return array_merge(
402
+ array(
403
+ 'settings' => '<a href="' . admin_url( 'options-general.php?page=' . $this->plugin_slug ) . '">' . __( 'Settings', $this->plugin_slug ) . '</a>'
404
+ ),
405
+ $links
406
+ );
407
+
408
+ }
409
+
410
+ /**
411
+ * Return available posts types. Used in filters
412
+ * @param array $post_types custom post types
413
+ * @param array $exclude cpt to explude
414
+ * @param array $include cpts to include
415
+ * @return array Resulting cpts
416
+ */
417
+ function get_post_types( $post_types, $exclude = array(), $include = array() ) {
418
+
419
+ // get all custom post types
420
+ $post_types = array_merge($post_types, get_post_types());
421
+
422
+
423
+ // core include / exclude
424
+ $spu_includes = array_merge( array(), $include );
425
+ $spu_excludes = array_merge( array( 'spucpt', 'acf', 'revision', 'nav_menu_item' ), $exclude );
426
+
427
+
428
+ // include
429
+ foreach( $spu_includes as $p )
430
+ {
431
+ if( post_type_exists($p) )
432
+ {
433
+ $post_types[ $p ] = $p;
434
+ }
435
+ }
436
+
437
+
438
+ // exclude
439
+ foreach( $spu_excludes as $p )
440
+ {
441
+ unset( $post_types[ $p ] );
442
+ }
443
+
444
+
445
+ return $post_types;
446
+
447
+ }
448
+
449
+ /**
450
+ * Get taxonomies. Used in filters rules
451
+ * @param array $choices [description]
452
+ * @param boolean $simple_value [description]
453
+ * @return [type] [description]
454
+ */
455
+ function get_taxonomies( $choices, $simple_value = false ) {
456
+
457
+ // vars
458
+ $post_types = get_post_types();
459
+
460
+
461
+ if($post_types)
462
+ {
463
+ foreach($post_types as $post_type)
464
+ {
465
+ $post_type_object = get_post_type_object($post_type);
466
+ $taxonomies = get_object_taxonomies($post_type);
467
+ if($taxonomies)
468
+ {
469
+ foreach($taxonomies as $taxonomy)
470
+ {
471
+ if(!is_taxonomy_hierarchical($taxonomy)) continue;
472
+ $terms = get_terms($taxonomy, array('hide_empty' => false));
473
+ if($terms)
474
+ {
475
+ foreach($terms as $term)
476
+ {
477
+ $value = $taxonomy . ':' . $term->term_id;
478
+
479
+ if( $simple_value )
480
+ {
481
+ $value = $term->term_id;
482
+ }
483
+
484
+ $choices[$post_type_object->label . ': ' . $taxonomy][$value] = $term->name;
485
+ }
486
+ }
487
+ }
488
+ }
489
+ }
490
+ }
491
+
492
+ return $choices;
493
+ }
494
+
495
+ /**
496
+ * Load tinymce style on load
497
+ * @param [type] $args [description]
498
+ * @return [type] [description]
499
+ */
500
+ public function tinymce_init($args) {
501
+
502
+ if( get_post_type() !== 'spucpt') {
503
+ return $args;
504
+ }
505
+
506
+ $args['setup'] = 'function(ed) { if(typeof SPU_ADMIN === \'undefined\') { return; } ed.onInit.add(SPU_ADMIN.onTinyMceInit); }';
507
+
508
+ return $args;
509
+ }
510
+
511
+ }
admin/includes/class-spu-upgrade.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Upgrade (NOT USED for now)
5
+ *
6
+ * @description: Upgrade rutines and upgrade messages
7
+ * @since 1.0.0
8
+ * @version 1.0
9
+ */
10
+
11
+ class Spu_Upgrade {
12
+
13
+ /**
14
+ * __construct
15
+ *
16
+ * @description:
17
+ * @since 1.0
18
+ */
19
+
20
+ function __construct()
21
+ {
22
+ // actions
23
+ add_action('admin_menu', array($this,'admin_menu'), 11);
24
+
25
+ }
26
+
27
+
28
+ /**
29
+ * admin_menu
30
+ * @since 1.0
31
+ **/
32
+
33
+ function admin_menu()
34
+ {
35
+ // dont run on plugin activate!
36
+ if( isset($_GET['action']) && $_GET['action'] == 'activate-plugin' )
37
+ {
38
+ return;
39
+ }
40
+
41
+ // vars
42
+ $new_version = apply_filters('spu/get_info', 'version');
43
+ $old_version = get_option('spu_version', false);
44
+
45
+ // update info
46
+ global $pagenow;
47
+
48
+ if( $pagenow == 'plugins.php' )
49
+ {
50
+ $hook = apply_filters('spu/get_info', 'hook');
51
+
52
+ add_action( 'in_plugin_update_message-' . $hook, array($this, 'in_plugin_update_message'), 10, 2 );
53
+ }
54
+
55
+
56
+
57
+ }
58
+
59
+
60
+
61
+
62
+
63
+ /**
64
+ * Shows update changelog message
65
+ * @param [type] $plugin_data [description]
66
+ * @param [type] $r [description]
67
+ * @return [type] [description]
68
+ */
69
+ function in_plugin_update_message( $plugin_data, $r )
70
+ {
71
+ // vars
72
+ $version = apply_filters('spu/get_info', 'version');
73
+ #$readme = wp_remote_fopen( 'http://plugins.svn.wordpress.org/advanced-custom-fields/trunk/readme.txt' );
74
+ $readme = wp_remote_fopen( 'http://local.dev.192.168.1.200.xip.io/testdrive/README.txt' );
75
+ $regexp = '/== Changelog ==(.*)= ' . $version . ' =/sm';
76
+ $o = '';
77
+
78
+
79
+ // validate
80
+ if( !$readme )
81
+ {
82
+ return;
83
+ }
84
+
85
+
86
+ // regexp
87
+ preg_match( $regexp, $readme, $matches );
88
+
89
+
90
+ if( ! isset($matches[1]) )
91
+ {
92
+ return;
93
+ }
94
+
95
+
96
+ // render changelog
97
+ $changelog = explode('*', $matches[1]);
98
+ array_shift( $changelog );
99
+
100
+
101
+ if( !empty($changelog) )
102
+ {
103
+ $o .= '<div class="acf-plugin-update-info">';
104
+ $o .= '<h3>' . __("What's new", 'acf') . '</h3>';
105
+ $o .= '<ul>';
106
+
107
+ foreach( $changelog as $item )
108
+ {
109
+ $item = explode('http', $item);
110
+
111
+ $o .= '<li>' . $item[0];
112
+
113
+ if( isset($item[1]) )
114
+ {
115
+ $o .= '<a href="http' . $item[1] . '" target="_blank">' . __("credits",'acf') . '</a>';
116
+ }
117
+
118
+ $o .= '</li>';
119
+
120
+
121
+ }
122
+
123
+ $o .= '</ul></div>';
124
+ }
125
+
126
+ echo $o;
127
+
128
+
129
+ }
130
+
131
+
132
+
133
+ }
134
+
135
+ new Spu_Upgrade();
136
+
137
+ ?>
admin/includes/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
admin/views/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
admin/views/metabox-donate.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Exit if accessed directly
3
+ if ( !defined( 'ABSPATH' ) ) exit;
4
+ ?>
5
+
6
+ <p><?php _e( 'If you like this plugin, consider supporting it by donating.', $this->plugin_slug );?></p>
7
+
8
+ <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=K4T6L69EV9G2Q" class="button-primary"><?php _e( 'Donate with PayPal', $this->plugin_slug );?></a>
9
+
10
+ <p><?php _e( 'Some other ways to support this plugin', $this->plugin_slug );?></p>
11
+ <ul class="ul-square">
12
+ <li><a href="http://wordpress.org/support/view/plugin-reviews/popups?rate=5#postform" target="_blank"><?php _e( 'Leave a &#9733;&#9733;&#9733;&#9733;&#9733; review on WordPress.org', $this->plugin_slug );?></a></li>
13
+ <li><a href="http://wp.timersys.com/free-plugins/popups/" target="_blank"><?php _e( 'Write about Popups on your blog', $this->plugin_slug );?></a></li>
14
+ <li><a href="http://twitter.com/intent/tweet/?text=I+am+using+Social+PopUP+on+my+WordPress+site.+It%27s+great%21&amp;via=chifliiii&amp;url=http%3A%2F%2Fwordpress.org%2Fplugins%2Fpopups%2F" target="_blank"><?php _e( 'Tweet about Popups', $this->plugin_slug );?></a></li>
15
+ <li><a href="http://wordpress.org/plugins/popups/#compatibility"><?php _e( 'Vote "works" on the WordPress.org plugin page', $this->plugin_slug );?></a></li>
16
+ </ul>
admin/views/metabox-help.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Exit if accessed directly
3
+ if ( !defined( 'ABSPATH' ) ) exit;
4
+ ?>
5
+
6
+ <p><?php _e( 'You have three social shortcodes to use that will print a Facebook like, a Google+ Follow and a Twitter follow. Check the available options and default values:', $this->plugin_slug );?></p>
7
+ <p><strong>Facebook:</strong></p>
8
+ <pre>
9
+ [spu-facebook href="" layout="" show_faces="" share="" action="" width=""]
10
+ </pre>
11
+ <a href="fb-opts" onclick="jQuery('#fb-opts').slideToggle();return false;"><?php _e( 'View Facebook Options', $this->plugin_slug );?></a>
12
+ <ul id="fb-opts" style="display:none;">
13
+ <li><b>href:</b> <?php _e( 'Your facebook page url', $this->plugin_slug );?></li>
14
+ <li><b>layout:</b> <?php _e( 'standard, box_count, button - Default: button_count', $this->plugin_slug );?></li>
15
+ <li><b>show_faces:</b> <?php _e( 'true - Default: False', $this->plugin_slug );?></li>
16
+ <li><b>share:</b> <?php _e( 'true - Default: False', $this->plugin_slug );?></li>
17
+ <li><b>action:</b> <?php _e( 'recommend - Default: Like', $this->plugin_slug );?></li>
18
+ <li><b>width:</b></li>
19
+ </ul>
20
+ <p><strong>Google+:</strong></p>
21
+ <pre>
22
+ [spu-google url="" size="" annotation=""]
23
+ </pre>
24
+ <a href="go-opts" onclick="jQuery('#go-opts').slideToggle();return false;"><?php _e( 'View Google+ Options', $this->plugin_slug );?></a>
25
+ <ul id="go-opts" style="display:none;">
26
+ <li><b>url:</b> <?php _e( 'Your Google+ url', $this->plugin_slug );?></li>
27
+ <li><b>size:</b> <?php _e( 'small, standard, tall Default: medium', $this->plugin_slug );?></li>
28
+ <li><b>annotation:</b> <?php _e( 'inline, none - Default: bubble', $this->plugin_slug );?></li>
29
+ </ul>
30
+ <p><strong>Twitter:</strong></p>
31
+ <pre>
32
+ [spu-twitter user="" show_count="" size="" lang="" text=""]
33
+ </pre>
34
+ <a href="tw-opts" onclick="jQuery('#tw-opts').slideToggle();return false;"><?php _e( 'View Twitter Options', $this->plugin_slug );?></a>
35
+ <ul id="tw-opts" style="display:none;">
36
+ <li><b>user:</b> <?php _e( 'Your Twitter user - Default chifliiiii', $this->plugin_slug );?></li>
37
+ <li><b>show_count:</b> <?php _e( 'false Default: true', $this->plugin_slug );?></li>
38
+ <li><b>size:</b> <?php _e( 'large - Default: ""', $this->plugin_slug );?></li>
39
+ <li><b>lang:</b> </li>
40
+ <li><b>text:</b> <?php _e( 'The button text - Default: Follow @chifliiiii', $this->plugin_slug );?></li>
41
+ </ul>
admin/views/metabox-links.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Exit if accessed directly
3
+ if ( !defined( 'ABSPATH' ) ) exit;
4
+ ?>
5
+
6
+ <p><?php _e( 'My name is', $this->plugin_slug );?> <a href="http://twitter.com/chifliiiii">Damian Logghe</a>. <?php _e( 'I develop WordPress plugins and themes.', $this->plugin_slug );?></p>
7
+ <p><?php printf(__( 'Take a look at my <a href="%s">site</a> to see my other plugins or hire me. Subscribe to get updates!', $this->plugin_slug ), 'http://wp.timersys.com/');?></p>
8
+ <p><iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fpages%2FTimersys%2F146687622031640&amp;width&amp;layout=button_count&amp;action=like&amp;show_faces=false&amp;share=true&amp;height=21&amp;appId=249344005267053" scrolling="no" frameborder="0" style="border:none; width: 100%; overflow:hidden; height: 80px;" allowTransparency="true"></iframe></p>
admin/views/metabox-options.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Exit if accessed directly
3
+ if ( !defined( 'ABSPATH' ) ) exit;?>
4
+
5
+ <table class="form-table">
6
+
7
+
8
+ <tr valign="top">
9
+ <th><label for="spu_position"><?php _e( 'Box Position', $this->plugin_slug ); ?></label></th>
10
+ <td>
11
+ <select id="spu_position" name="spu[css][position]" class="widefat">
12
+ <option value="centered" <?php selected($opts['css']['position'], 'centered'); ?>><?php _e( 'Centered', $this->plugin_slug ); ?></option>
13
+ <option value="top-left" <?php selected($opts['css']['position'], 'top-left'); ?>><?php _e( 'Top Left', $this->plugin_slug ); ?></option>
14
+ <option value="top-right" <?php selected($opts['css']['position'], 'top-right'); ?>><?php _e( 'Top Right', $this->plugin_slug ); ?></option>
15
+ <option value="bottom-left" <?php selected($opts['css']['position'], 'bottom-left'); ?>><?php _e( 'Bottom Left', $this->plugin_slug ); ?></option>
16
+ <option value="bottom-right" <?php selected($opts['css']['position'], 'bottom-right'); ?>><?php _e( 'Bottom Right', $this->plugin_slug ); ?></option>
17
+ </select>
18
+ </td>
19
+ <td colspan="2"></td>
20
+ </tr>
21
+ <tr valign="top">
22
+ <th><label for="spu_trigger"><?php _e( 'Trigger action', $this->plugin_slug ); ?></label></th>
23
+ <td class="spu-sm">
24
+ <select id="spu_trigger" name="spu[trigger]" class="widefat">
25
+
26
+ <option value="seconds" <?php selected($opts['trigger'], 'seconds'); ?>><?php _e( 'seconds after page load', $this->plugin_slug ); ?></option>
27
+ <option value="percentage" <?php selected($opts['trigger'], 'percentage'); ?>>% <?php _e( 'of page height', $this->plugin_slug ); ?></option>
28
+
29
+ </select>
30
+ </td>
31
+ <td>
32
+ <input type="number" class="spu-trigger-number" name="spu[trigger_number]" min="0" max="100" value="<?php echo esc_attr($opts['trigger_number']); ?>" />
33
+ </td>
34
+ </tr>
35
+ <tr valign="top">
36
+ <th><label><?php _e( 'Animation', $this->plugin_slug ); ?></label></th>
37
+ <td colspan="3">
38
+ <label><input type="radio" name="spu[animation]" value="fade" <?php checked($opts['animation'], 'fade'); ?> /> <?php _e( 'Fade In', $this->plugin_slug ); ?></label> &nbsp;
39
+ <label><input type="radio" name="spu[animation]" value="slide" <?php checked($opts['animation'], 'slide'); ?> /> <?php _e( 'Slide In', $this->plugin_slug ); ?></label>
40
+ <p class="help"><?php _e( 'Slide will only apply when popup is on the corners', $this->plugin_slug ); ?></p>
41
+ </td>
42
+ </tr>
43
+
44
+ <tr valign="top">
45
+ <th><label for="spu_cookie"><?php _e( 'Cookie expiration days', $this->plugin_slug ); ?></label></th>
46
+ <td colspan="3">
47
+ <input type="number" id="spu_cookie" name="spu[cookie]" min="0" step="1" value="<?php echo esc_attr($opts['cookie']); ?>" />
48
+ <p class="help"><?php _e( 'After closing the box, how many days should it stay hidden?', $this->plugin_slug ); ?></p>
49
+ </td>
50
+
51
+ </tr>
52
+ <tr valign="top">
53
+ <th><label for="spu_auto_hide"><?php _e( 'Auto-hide?', $this->plugin_slug ); ?></label></th>
54
+ <td colspan="3">
55
+ <label><input type="radio" id="spu_auto_hide_1" name="spu[auto_hide]" value="1" <?php checked($opts['auto_hide'], 1); ?> /> <?php _e( 'Yes' ); ?></label> &nbsp;
56
+ <label><input type="radio" id="spu_auto_hide_0" name="spu[auto_hide]" value="0" <?php checked($opts['auto_hide'], 0); ?> /> <?php _e( 'No' ); ?></label> &nbsp;
57
+ <p class="help"><?php _e( 'Hide box again when visitors scroll back up? Only works when Trigger action is set to % of page height', $this->plugin_slug ); ?></p>
58
+ </td>
59
+
60
+ </tr>
61
+ <tr valign="top">
62
+ <th><label for="spu_test_mode"><?php _e( 'Enable test mode?', $this->plugin_slug ); ?></label></th>
63
+ <td colspan="3">
64
+ <label><input type="radio" id="spu_test_mode_1" name="spu[test_mode]" value="1" <?php checked($opts['test_mode'], 1); ?> /> <?php _e( 'Yes' ); ?></label> &nbsp;
65
+ <label><input type="radio" id="spu_test_mode_0" name="spu[test_mode]" value="0" <?php checked($opts['test_mode'], 0); ?> /> <?php _e( 'No' ); ?></label> &nbsp;
66
+ <p class="help"><?php _e( 'If test mode is enabled, the box will show up regardless of whether a cookie has been set. (To admins only)', $this->plugin_slug ); ?></p>
67
+ </td>
68
+ </tr>
69
+ </table>
70
+
71
+ <h3 class="spu-title"><?php _e( 'Appearance', $this->plugin_slug ); ?></h3>
72
+ <table class="form-table">
73
+ <tr valign="top">
74
+ <th><label for="spu_bgopacity"><?php _e( 'Background opacity', $this->plugin_slug ); ?></label></th>
75
+ <td colspan="3">
76
+ <input type="number" id="spu_bgopacity" name="spu[css][bgopacity]" min="0" step="0.1" max="1" value="<?php echo esc_attr($opts['css']['bgopacity']); ?>" />
77
+ <p class="help"><?php _e( 'Leave at 0 for no background. Max value is 1', $this->plugin_slug ); ?></p>
78
+ </td>
79
+
80
+ </tr>
81
+ <tr valign="top">
82
+ <td>
83
+ <label class="spu-label" for="spu-background-color"><?php _e( 'Background color', $this->plugin_slug ); ?></label>
84
+ <input id="spu-background-color" name="spu[css][background_color]" type="text" class="spu-color-field" value="<?php echo esc_attr($opts['css']['background_color']); ?>" />
85
+ </td>
86
+ <td>
87
+ <label class="spu-label" for="spu-color"><?php _e( 'Text color', $this->plugin_slug ); ?></label>
88
+ <input id="spu-color" name="spu[css][color]" type="text" class="spu-color-field" value="<?php echo esc_attr($opts['css']['color']); ?>" />
89
+ </td>
90
+ <td>
91
+ <label class="spu-label" for="spu-width"><?php _e( 'Box width', $this->plugin_slug ); ?></label>
92
+ <input id="spu-width" name="spu[css][width]" id="spu-box-width" type="text" class="small" value="<?php echo esc_attr($opts['css']['width']); ?>" />
93
+ </td>
94
+ </tr>
95
+ <tr valign="top">
96
+ <td>
97
+ <label class="spu-label" for="spu-border-color"><?php _e( 'Border color', $this->plugin_slug ); ?></label>
98
+ <input name="spu[css][border_color]" id="spu-border-color" type="text" class="spu-color-field" value="<?php echo esc_attr($opts['css']['border_color']); ?>" />
99
+ </td>
100
+ <td>
101
+ <label class="spu-label" for="spu-border-width"><?php _e( 'Border width', $this->plugin_slug ); ?></label>
102
+ <input name="spu[css][border_width]" id="spu-border-width" type="number" min="0" max="25" value="<?php echo esc_attr($opts['css']['border_width']); ?>" /> px
103
+ </td>
104
+ <td></td>
105
+ </tr>
106
+ </table>
107
+
108
+ <?php wp_nonce_field( 'spu_options', 'spu_options_nonce' ); ?>
admin/views/metabox-rules.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Exit if accessed directly
3
+ if ( !defined( 'ABSPATH' ) ) exit;
4
+
5
+ /*
6
+ * Meta box - Rules
7
+ *
8
+ * This template file is used when editing a popup and creates the interface for editing popup rules.
9
+ *
10
+ * @type template
11
+ * @since 2.0
12
+ */
13
+ ?>
14
+
15
+ <table class="spu_table widefat" id="spu_ruñes">
16
+ <tbody>
17
+ <tr>
18
+ <td class="label">
19
+ <label for="post_type"><?php _e("Rules", $this->plugin_slug ); ?></label>
20
+ <p class="description"><?php _e("Create a set of rules to determine where the popup will show", $this->plugin_slug ); ?></p>
21
+ </td>
22
+ <td>
23
+ <div class="rules-groups">
24
+
25
+ <?php if( is_array($groups) ): ?>
26
+ <?php foreach( $groups as $group_id => $group ):
27
+ $group_id = 'group_' . $group_id;
28
+ ?>
29
+ <div class="rules-group" data-id="<?php echo $group_id; ?>">
30
+ <?php if( $group_id == 'group_0' ): ?>
31
+ <h4><?php _e("Show this popup if", $this->plugin_slug ); ?></h4>
32
+ <?php else: ?>
33
+ <h4><?php _e("or", $this->plugin_slug ); ?></h4>
34
+ <?php endif; ?>
35
+ <?php if( is_array($group) ): ?>
36
+ <table class="spu_table widefat">
37
+ <tbody>
38
+ <?php foreach( $group as $rule_id => $rule ):
39
+ $rule_id = 'rule_' . $rule_id;
40
+ ?>
41
+ <tr data-id="<?php echo $rule_id; ?>">
42
+ <td class="param"><?php
43
+
44
+ $choices = array(
45
+ __("User", $this->plugin_slug ) => array(
46
+ 'user_type' => __("User role", $this->plugin_slug ),
47
+ 'logged_user' => __("User is logged", $this->plugin_slug ),
48
+ 'left_comment' => __("User never left a comment", $this->plugin_slug ),
49
+ 'search_engine' => __("User came via a search engine", $this->plugin_slug ),
50
+ 'same_site' => __("User did not arrive via another page on your site", $this->plugin_slug ),
51
+ ),
52
+ __("Post", $this->plugin_slug ) => array(
53
+ 'post' => __("Post", $this->plugin_slug ),
54
+ 'post_type' => __("Post Type", $this->plugin_slug ),
55
+ 'post_category' => __("Post Category", $this->plugin_slug ),
56
+ 'post_format' => __("Post Format", $this->plugin_slug ),
57
+ 'post_status' => __("Post Status", $this->plugin_slug ),
58
+ 'taxonomy' => __("Post Taxonomy", $this->plugin_slug ),
59
+ ),
60
+ __("Page", $this->plugin_slug ) => array(
61
+ 'page' => __("Page", $this->plugin_slug ),
62
+ 'page_type' => __("Page Type", $this->plugin_slug ),
63
+ 'page_parent' => __("Page Parent", $this->plugin_slug ),
64
+ 'page_template' => __("Page Template", $this->plugin_slug ),
65
+ ),
66
+ __("Other", $this->plugin_slug ) => array(
67
+ 'mobiles' => __("Mobile Phone", $this->plugin_slug ),
68
+ 'tablets' => __("Tablet", $this->plugin_slug ),
69
+ )
70
+ );
71
+
72
+
73
+ // allow custom rules rules
74
+ $choices = apply_filters( 'spu/metaboxes/rule_types', $choices );
75
+
76
+
77
+ // create field
78
+ $args = array(
79
+ 'group_id' => $group_id,
80
+ 'rule_id' => $rule_id,
81
+ 'name' => 'spu_rules[' . $group_id . '][' . $rule_id . '][param]',
82
+ 'value' => $rule['param']
83
+ );
84
+
85
+ Spu_Helper::print_select( $choices, $args );
86
+
87
+
88
+ ?></td>
89
+ <td class="operator"><?php
90
+
91
+ $choices = array(
92
+ '==' => __("is equal to", $this->plugin_slug ),
93
+ '!=' => __("is not equal to", $this->plugin_slug ),
94
+ );
95
+
96
+
97
+ // allow custom rules rules
98
+ $choices = apply_filters( 'spu/metaboxes/rule_operators', $choices );
99
+
100
+ $args = array(
101
+ 'group_id' => $group_id,
102
+ 'rule_id' => $rule_id,
103
+ 'name' => 'spu_rules[' . $group_id . '][' . $rule_id . '][operator]',
104
+ 'value' => $rule['operator']
105
+
106
+ );
107
+
108
+ Spu_Helper::print_select( $choices, $args );
109
+
110
+
111
+ ?></td>
112
+ <td class="value"><?php
113
+ $args = array(
114
+ 'group_id' => $group_id,
115
+ 'rule_id' => $rule_id,
116
+ 'value' => $rule['value'],
117
+ 'name' => 'spu_rules[' . $group_id . '][' . $rule_id . '][value]',
118
+ 'param' => $rule['param']
119
+ );
120
+ Spu_Helper::ajax_render_rules( $args );
121
+
122
+ ?></td>
123
+ <td class="add">
124
+ <a href="#" class="rules-add-rule button"><?php _e("and", $this->plugin_slug ); ?></a>
125
+ </td>
126
+ <td class="remove">
127
+ <a href="#" class="rules-remove-rule acf-button-remove"></a>
128
+ </td>
129
+ </tr>
130
+ <?php endforeach; ?>
131
+ </tbody>
132
+ </table>
133
+ <?php endif; ?>
134
+ </div>
135
+ <?php endforeach; ?>
136
+
137
+ <h4><?php _e("or", $this->plugin_slug ); ?></h4>
138
+
139
+ <a class="button rules-add-group" href="#"><?php _e("Add rule group", $this->plugin_slug ); ?></a>
140
+
141
+ <?php endif; ?>
142
+
143
+ </div>
144
+ </td>
145
+ </tr>
146
+ </tbody>
147
+ </table>
admin/views/metabox-support.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ // Exit if accessed directly
3
+ if ( !defined( 'ABSPATH' ) ) exit;
4
+ ?>
5
+
6
+ <p><?php echo sprintf( __( 'If you need support please go to the WordPress.org <a href="%s">support forums</a>', $this->plugin_slug ), 'http://wordpress.org/support/plugin/http://wordpress.org/plugins/popups/');?></p>
config.codekit ADDED
@@ -0,0 +1,1049 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "CodeKitInfo": "This is a CodeKit 2.x project configuration file. It is designed to sync project settings across multiple machines. MODIFYING THE CONTENTS OF THIS FILE IS A POOR LIFE DECISION. If you do so, you will likely cause CodeKit to crash. This file is not useful unless accompanied by the project that created it in CodeKit 2. This file is not backwards-compatible with CodeKit 1.x. For more information, see: http:\/\/incident57.com\/codekit",
3
+ "creatorBuild": "17018",
4
+ "files": {
5
+ "\/admin\/assets\/css\/admin.css": {
6
+ "fileType": 16,
7
+ "ignore": 0,
8
+ "ignoreWasSetByUser": 0,
9
+ "inputAbbreviatedPath": "\/admin\/assets\/css\/admin.css",
10
+ "outputAbbreviatedPath": "No Output Path",
11
+ "outputPathIsOutsideProject": 0,
12
+ "outputPathIsSetByUser": 0
13
+ },
14
+ "\/admin\/assets\/css\/index.php": {
15
+ "fileType": 8192,
16
+ "ignore": 0,
17
+ "ignoreWasSetByUser": 0,
18
+ "inputAbbreviatedPath": "\/admin\/assets\/css\/index.php",
19
+ "outputAbbreviatedPath": "No Output Path",
20
+ "outputPathIsOutsideProject": 0,
21
+ "outputPathIsSetByUser": 0
22
+ },
23
+ "\/admin\/assets\/js\/admin.js": {
24
+ "fileType": 64,
25
+ "ignore": 0,
26
+ "ignoreWasSetByUser": 0,
27
+ "inputAbbreviatedPath": "\/admin\/assets\/js\/admin.js",
28
+ "outputAbbreviatedPath": "\/admin\/assets\/js\/min\/admin-ck.js",
29
+ "outputPathIsOutsideProject": 0,
30
+ "outputPathIsSetByUser": 0,
31
+ "outputStyle": 1,
32
+ "syntaxCheckerStyle": 1
33
+ },
34
+ "\/admin\/assets\/js\/index.php": {
35
+ "fileType": 8192,
36
+ "ignore": 0,
37
+ "ignoreWasSetByUser": 0,
38
+ "inputAbbreviatedPath": "\/admin\/assets\/js\/index.php",
39
+ "outputAbbreviatedPath": "No Output Path",
40
+ "outputPathIsOutsideProject": 0,
41
+ "outputPathIsSetByUser": 0
42
+ },
43
+ "\/admin\/class-social-popup-admin.php": {
44
+ "fileType": 8192,
45
+ "ignore": 0,
46
+ "ignoreWasSetByUser": 0,
47
+ "inputAbbreviatedPath": "\/admin\/class-social-popup-admin.php",
48
+ "outputAbbreviatedPath": "No Output Path",
49
+ "outputPathIsOutsideProject": 0,
50
+ "outputPathIsSetByUser": 0
51
+ },
52
+ "\/admin\/includes\/class-spu-upgrade.php": {
53
+ "fileType": 8192,
54
+ "ignore": 0,
55
+ "ignoreWasSetByUser": 0,
56
+ "inputAbbreviatedPath": "\/admin\/includes\/class-spu-upgrade.php",
57
+ "outputAbbreviatedPath": "No Output Path",
58
+ "outputPathIsOutsideProject": 0,
59
+ "outputPathIsSetByUser": 0
60
+ },
61
+ "\/admin\/includes\/index.php": {
62
+ "fileType": 8192,
63
+ "ignore": 0,
64
+ "ignoreWasSetByUser": 0,
65
+ "inputAbbreviatedPath": "\/admin\/includes\/index.php",
66
+ "outputAbbreviatedPath": "No Output Path",
67
+ "outputPathIsOutsideProject": 0,
68
+ "outputPathIsSetByUser": 0
69
+ },
70
+ "\/admin\/views\/index.php": {
71
+ "fileType": 8192,
72
+ "ignore": 0,
73
+ "ignoreWasSetByUser": 0,
74
+ "inputAbbreviatedPath": "\/admin\/views\/index.php",
75
+ "outputAbbreviatedPath": "No Output Path",
76
+ "outputPathIsOutsideProject": 0,
77
+ "outputPathIsSetByUser": 0
78
+ },
79
+ "\/admin\/views\/metabox-donate.php": {
80
+ "fileType": 8192,
81
+ "ignore": 0,
82
+ "ignoreWasSetByUser": 0,
83
+ "inputAbbreviatedPath": "\/admin\/views\/metabox-donate.php",
84
+ "outputAbbreviatedPath": "No Output Path",
85
+ "outputPathIsOutsideProject": 0,
86
+ "outputPathIsSetByUser": 0
87
+ },
88
+ "\/admin\/views\/metabox-help.php": {
89
+ "fileType": 8192,
90
+ "ignore": 0,
91
+ "ignoreWasSetByUser": 0,
92
+ "inputAbbreviatedPath": "\/admin\/views\/metabox-help.php",
93
+ "outputAbbreviatedPath": "No Output Path",
94
+ "outputPathIsOutsideProject": 0,
95
+ "outputPathIsSetByUser": 0
96
+ },
97
+ "\/admin\/views\/metabox-links.php": {
98
+ "fileType": 8192,
99
+ "ignore": 0,
100
+ "ignoreWasSetByUser": 0,
101
+ "inputAbbreviatedPath": "\/admin\/views\/metabox-links.php",
102
+ "outputAbbreviatedPath": "No Output Path",
103
+ "outputPathIsOutsideProject": 0,
104
+ "outputPathIsSetByUser": 0
105
+ },
106
+ "\/admin\/views\/metabox-options.php": {
107
+ "fileType": 8192,
108
+ "ignore": 0,
109
+ "ignoreWasSetByUser": 0,
110
+ "inputAbbreviatedPath": "\/admin\/views\/metabox-options.php",
111
+ "outputAbbreviatedPath": "No Output Path",
112
+ "outputPathIsOutsideProject": 0,
113
+ "outputPathIsSetByUser": 0
114
+ },
115
+ "\/admin\/views\/metabox-rules.php": {
116
+ "fileType": 8192,
117
+ "ignore": 0,
118
+ "ignoreWasSetByUser": 0,
119
+ "inputAbbreviatedPath": "\/admin\/views\/metabox-rules.php",
120
+ "outputAbbreviatedPath": "No Output Path",
121
+ "outputPathIsOutsideProject": 0,
122
+ "outputPathIsSetByUser": 0
123
+ },
124
+ "\/admin\/views\/metabox-support.php": {
125
+ "fileType": 8192,
126
+ "ignore": 0,
127
+ "ignoreWasSetByUser": 0,
128
+ "inputAbbreviatedPath": "\/admin\/views\/metabox-support.php",
129
+ "outputAbbreviatedPath": "No Output Path",
130
+ "outputPathIsOutsideProject": 0,
131
+ "outputPathIsSetByUser": 0
132
+ },
133
+ "\/includes\/class-spu-helper.php": {
134
+ "fileType": 8192,
135
+ "ignore": 0,
136
+ "ignoreWasSetByUser": 0,
137
+ "inputAbbreviatedPath": "\/includes\/class-spu-helper.php",
138
+ "outputAbbreviatedPath": "No Output Path",
139
+ "outputPathIsOutsideProject": 0,
140
+ "outputPathIsSetByUser": 0
141
+ },
142
+ "\/includes\/index.php": {
143
+ "fileType": 8192,
144
+ "ignore": 0,
145
+ "ignoreWasSetByUser": 0,
146
+ "inputAbbreviatedPath": "\/includes\/index.php",
147
+ "outputAbbreviatedPath": "No Output Path",
148
+ "outputPathIsOutsideProject": 0,
149
+ "outputPathIsSetByUser": 0
150
+ },
151
+ "\/includes\/updates-msg.html": {
152
+ "fileType": 8192,
153
+ "ignore": 0,
154
+ "ignoreWasSetByUser": 0,
155
+ "inputAbbreviatedPath": "\/includes\/updates-msg.html",
156
+ "outputAbbreviatedPath": "No Output Path",
157
+ "outputPathIsOutsideProject": 0,
158
+ "outputPathIsSetByUser": 0
159
+ },
160
+ "\/index.php": {
161
+ "fileType": 8192,
162
+ "ignore": 0,
163
+ "ignoreWasSetByUser": 0,
164
+ "inputAbbreviatedPath": "\/index.php",
165
+ "outputAbbreviatedPath": "No Output Path",
166
+ "outputPathIsOutsideProject": 0,
167
+ "outputPathIsSetByUser": 0
168
+ },
169
+ "\/languages\/index.php": {
170
+ "fileType": 8192,
171
+ "ignore": 0,
172
+ "ignoreWasSetByUser": 0,
173
+ "inputAbbreviatedPath": "\/languages\/index.php",
174
+ "outputAbbreviatedPath": "No Output Path",
175
+ "outputPathIsOutsideProject": 0,
176
+ "outputPathIsSetByUser": 0
177
+ },
178
+ "\/popups.php": {
179
+ "fileType": 8192,
180
+ "ignore": 0,
181
+ "ignoreWasSetByUser": 0,
182
+ "inputAbbreviatedPath": "\/popups.php",
183
+ "outputAbbreviatedPath": "No Output Path",
184
+ "outputPathIsOutsideProject": 0,
185
+ "outputPathIsSetByUser": 0
186
+ },
187
+ "\/public\/assets\/css\/index.php": {
188
+ "fileType": 8192,
189
+ "ignore": 0,
190
+ "ignoreWasSetByUser": 0,
191
+ "inputAbbreviatedPath": "\/public\/assets\/css\/index.php",
192
+ "outputAbbreviatedPath": "No Output Path",
193
+ "outputPathIsOutsideProject": 0,
194
+ "outputPathIsSetByUser": 0
195
+ },
196
+ "\/public\/assets\/css\/public.css": {
197
+ "fileType": 16,
198
+ "ignore": 0,
199
+ "ignoreWasSetByUser": 0,
200
+ "inputAbbreviatedPath": "\/public\/assets\/css\/public.css",
201
+ "outputAbbreviatedPath": "No Output Path",
202
+ "outputPathIsOutsideProject": 0,
203
+ "outputPathIsSetByUser": 0
204
+ },
205
+ "\/public\/assets\/index.php": {
206
+ "fileType": 8192,
207
+ "ignore": 0,
208
+ "ignoreWasSetByUser": 0,
209
+ "inputAbbreviatedPath": "\/public\/assets\/index.php",
210
+ "outputAbbreviatedPath": "No Output Path",
211
+ "outputPathIsOutsideProject": 0,
212
+ "outputPathIsSetByUser": 0
213
+ },
214
+ "\/public\/assets\/js\/index.php": {
215
+ "fileType": 8192,
216
+ "ignore": 0,
217
+ "ignoreWasSetByUser": 0,
218
+ "inputAbbreviatedPath": "\/public\/assets\/js\/index.php",
219
+ "outputAbbreviatedPath": "No Output Path",
220
+ "outputPathIsOutsideProject": 0,
221
+ "outputPathIsSetByUser": 0
222
+ },
223
+ "\/public\/assets\/js\/min\/public-ck.js": {
224
+ "fileType": 64,
225
+ "ignore": 1,
226
+ "ignoreWasSetByUser": 0,
227
+ "inputAbbreviatedPath": "\/public\/assets\/js\/min\/public-ck.js",
228
+ "outputAbbreviatedPath": "\/public\/assets\/js\/min\/min\/public-ck-ck.js",
229
+ "outputPathIsOutsideProject": 0,
230
+ "outputPathIsSetByUser": 0,
231
+ "outputStyle": 1,
232
+ "syntaxCheckerStyle": 1
233
+ },
234
+ "\/public\/assets\/js\/public.js": {
235
+ "fileType": 64,
236
+ "ignore": 0,
237
+ "ignoreWasSetByUser": 0,
238
+ "inputAbbreviatedPath": "\/public\/assets\/js\/public.js",
239
+ "outputAbbreviatedPath": "\/public\/assets\/js\/min\/public-ck.js",
240
+ "outputPathIsOutsideProject": 0,
241
+ "outputPathIsSetByUser": 0,
242
+ "outputStyle": 1,
243
+ "syntaxCheckerStyle": 1
244
+ },
245
+ "\/public\/class-social-popup.php": {
246
+ "fileType": 8192,
247
+ "ignore": 0,
248
+ "ignoreWasSetByUser": 0,
249
+ "inputAbbreviatedPath": "\/public\/class-social-popup.php",
250
+ "outputAbbreviatedPath": "No Output Path",
251
+ "outputPathIsOutsideProject": 0,
252
+ "outputPathIsSetByUser": 0
253
+ },
254
+ "\/public\/includes\/class-spu-rules.php": {
255
+ "fileType": 8192,
256
+ "ignore": 0,
257
+ "ignoreWasSetByUser": 0,
258
+ "inputAbbreviatedPath": "\/public\/includes\/class-spu-rules.php",
259
+ "outputAbbreviatedPath": "No Output Path",
260
+ "outputPathIsOutsideProject": 0,
261
+ "outputPathIsSetByUser": 0
262
+ },
263
+ "\/public\/includes\/index.php": {
264
+ "fileType": 8192,
265
+ "ignore": 0,
266
+ "ignoreWasSetByUser": 0,
267
+ "inputAbbreviatedPath": "\/public\/includes\/index.php",
268
+ "outputAbbreviatedPath": "No Output Path",
269
+ "outputPathIsOutsideProject": 0,
270
+ "outputPathIsSetByUser": 0
271
+ },
272
+ "\/public\/views\/index.php": {
273
+ "fileType": 8192,
274
+ "ignore": 0,
275
+ "ignoreWasSetByUser": 0,
276
+ "inputAbbreviatedPath": "\/public\/views\/index.php",
277
+ "outputAbbreviatedPath": "No Output Path",
278
+ "outputPathIsOutsideProject": 0,
279
+ "outputPathIsSetByUser": 0
280
+ },
281
+ "\/public\/views\/public.php": {
282
+ "fileType": 8192,
283
+ "ignore": 0,
284
+ "ignoreWasSetByUser": 0,
285
+ "inputAbbreviatedPath": "\/public\/views\/public.php",
286
+ "outputAbbreviatedPath": "No Output Path",
287
+ "outputPathIsOutsideProject": 0,
288
+ "outputPathIsSetByUser": 0
289
+ },
290
+ "\/uninstall.php": {
291
+ "fileType": 8192,
292
+ "ignore": 0,
293
+ "ignoreWasSetByUser": 0,
294
+ "inputAbbreviatedPath": "\/uninstall.php",
295
+ "outputAbbreviatedPath": "No Output Path",
296
+ "outputPathIsOutsideProject": 0,
297
+ "outputPathIsSetByUser": 0
298
+ }
299
+ },
300
+ "hooks": [
301
+ ],
302
+ "lastSavedByUser": "chifli",
303
+ "manualImportLinks": {
304
+ },
305
+ "projectAttributes": {
306
+ "bowerAbbreviatedPath": "",
307
+ "displayValue": "Popups",
308
+ "displayValueWasSetByUser": 1,
309
+ "iconImageName": "compass_blue"
310
+ },
311
+ "projectSettings": {
312
+ "alwaysUseExternalServer": 0,
313
+ "animateCSSInjections": 1,
314
+ "autoApplyPSLanguageSettingsStyle": 0,
315
+ "autoprefixerBrowserString": "> 1%, last 2 versions, ff 17, opera 12.1",
316
+ "autoSyncProjectSettingsFile": 1,
317
+ "browserRefreshDelay": 0,
318
+ "coffeeAutoOutputPathRelativePath": "",
319
+ "coffeeAutoOutputPathReplace1": "",
320
+ "coffeeAutoOutputPathReplace2": "",
321
+ "coffeeAutoOutputPathStyle": 0,
322
+ "coffeeCreateSourceMap": 0,
323
+ "coffeeLintFlags2": {
324
+ "arrow_spacing": {
325
+ "active": 0,
326
+ "flagValue": -1
327
+ },
328
+ "camel_case_classes": {
329
+ "active": 1,
330
+ "flagValue": -1
331
+ },
332
+ "colon_assignment_spacing": {
333
+ "active": 0,
334
+ "flagValue": 1
335
+ },
336
+ "cyclomatic_complexity": {
337
+ "active": 0,
338
+ "flagValue": 10
339
+ },
340
+ "duplicate_key": {
341
+ "active": 1,
342
+ "flagValue": -1
343
+ },
344
+ "empty_constructor_needs_parens": {
345
+ "active": 0,
346
+ "flagValue": -1
347
+ },
348
+ "indentation": {
349
+ "active": 1,
350
+ "flagValue": 2
351
+ },
352
+ "line_endings": {
353
+ "active": 0,
354
+ "flagValue": 0
355
+ },
356
+ "max_line_length": {
357
+ "active": 0,
358
+ "flagValue": 150
359
+ },
360
+ "missing_fat_arrows": {
361
+ "active": 0,
362
+ "flagValue": -1
363
+ },
364
+ "newlines_after_classes": {
365
+ "active": 0,
366
+ "flagValue": 3
367
+ },
368
+ "no_backticks": {
369
+ "active": 1,
370
+ "flagValue": -1
371
+ },
372
+ "no_debugger": {
373
+ "active": 1,
374
+ "flagValue": -1
375
+ },
376
+ "no_empty_functions": {
377
+ "active": 0,
378
+ "flagValue": -1
379
+ },
380
+ "no_empty_param_list": {
381
+ "active": 0,
382
+ "flagValue": -1
383
+ },
384
+ "no_implicit_braces": {
385
+ "active": 1,
386
+ "flagValue": -1
387
+ },
388
+ "no_implicit_parens": {
389
+ "active": 0,
390
+ "flagValue": -1
391
+ },
392
+ "no_interpolation_in_single_quotes": {
393
+ "active": 0,
394
+ "flagValue": -1
395
+ },
396
+ "no_plusplus": {
397
+ "active": 0,
398
+ "flagValue": -1
399
+ },
400
+ "no_stand_alone_at": {
401
+ "active": 1,
402
+ "flagValue": -1
403
+ },
404
+ "no_tabs": {
405
+ "active": 1,
406
+ "flagValue": -1
407
+ },
408
+ "no_throwing_strings": {
409
+ "active": 1,
410
+ "flagValue": -1
411
+ },
412
+ "no_trailing_semicolons": {
413
+ "active": 1,
414
+ "flagValue": -1
415
+ },
416
+ "no_trailing_whitespace": {
417
+ "active": 1,
418
+ "flagValue": -1
419
+ },
420
+ "no_unnecessary_double_quotes": {
421
+ "active": 0,
422
+ "flagValue": -1
423
+ },
424
+ "no_unnecessary_fat_arrows": {
425
+ "active": 1,
426
+ "flagValue": -1
427
+ },
428
+ "non_empty_constructor_needs_parens": {
429
+ "active": 0,
430
+ "flagValue": -1
431
+ },
432
+ "space_operators": {
433
+ "active": 0,
434
+ "flagValue": -1
435
+ }
436
+ },
437
+ "coffeeMinifyOutput": 1,
438
+ "coffeeOutputStyle": 0,
439
+ "coffeeSyntaxCheckerStyle": 1,
440
+ "externalServerAddress": "http:\/\/localhost:8888",
441
+ "externalServerPreviewPathAddition": "",
442
+ "genericWebpageFileExtensionsString": "html, htm, shtml, shtm, xhtml, php, jsp, asp, aspx, erb, ctp",
443
+ "hamlAutoOutputPathRelativePath": "",
444
+ "hamlAutoOutputPathReplace1": "",
445
+ "hamlAutoOutputPathReplace2": "",
446
+ "hamlAutoOutputPathStyle": 0,
447
+ "hamlEscapeHTMLCharacters": 0,
448
+ "hamlNoEscapeInAttributes": 0,
449
+ "hamlOutputFormat": 2,
450
+ "hamlOutputStyle": 0,
451
+ "hamlUseCDATA": 0,
452
+ "hamlUseDoubleQuotes": 0,
453
+ "hamlUseUnixNewlines": 0,
454
+ "jadeAutoOutputPathRelativePath": "",
455
+ "jadeAutoOutputPathReplace1": "",
456
+ "jadeAutoOutputPathReplace2": "",
457
+ "jadeAutoOutputPathStyle": 0,
458
+ "jadeCompileDebug": 1,
459
+ "jadeOutputStyle": 0,
460
+ "javascriptAutoOutputPathRelativePath": "\/min",
461
+ "javascriptAutoOutputPathReplace1": "",
462
+ "javascriptAutoOutputPathReplace2": "",
463
+ "javascriptAutoOutputPathStyle": 2,
464
+ "javascriptCreateSourceMap": 1,
465
+ "javascriptOutputStyle": 1,
466
+ "javascriptOutputSuffix": "-ck",
467
+ "javascriptSyntaxCheckerStyle": 1,
468
+ "jsCheckerReservedNamesString": "",
469
+ "jsHintFlags2": {
470
+ "asi": {
471
+ "active": 0,
472
+ "flagValue": -1
473
+ },
474
+ "bitwise": {
475
+ "active": 1,
476
+ "flagValue": -1
477
+ },
478
+ "boss": {
479
+ "active": 0,
480
+ "flagValue": -1
481
+ },
482
+ "browser": {
483
+ "active": 1,
484
+ "flagValue": -1
485
+ },
486
+ "camelcase": {
487
+ "active": 0,
488
+ "flagValue": -1
489
+ },
490
+ "couch": {
491
+ "active": 0,
492
+ "flagValue": -1
493
+ },
494
+ "curly": {
495
+ "active": 1,
496
+ "flagValue": -1
497
+ },
498
+ "debug": {
499
+ "active": 0,
500
+ "flagValue": -1
501
+ },
502
+ "devel": {
503
+ "active": 0,
504
+ "flagValue": -1
505
+ },
506
+ "dojo": {
507
+ "active": 0,
508
+ "flagValue": -1
509
+ },
510
+ "eqeqeq": {
511
+ "active": 1,
512
+ "flagValue": -1
513
+ },
514
+ "eqnull": {
515
+ "active": 0,
516
+ "flagValue": -1
517
+ },
518
+ "es3": {
519
+ "active": 0,
520
+ "flagValue": -1
521
+ },
522
+ "esnext": {
523
+ "active": 0,
524
+ "flagValue": -1
525
+ },
526
+ "evil": {
527
+ "active": 0,
528
+ "flagValue": -1
529
+ },
530
+ "expr": {
531
+ "active": 0,
532
+ "flagValue": -1
533
+ },
534
+ "forin": {
535
+ "active": 0,
536
+ "flagValue": -1
537
+ },
538
+ "freeze": {
539
+ "active": 1,
540
+ "flagValue": -1
541
+ },
542
+ "funcscope": {
543
+ "active": 0,
544
+ "flagValue": -1
545
+ },
546
+ "globalstrict": {
547
+ "active": 0,
548
+ "flagValue": -1
549
+ },
550
+ "immed": {
551
+ "active": 0,
552
+ "flagValue": -1
553
+ },
554
+ "indent": {
555
+ "active": 0,
556
+ "flagValue": 4
557
+ },
558
+ "iterator": {
559
+ "active": 0,
560
+ "flagValue": -1
561
+ },
562
+ "jquery": {
563
+ "active": 1,
564
+ "flagValue": -1
565
+ },
566
+ "lastsemic": {
567
+ "active": 0,
568
+ "flagValue": -1
569
+ },
570
+ "latedef": {
571
+ "active": 1,
572
+ "flagValue": -1
573
+ },
574
+ "laxbreak": {
575
+ "active": 0,
576
+ "flagValue": -1
577
+ },
578
+ "laxcomma": {
579
+ "active": 0,
580
+ "flagValue": -1
581
+ },
582
+ "loopfunc": {
583
+ "active": 0,
584
+ "flagValue": -1
585
+ },
586
+ "maxcomplexity": {
587
+ "active": 0,
588
+ "flagValue": 10
589
+ },
590
+ "maxdepth": {
591
+ "active": 0,
592
+ "flagValue": 3
593
+ },
594
+ "maxlen": {
595
+ "active": 0,
596
+ "flagValue": 150
597
+ },
598
+ "maxparams": {
599
+ "active": 0,
600
+ "flagValue": 3
601
+ },
602
+ "maxstatements": {
603
+ "active": 0,
604
+ "flagValue": 4
605
+ },
606
+ "mootools": {
607
+ "active": 0,
608
+ "flagValue": -1
609
+ },
610
+ "moz": {
611
+ "active": 0,
612
+ "flagValue": -1
613
+ },
614
+ "multistr": {
615
+ "active": 0,
616
+ "flagValue": -1
617
+ },
618
+ "newcap": {
619
+ "active": 1,
620
+ "flagValue": -1
621
+ },
622
+ "noarg": {
623
+ "active": 1,
624
+ "flagValue": -1
625
+ },
626
+ "node": {
627
+ "active": 0,
628
+ "flagValue": -1
629
+ },
630
+ "noempty": {
631
+ "active": 0,
632
+ "flagValue": -1
633
+ },
634
+ "nonbsp": {
635
+ "active": 0,
636
+ "flagValue": -1
637
+ },
638
+ "nonew": {
639
+ "active": 1,
640
+ "flagValue": -1
641
+ },
642
+ "nonstandard": {
643
+ "active": 0,
644
+ "flagValue": -1
645
+ },
646
+ "notypeof": {
647
+ "active": 1,
648
+ "flagValue": -1
649
+ },
650
+ "noyield": {
651
+ "active": 0,
652
+ "flagValue": -1
653
+ },
654
+ "onecase": {
655
+ "active": 0,
656
+ "flagValue": -1
657
+ },
658
+ "phantom": {
659
+ "active": 0,
660
+ "flagValue": -1
661
+ },
662
+ "plusplus": {
663
+ "active": 0,
664
+ "flagValue": -1
665
+ },
666
+ "proto": {
667
+ "active": 0,
668
+ "flagValue": -1
669
+ },
670
+ "prototypejs": {
671
+ "active": 0,
672
+ "flagValue": -1
673
+ },
674
+ "regexp": {
675
+ "active": 1,
676
+ "flagValue": -1
677
+ },
678
+ "rhino": {
679
+ "active": 0,
680
+ "flagValue": -1
681
+ },
682
+ "scripturl": {
683
+ "active": 0,
684
+ "flagValue": -1
685
+ },
686
+ "shadow": {
687
+ "active": 0,
688
+ "flagValue": -1
689
+ },
690
+ "shelljs": {
691
+ "active": 0,
692
+ "flagValue": -1
693
+ },
694
+ "strict": {
695
+ "active": 0,
696
+ "flagValue": -1
697
+ },
698
+ "sub": {
699
+ "active": 0,
700
+ "flagValue": -1
701
+ },
702
+ "supernew": {
703
+ "active": 0,
704
+ "flagValue": -1
705
+ },
706
+ "typed": {
707
+ "active": 0,
708
+ "flagValue": -1
709
+ },
710
+ "undef": {
711
+ "active": 1,
712
+ "flagValue": -1
713
+ },
714
+ "unused": {
715
+ "active": 1,
716
+ "flagValue": -1
717
+ },
718
+ "withstmt": {
719
+ "active": 0,
720
+ "flagValue": -1
721
+ },
722
+ "worker": {
723
+ "active": 0,
724
+ "flagValue": -1
725
+ },
726
+ "wsh": {
727
+ "active": 0,
728
+ "flagValue": -1
729
+ },
730
+ "yui": {
731
+ "active": 0,
732
+ "flagValue": -1
733
+ }
734
+ },
735
+ "jsLintFlags2": {
736
+ "ass": {
737
+ "active": 0,
738
+ "flagValue": -1
739
+ },
740
+ "bitwise": {
741
+ "active": 0,
742
+ "flagValue": -1
743
+ },
744
+ "browser": {
745
+ "active": 1,
746
+ "flagValue": -1
747
+ },
748
+ "closure": {
749
+ "active": 0,
750
+ "flagValue": -1
751
+ },
752
+ "continue": {
753
+ "active": 0,
754
+ "flagValue": -1
755
+ },
756
+ "debug": {
757
+ "active": 0,
758
+ "flagValue": -1
759
+ },
760
+ "devel": {
761
+ "active": 0,
762
+ "flagValue": -1
763
+ },
764
+ "eqeq": {
765
+ "active": 0,
766
+ "flagValue": -1
767
+ },
768
+ "evil": {
769
+ "active": 0,
770
+ "flagValue": -1
771
+ },
772
+ "forin": {
773
+ "active": 0,
774
+ "flagValue": -1
775
+ },
776
+ "indent": {
777
+ "active": 0,
778
+ "flagValue": 4
779
+ },
780
+ "maxlen": {
781
+ "active": 0,
782
+ "flagValue": 150
783
+ },
784
+ "newcap": {
785
+ "active": 0,
786
+ "flagValue": -1
787
+ },
788
+ "node": {
789
+ "active": 0,
790
+ "flagValue": -1
791
+ },
792
+ "nomen": {
793
+ "active": 0,
794
+ "flagValue": -1
795
+ },
796
+ "plusplus": {
797
+ "active": 0,
798
+ "flagValue": -1
799
+ },
800
+ "properties": {
801
+ "active": 0,
802
+ "flagValue": -1
803
+ },
804
+ "regexp": {
805
+ "active": 0,
806
+ "flagValue": -1
807
+ },
808
+ "rhino": {
809
+ "active": 0,
810
+ "flagValue": -1
811
+ },
812
+ "sloppy": {
813
+ "active": 0,
814
+ "flagValue": -1
815
+ },
816
+ "stupid": {
817
+ "active": 0,
818
+ "flagValue": -1
819
+ },
820
+ "sub": {
821
+ "active": 0,
822
+ "flagValue": -1
823
+ },
824
+ "todo": {
825
+ "active": 0,
826
+ "flagValue": -1
827
+ },
828
+ "unparam": {
829
+ "active": 0,
830
+ "flagValue": -1
831
+ },
832
+ "vars": {
833
+ "active": 0,
834
+ "flagValue": -1
835
+ },
836
+ "white": {
837
+ "active": 0,
838
+ "flagValue": -1
839
+ }
840
+ },
841
+ "kitAutoOutputPathRelativePath": "",
842
+ "kitAutoOutputPathReplace1": "",
843
+ "kitAutoOutputPathReplace2": "",
844
+ "kitAutoOutputPathStyle": 0,
845
+ "lessAllowInsecureImports": 0,
846
+ "lessAutoOutputPathRelativePath": "..\/css",
847
+ "lessAutoOutputPathReplace1": "less",
848
+ "lessAutoOutputPathReplace2": "css",
849
+ "lessAutoOutputPathStyle": 2,
850
+ "lessCreateSourceMap": 0,
851
+ "lessDisableJavascript": 0,
852
+ "lessIeCompatibility": 1,
853
+ "lessOutputStyle": 0,
854
+ "lessRelativeURLS": 0,
855
+ "lessStrictImports": 0,
856
+ "lessStrictMath": 0,
857
+ "lessStrictUnits": 0,
858
+ "markdownAutoOutputPathRelativePath": "",
859
+ "markdownAutoOutputPathReplace1": "",
860
+ "markdownAutoOutputPathReplace2": "",
861
+ "markdownAutoOutputPathStyle": 0,
862
+ "markdownEnableFootnotes": 0,
863
+ "markdownEnableSmartyPants": 1,
864
+ "markdownExpandTabs": 1,
865
+ "reloadFileURLs": 0,
866
+ "sassAutoOutputPathRelativePath": "..\/css",
867
+ "sassAutoOutputPathReplace1": "sass",
868
+ "sassAutoOutputPathReplace2": "css",
869
+ "sassAutoOutputPathStyle": 2,
870
+ "sassCreateSourceMap": 0,
871
+ "sassDebugStyle": 0,
872
+ "sassDecimalPrecision": 5,
873
+ "sassOutputStyle": 0,
874
+ "sassUseLibsass": 0,
875
+ "shouldRunAutoprefixer": 0,
876
+ "shouldRunBless": 0,
877
+ "skippedItemsString": ".svn, .git, .hg, log, _logs, _cache, cache, logs",
878
+ "slimAutoOutputPathRelativePath": "",
879
+ "slimAutoOutputPathReplace1": "",
880
+ "slimAutoOutputPathReplace2": "",
881
+ "slimAutoOutputPathStyle": 0,
882
+ "slimCompileOnly": 0,
883
+ "slimLogicless": 0,
884
+ "slimOutputStyle": 1,
885
+ "slimRailsCompatible": 0,
886
+ "stylusAutoOutputPathRelativePath": "..\/css",
887
+ "stylusAutoOutputPathReplace1": "stylus",
888
+ "stylusAutoOutputPathReplace2": "css",
889
+ "stylusAutoOutputPathStyle": 2,
890
+ "stylusDebugStyle": 0,
891
+ "stylusImportCSS": 0,
892
+ "stylusOutputStyle": 0,
893
+ "stylusResolveRelativeURLS": 0,
894
+ "typescriptAutoOutputPathRelativePath": "\/js",
895
+ "typescriptAutoOutputPathReplace1": "",
896
+ "typescriptAutoOutputPathReplace2": "",
897
+ "typescriptAutoOutputPathStyle": 2,
898
+ "typescriptCreateDeclarationFile": 0,
899
+ "typescriptCreateSourceMap": 0,
900
+ "typescriptMinifyOutput": 0,
901
+ "typescriptModuleType": 0,
902
+ "typescriptNoImplicitAny": 0,
903
+ "typescriptNoResolve": 0,
904
+ "typescriptRemoveComments": 0,
905
+ "typescriptTargetECMAVersion": 0,
906
+ "uglifyDefinesString": "",
907
+ "uglifyFlags2": {
908
+ "ascii-only": {
909
+ "active": 0,
910
+ "flagValue": -1
911
+ },
912
+ "booleans": {
913
+ "active": 1,
914
+ "flagValue": -1
915
+ },
916
+ "bracketize": {
917
+ "active": 0,
918
+ "flagValue": -1
919
+ },
920
+ "cascade": {
921
+ "active": 1,
922
+ "flagValue": -1
923
+ },
924
+ "comments": {
925
+ "active": 1,
926
+ "flagValue": -1
927
+ },
928
+ "comparisons": {
929
+ "active": 1,
930
+ "flagValue": -1
931
+ },
932
+ "compress": {
933
+ "active": 1,
934
+ "flagValue": -1
935
+ },
936
+ "conditionals": {
937
+ "active": 1,
938
+ "flagValue": -1
939
+ },
940
+ "dead_code": {
941
+ "active": 0,
942
+ "flagValue": -1
943
+ },
944
+ "drop_debugger": {
945
+ "active": 1,
946
+ "flagValue": -1
947
+ },
948
+ "eval": {
949
+ "active": 0,
950
+ "flagValue": -1
951
+ },
952
+ "evaluate": {
953
+ "active": 1,
954
+ "flagValue": -1
955
+ },
956
+ "hoist_funs": {
957
+ "active": 1,
958
+ "flagValue": -1
959
+ },
960
+ "hoist_vars": {
961
+ "active": 0,
962
+ "flagValue": -1
963
+ },
964
+ "if_return": {
965
+ "active": 1,
966
+ "flagValue": -1
967
+ },
968
+ "indent-level": {
969
+ "active": 0,
970
+ "flagValue": 4
971
+ },
972
+ "indent-start": {
973
+ "active": 0,
974
+ "flagValue": 0
975
+ },
976
+ "inline-script": {
977
+ "active": 0,
978
+ "flagValue": -1
979
+ },
980
+ "join_vars": {
981
+ "active": 1,
982
+ "flagValue": -1
983
+ },
984
+ "loops": {
985
+ "active": 1,
986
+ "flagValue": -1
987
+ },
988
+ "mangle": {
989
+ "active": 1,
990
+ "flagValue": -1
991
+ },
992
+ "max-line-len": {
993
+ "active": 1,
994
+ "flagValue": 32000
995
+ },
996
+ "properties": {
997
+ "active": 1,
998
+ "flagValue": -1
999
+ },
1000
+ "quote-keys": {
1001
+ "active": 0,
1002
+ "flagValue": -1
1003
+ },
1004
+ "screw-ie8": {
1005
+ "active": 0,
1006
+ "flagValue": -1
1007
+ },
1008
+ "semicolons": {
1009
+ "active": 1,
1010
+ "flagValue": -1
1011
+ },
1012
+ "sequences": {
1013
+ "active": 1,
1014
+ "flagValue": -1
1015
+ },
1016
+ "sort": {
1017
+ "active": 0,
1018
+ "flagValue": -1
1019
+ },
1020
+ "space-colon": {
1021
+ "active": 1,
1022
+ "flagValue": -1
1023
+ },
1024
+ "toplevel": {
1025
+ "active": 0,
1026
+ "flagValue": -1
1027
+ },
1028
+ "unsafe": {
1029
+ "active": 0,
1030
+ "flagValue": -1
1031
+ },
1032
+ "unused": {
1033
+ "active": 0,
1034
+ "flagValue": -1
1035
+ },
1036
+ "warnings": {
1037
+ "active": 0,
1038
+ "flagValue": -1
1039
+ },
1040
+ "width": {
1041
+ "active": 1,
1042
+ "flagValue": 80
1043
+ }
1044
+ },
1045
+ "uglifyReservedNamesString": "$",
1046
+ "websiteRelativeRoot": ""
1047
+ },
1048
+ "settingsFileVersion": "2"
1049
+ }
includes/class-spu-helper.php ADDED
@@ -0,0 +1,428 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Helper class of SPu for admin
5
+ *
6
+ * @package SocialPopup_Admin
7
+ * @author Damian Logghe <info@timersys.com>
8
+ */
9
+ class Spu_Helper {
10
+ /**
11
+ * Plugin slug
12
+ * @var string
13
+ */
14
+ protected static $plugin_slug = '';
15
+
16
+ /**
17
+ * ajax_render_rules
18
+ *
19
+ * @description creates the HTML for the field group rules metabox. Called from both Ajax and PHP
20
+ * @since 2.0
21
+ * I took this functions from the awesome Advanced custom fields plugin http://www.advancedcustomfields.com/
22
+ */
23
+
24
+ public static function ajax_render_rules( $options = array() )
25
+ {
26
+ $plugin = SocialPopup::get_instance();
27
+ self::$plugin_slug = $plugin->get_plugin_slug();
28
+
29
+ // defaults
30
+ $defaults = array(
31
+ 'group_id' => 0,
32
+ 'rule_id' => 0,
33
+ 'value' => null,
34
+ 'param' => null,
35
+ );
36
+
37
+ $is_ajax = false;
38
+ if( isset($_POST['nonce']) && wp_verify_nonce($_POST['nonce'], 'spu_nonce') )
39
+ {
40
+ $is_ajax = true;
41
+ }
42
+
43
+
44
+ // Is AJAX call?
45
+ if( $is_ajax )
46
+ {
47
+ $options = array_merge($defaults, $_POST);
48
+ $options['name'] = 'spu_rules[' . $options['group_id'] . '][' . $options['rule_id'] . '][value]';
49
+ }
50
+ else
51
+ {
52
+ $options = array_merge($defaults, $options);
53
+ }
54
+
55
+ // vars
56
+ $choices = array();
57
+
58
+
59
+ // some case's have the same outcome
60
+ if($options['param'] == "page_parent")
61
+ {
62
+ $options['param'] = "page";
63
+ }
64
+
65
+
66
+ switch($options['param'])
67
+ {
68
+ case "post_type":
69
+
70
+ // all post types except attachment
71
+ $choices = apply_filters('spu/get_post_types', array(), array('attachment') );
72
+
73
+ break;
74
+
75
+
76
+ case "page":
77
+
78
+ $post_type = 'page';
79
+ $posts = get_posts(array(
80
+ 'posts_per_page' => -1,
81
+ 'post_type' => $post_type,
82
+ 'orderby' => 'menu_order title',
83
+ 'order' => 'ASC',
84
+ 'post_status' => 'any',
85
+ 'suppress_filters' => false,
86
+ 'update_post_meta_cache' => false,
87
+ ));
88
+
89
+ if( $posts )
90
+ {
91
+ // sort into hierachial order!
92
+ if( is_post_type_hierarchical( $post_type ) )
93
+ {
94
+ $posts = get_page_children( 0, $posts );
95
+ }
96
+
97
+ foreach( $posts as $page )
98
+ {
99
+ $title = '';
100
+ $ancestors = get_ancestors($page->ID, 'page');
101
+ if($ancestors)
102
+ {
103
+ foreach($ancestors as $a)
104
+ {
105
+ $title .= '- ';
106
+ }
107
+ }
108
+
109
+ $title .= apply_filters( 'the_title', $page->post_title, $page->ID );
110
+
111
+
112
+ // status
113
+ if($page->post_status != "publish")
114
+ {
115
+ $title .= " ($page->post_status)";
116
+ }
117
+
118
+ $choices[ $page->ID ] = $title;
119
+
120
+ }
121
+ // foreach($pages as $page)
122
+
123
+ }
124
+
125
+ break;
126
+
127
+
128
+ case "page_type" :
129
+
130
+ $choices = array(
131
+ 'all_pages' => __("All Pages", self::$plugin_slug),
132
+ 'front_page' => __("Front Page", self::$plugin_slug),
133
+ 'posts_page' => __("Posts Page", self::$plugin_slug),
134
+ 'top_level' => __("Top Level Page (parent of 0)", self::$plugin_slug),
135
+ 'parent' => __("Parent Page (has children)", self::$plugin_slug),
136
+ 'child' => __("Child Page (has parent)", self::$plugin_slug),
137
+ );
138
+
139
+ break;
140
+
141
+ case "page_template" :
142
+
143
+ $choices = array(
144
+ 'default' => __("Default Template", self::$plugin_slug),
145
+ );
146
+
147
+ $templates = get_page_templates();
148
+ foreach($templates as $k => $v)
149
+ {
150
+ $choices[$v] = $k;
151
+ }
152
+
153
+ break;
154
+
155
+ case "post" :
156
+
157
+ $post_types = get_post_types();
158
+
159
+ unset( $post_types['page'], $post_types['attachment'], $post_types['revision'] , $post_types['nav_menu_item'], $post_types['spucpt'] );
160
+
161
+ if( $post_types )
162
+ {
163
+ foreach( $post_types as $post_type )
164
+ {
165
+
166
+ $posts = get_posts(array(
167
+ 'numberposts' => '-1',
168
+ 'post_type' => $post_type,
169
+ 'post_status' => array('publish', 'private', 'draft', 'inherit', 'future'),
170
+ 'suppress_filters' => false,
171
+ ));
172
+
173
+ if( $posts)
174
+ {
175
+ $choices[$post_type] = array();
176
+
177
+ foreach($posts as $post)
178
+ {
179
+ $title = apply_filters( 'the_title', $post->post_title, $post->ID );
180
+
181
+ // status
182
+ if($post->post_status != "publish")
183
+ {
184
+ $title .= " ($post->post_status)";
185
+ }
186
+
187
+ $choices[$post_type][$post->ID] = $title;
188
+
189
+ }
190
+ // foreach($posts as $post)
191
+ }
192
+ // if( $posts )
193
+ }
194
+ // foreach( $post_types as $post_type )
195
+ }
196
+ // if( $post_types )
197
+
198
+
199
+ break;
200
+
201
+ case "post_category" :
202
+
203
+ $category_ids = get_all_category_ids();
204
+
205
+ foreach($category_ids as $cat_id)
206
+ {
207
+ $cat_name = get_cat_name($cat_id);
208
+ $choices[$cat_id] = $cat_name;
209
+ }
210
+
211
+ break;
212
+
213
+ case "post_format" :
214
+
215
+ $choices = get_post_format_strings();
216
+
217
+ break;
218
+
219
+ case "post_status" :
220
+
221
+ $choices = array(
222
+ 'publish' => __( 'Publish' ),
223
+ 'pending' => __( 'Pending Review' ),
224
+ 'draft' => __( 'Draft' ),
225
+ 'future' => __( 'Future' ),
226
+ 'private' => __( 'Private' ),
227
+ 'inherit' => __( 'Revision' ),
228
+ 'trash' => __( 'Trash' )
229
+ );
230
+
231
+ break;
232
+
233
+ case "user_type" :
234
+
235
+ global $wp_roles;
236
+
237
+ $choices = $wp_roles->get_names();
238
+
239
+ if( is_multisite() )
240
+ {
241
+ $choices['super_admin'] = __('Super Admin');
242
+ }
243
+
244
+ break;
245
+
246
+ case "taxonomy" :
247
+
248
+ $choices = array();
249
+ $simple_value = true;
250
+ $choices = apply_filters('spu/get_taxonomies', $choices, $simple_value);
251
+
252
+ break;
253
+
254
+ case "logged_user" :
255
+ case "mobiles" :
256
+ case "tablets" :
257
+ case "left_comment" :
258
+ case "search_engine" :
259
+ case "same_site" :
260
+
261
+ $choices = array('true' => __( 'True', self::$plugin_slug ) );
262
+
263
+ break;
264
+
265
+
266
+ }
267
+
268
+
269
+ // allow custom rules rules
270
+ $choices = apply_filters( 'spu/rules/rule_values/' . $options['param'], $choices );
271
+
272
+ self::print_select( $choices, $options );
273
+
274
+
275
+ // ajax?
276
+ if( $is_ajax )
277
+ {
278
+ die();
279
+ }
280
+
281
+ }
282
+
283
+ /**
284
+ * Helper function to print select fields for rules
285
+ * @since 2.0
286
+ * @param array $choices options values for select
287
+ * @param array $options array to pass group, id, rule_id etc
288
+ * @return echo the select field
289
+ */
290
+ static function print_select( $choices, $options ) {
291
+
292
+ // value must be array
293
+ if( !is_array($options['value']) )
294
+ {
295
+ // perhaps this is a default value with new lines in it?
296
+ if( strpos($options['value'], "\n") !== false )
297
+ {
298
+ // found multiple lines, explode it
299
+ $options['value'] = explode("\n", $options['value']);
300
+ }
301
+ else
302
+ {
303
+ $options['value'] = array( $options['value'] );
304
+ }
305
+ }
306
+
307
+
308
+ // trim value
309
+ $options['value'] = array_map('trim', $options['value']);
310
+ // determin if choices are grouped (2 levels of array)
311
+ if( is_array($choices) )
312
+ {
313
+ foreach( $choices as $k => $v )
314
+ {
315
+ if( is_array($v) )
316
+ {
317
+ $optgroup = true;
318
+ }
319
+ }
320
+ }
321
+
322
+ echo '<select id="spu_rule_'.$options['group_id'].'_rule_'.$options['rule_id'].'" class="select" name="'.$options['name'].'">';
323
+
324
+ // loop through values and add them as options
325
+ if( is_array($choices) )
326
+ {
327
+ foreach( $choices as $key => $value )
328
+ {
329
+ if( $optgroup )
330
+ {
331
+ // this select is grouped with optgroup
332
+ if($key != '') echo '<optgroup label="'.$key.'">';
333
+
334
+ if( is_array($value) )
335
+ {
336
+ foreach($value as $id => $label)
337
+ {
338
+
339
+ $selected = in_array($id, $options['value']) ? 'selected="selected"' : '';
340
+
341
+ echo '<option value="'.$id.'" '.$selected.'>'.$label.'</option>';
342
+ }
343
+ }
344
+
345
+ if($key != '') echo '</optgroup>';
346
+ }
347
+ else
348
+ {
349
+ $selected = in_array($key, $options['value']) ? 'selected="selected"' : '';
350
+ echo '<option value="'.$key.'" '.$selected.'>'.$value.'</option>';
351
+ }
352
+ }
353
+ }
354
+
355
+
356
+ echo '</select>';
357
+
358
+ }
359
+
360
+ /**
361
+ * Return the box options
362
+ * @param int $id spucpt id
363
+ * @since 2.0
364
+ * @return array metadata values
365
+ */
366
+ function get_box_options( $id )
367
+ {
368
+ $defaults = array(
369
+ 'css' => array(
370
+ 'position' => 'centered',
371
+ 'bgopacity' => '0.5',
372
+ 'background_color' => '#eeeeee',
373
+ 'color' => '#333',
374
+ 'width' => '400px',
375
+ 'border_color' => '#555',
376
+ 'border_width' => '8',
377
+ ),
378
+ 'trigger' => 'seconds',
379
+ 'trigger_number' => '5',
380
+ 'animation' => 'fade',
381
+ 'cookie' => '99',
382
+ 'auto_hide' => 0,
383
+ 'test_mode' => 0,
384
+ );
385
+
386
+ $opts = get_post_meta( $id, 'spu_options', true );
387
+
388
+ return wp_parse_args( $opts, apply_filters( 'spu/metaboxes/default_options', $defaults ) );
389
+ }
390
+
391
+ /**
392
+ * Return the box rules
393
+ * @param int $id spucpt id
394
+ * @since 2.0
395
+ * @return array metadata values
396
+ */
397
+ function get_box_rules( $id )
398
+ {
399
+ $defaults = array(
400
+ // group_0
401
+ array(
402
+
403
+ // rule_0
404
+ array(
405
+ 'param' => 'page_type',
406
+ 'operator' => '==',
407
+ 'value' => 'all_pages',
408
+ 'order_no' => 0,
409
+ 'group_no' => 0
410
+ )
411
+ )
412
+ );
413
+
414
+ $rules = get_post_meta( $id, 'spu_rules', true );
415
+
416
+ if( empty( $rules ) ) {
417
+
418
+ return apply_filters( 'spu/metaboxes/default_rules', $defaults );
419
+
420
+ } else {
421
+
422
+ return $rules;
423
+
424
+ }
425
+
426
+
427
+ }
428
+ }
includes/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
includes/updates-msg.html ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <div class="warning">
2
+ <p><strong>Warning:</strong></p>
3
+ <p>Popups v1.0.0 it's a totally new version of the plugin. Previous version are deprecated as the plugin was totally recoded from scracth. Please save your popups if you have custom text on them because the <strong>will be lost after update</strong></p>
4
+ </div>
5
+ <div class="error">
6
+ <p><strong>Warning:</strong></p>
7
+ <p>Popups v1.0.0 it's a totally new version of the plugin. Previous version are deprecated as the plugin was totally recoded from scracth. Please save your popups if you have custom text on them because the <strong>will be lost after update</strong></p>
8
+ </div>
index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
languages/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
languages/popups.pot ADDED
@@ -0,0 +1,522 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2013 TODO
2
+ # This file is distributed under the same license as the TODO package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Popups\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/plugins/plugin-name\n"
7
+ "POT-Creation-Date: 2014-07-14 22:20-0300\n"
8
+ "PO-Revision-Date: 2014-07-14 22:21-0300\n"
9
+ "Last-Translator: Damian Logghe <info@timersys.com>\n"
10
+ "Language-Team: Timersys <info@timersys.com>\n"
11
+ "Language: en_EN\n"
12
+ "MIME-Version: 1.0\n"
13
+ "Content-Type: text/plain; charset=UTF-8\n"
14
+ "Content-Transfer-Encoding: 8bit\n"
15
+ "X-Generator: Poedit 1.6.4\n"
16
+ "X-Poedit-KeywordsList: __;_e;_n;_x;esc_html_e;esc_html__;esc_attr_e;"
17
+ "esc_attr__;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_x:1,2c;_n:1,2\n"
18
+ "X-Poedit-Basepath: ../\n"
19
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
20
+ "X-Poedit-SearchPath-0: .\n"
21
+
22
+ #: admin/class-social-popup-admin.php:115
23
+ msgctxt "post type general name"
24
+ msgid "Popups"
25
+ msgstr ""
26
+
27
+ #: admin/class-social-popup-admin.php:116
28
+ msgctxt "post type singular name"
29
+ msgid "Popups"
30
+ msgstr ""
31
+
32
+ #: admin/class-social-popup-admin.php:117
33
+ msgctxt "admin menu"
34
+ msgid "Popups"
35
+ msgstr ""
36
+
37
+ #: admin/class-social-popup-admin.php:118
38
+ msgctxt "add new on admin bar"
39
+ msgid "Popups"
40
+ msgstr ""
41
+
42
+ #: admin/class-social-popup-admin.php:119
43
+ msgctxt "Popups"
44
+ msgid "Add New"
45
+ msgstr ""
46
+
47
+ #: admin/class-social-popup-admin.php:120
48
+ msgid "Add New Popups"
49
+ msgstr ""
50
+
51
+ #: admin/class-social-popup-admin.php:121
52
+ msgid "New Popups"
53
+ msgstr ""
54
+
55
+ #: admin/class-social-popup-admin.php:122
56
+ msgid "Edit Popups"
57
+ msgstr ""
58
+
59
+ #: admin/class-social-popup-admin.php:123
60
+ msgid "View Popups"
61
+ msgstr ""
62
+
63
+ #: admin/class-social-popup-admin.php:124
64
+ msgid "All Popups"
65
+ msgstr ""
66
+
67
+ #: admin/class-social-popup-admin.php:125
68
+ msgid "Search Popups"
69
+ msgstr ""
70
+
71
+ #: admin/class-social-popup-admin.php:126
72
+ msgid "Parent Popups:"
73
+ msgstr ""
74
+
75
+ #: admin/class-social-popup-admin.php:127
76
+ msgid "No Popups found."
77
+ msgstr ""
78
+
79
+ #: admin/class-social-popup-admin.php:128
80
+ msgid "No Popups found in Trash."
81
+ msgstr ""
82
+
83
+ #: admin/class-social-popup-admin.php:158
84
+ msgid "PopUp Shortcodes"
85
+ msgstr ""
86
+
87
+ #: admin/class-social-popup-admin.php:167
88
+ msgid "PopUp Display Rules"
89
+ msgstr ""
90
+
91
+ #: admin/class-social-popup-admin.php:176
92
+ msgid "Display Options"
93
+ msgstr ""
94
+
95
+ #: admin/class-social-popup-admin.php:185
96
+ msgid "Need support?"
97
+ msgstr ""
98
+
99
+ #: admin/class-social-popup-admin.php:193
100
+ msgid "Donate $10, $20 or $50"
101
+ msgstr ""
102
+
103
+ #: admin/class-social-popup-admin.php:201
104
+ msgid "About the developer"
105
+ msgstr ""
106
+
107
+ #: admin/class-social-popup-admin.php:385 admin/views/metabox-rules.php:33
108
+ #: admin/views/metabox-rules.php:136
109
+ msgid "or"
110
+ msgstr ""
111
+
112
+ #: admin/class-social-popup-admin.php:403
113
+ msgid "Settings"
114
+ msgstr ""
115
+
116
+ #: admin/includes/class-spu-upgrade.php:104
117
+ msgid "What's new"
118
+ msgstr ""
119
+
120
+ #: admin/includes/class-spu-upgrade.php:115
121
+ msgid "credits"
122
+ msgstr ""
123
+
124
+ #: admin/views/metabox-donate.php:6
125
+ msgid "If you like this plugin, consider supporting it by donating."
126
+ msgstr ""
127
+
128
+ #: admin/views/metabox-donate.php:8
129
+ msgid "Donate with PayPal"
130
+ msgstr ""
131
+
132
+ #: admin/views/metabox-donate.php:10
133
+ msgid "Some other ways to support this plugin"
134
+ msgstr ""
135
+
136
+ #: admin/views/metabox-donate.php:12
137
+ msgid "Leave a &#9733;&#9733;&#9733;&#9733;&#9733; review on WordPress.org"
138
+ msgstr ""
139
+
140
+ #: admin/views/metabox-donate.php:13
141
+ msgid "Write about Popups on your blog"
142
+ msgstr ""
143
+
144
+ #: admin/views/metabox-donate.php:14
145
+ msgid "Tweet about Popups"
146
+ msgstr ""
147
+
148
+ #: admin/views/metabox-donate.php:15
149
+ msgid "Vote \"works\" on the WordPress.org plugin page"
150
+ msgstr ""
151
+
152
+ #: admin/views/metabox-help.php:6
153
+ msgid ""
154
+ "You have three social shortcodes to use that will print a Facebook like, a "
155
+ "Google+ Follow and a Twitter follow. Check the available options and default "
156
+ "values:"
157
+ msgstr ""
158
+
159
+ #: admin/views/metabox-help.php:11
160
+ msgid "View Facebook Options"
161
+ msgstr ""
162
+
163
+ #: admin/views/metabox-help.php:13
164
+ msgid "Your facebook page url"
165
+ msgstr ""
166
+
167
+ #: admin/views/metabox-help.php:14
168
+ msgid "standard, box_count, button - Default: button_count"
169
+ msgstr ""
170
+
171
+ #: admin/views/metabox-help.php:15 admin/views/metabox-help.php:16
172
+ msgid "true - Default: False"
173
+ msgstr ""
174
+
175
+ #: admin/views/metabox-help.php:17
176
+ msgid "recommend - Default: Like"
177
+ msgstr ""
178
+
179
+ #: admin/views/metabox-help.php:24
180
+ msgid "View Google+ Options"
181
+ msgstr ""
182
+
183
+ #: admin/views/metabox-help.php:26
184
+ msgid "Your Google+ url"
185
+ msgstr ""
186
+
187
+ #: admin/views/metabox-help.php:27
188
+ msgid "small, standard, tall Default: medium"
189
+ msgstr ""
190
+
191
+ #: admin/views/metabox-help.php:28
192
+ msgid "inline, none - Default: bubble"
193
+ msgstr ""
194
+
195
+ #: admin/views/metabox-help.php:34
196
+ msgid "View Twitter Options"
197
+ msgstr ""
198
+
199
+ #: admin/views/metabox-help.php:36
200
+ msgid "Your Twitter user - Default chifliiiii"
201
+ msgstr ""
202
+
203
+ #: admin/views/metabox-help.php:37
204
+ msgid "false Default: true"
205
+ msgstr ""
206
+
207
+ #: admin/views/metabox-help.php:38
208
+ msgid "large - Default: \"\""
209
+ msgstr ""
210
+
211
+ #: admin/views/metabox-help.php:40
212
+ msgid "The button text - Default: Follow @chifliiiii"
213
+ msgstr ""
214
+
215
+ #: admin/views/metabox-links.php:6
216
+ msgid "My name is"
217
+ msgstr ""
218
+
219
+ #: admin/views/metabox-links.php:6
220
+ msgid "I develop WordPress plugins and themes."
221
+ msgstr ""
222
+
223
+ #: admin/views/metabox-links.php:7
224
+ #, php-format
225
+ msgid ""
226
+ "Take a look at my <a href=\"%s\">site</a> to see my other plugins or hire "
227
+ "me. Subscribe to get updates!"
228
+ msgstr ""
229
+
230
+ #: admin/views/metabox-options.php:9
231
+ msgid "Box Position"
232
+ msgstr ""
233
+
234
+ #: admin/views/metabox-options.php:12
235
+ msgid "Centered"
236
+ msgstr ""
237
+
238
+ #: admin/views/metabox-options.php:13
239
+ msgid "Top Left"
240
+ msgstr ""
241
+
242
+ #: admin/views/metabox-options.php:14
243
+ msgid "Top Right"
244
+ msgstr ""
245
+
246
+ #: admin/views/metabox-options.php:15
247
+ msgid "Bottom Left"
248
+ msgstr ""
249
+
250
+ #: admin/views/metabox-options.php:16
251
+ msgid "Bottom Right"
252
+ msgstr ""
253
+
254
+ #: admin/views/metabox-options.php:22
255
+ msgid "Trigger action"
256
+ msgstr ""
257
+
258
+ #: admin/views/metabox-options.php:26
259
+ msgid "seconds after page load"
260
+ msgstr ""
261
+
262
+ #: admin/views/metabox-options.php:27
263
+ msgid "of page height"
264
+ msgstr ""
265
+
266
+ #: admin/views/metabox-options.php:36
267
+ msgid "Animation"
268
+ msgstr ""
269
+
270
+ #: admin/views/metabox-options.php:38
271
+ msgid "Fade In"
272
+ msgstr ""
273
+
274
+ #: admin/views/metabox-options.php:39
275
+ msgid "Slide In"
276
+ msgstr ""
277
+
278
+ #: admin/views/metabox-options.php:40
279
+ msgid "Slide will only apply when popup is on the corners"
280
+ msgstr ""
281
+
282
+ #: admin/views/metabox-options.php:45
283
+ msgid "Cookie expiration days"
284
+ msgstr ""
285
+
286
+ #: admin/views/metabox-options.php:48
287
+ msgid "After closing the box, how many days should it stay hidden?"
288
+ msgstr ""
289
+
290
+ #: admin/views/metabox-options.php:53
291
+ msgid "Auto-hide?"
292
+ msgstr ""
293
+
294
+ #: admin/views/metabox-options.php:55 admin/views/metabox-options.php:64
295
+ msgid "Yes"
296
+ msgstr ""
297
+
298
+ #: admin/views/metabox-options.php:56 admin/views/metabox-options.php:65
299
+ msgid "No"
300
+ msgstr ""
301
+
302
+ #: admin/views/metabox-options.php:57
303
+ #, php-format
304
+ msgid ""
305
+ "Hide box again when visitors scroll back up? Only works when Trigger action "
306
+ "is set to % of page height"
307
+ msgstr ""
308
+
309
+ #: admin/views/metabox-options.php:62
310
+ msgid "Enable test mode?"
311
+ msgstr ""
312
+
313
+ #: admin/views/metabox-options.php:66
314
+ msgid ""
315
+ "If test mode is enabled, the box will show up regardless of whether a cookie "
316
+ "has been set. (To admins only)"
317
+ msgstr ""
318
+
319
+ #: admin/views/metabox-options.php:71
320
+ msgid "Appearance"
321
+ msgstr ""
322
+
323
+ #: admin/views/metabox-options.php:74
324
+ msgid "Background opacity"
325
+ msgstr ""
326
+
327
+ #: admin/views/metabox-options.php:77
328
+ msgid "Leave at 0 for no background. Max value is 1"
329
+ msgstr ""
330
+
331
+ #: admin/views/metabox-options.php:83
332
+ msgid "Background color"
333
+ msgstr ""
334
+
335
+ #: admin/views/metabox-options.php:87
336
+ msgid "Text color"
337
+ msgstr ""
338
+
339
+ #: admin/views/metabox-options.php:91
340
+ msgid "Box width"
341
+ msgstr ""
342
+
343
+ #: admin/views/metabox-options.php:97
344
+ msgid "Border color"
345
+ msgstr ""
346
+
347
+ #: admin/views/metabox-options.php:101
348
+ msgid "Border width"
349
+ msgstr ""
350
+
351
+ #: admin/views/metabox-rules.php:19
352
+ msgid "Rules"
353
+ msgstr ""
354
+
355
+ #: admin/views/metabox-rules.php:20
356
+ msgid "Create a set of rules to determine where the popup will show"
357
+ msgstr ""
358
+
359
+ #: admin/views/metabox-rules.php:31
360
+ msgid "Show this popup if"
361
+ msgstr ""
362
+
363
+ #: admin/views/metabox-rules.php:45
364
+ msgid "User"
365
+ msgstr ""
366
+
367
+ #: admin/views/metabox-rules.php:46
368
+ msgid "User role"
369
+ msgstr ""
370
+
371
+ #: admin/views/metabox-rules.php:47
372
+ msgid "User is logged"
373
+ msgstr ""
374
+
375
+ #: admin/views/metabox-rules.php:48
376
+ msgid "User never left a comment"
377
+ msgstr ""
378
+
379
+ #: admin/views/metabox-rules.php:49
380
+ msgid "User came via a search engine"
381
+ msgstr ""
382
+
383
+ #: admin/views/metabox-rules.php:50
384
+ msgid "User did not arrive via another page on your site"
385
+ msgstr ""
386
+
387
+ #: admin/views/metabox-rules.php:52 admin/views/metabox-rules.php:53
388
+ msgid "Post"
389
+ msgstr ""
390
+
391
+ #: admin/views/metabox-rules.php:54
392
+ msgid "Post Type"
393
+ msgstr ""
394
+
395
+ #: admin/views/metabox-rules.php:55
396
+ msgid "Post Category"
397
+ msgstr ""
398
+
399
+ #: admin/views/metabox-rules.php:56
400
+ msgid "Post Format"
401
+ msgstr ""
402
+
403
+ #: admin/views/metabox-rules.php:57
404
+ msgid "Post Status"
405
+ msgstr ""
406
+
407
+ #: admin/views/metabox-rules.php:58
408
+ msgid "Post Taxonomy"
409
+ msgstr ""
410
+
411
+ #: admin/views/metabox-rules.php:60 admin/views/metabox-rules.php:61
412
+ msgid "Page"
413
+ msgstr ""
414
+
415
+ #: admin/views/metabox-rules.php:62
416
+ msgid "Page Type"
417
+ msgstr ""
418
+
419
+ #: admin/views/metabox-rules.php:63
420
+ msgid "Page Parent"
421
+ msgstr ""
422
+
423
+ #: admin/views/metabox-rules.php:64
424
+ msgid "Page Template"
425
+ msgstr ""
426
+
427
+ #: admin/views/metabox-rules.php:66
428
+ msgid "Other"
429
+ msgstr ""
430
+
431
+ #: admin/views/metabox-rules.php:67
432
+ msgid "Mobile / Tablets"
433
+ msgstr ""
434
+
435
+ #: admin/views/metabox-rules.php:91
436
+ msgid "is equal to"
437
+ msgstr ""
438
+
439
+ #: admin/views/metabox-rules.php:92
440
+ msgid "is not equal to"
441
+ msgstr ""
442
+
443
+ #: admin/views/metabox-rules.php:123
444
+ msgid "and"
445
+ msgstr ""
446
+
447
+ #: admin/views/metabox-rules.php:138
448
+ msgid "Add rule group"
449
+ msgstr ""
450
+
451
+ #: admin/views/metabox-support.php:6
452
+ #, php-format
453
+ msgid ""
454
+ "If you need support please go to the WordPress.org <a href=\"%s\">support "
455
+ "forums</a>"
456
+ msgstr ""
457
+
458
+ #: includes/class-spu-helper.php:131
459
+ msgid "All Pages"
460
+ msgstr ""
461
+
462
+ #: includes/class-spu-helper.php:132
463
+ msgid "Front Page"
464
+ msgstr ""
465
+
466
+ #: includes/class-spu-helper.php:133
467
+ msgid "Posts Page"
468
+ msgstr ""
469
+
470
+ #: includes/class-spu-helper.php:134
471
+ msgid "Top Level Page (parent of 0)"
472
+ msgstr ""
473
+
474
+ #: includes/class-spu-helper.php:135
475
+ msgid "Parent Page (has children)"
476
+ msgstr ""
477
+
478
+ #: includes/class-spu-helper.php:136
479
+ msgid "Child Page (has parent)"
480
+ msgstr ""
481
+
482
+ #: includes/class-spu-helper.php:144
483
+ msgid "Default Template"
484
+ msgstr ""
485
+
486
+ #: includes/class-spu-helper.php:222
487
+ msgid "Publish"
488
+ msgstr ""
489
+
490
+ #: includes/class-spu-helper.php:223
491
+ msgid "Pending Review"
492
+ msgstr ""
493
+
494
+ #: includes/class-spu-helper.php:224
495
+ msgid "Draft"
496
+ msgstr ""
497
+
498
+ #: includes/class-spu-helper.php:225
499
+ msgid "Future"
500
+ msgstr ""
501
+
502
+ #: includes/class-spu-helper.php:226
503
+ msgid "Private"
504
+ msgstr ""
505
+
506
+ #: includes/class-spu-helper.php:227
507
+ msgid "Revision"
508
+ msgstr ""
509
+
510
+ #: includes/class-spu-helper.php:228
511
+ msgid "Trash"
512
+ msgstr ""
513
+
514
+ #: includes/class-spu-helper.php:241
515
+ msgid "Super Admin"
516
+ msgstr ""
517
+
518
+ #: includes/class-spu-helper.php:256 includes/class-spu-helper.php:262
519
+ #: includes/class-spu-helper.php:268 includes/class-spu-helper.php:274
520
+ #: includes/class-spu-helper.php:280
521
+ msgid "True"
522
+ msgstr ""
popups.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Popups
4
+ *
5
+ * @package socialpopup
6
+ * @author Damian Logghe <info@timersys.com>
7
+ * @license GPL-2.0+
8
+ * @link http://www.timersys.com/plugins-wordpress/social-popup/
9
+ * @copyright 2014 Damian Logghe
10
+ *
11
+ * @socialpopup
12
+ * Plugin Name: Popups
13
+ * Plugin URI: http://www.timersys.com/free-plugins/social-popup/
14
+ * Version: 1.0.1
15
+ * Description: This plugin will display a popup or splash screen when a new user visit your site showing a Google+, twitter and facebook follow links. This will increase you followers ratio in a 40%. Popup will be close depending on your settings. Check readme.txt for full details.
16
+ * Author: Damian Logghe
17
+ * Author URI: http://wp.timersys.com
18
+ * Text Domain: spu
19
+ * License: GPL-2.0+
20
+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
21
+ * Domain Path: /languages
22
+ */
23
+
24
+ // If this file is called directly, abort.
25
+ if ( ! defined( 'WPINC' ) ) {
26
+ die;
27
+ }
28
+
29
+ /*----------------------------------------------------------------------------*
30
+ * Public-Facing Functionality
31
+ *----------------------------------------------------------------------------*/
32
+
33
+ define( SPU_PLUGIN_DIR , plugin_dir_path(__FILE__) );
34
+ define( SPU_PLUGIN_URL , plugin_dir_url(__FILE__) );
35
+ define( SPU_PLUGIN_HOOK , basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ) );
36
+
37
+
38
+ require_once( plugin_dir_path( __FILE__ ) . 'public/class-social-popup.php' );
39
+
40
+ /*
41
+ * Register hooks that are fired when the plugin is activated or deactivated.
42
+ * When the plugin is deleted, the uninstall.php file is loaded.
43
+ */
44
+ register_activation_hook( __FILE__, array( 'SocialPopup', 'activate' ) );
45
+ register_deactivation_hook( __FILE__, array( 'SocialPopup', 'deactivate' ) );
46
+
47
+ /*
48
+ * @TODO:
49
+ *
50
+ * - replace SocialPopup with the name of the class defined in
51
+ * `class-plugin-name.php`
52
+ */
53
+ add_action( 'plugins_loaded', array( 'SocialPopup', 'get_instance' ) );
54
+
55
+ /*----------------------------------------------------------------------------*
56
+ * Dashboard and Administrative Functionality
57
+ *----------------------------------------------------------------------------*/
58
+
59
+
60
+ if ( is_admin() ) {
61
+
62
+ require_once( plugin_dir_path( __FILE__ ) . 'admin/class-social-popup-admin.php' );
63
+
64
+ add_action( 'plugins_loaded', array( 'SocialPopup_Admin', 'get_instance' ) );
65
+
66
+ }
public/assets/css/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
public/assets/css/public.css ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* This stylesheet is used to style the public-facing components of the plugin. */
2
+ html,
3
+ body {
4
+ min-height: 100% !important;
5
+ height: auto !important;
6
+ }
7
+ .spu-bg{
8
+ position: fixed;
9
+ width: 100%;
10
+ height: 100%;
11
+ background: #000;
12
+ top: 0;
13
+ left: 0;
14
+ display: none;
15
+ z-index: 99999;
16
+ }
17
+ .spu-box {
18
+ position:fixed;
19
+ z-index: 999999;
20
+ -moz-box-shadow: 0 0 10px 1px #666;
21
+ -webkit-box-shadow: 0 0 10px 1px #666;
22
+ box-shadow: 0 0 10px 1px #666;
23
+ padding: 25px;
24
+ margin: 10px;
25
+ -moz-border-radius: 8px;
26
+ -webkit-border-radius: 8px;
27
+ border-radius: 8px;
28
+ }
29
+ /** Some basic css for box content**/
30
+ .spu-box h1{
31
+ margin: 1.414285714rem 0;
32
+ font-size: 1.4em;
33
+ }
34
+ .spu-box h2{
35
+ margin: 1.414285714rem 0;
36
+ font-size: 1.2em;
37
+ }
38
+ .spu-box h3{
39
+ margin: 1.414285714rem 0;
40
+ font-size: 1.0em;
41
+ }
42
+ .spu-box p{
43
+ margin: 0 0 1.414285714rem;
44
+ }
45
+
46
+ /** end basic style**/
47
+ .spu-box.spu-top-left{
48
+ top: 0; left: 0; bottom: auto; right: auto;
49
+ }
50
+
51
+ .spu-box.spu-top-right{
52
+ top: 0; right: 0; bottom: auto; left: auto;
53
+ }
54
+
55
+ .spu-box.spu-bottom-left{
56
+ bottom: 0; left: 0; top: auto; right: auto;
57
+ }
58
+
59
+ .spu-box.spu-bottom-right{
60
+ bottom: 0; right: 0; top: auto; left: auto;
61
+ }
62
+
63
+ .spu-content > *:first-child {
64
+ margin-top: 0; padding-top: 0;
65
+ }
66
+
67
+ .spu-content > *:last-child {
68
+ margin-bottom:0; padding-bottom:0;
69
+ }
70
+
71
+ .spu-close{
72
+ position:absolute;
73
+ right:5px;
74
+ top:5px;
75
+ height:20px;
76
+ width:20px;
77
+ text-align:center;
78
+ padding: 0;
79
+ cursor: pointer;
80
+ background: transparent;
81
+ border: 0;
82
+ -webkit-appearance: none;
83
+ font-size: 21px;
84
+ font-weight: bold;
85
+ line-height: 1;
86
+ text-shadow: 0 1px 0 #fff;
87
+ opacity: .3;
88
+ filter: alpha(opacity=30);
89
+ }
90
+
91
+ .spu-close:hover, .spu-close:focus {
92
+ color: #000;
93
+ text-decoration: none;
94
+ cursor: pointer;
95
+ opacity: .6;
96
+ filter: alpha(opacity=60);
97
+ }
98
+ .spu-shortcode {
99
+ float: left;
100
+ }
101
+ .spu-total-4 .spu-shortcode{
102
+ width:24%;
103
+ margin-left:.5%;
104
+ }
105
+
106
+ .spu-total-3 .spu-shortcode{
107
+ width:28%;
108
+ margin-left:5.3%;
109
+ }
110
+
111
+ .spu-total-2 .spu-shortcode{
112
+ width:14%;
113
+ margin-left:20%;
114
+ }
115
+
116
+ .spu-total-1 .spu-shortcode{
117
+ margin:0 37.5%;
118
+ width:auto;
119
+ }
public/assets/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
public/assets/js/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
public/assets/js/min/public-ck.js ADDED
@@ -0,0 +1 @@
 
1
+ function createCookie(t,n,e){if(e){var i=new Date;i.setTime(i.getTime()+24*e*60*60*1e3);var o="; expires="+i.toGMTString()}else var o="";document.cookie=t+"="+n+o+"; path=/"}function readCookie(t){for(var n=t+"=",e=document.cookie.split(";"),i=0;i<e.length;i++){for(var o=e[i];" "==o.charAt(0);)o=o.substring(1,o.length);if(0==o.indexOf(n))return o.substring(n.length,o.length)}return null}jQuery(window).load(function(){window.SPU=function(t){function n(n){var e=a[n],i=t(window).width(),o=t(window).height(),r=e.height(),s=e.width();e.css({position:"fixed",top:o/2-r/2,left:i/2-s/2})}function e(n,e){var i=a[n],o=t("#spu-bg-"+n),r=i.data("bgopa");if(i.is(":animated"))return!1;if(e===!0&&i.is(":visible")||e===!1&&i.is(":hidden"))return!1;var s=i.data("animation");return"fade"===s?i.fadeToggle("slow"):i.slideToggle("slow"),e===!0&&r>0?o.fadeIn():o.fadeOut(),e}var i=t(window).height(),o=spuvar.is_admin,a=[];return t(".spu-content").children().first().css({"margin-top":0,"padding-top":0}).end().last().css({"margin-bottom":0,"padding-bottom":0}),t(".spu-box").each(function(){var r=t(this),s=r.data("trigger"),d=r.data("animation"),c=0,u=1===parseInt(r.data("test-mode")),l=r.data("box-id"),f=1===parseInt(r.data("auto-hide")),h=1===parseInt(r.data("advanced-close")),w=parseInt(r.data("seconds-close"));if(h){t(document).keyup(function(t){27==t.keyCode&&e(l,!1)});var g=navigator.userAgent,p=g.match(/iPad/i)||g.match(/iPhone/i)?"touchstart":"click";t("body").on(p,function(t){e(l,!1)}),t("#"+l).click(function(t){t.stopPropagation()})}if(r.hide().css("left",""),a[l]=r,"seconds"==s)var m=parseInt(r.data("trigger-number"),10);else var v="percentage"==s?parseInt(r.data("trigger-number"),10)/100:.8,b=v*t(document).height();var k=function(){c&&clearTimeout(c),c=window.setTimeout(function(){var o=t(window).scrollTop(),a=o+i>=b;a?(f||t(window).unbind("scroll",k),r.hasClass("spu-centered")&&n(l),e(l,!0)):e(l,!1)},100)},T=function(){c&&clearTimeout(c),c=window.setTimeout(function(){r.hasClass("spu-centered")&&n(l),e(l,!0)},1e3*m)},I=readCookie("spu_box_"+l);if((void 0==I||o&&u)&&("seconds"==s?T():(t(window).bind("scroll",k),k()),window.location.hash&&window.location.hash.length>0)){var x=window.location.hash,C;x.substring(1)===r.attr("id")&&setTimeout(function(){e(l,!0)},100)}r.find(".spu-close").click(function(){e(l,!1),"percentage"==s&&t(window).unbind("scroll",k);var n=parseInt(r.data("cookie"));n>0&&createCookie("spu_box_"+l,!0,n)}),t('a[href="#'+r.attr("id")+'"]').click(function(){return e(l,!0),!1})}),{show:function(t){return e(t,!0)},hide:function(t){return e(t,!1)}}}(window.jQuery)});
public/assets/js/public.js ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(window).load(function() {
2
+ window.SPU = (function($) {
3
+
4
+ var windowHeight = $(window).height();
5
+ var isAdmin = spuvar.is_admin;
6
+ var $boxes = [];
7
+
8
+
9
+ //remove paddings and margins from first and last items inside box
10
+ $(".spu-content").children().first().css({
11
+ "margin-top": 0,
12
+ "padding-top": 0
13
+ }).end().last().css({
14
+ 'margin-bottom': 0,
15
+ 'padding-bottom': 0
16
+ });
17
+
18
+ // loop through boxes
19
+ $(".spu-box").each(function() {
20
+
21
+
22
+ // vars
23
+ var $box = $(this);
24
+ var triggerMethod = $box.data('trigger');
25
+ var animation = $box.data('animation');
26
+ var timer = 0;
27
+ var testMode = (parseInt($box.data('test-mode')) === 1);
28
+ var id = $box.data('box-id');
29
+ var autoHide = (parseInt($box.data('auto-hide')) === 1);
30
+ var advancedClose = (parseInt($box.data('advanced-close')) === 1);
31
+ var secondsClose = parseInt($box.data('seconds-close'));
32
+
33
+ if ( advancedClose ) {
34
+ //close with esc
35
+ $(document).keyup(function(e) {
36
+ if (e.keyCode == 27) {
37
+ toggleBox( id, false );
38
+ }
39
+ });
40
+ //close on ipads // iphones
41
+ var ua = navigator.userAgent,
42
+ event = (ua.match(/iPad/i) || ua.match(/iPhone/i)) ? "touchstart" : "click";
43
+
44
+ $('body').on(event, function (ev) {
45
+
46
+ toggleBox( id, false );
47
+ });
48
+ //not on the box
49
+ $('#' + id ).click(function(event) {
50
+ event.stopPropagation();
51
+ });
52
+ }
53
+ // Seconds left to close
54
+ // if( secondsClose > 0 )
55
+ // {
56
+ // spu_count= defaults.s_to_close;
57
+ // spu_counter = setInterval(function(){spu_timer(defaults)}, 1000);
58
+ // }
59
+
60
+ //hide boxes and remove left-99999px we cannot since beggining of facebook won't display
61
+ $box.hide().css('left','');
62
+
63
+ // add box to global boxes array
64
+ $boxes[id] = $box;
65
+
66
+
67
+ if(triggerMethod == 'seconds') {
68
+ var triggerSeconds = parseInt( $box.data('trigger-number'), 10 );
69
+ } else {
70
+ var triggerPercentage = ( triggerMethod == 'percentage' ) ? ( parseInt( $box.data('trigger-number'), 10 ) / 100 ) : 0.8;
71
+ var triggerHeight = ( triggerPercentage * $(document).height() );
72
+ }
73
+
74
+ // functions that check % of height
75
+ var triggerHeightCheck = function()
76
+ {
77
+ if(timer) {
78
+ clearTimeout(timer);
79
+ }
80
+
81
+ timer = window.setTimeout(function() {
82
+ var scrollY = $(window).scrollTop();
83
+ var triggered = ((scrollY + windowHeight) >= triggerHeight);
84
+
85
+ // show box when criteria for this box is matched
86
+ if( triggered ) {
87
+
88
+ // remove listen event if box shouldn't be hidden again
89
+ if( ! autoHide ) {
90
+ $(window).unbind('scroll', triggerHeightCheck);
91
+ }
92
+ //if is a centered popup, center it
93
+ if( $box.hasClass('spu-centered') ) {
94
+
95
+ centerBox( id );
96
+
97
+ }
98
+ toggleBox( id, true );
99
+ } else {
100
+ toggleBox( id, false );
101
+ }
102
+
103
+ }, 100);
104
+ }
105
+ // function that show popup after X secs
106
+ var triggerSecondsCheck = function()
107
+ {
108
+ if(timer) {
109
+ clearTimeout(timer);
110
+ }
111
+
112
+ timer = window.setTimeout(function() {
113
+ //if is a centered popup, center it
114
+ if( $box.hasClass('spu-centered') ) {
115
+
116
+ centerBox( id );
117
+
118
+ }
119
+ toggleBox( id, true );
120
+
121
+ }, triggerSeconds * 1000);
122
+ }
123
+
124
+ // show box if cookie not set or if in test mode
125
+ var cookieValue = readCookie( 'spu_box_' + id );
126
+
127
+ if( cookieValue == undefined || ( isAdmin && testMode ) ) {
128
+
129
+ if(triggerMethod == 'seconds') {
130
+ triggerSecondsCheck();
131
+ } else {
132
+ $(window).bind( 'scroll', triggerHeightCheck );
133
+ // init, check box criteria once
134
+ triggerHeightCheck();
135
+ }
136
+
137
+ // shows the box when hash refers to a box
138
+ if(window.location.hash && window.location.hash.length > 0) {
139
+
140
+ var hash = window.location.hash;
141
+ var $element;
142
+
143
+ if( hash.substring(1) === $box.attr( 'id' ) ) {
144
+ setTimeout(function() {
145
+ toggleBox( id, true );
146
+ }, 100);
147
+ }
148
+ }
149
+ } /* end check cookie */
150
+
151
+ $box.find(".spu-close").click(function() {
152
+
153
+ // hide box
154
+ toggleBox( id, false );
155
+
156
+ if(triggerMethod == 'percentage') {
157
+ // unbind
158
+ $(window).unbind( 'scroll', triggerHeightCheck );
159
+ }
160
+
161
+ // set cookie
162
+ var days = parseInt( $box.data('cookie') );
163
+ if( days > 0 ) {
164
+ createCookie( 'spu_box_' + id, true, days );
165
+ }
166
+
167
+ });
168
+
169
+ // add link listener for this box
170
+ $('a[href="#' + $box.attr('id') +'"]').click(function() { toggleBox(id, true); return false; });
171
+
172
+ });
173
+ //function that center popup on screen
174
+ function centerBox( id ) {
175
+ var $box = $boxes[id];
176
+ var windowWidth = $(window).width();
177
+ var windowHeight = $(window).height();
178
+ var popupHeight = $box.height();
179
+ var popupWidth = $box.width();
180
+ $box.css({
181
+ "position": "fixed",
182
+ "top": windowHeight / 2 - popupHeight / 2,
183
+ "left": windowWidth / 2 - popupWidth / 2
184
+ });
185
+ }
186
+
187
+ //function that show/hide box
188
+ function toggleBox( id, show ) {
189
+ var $box = $boxes[id];
190
+ var $bg = $('#spu-bg-'+id);
191
+ var $bgopa = $box.data('bgopa');
192
+
193
+ // don't do anything if box is undergoing an animation
194
+ if( $box.is( ":animated" ) ) {
195
+ return false;
196
+ }
197
+
198
+ // is box already at desired visibility?
199
+ if( ( show === true && $box.is( ":visible" ) ) || ( show === false && $box.is( ":hidden" ) ) ) {
200
+ return false;
201
+ }
202
+
203
+ // show box
204
+ var animation = $box.data('animation');
205
+
206
+ if( animation === 'fade' ) {
207
+ $box.fadeToggle( 'slow' );
208
+ } else {
209
+ $box.slideToggle( 'slow' );
210
+ }
211
+ if( show === true && $bgopa > 0 ){
212
+ $bg.fadeIn();
213
+ } else {
214
+ $bg.fadeOut();
215
+ }
216
+
217
+ return show;
218
+ }
219
+
220
+ return {
221
+ show: function( box_id ) {
222
+ return toggleBox( box_id, true );
223
+ },
224
+ hide: function( box_id ) {
225
+ return toggleBox( box_id, false );
226
+ }
227
+ }
228
+
229
+ })(window.jQuery);
230
+
231
+ });
232
+ /**
233
+ * Cookie functions
234
+ */
235
+ function createCookie(name, value, days) {
236
+ if (days) {
237
+ var date = new Date();
238
+ date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
239
+ var expires = "; expires=" + date.toGMTString();
240
+ } else var expires = "";
241
+ document.cookie = name + "=" + value + expires + "; path=/";
242
+ }
243
+
244
+ function readCookie(name) {
245
+ var nameEQ = name + "=";
246
+ var ca = document.cookie.split(';');
247
+ for (var i = 0; i < ca.length; i++) {
248
+ var c = ca[i];
249
+ while (c.charAt(0) == ' ') c = c.substring(1, c.length);
250
+ if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
251
+ }
252
+ return null;
253
+ }
public/class-social-popup.php ADDED
@@ -0,0 +1,552 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Popups.
4
+ *
5
+ * @package Popups
6
+ * @author Damian Logghe <info@timersys.com>
7
+ * @license GPL-2.0+
8
+ * @link http://example.com
9
+ * @copyright 2014 Your Name or Company Name
10
+ */
11
+
12
+ /**
13
+ * Public Class of the plugin
14
+ * @package Popups
15
+ * @author Damian Logghe <info@timersys.com>
16
+ */
17
+ class SocialPopup {
18
+
19
+ /**
20
+ * Plugin version, used for cache-busting of style and script file references.
21
+ *
22
+ * @since 1.0.0
23
+ *
24
+ * @var string
25
+ */
26
+ const VERSION = '1.0.1';
27
+
28
+ /**
29
+ * Popups to use acrros files
30
+ *
31
+ * @since 1.7
32
+ *
33
+ * @var string
34
+ */
35
+ const PLUGIN_NAME = 'Popups';
36
+
37
+ /**
38
+ * @TODO - Rename "plugin-name" to the name your your plugin
39
+ *
40
+ * Unique identifier for your plugin.
41
+ *
42
+ *
43
+ * The variable name is used as the text domain when internationalizing strings
44
+ * of text. Its value should match the Text Domain file header in the main
45
+ * plugin file.
46
+ *
47
+ * @since 1.0.0
48
+ *
49
+ * @var string
50
+ */
51
+ protected $plugin_slug = 'spu';
52
+
53
+ /**
54
+ * Instance of this class.
55
+ *
56
+ * @since 1.0.0
57
+ *
58
+ * @var object
59
+ */
60
+ protected static $instance = null;
61
+
62
+ /**
63
+ * Plugin info accesible everywhere
64
+ * @var array
65
+ *
66
+ * @since 1.0.0
67
+ */
68
+ var $info;
69
+
70
+ /**
71
+ * Initialize the plugin by setting localization and loading public scripts
72
+ * and styles.
73
+ *
74
+ * @since 1.0.0
75
+ */
76
+ private function __construct() {
77
+
78
+ // vars
79
+ $this->info = array(
80
+ 'dir' => SPU_PLUGIN_DIR,
81
+ 'url' => SPU_PLUGIN_URL,
82
+ 'hook' => SPU_PLUGIN_HOOK,
83
+ 'version' => self::VERSION,
84
+ 'upgrade_version' => '1.6.4.3',
85
+ );
86
+
87
+ // Load plugin text domain
88
+ add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
89
+
90
+ // Activate plugin when new blog is added
91
+ add_action( 'wpmu_new_blog', array( $this, 'activate_new_site' ) );
92
+
93
+ // Register public-facing style sheet and JavaScript.
94
+ add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
95
+
96
+ //check for matches
97
+ add_action( 'wp_enqueue_scripts', array( $this, 'check_for_matches' ) );
98
+
99
+ //print boxes
100
+ add_action( 'wp_footer', array( $this, 'print_boxes' ) );
101
+
102
+ //FILTERS
103
+ add_filter('spu/get_info', array($this, 'get_info'), 1, 1);
104
+ //spu content function
105
+ add_filter( 'spu/popup/content', 'wptexturize') ;
106
+ add_filter( 'spu/popup/content', 'convert_smilies' );
107
+ add_filter( 'spu/popup/content', 'convert_chars' );
108
+ add_filter( 'spu/popup/content', 'wpautop' );
109
+ add_filter( 'spu/popup/content', 'shortcode_unautop' );
110
+ add_filter( 'spu/popup/content', 'do_shortcode', 11 );
111
+
112
+ //Register shortcodes
113
+ add_shortcode( 'spu-facebook', array( $this, 'facebook_shortcode' ) );
114
+ add_shortcode( 'spu-twitter', array( $this, 'twitter_shortcode' ) );
115
+ add_shortcode( 'spu-google', array( $this, 'google_shortcode' ) );
116
+ }
117
+
118
+ /**
119
+ * Return the plugin slug.
120
+ *
121
+ * @since 1.0.0
122
+ *
123
+ * @return Plugin slug variable.
124
+ */
125
+ public function get_plugin_slug() {
126
+ return $this->plugin_slug;
127
+ }
128
+
129
+ /**
130
+ * Return an instance of this class.
131
+ *
132
+ * @since 1.0.0
133
+ *
134
+ * @return object A single instance of this class.
135
+ */
136
+ public static function get_instance() {
137
+
138
+ // If the single instance hasn't been set, set it now.
139
+ if ( null == self::$instance ) {
140
+ self::$instance = new self;
141
+ }
142
+
143
+ return self::$instance;
144
+ }
145
+
146
+ /**
147
+ * Fired when the plugin is activated.
148
+ *
149
+ * @since 1.0.0
150
+ *
151
+ * @param boolean $network_wide True if WPMU superadmin uses
152
+ * "Network Activate" action, false if
153
+ * WPMU is disabled or plugin is
154
+ * activated on an individual blog.
155
+ */
156
+ public static function activate( $network_wide ) {
157
+
158
+ if ( function_exists( 'is_multisite' ) && is_multisite() ) {
159
+
160
+ if ( $network_wide ) {
161
+
162
+ // Get all blog ids
163
+ $blog_ids = self::get_blog_ids();
164
+
165
+ foreach ( $blog_ids as $blog_id ) {
166
+
167
+ switch_to_blog( $blog_id );
168
+ self::single_activate();
169
+ }
170
+
171
+ restore_current_blog();
172
+
173
+ } else {
174
+ self::single_activate();
175
+ }
176
+
177
+ } else {
178
+ self::single_activate();
179
+ }
180
+
181
+ }
182
+
183
+ /**
184
+ * Fired when the plugin is deactivated.
185
+ *
186
+ * @since 1.0.0
187
+ *
188
+ * @param boolean $network_wide True if WPMU superadmin uses
189
+ * "Network Deactivate" action, false if
190
+ * WPMU is disabled or plugin is
191
+ * deactivated on an individual blog.
192
+ */
193
+ public static function deactivate( $network_wide ) {
194
+
195
+ if ( function_exists( 'is_multisite' ) && is_multisite() ) {
196
+
197
+ if ( $network_wide ) {
198
+
199
+ // Get all blog ids
200
+ $blog_ids = self::get_blog_ids();
201
+
202
+ foreach ( $blog_ids as $blog_id ) {
203
+
204
+ switch_to_blog( $blog_id );
205
+ self::single_deactivate();
206
+
207
+ }
208
+
209
+ restore_current_blog();
210
+
211
+ } else {
212
+ self::single_deactivate();
213
+ }
214
+
215
+ } else {
216
+ self::single_deactivate();
217
+ }
218
+
219
+ }
220
+
221
+ /**
222
+ * Fired when a new site is activated with a WPMU environment.
223
+ *
224
+ * @since 1.0.0
225
+ *
226
+ * @param int $blog_id ID of the new blog.
227
+ */
228
+ public function activate_new_site( $blog_id ) {
229
+
230
+ if ( 1 !== did_action( 'wpmu_new_blog' ) ) {
231
+ return;
232
+ }
233
+
234
+ switch_to_blog( $blog_id );
235
+ self::single_activate();
236
+ restore_current_blog();
237
+
238
+ }
239
+
240
+ /**
241
+ * Get all blog ids of blogs in the current network that are:
242
+ * - not archived
243
+ * - not spam
244
+ * - not deleted
245
+ *
246
+ * @since 1.0.0
247
+ *
248
+ * @return array|false The blog ids, false if no matches.
249
+ */
250
+ private static function get_blog_ids() {
251
+
252
+ global $wpdb;
253
+
254
+ // get an array of blog ids
255
+ $sql = "SELECT blog_id FROM $wpdb->blogs
256
+ WHERE archived = '0' AND spam = '0'
257
+ AND deleted = '0'";
258
+
259
+ return $wpdb->get_col( $sql );
260
+
261
+ }
262
+
263
+ /**
264
+ * Fired for each blog when the plugin is activated.
265
+ *
266
+ * @since 1.0.0
267
+ */
268
+ private static function single_activate() {
269
+ // If there are not popups created let's create a default one
270
+ global $wpdb;
271
+
272
+ $spus = $wpdb->get_results( "SELECT ID FROM $wpdb->posts WHERE post_type='spucpt'");
273
+
274
+
275
+ if ( empty( $spus) ) {
276
+ $post_content ='<h1 style="text-align: center;">Support us!</h1>
277
+ <p style="text-align: center;">If you like this site please help and make click on any of these buttons!</p>
278
+ <p style="text-align: center;">[spu-facebook][spu-google][spu-twitter]</p>';
279
+ $defaults = array(
280
+ 'post_status' => 'draft',
281
+ 'post_type' => 'spucpt',
282
+ 'post_content' => $post_content,
283
+ 'post_title' => 'Popups Example'
284
+ );
285
+ wp_insert_post( $defaults, $wp_error );
286
+ }
287
+ }
288
+
289
+ /**
290
+ * Fired for each blog when the plugin is deactivated.
291
+ *
292
+ * @since 1.0.0
293
+ */
294
+ private static function single_deactivate() {
295
+ // @TODO: Define deactivation functionality here
296
+ }
297
+
298
+ /**
299
+ * Load the plugin text domain for translation.
300
+ *
301
+ * @since 1.0.0
302
+ */
303
+ public function load_plugin_textdomain() {
304
+
305
+ $domain = $this->plugin_slug;
306
+ $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
307
+
308
+ load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' );
309
+ load_plugin_textdomain( $domain, FALSE, basename( plugin_dir_path( dirname( __FILE__ ) ) ) . '/languages/' );
310
+
311
+ }
312
+
313
+
314
+
315
+ /**
316
+ * Register and enqueues public-facing JavaScript files.
317
+ *
318
+ * @since 1.0.0
319
+ */
320
+ public function register_scripts() {
321
+ wp_register_style( 'spu-public-css', plugins_url( 'assets/css/public.css', __FILE__ ), array(), self::VERSION );
322
+ wp_register_script( 'spu-public', plugins_url( 'assets/js/min/public-ck.js', __FILE__ ), array( 'jquery' ), self::VERSION, true );
323
+
324
+ wp_register_script( 'spu-facebook', 'http://connect.facebook.net/'.get_bloginfo('language').'/all.js#xfbml=1', array('jquery'), self::VERSION, FALSE);
325
+ wp_register_script( 'spu-twitter', 'http://platform.twitter.com/widgets.js', array('jquery'), self::VERSION, FALSE);
326
+ wp_register_script( 'spu-google', 'https://apis.google.com/js/plusone.js', array('jquery'), self::VERSION, FALSE);
327
+ }
328
+
329
+ /**
330
+ * load and print SPU popup when rules matches
331
+ *
332
+ * @since 1.0.0
333
+ */
334
+ public function check_for_matches() {
335
+
336
+ global $wpdb;
337
+ global $spu_matches;
338
+ global $total_shortcodes;
339
+
340
+ include_once( SPU_PLUGIN_DIR . 'public/includes/class-spu-rules.php' );
341
+
342
+ $spu_rules = new Spu_Rules();
343
+
344
+ $matches = $facebook = $twitter = $google = false;
345
+
346
+ //Grab all popups ids
347
+ $spu_ids = $wpdb->get_results( "SELECT ID, post_content FROM $wpdb->posts WHERE post_type='spucpt' AND post_status='publish'");
348
+ foreach( $spu_ids as $spu ) {
349
+
350
+ $rules = get_post_meta( $spu->ID, 'spu_rules' ,true );
351
+
352
+ $match = $spu_rules->check_rules( $rules );
353
+ if( $match ) {
354
+ $matches = true;
355
+ $spu_matches[] = $spu->ID;
356
+
357
+ $total_shortcodes[$spu->ID] = 0;
358
+
359
+ //if we have matches we check for shortcodes to add scripts later
360
+ if( has_shortcode( $spu->post_content, 'spu-facebook' ) ){
361
+ $facebook = true;
362
+ $total_shortcodes[$spu->ID]++;
363
+ }
364
+ if( has_shortcode( $spu->post_content, 'spu-twitter' ) ){
365
+ $twitter = true;
366
+ $total_shortcodes[$spu->ID]++;
367
+ }
368
+ if( has_shortcode( $spu->post_content, 'spu-google' ) ){
369
+ $google = true;
370
+ $total_shortcodes[$spu->ID]++;
371
+ }
372
+ }
373
+ }
374
+
375
+ if( $matches ) {
376
+
377
+
378
+ wp_enqueue_script('spu-public');
379
+ wp_enqueue_style('spu-public-css');
380
+ wp_localize_script( 'spu-public', 'spuvar', array( 'is_admin' => current_user_can( 'administrator' ) ) );
381
+
382
+ if( $facebook ){
383
+ wp_enqueue_script( 'spu-facebook' );
384
+ }
385
+ if( $twitter ){
386
+ wp_enqueue_script( 'spu-twitter' );
387
+ }
388
+
389
+ if( $google ){
390
+ wp_enqueue_script( 'spu-google' );
391
+ }
392
+ }
393
+
394
+
395
+ }
396
+
397
+
398
+ /**
399
+ * [facebook_shortcode description]
400
+ * @param {[type]} $content [description]
401
+ * @param {[type]} $atts [description]
402
+ * @return {[type]} [description]
403
+ */
404
+ function facebook_shortcode( $atts, $content ) {
405
+
406
+ extract( shortcode_atts( array(
407
+ 'href' => 'https://www.facebook.com/pages/Timersys/146687622031640',
408
+ 'layout' => 'button_count', // standard, box_count, button_count, button
409
+ 'show_faces' => 'false', // true
410
+ 'share' => 'false', // true
411
+ 'action' => 'like', // recommend
412
+ 'width' => '',
413
+ ), $atts ) );
414
+
415
+
416
+ return '<div class="spu-facebook spu-shortcode"><div class="fb-like" data-width="'.$width.'" data-href="'.$href.'" data-layout="'.$layout.'" data-action="'.$action.'" data-show-faces="'.$show_faces.'" data-share="'.$share.'"></div></div>';
417
+
418
+ }
419
+
420
+ /**
421
+ * [twitter_shortcode description]
422
+ * @param [type] $content [description]
423
+ * @param [type] $atts [description]
424
+ * @return [type] [description]
425
+ */
426
+ function twitter_shortcode( $atts, $content ) {
427
+
428
+ extract( shortcode_atts( array(
429
+ 'user' => 'chifliiiii',
430
+ 'show_count' => 'true', // false
431
+ 'size' => '', // large
432
+ 'lang' => '',
433
+ 'text' => 'Follow @chifliiiii',
434
+ ), $atts ) );
435
+
436
+ return '<div class="spu-twitter spu-shortcode"><a href="https://twitter.com/'.$user.'" class="twitter-follow-button" data-show-count="'.$show_count.'" data-size="'.$size.'"></a></div>';
437
+
438
+ }
439
+
440
+ /**
441
+ * [google_shortcode description]
442
+ * @param [type] $atts [description]
443
+ * @param [type] $content [description]
444
+ * @return [type] [description]
445
+ */
446
+ function google_shortcode( $atts, $content ) {
447
+ extract( shortcode_atts( array(
448
+ 'size' => 'medium', //small standard tall
449
+ 'annotation' => 'bubble', //inline none
450
+ 'url' => 'https://plus.google.com/u/0/103508783120806246698/posts', //inline none
451
+ ), $atts ) );
452
+
453
+ return '<div class="spu-google spu-shortcode"><div class="g-plusone" data-callback="googleCB" data-onendinteraction="closeGoogle" data-recommendations="false" data-annotation="'.$annotation.'" data-size="'.$size.'" data-href="'.$url.'"></div></div>';
454
+
455
+ }
456
+
457
+ /**
458
+ * Returns plugin info
459
+ * @param string $i info name
460
+ * @return mixed one all or none
461
+ */
462
+ function get_info( $i )
463
+ {
464
+ // vars
465
+ $return = false;
466
+
467
+
468
+ // specific
469
+ if( isset($this->info[ $i ]) )
470
+ {
471
+ $return = $this->info[ $i ];
472
+ }
473
+
474
+
475
+ // all
476
+ if( $i == 'all' )
477
+ {
478
+ $return = $this->info;
479
+ }
480
+
481
+
482
+ // return
483
+ return $return;
484
+ }
485
+
486
+ /**
487
+ * Print the actual popup
488
+ * @param int $spu_id post id of the popup
489
+ * @return echo the popup
490
+ */
491
+ function print_boxes( ) {
492
+
493
+ global $spu_matches;
494
+ global $total_shortcodes;
495
+
496
+ //if we dont' have matches stop here
497
+ if( empty( $spu_matches) )
498
+ return;
499
+ // Include Helper class
500
+ include_once( SPU_PLUGIN_DIR . 'includes/class-spu-helper.php' );
501
+
502
+ foreach ($spu_matches as $spu_id ) {
503
+
504
+ ?><!-- Popups v<?php echo self::VERSION; ?> - http://wordpress.org/plugins/social-popup/--><?php
505
+ $box = get_post( $spu_id );
506
+
507
+ // has box with this id been found?
508
+ if ( ! $box instanceof WP_Post || $box->post_status !== 'publish' ) {
509
+ return;
510
+ }
511
+
512
+ $opts = Spu_Helper::get_box_options( $box->ID );
513
+ $css = $opts['css'];
514
+ $content = $box->post_content;
515
+
516
+ // run filters on content
517
+ $content = apply_filters( 'spu/popup/content', $content, $box );
518
+
519
+
520
+ ?>
521
+ <style type="text/css">
522
+ #spu-<?php echo $box->ID; ?> {
523
+ background: <?php echo ( !empty( $css['background_color'] ) ) ? esc_attr($css['background_color']) : 'white'; ?>;
524
+ <?php if ( !empty( $css['color'] ) ) { ?>color: <?php echo esc_attr($css['color']); ?>;<?php } ?>
525
+ <?php if ( !empty( $css['border_color'] ) && !empty( $css['border_width'] ) ) { ?>border: <?php echo esc_attr($css['border_width']) . 'px' ?> solid <?php echo esc_attr($css['border_color']); ?>;<?php } ?>
526
+ max-width: <?php echo ( !empty( $css['width'] ) ) ? esc_attr( $css['width'] ) : 'auto'; ?>;
527
+ }
528
+ #spu-bg-<?php echo $box->ID; ?> {
529
+ opacity: <?php echo ( !empty( $css['bgopacity'] ) ) ? esc_attr($css['bgopacity']) : 0; ?>;
530
+ }
531
+ </style>
532
+ <div class="spu-bg" id="spu-bg-<?php echo $box->ID; ?>"></div>
533
+ <div class="spu-box spu-<?php echo esc_attr( $opts['css']['position'] ); ?> spu-total-<?php echo $total_shortcodes[$box->ID];?>" id="spu-<?php echo $box->ID; ?>"
534
+ data-box-id="<?php echo $box->ID ; ?>" data-trigger="<?php echo esc_attr( $opts['trigger'] ); ?>"
535
+ data-trigger-number="<?php echo esc_attr( absint( $opts['trigger_number'] ) ); ?>"
536
+ data-animation="<?php echo esc_attr($opts['animation']); ?>" data-cookie="<?php echo esc_attr( absint ( $opts['cookie'] ) ); ?>" data-test-mode="<?php echo esc_attr($opts['test_mode']); ?>"
537
+ data-auto-hide="<?php echo esc_attr($opts['auto_hide']); ?>" data-bgopa="<?php echo esc_attr($css['bgopacity']);?>" data-advanced-close="true"
538
+ style="left:-99999px">
539
+ <div class="spu-content"><?php echo $content; ?></div>
540
+ <span class="spu-close">&times;</span>
541
+ </div>
542
+ <?php
543
+
544
+ ?> <!-- / Popups Box -->
545
+ <?php
546
+
547
+ } //endforeach
548
+ echo '<div id="fb-root" class=" fb_reset"></div>';
549
+
550
+ }
551
+
552
+ }
public/includes/Mobile_Detect.php ADDED
@@ -0,0 +1,1248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Mobile Detect Library
4
+ * =====================
5
+ *
6
+ * Motto: "Every business should have a mobile detection script to detect mobile readers"
7
+ *
8
+ * Mobile_Detect is a lightweight PHP class for detecting mobile devices (including tablets).
9
+ * It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.
10
+ *
11
+ * @author Current authors: Serban Ghita <serbanghita@gmail.com>, Nick Ilyin <nick.ilyin@gmail.com>
12
+ * Original author: Victor Stanciu <vic.stanciu@gmail.com>
13
+ *
14
+ * @license Code and contributions have 'MIT License'
15
+ * More details: https://github.com/serbanghita/Mobile-Detect/blob/master/LICENSE.txt
16
+ *
17
+ * @link Homepage: http://mobiledetect.net
18
+ * GitHub Repo: https://github.com/serbanghita/Mobile-Detect
19
+ * Google Code: http://code.google.com/p/php-mobile-detect/
20
+ * README: https://github.com/serbanghita/Mobile-Detect/blob/master/README.md
21
+ * HOWTO: https://github.com/serbanghita/Mobile-Detect/wiki/Code-examples
22
+ *
23
+ * @version 2.8.3
24
+ */
25
+
26
+ class Mobile_Detect
27
+ {
28
+ /**
29
+ * Mobile detection type.
30
+ *
31
+ * @deprecated since version 2.6.9
32
+ */
33
+ const DETECTION_TYPE_MOBILE = 'mobile';
34
+
35
+ /**
36
+ * Extended detection type.
37
+ *
38
+ * @deprecated since version 2.6.9
39
+ */
40
+ const DETECTION_TYPE_EXTENDED = 'extended';
41
+
42
+ /**
43
+ * A frequently used regular expression to extract version #s.
44
+ *
45
+ * @deprecated since version 2.6.9
46
+ */
47
+ const VER = '([\w._\+]+)';
48
+
49
+ /**
50
+ * Top-level device.
51
+ */
52
+ const MOBILE_GRADE_A = 'A';
53
+
54
+ /**
55
+ * Mid-level device.
56
+ */
57
+ const MOBILE_GRADE_B = 'B';
58
+
59
+ /**
60
+ * Low-level device.
61
+ */
62
+ const MOBILE_GRADE_C = 'C';
63
+
64
+ /**
65
+ * Stores the version number of the current release.
66
+ */
67
+ const VERSION = '2.8.3';
68
+
69
+ /**
70
+ * A type for the version() method indicating a string return value.
71
+ */
72
+ const VERSION_TYPE_STRING = 'text';
73
+
74
+ /**
75
+ * A type for the version() method indicating a float return value.
76
+ */
77
+ const VERSION_TYPE_FLOAT = 'float';
78
+
79
+ /**
80
+ * The User-Agent HTTP header is stored in here.
81
+ * @var string
82
+ */
83
+ protected $userAgent = null;
84
+
85
+ /**
86
+ * HTTP headers in the PHP-flavor. So HTTP_USER_AGENT and SERVER_SOFTWARE.
87
+ * @var array
88
+ */
89
+ protected $httpHeaders = array();
90
+
91
+ /**
92
+ * The detection type, using self::DETECTION_TYPE_MOBILE or self::DETECTION_TYPE_EXTENDED.
93
+ *
94
+ * @deprecated since version 2.6.9
95
+ *
96
+ * @var string
97
+ */
98
+ protected $detectionType = self::DETECTION_TYPE_MOBILE;
99
+
100
+ /**
101
+ * HTTP headers that trigger the 'isMobile' detection
102
+ * to be true.
103
+ *
104
+ * @var array
105
+ */
106
+ protected static $mobileHeaders = array(
107
+
108
+ 'HTTP_ACCEPT' => array('matches' => array(
109
+ // Opera Mini; @reference: http://dev.opera.com/articles/view/opera-binary-markup-language/
110
+ 'application/x-obml2d',
111
+ // BlackBerry devices.
112
+ 'application/vnd.rim.html',
113
+ 'text/vnd.wap.wml',
114
+ 'application/vnd.wap.xhtml+xml'
115
+ )),
116
+ 'HTTP_X_WAP_PROFILE' => null,
117
+ 'HTTP_X_WAP_CLIENTID' => null,
118
+ 'HTTP_WAP_CONNECTION' => null,
119
+ 'HTTP_PROFILE' => null,
120
+ // Reported by Opera on Nokia devices (eg. C3).
121
+ 'HTTP_X_OPERAMINI_PHONE_UA' => null,
122
+ 'HTTP_X_NOKIA_GATEWAY_ID' => null,
123
+ 'HTTP_X_ORANGE_ID' => null,
124
+ 'HTTP_X_VODAFONE_3GPDPCONTEXT' => null,
125
+ 'HTTP_X_HUAWEI_USERID' => null,
126
+ // Reported by Windows Smartphones.
127
+ 'HTTP_UA_OS' => null,
128
+ // Reported by Verizon, Vodafone proxy system.
129
+ 'HTTP_X_MOBILE_GATEWAY' => null,
130
+ // Seend this on HTC Sensation. @ref: SensationXE_Beats_Z715e.
131
+ 'HTTP_X_ATT_DEVICEID' => null,
132
+ // Seen this on a HTC.
133
+ 'HTTP_UA_CPU' => array('matches' => array('ARM')),
134
+ );
135
+
136
+ /**
137
+ * List of mobile devices (phones).
138
+ *
139
+ * @var array
140
+ */
141
+ protected static $phoneDevices = array(
142
+ 'iPhone' => '\biPhone.*(Mobile|PhoneGap)|\biPod', // |\biTunes
143
+ 'BlackBerry' => 'BlackBerry|\bBB10\b|rim[0-9]+',
144
+ 'HTC' => 'HTC|HTC.*(Sensation|Evo|Vision|Explorer|6800|8100|8900|A7272|S510e|C110e|Legend|Desire|T8282)|APX515CKT|Qtek9090|APA9292KT|HD_mini|Sensation.*Z710e|PG86100|Z715e|Desire.*(A8181|HD)|ADR6200|ADR6400L|ADR6425|001HT|Inspire 4G|Android.*\bEVO\b|T-Mobile G1|Z520m',
145
+ 'Nexus' => 'Nexus One|Nexus S|Galaxy.*Nexus|Android.*Nexus.*Mobile',
146
+ // @todo: Is 'Dell Streak' a tablet or a phone? ;)
147
+ 'Dell' => 'Dell.*Streak|Dell.*Aero|Dell.*Venue|DELL.*Venue Pro|Dell Flash|Dell Smoke|Dell Mini 3iX|XCD28|XCD35|\b001DL\b|\b101DL\b|\bGS01\b',
148
+ 'Motorola' => 'Motorola|DROIDX|DROID BIONIC|\bDroid\b.*Build|Android.*Xoom|HRI39|MOT-|A1260|A1680|A555|A853|A855|A953|A955|A956|Motorola.*ELECTRIFY|Motorola.*i1|i867|i940|MB200|MB300|MB501|MB502|MB508|MB511|MB520|MB525|MB526|MB611|MB612|MB632|MB810|MB855|MB860|MB861|MB865|MB870|ME501|ME502|ME511|ME525|ME600|ME632|ME722|ME811|ME860|ME863|ME865|MT620|MT710|MT716|MT720|MT810|MT870|MT917|Motorola.*TITANIUM|WX435|WX445|XT300|XT301|XT311|XT316|XT317|XT319|XT320|XT390|XT502|XT530|XT531|XT532|XT535|XT603|XT610|XT611|XT615|XT681|XT701|XT702|XT711|XT720|XT800|XT806|XT860|XT862|XT875|XT882|XT883|XT894|XT901|XT907|XT909|XT910|XT912|XT928|XT926|XT915|XT919|XT925',
149
+ 'Samsung' => 'Samsung|SGH-I337|BGT-S5230|GT-B2100|GT-B2700|GT-B2710|GT-B3210|GT-B3310|GT-B3410|GT-B3730|GT-B3740|GT-B5510|GT-B5512|GT-B5722|GT-B6520|GT-B7300|GT-B7320|GT-B7330|GT-B7350|GT-B7510|GT-B7722|GT-B7800|GT-C3010|GT-C3011|GT-C3060|GT-C3200|GT-C3212|GT-C3212I|GT-C3262|GT-C3222|GT-C3300|GT-C3300K|GT-C3303|GT-C3303K|GT-C3310|GT-C3322|GT-C3330|GT-C3350|GT-C3500|GT-C3510|GT-C3530|GT-C3630|GT-C3780|GT-C5010|GT-C5212|GT-C6620|GT-C6625|GT-C6712|GT-E1050|GT-E1070|GT-E1075|GT-E1080|GT-E1081|GT-E1085|GT-E1087|GT-E1100|GT-E1107|GT-E1110|GT-E1120|GT-E1125|GT-E1130|GT-E1160|GT-E1170|GT-E1175|GT-E1180|GT-E1182|GT-E1200|GT-E1210|GT-E1225|GT-E1230|GT-E1390|GT-E2100|GT-E2120|GT-E2121|GT-E2152|GT-E2220|GT-E2222|GT-E2230|GT-E2232|GT-E2250|GT-E2370|GT-E2550|GT-E2652|GT-E3210|GT-E3213|GT-I5500|GT-I5503|GT-I5700|GT-I5800|GT-I5801|GT-I6410|GT-I6420|GT-I7110|GT-I7410|GT-I7500|GT-I8000|GT-I8150|GT-I8160|GT-I8190|GT-I8320|GT-I8330|GT-I8350|GT-I8530|GT-I8700|GT-I8703|GT-I8910|GT-I9000|GT-I9001|GT-I9003|GT-I9010|GT-I9020|GT-I9023|GT-I9070|GT-I9082|GT-I9100|GT-I9103|GT-I9220|GT-I9250|GT-I9300|GT-I9305|GT-I9500|GT-I9505|GT-M3510|GT-M5650|GT-M7500|GT-M7600|GT-M7603|GT-M8800|GT-M8910|GT-N7000|GT-S3110|GT-S3310|GT-S3350|GT-S3353|GT-S3370|GT-S3650|GT-S3653|GT-S3770|GT-S3850|GT-S5210|GT-S5220|GT-S5229|GT-S5230|GT-S5233|GT-S5250|GT-S5253|GT-S5260|GT-S5263|GT-S5270|GT-S5300|GT-S5330|GT-S5350|GT-S5360|GT-S5363|GT-S5369|GT-S5380|GT-S5380D|GT-S5560|GT-S5570|GT-S5600|GT-S5603|GT-S5610|GT-S5620|GT-S5660|GT-S5670|GT-S5690|GT-S5750|GT-S5780|GT-S5830|GT-S5839|GT-S6102|GT-S6500|GT-S7070|GT-S7200|GT-S7220|GT-S7230|GT-S7233|GT-S7250|GT-S7500|GT-S7530|GT-S7550|GT-S7562|GT-S7710|GT-S8000|GT-S8003|GT-S8500|GT-S8530|GT-S8600|SCH-A310|SCH-A530|SCH-A570|SCH-A610|SCH-A630|SCH-A650|SCH-A790|SCH-A795|SCH-A850|SCH-A870|SCH-A890|SCH-A930|SCH-A950|SCH-A970|SCH-A990|SCH-I100|SCH-I110|SCH-I400|SCH-I405|SCH-I500|SCH-I510|SCH-I515|SCH-I600|SCH-I730|SCH-I760|SCH-I770|SCH-I830|SCH-I910|SCH-I920|SCH-I959|SCH-LC11|SCH-N150|SCH-N300|SCH-R100|SCH-R300|SCH-R351|SCH-R400|SCH-R410|SCH-T300|SCH-U310|SCH-U320|SCH-U350|SCH-U360|SCH-U365|SCH-U370|SCH-U380|SCH-U410|SCH-U430|SCH-U450|SCH-U460|SCH-U470|SCH-U490|SCH-U540|SCH-U550|SCH-U620|SCH-U640|SCH-U650|SCH-U660|SCH-U700|SCH-U740|SCH-U750|SCH-U810|SCH-U820|SCH-U900|SCH-U940|SCH-U960|SCS-26UC|SGH-A107|SGH-A117|SGH-A127|SGH-A137|SGH-A157|SGH-A167|SGH-A177|SGH-A187|SGH-A197|SGH-A227|SGH-A237|SGH-A257|SGH-A437|SGH-A517|SGH-A597|SGH-A637|SGH-A657|SGH-A667|SGH-A687|SGH-A697|SGH-A707|SGH-A717|SGH-A727|SGH-A737|SGH-A747|SGH-A767|SGH-A777|SGH-A797|SGH-A817|SGH-A827|SGH-A837|SGH-A847|SGH-A867|SGH-A877|SGH-A887|SGH-A897|SGH-A927|SGH-B100|SGH-B130|SGH-B200|SGH-B220|SGH-C100|SGH-C110|SGH-C120|SGH-C130|SGH-C140|SGH-C160|SGH-C170|SGH-C180|SGH-C200|SGH-C207|SGH-C210|SGH-C225|SGH-C230|SGH-C417|SGH-C450|SGH-D307|SGH-D347|SGH-D357|SGH-D407|SGH-D415|SGH-D780|SGH-D807|SGH-D980|SGH-E105|SGH-E200|SGH-E315|SGH-E316|SGH-E317|SGH-E335|SGH-E590|SGH-E635|SGH-E715|SGH-E890|SGH-F300|SGH-F480|SGH-I200|SGH-I300|SGH-I320|SGH-I550|SGH-I577|SGH-I600|SGH-I607|SGH-I617|SGH-I627|SGH-I637|SGH-I677|SGH-I700|SGH-I717|SGH-I727|SGH-i747M|SGH-I777|SGH-I780|SGH-I827|SGH-I847|SGH-I857|SGH-I896|SGH-I897|SGH-I900|SGH-I907|SGH-I917|SGH-I927|SGH-I937|SGH-I997|SGH-J150|SGH-J200|SGH-L170|SGH-L700|SGH-M110|SGH-M150|SGH-M200|SGH-N105|SGH-N500|SGH-N600|SGH-N620|SGH-N625|SGH-N700|SGH-N710|SGH-P107|SGH-P207|SGH-P300|SGH-P310|SGH-P520|SGH-P735|SGH-P777|SGH-Q105|SGH-R210|SGH-R220|SGH-R225|SGH-S105|SGH-S307|SGH-T109|SGH-T119|SGH-T139|SGH-T209|SGH-T219|SGH-T229|SGH-T239|SGH-T249|SGH-T259|SGH-T309|SGH-T319|SGH-T329|SGH-T339|SGH-T349|SGH-T359|SGH-T369|SGH-T379|SGH-T409|SGH-T429|SGH-T439|SGH-T459|SGH-T469|SGH-T479|SGH-T499|SGH-T509|SGH-T519|SGH-T539|SGH-T559|SGH-T589|SGH-T609|SGH-T619|SGH-T629|SGH-T639|SGH-T659|SGH-T669|SGH-T679|SGH-T709|SGH-T719|SGH-T729|SGH-T739|SGH-T746|SGH-T749|SGH-T759|SGH-T769|SGH-T809|SGH-T819|SGH-T839|SGH-T919|SGH-T929|SGH-T939|SGH-T959|SGH-T989|SGH-U100|SGH-U200|SGH-U800|SGH-V205|SGH-V206|SGH-X100|SGH-X105|SGH-X120|SGH-X140|SGH-X426|SGH-X427|SGH-X475|SGH-X495|SGH-X497|SGH-X507|SGH-X600|SGH-X610|SGH-X620|SGH-X630|SGH-X700|SGH-X820|SGH-X890|SGH-Z130|SGH-Z150|SGH-Z170|SGH-ZX10|SGH-ZX20|SHW-M110|SPH-A120|SPH-A400|SPH-A420|SPH-A460|SPH-A500|SPH-A560|SPH-A600|SPH-A620|SPH-A660|SPH-A700|SPH-A740|SPH-A760|SPH-A790|SPH-A800|SPH-A820|SPH-A840|SPH-A880|SPH-A900|SPH-A940|SPH-A960|SPH-D600|SPH-D700|SPH-D710|SPH-D720|SPH-I300|SPH-I325|SPH-I330|SPH-I350|SPH-I500|SPH-I600|SPH-I700|SPH-L700|SPH-M100|SPH-M220|SPH-M240|SPH-M300|SPH-M305|SPH-M320|SPH-M330|SPH-M350|SPH-M360|SPH-M370|SPH-M380|SPH-M510|SPH-M540|SPH-M550|SPH-M560|SPH-M570|SPH-M580|SPH-M610|SPH-M620|SPH-M630|SPH-M800|SPH-M810|SPH-M850|SPH-M900|SPH-M910|SPH-M920|SPH-M930|SPH-N100|SPH-N200|SPH-N240|SPH-N300|SPH-N400|SPH-Z400|SWC-E100|SCH-i909|GT-N7100|GT-N7105|SCH-I535|SM-N900A|SGH-I317|SGH-T999L|GT-S5360B|GT-I8262|GT-S6802|GT-S6312|GT-S6310|GT-S5312|GT-S5310|GT-I9105|GT-I8510|GT-S6790N|SM-G7105|SM-N9005|GT-S5301|GT-I9295|GT-I9195|SM-C101|GT-S7392|GT-S7560|GT-B7610|GT-I5510|GT-S7582|GT-S7530E',
150
+ 'LG' => '\bLG\b;|LG[- ]?(C800|C900|E400|E610|E900|E-900|F160|F180K|F180L|F180S|730|855|L160|LS840|LS970|LU6200|MS690|MS695|MS770|MS840|MS870|MS910|P500|P700|P705|VM696|AS680|AS695|AX840|C729|E970|GS505|272|C395|E739BK|E960|L55C|L75C|LS696|LS860|P769BK|P350|P500|P509|P870|UN272|US730|VS840|VS950|LN272|LN510|LS670|LS855|LW690|MN270|MN510|P509|P769|P930|UN200|UN270|UN510|UN610|US670|US740|US760|UX265|UX840|VN271|VN530|VS660|VS700|VS740|VS750|VS910|VS920|VS930|VX9200|VX11000|AX840A|LW770|P506|P925|P999|E612|D955|D802)',
151
+ 'Sony' => 'SonyST|SonyLT|SonyEricsson|SonyEricssonLT15iv|LT18i|E10i|LT28h|LT26w|SonyEricssonMT27i',
152
+ 'Asus' => 'Asus.*Galaxy|PadFone.*Mobile',
153
+ // @ref: http://www.micromaxinfo.com/mobiles/smartphones
154
+ // Added because the codes might conflict with Acer Tablets.
155
+ 'Micromax' => 'Micromax.*\b(A210|A92|A88|A72|A111|A110Q|A115|A116|A110|A90S|A26|A51|A35|A54|A25|A27|A89|A68|A65|A57|A90)\b',
156
+ 'Palm' => 'PalmSource|Palm', // avantgo|blazer|elaine|hiptop|plucker|xiino ; @todo - complete the regex.
157
+ 'Vertu' => 'Vertu|Vertu.*Ltd|Vertu.*Ascent|Vertu.*Ayxta|Vertu.*Constellation(F|Quest)?|Vertu.*Monika|Vertu.*Signature', // Just for fun ;)
158
+ // @ref: http://www.pantech.co.kr/en/prod/prodList.do?gbrand=VEGA (PANTECH)
159
+ // Most of the VEGA devices are legacy. PANTECH seem to be newer devices based on Android.
160
+ 'Pantech' => 'PANTECH|IM-A850S|IM-A840S|IM-A830L|IM-A830K|IM-A830S|IM-A820L|IM-A810K|IM-A810S|IM-A800S|IM-T100K|IM-A725L|IM-A780L|IM-A775C|IM-A770K|IM-A760S|IM-A750K|IM-A740S|IM-A730S|IM-A720L|IM-A710K|IM-A690L|IM-A690S|IM-A650S|IM-A630K|IM-A600S|VEGA PTL21|PT003|P8010|ADR910L|P6030|P6020|P9070|P4100|P9060|P5000|CDM8992|TXT8045|ADR8995|IS11PT|P2030|P6010|P8000|PT002|IS06|CDM8999|P9050|PT001|TXT8040|P2020|P9020|P2000|P7040|P7000|C790',
161
+ // @ref: http://www.fly-phone.com/devices/smartphones/ ; Included only smartphones.
162
+ 'Fly' => 'IQ230|IQ444|IQ450|IQ440|IQ442|IQ441|IQ245|IQ256|IQ236|IQ255|IQ235|IQ245|IQ275|IQ240|IQ285|IQ280|IQ270|IQ260|IQ250',
163
+ 'iMobile' => 'i-mobile (IQ|i-STYLE|idea|ZAA|Hitz)',
164
+ // Added simvalley mobile just for fun. They have some interesting devices.
165
+ // @ref: http://www.simvalley.fr/telephonie---gps-_22_telephonie-mobile_telephones_.html
166
+ 'SimValley' => '\b(SP-80|XT-930|SX-340|XT-930|SX-310|SP-360|SP60|SPT-800|SP-120|SPT-800|SP-140|SPX-5|SPX-8|SP-100|SPX-8|SPX-12)\b',
167
+ // @Tapatalk is a mobile app; @ref: http://support.tapatalk.com/threads/smf-2-0-2-os-and-browser-detection-plugin-and-tapatalk.15565/#post-79039
168
+ 'GenericPhone' => 'Tapatalk|PDA;|SAGEM|\bmmp\b|pocket|\bpsp\b|symbian|Smartphone|smartfon|treo|up.browser|up.link|vodafone|\bwap\b|nokia|Series40|Series60|S60|SonyEricsson|N900|MAUI.*WAP.*Browser'
169
+ );
170
+
171
+ /**
172
+ * List of tablet devices.
173
+ *
174
+ * @var array
175
+ */
176
+ protected static $tabletDevices = array(
177
+ 'iPad' => 'iPad|iPad.*Mobile', // @todo: check for mobile friendly emails topic.
178
+ 'NexusTablet' => 'Android.*Nexus[\s]+(7|10)|^.*Android.*Nexus(?:(?!Mobile).)*$',
179
+ 'SamsungTablet' => 'SAMSUNG.*Tablet|Galaxy.*Tab|SC-01C|GT-P1000|GT-P1003|GT-P1010|GT-P3105|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-P3100|GT-P3108|GT-P3110|GT-P5100|GT-P5110|GT-P6200|GT-P7320|GT-P7511|GT-N8000|GT-P8510|SGH-I497|SPH-P500|SGH-T779|SCH-I705|SCH-I915|GT-N8013|GT-P3113|GT-P5113|GT-P8110|GT-N8010|GT-N8005|GT-N8020|GT-P1013|GT-P6201|GT-P7501|GT-N5100|GT-N5105|GT-N5110|SHV-E140K|SHV-E140L|SHV-E140S|SHV-E150S|SHV-E230K|SHV-E230L|SHV-E230S|SHW-M180K|SHW-M180L|SHW-M180S|SHW-M180W|SHW-M300W|SHW-M305W|SHW-M380K|SHW-M380S|SHW-M380W|SHW-M430W|SHW-M480K|SHW-M480S|SHW-M480W|SHW-M485W|SHW-M486W|SHW-M500W|GT-I9228|SCH-P739|SCH-I925|GT-I9200|GT-I9205|GT-P5200|GT-P5210|GT-P5210X|SM-T311|SM-T310|SM-T310X|SM-T210|SM-T210R|SM-T211|SM-P600|SM-P601|SM-P605|SM-P900|SM-P901|SM-T217|SM-T217A|SM-T217S|SM-P6000|SM-T3100|SGH-I467|XE500|SM-T110|GT-P5220|GT-I9200X|GT-N5110X|GT-N5120|SM-P905|SM-T111|SM-T2105|SM-T315|SM-T320|SM-T320X|SM-T321|SM-T520|SM-T525|SM-T530NU|SM-T230NU|SM-T330NU|SM-T900|XE500T1C|SM-P605V|SM-P905V|SM-P600X|SM-P900X|SM-T210X|SM-T230|SM-T230X|SM-T325|GT-P7503|SM-T531|SM-T330|SM-T530|SM-T705C|SM-T535|SM-T331', // SCH-P709|SCH-P729|SM-T2558 - Samsung Mega - treat them like a regular phone.
180
+ // @reference: http://www.labnol.org/software/kindle-user-agent-string/20378/
181
+ 'Kindle' => 'Kindle|Silk.*Accelerated|Android.*\b(KFOT|KFTT|KFJWI|KFJWA|KFOTE|KFSOWI|KFTHWI|KFTHWA|KFAPWI|KFAPWA|WFJWAE)\b',
182
+ // Only the Surface tablets with Windows RT are considered mobile.
183
+ // @ref: http://msdn.microsoft.com/en-us/library/ie/hh920767(v=vs.85).aspx
184
+ 'SurfaceTablet' => 'Windows NT [0-9.]+; ARM;',
185
+ // @ref: http://shopping1.hp.com/is-bin/INTERSHOP.enfinity/WFS/WW-USSMBPublicStore-Site/en_US/-/USD/ViewStandardCatalog-Browse?CatalogCategoryID=JfIQ7EN5lqMAAAEyDcJUDwMT
186
+ 'HPTablet' => 'HP Slate 7|HP ElitePad 900|hp-tablet|EliteBook.*Touch|HP 8',
187
+ // @note: watch out for PadFone, see #132
188
+ 'AsusTablet' => '^.*PadFone((?!Mobile).)*$|Transformer|TF101|TF101G|TF300T|TF300TG|TF300TL|TF700T|TF700KL|TF701T|TF810C|ME171|ME301T|ME302C|ME371MG|ME370T|ME372MG|ME172V|ME173X|ME400C|Slider SL101|\bK00F\b|TX201LA',
189
+ 'BlackBerryTablet' => 'PlayBook|RIM Tablet',
190
+ 'HTCtablet' => 'HTC Flyer|HTC Jetstream|HTC-P715a|HTC EVO View 4G|PG41200',
191
+ 'MotorolaTablet' => 'xoom|sholest|MZ615|MZ605|MZ505|MZ601|MZ602|MZ603|MZ604|MZ606|MZ607|MZ608|MZ609|MZ615|MZ616|MZ617',
192
+ 'NookTablet' => 'Android.*Nook|NookColor|nook browser|BNRV200|BNRV200A|BNTV250|BNTV250A|BNTV400|BNTV600|LogicPD Zoom2',
193
+ // @ref: http://www.acer.ro/ac/ro/RO/content/drivers
194
+ // @ref: http://www.packardbell.co.uk/pb/en/GB/content/download (Packard Bell is part of Acer)
195
+ // @ref: http://us.acer.com/ac/en/US/content/group/tablets
196
+ // @note: Can conflict with Micromax and Motorola phones codes.
197
+ 'AcerTablet' => 'Android.*; \b(A100|A101|A110|A200|A210|A211|A500|A501|A510|A511|A700|A701|W500|W500P|W501|W501P|W510|W511|W700|G100|G100W|B1-A71|B1-710|B1-711|A1-810|A1-830)\b|W3-810|\bA3-A10\b',
198
+ // @ref: http://eu.computers.toshiba-europe.com/innovation/family/Tablets/1098744/banner_id/tablet_footerlink/
199
+ // @ref: http://us.toshiba.com/tablets/tablet-finder
200
+ // @ref: http://www.toshiba.co.jp/regza/tablet/
201
+ 'ToshibaTablet' => 'Android.*(AT100|AT105|AT200|AT205|AT270|AT275|AT300|AT305|AT1S5|AT500|AT570|AT700|AT830)|TOSHIBA.*FOLIO',
202
+ // @ref: http://www.nttdocomo.co.jp/english/service/developer/smart_phone/technical_info/spec/index.html
203
+ // @ref: http://www.lg.com/us/tablets
204
+ 'LGTablet' => '\bL-06C|LG-V900|LG-V500|LG-V909|LG-V500|LG-V510|LG-VK810\b',
205
+ 'FujitsuTablet' => 'Android.*\b(F-01D|F-02F|F-05E|F-10D|M532|Q572)\b',
206
+ // Prestigio Tablets http://www.prestigio.com/support
207
+ 'PrestigioTablet' => 'PMP3170B|PMP3270B|PMP3470B|PMP7170B|PMP3370B|PMP3570C|PMP5870C|PMP3670B|PMP5570C|PMP5770D|PMP3970B|PMP3870C|PMP5580C|PMP5880D|PMP5780D|PMP5588C|PMP7280C|PMP7280C3G|PMP7280|PMP7880D|PMP5597D|PMP5597|PMP7100D|PER3464|PER3274|PER3574|PER3884|PER5274|PER5474|PMP5097CPRO|PMP5097|PMP7380D|PMP5297C|PMP5297C_QUAD',
208
+ // @ref: http://support.lenovo.com/en_GB/downloads/default.page?#
209
+ 'LenovoTablet' => 'IdeaTab|ThinkPad([ ]+)?Tablet|Lenovo.*(S2109|S2110|S5000|S6000|K3011|A3000|A1000|A2107|A2109|A1107|B6000|B8000|B8080-F)',
210
+ // @ref: http://www.yarvik.com/en/matrix/tablets/
211
+ 'YarvikTablet' => 'Android.*\b(TAB210|TAB211|TAB224|TAB250|TAB260|TAB264|TAB310|TAB360|TAB364|TAB410|TAB411|TAB420|TAB424|TAB450|TAB460|TAB461|TAB464|TAB465|TAB467|TAB468|TAB07-100|TAB07-101|TAB07-150|TAB07-151|TAB07-152|TAB07-200|TAB07-201-3G|TAB07-210|TAB07-211|TAB07-212|TAB07-214|TAB07-220|TAB07-400|TAB07-485|TAB08-150|TAB08-200|TAB08-201-3G|TAB08-201-30|TAB09-100|TAB09-211|TAB09-410|TAB10-150|TAB10-201|TAB10-211|TAB10-400|TAB10-410|TAB13-201|TAB274EUK|TAB275EUK|TAB374EUK|TAB462EUK|TAB474EUK|TAB9-200)\b',
212
+ 'MedionTablet' => 'Android.*\bOYO\b|LIFE.*(P9212|P9514|P9516|S9512)|LIFETAB',
213
+ 'ArnovaTablet' => 'AN10G2|AN7bG3|AN7fG3|AN8G3|AN8cG3|AN7G3|AN9G3|AN7dG3|AN7dG3ST|AN7dG3ChildPad|AN10bG3|AN10bG3DT',
214
+ // http://www.intenso.de/kategorie_en.php?kategorie=33
215
+ // @todo: http://www.nbhkdz.com/read/b8e64202f92a2df129126bff.html - investigate
216
+ 'IntensoTablet' => 'INM8002KP|INM1010FP|INM805ND|Intenso Tab',
217
+ // IRU.ru Tablets http://www.iru.ru/catalog/soho/planetable/
218
+ 'IRUTablet' => 'M702pro',
219
+ 'MegafonTablet' => 'MegaFon V9|\bZTE V9\b|Android.*\bMT7A\b',
220
+ // @ref: http://www.e-boda.ro/tablete-pc.html
221
+ 'EbodaTablet' => 'E-Boda (Supreme|Impresspeed|Izzycomm|Essential)',
222
+ // @ref: http://www.allview.ro/produse/droseries/lista-tablete-pc/
223
+ 'AllViewTablet' => 'Allview.*(Viva|Alldro|City|Speed|All TV|Frenzy|Quasar|Shine|TX1|AX1|AX2)',
224
+ // @reference: http://wiki.archosfans.com/index.php?title=Main_Page
225
+ 'ArchosTablet' => '\b(101G9|80G9|A101IT)\b|Qilive 97R|ARCHOS 101G10|Archos 101 Neon',
226
+ // @ref: http://www.ainol.com/plugin.php?identifier=ainol&module=product
227
+ 'AinolTablet' => 'NOVO7|NOVO8|NOVO10|Novo7Aurora|Novo7Basic|NOVO7PALADIN|novo9-Spark',
228
+ // @todo: inspect http://esupport.sony.com/US/p/select-system.pl?DIRECTOR=DRIVER
229
+ // @ref: Readers http://www.atsuhiro-me.net/ebook/sony-reader/sony-reader-web-browser
230
+ // @ref: http://www.sony.jp/support/tablet/
231
+ 'SonyTablet' => 'Sony.*Tablet|Xperia Tablet|Sony Tablet S|SO-03E|SGPT12|SGPT13|SGPT114|SGPT121|SGPT122|SGPT123|SGPT111|SGPT112|SGPT113|SGPT131|SGPT132|SGPT133|SGPT211|SGPT212|SGPT213|SGP311|SGP312|SGP321|EBRD1101|EBRD1102|EBRD1201|SGP351|SGP341|SGP511|SGP512|SGP521|SGP541|SGP551',
232
+ // @ref: db + http://www.cube-tablet.com/buy-products.html
233
+ 'CubeTablet' => 'Android.*(K8GT|U9GT|U10GT|U16GT|U17GT|U18GT|U19GT|U20GT|U23GT|U30GT)|CUBE U8GT',
234
+ // @ref: http://www.cobyusa.com/?p=pcat&pcat_id=3001
235
+ 'CobyTablet' => 'MID1042|MID1045|MID1125|MID1126|MID7012|MID7014|MID7015|MID7034|MID7035|MID7036|MID7042|MID7048|MID7127|MID8042|MID8048|MID8127|MID9042|MID9740|MID9742|MID7022|MID7010',
236
+ // @ref: http://www.match.net.cn/products.asp
237
+ 'MIDTablet' => 'M9701|M9000|M9100|M806|M1052|M806|T703|MID701|MID713|MID710|MID727|MID760|MID830|MID728|MID933|MID125|MID810|MID732|MID120|MID930|MID800|MID731|MID900|MID100|MID820|MID735|MID980|MID130|MID833|MID737|MID960|MID135|MID860|MID736|MID140|MID930|MID835|MID733',
238
+ // @ref: http://pdadb.net/index.php?m=pdalist&list=SMiT (NoName Chinese Tablets)
239
+ // @ref: http://www.imp3.net/14/show.php?itemid=20454
240
+ 'SMiTTablet' => 'Android.*(\bMID\b|MID-560|MTV-T1200|MTV-PND531|MTV-P1101|MTV-PND530)',
241
+ // @ref: http://www.rock-chips.com/index.php?do=prod&pid=2
242
+ 'RockChipTablet' => 'Android.*(RK2818|RK2808A|RK2918|RK3066)|RK2738|RK2808A',
243
+ // @ref: http://www.fly-phone.com/devices/tablets/ ; http://www.fly-phone.com/service/
244
+ 'FlyTablet' => 'IQ310|Fly Vision',
245
+ // @ref: http://www.bqreaders.com/gb/tablets-prices-sale.html
246
+ 'bqTablet' => 'bq.*(Elcano|Curie|Edison|Maxwell|Kepler|Pascal|Tesla|Hypatia|Platon|Newton|Livingstone|Cervantes|Avant)|Maxwell.*Lite|Maxwell.*Plus',
247
+ // @ref: http://www.huaweidevice.com/worldwide/productFamily.do?method=index&directoryId=5011&treeId=3290
248
+ // @ref: http://www.huaweidevice.com/worldwide/downloadCenter.do?method=index&directoryId=3372&treeId=0&tb=1&type=software (including legacy tablets)
249
+ 'HuaweiTablet' => 'MediaPad|MediaPad 7 Youth|IDEOS S7|S7-201c|S7-202u|S7-101|S7-103|S7-104|S7-105|S7-106|S7-201|S7-Slim',
250
+ // Nec or Medias Tab
251
+ 'NecTablet' => '\bN-06D|\bN-08D',
252
+ // Pantech Tablets: http://www.pantechusa.com/phones/
253
+ 'PantechTablet' => 'Pantech.*P4100',
254
+ // Broncho Tablets: http://www.broncho.cn/ (hard to find)
255
+ 'BronchoTablet' => 'Broncho.*(N701|N708|N802|a710)',
256
+ // @ref: http://versusuk.com/support.html
257
+ 'VersusTablet' => 'TOUCHPAD.*[78910]|\bTOUCHTAB\b',
258
+ // @ref: http://www.zync.in/index.php/our-products/tablet-phablets
259
+ 'ZyncTablet' => 'z1000|Z99 2G|z99|z930|z999|z990|z909|Z919|z900',
260
+ // @ref: http://www.positivoinformatica.com.br/www/pessoal/tablet-ypy/
261
+ 'PositivoTablet' => 'TB07STA|TB10STA|TB07FTA|TB10FTA',
262
+ // @ref: https://www.nabitablet.com/
263
+ 'NabiTablet' => 'Android.*\bNabi',
264
+ 'KoboTablet' => 'Kobo Touch|\bK080\b|\bVox\b Build|\bArc\b Build',
265
+ // French Danew Tablets http://www.danew.com/produits-tablette.php
266
+ 'DanewTablet' => 'DSlide.*\b(700|701R|702|703R|704|802|970|971|972|973|974|1010|1012)\b',
267
+ // Texet Tablets and Readers http://www.texet.ru/tablet/
268
+ 'TexetTablet' => 'NaviPad|TB-772A|TM-7045|TM-7055|TM-9750|TM-7016|TM-7024|TM-7026|TM-7041|TM-7043|TM-7047|TM-8041|TM-9741|TM-9747|TM-9748|TM-9751|TM-7022|TM-7021|TM-7020|TM-7011|TM-7010|TM-7023|TM-7025|TM-7037W|TM-7038W|TM-7027W|TM-9720|TM-9725|TM-9737W|TM-1020|TM-9738W|TM-9740|TM-9743W|TB-807A|TB-771A|TB-727A|TB-725A|TB-719A|TB-823A|TB-805A|TB-723A|TB-715A|TB-707A|TB-705A|TB-709A|TB-711A|TB-890HD|TB-880HD|TB-790HD|TB-780HD|TB-770HD|TB-721HD|TB-710HD|TB-434HD|TB-860HD|TB-840HD|TB-760HD|TB-750HD|TB-740HD|TB-730HD|TB-722HD|TB-720HD|TB-700HD|TB-500HD|TB-470HD|TB-431HD|TB-430HD|TB-506|TB-504|TB-446|TB-436|TB-416|TB-146SE|TB-126SE',
269
+ // @note: Avoid detecting 'PLAYSTATION 3' as mobile.
270
+ 'PlaystationTablet' => 'Playstation.*(Portable|Vita)',
271
+ // @ref: http://www.trekstor.de/surftabs.html
272
+ 'TrekstorTablet' => 'ST10416-1|VT10416-1|ST70408-1|ST702xx-1|ST702xx-2|ST80208|ST97216|ST70104-2|VT10416-2|ST10216-2A',
273
+ // @ref: http://www.pyleaudio.com/Products.aspx?%2fproducts%2fPersonal-Electronics%2fTablets
274
+ 'PyleAudioTablet' => '\b(PTBL10CEU|PTBL10C|PTBL72BC|PTBL72BCEU|PTBL7CEU|PTBL7C|PTBL92BC|PTBL92BCEU|PTBL9CEU|PTBL9CUK|PTBL9C)\b',
275
+ // @ref: http://www.advandigital.com/index.php?link=content-product&jns=JP001
276
+ // @Note: because of the short codenames we have to include whitespaces to reduce the possible conflicts.
277
+ 'AdvanTablet' => 'Android.* \b(E3A|T3X|T5C|T5B|T3E|T3C|T3B|T1J|T1F|T2A|T1H|T1i|E1C|T1-E|T5-A|T4|E1-B|T2Ci|T1-B|T1-D|O1-A|E1-A|T1-A|T3A|T4i)\b ',
278
+ // @ref: http://www.danytech.com/category/tablet-pc
279
+ 'DanyTechTablet' => 'Genius Tab G3|Genius Tab S2|Genius Tab Q3|Genius Tab G4|Genius Tab Q4|Genius Tab G-II|Genius TAB GII|Genius TAB GIII|Genius Tab S1',
280
+ // @ref: http://www.galapad.net/product.html
281
+ 'GalapadTablet' => 'Android.*\bG1\b',
282
+ // @ref: http://www.micromaxinfo.com/tablet/funbook
283
+ 'MicromaxTablet' => 'Funbook|Micromax.*\b(P250|P560|P360|P362|P600|P300|P350|P500|P275)\b',
284
+ // http://www.karbonnmobiles.com/products_tablet.php
285
+ 'KarbonnTablet' => 'Android.*\b(A39|A37|A34|ST8|ST10|ST7|Smart Tab3|Smart Tab2)\b',
286
+ // @ref: http://www.myallfine.com/Products.asp
287
+ 'AllFineTablet' => 'Fine7 Genius|Fine7 Shine|Fine7 Air|Fine8 Style|Fine9 More|Fine10 Joy|Fine11 Wide',
288
+ // @ref: http://www.proscanvideo.com/products-search.asp?itemClass=TABLET&itemnmbr=
289
+ 'PROSCANTablet' => '\b(PEM63|PLT1023G|PLT1041|PLT1044|PLT1044G|PLT1091|PLT4311|PLT4311PL|PLT4315|PLT7030|PLT7033|PLT7033D|PLT7035|PLT7035D|PLT7044K|PLT7045K|PLT7045KB|PLT7071KG|PLT7072|PLT7223G|PLT7225G|PLT7777G|PLT7810K|PLT7849G|PLT7851G|PLT7852G|PLT8015|PLT8031|PLT8034|PLT8036|PLT8080K|PLT8082|PLT8088|PLT8223G|PLT8234G|PLT8235G|PLT8816K|PLT9011|PLT9045K|PLT9233G|PLT9735|PLT9760G|PLT9770G)\b',
290
+ // @ref: http://www.yonesnav.com/products/products.php
291
+ 'YONESTablet' => 'BQ1078|BC1003|BC1077|RK9702|BC9730|BC9001|IT9001|BC7008|BC7010|BC708|BC728|BC7012|BC7030|BC7027|BC7026',
292
+ // @ref: http://www.cjshowroom.com/eproducts.aspx?classcode=004001001
293
+ // China manufacturer makes tablets for different small brands (eg. http://www.zeepad.net/index.html)
294
+ 'ChangJiaTablet' => 'TPC7102|TPC7103|TPC7105|TPC7106|TPC7107|TPC7201|TPC7203|TPC7205|TPC7210|TPC7708|TPC7709|TPC7712|TPC7110|TPC8101|TPC8103|TPC8105|TPC8106|TPC8203|TPC8205|TPC8503|TPC9106|TPC9701|TPC97101|TPC97103|TPC97105|TPC97106|TPC97111|TPC97113|TPC97203|TPC97603|TPC97809|TPC97205|TPC10101|TPC10103|TPC10106|TPC10111|TPC10203|TPC10205|TPC10503',
295
+ // @ref: http://www.gloryunion.cn/products.asp
296
+ // @ref: http://www.allwinnertech.com/en/apply/mobile.html
297
+ // @ref: http://www.ptcl.com.pk/pd_content.php?pd_id=284 (EVOTAB)
298
+ // @todo: Softwiner tablets?
299
+ // aka. Cute or Cool tablets. Not sure yet, must research to avoid collisions.
300
+ 'GUTablet' => 'TX-A1301|TX-M9002|Q702|kf026', // A12R|D75A|D77|D79|R83|A95|A106C|R15|A75|A76|D71|D72|R71|R73|R77|D82|R85|D92|A97|D92|R91|A10F|A77F|W71F|A78F|W78F|W81F|A97F|W91F|W97F|R16G|C72|C73E|K72|K73|R96G
301
+ // @ref: http://www.pointofview-online.com/showroom.php?shop_mode=product_listing&category_id=118
302
+ 'PointOfViewTablet' => 'TAB-P506|TAB-navi-7-3G-M|TAB-P517|TAB-P-527|TAB-P701|TAB-P703|TAB-P721|TAB-P731N|TAB-P741|TAB-P825|TAB-P905|TAB-P925|TAB-PR945|TAB-PL1015|TAB-P1025|TAB-PI1045|TAB-P1325|TAB-PROTAB[0-9]+|TAB-PROTAB25|TAB-PROTAB26|TAB-PROTAB27|TAB-PROTAB26XL|TAB-PROTAB2-IPS9|TAB-PROTAB30-IPS9|TAB-PROTAB25XXL|TAB-PROTAB26-IPS10|TAB-PROTAB30-IPS10',
303
+ // @ref: http://www.overmax.pl/pl/katalog-produktow,p8/tablety,c14/
304
+ // @todo: add more tests.
305
+ 'OvermaxTablet' => 'OV-(SteelCore|NewBase|Basecore|Baseone|Exellen|Quattor|EduTab|Solution|ACTION|BasicTab|TeddyTab|MagicTab|Stream|TB-08|TB-09)',
306
+ // @ref: http://hclmetablet.com/India/index.php
307
+ 'HCLTablet' => 'HCL.*Tablet|Connect-3G-2.0|Connect-2G-2.0|ME Tablet U1|ME Tablet U2|ME Tablet G1|ME Tablet X1|ME Tablet Y2|ME Tablet Sync',
308
+ // @ref: http://www.edigital.hu/Tablet_es_e-book_olvaso/Tablet-c18385.html
309
+ 'DPSTablet' => 'DPS Dream 9|DPS Dual 7',
310
+ // @ref: http://www.visture.com/index.asp
311
+ 'VistureTablet' => 'V97 HD|i75 3G|Visture V4( HD)?|Visture V5( HD)?|Visture V10',
312
+ // @ref: http://www.mijncresta.nl/tablet
313
+ 'CrestaTablet' => 'CTP(-)?810|CTP(-)?818|CTP(-)?828|CTP(-)?838|CTP(-)?888|CTP(-)?978|CTP(-)?980|CTP(-)?987|CTP(-)?988|CTP(-)?989',
314
+ // MediaTek - http://www.mediatek.com/_en/01_products/02_proSys.php?cata_sn=1&cata1_sn=1&cata2_sn=309
315
+ 'MediatekTablet' => '\bMT8125|MT8389|MT8135|MT8377\b',
316
+ // Concorde tab
317
+ 'ConcordeTablet' => 'Concorde([ ]+)?Tab|ConCorde ReadMan',
318
+ // GoClever Tablets - http://www.goclever.com/uk/products,c1/tablet,c5/
319
+ 'GoCleverTablet' => 'GOCLEVER TAB|A7GOCLEVER|M1042|M7841|M742|R1042BK|R1041|TAB A975|TAB A7842|TAB A741|TAB A741L|TAB M723G|TAB M721|TAB A1021|TAB I921|TAB R721|TAB I720|TAB T76|TAB R70|TAB R76.2|TAB R106|TAB R83.2|TAB M813G|TAB I721|GCTA722|TAB I70|TAB I71|TAB S73|TAB R73|TAB R74|TAB R93|TAB R75|TAB R76.1|TAB A73|TAB A93|TAB A93.2|TAB T72|TAB R83|TAB R974|TAB R973|TAB A101|TAB A103|TAB A104|TAB A104.2|R105BK|M713G|A972BK|TAB A971|TAB R974.2|TAB R104|TAB R83.3|TAB A1042',
320
+ // Modecom Tablets - http://www.modecom.eu/tablets/portal/
321
+ 'ModecomTablet' => 'FreeTAB 9000|FreeTAB 7.4|FreeTAB 7004|FreeTAB 7800|FreeTAB 2096|FreeTAB 7.5|FreeTAB 1014|FreeTAB 1001 |FreeTAB 8001|FreeTAB 9706|FreeTAB 9702|FreeTAB 7003|FreeTAB 7002|FreeTAB 1002|FreeTAB 7801|FreeTAB 1331|FreeTAB 1004|FreeTAB 8002|FreeTAB 8014|FreeTAB 9704|FreeTAB 1003',
322
+ // Vonino Tablets - http://www.vonino.eu/tablets
323
+ 'VoninoTablet' => '\b(Argus[ _]?S|Diamond[ _]?79HD|Emerald[ _]?78E|Luna[ _]?70C|Onyx[ _]?S|Onyx[ _]?Z|Orin[ _]?HD|Orin[ _]?S|Otis[ _]?S|SpeedStar[ _]?S|Magnet[ _]?M9|Primus[ _]?94[ _]?3G|Primus[ _]?94HD|Primus[ _]?QS|Android.*\bQ8\b|Sirius[ _]?EVO[ _]?QS|Sirius[ _]?QS|Spirit[ _]?S)\b',
324
+ // ECS Tablets - http://www.ecs.com.tw/ECSWebSite/Product/Product_Tablet_List.aspx?CategoryID=14&MenuID=107&childid=M_107&LanID=0
325
+ 'ECSTablet' => 'V07OT2|TM105A|S10OT1|TR10CS1',
326
+ // Storex Tablets - http://storex.fr/espace_client/support.html
327
+ // @note: no need to add all the tablet codes since they are guided by the first regex.
328
+ 'StorexTablet' => 'eZee[_\']?(Tab|Go)[0-9]+|TabLC7|Looney Tunes Tab',
329
+ // Generic Vodafone tablets.
330
+ 'VodafoneTablet' => 'SmartTab([ ]+)?[0-9]+|SmartTabII10',
331
+ // French tablets - Essentiel B http://www.boulanger.fr/tablette_tactile_e-book/tablette_tactile_essentiel_b/cl_68908.htm?multiChoiceToDelete=brand&mc_brand=essentielb
332
+ // Aka: http://www.essentielb.fr/
333
+ 'EssentielBTablet' => 'Smart[ \']?TAB[ ]+?[0-9]+|Family[ \']?TAB2',
334
+ // Ross & Moor - http://ross-moor.ru/
335
+ 'RossMoorTablet' => 'RM-790|RM-997|RMD-878G|RMD-974R|RMT-705A|RMT-701|RME-601|RMT-501|RMT-711',
336
+ // i-mobile http://product.i-mobilephone.com/Mobile_Device
337
+ 'iMobileTablet' => 'i-mobile i-note',
338
+ // @ref: http://www.tolino.de/de/vergleichen/
339
+ 'TolinoTablet' => 'tolino tab [0-9.]+|tolino shine',
340
+ // AudioSonic - a Kmart brand
341
+ // http://www.kmart.com.au/webapp/wcs/stores/servlet/Search?langId=-1&storeId=10701&catalogId=10001&categoryId=193001&pageSize=72&currentPage=1&searchCategory=193001%2b4294965664&sortBy=p_MaxPrice%7c1
342
+ 'AudioSonicTablet' => '\bC-22Q|T7-QC|T-17B|T-17P\b',
343
+ // AMPE Tablets - http://www.ampe.com.my/product-category/tablets/
344
+ // @todo: add them gradually to avoid conflicts.
345
+ 'AMPETablet' => 'Android.* A78 ',
346
+ // Skk Mobile - http://skkmobile.com.ph/product_tablets.php
347
+ 'SkkTablet' => 'Android.* (SKYPAD|PHOENIX|CYCLOPS)',
348
+ // Tecno Mobile (only tablet) - http://www.tecno-mobile.com/index.php/product?filterby=smart&list_order=all&page=1
349
+ 'TecnoTablet' => 'TECNO P9',
350
+ // JXD (consoles & tablets) - http://jxd.hk/products.asp?selectclassid=009008&clsid=3
351
+ 'JXDTablet' => 'Android.*\b(F3000|A3300|JXD5000|JXD3000|JXD2000|JXD300B|JXD300|S5800|S7800|S602b|S5110b|S7300|S5300|S602|S603|S5100|S5110|S601|S7100a|P3000F|P3000s|P101|P200s|P1000m|P200m|P9100|P1000s|S6600b|S908|P1000|P300|S18|S6600|S9100)\b',
352
+ // i-Joy tablets - http://www.i-joy.es/en/cat/products/tablets/
353
+ 'iJoyTablet' => 'Tablet (Spirit 7|Essentia|Galatea|Fusion|Onix 7|Landa|Titan|Scooby|Deox|Stella|Themis|Argon|Unique 7|Sygnus|Hexen|Finity 7|Cream|Cream X2|Jade|Neon 7|Neron 7|Kandy|Scape|Saphyr 7|Rebel|Biox|Rebel|Rebel 8GB|Myst|Draco 7|Myst|Tab7-004|Myst|Tadeo Jones|Tablet Boing|Arrow|Draco Dual Cam|Aurix|Mint|Amity|Revolution|Finity 9|Neon 9|T9w|Amity 4GB Dual Cam|Stone 4GB|Stone 8GB|Andromeda|Silken|X2|Andromeda II|Halley|Flame|Saphyr 9,7|Touch 8|Planet|Triton|Unique 10|Hexen 10|Memphis 4GB|Memphis 8GB|Onix 10)',
354
+ // http://www.intracon.eu/tablet
355
+ 'FX2Tablet' => 'FX2 PAD7|FX2 PAD10',
356
+ // http://www.xoro.de/produkte/
357
+ // @note: Might be the same brand with 'Simply tablets'
358
+ 'XoroTablet' => 'KidsPAD 701|PAD[ ]?712|PAD[ ]?714|PAD[ ]?716|PAD[ ]?717|PAD[ ]?718|PAD[ ]?720|PAD[ ]?721|PAD[ ]?722|PAD[ ]?790|PAD[ ]?792|PAD[ ]?900|PAD[ ]?9715D|PAD[ ]?9716DR|PAD[ ]?9718DR|PAD[ ]?9719QR|PAD[ ]?9720QR|TelePAD1030|Telepad1032|TelePAD730|TelePAD731|TelePAD732|TelePAD735Q|TelePAD830|TelePAD9730|TelePAD795|MegaPAD 1331|MegaPAD 1851|MegaPAD 2151',
359
+ // http://www1.viewsonic.com/products/computing/tablets/
360
+ 'ViewsonicTablet' => 'ViewPad 10pi|ViewPad 10e|ViewPad 10s|ViewPad E72|ViewPad7|ViewPad E100|ViewPad 7e|ViewSonic VB733|VB100a',
361
+ // http://www.odys.de/web/internet-tablet_en.html
362
+ 'OdysTablet' => 'LOOX|XENO10|ODYS Space',
363
+ // http://www.captiva-power.de/products.html#tablets-en
364
+ 'CaptivaTablet' => 'CAPTIVA PAD',
365
+ // IconBIT - http://www.iconbit.com/products/tablets/
366
+ 'IconbitTablet' => 'NetTAB|NT-3702|NT-3702S|NT-3702S|NT-3603P|NT-3603P|NT-0704S|NT-0704S|NT-3805C|NT-3805C|NT-0806C|NT-0806C|NT-0909T|NT-0909T|NT-0907S|NT-0907S|NT-0902S|NT-0902S',
367
+ // @ref: http://www.tesco.com/direct/hudl/
368
+ 'Hudl' => 'Hudl HT7S3',
369
+ // @ref: http://www.telstra.com.au/home-phone/thub-2/
370
+ 'TelstraTablet' => 'T-Hub2',
371
+ 'GenericTablet' => 'Android.*\b97D\b|Tablet(?!.*PC)|BNTV250A|MID-WCDMA|LogicPD Zoom2|\bA7EB\b|CatNova8|A1_07|CT704|CT1002|\bM721\b|rk30sdk|\bEVOTAB\b|M758A|ET904|ALUMIUM10|Smartfren Tab|Endeavour 1010|Tablet-PC-4',
372
+ );
373
+
374
+ /**
375
+ * List of mobile Operating Systems.
376
+ *
377
+ * @var array
378
+ */
379
+ protected static $operatingSystems = array(
380
+ 'AndroidOS' => 'Android',
381
+ 'BlackBerryOS' => 'blackberry|\bBB10\b|rim tablet os',
382
+ 'PalmOS' => 'PalmOS|avantgo|blazer|elaine|hiptop|palm|plucker|xiino',
383
+ 'SymbianOS' => 'Symbian|SymbOS|Series60|Series40|SYB-[0-9]+|\bS60\b',
384
+ // @reference: http://en.wikipedia.org/wiki/Windows_Mobile
385
+ 'WindowsMobileOS' => 'Windows CE.*(PPC|Smartphone|Mobile|[0-9]{3}x[0-9]{3})|Window Mobile|Windows Phone [0-9.]+|WCE;',
386
+ // @reference: http://en.wikipedia.org/wiki/Windows_Phone
387
+ // http://wifeng.cn/?r=blog&a=view&id=106
388
+ // http://nicksnettravels.builttoroam.com/post/2011/01/10/Bogus-Windows-Phone-7-User-Agent-String.aspx
389
+ 'WindowsPhoneOS' => 'Windows Phone 8.0|Windows Phone OS|XBLWP7|ZuneWP7',
390
+ 'iOS' => '\biPhone.*Mobile|\biPod|\biPad',
391
+ // http://en.wikipedia.org/wiki/MeeGo
392
+ // @todo: research MeeGo in UAs
393
+ 'MeeGoOS' => 'MeeGo',
394
+ // http://en.wikipedia.org/wiki/Maemo
395
+ // @todo: research Maemo in UAs
396
+ 'MaemoOS' => 'Maemo',
397
+ 'JavaOS' => 'J2ME/|\bMIDP\b|\bCLDC\b', // '|Java/' produces bug #135
398
+ 'webOS' => 'webOS|hpwOS',
399
+ 'badaOS' => '\bBada\b',
400
+ 'BREWOS' => 'BREW',
401
+ );
402
+
403
+ /**
404
+ * List of mobile User Agents.
405
+ *
406
+ * @var array
407
+ */
408
+ protected static $browsers = array(
409
+ // @reference: https://developers.google.com/chrome/mobile/docs/user-agent
410
+ 'Chrome' => '\bCrMo\b|CriOS|Android.*Chrome/[.0-9]* (Mobile)?',
411
+ 'Dolfin' => '\bDolfin\b',
412
+ 'Opera' => 'Opera.*Mini|Opera.*Mobi|Android.*Opera|Mobile.*OPR/[0-9.]+|Coast/[0-9.]+',
413
+ 'Skyfire' => 'Skyfire',
414
+ 'IE' => 'IEMobile|MSIEMobile', // |Trident/[.0-9]+
415
+ 'Firefox' => 'fennec|firefox.*maemo|(Mobile|Tablet).*Firefox|Firefox.*Mobile',
416
+ 'Bolt' => 'bolt',
417
+ 'TeaShark' => 'teashark',
418
+ 'Blazer' => 'Blazer',
419
+ // @reference: http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/OptimizingforSafarioniPhone/OptimizingforSafarioniPhone.html#//apple_ref/doc/uid/TP40006517-SW3
420
+ 'Safari' => 'Version.*Mobile.*Safari|Safari.*Mobile',
421
+ // @ref: http://en.wikipedia.org/wiki/Midori_(web_browser)
422
+ //'Midori' => 'midori',
423
+ 'Tizen' => 'Tizen',
424
+ 'UCBrowser' => 'UC.*Browser|UCWEB',
425
+ // @ref: https://github.com/serbanghita/Mobile-Detect/issues/7
426
+ 'DiigoBrowser' => 'DiigoBrowser',
427
+ // http://www.puffinbrowser.com/index.php
428
+ 'Puffin' => 'Puffin',
429
+ // @ref: http://mercury-browser.com/index.html
430
+ 'Mercury' => '\bMercury\b',
431
+ // @reference: http://en.wikipedia.org/wiki/Minimo
432
+ // http://en.wikipedia.org/wiki/Vision_Mobile_Browser
433
+ 'GenericBrowser' => 'NokiaBrowser|OviBrowser|OneBrowser|TwonkyBeamBrowser|SEMC.*Browser|FlyFlow|Minimo|NetFront|Novarra-Vision|MQQBrowser|MicroMessenger'
434
+ );
435
+
436
+ /**
437
+ * Utilities.
438
+ *
439
+ * @var array
440
+ */
441
+ protected static $utilities = array(
442
+ // Experimental. When a mobile device wants to switch to 'Desktop Mode'.
443
+ // @ref: http://scottcate.com/technology/windows-phone-8-ie10-desktop-or-mobile/
444
+ // @ref: https://github.com/serbanghita/Mobile-Detect/issues/57#issuecomment-15024011
445
+ 'DesktopMode' => 'WPDesktop',
446
+ 'TV' => 'SonyDTV|HbbTV', // experimental
447
+ 'WebKit' => '(webkit)[ /]([\w.]+)',
448
+ 'Bot' => 'Googlebot|DoCoMo|YandexBot|bingbot|ia_archiver|AhrefsBot|Ezooms|GSLFbot|WBSearchBot|Twitterbot|TweetmemeBot|Twikle|PaperLiBot|Wotbox|UnwindFetchor|facebookexternalhit',
449
+ 'MobileBot' => 'Googlebot-Mobile|DoCoMo|YahooSeeker/M1A1-R2D2',
450
+ // @todo: Include JXD consoles.
451
+ 'Console' => '\b(Nintendo|Nintendo WiiU|PLAYSTATION|Xbox)\b',
452
+ 'Watch' => 'SM-V700',
453
+ );
454
+
455
+ /**
456
+ * All possible HTTP headers that represent the
457
+ * User-Agent string.
458
+ *
459
+ * @var array
460
+ */
461
+ protected static $uaHttpHeaders = array(
462
+ // The default User-Agent string.
463
+ 'HTTP_USER_AGENT',
464
+ // Header can occur on devices using Opera Mini.
465
+ 'HTTP_X_OPERAMINI_PHONE_UA',
466
+ // Vodafone specific header: http://www.seoprinciple.com/mobile-web-community-still-angry-at-vodafone/24/
467
+ 'HTTP_X_DEVICE_USER_AGENT',
468
+ 'HTTP_X_ORIGINAL_USER_AGENT',
469
+ 'HTTP_X_SKYFIRE_PHONE',
470
+ 'HTTP_X_BOLT_PHONE_UA',
471
+ 'HTTP_DEVICE_STOCK_UA',
472
+ 'HTTP_X_UCBROWSER_DEVICE_UA'
473
+ );
474
+
475
+ /**
476
+ * The individual segments that could exist in a User-Agent string. VER refers to the regular
477
+ * expression defined in the constant self::VER.
478
+ *
479
+ * @var array
480
+ */
481
+ protected static $properties = array(
482
+
483
+ // Build
484
+ 'Mobile' => 'Mobile/[VER]',
485
+ 'Build' => 'Build/[VER]',
486
+ 'Version' => 'Version/[VER]',
487
+ 'VendorID' => 'VendorID/[VER]',
488
+
489
+ // Devices
490
+ 'iPad' => 'iPad.*CPU[a-z ]+[VER]',
491
+ 'iPhone' => 'iPhone.*CPU[a-z ]+[VER]',
492
+ 'iPod' => 'iPod.*CPU[a-z ]+[VER]',
493
+ //'BlackBerry' => array('BlackBerry[VER]', 'BlackBerry [VER];'),
494
+ 'Kindle' => 'Kindle/[VER]',
495
+
496
+ // Browser
497
+ 'Chrome' => array('Chrome/[VER]', 'CriOS/[VER]', 'CrMo/[VER]'),
498
+ 'Coast' => array('Coast/[VER]'),
499
+ 'Dolfin' => 'Dolfin/[VER]',
500
+ // @reference: https://developer.mozilla.org/en-US/docs/User_Agent_Strings_Reference
501
+ 'Firefox' => 'Firefox/[VER]',
502
+ 'Fennec' => 'Fennec/[VER]',
503
+ // @reference: http://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx
504
+ 'IE' => array('IEMobile/[VER];', 'IEMobile [VER]', 'MSIE [VER];'),
505
+ // http://en.wikipedia.org/wiki/NetFront
506
+ 'NetFront' => 'NetFront/[VER]',
507
+ 'NokiaBrowser' => 'NokiaBrowser/[VER]',
508
+ 'Opera' => array( ' OPR/[VER]', 'Opera Mini/[VER]', 'Version/[VER]' ),
509
+ 'Opera Mini' => 'Opera Mini/[VER]',
510
+ 'Opera Mobi' => 'Version/[VER]',
511
+ 'UC Browser' => 'UC Browser[VER]',
512
+ 'MQQBrowser' => 'MQQBrowser/[VER]',
513
+ 'MicroMessenger' => 'MicroMessenger/[VER]',
514
+ // @note: Safari 7534.48.3 is actually Version 5.1.
515
+ // @note: On BlackBerry the Version is overwriten by the OS.
516
+ 'Safari' => array( 'Version/[VER]', 'Safari/[VER]' ),
517
+ 'Skyfire' => 'Skyfire/[VER]',
518
+ 'Tizen' => 'Tizen/[VER]',
519
+ 'Webkit' => 'webkit[ /][VER]',
520
+
521
+ // Engine
522
+ 'Gecko' => 'Gecko/[VER]',
523
+ 'Trident' => 'Trident/[VER]',
524
+ 'Presto' => 'Presto/[VER]',
525
+
526
+ // OS
527
+ 'iOS' => ' \bOS\b [VER] ',
528
+ 'Android' => 'Android [VER]',
529
+ 'BlackBerry' => array('BlackBerry[\w]+/[VER]', 'BlackBerry.*Version/[VER]', 'Version/[VER]'),
530
+ 'BREW' => 'BREW [VER]',
531
+ 'Java' => 'Java/[VER]',
532
+ // @reference: http://windowsteamblog.com/windows_phone/b/wpdev/archive/2011/08/29/introducing-the-ie9-on-windows-phone-mango-user-agent-string.aspx
533
+ // @reference: http://en.wikipedia.org/wiki/Windows_NT#Releases
534
+ 'Windows Phone OS' => array( 'Windows Phone OS [VER]', 'Windows Phone [VER]'),
535
+ 'Windows Phone' => 'Windows Phone [VER]',
536
+ 'Windows CE' => 'Windows CE/[VER]',
537
+ // http://social.msdn.microsoft.com/Forums/en-US/windowsdeveloperpreviewgeneral/thread/6be392da-4d2f-41b4-8354-8dcee20c85cd
538
+ 'Windows NT' => 'Windows NT [VER]',
539
+ 'Symbian' => array('SymbianOS/[VER]', 'Symbian/[VER]'),
540
+ 'webOS' => array('webOS/[VER]', 'hpwOS/[VER];'),
541
+ );
542
+
543
+ /**
544
+ * Construct an instance of this class.
545
+ *
546
+ * @param array $headers Specify the headers as injection. Should be PHP _SERVER flavored.
547
+ * If left empty, will use the global _SERVER['HTTP_*'] vars instead.
548
+ * @param string $userAgent Inject the User-Agent header. If null, will use HTTP_USER_AGENT
549
+ * from the $headers array instead.
550
+ */
551
+ public function __construct(
552
+ array $headers = null,
553
+ $userAgent = null
554
+ ){
555
+ $this->setHttpHeaders($headers);
556
+ $this->setUserAgent($userAgent);
557
+ }
558
+
559
+ /**
560
+ * Get the current script version.
561
+ * This is useful for the demo.php file,
562
+ * so people can check on what version they are testing
563
+ * for mobile devices.
564
+ *
565
+ * @return string The version number in semantic version format.
566
+ */
567
+ public static function getScriptVersion()
568
+ {
569
+ return self::VERSION;
570
+ }
571
+
572
+ /**
573
+ * Set the HTTP Headers. Must be PHP-flavored. This method will reset existing headers.
574
+ *
575
+ * @param array $httpHeaders The headers to set. If null, then using PHP's _SERVER to extract
576
+ * the headers. The default null is left for backwards compatibilty.
577
+ */
578
+ public function setHttpHeaders($httpHeaders = null)
579
+ {
580
+ //use global _SERVER if $httpHeaders aren't defined
581
+ if (!is_array($httpHeaders) || !count($httpHeaders)) {
582
+ $httpHeaders = $_SERVER;
583
+ }
584
+
585
+ //clear existing headers
586
+ $this->httpHeaders = array();
587
+
588
+ //Only save HTTP headers. In PHP land, that means only _SERVER vars that
589
+ //start with HTTP_.
590
+ foreach ($httpHeaders as $key => $value) {
591
+ if (substr($key,0,5) == 'HTTP_') {
592
+ $this->httpHeaders[$key] = $value;
593
+ }
594
+ }
595
+ }
596
+
597
+ /**
598
+ * Retrieves the HTTP headers.
599
+ *
600
+ * @return array
601
+ */
602
+ public function getHttpHeaders()
603
+ {
604
+ return $this->httpHeaders;
605
+ }
606
+
607
+ /**
608
+ * Retrieves a particular header. If it doesn't exist, no exception/error is caused.
609
+ * Simply null is returned.
610
+ *
611
+ * @param string $header The name of the header to retrieve. Can be HTTP compliant such as
612
+ * "User-Agent" or "X-Device-User-Agent" or can be php-esque with the
613
+ * all-caps, HTTP_ prefixed, underscore seperated awesomeness.
614
+ *
615
+ * @return string|null The value of the header.
616
+ */
617
+ public function getHttpHeader($header)
618
+ {
619
+ //are we using PHP-flavored headers?
620
+ if (strpos($header, '_') === false) {
621
+ $header = str_replace('-', '_', $header);
622
+ $header = strtoupper($header);
623
+ }
624
+
625
+ //test the alternate, too
626
+ $altHeader = 'HTTP_' . $header;
627
+
628
+ //Test both the regular and the HTTP_ prefix
629
+ if (isset($this->httpHeaders[$header])) {
630
+ return $this->httpHeaders[$header];
631
+ } elseif (isset($this->httpHeaders[$altHeader])) {
632
+ return $this->httpHeaders[$altHeader];
633
+ }
634
+
635
+ return null;
636
+ }
637
+
638
+ public function getMobileHeaders()
639
+ {
640
+ return self::$mobileHeaders;
641
+ }
642
+
643
+ /**
644
+ * Get all possible HTTP headers that
645
+ * can contain the User-Agent string.
646
+ *
647
+ * @return array List of HTTP headers.
648
+ */
649
+ public function getUaHttpHeaders()
650
+ {
651
+ return self::$uaHttpHeaders;
652
+ }
653
+
654
+ /**
655
+ * Set the User-Agent to be used.
656
+ *
657
+ * @param string $userAgent The user agent string to set.
658
+ *
659
+ * @return string|null
660
+ */
661
+ public function setUserAgent($userAgent = null)
662
+ {
663
+ if (!empty($userAgent)) {
664
+ return $this->userAgent = $userAgent;
665
+ } else {
666
+
667
+ $this->userAgent = null;
668
+
669
+ foreach($this->getUaHttpHeaders() as $altHeader){
670
+ if(!empty($this->httpHeaders[$altHeader])){ // @todo: should use getHttpHeader(), but it would be slow. (Serban)
671
+ $this->userAgent .= $this->httpHeaders[$altHeader] . " ";
672
+ }
673
+ }
674
+
675
+ return $this->userAgent = (!empty($this->userAgent) ? trim($this->userAgent) : null);
676
+
677
+ }
678
+ }
679
+
680
+ /**
681
+ * Retrieve the User-Agent.
682
+ *
683
+ * @return string|null The user agent if it's set.
684
+ */
685
+ public function getUserAgent()
686
+ {
687
+ return $this->userAgent;
688
+ }
689
+
690
+ /**
691
+ * Set the detection type. Must be one of self::DETECTION_TYPE_MOBILE or
692
+ * self::DETECTION_TYPE_EXTENDED. Otherwise, nothing is set.
693
+ *
694
+ * @deprecated since version 2.6.9
695
+ *
696
+ * @param string $type The type. Must be a self::DETECTION_TYPE_* constant. The default
697
+ * parameter is null which will default to self::DETECTION_TYPE_MOBILE.
698
+ */
699
+ public function setDetectionType($type = null)
700
+ {
701
+ if ($type === null) {
702
+ $type = self::DETECTION_TYPE_MOBILE;
703
+ }
704
+
705
+ if ($type != self::DETECTION_TYPE_MOBILE && $type != self::DETECTION_TYPE_EXTENDED) {
706
+ return;
707
+ }
708
+
709
+ $this->detectionType = $type;
710
+ }
711
+
712
+ /**
713
+ * Retrieve the list of known phone devices.
714
+ *
715
+ * @return array List of phone devices.
716
+ */
717
+ public static function getPhoneDevices()
718
+ {
719
+ return self::$phoneDevices;
720
+ }
721
+
722
+ /**
723
+ * Retrieve the list of known tablet devices.
724
+ *
725
+ * @return array List of tablet devices.
726
+ */
727
+ public static function getTabletDevices()
728
+ {
729
+ return self::$tabletDevices;
730
+ }
731
+
732
+ /**
733
+ * Alias for getBrowsers() method.
734
+ *
735
+ * @return array List of user agents.
736
+ */
737
+ public static function getUserAgents()
738
+ {
739
+ return self::getBrowsers();
740
+ }
741
+
742
+ /**
743
+ * Retrieve the list of known browsers. Specifically, the user agents.
744
+ *
745
+ * @return array List of browsers / user agents.
746
+ */
747
+ public static function getBrowsers()
748
+ {
749
+ return self::$browsers;
750
+ }
751
+
752
+ /**
753
+ * Retrieve the list of known utilities.
754
+ *
755
+ * @return array List of utilities.
756
+ */
757
+ public static function getUtilities()
758
+ {
759
+ return self::$utilities;
760
+ }
761
+
762
+ /**
763
+ * Method gets the mobile detection rules. This method is used for the magic methods $detect->is*().
764
+ *
765
+ * @deprecated since version 2.6.9
766
+ *
767
+ * @return array All the rules (but not extended).
768
+ */
769
+ public static function getMobileDetectionRules()
770
+ {
771
+ static $rules;
772
+
773
+ if (!$rules) {
774
+ $rules = array_merge(
775
+ self::$phoneDevices,
776
+ self::$tabletDevices,
777
+ self::$operatingSystems,
778
+ self::$browsers
779
+ );
780
+ }
781
+
782
+ return $rules;
783
+
784
+ }
785
+
786
+ /**
787
+ * Method gets the mobile detection rules + utilities.
788
+ * The reason this is separate is because utilities rules
789
+ * don't necessary imply mobile. This method is used inside
790
+ * the new $detect->is('stuff') method.
791
+ *
792
+ * @deprecated since version 2.6.9
793
+ *
794
+ * @return array All the rules + extended.
795
+ */
796
+ public function getMobileDetectionRulesExtended()
797
+ {
798
+ static $rules;
799
+
800
+ if (!$rules) {
801
+ // Merge all rules together.
802
+ $rules = array_merge(
803
+ self::$phoneDevices,
804
+ self::$tabletDevices,
805
+ self::$operatingSystems,
806
+ self::$browsers,
807
+ self::$utilities
808
+ );
809
+ }
810
+
811
+ return $rules;
812
+ }
813
+
814
+ /**
815
+ * Retrieve the current set of rules.
816
+ *
817
+ * @deprecated since version 2.6.9
818
+ *
819
+ * @return array
820
+ */
821
+ public function getRules()
822
+ {
823
+ if ($this->detectionType == self::DETECTION_TYPE_EXTENDED) {
824
+ return self::getMobileDetectionRulesExtended();
825
+ } else {
826
+ return self::getMobileDetectionRules();
827
+ }
828
+ }
829
+
830
+ /**
831
+ * Retrieve the list of mobile operating systems.
832
+ *
833
+ * @return array The list of mobile operating systems.
834
+ */
835
+ public static function getOperatingSystems()
836
+ {
837
+ return self::$operatingSystems;
838
+ }
839
+
840
+ /**
841
+ * Check the HTTP headers for signs of mobile.
842
+ * This is the fastest mobile check possible; it's used
843
+ * inside isMobile() method.
844
+ *
845
+ * @return bool
846
+ */
847
+ public function checkHttpHeadersForMobile()
848
+ {
849
+
850
+ foreach($this->getMobileHeaders() as $mobileHeader => $matchType){
851
+ if( isset($this->httpHeaders[$mobileHeader]) ){
852
+ if( is_array($matchType['matches']) ){
853
+ foreach($matchType['matches'] as $_match){
854
+ if( strpos($this->httpHeaders[$mobileHeader], $_match) !== false ){
855
+ return true;
856
+ }
857
+ }
858
+ return false;
859
+ } else {
860
+ return true;
861
+ }
862
+ }
863
+ }
864
+
865
+ return false;
866
+
867
+ }
868
+
869
+ /**
870
+ * Magic overloading method.
871
+ *
872
+ * @method boolean is[...]()
873
+ * @param string $name
874
+ * @param array $arguments
875
+ * @return mixed
876
+ * @throws BadMethodCallException when the method doesn't exist and doesn't start with 'is'
877
+ */
878
+ public function __call($name, $arguments)
879
+ {
880
+ //make sure the name starts with 'is', otherwise
881
+ if (substr($name, 0, 2) != 'is') {
882
+ throw new BadMethodCallException("No such method exists: $name");
883
+ }
884
+
885
+ $this->setDetectionType(self::DETECTION_TYPE_MOBILE);
886
+
887
+ $key = substr($name, 2);
888
+
889
+ return $this->matchUAAgainstKey($key);
890
+ }
891
+
892
+ /**
893
+ * Find a detection rule that matches the current User-agent.
894
+ *
895
+ * @param null $userAgent deprecated
896
+ * @return boolean
897
+ */
898
+ protected function matchDetectionRulesAgainstUA($userAgent = null)
899
+ {
900
+ // Begin general search.
901
+ foreach ($this->getRules() as $_regex) {
902
+ if (empty($_regex)) {
903
+ continue;
904
+ }
905
+ if ($this->match($_regex, $userAgent)) {
906
+ return true;
907
+ }
908
+ }
909
+
910
+ return false;
911
+ }
912
+
913
+ /**
914
+ * Search for a certain key in the rules array.
915
+ * If the key is found the try to match the corresponding
916
+ * regex agains the User-Agent.
917
+ *
918
+ * @param string $key
919
+ * @param null $userAgent deprecated
920
+ * @return mixed
921
+ */
922
+ protected function matchUAAgainstKey($key, $userAgent = null)
923
+ {
924
+ // Make the keys lowercase so we can match: isIphone(), isiPhone(), isiphone(), etc.
925
+ $key = strtolower($key);
926
+
927
+ //change the keys to lower case
928
+ $_rules = array_change_key_case($this->getRules());
929
+
930
+ if (array_key_exists($key, $_rules)) {
931
+ if (empty($_rules[$key])) {
932
+ return null;
933
+ }
934
+
935
+ return $this->match($_rules[$key], $userAgent);
936
+ }
937
+
938
+ return false;
939
+ }
940
+
941
+ /**
942
+ * Check if the device is mobile.
943
+ * Returns true if any type of mobile device detected, including special ones
944
+ * @param null $userAgent deprecated
945
+ * @param null $httpHeaders deprecated
946
+ * @return bool
947
+ */
948
+ public function isMobile($userAgent = null, $httpHeaders = null)
949
+ {
950
+
951
+ if ($httpHeaders) {
952
+ $this->setHttpHeaders($httpHeaders);
953
+ }
954
+
955
+ if ($userAgent) {
956
+ $this->setUserAgent($userAgent);
957
+ }
958
+
959
+ $this->setDetectionType(self::DETECTION_TYPE_MOBILE);
960
+
961
+ if ($this->checkHttpHeadersForMobile()) {
962
+ return true;
963
+ } else {
964
+ return $this->matchDetectionRulesAgainstUA();
965
+ }
966
+
967
+ }
968
+
969
+ /**
970
+ * Check if the device is a tablet.
971
+ * Return true if any type of tablet device is detected.
972
+ *
973
+ * @param string $userAgent deprecated
974
+ * @param array $httpHeaders deprecated
975
+ * @return bool
976
+ */
977
+ public function isTablet($userAgent = null, $httpHeaders = null)
978
+ {
979
+ $this->setDetectionType(self::DETECTION_TYPE_MOBILE);
980
+
981
+ foreach (self::$tabletDevices as $_regex) {
982
+ if ($this->match($_regex, $userAgent)) {
983
+ return true;
984
+ }
985
+ }
986
+
987
+ return false;
988
+ }
989
+
990
+ /**
991
+ * This method checks for a certain property in the
992
+ * userAgent.
993
+ * @todo: The httpHeaders part is not yet used.
994
+ *
995
+ * @param string $key
996
+ * @param string $userAgent deprecated
997
+ * @param string $httpHeaders deprecated
998
+ * @return bool|int|null
999
+ */
1000
+ public function is($key, $userAgent = null, $httpHeaders = null)
1001
+ {
1002
+ // Set the UA and HTTP headers only if needed (eg. batch mode).
1003
+ if ($httpHeaders) {
1004
+ $this->setHttpHeaders($httpHeaders);
1005
+ }
1006
+
1007
+ if ($userAgent) {
1008
+ $this->setUserAgent($userAgent);
1009
+ }
1010
+
1011
+ $this->setDetectionType(self::DETECTION_TYPE_EXTENDED);
1012
+
1013
+ return $this->matchUAAgainstKey($key);
1014
+ }
1015
+
1016
+ /**
1017
+ * Some detection rules are relative (not standard),
1018
+ * because of the diversity of devices, vendors and
1019
+ * their conventions in representing the User-Agent or
1020
+ * the HTTP headers.
1021
+ *
1022
+ * This method will be used to check custom regexes against
1023
+ * the User-Agent string.
1024
+ *
1025
+ * @param $regex
1026
+ * @param string $userAgent
1027
+ * @return bool
1028
+ *
1029
+ * @todo: search in the HTTP headers too.
1030
+ */
1031
+ public function match($regex, $userAgent = null)
1032
+ {
1033
+ // Escape the special character which is the delimiter.
1034
+ $regex = str_replace('/', '\/', $regex);
1035
+
1036
+ return (bool) preg_match('/'.$regex.'/is', (!empty($userAgent) ? $userAgent : $this->userAgent));
1037
+ }
1038
+
1039
+ /**
1040
+ * Get the properties array.
1041
+ *
1042
+ * @return array
1043
+ */
1044
+ public static function getProperties()
1045
+ {
1046
+ return self::$properties;
1047
+ }
1048
+
1049
+ /**
1050
+ * Prepare the version number.
1051
+ *
1052
+ * @todo Remove the error supression from str_replace() call.
1053
+ *
1054
+ * @param string $ver The string version, like "2.6.21.2152";
1055
+ *
1056
+ * @return float
1057
+ */
1058
+ public function prepareVersionNo($ver)
1059
+ {
1060
+ $ver = str_replace(array('_', ' ', '/'), '.', $ver);
1061
+ $arrVer = explode('.', $ver, 2);
1062
+
1063
+ if (isset($arrVer[1])) {
1064
+ $arrVer[1] = @str_replace('.', '', $arrVer[1]); // @todo: treat strings versions.
1065
+ }
1066
+
1067
+ return (float) implode('.', $arrVer);
1068
+ }
1069
+
1070
+ /**
1071
+ * Check the version of the given property in the User-Agent.
1072
+ * Will return a float number. (eg. 2_0 will return 2.0, 4.3.1 will return 4.31)
1073
+ *
1074
+ * @param string $propertyName The name of the property. See self::getProperties() array
1075
+ * keys for all possible properties.
1076
+ * @param string $type Either self::VERSION_TYPE_STRING to get a string value or
1077
+ * self::VERSION_TYPE_FLOAT indicating a float value. This parameter
1078
+ * is optional and defaults to self::VERSION_TYPE_STRING. Passing an
1079
+ * invalid parameter will default to the this type as well.
1080
+ *
1081
+ * @return string|float The version of the property we are trying to extract.
1082
+ */
1083
+ public function version($propertyName, $type = self::VERSION_TYPE_STRING)
1084
+ {
1085
+ if (empty($propertyName)) {
1086
+ return false;
1087
+ }
1088
+
1089
+ //set the $type to the default if we don't recognize the type
1090
+ if ($type != self::VERSION_TYPE_STRING && $type != self::VERSION_TYPE_FLOAT) {
1091
+ $type = self::VERSION_TYPE_STRING;
1092
+ }
1093
+
1094
+ $properties = self::getProperties();
1095
+
1096
+ // Check if the property exists in the properties array.
1097
+ if (array_key_exists($propertyName, $properties)) {
1098
+
1099
+ // Prepare the pattern to be matched.
1100
+ // Make sure we always deal with an array (string is converted).
1101
+ $properties[$propertyName] = (array) $properties[$propertyName];
1102
+
1103
+ foreach ($properties[$propertyName] as $propertyMatchString) {
1104
+
1105
+ $propertyPattern = str_replace('[VER]', self::VER, $propertyMatchString);
1106
+
1107
+ // Escape the special character which is the delimiter.
1108
+ $propertyPattern = str_replace('/', '\/', $propertyPattern);
1109
+
1110
+ // Identify and extract the version.
1111
+ preg_match('/'.$propertyPattern.'/is', $this->userAgent, $match);
1112
+
1113
+ if (!empty($match[1])) {
1114
+ $version = ( $type == self::VERSION_TYPE_FLOAT ? $this->prepareVersionNo($match[1]) : $match[1] );
1115
+
1116
+ return $version;
1117
+ }
1118
+
1119
+ }
1120
+
1121
+ }
1122
+
1123
+ return false;
1124
+ }
1125
+
1126
+ /**
1127
+ * Retrieve the mobile grading, using self::MOBILE_GRADE_* constants.
1128
+ *
1129
+ * @return string One of the self::MOBILE_GRADE_* constants.
1130
+ */
1131
+ public function mobileGrade()
1132
+ {
1133
+ $isMobile = $this->isMobile();
1134
+
1135
+ if (
1136
+ // Apple iOS 3.2-5.1 - Tested on the original iPad (4.3 / 5.0), iPad 2 (4.3), iPad 3 (5.1), original iPhone (3.1), iPhone 3 (3.2), 3GS (4.3), 4 (4.3 / 5.0), and 4S (5.1)
1137
+ $this->isIOS() && $this->version('iPad', self::VERSION_TYPE_FLOAT)>=4.3 ||
1138
+ $this->isIOS() && $this->version('iPhone', self::VERSION_TYPE_FLOAT)>=3.1 ||
1139
+ $this->isIOS() && $this->version('iPod', self::VERSION_TYPE_FLOAT)>=3.1 ||
1140
+
1141
+ // Android 2.1-2.3 - Tested on the HTC Incredible (2.2), original Droid (2.2), HTC Aria (2.1), Google Nexus S (2.3). Functional on 1.5 & 1.6 but performance may be sluggish, tested on Google G1 (1.5)
1142
+ // Android 3.1 (Honeycomb) - Tested on the Samsung Galaxy Tab 10.1 and Motorola XOOM
1143
+ // Android 4.0 (ICS) - Tested on a Galaxy Nexus. Note: transition performance can be poor on upgraded devices
1144
+ // Android 4.1 (Jelly Bean) - Tested on a Galaxy Nexus and Galaxy 7
1145
+ ( $this->version('Android', self::VERSION_TYPE_FLOAT)>2.1 && $this->is('Webkit') ) ||
1146
+
1147
+ // Windows Phone 7-7.5 - Tested on the HTC Surround (7.0) HTC Trophy (7.5), LG-E900 (7.5), Nokia Lumia 800
1148
+ $this->version('Windows Phone OS', self::VERSION_TYPE_FLOAT)>=7.0 ||
1149
+
1150
+ // Blackberry 7 - Tested on BlackBerry Torch 9810
1151
+ // Blackberry 6.0 - Tested on the Torch 9800 and Style 9670
1152
+ $this->is('BlackBerry') && $this->version('BlackBerry', self::VERSION_TYPE_FLOAT)>=6.0 ||
1153
+ // Blackberry Playbook (1.0-2.0) - Tested on PlayBook
1154
+ $this->match('Playbook.*Tablet') ||
1155
+
1156
+ // Palm WebOS (1.4-2.0) - Tested on the Palm Pixi (1.4), Pre (1.4), Pre 2 (2.0)
1157
+ ( $this->version('webOS', self::VERSION_TYPE_FLOAT)>=1.4 && $this->match('Palm|Pre|Pixi') ) ||
1158
+ // Palm WebOS 3.0 - Tested on HP TouchPad
1159
+ $this->match('hp.*TouchPad') ||
1160
+
1161
+ // Firefox Mobile (12 Beta) - Tested on Android 2.3 device
1162
+ ( $this->is('Firefox') && $this->version('Firefox', self::VERSION_TYPE_FLOAT)>=12 ) ||
1163
+
1164
+ // Chrome for Android - Tested on Android 4.0, 4.1 device
1165
+ ( $this->is('Chrome') && $this->is('AndroidOS') && $this->version('Android', self::VERSION_TYPE_FLOAT)>=4.0 ) ||
1166
+
1167
+ // Skyfire 4.1 - Tested on Android 2.3 device
1168
+ ( $this->is('Skyfire') && $this->version('Skyfire', self::VERSION_TYPE_FLOAT)>=4.1 && $this->is('AndroidOS') && $this->version('Android', self::VERSION_TYPE_FLOAT)>=2.3 ) ||
1169
+
1170
+ // Opera Mobile 11.5-12: Tested on Android 2.3
1171
+ ( $this->is('Opera') && $this->version('Opera Mobi', self::VERSION_TYPE_FLOAT)>11 && $this->is('AndroidOS') ) ||
1172
+
1173
+ // Meego 1.2 - Tested on Nokia 950 and N9
1174
+ $this->is('MeeGoOS') ||
1175
+
1176
+ // Tizen (pre-release) - Tested on early hardware
1177
+ $this->is('Tizen') ||
1178
+
1179
+ // Samsung Bada 2.0 - Tested on a Samsung Wave 3, Dolphin browser
1180
+ // @todo: more tests here!
1181
+ $this->is('Dolfin') && $this->version('Bada', self::VERSION_TYPE_FLOAT)>=2.0 ||
1182
+
1183
+ // UC Browser - Tested on Android 2.3 device
1184
+ ( ($this->is('UC Browser') || $this->is('Dolfin')) && $this->version('Android', self::VERSION_TYPE_FLOAT)>=2.3 ) ||
1185
+
1186
+ // Kindle 3 and Fire - Tested on the built-in WebKit browser for each
1187
+ ( $this->match('Kindle Fire') ||
1188
+ $this->is('Kindle') && $this->version('Kindle', self::VERSION_TYPE_FLOAT)>=3.0 ) ||
1189
+
1190
+ // Nook Color 1.4.1 - Tested on original Nook Color, not Nook Tablet
1191
+ $this->is('AndroidOS') && $this->is('NookTablet') ||
1192
+
1193
+ // Chrome Desktop 11-21 - Tested on OS X 10.7 and Windows 7
1194
+ $this->version('Chrome', self::VERSION_TYPE_FLOAT)>=11 && !$isMobile ||
1195
+
1196
+ // Safari Desktop 4-5 - Tested on OS X 10.7 and Windows 7
1197
+ $this->version('Safari', self::VERSION_TYPE_FLOAT)>=5.0 && !$isMobile ||
1198
+
1199
+ // Firefox Desktop 4-13 - Tested on OS X 10.7 and Windows 7
1200
+ $this->version('Firefox', self::VERSION_TYPE_FLOAT)>=4.0 && !$isMobile ||
1201
+
1202
+ // Internet Explorer 7-9 - Tested on Windows XP, Vista and 7
1203
+ $this->version('MSIE', self::VERSION_TYPE_FLOAT)>=7.0 && !$isMobile ||
1204
+
1205
+ // Opera Desktop 10-12 - Tested on OS X 10.7 and Windows 7
1206
+ // @reference: http://my.opera.com/community/openweb/idopera/
1207
+ $this->version('Opera', self::VERSION_TYPE_FLOAT)>=10 && !$isMobile
1208
+
1209
+ ){
1210
+ return self::MOBILE_GRADE_A;
1211
+ }
1212
+
1213
+ if (
1214
+ $this->isIOS() && $this->version('iPad', self::VERSION_TYPE_FLOAT)<4.3 ||
1215
+ $this->isIOS() && $this->version('iPhone', self::VERSION_TYPE_FLOAT)<3.1 ||
1216
+ $this->isIOS() && $this->version('iPod', self::VERSION_TYPE_FLOAT)<3.1 ||
1217
+
1218
+ // Blackberry 5.0: Tested on the Storm 2 9550, Bold 9770
1219
+ $this->is('Blackberry') && $this->version('BlackBerry', self::VERSION_TYPE_FLOAT)>=5 && $this->version('BlackBerry', self::VERSION_TYPE_FLOAT)<6 ||
1220
+
1221
+ //Opera Mini (5.0-6.5) - Tested on iOS 3.2/4.3 and Android 2.3
1222
+ ( $this->version('Opera Mini', self::VERSION_TYPE_FLOAT)>=5.0 && $this->version('Opera Mini', self::VERSION_TYPE_FLOAT)<=6.5 &&
1223
+ ($this->version('Android', self::VERSION_TYPE_FLOAT)>=2.3 || $this->is('iOS')) ) ||
1224
+
1225
+ // Nokia Symbian^3 - Tested on Nokia N8 (Symbian^3), C7 (Symbian^3), also works on N97 (Symbian^1)
1226
+ $this->match('NokiaN8|NokiaC7|N97.*Series60|Symbian/3') ||
1227
+
1228
+ // @todo: report this (tested on Nokia N71)
1229
+ $this->version('Opera Mobi', self::VERSION_TYPE_FLOAT)>=11 && $this->is('SymbianOS')
1230
+ ){
1231
+ return self::MOBILE_GRADE_B;
1232
+ }
1233
+
1234
+ if (
1235
+ // Blackberry 4.x - Tested on the Curve 8330
1236
+ $this->version('BlackBerry', self::VERSION_TYPE_FLOAT)<5.0 ||
1237
+ // Windows Mobile - Tested on the HTC Leo (WinMo 5.2)
1238
+ $this->match('MSIEMobile|Windows CE.*Mobile') || $this->version('Windows Mobile', self::VERSION_TYPE_FLOAT)<=5.2
1239
+
1240
+ ){
1241
+ return self::MOBILE_GRADE_C;
1242
+ }
1243
+
1244
+ //All older smartphone platforms and featurephones - Any device that doesn't support media queries
1245
+ //will receive the basic, C grade experience.
1246
+ return self::MOBILE_GRADE_C;
1247
+ }
1248
+ }
public/includes/class-spu-rules.php ADDED
@@ -0,0 +1,799 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Spu Rules
5
+ * Class that will compare rules and determine if popup needs to show
6
+ * @since: 2.0
7
+ */
8
+
9
+ class Spu_Rules
10
+ {
11
+
12
+ /*
13
+ * __construct
14
+ * Add all the filters to use later
15
+ */
16
+
17
+ function __construct()
18
+ {
19
+
20
+
21
+ // User
22
+ add_filter('spu/rules/rule_match/user_type', array($this, 'rule_match_user_type'), 10, 2);
23
+ add_filter('spu/rules/rule_match/logged_user', array($this, 'rule_match_logged_user'), 10, 2);
24
+ add_filter('spu/rules/rule_match/left_comment', array($this, 'rule_match_left_comment'), 10, 2);
25
+ add_filter('spu/rules/rule_match/search_engine', array($this, 'rule_match_search_engine'), 10, 2);
26
+ add_filter('spu/rules/rule_match/same_site', array($this, 'rule_match_same_site'), 10, 2);
27
+
28
+ // Post
29
+ add_filter('spu/rules/rule_match/post_type', array($this, 'rule_match_post_type'), 10, 2);
30
+ add_filter('spu/rules/rule_match/post', array($this, 'rule_match_post'), 10, 2);
31
+ add_filter('spu/rules/rule_match/post_category', array($this, 'rule_match_post_category'), 10, 2);
32
+ add_filter('spu/rules/rule_match/post_format', array($this, 'rule_match_post_format'), 10, 2);
33
+ add_filter('spu/rules/rule_match/post_status', array($this, 'rule_match_post_status'), 10, 2);
34
+ add_filter('spu/rules/rule_match/taxonomy', array($this, 'rule_match_taxonomy'), 10, 2);
35
+
36
+ // Page
37
+ add_filter('spu/rules/rule_match/page', array($this, 'rule_match_post'), 10, 2);
38
+ add_filter('spu/rules/rule_match/page_type', array($this, 'rule_match_page_type'), 10, 2);
39
+ add_filter('spu/rules/rule_match/page_parent', array($this, 'rule_match_page_parent'), 10, 2);
40
+ add_filter('spu/rules/rule_match/page_template', array($this, 'rule_match_page_template'), 10, 2);
41
+
42
+ //Other
43
+ add_filter('spu/rules/rule_match/mobiles', array($this, 'rule_match_mobiles'), 10, 2);
44
+ add_filter('spu/rules/rule_match/tablets', array($this, 'rule_match_tablets'), 10, 2);
45
+
46
+
47
+ }
48
+
49
+
50
+ /*
51
+ * check_rules
52
+ *
53
+ * @since 1.0.0
54
+ */
55
+
56
+ function check_rules( $rules = '' )
57
+ {
58
+
59
+ // Parse values
60
+ #$options = apply_filters( 'spu/parse_types' );
61
+
62
+
63
+ // find all acf objects
64
+ #$acfs = apply_filters('spu/get_field_groups', array());
65
+
66
+ //if no rules, add the box
67
+ $add_box = true;
68
+
69
+ if( !empty( $rules ) ) {
70
+ // vars
71
+ $add_box = false;
72
+
73
+
74
+ foreach( $rules as $group_id => $group ) {
75
+ // start of as true, this way, any rule that doesn't match will cause this varaible to false
76
+ $match_group = true;
77
+
78
+ if( is_array($group) )
79
+ {
80
+
81
+ foreach( $group as $rule_id => $rule )
82
+ {
83
+
84
+ // $match = true / false
85
+ $match = apply_filters( 'spu/rules/rule_match/' . $rule['param'] , false, $rule );
86
+
87
+ if( !$match )
88
+ {
89
+ $match_group = false;
90
+ }
91
+
92
+ }
93
+ }
94
+
95
+
96
+ // all rules must havematched!
97
+ if( $match_group )
98
+ {
99
+ $add_box = true;
100
+ }
101
+
102
+ }
103
+
104
+
105
+ }
106
+
107
+
108
+ return $add_box;
109
+ }
110
+
111
+ /**
112
+ * [rule_match_logged_user description]
113
+ * @param bool $match false default
114
+ * @param array $rule rule to compare
115
+ * @return boolean true if match
116
+ */
117
+ function rule_match_logged_user( $match, $rule ) {
118
+
119
+ if ( $rule['operator'] == "==" ) {
120
+
121
+ return is_user_logged_in();
122
+
123
+ } else {
124
+
125
+ return !is_user_logged_in();
126
+
127
+ }
128
+
129
+ }
130
+
131
+ /**
132
+ * [rule_match_mobiles description]
133
+ * @param bool $match false default
134
+ * @param array $rule rule to compare
135
+ * @return boolean true if match
136
+ */
137
+ function rule_match_mobiles( $match, $rule ) {
138
+
139
+ require_once 'Mobile_Detect.php';
140
+ $detect = new Mobile_Detect;
141
+
142
+ if ( $rule['operator'] == "==" ) {
143
+
144
+ return $detect->isMobile();
145
+
146
+ } else {
147
+
148
+ return !$detect->isMobile();
149
+
150
+ }
151
+
152
+ }
153
+ /**
154
+ * [rule_match_tablets description]
155
+ * @param bool $match false default
156
+ * @param array $rule rule to compare
157
+ * @return boolean true if match
158
+ */
159
+ function rule_match_tablets( $match, $rule ) {
160
+
161
+ require_once 'Mobile_Detect.php';
162
+ $detect = new Mobile_Detect;
163
+
164
+ if ( $rule['operator'] == "==" ) {
165
+
166
+ return $detect->isTablet();
167
+
168
+ } else {
169
+
170
+ return !$detect->isTablet();
171
+
172
+ }
173
+
174
+ }
175
+
176
+ /**
177
+ * [rule_match_left_comment description]
178
+ * @param bool $match false default
179
+ * @param array $rule rule to compare
180
+ * @return boolean true if match
181
+ */
182
+ function rule_match_left_comment( $match, $rule ) {
183
+
184
+ if ( $rule['operator'] == "==" ) {
185
+
186
+ return !empty( $_COOKIE['comment_author_'.COOKIEHASH] );
187
+
188
+ } else {
189
+
190
+ return empty( $_COOKIE['comment_author_'.COOKIEHASH] );
191
+
192
+ }
193
+
194
+ }
195
+ /**
196
+ * [rule_match_search_engine description]
197
+ * @param bool $match false default
198
+ * @param array $rule rule to compare
199
+ * @return boolean true if match
200
+ */
201
+ function rule_match_search_engine( $match, $rule ) {
202
+
203
+ $ref = isset($_SERVER['HTTP_REFERRER']) ? $_SERVER['HTTP_REFERRER'] : '';
204
+
205
+ $SE = apply_filters( 'spu/rules/search_engines', array('/search?', '.google.', 'web.info.com', 'search.', 'del.icio.us/search', 'soso.com', '/search/', '.yahoo.', '.bing.' ) );
206
+
207
+ foreach ($SE as $url) {
208
+ if ( strpos( $ref,$url ) !==false ){
209
+
210
+ return $rule['operator'] == "==" ? true : false;
211
+ }
212
+ }
213
+
214
+ return $rule['operator'] == "==" ? false : true;
215
+
216
+ }
217
+
218
+ /**
219
+ * [rule_match_same_site description]
220
+ * @param bool $match false default
221
+ * @param array $rule rule to compare
222
+ * @return boolean true if match
223
+ */
224
+ function rule_match_same_site( $match, $rule ) {
225
+
226
+ $ref = (isset($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : '';
227
+
228
+ $internal = str_replace( array( 'http://','https://' ), '', site_url() );
229
+
230
+ if( $rule['operator'] == "==" ) {
231
+ return preg_match( '~' . $internal . '~i', $ref );
232
+ } else {
233
+ return !preg_match( '~' . $internal . '~i', $ref );
234
+ }
235
+
236
+ }
237
+
238
+
239
+ /*
240
+ * rule_match_post_type
241
+ *
242
+ * @since 1.0.0
243
+ */
244
+
245
+ function rule_match_post_type( $match, $rule )
246
+ {
247
+ $post_type = get_post_type( );
248
+
249
+ if( $rule['operator'] == "==" )
250
+ {
251
+ $match = ( $post_type === $rule['value'] );
252
+ }
253
+ elseif( $rule['operator'] == "!=" )
254
+ {
255
+ $match = ( $post_type !== $rule['value'] );
256
+ }
257
+
258
+
259
+ return $match;
260
+ }
261
+
262
+
263
+ /*
264
+ * rule_match_post
265
+ *
266
+ * @since 1.0.0
267
+ */
268
+
269
+ function rule_match_post( $match, $rule )
270
+ {
271
+ global $post;
272
+ $post_id = $post->ID;
273
+
274
+ if($rule['operator'] == "==")
275
+ {
276
+ $match = ( $post_id == $rule['value'] );
277
+ }
278
+ elseif($rule['operator'] == "!=")
279
+ {
280
+ $match = ( $post_id != $rule['value'] );
281
+ }
282
+
283
+ return $match;
284
+
285
+ }
286
+
287
+
288
+ /*
289
+ * rule_match_page_type
290
+ *
291
+ * @since 1.0.0
292
+ */
293
+
294
+ function rule_match_page_type( $match, $rule )
295
+ {
296
+ global $post;
297
+
298
+
299
+ $post = get_post( $post->ID );
300
+
301
+ if( $rule['value'] == 'front_page') {
302
+
303
+ $front_page = (int) get_option('page_on_front');
304
+
305
+ if( $front_page !== 0 ) {
306
+
307
+ if($rule['operator'] == "==") {
308
+
309
+ $match = ( $front_page == $post->ID );
310
+
311
+ } elseif($rule['operator'] == "!=") {
312
+
313
+ $match = ( $front_page != $post->ID );
314
+
315
+ }
316
+ } else {
317
+
318
+ if($rule['operator'] == "==") {
319
+
320
+ $match = is_home();
321
+
322
+ } elseif($rule['operator'] == "!=") {
323
+
324
+ $match = !is_home();
325
+
326
+ }
327
+
328
+ }
329
+
330
+ }
331
+ elseif( $rule['value'] == 'posts_page') {
332
+
333
+ $posts_page = (int) get_option('page_for_posts');
334
+
335
+ if( $posts_page !== 0 ) {
336
+ if($rule['operator'] == "==") {
337
+
338
+ $match = ( $posts_page == $post->ID );
339
+
340
+ } elseif($rule['operator'] == "!=") {
341
+
342
+ $match = ( $posts_page != $post->ID );
343
+
344
+ }
345
+ } else {
346
+
347
+ if($rule['operator'] == "==") {
348
+
349
+ $match = is_home();
350
+
351
+ } elseif($rule['operator'] == "!=") {
352
+
353
+ $match = !is_home();
354
+
355
+ }
356
+
357
+ }
358
+
359
+ }
360
+ elseif( $rule['value'] == 'top_level') {
361
+ $post_parent = $post->post_parent;
362
+ if( $options['page_parent'] )
363
+ {
364
+ $post_parent = $options['page_parent'];
365
+ }
366
+
367
+
368
+ if($rule['operator'] == "==")
369
+ {
370
+ $match = ( $post_parent == 0 );
371
+ }
372
+ elseif($rule['operator'] == "!=")
373
+ {
374
+ $match = ( $post_parent != 0 );
375
+ }
376
+
377
+ }
378
+ elseif( $rule['value'] == 'parent') {
379
+
380
+ $children = get_pages(array(
381
+ 'post_type' => $post->post_type,
382
+ 'child_of' => $post->ID,
383
+ ));
384
+
385
+
386
+ if($rule['operator'] == "==") {
387
+ $match = ( count($children) > 0 );
388
+ }
389
+ elseif($rule['operator'] == "!=")
390
+ {
391
+ $match = ( count($children) == 0 );
392
+ }
393
+
394
+ }
395
+ elseif( $rule['value'] == 'child') {
396
+
397
+ $post_parent = $post->post_parent;
398
+ if( $options['page_parent'] )
399
+ {
400
+ $post_parent = $options['page_parent'];
401
+ }
402
+
403
+
404
+ if($rule['operator'] == "==")
405
+ {
406
+ $match = ( $post_parent != 0 );
407
+ }
408
+ elseif($rule['operator'] == "!=")
409
+ {
410
+ $match = ( $post_parent == 0 );
411
+ }
412
+
413
+ } elseif( $rule['value'] == 'all_pages') {
414
+
415
+ $match = true;
416
+
417
+ }
418
+
419
+ return $match;
420
+
421
+ }
422
+
423
+
424
+ /*
425
+ * rule_match_page_parent
426
+ *
427
+ * @since 1.0.0
428
+ */
429
+
430
+ function rule_match_page_parent( $match, $rule )
431
+ {
432
+ global $post;
433
+ // validation
434
+ if( !$post->ID )
435
+ {
436
+ return false;
437
+ }
438
+
439
+
440
+ // vars
441
+ $post = get_post( $post->ID );
442
+
443
+ $post_parent = $post->post_parent;
444
+ if( $options['page_parent'] )
445
+ {
446
+ $post_parent = $options['page_parent'];
447
+ }
448
+
449
+
450
+ if($rule['operator'] == "==")
451
+ {
452
+ $match = ( $post_parent == $rule['value'] );
453
+ }
454
+ elseif($rule['operator'] == "!=")
455
+ {
456
+ $match = ( $post_parent != $rule['value'] );
457
+ }
458
+
459
+
460
+ return $match;
461
+
462
+ }
463
+
464
+
465
+ /*
466
+ * rule_match_page_template
467
+ *
468
+ * @since 1.0.0
469
+ */
470
+
471
+ function rule_match_page_template( $match, $rule )
472
+ {
473
+ global $post;
474
+
475
+ $page_template = get_post_meta( $post->ID, '_wp_page_template', true );
476
+
477
+
478
+ if( ! $page_template ) {
479
+
480
+ if( 'page' == get_post_type( $post->ID ) ) {
481
+
482
+ $page_template = "default";
483
+
484
+ }
485
+ }
486
+
487
+
488
+ if($rule['operator'] == "==")
489
+ {
490
+ $match = ( $page_template === $rule['value'] );
491
+ }
492
+ elseif($rule['operator'] == "!=")
493
+ {
494
+ $match = ( $page_template !== $rule['value'] );
495
+ }
496
+
497
+ return $match;
498
+
499
+ }
500
+
501
+
502
+ /*
503
+ * rule_match_post_category
504
+ *
505
+ * @since 1.0.0
506
+ */
507
+
508
+ function rule_match_post_category( $match, $rule )
509
+ {
510
+ global $post;
511
+
512
+ // validate
513
+ if( !$post->ID )
514
+ {
515
+ return false;
516
+ }
517
+
518
+
519
+ // post type
520
+ $post_type = get_post_type( $post->ID );
521
+
522
+ // vars
523
+ $taxonomies = get_object_taxonomies( $post_type );
524
+
525
+ $all_terms = get_the_terms( $post->ID, 'category' );
526
+ if($all_terms)
527
+ {
528
+ foreach($all_terms as $all_term)
529
+ {
530
+ $terms[] = $all_term->term_id;
531
+ }
532
+ }
533
+
534
+ // no terms at all?
535
+ if( empty($terms) )
536
+ {
537
+ // If no ters, this is a new post and should be treated as if it has the "Uncategorized" (1) category ticked
538
+ if( is_array($taxonomies) && in_array('category', $taxonomies) )
539
+ {
540
+ $terms[] = '1';
541
+ }
542
+ }
543
+
544
+
545
+ if($rule['operator'] == "==")
546
+ {
547
+ $match = false;
548
+
549
+ if($terms)
550
+ {
551
+ if( in_array($rule['value'], $terms) )
552
+ {
553
+ $match = true;
554
+ }
555
+ }
556
+
557
+ }
558
+ elseif($rule['operator'] == "!=")
559
+ {
560
+ $match = true;
561
+
562
+ if($terms)
563
+ {
564
+ if( in_array($rule['value'], $terms) )
565
+ {
566
+ $match = false;
567
+ }
568
+ }
569
+
570
+ }
571
+
572
+
573
+ return $match;
574
+
575
+ }
576
+
577
+
578
+ /*
579
+ * rule_match_user_type
580
+ *
581
+ * @since 1.0.0
582
+ */
583
+
584
+ function rule_match_user_type( $match, $rule )
585
+ {
586
+ $user = wp_get_current_user();
587
+
588
+ if( $rule['operator'] == "==" )
589
+ {
590
+ if( $rule['value'] == 'super_admin' )
591
+ {
592
+ $match = is_super_admin( $user->ID );
593
+ }
594
+ else
595
+ {
596
+ $match = in_array( $rule['value'], $user->roles );
597
+ }
598
+
599
+ }
600
+ elseif( $rule['operator'] == "!=" )
601
+ {
602
+ if( $rule['value'] == 'super_admin' )
603
+ {
604
+ $match = !is_super_admin( $user->ID );
605
+ }
606
+ else
607
+ {
608
+ $match = ( ! in_array( $rule['value'], $user->roles ) );
609
+ }
610
+ }
611
+
612
+ return $match;
613
+
614
+ }
615
+
616
+
617
+
618
+
619
+ /*
620
+ * rule_match_post_format
621
+ *
622
+ * @since 1.0.0
623
+ */
624
+
625
+ function rule_match_post_format( $match, $rule )
626
+ {
627
+ global $post;
628
+
629
+ // validate
630
+ if( !$post->ID )
631
+ {
632
+ return false;
633
+ }
634
+
635
+ $post_type = get_post_type( $post->ID );
636
+
637
+
638
+ // does post_type support 'post-format'
639
+ if( post_type_supports( $post_type, 'post-formats' ) )
640
+ {
641
+ $post_format = get_post_format( $post->ID );
642
+
643
+ if( $post_format === false )
644
+ {
645
+ $post_format = 'standard';
646
+ }
647
+ }
648
+
649
+
650
+
651
+ if($rule['operator'] == "==")
652
+ {
653
+ $match = ( $post_format === $rule['value'] );
654
+
655
+ }
656
+ elseif($rule['operator'] == "!=")
657
+ {
658
+ $match = ( $post_format !== $rule['value'] );
659
+ }
660
+
661
+
662
+
663
+ return $match;
664
+
665
+ }
666
+
667
+
668
+ /*
669
+ * rule_match_post_status
670
+ *
671
+ * @since 1.0.0
672
+ */
673
+
674
+ function rule_match_post_status( $match, $rule )
675
+ {
676
+ global $post;
677
+
678
+ // validate
679
+ if( !$post->ID )
680
+ {
681
+ return false;
682
+ }
683
+
684
+
685
+ // vars
686
+ $post_status = get_post_status( $post->ID );
687
+
688
+
689
+ // auto-draft = draft
690
+ if( $post_status == 'auto-draft' )
691
+ {
692
+ $post_status = 'draft';
693
+ }
694
+
695
+
696
+ // match
697
+ if($rule['operator'] == "==")
698
+ {
699
+ $match = ( $post_status === $rule['value'] );
700
+
701
+ }
702
+ elseif($rule['operator'] == "!=")
703
+ {
704
+ $match = ( $post_status !== $rule['value'] );
705
+ }
706
+
707
+
708
+ // return
709
+ return $match;
710
+
711
+ }
712
+
713
+
714
+ /*
715
+ * rule_match_taxonomy
716
+ *
717
+ * @since 1.0.0
718
+ */
719
+
720
+ function rule_match_taxonomy( $match, $rule )
721
+ {
722
+ global $post;
723
+ // validate
724
+ if( !$post->ID )
725
+ {
726
+ return false;
727
+ }
728
+
729
+
730
+ // post type
731
+ $post_type = get_post_type( $post->ID );
732
+
733
+ // vars
734
+ $taxonomies = get_object_taxonomies( $post_type );
735
+
736
+ if( is_array($taxonomies) )
737
+ {
738
+ foreach( $taxonomies as $tax )
739
+ {
740
+ $all_terms = get_the_terms( $post->ID, $tax );
741
+ if($all_terms)
742
+ {
743
+ foreach($all_terms as $all_term)
744
+ {
745
+ $terms[] = $all_term->term_id;
746
+ }
747
+ }
748
+ }
749
+ }
750
+
751
+ // no terms at all?
752
+ if( empty($terms) )
753
+ {
754
+ // If no ters, this is a new post and should be treated as if it has the "Uncategorized" (1) category ticked
755
+ if( is_array($taxonomies) && in_array('category', $taxonomies) )
756
+ {
757
+ $terms[] = '1';
758
+ }
759
+ }
760
+
761
+
762
+
763
+ if($rule['operator'] == "==")
764
+ {
765
+ $match = false;
766
+
767
+ if($terms)
768
+ {
769
+ if( in_array($rule['value'], $terms) )
770
+ {
771
+ $match = true;
772
+ }
773
+ }
774
+
775
+ }
776
+ elseif($rule['operator'] == "!=")
777
+ {
778
+ $match = true;
779
+
780
+ if($terms)
781
+ {
782
+ if( in_array($rule['value'], $terms) )
783
+ {
784
+ $match = false;
785
+ }
786
+ }
787
+
788
+ }
789
+
790
+
791
+ return $match;
792
+
793
+ }
794
+
795
+
796
+
797
+ }
798
+
799
+ ?>
public/includes/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
public/views/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
public/views/public.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Represents the view for the public-facing component of the plugin.
4
+ *
5
+ * This typically includes any information, if any, that is rendered to the
6
+ * frontend of the theme when the plugin is activated.
7
+ *
8
+ * @package Plugin_Name
9
+ * @author Your Name <email@example.com>
10
+ * @license GPL-2.0+
11
+ * @link http://example.com
12
+ * @copyright 2014 Your Name or Company Name
13
+ */
14
+ ?>
15
+
16
+ <!-- This file is used to markup the public facing aspect of the plugin. -->