To Top - Version 1.0

Version Description

Download this release

Release Info

Developer catchthemes
Plugin Icon 128x128 To Top
Version 1.0
Comparing to
See all releases

Version 1.0

LICENSE.txt ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright (C) <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ <program> Copyright (C) <year> <name of author>
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <http://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <http://www.gnu.org/philosophy/why-not-lgpl.html>.
README.txt ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Plugin Name ===
2
+ Contributors: catchthemes
3
+ Donate link: http://catchthemes.com/wp-plugins/to-top/
4
+ Tags: to-top, arrow, button, icon, link to top, scroll, back to top, scroll to top, scroll top, scroll up, simple scroll to top, simple back to top, smooth scroll
5
+ Requires at least: 4.2
6
+ Tested up to: 4.4.1
7
+ Stable tag: 1.0
8
+ License: GNU General Public License, version 3 (GPLv3)
9
+ License URI: http://www.gnu.org/licenses/gpl-3.0.txt
10
+
11
+ To Top is a nifty lightweight plugin. It adds a highly customizable button, which when clicked, scrolls up smoothly to the top of a page.
12
+
13
+ == Description ==
14
+
15
+ To Top Plugin adds a floating box at the bottom right side (by default) of the page when scrolled down and, when clicked, rolls smoothly to the top. This is convenient when you have a long page, and you want to give your visitors an easy way to get back to the top.
16
+
17
+ When a page or post has heaps of content, visitors have to scroll down to read those content. As they scroll below, all the navigational links go up. When visitors are done with the reading, they need to scroll up to see what else is there on your website. This can be very tedious. To Top Plugin adds a button that quickly gets visitors to the top of the page in a matter of milliseconds. Also, the transition is smooth and improves user experience. The other great thing about this plugin is you don’t have to touch a single code of your template.
18
+
19
+ ### Features
20
+ * Displays an icon when user scrolls down the page
21
+ * Live Preview via Customizer
22
+ * Scrolls the page back to top with animation
23
+ * Set icon/image opacity
24
+ * Set icon(dashicons) or image as to top button
25
+ * For icon, set background color, icon color, icon size and icon shape(from square to circle)
26
+ * Set any image you want
27
+ * Set image width
28
+ * Set the location of the icon
29
+ * Show/hide To Top button in admin pages.
30
+ * Auto hide
31
+ * Hide on small devices
32
+
33
+ = Premium Support =
34
+
35
+ Catch Themes team does not provide support for the To Top plugin on the WordPress.org forums. Support is provided at [To Top Support Forum](http://catchthemes.com/support-forum/forum/to-top/)
36
+
37
+ = Translation =
38
+
39
+ To Top plugin is translation ready.
40
+
41
+
42
+ == Installation ==
43
+
44
+ You can download and install To Top plugin using the built in WordPress plugin installer. If you download To Top manually, make sure it is uploaded to "/wp-content/plugins/to-top/".
45
+
46
+ Activate To Top in the "Plugins" admin panel using the "Activate" link.
47
+
48
+ You'll then see To Top dashboard from which you can enable or disable the button as per your need.
49
+
50
+ == Screenshots ==
51
+
52
+ 1. Basic Settings
53
+ 2. Icon Settings
54
+ 3. Image Settings
55
+ 4. Advanced Settings
56
+ 5. Reset Settings
57
+
58
+ == Changelog ==
59
+
60
+ = 1.0 =
61
+ * Initial Release
admin/class-to-top-admin.php ADDED
@@ -0,0 +1,709 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The admin-specific functionality of the plugin.
5
+ *
6
+ * @link catchthemes.com
7
+ * @since 1.0
8
+ *
9
+ * @package To_Top
10
+ * @subpackage To_Top/admin
11
+ */
12
+
13
+ /**
14
+ * The admin-specific functionality of the plugin.
15
+ *
16
+ * Defines the plugin name, version, and two examples hooks for how to
17
+ * enqueue the admin-specific stylesheet and JavaScript.
18
+ *
19
+ * @package To_Top
20
+ * @subpackage To_Top/admin
21
+ * @author Catch Themes <info@catchthemes.com>
22
+ */
23
+ class To_Top_Admin {
24
+
25
+ /**
26
+ * The ID of this plugin.
27
+ *
28
+ * @since 1.0
29
+ * @access private
30
+ * @var string $plugin_name The ID of this plugin.
31
+ */
32
+ private $plugin_name;
33
+
34
+ /**
35
+ * The version of this plugin.
36
+ *
37
+ * @since 1.0
38
+ * @access private
39
+ * @var string $version The current version of this plugin.
40
+ */
41
+ private $version;
42
+
43
+ /**
44
+ * Initialize the class and set its properties.
45
+ *
46
+ * @since 1.0
47
+ * @param string $plugin_name The name of this plugin.
48
+ * @param string $version The version of this plugin.
49
+ */
50
+ public function __construct( $plugin_name, $version ) {
51
+
52
+ $this->plugin_name = $plugin_name;
53
+ $this->version = $version;
54
+
55
+ }
56
+
57
+ /**
58
+ * Register the stylesheets for the admin area.
59
+ *
60
+ * @since 1.0
61
+ */
62
+ public function enqueue_styles( $hook ) {
63
+ /**
64
+ * This function is provided for demonstration purposes only.
65
+ *
66
+ * An instance of this class should be passed to the run() function
67
+ * defined in To_Top_Loader as all of the hooks are defined
68
+ * in that particular class.
69
+ *
70
+ * The To_Top_Loader will then create the relationship
71
+ * between the defined hooks and the functions defined in this
72
+ * class.
73
+ */
74
+
75
+ if ( 'toplevel_page_to-top' == $hook ) {
76
+ wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/to-top-admin.css', array( 'dashicons', 'wp-color-picker' ), $this->version, 'all' );
77
+ }
78
+
79
+ $option = to_top_get_options();
80
+
81
+ if ( $option['show_on_admin'] ) {
82
+ //Load CSS if To Top is enabled on admin
83
+ //No need to enqueue dashicons as it is already present in admin
84
+ wp_enqueue_style( $this->plugin_name . '-public', plugin_dir_url( __FILE__ ) . '../public/css/to-top-public.css', array(), $this->version, 'all' );
85
+ }
86
+
87
+ }
88
+
89
+ /**
90
+ * Register the JavaScript for the admin area.
91
+ *
92
+ * @since 1.0
93
+ */
94
+ public function enqueue_scripts( $hook ) {
95
+
96
+ /**
97
+ * This function is provided for demonstration purposes only.
98
+ *
99
+ * An instance of this class should be passed to the run() function
100
+ * defined in To_Top_Loader as all of the hooks are defined
101
+ * in that particular class.
102
+ *
103
+ * The To_Top_Loader will then create the relationship
104
+ * between the defined hooks and the functions defined in this
105
+ * class.
106
+ */
107
+
108
+ if ( 'toplevel_page_to-top' == $hook ) {
109
+ wp_enqueue_media();
110
+
111
+ wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/to-top-admin.js', array( 'jquery', 'wp-color-picker' ), $this->version, false );
112
+ }
113
+
114
+ $option = to_top_get_options();
115
+
116
+ if ( $option['show_on_admin'] ) {
117
+ //Load JS if To Top is enabled on admin
118
+ wp_enqueue_script( $this->plugin_name. '-public', plugin_dir_url( __FILE__ ) . '../public/js/to-top-public.js', array( 'jquery' ), $this->version, false );
119
+
120
+ // Localize the script with new data
121
+ wp_localize_script( $this->plugin_name. '-public', 'to_top_options', $option );
122
+ }
123
+ }
124
+
125
+ public function action_links($links, $file) {
126
+ if ( $file == $this->plugin_name . '/' . $this->plugin_name . '.php' ) {
127
+ $customizer_link = add_query_arg( array(
128
+ 'autofocus[panel]' => 'to_top_panel',
129
+ ),
130
+ admin_url('customize.php')
131
+ );
132
+
133
+ $settings_link = '<a href="' . esc_url( $customizer_link ) . '">' .esc_html__( 'Settings', 'to-top' ) . '</a>';
134
+
135
+ array_unshift( $links, $settings_link );
136
+ }
137
+ return $links;
138
+ }
139
+
140
+ /**
141
+ * catchwebtools: add_plugin_settings_menu
142
+ * add Catch Web Tools to menu
143
+ */
144
+ public function add_plugin_settings_menu() {
145
+ //add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position );
146
+ add_menu_page( esc_html__( 'To Top Settings', 'to-top' ), __( 'To Top Settings', 'to-top' ), 'manage_options', 'to-top', array( $this, 'settings_page' ), 'dashicons-arrow-up-alt2', '99.01564' );
147
+ }
148
+
149
+ /**
150
+ * catchwebtools: catch_web_tools_settings_page
151
+ * Catch Web Tools Setting function
152
+ */
153
+ public function settings_page() {
154
+ if ( !current_user_can( 'manage_options' ) ) {
155
+ wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
156
+ }
157
+
158
+ require plugin_dir_path( __FILE__ ) . 'partials/to-top-admin-display.php';
159
+ }
160
+
161
+ /**
162
+ * catchwebtools: register_settings
163
+ * Catch Web Tools Register Settings
164
+ */
165
+ public function register_settings() {
166
+ // register_setting( $option_group, $option_name, $sanitize_callback )
167
+ register_setting(
168
+ 'to-top-group',
169
+ 'to_top_options',
170
+ array( $this, 'sanitize_callback' )
171
+ );
172
+ }
173
+
174
+ /**
175
+ * catchwebtools: catchwebtools_catch_updater_sanitize_callback
176
+ * Catch Ids Sanitization function callback
177
+ */
178
+ public function sanitize_callback( $input ){
179
+
180
+ if ( isset( $input['reset'] ) && $input['reset'] ) {
181
+ //If reset, restore defaults
182
+ return to_top_default_options();
183
+ }
184
+
185
+ //Basic Settings
186
+ $input['scroll_offset'] = absint( $input['scroll_offset'] );
187
+ $input['icon_opacity'] = absint( $input['icon_opacity'] );
188
+ $input['style'] = sanitize_key( $input['style'] );
189
+
190
+ //Icon Settings
191
+ $input['icon_type'] = sanitize_key( $input['icon_type'] );
192
+ $input['icon_color'] = (empty( $input['icon_color']) || !preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $input['icon_color'])) ? '' : $input['icon_color'];
193
+ $input['icon_bg_color'] = (empty( $input['icon_bg_color']) || !preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $input['icon_bg_color'])) ? '' : $input['icon_bg_color'];
194
+ $input['icon_size'] = absint( $input['icon_size'] );
195
+ $input['border_radius'] = absint( $input['border_radius'] );
196
+
197
+ //Image Settings
198
+ $input['image'] = esc_url_raw( $input['image'] );
199
+ $input['image_width'] = absint( $input['image_width'] );
200
+ $input['image_alt'] = sanitize_text_field( $input['image_alt'] );
201
+
202
+ //Advanced Settings
203
+ $input['location'] = sanitize_key( $input['location'] );
204
+ $input['margin_x'] = absint( $input['margin_x'] );
205
+ $input['margin_y'] = absint( $input['margin_y'] );
206
+ $input['show_on_admin'] = ( ( isset( $input['show_on_admin'] ) && true == $input['show_on_admin'] ) ? true : false );
207
+ $input['enable_autohide'] = ( ( isset( $input['enable_autohide'] ) && true == $input['enable_autohide'] ) ? true : false );
208
+ $input['autohide_time'] = absint( $input['autohide_time'] );
209
+ $input['enable_hide_small_device']= ( ( isset( $input['enable_hide_small_device'] ) && true == $input['enable_hide_small_device'] ) ? true : false );
210
+ $input['small_device_max_width'] = absint( $input['small_device_max_width'] );
211
+
212
+ return $input;
213
+ }
214
+
215
+ /**
216
+ * Add Options to customizer separating the basic and advanced controls
217
+ *
218
+ * @since 1.0
219
+ */
220
+ public function customize_register( $wp_customize ){
221
+
222
+ $to_top_defaults = to_top_default_options();
223
+ //print_r($defaults); die();
224
+
225
+ //Custom Controls
226
+ require plugin_dir_path( __FILE__ ) . 'partials/customizer/customizer-custom-controls.php';
227
+
228
+ $wp_customize->add_panel( 'to_top_panel', array(
229
+ 'priority' => 1,
230
+ 'title' => esc_html__( 'To Top Options', 'to-top' ),
231
+ ) );
232
+
233
+ /* Basic Settings Start */
234
+ $wp_customize->add_section( 'to_top_basic_settings', array(
235
+ 'description' => '',
236
+ 'panel' => 'to_top_panel',
237
+ 'title' => esc_html__( 'Basic Settings', 'to-top' ),
238
+ ) );
239
+
240
+ $wp_customize->add_setting( 'to_top_options[scroll_offset]', array(
241
+ 'capability' => 'edit_theme_options',
242
+ 'default' => $to_top_defaults['scroll_offset'],
243
+ 'type' => 'option',
244
+ 'transport' => 'refresh',
245
+ ) );
246
+
247
+ $wp_customize->add_control( 'to_top_options[scroll_offset]', array(
248
+ 'label' => esc_html__( 'Scroll Offset (px)', 'to-top' ),
249
+ 'description' => esc_html__( 'Number of pixels to be scrolled before the button appears', 'to-top' ),
250
+ 'section' => 'to_top_basic_settings',
251
+ 'settings' => 'to_top_options[scroll_offset]',
252
+ 'type' => 'number',
253
+ 'input_attrs' => array(
254
+ 'style' => 'width: 55px;',
255
+ 'min' => 0,
256
+ 'max' => 500,
257
+ 'step' => 1,
258
+ ),
259
+ ) );
260
+
261
+ $wp_customize->add_setting( 'to_top_options[icon_opacity]', array(
262
+ 'capability' => 'edit_theme_options',
263
+ 'default' => $to_top_defaults['icon_opacity'],
264
+ 'type' => 'option',
265
+ 'transport' => 'postMessage',
266
+ ) );
267
+
268
+ $wp_customize->add_control( 'to_top_options[icon_opacity]', array(
269
+ 'label' => esc_html__( 'Icon Opacity (%)', 'to-top' ),
270
+ 'section' => 'to_top_basic_settings',
271
+ 'settings' => 'to_top_options[icon_opacity]',
272
+ 'type' => 'number',
273
+ 'input_attrs' => array(
274
+ 'style' => 'width: 55px;',
275
+ 'min' => 0,
276
+ 'max' => 100,
277
+ 'step' => 1,
278
+ ),
279
+ ) );
280
+
281
+ $wp_customize->add_setting( 'to_top_options[style]', array(
282
+ 'capability' => 'edit_theme_options',
283
+ 'default' => $to_top_defaults['style'],
284
+ 'type' => 'option',
285
+ 'transport' => 'refresh',
286
+ ) );
287
+
288
+ $wp_customize->add_control( 'to_top_options[style]', array(
289
+ 'label' => esc_html__( 'Style', 'to-top' ),
290
+ 'section' => 'to_top_basic_settings',
291
+ 'settings' => 'to_top_options[style]',
292
+ 'type' => 'select',
293
+ 'choices' => array(
294
+ 'icon' => esc_html__( 'Icon', 'to-top'),
295
+ 'image' => esc_html__( 'Image', 'to-top')
296
+ ),
297
+ ) );
298
+
299
+ $wp_customize->add_setting( 'to_top_options[icon_type]', array(
300
+ 'capability' => 'edit_theme_options',
301
+ 'default' => $to_top_defaults['icon_type'],
302
+ 'type' => 'option',
303
+ 'transport' => 'postMessage',
304
+ ) );
305
+
306
+ $wp_customize->add_control( new To_Top_Custom_Icons ( $wp_customize, 'to_top_options[icon_type]', array(
307
+ 'label' => esc_html__( 'Select Icon Type', 'to-top' ),
308
+ 'section' => 'to_top_basic_settings',
309
+ 'settings' => 'to_top_options[icon_type]',
310
+ 'type' => 'select',
311
+ 'active_callback' => array( $this, 'to_top_is_icon_setting_active' ),
312
+ ) ) );
313
+
314
+ $wp_customize->add_setting( 'to_top_options[icon_color]', array(
315
+ 'capability' => 'edit_theme_options',
316
+ 'default' => $to_top_defaults['icon_color'],
317
+ 'type' => 'option',
318
+ 'transport' => 'postMessage',
319
+ ) );
320
+
321
+ $wp_customize->add_control( new WP_Customize_Color_Control ( $wp_customize, 'to_top_options[icon_color]', array(
322
+ 'label' => esc_html__( 'Icon Color', 'to-top' ),
323
+ 'section' => 'to_top_basic_settings',
324
+ 'settings' => 'to_top_options[icon_color]',
325
+ 'type' => 'color',
326
+ 'active_callback' => array( $this, 'to_top_is_icon_setting_active' ),
327
+ ) ) );
328
+
329
+ $wp_customize->add_setting( 'to_top_options[icon_bg_color]', array(
330
+ 'capability' => 'edit_theme_options',
331
+ 'default' => $to_top_defaults['icon_bg_color'],
332
+ 'type' => 'option',
333
+ 'transport' => 'postMessage',
334
+ ) );
335
+
336
+ $wp_customize->add_control( new WP_Customize_Color_Control ( $wp_customize, 'to_top_options[icon_bg_color]', array(
337
+ 'label' => esc_html__( 'Icon Background Color', 'to-top' ),
338
+ 'section' => 'to_top_basic_settings',
339
+ 'settings' => 'to_top_options[icon_bg_color]',
340
+ 'type' => 'color',
341
+ 'active_callback' => array( $this, 'to_top_is_icon_setting_active' ),
342
+ ) ) );
343
+
344
+ $wp_customize->add_setting( 'to_top_options[icon_size]', array(
345
+ 'capability' => 'edit_theme_options',
346
+ 'default' => $to_top_defaults['icon_size'],
347
+ 'type' => 'option',
348
+ 'transport' => 'postMessage',
349
+ ) );
350
+
351
+ $wp_customize->add_control( 'to_top_options[icon_size]', array(
352
+ 'label' => esc_html__( 'Icon Size (px)', 'to-top' ),
353
+ 'section' => 'to_top_basic_settings',
354
+ 'settings' => 'to_top_options[icon_size]',
355
+ 'type' => 'number',
356
+ 'input_attrs' => array(
357
+ 'style' => 'width: 55px;',
358
+ 'min' => 1,
359
+ 'step' => 1,
360
+ ),
361
+ 'active_callback' => array( $this, 'to_top_is_icon_setting_active' ),
362
+ ) );
363
+
364
+ $wp_customize->add_setting( 'to_top_options[border_radius]', array(
365
+ 'capability' => 'edit_theme_options',
366
+ 'default' => $to_top_defaults['border_radius'],
367
+ 'type' => 'option',
368
+ 'transport' => 'postMessage',
369
+ ) );
370
+
371
+ $wp_customize->add_control( 'to_top_options[border_radius]', array(
372
+ 'label' => esc_html__( 'Border Radius (%)', 'to-top' ),
373
+ 'description' => esc_html__( '0 will make the icon background square, 50 will make it a circle', 'to-top' ),
374
+ 'section' => 'to_top_basic_settings',
375
+ 'settings' => 'to_top_options[border_radius]',
376
+ 'type' => 'number',
377
+ 'input_attrs' => array(
378
+ 'style' => 'width: 55px;',
379
+ 'min' => 0,
380
+ 'max' => 50,
381
+ 'step' => 1,
382
+ ),
383
+ 'active_callback' => array( $this, 'to_top_is_icon_setting_active' ),
384
+ ) );
385
+
386
+ $wp_customize->add_setting( 'to_top_options[image]', array(
387
+ 'capability' => 'edit_theme_options',
388
+ 'default' => $to_top_defaults['image'],
389
+ 'type' => 'option',
390
+ 'transport' => 'postMessage',
391
+ ) );
392
+
393
+ $wp_customize->add_control( new WP_Customize_Image_Control ( $wp_customize, 'to_top_options[image]', array(
394
+ 'label' => esc_html__( 'Image', 'to-top' ),
395
+ 'description' => '',
396
+ 'section' => 'to_top_basic_settings',
397
+ 'settings' => 'to_top_options[image]',
398
+ 'type' => 'image',
399
+ 'active_callback' => array( $this, 'to_top_is_image_setting_active' ),
400
+ ) ) );
401
+
402
+ $wp_customize->add_setting( 'to_top_options[image_width]', array(
403
+ 'capability' => 'edit_theme_options',
404
+ 'default' => $to_top_defaults['image_width'],
405
+ 'type' => 'option',
406
+ 'transport' => 'postMessage',
407
+ ) );
408
+
409
+ $wp_customize->add_control( 'to_top_options[image_width]', array(
410
+ 'label' => esc_html__( 'Image Width (px)', 'to-top' ),
411
+ 'section' => 'to_top_basic_settings',
412
+ 'settings' => 'to_top_options[image_width]',
413
+ 'type' => 'number',
414
+ 'input_attrs' => array(
415
+ 'style' => 'width: 55px;',
416
+ 'min' => 1,
417
+ 'max' => 200,
418
+ 'step' => 1,
419
+ ),
420
+ 'active_callback' => array( $this, 'to_top_is_image_setting_active' ),
421
+ ) );
422
+
423
+ $wp_customize->add_setting( 'to_top_options[image_alt]', array(
424
+ 'capability' => 'edit_theme_options',
425
+ 'default' => $to_top_defaults['image_alt'],
426
+ 'type' => 'option',
427
+ 'transport' => 'postMessage',
428
+ ) );
429
+
430
+ $wp_customize->add_control( 'to_top_options[image_alt]', array(
431
+ 'label' => esc_html__( 'Image Alt', 'to-top' ),
432
+ 'description' => '',
433
+ 'section' => 'to_top_basic_settings',
434
+ 'settings' => 'to_top_options[image_alt]',
435
+ 'type' => 'text',
436
+ 'active_callback' => array( $this, 'to_top_is_image_setting_active' ),
437
+ ) );
438
+
439
+ /* Basic Settings End */
440
+
441
+ /* Advanced Settings Start */
442
+
443
+ $wp_customize->add_section( 'to_top_advance_settings', array(
444
+ 'description' => '',
445
+ 'panel' => 'to_top_panel',
446
+ 'title' => esc_html__( 'Advanced Settings', 'to-top' ),
447
+ ) );
448
+
449
+ $wp_customize->add_setting( 'to_top_options[location]', array(
450
+ 'capability' => 'edit_theme_options',
451
+ 'default' => $to_top_defaults['location'],
452
+ 'type' => 'option',
453
+ 'transport' => 'postMessage',
454
+ ) );
455
+
456
+ $wp_customize->add_control( 'to_top_options[location]', array(
457
+ 'label' => esc_html__( 'Location', 'to-top' ),
458
+ 'description' => '',
459
+ 'section' => 'to_top_advance_settings',
460
+ 'settings' => 'to_top_options[location]',
461
+ 'type' => 'select',
462
+ 'choices' => array(
463
+ 'bottom-right' => esc_html__( 'Bottom Right', 'to-top' ),
464
+ 'bottom-left' => esc_html__( 'Bottom Left', 'to-top' ),
465
+ 'top-right' => esc_html__( 'Top Right', 'to-top' ),
466
+ 'top-left' => esc_html__( 'Top Left', 'to-top' ),
467
+ ),
468
+ ) );
469
+
470
+ $wp_customize->add_setting( 'to_top_options[margin_x]', array(
471
+ 'capability' => 'edit_theme_options',
472
+ 'default' => $to_top_defaults['margin_x'],
473
+ 'type' => 'option',
474
+ 'transport' => 'postMessage',
475
+ ) );
476
+
477
+ $wp_customize->add_control( 'to_top_options[margin_x]', array(
478
+ 'label' => esc_html__( 'Margin X (px)', 'to-top' ),
479
+ 'description' => '',
480
+ 'section' => 'to_top_advance_settings',
481
+ 'settings' => 'to_top_options[margin_x]',
482
+ 'type' => 'number',
483
+ 'input_attrs' => array(
484
+ 'style' => 'width: 55px;',
485
+ 'min' => 1,
486
+ 'step' => 1,
487
+ ),
488
+ ) );
489
+
490
+ $wp_customize->add_setting( 'to_top_options[margin_y]', array(
491
+ 'capability' => 'edit_theme_options',
492
+ 'default' => $to_top_defaults['border_radius'],
493
+ 'type' => 'option',
494
+ 'transport' => 'postMessage',
495
+ ) );
496
+
497
+ $wp_customize->add_control( 'to_top_options[margin_y]', array(
498
+ 'label' => esc_html__( 'Margin Y (px)', 'to-top' ),
499
+ 'description'=> '',
500
+ 'section' => 'to_top_advance_settings',
501
+ 'settings' => 'to_top_options[margin_y]',
502
+ 'type' => 'number',
503
+ 'input_attrs'=> array(
504
+ 'style' => 'width: 55px;',
505
+ 'min' => 1,
506
+ 'step' => 1,
507
+ ),
508
+ ) );
509
+
510
+ $wp_customize->add_setting( 'to_top_options[show_on_admin]', array(
511
+ 'capability' => 'edit_theme_options',
512
+ 'default' => $to_top_defaults['show_on_admin'],
513
+ 'type' => 'option',
514
+ 'transport' => 'postMessage',
515
+ ) );
516
+
517
+ $wp_customize->add_control( 'to_top_options[show_on_admin]', array(
518
+ 'label' => esc_html__( 'Check to show on WP-ADMIN', 'to-top' ),
519
+ 'description' => esc_html__( 'Button will be shown on admin section', 'to-top' ),
520
+ 'section' => 'to_top_advance_settings',
521
+ 'settings' => 'to_top_options[show_on_admin]',
522
+ 'type' => 'checkbox',
523
+ ) );
524
+
525
+ $wp_customize->add_setting( 'to_top_options[enable_autohide]', array(
526
+ 'capability' => 'edit_theme_options',
527
+ 'default' => $to_top_defaults['enable_autohide'],
528
+ 'type' => 'option',
529
+ 'transport' => 'refresh',
530
+ ) );
531
+
532
+ $wp_customize->add_control( 'to_top_options[enable_autohide]', array(
533
+ 'label' => esc_html__( 'Check to Enable Auto Hide', 'to-top' ),
534
+ 'description' => '',
535
+ 'section' => 'to_top_advance_settings',
536
+ 'settings' => 'to_top_options[enable_autohide]',
537
+ 'type' => 'checkbox',
538
+ ) );
539
+
540
+ $wp_customize->add_setting( 'to_top_options[autohide_time]', array(
541
+ 'capability' => 'edit_theme_options',
542
+ 'default' => $to_top_defaults['autohide_time'],
543
+ 'type' => 'option',
544
+ 'transport' => 'refresh',
545
+ ) );
546
+
547
+ $wp_customize->add_control( 'to_top_options[autohide_time]', array(
548
+ 'label' => esc_html__( 'Auto Hide Time (secs)', 'to-top' ),
549
+ 'description' => esc_html__( 'Button will be auto hidden after this duration in seconds, if enabled', 'to-top' ),
550
+ 'section' => 'to_top_advance_settings',
551
+ 'settings' => 'to_top_options[autohide_time]',
552
+ 'type' => 'number',
553
+ 'input_attrs' => array(
554
+ 'style' => 'width: 55px;',
555
+ 'min' => 1,
556
+ 'step' => 1,
557
+ ),
558
+ 'active_callback' => array( $this, 'to_top_is_auto_hide_enabled' ),
559
+ ) );
560
+
561
+ $wp_customize->add_setting( 'to_top_options[enable_hide_small_device]', array(
562
+ 'capability' => 'edit_theme_options',
563
+ 'default' => $to_top_defaults['enable_hide_small_device'],
564
+ 'type' => 'option',
565
+ 'transport' => 'refresh',
566
+ ) );
567
+
568
+ $wp_customize->add_control( 'to_top_options[enable_hide_small_device]', array(
569
+ 'label' => esc_html__( 'Check to Hide on Small Devices', 'to-top' ),
570
+ 'description' => esc_html__( 'Button will be hidden on small devices when the width below matches', 'to-top' ),
571
+ 'section' => 'to_top_advance_settings',
572
+ 'settings' => 'to_top_options[enable_hide_small_device]',
573
+ 'type' => 'checkbox',
574
+ ) );
575
+
576
+ $wp_customize->add_setting( 'to_top_options[small_device_max_width]', array(
577
+ 'capability' => 'edit_theme_options',
578
+ 'default' => $to_top_defaults['small_device_max_width'],
579
+ 'type' => 'option',
580
+ 'transport' => 'refresh',
581
+ ) );
582
+
583
+ $wp_customize->add_control( 'to_top_options[small_device_max_width]', array(
584
+ 'label' => esc_html__( 'Small Device Max Width (px)', 'to-top' ),
585
+ 'description' => esc_html__( 'Button will be hidden on devices with lesser or equal width', 'to-top' ),
586
+ 'section' => 'to_top_advance_settings',
587
+ 'settings' => 'to_top_options[small_device_max_width]',
588
+ 'type' => 'number',
589
+ 'input_attrs' => array(
590
+ 'style' => 'width: 55px;',
591
+ 'min' => 1,
592
+ 'step' => 1,
593
+ ),
594
+ 'active_callback' => array( $this, 'to_top_is_hide_on_small_devices_enabled' ),
595
+ ) );
596
+
597
+ /* Advanced Settings End */
598
+
599
+ /* Reset Settings Start */
600
+
601
+ $wp_customize->add_section( 'to_top_reset_settings', array(
602
+ 'description' => '',
603
+ 'panel' => 'to_top_panel',
604
+ 'title' => esc_html__( 'Reset Settings', 'to-top' ),
605
+ ) );
606
+
607
+ $wp_customize->add_setting( 'to_top_options[reset]', array(
608
+ 'capability' => 'edit_theme_options',
609
+ 'default' => $to_top_defaults['reset'],
610
+ 'type' => 'option',
611
+ 'transport' => 'postMessage',
612
+ ) );
613
+
614
+ $wp_customize->add_control( 'to_top_options[reset]', array(
615
+ 'label' => esc_html__( 'Check to Reset All Settings', 'to-top' ),
616
+ 'description' => esc_html__( 'Caution: All data will be lost. Refresh the page after save to view full effects.', 'to-top' ),
617
+ 'section' => 'to_top_reset_settings',
618
+ 'settings' => 'to_top_options[reset]',
619
+ 'type' => 'checkbox',
620
+ ) );
621
+
622
+ /* Reset Settings End */
623
+ }
624
+
625
+ /**
626
+ * Custom scripts on Customizer for Catch Box
627
+ *
628
+ * @since To Top 1.0
629
+ */
630
+ function customizer_enqueue_scripts() {
631
+
632
+ $option = to_top_get_options();
633
+
634
+ wp_enqueue_script( 'to_top_customizer_custom_script', plugin_dir_url( __FILE__ ) . 'js/to-top-customizer-scripts.js', array( 'jquery' ), '20151223', true );
635
+ }
636
+
637
+ /**
638
+ * Custom styles on Customizer for Catch Box
639
+ *
640
+ * @since To Top 1.0
641
+ */
642
+ function customizer_enqueue_styles() {
643
+
644
+ wp_enqueue_style( 'to_top_customizer_custom_style', plugin_dir_url( __FILE__ ) . 'css/customizer.css' );
645
+
646
+ }
647
+
648
+
649
+
650
+ /**
651
+ * Sanitizes Checkboxes
652
+ * @param $input entered value
653
+ * @return sanitized output
654
+ *
655
+ * @since 1.0
656
+ */
657
+ function sanitize_checkbox( $checked ) {
658
+ // Boolean check.
659
+ return ( ( isset( $checked ) && true == $checked ) ? true : false );
660
+ }
661
+
662
+ /**
663
+ * Active Callbacks
664
+ * @return true or false
665
+ *
666
+ * @since 1.0
667
+ */
668
+
669
+ function to_top_is_icon_setting_active( $control ) {
670
+ $style = $control->manager->get_setting( 'to_top_options[style]' )->value();
671
+
672
+ //return true only if icon setting is selected
673
+ if( $style === 'icon' ) {
674
+ return true;
675
+ }
676
+ else {
677
+ return false;
678
+ }
679
+ }
680
+
681
+ function to_top_is_image_setting_active( $control ) {
682
+ $style = $control->manager->get_setting( 'to_top_options[style]' )->value();
683
+
684
+ //return true only if icon setting is selected
685
+ if( $style === 'image') {
686
+ return true;
687
+ } else {
688
+ return false;
689
+ }
690
+ }
691
+
692
+ function to_top_is_auto_hide_enabled( $control ) {
693
+ $autohide = $control->manager->get_setting( 'to_top_options[enable_autohide]' )->value();
694
+ if ( $autohide ) {
695
+ return true;
696
+ } else {
697
+ return false;
698
+ }
699
+ }
700
+
701
+ function to_top_is_hide_on_small_devices_enabled( $control ) {
702
+ $hide_on_small_devices = $control->manager->get_setting( 'to_top_options[enable_hide_small_device]' )->value();
703
+ if ( $hide_on_small_devices ) {
704
+ return true;
705
+ } else {
706
+ return false;
707
+ }
708
+ }
709
+ }
admin/css/customizer.css ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ #customize-control-to_top_options-icon_type .dashicons {
2
+ text-align: left;
3
+ display: block;
4
+ height: auto;
5
+ width: auto;
6
+ vertical-align: auto;
7
+ font-size: inherit;
8
+ font-style: auto;
9
+ font-weight: inherit;
10
+ line-height: 1;
11
+ }
admin/css/to-top-admin.css ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * All of the CSS for your admin-specific functionality should be
3
+ * included in this file.
4
+ */
5
+
6
+ /* Self Clearing Goodness */
7
+ #to-top:after,
8
+ #plugin-option-title:after,
9
+ #plugin-support:after,
10
+ #catch_ad_tabs:after,
11
+ #module-container:after {
12
+ content: "\0020";
13
+ display: block;
14
+ height: 0;
15
+ clear: both;
16
+ visibility: hidden;
17
+ }
18
+ .clear {
19
+ clear: both;
20
+ }
21
+ #to-top {
22
+ background-color: #fff;
23
+ box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3);
24
+ margin: 10px 20px 10px 0;
25
+ padding-bottom: 30px;
26
+ }
27
+ #to-top .form-table th {
28
+ padding-left: 10px;
29
+ }
30
+ #plugin-option-header {
31
+ background-color: #3A3D41;
32
+ display: block;
33
+ padding: 15px 20px;
34
+ overflow: hidden;
35
+ }
36
+ #plugin-social {
37
+ float: right;
38
+ width: 330px;
39
+ }
40
+ #plugin-social ul li {
41
+ display: inline;
42
+ float: right;
43
+ }
44
+ #plugin-option-title {
45
+ float: left;
46
+ }
47
+ #plugin-option-title .title {
48
+ color: #fff;
49
+ float: left;
50
+ font-size: 21px;
51
+ line-height: 53px;
52
+ padding: 0 10px 0 0;
53
+ text-shadow: none;
54
+ }
55
+ #plugin-option-title .logo {
56
+ float: left;
57
+ padding: 0;
58
+ }
59
+ #plugin-support {
60
+ float: right;
61
+ text-align: right;
62
+ }
63
+ #plugin-support ul li {
64
+ display: inline;
65
+ }
66
+ #plugin-support a {
67
+ opacity: 0.8;
68
+ -moz-opacity: 0.8;
69
+ }
70
+ #plugin-support a:hover {
71
+ opacity: 1;
72
+ -moz-opacity: 1;
73
+ }
74
+ #to-top .option-container {
75
+ margin: 0 auto;
76
+ width: 90%;
77
+ }
78
+ #to-top #videos textarea, #howimadeit textarea {
79
+ height: 150px;
80
+ width: 400px;
81
+ }
82
+
83
+ #to-top #videos textarea, #howimadeit textarea {
84
+ height: 150px;
85
+ width: 400px;
86
+ }
87
+ #to-top #faq ul li {
88
+ list-style:disc inside none;
89
+ }
90
+ #sociallinks .form-table th {
91
+ padding: 0px;
92
+ vertical-align: middle;
93
+ }
94
+ #to-top .form-table select[multiple] {
95
+ height: 200px;
96
+ }
97
+
98
+ #to-top .form-table label.box {
99
+ float: left;
100
+ margin-right: 20px;
101
+ }
102
+ #to-top .form-table label.box:last-child {
103
+ margin-right: 0;
104
+ }
105
+ h3.option-toggle {
106
+ -webkit-border-top-left-radius: 3px;
107
+ -webkit-border-top-right-radius: 3px;
108
+ -moz-border-radius-topleft: 3px;
109
+ -moz-border-radius-topright: 3px;
110
+ border-top-left-radius: 3px;
111
+ border-top-right-radius: 3px;
112
+ margin: 20px 0 0 0;
113
+ min-width: 600px;
114
+ border:1px solid #dfdfdf;
115
+ background-color: #F1F1F1;
116
+ background-image: -ms-linear-gradient(top, #f9f9f9, #ececec);
117
+ background-image: -moz-linear-gradient(top, #f9f9f9, #ececec);
118
+ background-image: -o-linear-gradient(top, #f9f9f9, #ececec);
119
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#ececec));
120
+ background-image: -webkit-linear-gradient(top, #f9f9f9, #ececec);
121
+ background-image: linear-gradient(top, #f9f9f9, #ececec);
122
+ height: 34px;
123
+ line-height: 34px;
124
+ font-size: 15px;
125
+ font-weight: normal;
126
+ float: left;
127
+ padding: 0;
128
+ width: 98%;
129
+ }
130
+ h3.option-toggle a {
131
+ background:url(../images/arrow-light.png) 99% 50% no-repeat;
132
+ color: #464646;
133
+ padding-left: 10px;
134
+ text-decoration: none;
135
+ display: block;
136
+ text-shadow:#fff 0 1px 0;
137
+ }
138
+ h3.option-toggle a:hover, h3.option-active a {
139
+ background:url(../images/arrow-dark.png) 99% 50% no-repeat;
140
+ color: #444;
141
+ }
142
+ .option-content {
143
+ -webkit-border-bottom-right-radius: 3px;
144
+ -webkit-border-bottom-left-radius: 3px;
145
+ -moz-border-radius-bottomright: 3px;
146
+ -moz-border-radius-bottomleft: 3px;
147
+ border-bottom-right-radius: 3px;
148
+ border-bottom-left-radius: 3px;
149
+ margin: 0;
150
+ min-width: 600px;
151
+ padding: 0;
152
+ border: 1px solid #dfdfdf;
153
+ border-top:none;
154
+ background: #fcfcfc;
155
+ overflow: hidden;
156
+ font-size: 12px;
157
+ clear: both;
158
+ color: #333;
159
+ width: 98%;
160
+ }
161
+ .option-content p {
162
+ padding-left: 10px;
163
+ }
164
+ /* Genericon */
165
+ .genericon {
166
+ vertical-align: middle;
167
+ float: right;
168
+ }
169
+ /* Dashboard */
170
+ #to-top #dashboard {
171
+ margin: 0 auto;
172
+ width: 90%;
173
+ }
174
+ .wrap #plugin-description h2 {
175
+ color: #464646;
176
+ font-size: 18px;
177
+ padding-bottom: 0;
178
+ }
179
+ .wrap #plugin-description p {
180
+ font-size: 13px;
181
+ line-height: 1.5;
182
+ margin-top: 5px;
183
+ }
184
+ #message {
185
+ text-align: center;
186
+ }
187
+ .dashicons {
188
+ font-size: 32px;
189
+ height: 32px;
190
+ width: 32px;
191
+ }
192
+ .dashicon_label {
193
+ margin-right: 20px;
194
+ }
195
+ .dashicon_to_top_admin {
196
+ background-color: #000;
197
+ -webkit-border-radius: 5%;
198
+ -moz-border-radius: 5%;
199
+ border-radius: 5%;
200
+ color: #fff;
201
+ font-size: 32px;
202
+ height: 32px;
203
+ opacity: 0.5;
204
+ padding: 5px;
205
+ width: 32px;
206
+ z-index: 9999;
207
+ }
admin/images/arrow-dark.png ADDED
Binary file
admin/images/arrow-light.png ADDED
Binary file
admin/images/default.png ADDED
Binary file
admin/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
admin/js/to-top-admin.js ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function( $ ) {
2
+ 'use strict';
3
+
4
+ /**
5
+ * Custom jQuery functions and trigger events
6
+ */
7
+ jQuery(document).ready(function($){
8
+ $("#setting-error-settings_updated").hide();
9
+
10
+ // Show Hide Toggle Box
11
+ $(".option-content").hide();
12
+
13
+ $(".open").show();
14
+
15
+ $("h3.option-toggle").click(function(){
16
+ $(this).toggleClass("option-active").next().slideToggle("fast");
17
+ return false;
18
+ });
19
+
20
+ setTimeout(function () {
21
+ $(".fade").fadeOut("slow", function () {
22
+ $(".fade").remove();
23
+ });
24
+
25
+ }, 2000);
26
+
27
+ var custom_uploader;
28
+
29
+ $( '.to_top_upload_image' ).click(function(e) {
30
+ e.preventDefault();
31
+
32
+ var title, this_selector, button_text, attachment;
33
+
34
+ title = $(this).val();
35
+
36
+ this_selector = $(this); //For later use
37
+
38
+ button_text = $(this).attr("ref");
39
+
40
+ //Extend the wp.media object
41
+ custom_uploader = wp.media.frames.file_frame = wp.media({
42
+ title: title,
43
+ button: {
44
+ text: button_text
45
+ },
46
+ multiple: true
47
+ });
48
+
49
+ //When a file is selected, grab the URL and set it as the text field's value
50
+ custom_uploader.on( 'select', function() {
51
+ attachment = custom_uploader.state().get( 'selection' ).first().toJSON();
52
+ this_selector.prev().val( attachment.url );
53
+ });
54
+
55
+ //Open the uploader dialog
56
+ custom_uploader.open();
57
+ });
58
+
59
+ //For Color picker in icon color
60
+ var myOptions = {
61
+ change: function(event, ui){
62
+ $(".dashicon_to_top_admin").css({
63
+ 'color' : ui.color.toString(),
64
+ });
65
+ },
66
+ };
67
+
68
+ $('.to_top_icon_color').wpColorPicker( myOptions );
69
+
70
+ //For Color picker in icon background color
71
+ var myOptions2 = {
72
+ change: function(event, ui){
73
+ $(".dashicon_to_top_admin").css({
74
+ 'background-color' : ui.color.toString(),
75
+ });
76
+ },
77
+ };
78
+
79
+ $('.to_top_icon_bg_color').wpColorPicker( myOptions2 );
80
+
81
+ $('#to_top_border_radius').change(function(){
82
+ $(".dashicon_to_top_admin").css({
83
+ '-webkit-border-radius' : $('#to_top_border_radius').val() + '%',
84
+ '-moz-border-radius' : $('#to_top_border_radius').val() + '%',
85
+ 'border-radius' : $('#to_top_border_radius').val() + '%',
86
+ });
87
+ });
88
+
89
+ $('#to_top_icon_size').change(function(){
90
+ $(".dashicon_to_top_admin").css({
91
+ 'font-size' : $('#to_top_icon_size').val() + 'px',
92
+ 'height' : $('#to_top_icon_size').val() + 'px',
93
+ 'width' : $('#to_top_icon_size').val() + 'px',
94
+ });
95
+ });
96
+
97
+ $(".dashicon_to_top_admin").css({
98
+ '-webkit-border-radius' : $('#to_top_border_radius').val() + '%',
99
+ '-moz-border-radius' : $('#to_top_border_radius').val() + '%',
100
+ 'border-radius' : $('#to_top_border_radius').val() + '%',
101
+ 'color' : $('.to_top_icon_color').val(),
102
+ 'background-color' : $('.to_top_icon_bg_color').val(),
103
+ 'font-size' : $('#to_top_icon_size').val() + 'px',
104
+ 'height' : $('#to_top_icon_size').val() + 'px',
105
+ 'width' : $('#to_top_icon_size').val() + 'px',
106
+ });
107
+
108
+ $( '#to_top_options_style' ).change(function(){
109
+ var value;
110
+ value = $(this).val();
111
+ if ( 'image' == value ) {
112
+ $( '.to_top_image_settings' ).show();
113
+ $( '.to_top_icon_settings' ).hide();
114
+ }
115
+ else {
116
+ $( '.to_top_icon_settings' ).show();
117
+ $( '.to_top_image_settings' ).hide();
118
+ }
119
+ });
120
+
121
+ var value;
122
+ value = $( '#to_top_options_style' ).val();
123
+ if ( 'image' == value ) {
124
+ $( '.to_top_image_settings' ).show();
125
+ $( '.to_top_icon_settings' ).hide();
126
+ }
127
+ else {
128
+ $( '.to_top_icon_settings' ).show();
129
+ $( '.to_top_image_settings' ).hide();
130
+ }
131
+ });
132
+
133
+ })( jQuery );
134
+
135
+
136
+ /**
137
+ * Facebook Script
138
+ */
139
+ (function(d, s, id) {
140
+ var js, fjs = d.getElementsByTagName(s)[0];
141
+
142
+ if (d.getElementById(id)) return;
143
+
144
+ js = d.createElement(s); js.id = id;
145
+
146
+ js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=276203972392824";
147
+
148
+ fjs.parentNode.insertBefore(js, fjs);
149
+ }(document, 'script', 'facebook-jssdk'));
150
+
151
+ /**
152
+ * Twitter Script
153
+ */
154
+ !function(d,s,id){
155
+ var js,fjs=d.getElementsByTagName(s)[0];
156
+
157
+ if(!d.getElementById(id)){
158
+ js=d.createElement(s);
159
+
160
+ js.id=id;
161
+
162
+ js.src="//platform.twitter.com/widgets.js";
163
+
164
+ fjs.parentNode.insertBefore(js,fjs);
165
+ }
166
+ }(document,"script","twitter-wjs");
admin/js/to-top-customizer-scripts.js ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * To Top Customizer enhancements for a better user experience.
3
+ *
4
+ * Contains handlers to make To Top Customizer preview reload changes asynchronously.
5
+ */
6
+
7
+ (function($) {
8
+
9
+ wp.customize('to_top_options[icon_opacity]', function(value) {
10
+ value.bind(function(to) {
11
+ $('#to_top_scrollup').css({
12
+ 'opacity': parseFloat(to / 100)
13
+ });
14
+ });
15
+ });
16
+
17
+ wp.customize('to_top_options[icon_type]', function(value) {
18
+ value.bind(function(to) {
19
+ var new_class = 'dashicons' + ' ' + to;
20
+
21
+ $('#to_top_scrollup').removeClass();
22
+ $('#to_top_scrollup').addClass(new_class);
23
+ });
24
+ });
25
+
26
+ wp.customize('to_top_options[icon_bg_color]', function(value) {
27
+ value.bind(function(to) {
28
+ $('#to_top_scrollup').css({
29
+ 'background-color': to
30
+ });
31
+ });
32
+ });
33
+
34
+ wp.customize('to_top_options[icon_color]', function(value) {
35
+ value.bind(function(to) {
36
+ $('#to_top_scrollup').css({
37
+ 'color': to
38
+ });
39
+ });
40
+ });
41
+
42
+ wp.customize('to_top_options[icon_size]', function(value) {
43
+ value.bind(function(to) {
44
+ $('#to_top_scrollup').css({
45
+ 'font-size': to + 'px',
46
+ 'height': to + 'px',
47
+ 'width': to + 'px'
48
+ });
49
+ });
50
+ });
51
+
52
+ wp.customize('to_top_options[border_radius]', function(value) {
53
+ value.bind(function(to) {
54
+ $('#to_top_scrollup').css({
55
+ 'border-radius': to + '%'
56
+ });
57
+ });
58
+ });
59
+
60
+ wp.customize('to_top_options[location]', function(value) {
61
+ value.bind(function(to) {
62
+ var margin_x = wp.customize('to_top_options[margin_x]').get();
63
+ var margin_y = wp.customize('to_top_options[margin_y]').get();
64
+
65
+ if ('bottom-right' === to) {
66
+ $('#to_top_scrollup').css({
67
+ 'top' : 'auto',
68
+ 'right': margin_x + 'px',
69
+ 'bottom': margin_y + 'px',
70
+ 'left': 'auto',
71
+ });
72
+ } else if ('bottom-left' === to) {
73
+ $('#to_top_scrollup').css({
74
+ 'top' : 'auto',
75
+ 'right': 'auto',
76
+ 'bottom': margin_y + 'px',
77
+ 'left': margin_x + 'px',
78
+ });
79
+ } else if ('top-right' === to) {
80
+ $('#to_top_scrollup').css({
81
+ 'top' : margin_y + 'px',
82
+ 'right': margin_x + 'px',
83
+ 'bottom': 'auto',
84
+ 'left': 'auto',
85
+ });
86
+ } else if ('top-left' === to) {
87
+ $('#to_top_scrollup').css({
88
+ 'top': margin_y + 'px',
89
+ 'right': 'auto',
90
+ 'bottom':'auto' ,
91
+ 'left': margin_x + 'px',
92
+ });
93
+ }
94
+
95
+ });
96
+ });
97
+
98
+ wp.customize('to_top_options[margin_y]', function(value) {
99
+ value.bind(function(to) {
100
+ var location = wp.customize('to_top_options[location]').get();
101
+ offset = location.split('-');
102
+ offset1 = offset[0];
103
+ if ('top' === offset1) {
104
+ $('#to_top_scrollup').css({
105
+ 'top': to + 'px'
106
+ });
107
+ } else if ('bottom' === offset1) {
108
+ $('#to_top_scrollup').css({
109
+ 'bottom': to + 'px'
110
+ });
111
+ }
112
+
113
+ });
114
+ });
115
+
116
+ wp.customize('to_top_options[margin_x]', function(value) {
117
+ value.bind(function(to) {
118
+ var location = wp.customize('to_top_options[location]').get();
119
+ offset = location.split('-');
120
+ offset2 = offset[1];
121
+ if ('right' === offset2) {
122
+ $('#to_top_scrollup').css({
123
+ 'right': to + 'px'
124
+ });
125
+ } else if ('left' === offset2) {
126
+ $('#to_top_scrollup').css({
127
+ 'left': to + 'px'
128
+ });
129
+ }
130
+ });
131
+ });
132
+
133
+ wp.customize('to_top_options[image]', function(value) {
134
+ value.bind(function(to) {
135
+ $('#to_top_scrollup img').attr({
136
+ 'src': to
137
+ });
138
+ });
139
+ });
140
+
141
+ wp.customize('to_top_options[image_width]', function(value) {
142
+ value.bind(function(to) {
143
+ $('#to_top_scrollup').css({
144
+ 'width': to + 'px'
145
+ });
146
+ });
147
+ });
148
+
149
+ wp.customize('to_top_options[image_alt]', function(value) {
150
+ value.bind(function(to) {
151
+ $('#to_top_scrollup img').attr({
152
+ 'alt': to
153
+ });
154
+ });
155
+ });
156
+
157
+ })(jQuery);
admin/partials/customizer/customizer-custom-controls.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Catch Themes
4
+ * @subpackage To Top
5
+ * @since To Top 1.0
6
+ */
7
+
8
+
9
+ //Custom control for Notes
10
+ class To_Top_Custom_Icons extends WP_Customize_Control {
11
+
12
+ private $icon_options = array(
13
+ 'dashicons-arrow-up' => 'Arrow Up',
14
+ 'dashicons-arrow-up-alt' => 'Arrow Up Alt',
15
+ 'dashicons-arrow-up-alt2' => 'Arrow Up Alt 2',
16
+ );
17
+
18
+ public function render_content() {
19
+ $output = '';
20
+ $output .= '<label><span class="customize-control-title">' . esc_html( $this->label ) . '</span>';
21
+ $output .= '<select ' . esc_url( $this->get_link() ) . ' id="to-top-customizer-icon-type">';
22
+ foreach ( $this->icon_options as $key => $value ) {
23
+ $output .= '<option class="dashicons ' . $key . '" value="' . $key . '">' . $value . '</option>';
24
+ }
25
+ $output .= '</select>';
26
+ $output .= '</label>';
27
+
28
+ echo $output;
29
+ }
30
+ }
31
+ ?>
admin/partials/to-top-admin-display.php ADDED
@@ -0,0 +1,351 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Provide a admin area view for the plugin
5
+ *
6
+ * This file is used to markup the admin-facing aspects of the plugin.
7
+ *
8
+ * @link catchthemes.com
9
+ * @since 1.0
10
+ *
11
+ * @package To_Top
12
+ * @subpackage To_Top/admin/partials
13
+ */
14
+ ?>
15
+
16
+ <!-- For Facebook -->
17
+ <div id="fb-root"></div>
18
+
19
+ <div id="to-top" class="wrap">
20
+ <div id="plugin-option-header">
21
+ <div id="plugin-social">
22
+ <ul>
23
+ <li class="widget-fb">
24
+ <div data-show-faces="false" data-width="80" data-layout="button_count" data-send="false" data-href="<?php echo esc_url( 'http://facebook.com/catchthemes' ); ?>" class="fb-like"></div>
25
+ </li>
26
+
27
+ <li class="widget-tw">
28
+ <a data-dnt="true" data-show-screen-name="true" data-show-count="true" class="twitter-follow-button" href="<?php echo esc_url( 'https://twitter.com/catchthemes' ); ?>"> <?php esc_html_e( 'Follow @catchthemes', 'to-top' ) ?></a>
29
+ </li>
30
+ </ul>
31
+ </div><!-- #plugin-social -->
32
+
33
+ <div id="plugin-option-title">
34
+ <h2 class="title"><?php esc_html_e( 'To Top By', 'to-top' ); ?></h2>
35
+ <h2 class="logo">
36
+ <a href="<?php echo esc_url( __( 'http://catchthemes.com/', 'to-top' ) ); ?>" title="<?php esc_attr_e( 'Catch Themes', 'to-top' ); ?>" target="_blank">
37
+
38
+ <img src="http://catchthemes.com/wp-content/themes/catchthemes/images/logo.png" alt="<?php esc_html_e( 'Catch Themes', 'to-top' ); ?>" />
39
+ </a>
40
+ </h2>
41
+ </div><!-- #plugin-option-title -->
42
+
43
+ <div id="plugin-support">
44
+ <ul>
45
+ <li>
46
+ <a class="button" href="<?php echo esc_url( __('http://catchthemes.com/forum/to-top/', 'to-top' )); ?>" title="<?php esc_attr_e('Support Forum', 'to-top' ); ?>" target="_blank"><?php printf(__('Support Forum', 'to-top' )); ?></a>
47
+ </li>
48
+ <li>
49
+ <a class="button" href="<?php echo esc_url( __('http://catchthemes.com/wp-plugins/to-top/', 'to-top' )); ?>" title="<?php esc_attr_e('Plugin Details', 'to-top' ); ?>" target="_blank"><?php printf(__('Plugin Details', 'to-top' ) ); ?></a>
50
+ </li>
51
+ <li>
52
+ <a class="button" href="<?php echo esc_url( __('https://www.facebook.com/catchthemes/', 'to-top' ) ); ?>" title="<?php esc_attr_e( 'Like Catch Themes on Facebook', 'to-top' ); ?>" target="_blank"><?php printf(__('Facebook', 'to-top' )); ?></a>
53
+ </li>
54
+ <li>
55
+ <a class="button" href="<?php echo esc_url( __('https://twitter.com/catchthemes/', 'to-top' ) ); ?>" title="<?php esc_attr_e( 'Follow Catch Themes on Twitter', 'to-top' ); ?>" target="_blank"><?php printf( __('Twitter', 'to-top' ) ); ?></a>
56
+ </li>
57
+ <li>
58
+ <a class="button" href="<?php echo esc_url( __('http://wordpress.org/support/view/plugin-reviews/to-top', 'to-top' ) ); ?>" title="<?php esc_attr_e('Rate us 5 Star on WordPress', 'to-top' ); ?>" target="_blank"><?php printf( __('5 Star Rating', 'to-top' ) ); ?></a>
59
+ </li>
60
+ </ul>
61
+ </div><!-- #plugin-support -->
62
+ </div><!-- #plugin-option-header -->
63
+
64
+ <?php if( isset($_GET['settings-updated']) ) { ?>
65
+ <div id="message" class="updated fade">
66
+ <p><strong><?php esc_html_e( 'Plugin Options Saved.', 'to-top' ) ?></strong></p>
67
+ </div>
68
+ <?php } ?>
69
+
70
+ <div id="to_top_main">
71
+ <div id="message" class="notice">
72
+ <?php
73
+ $customizer_link = add_query_arg( array(
74
+ 'autofocus[panel]' => 'to_top_panel',
75
+ ),
76
+ admin_url('customize.php')
77
+ );
78
+
79
+ $settings_link = '<a href="' . esc_url( $customizer_link ) . '">' .esc_html__( 'Customizer', 'to-top' ) . '</a>';
80
+ ?>
81
+ <p><strong><?php esc_html_e( 'Want Live Preview? Change the settings from ', 'to-top' ); echo $settings_link; ?></strong></p>
82
+ </div>
83
+
84
+ <form method="post" action="options.php">
85
+ <?php settings_fields( 'to-top-group' ); ?>
86
+ <?php $settings = to_top_get_options( 'to_top_options' ); ?>
87
+ <div class="option-container">
88
+ <h3 class="option-toggle option-active"><a href="#"><?php esc_html_e( 'Basic Settings', 'to-top' ); ?></a></h3>
89
+ <div class="option-content inside open">
90
+ <table class="form-table">
91
+ <tbody>
92
+ <tr>
93
+ <th scope="row"><?php esc_html_e( 'Scroll Offset (px)', 'to-top' ); ?></th>
94
+ <td>
95
+ <?php
96
+ echo '<input min="1" type="number" id="to_top_options[scroll_offset]" name="to_top_options[scroll_offset]" value="'. absint( $settings['scroll_offset'] ) .'"/>px';
97
+
98
+ echo '<p class="description">'. esc_html__( 'Number of pixels to be scrolled before the button appears', 'to-top' ) .'</p>';
99
+ ?>
100
+ </td>
101
+ </tr>
102
+
103
+ <tr>
104
+ <th scope="row"><?php esc_html_e( 'Icon Opacity (%)', 'to-top' ); ?></th>
105
+ <td>
106
+ <?php
107
+ echo '<input min="1" max="100" type="number" id="to_top_options[icon_opacity]" name="to_top_options[icon_opacity]" value="'. absint( $settings['icon_opacity'] ) .'"/>%';
108
+ ?>
109
+ </td>
110
+ </tr>
111
+
112
+ <tr>
113
+ <th scope="row"><?php esc_html_e( 'Style', 'to-top' ); ?></th>
114
+
115
+ <td>
116
+ <?php
117
+ echo '<select id="to_top_options_style" name="to_top_options[style]">';
118
+ echo '<option value="icon"' . selected( $settings['style'], 'icon', false) . '>'. esc_html__( 'Icon', 'to-top') .'</option>';
119
+ echo '<option value="image"' . selected( $settings['style'], 'image', false) . '>'. esc_html__( 'Image', 'to-top') .'</option>';
120
+ echo '</select>';
121
+ ?>
122
+ </td>
123
+ </tr>
124
+ </tbody>
125
+ </table>
126
+
127
+ <?php submit_button( esc_html__( 'Save Changes', 'top-up' ) ); ?>
128
+ </div>
129
+
130
+ <div class="to_top_icon_settings">
131
+ <h3 class="option-toggle "><a href="#"><?php esc_html_e( 'Icon Settings', 'to-top' ); ?></a></h3>
132
+ <div class="option-content inside open">
133
+ <table class="form-table">
134
+ <tbody>
135
+ <tr>
136
+ <th scope="row"><?php esc_html_e( 'Select Icon Type', 'to-top' ); ?></th>
137
+
138
+ <td>
139
+ <?php
140
+ echo '<input type="radio" id="to_top_options_icon_type_1" name="to_top_options[icon_type]" value="dashicons-arrow-up"' . checked( 'dashicons-arrow-up', $settings['icon_type'], false ) . '/>';
141
+ echo '<label class="dashicon_label" for="to_top_options_icon_type_1"><span class="dashicon_to_top_admin dashicons dashicons-arrow-up"></span></label>';
142
+
143
+ echo '<input type="radio" id="to_top_options_icon_type_2" name="to_top_options[icon_type]" value="dashicons-arrow-up-alt"' . checked( 'dashicons-arrow-up-alt', $settings['icon_type'], false ) . '/>';
144
+ echo '<label class="dashicon_label" for="to_top_options_icon_type_2"><span class="dashicon_to_top_admin dashicons dashicons-arrow-up-alt"></span></label>';
145
+
146
+ echo '<input type="radio" id="to_top_options_icon_type_3" name="to_top_options[icon_type]" value="dashicons-arrow-up-alt2"' . checked( 'dashicons-arrow-up-alt2', $settings['icon_type'], false ) . '/>';
147
+ echo '<label class="dashicon_label" for="to_top_options_icon_type_3"><span class="dashicon_to_top_admin dashicons dashicons-arrow-up-alt2"></span></label>';
148
+ ?>
149
+ </td>
150
+ </tr>
151
+
152
+ <tr>
153
+ <th scope="row"><?php esc_html_e( 'Icon Color', 'to-top' ); ?></th>
154
+
155
+ <td>
156
+ <?php
157
+ echo '<input type="text" class="to_top_icon_color" name="to_top_options[icon_color]" value="'. sanitize_text_field( $settings['icon_color'] ) .'"/>';
158
+ ?>
159
+ </td>
160
+ </tr>
161
+
162
+ <tr>
163
+ <th scope="row"><?php esc_html_e( 'Icon Background Color', 'to-top' ); ?></th>
164
+
165
+ <td>
166
+ <?php
167
+ echo '<input type="text" class="to_top_icon_bg_color" name="to_top_options[icon_bg_color]" value="'. sanitize_text_field( $settings['icon_bg_color'] ) .'"/>';
168
+ ?>
169
+ </td>
170
+ </tr>
171
+
172
+ <tr>
173
+ <th scope="row"><?php esc_html_e( 'Icon Size (px)', 'to-top' ); ?></th>
174
+ <td>
175
+ <?php
176
+ echo '<input min="0" type="number" id="to_top_icon_size" name="to_top_options[icon_size]" value="'. absint( $settings['icon_size'] ) .'"/>px';
177
+ ?>
178
+ </td>
179
+ </tr>
180
+
181
+ <tr>
182
+ <th scope="row"><?php esc_html_e( 'Border Radius (%)', 'to-top' ); ?></th>
183
+ <td>
184
+ <?php
185
+ echo '<input min="0" max="50" type="number" id="to_top_border_radius" name="to_top_options[border_radius]" value="'. absint( $settings['border_radius'] ) .'"/>%';
186
+
187
+ echo '<p class="description">'. esc_html__( '0 will make the icon background square, 50 will make it a circle', 'to-top' ) .'</p>';
188
+ ?>
189
+ </td>
190
+ </tr>
191
+ </tbody>
192
+ </table>
193
+ <?php submit_button( esc_html__( 'Save Changes', 'top-up' ) ); ?>
194
+ </div>
195
+ </div>
196
+
197
+ <div class="to_top_image_settings">
198
+ <h3 class="option-toggle"><a href="#"><?php esc_html_e( 'Image Settings', 'to-top' ); ?></a></h3>
199
+ <div class="option-content inside open">
200
+ <table class="form-table">
201
+ <tbody>
202
+ <tr>
203
+ <th scope="row"><?php esc_html_e( 'Image', 'to-top' ); ?></th>
204
+ <td>
205
+ <input class="upload-url" size="65" type="text" name="to_top_options[image]" value="<?php echo esc_url( $settings['image'] ); ?>" />
206
+ <input ref="<?php esc_attr_e( 'Insert Image','to-top' );?>" class="to_top_upload_image button" name="wsl-image-add" type="button" value="<?php esc_attr_e( 'Change Image','to-top' );?>" />
207
+ </td>
208
+ </tr>
209
+
210
+ <tr>
211
+ <th scope="row"><?php esc_html_e( 'Image Width (px)', 'to-top' ); ?></th>
212
+ <td>
213
+ <?php
214
+ echo '<input min="0" max="200" type="number" size="65" id="to_top_options[image_width]" name="to_top_options[image_width]" value="'. absint( $settings['image_width'] ) .'"/>px';
215
+ ?>
216
+ </td>
217
+ </tr>
218
+
219
+ <tr>
220
+ <th scope="row"><?php esc_html_e( 'Image Alt', 'to-top' ); ?></th>
221
+ <td>
222
+ <?php
223
+ echo '<input type="text" size="65" id="to_top_options[image_alt]" name="to_top_options[image_alt]" value="'. sanitize_text_field( $settings['image_alt'] ) .'"/>';
224
+ ?>
225
+ </td>
226
+ </tr>
227
+ </tbody>
228
+ </table>
229
+ <?php submit_button( esc_html__( 'Save Changes', 'top-up' ) ); ?>
230
+ </div>
231
+ </div>
232
+
233
+ <h3 class="option-toggle option-active"><a href="#"><?php esc_html_e( 'Advanced Settings', 'to-top' ); ?></a></h3>
234
+ <div class="option-content inside">
235
+ <table class="form-table">
236
+ <tbody>
237
+ <tr>
238
+ <th scope="row"><?php esc_html_e( 'Location', 'to-top' ); ?></th>
239
+
240
+ <td>
241
+ <?php
242
+ echo '<select id="to_top_options[location]" name="to_top_options[location]">';
243
+ echo '<option value="bottom-right"' . selected( $settings['location'], 'bottom-right', false) . '>'. esc_html__( 'Bottom Right', 'to-top') .'</option>';
244
+ echo '<option value="bottom-left"' . selected( $settings['location'], 'bottom-left', false) . '>'. esc_html__( 'Bottom Left', 'to-top') .'</option>';
245
+ echo '<option value="top-right"' . selected( $settings['location'], 'top-right', false) . '>'. esc_html__( 'Top Right', 'to-top') .'</option>';
246
+ echo '<option value="top-left"' . selected( $settings['location'], 'top-left', false) . '>'. esc_html__( 'Top Left', 'to-top') .'</option>';
247
+ echo '</select>';
248
+ ?>
249
+ </td>
250
+ </tr>
251
+
252
+ <tr>
253
+ <th scope="row"><?php esc_html_e( 'Margin X (px)', 'to-top' ); ?></th>
254
+ <td>
255
+ <?php
256
+ echo '<input min="1" type="number" id="to_top_options[margin_x]" name="to_top_options[margin_x]" value="'. absint( $settings['margin_x'] ) .'"/>px';
257
+ ?>
258
+ </td>
259
+ </tr>
260
+
261
+ <tr>
262
+ <th scope="row"><?php esc_html_e( 'Margin Y (px)', 'to-top' ); ?></th>
263
+ <td>
264
+ <?php
265
+ echo '<input min="1" type="number" id="to_top_options[margin_y]" name="to_top_options[margin_y]" value="'. absint( $settings['margin_y'] ) .'"/>px';
266
+ ?>
267
+ </td>
268
+ </tr>
269
+
270
+ <tr>
271
+ <th scope="row"><?php esc_html_e( 'Show on WP-ADMIN?', 'to-top' ); ?></th>
272
+
273
+ <td>
274
+ <?php
275
+ echo '<input name="to_top_options[show_on_admin]" id="to_top_options[show_on_admin]" type="checkbox" value="1" class="to_top_options[show_on_admin]" ' . checked( 1, $settings['show_on_admin'], false ) . ' />' . esc_html__( 'Check to Enable','to-top' );
276
+ echo '<p class="description">' . esc_html__( 'Button will be shown on admin section', 'to-top' ) .'</p>';
277
+ ?>
278
+ </td>
279
+ </tr>
280
+
281
+ <tr>
282
+ <th scope="row"><?php esc_html_e( 'Enable Auto Hide', 'to-top' ); ?></th>
283
+
284
+ <td>
285
+ <?php
286
+ echo '<input name="to_top_options[enable_autohide]" id="to_top_options[enable_autohide]" type="checkbox" value="1" class="to_top_options[enable_autohide]" ' . checked( 1, $settings['enable_autohide'], false ) . ' />' . esc_html__( 'Check to Enable','to-top' );
287
+ ?>
288
+ </td>
289
+ </tr>
290
+
291
+ <tr>
292
+ <th scope="row"><?php esc_html_e( 'Auto Hide Time (secs)', 'to-top' ); ?></th>
293
+ <td>
294
+ <?php
295
+ echo '<input min="1" type="number" id="to_top_options[autohide_time]" name="to_top_options[autohide_time]" value="'. absint( $settings['autohide_time'] ) .'"/>sec(s)';
296
+
297
+ echo '<p class="description">'. esc_html__( 'Button will be auto hidden after this duration in seconds, if enabled', 'to-top' ) .'</p>';
298
+ ?>
299
+ </td>
300
+ </tr>
301
+
302
+ <tr>
303
+ <th scope="row"><?php esc_html_e( 'Hide on Small Devices?', 'to-top' ); ?></th>
304
+
305
+ <td>
306
+ <?php
307
+ echo '<input name="to_top_options[enable_hide_small_device]" id="to_top_options[enable_hide_small_device]" type="checkbox" value="1" class="to_top_options[enable_hide_small_device]" ' . checked( 1, $settings['enable_hide_small_device'], false ) . ' />' . esc_html__( 'Check to Enable','to-top' );
308
+ echo '<p class="description">' . esc_html__( 'Button will be hidden on small devices when the width below matches', 'to-top' ) .'</p>';
309
+ ?>
310
+ </td>
311
+ </tr>
312
+
313
+ <tr>
314
+ <th scope="row"><?php esc_html_e( 'Small Device Max Width (px)', 'to-top' ); ?></th>
315
+ <td>
316
+ <?php
317
+ echo '<input min="1" type="number" id="to_top_options[small_device_max_width]" name="to_top_options[small_device_max_width]" value="'. absint( $settings['small_device_max_width'] ) .'"/>px';
318
+
319
+ echo '<p class="description">'. esc_html__( 'Button will be hidden on devices with lesser or equal width', 'to-top' ) .'</p>';
320
+ ?>
321
+ </td>
322
+ </tr>
323
+ </tbody>
324
+ </table>
325
+
326
+ <?php submit_button( esc_html__( 'Save Changes', 'top-up' ) ); ?>
327
+ </div>
328
+
329
+ <h3 class="option-toggle option-active"><a href="#"><?php esc_html_e( 'Reset Settings', 'to-top' ); ?></a></h3>
330
+ <div class="option-content inside">
331
+ <table class="form-table">
332
+ <tbody>
333
+ <tr>
334
+ <th scope="row"><?php esc_html_e( 'Reset All Settings', 'to-top' ); ?></th>
335
+
336
+ <td>
337
+ <?php
338
+ echo '<input name="to_top_options[reset]" id="to_top_options[reset]" type="checkbox" value="1" class="to_top_options[reset]" ' . checked( 1, $settings['reset'], false ) . ' />' . esc_html__( 'Check to Reset All Settings','to-top' );
339
+ echo '<p class="description">' . esc_html__( 'Caution: All data will be lost', 'to-top' ) .'</p>';
340
+ ?>
341
+ </td>
342
+ </tr>
343
+ </tbody>
344
+ </table>
345
+
346
+ <?php submit_button( esc_html__( 'Save Changes', 'top-up' ) ); ?>
347
+ </div>
348
+ </div>
349
+ </form>
350
+ </div><!-- #social -->
351
+ </div><!-- .wrap -->
includes/class-to-top-activator.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Fired during plugin activation
5
+ *
6
+ * @link catchthemes.com
7
+ * @since 1.0
8
+ *
9
+ * @package To_Top
10
+ * @subpackage To_Top/includes
11
+ */
12
+
13
+ /**
14
+ * Fired during plugin activation.
15
+ *
16
+ * This class defines all code necessary to run during the plugin's activation.
17
+ *
18
+ * @since 1.0
19
+ * @package To_Top
20
+ * @subpackage To_Top/includes
21
+ * @author Catch Themes <info@catchthemes.com>
22
+ */
23
+ class To_Top_Activator {
24
+
25
+ /**
26
+ * Short Description. (use period)
27
+ *
28
+ * Long Description.
29
+ *
30
+ * @since 1.0
31
+ */
32
+ public static function activate() {
33
+
34
+ }
35
+
36
+ }
includes/class-to-top-deactivator.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Fired during plugin deactivation
5
+ *
6
+ * @link catchthemes.com
7
+ * @since 1.0
8
+ *
9
+ * @package To_Top
10
+ * @subpackage To_Top/includes
11
+ */
12
+
13
+ /**
14
+ * Fired during plugin deactivation.
15
+ *
16
+ * This class defines all code necessary to run during the plugin's deactivation.
17
+ *
18
+ * @since 1.0
19
+ * @package To_Top
20
+ * @subpackage To_Top/includes
21
+ * @author Catch Themes <info@catchthemes.com>
22
+ */
23
+ class To_Top_Deactivator {
24
+
25
+ /**
26
+ * Short Description. (use period)
27
+ *
28
+ * Long Description.
29
+ *
30
+ * @since 1.0
31
+ */
32
+ public static function deactivate() {
33
+
34
+ }
35
+
36
+ }
includes/class-to-top-i18n.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Define the internationalization functionality
5
+ *
6
+ * Loads and defines the internationalization files for this plugin
7
+ * so that it is ready for translation.
8
+ *
9
+ * @link catchthemes.com
10
+ * @since 1.0
11
+ *
12
+ * @package To_Top
13
+ * @subpackage To_Top/includes
14
+ */
15
+
16
+ /**
17
+ * Define the internationalization functionality.
18
+ *
19
+ * Loads and defines the internationalization files for this plugin
20
+ * so that it is ready for translation.
21
+ *
22
+ * @since 1.0
23
+ * @package To_Top
24
+ * @subpackage To_Top/includes
25
+ * @author Catch Themes <info@catchthemes.com>
26
+ */
27
+ class To_Top_i18n {
28
+
29
+
30
+ /**
31
+ * Load the plugin text domain for translation.
32
+ *
33
+ * @since 1.0
34
+ */
35
+ public function load_plugin_textdomain() {
36
+
37
+ load_plugin_textdomain(
38
+ 'to-top',
39
+ false,
40
+ dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
41
+ );
42
+
43
+ }
44
+
45
+
46
+
47
+ }
includes/class-to-top-loader.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Register all actions and filters for the plugin
5
+ *
6
+ * @link catchthemes.com
7
+ * @since 1.0
8
+ *
9
+ * @package To_Top
10
+ * @subpackage To_Top/includes
11
+ */
12
+
13
+ /**
14
+ * Register all actions and filters for the plugin.
15
+ *
16
+ * Maintain a list of all hooks that are registered throughout
17
+ * the plugin, and register them with the WordPress API. Call the
18
+ * run function to execute the list of actions and filters.
19
+ *
20
+ * @package To_Top
21
+ * @subpackage To_Top/includes
22
+ * @author Catch Themes <info@catchthemes.com>
23
+ */
24
+ class To_Top_Loader {
25
+
26
+ /**
27
+ * The array of actions registered with WordPress.
28
+ *
29
+ * @since 1.0
30
+ * @access protected
31
+ * @var array $actions The actions registered with WordPress to fire when the plugin loads.
32
+ */
33
+ protected $actions;
34
+
35
+ /**
36
+ * The array of filters registered with WordPress.
37
+ *
38
+ * @since 1.0
39
+ * @access protected
40
+ * @var array $filters The filters registered with WordPress to fire when the plugin loads.
41
+ */
42
+ protected $filters;
43
+
44
+ /**
45
+ * Initialize the collections used to maintain the actions and filters.
46
+ *
47
+ * @since 1.0
48
+ */
49
+ public function __construct() {
50
+
51
+ $this->actions = array();
52
+ $this->filters = array();
53
+
54
+ }
55
+
56
+ /**
57
+ * Add a new action to the collection to be registered with WordPress.
58
+ *
59
+ * @since 1.0
60
+ * @param string $hook The name of the WordPress action that is being registered.
61
+ * @param object $component A reference to the instance of the object on which the action is defined.
62
+ * @param string $callback The name of the function definition on the $component.
63
+ * @param int $priority Optional. he priority at which the function should be fired. Default is 10.
64
+ * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
65
+ */
66
+ public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
67
+ $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
68
+ }
69
+
70
+ /**
71
+ * Add a new filter to the collection to be registered with WordPress.
72
+ *
73
+ * @since 1.0
74
+ * @param string $hook The name of the WordPress filter that is being registered.
75
+ * @param object $component A reference to the instance of the object on which the filter is defined.
76
+ * @param string $callback The name of the function definition on the $component.
77
+ * @param int $priority Optional. he priority at which the function should be fired. Default is 10.
78
+ * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1
79
+ */
80
+ public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
81
+ $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
82
+ }
83
+
84
+ /**
85
+ * A utility function that is used to register the actions and hooks into a single
86
+ * collection.
87
+ *
88
+ * @since 1.0
89
+ * @access private
90
+ * @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
91
+ * @param string $hook The name of the WordPress filter that is being registered.
92
+ * @param object $component A reference to the instance of the object on which the filter is defined.
93
+ * @param string $callback The name of the function definition on the $component.
94
+ * @param int $priority The priority at which the function should be fired.
95
+ * @param int $accepted_args The number of arguments that should be passed to the $callback.
96
+ * @return array The collection of actions and filters registered with WordPress.
97
+ */
98
+ private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
99
+
100
+ $hooks[] = array(
101
+ 'hook' => $hook,
102
+ 'component' => $component,
103
+ 'callback' => $callback,
104
+ 'priority' => $priority,
105
+ 'accepted_args' => $accepted_args
106
+ );
107
+
108
+ return $hooks;
109
+
110
+ }
111
+
112
+ /**
113
+ * Register the filters and actions with WordPress.
114
+ *
115
+ * @since 1.0
116
+ */
117
+ public function run() {
118
+
119
+ foreach ( $this->filters as $hook ) {
120
+ add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
121
+ }
122
+
123
+ foreach ( $this->actions as $hook ) {
124
+ add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
125
+ }
126
+
127
+ }
128
+
129
+ }
includes/class-to-top.php ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The file that defines the core plugin class
5
+ *
6
+ * A class definition that includes attributes and functions used across both the
7
+ * public-facing side of the site and the admin area.
8
+ *
9
+ * @link catchthemes.com
10
+ * @since 1.0
11
+ *
12
+ * @package To_Top
13
+ * @subpackage To_Top/includes
14
+ */
15
+
16
+ /**
17
+ * The core plugin class.
18
+ *
19
+ * This is used to define internationalization, admin-specific hooks, and
20
+ * public-facing site hooks.
21
+ *
22
+ * Also maintains the unique identifier of this plugin as well as the current
23
+ * version of the plugin.
24
+ *
25
+ * @since 1.0
26
+ * @package To_Top
27
+ * @subpackage To_Top/includes
28
+ * @author Catch Themes <info@catchthemes.com>
29
+ */
30
+ class To_Top {
31
+
32
+ /**
33
+ * The loader that's responsible for maintaining and registering all hooks that power
34
+ * the plugin.
35
+ *
36
+ * @since 1.0
37
+ * @access protected
38
+ * @var To_Top_Loader $loader Maintains and registers all hooks for the plugin.
39
+ */
40
+ protected $loader;
41
+
42
+ /**
43
+ * The unique identifier of this plugin.
44
+ *
45
+ * @since 1.0
46
+ * @access protected
47
+ * @var string $plugin_name The string used to uniquely identify this plugin.
48
+ */
49
+ protected $plugin_name;
50
+
51
+ /**
52
+ * The current version of the plugin.
53
+ *
54
+ * @since 1.0
55
+ * @access protected
56
+ * @var string $version The current version of the plugin.
57
+ */
58
+ protected $version;
59
+
60
+ /**
61
+ * Define the core functionality of the plugin.
62
+ *
63
+ * Set the plugin name and the plugin version that can be used throughout the plugin.
64
+ * Load the dependencies, define the locale, and set the hooks for the admin area and
65
+ * the public-facing side of the site.
66
+ *
67
+ * @since 1.0
68
+ */
69
+ public function __construct() {
70
+
71
+ $this->plugin_name = 'to-top';
72
+ $this->version = '1.0';
73
+
74
+ $this->load_dependencies();
75
+ $this->set_locale();
76
+ $this->define_admin_hooks();
77
+ $this->define_public_hooks();
78
+
79
+ }
80
+
81
+ /**
82
+ * Load the required dependencies for this plugin.
83
+ *
84
+ * Include the following files that make up the plugin:
85
+ *
86
+ * - To_Top_Loader. Orchestrates the hooks of the plugin.
87
+ * - To_Top_i18n. Defines internationalization functionality.
88
+ * - To_Top_Admin. Defines all hooks for the admin area.
89
+ * - To_Top_Public. Defines all hooks for the public side of the site.
90
+ *
91
+ * Create an instance of the loader which will be used to register the hooks
92
+ * with WordPress.
93
+ *
94
+ * @since 1.0
95
+ * @access private
96
+ */
97
+ private function load_dependencies() {
98
+
99
+ /**
100
+ * The class responsible for orchestrating the actions and filters of the
101
+ * core plugin.
102
+ */
103
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-to-top-loader.php';
104
+
105
+ /**
106
+ * The class responsible for defining internationalization functionality
107
+ * of the plugin.
108
+ */
109
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-to-top-i18n.php';
110
+
111
+ /**
112
+ * The class responsible for defining all actions that occur in the admin area.
113
+ */
114
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-to-top-admin.php';
115
+
116
+
117
+ /**
118
+ * The class responsible for defining all actions that occur in the public-facing
119
+ * side of the site.
120
+ */
121
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-to-top-public.php';
122
+
123
+ $this->loader = new To_Top_Loader();
124
+
125
+ }
126
+
127
+ /**
128
+ * Define the locale for this plugin for internationalization.
129
+ *
130
+ * Uses the To_Top_i18n class in order to set the domain and to register the hook
131
+ * with WordPress.
132
+ *
133
+ * @since 1.0
134
+ * @access private
135
+ */
136
+ private function set_locale() {
137
+
138
+ $plugin_i18n = new To_Top_i18n();
139
+
140
+ $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
141
+
142
+ }
143
+
144
+ /**
145
+ * Register all of the hooks related to the admin area functionality
146
+ * of the plugin.
147
+ *
148
+ * @since 1.0
149
+ * @access private
150
+ */
151
+ private function define_admin_hooks() {
152
+
153
+ $plugin_admin = new To_Top_Admin( $this->get_plugin_name(), $this->get_version() );
154
+
155
+ $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
156
+ $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
157
+
158
+ $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_plugin_settings_menu' );
159
+ $this->loader->add_action( 'admin_init', $plugin_admin, 'register_settings' );
160
+ $this->loader->add_action( 'customize_register', $plugin_admin, 'customize_register' );
161
+
162
+ $this->loader->add_filter( 'plugin_action_links', $plugin_admin, 'action_links', 10, 2 );
163
+
164
+ $this->loader->add_action( 'customize_controls_enqueue_scripts', $plugin_admin, 'customizer_enqueue_styles' );
165
+
166
+ $this->loader->add_action( 'customize_preview_init', $plugin_admin, 'customizer_enqueue_scripts' );
167
+
168
+ }
169
+
170
+ /**
171
+ * Register all of the hooks related to the public-facing functionality
172
+ * of the plugin.
173
+ *
174
+ * @since 1.0
175
+ * @access private
176
+ */
177
+ private function define_public_hooks() {
178
+
179
+ $plugin_public = new To_Top_Public( $this->get_plugin_name(), $this->get_version() );
180
+
181
+ $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
182
+ $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
183
+
184
+
185
+ $this->loader->add_action( 'wp_head', $plugin_public, 'custom_css', 101 );
186
+ $this->loader->add_action( 'admin_head', $plugin_public, 'custom_css' );
187
+
188
+ $this->loader->add_action( 'wp_footer', $plugin_public, 'public_display' );
189
+ $this->loader->add_action( 'admin_footer', $plugin_public, 'public_display' );
190
+ }
191
+
192
+ /**
193
+ * Run the loader to execute all of the hooks with WordPress.
194
+ *
195
+ * @since 1.0
196
+ */
197
+ public function run() {
198
+ $this->loader->run();
199
+ }
200
+
201
+ /**
202
+ * The name of the plugin used to uniquely identify it within the context of
203
+ * WordPress and to define internationalization functionality.
204
+ *
205
+ * @since 1.0
206
+ * @return string The name of the plugin.
207
+ */
208
+ public function get_plugin_name() {
209
+ return $this->plugin_name;
210
+ }
211
+
212
+ /**
213
+ * The reference to the class that orchestrates the hooks with the plugin.
214
+ *
215
+ * @since 1.0
216
+ * @return To_Top_Loader Orchestrates the hooks of the plugin.
217
+ */
218
+ public function get_loader() {
219
+ return $this->loader;
220
+ }
221
+
222
+ /**
223
+ * Retrieve the version number of the plugin.
224
+ *
225
+ * @since 1.0
226
+ * @return string The version number of the plugin.
227
+ */
228
+ public function get_version() {
229
+ return $this->version;
230
+ }
231
+ }
includes/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
languages/to-top.pot ADDED
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2016 Catch Themes
2
+ # This file is distributed under the GNU General Public License v3.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: To Top\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tags/_s\n"
7
+ "POT-Creation-Date: 2016-01-29 13:14+0545\n"
8
+ "PO-Revision-Date: 2016-01-29 13:14+0545\n"
9
+ "Last-Translator: Sakin Shrestha <info@catchthemes.com>\n"
10
+ "Language-Team: Catch Themes <info@catchthemes.com>\n"
11
+ "Language: en_US\n"
12
+ "MIME-Version: 1.0\n"
13
+ "Content-Type: text/plain; charset=UTF-8\n"
14
+ "Content-Transfer-Encoding: 8bit\n"
15
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
16
+ "X-Generator: Poedit 1.7.1\n"
17
+ "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;esc_attr_e;esc_attr__;_nx;"
18
+ "esc_html__;esc_html_e\n"
19
+ "X-Poedit-Basepath: .\n"
20
+ "X-Poedit-SourceCharset: UTF-8\n"
21
+ "X-Poedit-SearchPath-0: ..\n"
22
+
23
+ #: ../admin/class-to-top-admin.php:133
24
+ msgid "Settings"
25
+ msgstr ""
26
+
27
+ #: ../admin/class-to-top-admin.php:146
28
+ msgid "To Top Settings"
29
+ msgstr ""
30
+
31
+ #: ../admin/class-to-top-admin.php:155
32
+ msgid "You do not have sufficient permissions to access this page."
33
+ msgstr ""
34
+
35
+ #: ../admin/class-to-top-admin.php:230
36
+ msgid "To Top Options"
37
+ msgstr ""
38
+
39
+ #: ../admin/class-to-top-admin.php:237
40
+ #: ../admin/partials/to-top-admin-display.php:88
41
+ msgid "Basic Settings"
42
+ msgstr ""
43
+
44
+ #: ../admin/class-to-top-admin.php:248
45
+ #: ../admin/partials/to-top-admin-display.php:93
46
+ msgid "Scroll Offset (px)"
47
+ msgstr ""
48
+
49
+ #: ../admin/class-to-top-admin.php:249
50
+ #: ../admin/partials/to-top-admin-display.php:98
51
+ msgid "Number of pixels to be scrolled before the button appears"
52
+ msgstr ""
53
+
54
+ #: ../admin/class-to-top-admin.php:269
55
+ #: ../admin/partials/to-top-admin-display.php:104
56
+ msgid "Icon Opacity (%)"
57
+ msgstr ""
58
+
59
+ #: ../admin/class-to-top-admin.php:289
60
+ #: ../admin/partials/to-top-admin-display.php:113
61
+ msgid "Style"
62
+ msgstr ""
63
+
64
+ #: ../admin/class-to-top-admin.php:294
65
+ #: ../admin/partials/to-top-admin-display.php:118
66
+ msgid "Icon"
67
+ msgstr ""
68
+
69
+ #: ../admin/class-to-top-admin.php:295 ../admin/class-to-top-admin.php:394
70
+ #: ../admin/partials/to-top-admin-display.php:119
71
+ #: ../admin/partials/to-top-admin-display.php:203
72
+ msgid "Image"
73
+ msgstr ""
74
+
75
+ #: ../admin/class-to-top-admin.php:307
76
+ #: ../admin/partials/to-top-admin-display.php:136
77
+ msgid "Select Icon Type"
78
+ msgstr ""
79
+
80
+ #: ../admin/class-to-top-admin.php:322
81
+ #: ../admin/partials/to-top-admin-display.php:153
82
+ msgid "Icon Color"
83
+ msgstr ""
84
+
85
+ #: ../admin/class-to-top-admin.php:337
86
+ #: ../admin/partials/to-top-admin-display.php:163
87
+ msgid "Icon Background Color"
88
+ msgstr ""
89
+
90
+ #: ../admin/class-to-top-admin.php:352
91
+ #: ../admin/partials/to-top-admin-display.php:173
92
+ msgid "Icon Size (px)"
93
+ msgstr ""
94
+
95
+ #: ../admin/class-to-top-admin.php:372
96
+ #: ../admin/partials/to-top-admin-display.php:182
97
+ msgid "Border Radius (%)"
98
+ msgstr ""
99
+
100
+ #: ../admin/class-to-top-admin.php:373
101
+ #: ../admin/partials/to-top-admin-display.php:187
102
+ msgid "0 will make the icon background square, 50 will make it a circle"
103
+ msgstr ""
104
+
105
+ #: ../admin/class-to-top-admin.php:410
106
+ #: ../admin/partials/to-top-admin-display.php:211
107
+ msgid "Image Width (px)"
108
+ msgstr ""
109
+
110
+ #: ../admin/class-to-top-admin.php:431
111
+ #: ../admin/partials/to-top-admin-display.php:220
112
+ msgid "Image Alt"
113
+ msgstr ""
114
+
115
+ #: ../admin/class-to-top-admin.php:446
116
+ #: ../admin/partials/to-top-admin-display.php:233
117
+ msgid "Advanced Settings"
118
+ msgstr ""
119
+
120
+ #: ../admin/class-to-top-admin.php:457
121
+ #: ../admin/partials/to-top-admin-display.php:238
122
+ msgid "Location"
123
+ msgstr ""
124
+
125
+ #: ../admin/class-to-top-admin.php:463
126
+ #: ../admin/partials/to-top-admin-display.php:243
127
+ msgid "Bottom Right"
128
+ msgstr ""
129
+
130
+ #: ../admin/class-to-top-admin.php:464
131
+ #: ../admin/partials/to-top-admin-display.php:244
132
+ msgid "Bottom Left"
133
+ msgstr ""
134
+
135
+ #: ../admin/class-to-top-admin.php:465
136
+ #: ../admin/partials/to-top-admin-display.php:245
137
+ msgid "Top Right"
138
+ msgstr ""
139
+
140
+ #: ../admin/class-to-top-admin.php:466
141
+ #: ../admin/partials/to-top-admin-display.php:246
142
+ msgid "Top Left"
143
+ msgstr ""
144
+
145
+ #: ../admin/class-to-top-admin.php:478
146
+ #: ../admin/partials/to-top-admin-display.php:253
147
+ msgid "Margin X (px)"
148
+ msgstr ""
149
+
150
+ #: ../admin/class-to-top-admin.php:498
151
+ #: ../admin/partials/to-top-admin-display.php:262
152
+ msgid "Margin Y (px)"
153
+ msgstr ""
154
+
155
+ #: ../admin/class-to-top-admin.php:518
156
+ msgid "Check to show on WP-ADMIN"
157
+ msgstr ""
158
+
159
+ #: ../admin/class-to-top-admin.php:519
160
+ #: ../admin/partials/to-top-admin-display.php:276
161
+ msgid "Button will be shown on admin section"
162
+ msgstr ""
163
+
164
+ #: ../admin/class-to-top-admin.php:533
165
+ msgid "Check to Enable Auto Hide"
166
+ msgstr ""
167
+
168
+ #: ../admin/class-to-top-admin.php:548
169
+ #: ../admin/partials/to-top-admin-display.php:292
170
+ msgid "Auto Hide Time (secs)"
171
+ msgstr ""
172
+
173
+ #: ../admin/class-to-top-admin.php:549
174
+ #: ../admin/partials/to-top-admin-display.php:297
175
+ msgid "Button will be auto hidden after this duration in seconds, if enabled"
176
+ msgstr ""
177
+
178
+ #: ../admin/class-to-top-admin.php:569
179
+ msgid "Check to Hide on Small Devices"
180
+ msgstr ""
181
+
182
+ #: ../admin/class-to-top-admin.php:570
183
+ #: ../admin/partials/to-top-admin-display.php:308
184
+ msgid "Button will be hidden on small devices when the width below matches"
185
+ msgstr ""
186
+
187
+ #: ../admin/class-to-top-admin.php:584
188
+ #: ../admin/partials/to-top-admin-display.php:314
189
+ msgid "Small Device Max Width (px)"
190
+ msgstr ""
191
+
192
+ #: ../admin/class-to-top-admin.php:585
193
+ #: ../admin/partials/to-top-admin-display.php:319
194
+ msgid "Button will be hidden on devices with lesser or equal width"
195
+ msgstr ""
196
+
197
+ #: ../admin/class-to-top-admin.php:604
198
+ #: ../admin/partials/to-top-admin-display.php:329
199
+ msgid "Reset Settings"
200
+ msgstr ""
201
+
202
+ #: ../admin/class-to-top-admin.php:615
203
+ #: ../admin/partials/to-top-admin-display.php:338
204
+ msgid "Check to Reset All Settings"
205
+ msgstr ""
206
+
207
+ #: ../admin/class-to-top-admin.php:616
208
+ msgid ""
209
+ "Caution: All data will be lost. Refresh the page after save to view full "
210
+ "effects."
211
+ msgstr ""
212
+
213
+ #: ../admin/partials/to-top-admin-display.php:28
214
+ msgid "Follow @catchthemes"
215
+ msgstr ""
216
+
217
+ #: ../admin/partials/to-top-admin-display.php:34
218
+ msgid "To Top By"
219
+ msgstr ""
220
+
221
+ #: ../admin/partials/to-top-admin-display.php:36
222
+ msgid "http://catchthemes.com/"
223
+ msgstr ""
224
+
225
+ #: ../admin/partials/to-top-admin-display.php:36
226
+ #: ../admin/partials/to-top-admin-display.php:38
227
+ msgid "Catch Themes"
228
+ msgstr ""
229
+
230
+ #: ../admin/partials/to-top-admin-display.php:46
231
+ msgid "http://catchthemes.com/forum/to-top/"
232
+ msgstr ""
233
+
234
+ #: ../admin/partials/to-top-admin-display.php:46
235
+ msgid "Support Forum"
236
+ msgstr ""
237
+
238
+ #: ../admin/partials/to-top-admin-display.php:49
239
+ msgid "http://catchthemes.com/wp-plugins/to-top/"
240
+ msgstr ""
241
+
242
+ #: ../admin/partials/to-top-admin-display.php:49
243
+ msgid "Plugin Details"
244
+ msgstr ""
245
+
246
+ #: ../admin/partials/to-top-admin-display.php:52
247
+ msgid "https://www.facebook.com/catchthemes/"
248
+ msgstr ""
249
+
250
+ #: ../admin/partials/to-top-admin-display.php:52
251
+ msgid "Like Catch Themes on Facebook"
252
+ msgstr ""
253
+
254
+ #: ../admin/partials/to-top-admin-display.php:52
255
+ msgid "Facebook"
256
+ msgstr ""
257
+
258
+ #: ../admin/partials/to-top-admin-display.php:55
259
+ msgid "https://twitter.com/catchthemes/"
260
+ msgstr ""
261
+
262
+ #: ../admin/partials/to-top-admin-display.php:55
263
+ msgid "Follow Catch Themes on Twitter"
264
+ msgstr ""
265
+
266
+ #: ../admin/partials/to-top-admin-display.php:55
267
+ msgid "Twitter"
268
+ msgstr ""
269
+
270
+ #: ../admin/partials/to-top-admin-display.php:58
271
+ msgid "http://wordpress.org/support/view/plugin-reviews/to-top"
272
+ msgstr ""
273
+
274
+ #: ../admin/partials/to-top-admin-display.php:58
275
+ msgid "Rate us 5 Star on WordPress"
276
+ msgstr ""
277
+
278
+ #: ../admin/partials/to-top-admin-display.php:58
279
+ msgid "5 Star Rating"
280
+ msgstr ""
281
+
282
+ #: ../admin/partials/to-top-admin-display.php:66
283
+ msgid "Plugin Options Saved."
284
+ msgstr ""
285
+
286
+ #: ../admin/partials/to-top-admin-display.php:79
287
+ msgid "Customizer"
288
+ msgstr ""
289
+
290
+ #: ../admin/partials/to-top-admin-display.php:81
291
+ msgid "Want Live Preview? Change the settings from "
292
+ msgstr ""
293
+
294
+ #: ../admin/partials/to-top-admin-display.php:127
295
+ #: ../admin/partials/to-top-admin-display.php:193
296
+ #: ../admin/partials/to-top-admin-display.php:229
297
+ #: ../admin/partials/to-top-admin-display.php:326
298
+ #: ../admin/partials/to-top-admin-display.php:346
299
+ msgid "Save Changes"
300
+ msgstr ""
301
+
302
+ #: ../admin/partials/to-top-admin-display.php:131
303
+ msgid "Icon Settings"
304
+ msgstr ""
305
+
306
+ #: ../admin/partials/to-top-admin-display.php:198
307
+ msgid "Image Settings"
308
+ msgstr ""
309
+
310
+ #: ../admin/partials/to-top-admin-display.php:206
311
+ msgid "Insert Image"
312
+ msgstr ""
313
+
314
+ #: ../admin/partials/to-top-admin-display.php:206
315
+ msgid "Change Image"
316
+ msgstr ""
317
+
318
+ #: ../admin/partials/to-top-admin-display.php:271
319
+ msgid "Show on WP-ADMIN?"
320
+ msgstr ""
321
+
322
+ #: ../admin/partials/to-top-admin-display.php:275
323
+ #: ../admin/partials/to-top-admin-display.php:286
324
+ #: ../admin/partials/to-top-admin-display.php:307
325
+ msgid "Check to Enable"
326
+ msgstr ""
327
+
328
+ #: ../admin/partials/to-top-admin-display.php:282
329
+ msgid "Enable Auto Hide"
330
+ msgstr ""
331
+
332
+ #: ../admin/partials/to-top-admin-display.php:303
333
+ msgid "Hide on Small Devices?"
334
+ msgstr ""
335
+
336
+ #: ../admin/partials/to-top-admin-display.php:334
337
+ msgid "Reset All Settings"
338
+ msgstr ""
339
+
340
+ #: ../admin/partials/to-top-admin-display.php:339
341
+ msgid "Caution: All data will be lost"
342
+ msgstr ""
343
+
344
+ #: ../public/class-to-top-public.php:126
345
+ msgid "Scroll Up"
346
+ msgstr ""
public/class-to-top-public.php ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The public-facing functionality of the plugin.
5
+ *
6
+ * @link catchthemes.com
7
+ * @since 1.0
8
+ *
9
+ * @package To_Top
10
+ * @subpackage To_Top/public
11
+ */
12
+
13
+ /**
14
+ * The public-facing functionality of the plugin.
15
+ *
16
+ * Defines the plugin name, version, and two examples hooks for how to
17
+ * enqueue the admin-specific stylesheet and JavaScript.
18
+ *
19
+ * @package To_Top
20
+ * @subpackage To_Top/public
21
+ * @author Catch Themes <info@catchthemes.com>
22
+ */
23
+ class To_Top_Public {
24
+
25
+ /**
26
+ * The ID of this plugin.
27
+ *
28
+ * @since 1.0
29
+ * @access private
30
+ * @var string $plugin_name The ID of this plugin.
31
+ */
32
+ private $plugin_name;
33
+
34
+ /**
35
+ * The version of this plugin.
36
+ *
37
+ * @since 1.0
38
+ * @access private
39
+ * @var string $version The current version of this plugin.
40
+ */
41
+ private $version;
42
+
43
+ /**
44
+ * Initialize the class and set its properties.
45
+ *
46
+ * @since 1.0
47
+ * @param string $plugin_name The name of the plugin.
48
+ * @param string $version The version of this plugin.
49
+ */
50
+ public function __construct( $plugin_name, $version ) {
51
+
52
+ $this->plugin_name = $plugin_name;
53
+ $this->version = $version;
54
+
55
+ }
56
+
57
+ /**
58
+ * Register the stylesheets for the public-facing side of the site.
59
+ *
60
+ * @since 1.0
61
+ */
62
+ public function enqueue_styles() {
63
+
64
+ /**
65
+ * This function is provided for demonstration purposes only.
66
+ *
67
+ * An instance of this class should be passed to the run() function
68
+ * defined in To_Top_Loader as all of the hooks are defined
69
+ * in that particular class.
70
+ *
71
+ * The To_Top_Loader will then create the relationship
72
+ * between the defined hooks and the functions defined in this
73
+ * class.
74
+ */
75
+
76
+ $option = to_top_get_options();
77
+
78
+ if ( 'icon' == $option['style'] ) {
79
+ //Load Dashicon if icon style type is chosen
80
+ wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/to-top-public.css', array( 'dashicons' ), $this->version, 'all' );
81
+ }
82
+ else {
83
+ wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/to-top-public.css', array(), $this->version, 'all' );
84
+ }
85
+
86
+ }
87
+
88
+ /**
89
+ * Register the JavaScript for the public-facing side of the site.
90
+ *
91
+ * @since 1.0
92
+ */
93
+ public function enqueue_scripts() {
94
+
95
+ /**
96
+ * This function is provided for demonstration purposes only.
97
+ *
98
+ * An instance of this class should be passed to the run() function
99
+ * defined in To_Top_Loader as all of the hooks are defined
100
+ * in that particular class.
101
+ *
102
+ * The To_Top_Loader will then create the relationship
103
+ * between the defined hooks and the functions defined in this
104
+ * class.
105
+ */
106
+
107
+ $option = to_top_get_options();
108
+
109
+ wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/to-top-public.js', array( 'jquery' ), $this->version, false );
110
+
111
+ // Localize the script with new data
112
+ wp_localize_script( $this->plugin_name, 'to_top_options', $option );
113
+
114
+ }
115
+
116
+ public function public_display() {
117
+
118
+ $option = to_top_get_options();
119
+
120
+ if ( is_admin() && !$option['show_on_admin'] ) {
121
+ //Bail early if in admin and show on admin is disabled
122
+ return;
123
+ }
124
+
125
+ if ( 'icon' == $option['style'] ) {
126
+ echo '<div id="to_top_scrollup" class="dashicons ' . esc_attr( $option['icon_type'] ) .'"><span class="screen-reader-text">' . __( 'Scroll Up', 'to-top' ) . '</span></div>' ;
127
+ }
128
+ else {
129
+ echo '<div id="to_top_scrollup"><img alt="' . esc_attr( $option['image_alt'] ) . '" src="' . esc_url( $option['image'] ) . '"/></div>' ;
130
+ }
131
+ }
132
+
133
+ public function custom_css() {
134
+ $custom_css = '';
135
+
136
+ $option = to_top_get_options();
137
+
138
+ if ( is_admin() && !$option['show_on_admin'] ) {
139
+ return $custom_css;
140
+ }
141
+
142
+ $default = to_top_default_options();
143
+
144
+ if( $option != $default ) {
145
+ if ( 'image' == $option['style'] ) {
146
+ $custom_css .= 'background-color: transparent; color: transparent; height: auto; width: 65px;';
147
+ if ( $default['image_width'] != $option['image_width'] ) {
148
+ $custom_css .= 'width: ' . esc_attr( $option['image_width'] ) . 'px;';
149
+ }
150
+ }
151
+ else {
152
+ //Type is icon
153
+ if ( $default['icon_color'] != $option['icon_color'] ) {
154
+ $custom_css .= 'color: ' . esc_attr( $option['icon_color'] ) . ';';
155
+ }
156
+
157
+ if ( $default['icon_size'] != $option['icon_size'] ) {
158
+ $custom_css .= 'font-size: ' . esc_attr( $option['icon_size'] ) . 'px; width: ' . esc_attr( $option['icon_size'] ) . 'px; height: ' . esc_attr( $option['icon_size'] ) . 'px;';
159
+ }
160
+
161
+ if ( $default['icon_bg_color'] != $option['icon_bg_color'] ) {
162
+ $custom_css .= 'background-color: ' . esc_attr( $option['icon_bg_color'] ) . ';';
163
+ }
164
+
165
+ if ( $default['border_radius'] != $option['border_radius'] ) {
166
+ $custom_css .= '-webkit-border-radius: ' . esc_attr( $option['border_radius'] ) . '%; -moz-border-radius: ' . esc_attr( $option['border_radius'] ) . '%; border-radius: ' . esc_attr( $option['border_radius'] ) . '%;';
167
+ }
168
+ }
169
+
170
+ if ( $default['icon_opacity'] != $option['icon_opacity'] ) {
171
+ $custom_css .= 'opacity: ' . esc_attr( $option['icon_opacity'] / 100 ) . ';';
172
+ }
173
+
174
+ if ( $default['location'] != $option['location'] || $default['margin_x'] != $option['margin_x'] || $default['margin_x'] != $option['margin_x'] ) {
175
+ $offset = explode( '-', $option['location'] );
176
+ $offset1 = $offset[0];
177
+ $offset2 = $offset[1];
178
+
179
+ $custom_css .= esc_attr( $offset2 ) . ':' . esc_attr( $option['margin_x'] ) . 'px;';
180
+ $custom_css .= esc_attr( $offset1 ) . ':' . esc_attr( $option['margin_y'] ) . 'px;';
181
+
182
+ }
183
+ }
184
+
185
+ if ( '' != $custom_css ) {
186
+ $custom_css = "<!-- To Top Custom CSS --><style type='text/css'>#to_top_scrollup {" . $custom_css . "}</style>";
187
+ }
188
+
189
+ echo $custom_css;
190
+ }
191
+ }
public/css/to-top-public.css ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * All of the CSS for your public-facing functionality should be
3
+ * included in this file.
4
+ */
5
+
6
+ #to_top_scrollup {
7
+ background-color: #000;
8
+ -webkit-border-radius: 5%;
9
+ -moz-border-radius: 5%;
10
+ border-radius: 5%;
11
+ box-sizing: content-box;
12
+ bottom: 20px;
13
+ color: #fff;
14
+ cursor: pointer;
15
+ font-size: 32px;
16
+ height: 32px;
17
+ opacity: 0.5;
18
+ padding: 5px;
19
+ position: fixed;
20
+ right: 20px;
21
+ text-decoration: none;
22
+ vertical-align: top;
23
+ width: 32px;
24
+ z-index: 9999;
25
+ }
26
+
27
+ #to_top_scrollup img{
28
+ width: 100%;
29
+ }
30
+
31
+ .screen-reader-text {
32
+ clip: rect(1px, 1px, 1px, 1px);
33
+ position: absolute !important;
34
+ height: 1px;
35
+ width: 1px;
36
+ overflow: hidden;
37
+ }
public/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
public/js/to-top-public.js ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*(function($) {
2
+ "use strict";
3
+ $(function() {
4
+ if ("undefined" != typeof to_top_options.enable_hide_small_device && "1" == to_top_options.enable_hide_small_device) {
5
+ if ($(window).width() > to_top_options.small_device_max_width) {
6
+ $(window).scroll(function() {
7
+ if ($(this).scrollTop() > to_top_options.scroll_offset) {
8
+ if ("undefined" != typeof to_top_options.enable_autohide && "1" == to_top_options.enable_autohide) {
9
+ $("#to_top_scrollup").fadeIn("slow");
10
+ setTimeout(function() {
11
+ $("#to_top_scrollup").hide();
12
+ }, to_top_options.autohide_time * 1e3);
13
+ } else {
14
+ $("#to_top_scrollup").fadeIn("slow");
15
+ $("#to_top_scrollup").show();
16
+ }
17
+ } else {
18
+ $("#to_top_scrollup").fadeOut("slow");
19
+ $("#to_top_scrollup").hide();
20
+ }
21
+ });
22
+ $("#to_top_scrollup").click(function() {
23
+ $("body,html").animate({
24
+ scrollTop: 0
25
+ }, 500);
26
+ return false;
27
+ });
28
+ }
29
+ } else {
30
+ $(window).scroll(function() {
31
+ if ($(this).scrollTop() > to_top_options.scroll_offset) {
32
+ if ("undefined" != typeof to_top_options.enable_autohide && "1" == to_top_options.enable_autohide) {
33
+ $("#to_top_scrollup").fadeIn("slow");
34
+ setTimeout(function() {
35
+ $("#to_top_scrollup").hide();
36
+ }, to_top_options.autohide_time * 1e3);
37
+ } else {
38
+ $("#to_top_scrollup").fadeIn("slow");
39
+ $("#to_top_scrollup").show();
40
+ }
41
+ } else {
42
+ $("#to_top_scrollup").fadeOut("slow");
43
+ $("#to_top_scrollup").hide();
44
+ }
45
+ });
46
+ $("#to_top_scrollup").click(function() {
47
+ $("body,html").animate({
48
+ scrollTop: 0
49
+ }, 500);
50
+ return false;
51
+ });
52
+ }
53
+ });
54
+ })(jQuery);*/
55
+
56
+ (function($) {
57
+ "use strict";
58
+ $(function() {
59
+ var container = $("#to_top_scrollup").css({
60
+ 'opacity': 0
61
+ });
62
+ var data = to_top_options;
63
+
64
+ var mouse_over = false;
65
+ var hideEventID = 0;
66
+
67
+ var fnHide = function() {
68
+ clearTimeout(hideEventID);
69
+ if (container.is(":visible")) {
70
+ container.stop().fadeTo(200, 0, function() {
71
+ container.hide();
72
+ mouse_over = false;
73
+ });
74
+ }
75
+ };
76
+
77
+ var fnHideEvent = function() {
78
+ if (!mouse_over && data.enable_autohide == 1 ) {
79
+ clearTimeout(hideEventID);
80
+ hideEventID = setTimeout(function() {
81
+ fnHide();
82
+ }, data.autohide_time * 1000);
83
+ }
84
+ };
85
+
86
+ var scrollHandled = false;
87
+ var fnScroll = function() {
88
+ if (scrollHandled)
89
+ return;
90
+
91
+ scrollHandled = true;
92
+
93
+ if ($(window).scrollTop() > data.scroll_offset) {
94
+ container.stop().css("opacity", mouse_over ? 1 : parseFloat(data.icon_opacity/100)).show();
95
+
96
+ fnHideEvent();
97
+
98
+ } else {
99
+ fnHide();
100
+ }
101
+
102
+ scrollHandled = false;
103
+ };
104
+
105
+ if ("undefined" != typeof to_top_options.enable_hide_small_device && "1" == to_top_options.enable_hide_small_device) {
106
+ if ($(window).width() > to_top_options.small_device_max_width) {
107
+ $(window).scroll(fnScroll);
108
+ $(document).scroll(fnScroll);
109
+ }
110
+ }else{
111
+ $(window).scroll(fnScroll);
112
+ $(document).scroll(fnScroll);
113
+ }
114
+
115
+ container
116
+ .hover(function() {
117
+ clearTimeout(hideEventID);
118
+ mouse_over = true;
119
+ $(this).css("opacity", 1);
120
+ }, function() {
121
+ $(this).css("opacity", parseFloat(data.icon_opacity/100));
122
+ mouse_over = false;
123
+ fnHideEvent();
124
+ })
125
+ .click(function() {
126
+ $("html, body").animate({
127
+ scrollTop: 0
128
+ }, 400);
129
+ return false;
130
+ });
131
+ });
132
+ })(jQuery);
screenshot-1.jpg ADDED
Binary file
screenshot-2.jpg ADDED
Binary file
screenshot-3.jpg ADDED
Binary file
screenshot-4.jpg ADDED
Binary file
screenshot-5.jpg ADDED
Binary file
to-top.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The plugin bootstrap file
5
+ *
6
+ * This file is read by WordPress to generate the plugin information in the plugin
7
+ * admin area. This file also includes all of the dependencies used by the plugin,
8
+ * registers the activation and deactivation functions, and defines a function
9
+ * that starts the plugin.
10
+ *
11
+ * @link catchthemes.com
12
+ * @since 1.0
13
+ * @package To_Top
14
+ *
15
+ * @wordpress-plugin
16
+ * Plugin Name: To Top
17
+ * Plugin URI: catchthemes.com/wp-plugins/to-top
18
+ * Description: To Top plugin allows the visitor as well as admin to easily scroll back to the top of the page, with fully customizable options and ability to use image.
19
+ * Version: 1.0
20
+ * Author: Catch Themes
21
+ * Author URI: catchthemes.com
22
+ * License: GNU General Public License, version 3 (GPLv3)
23
+ * License URI: http://www.gnu.org/licenses/gpl-3.0.txt
24
+ * Text Domain: to-top
25
+ * Domain Path: /languages
26
+ */
27
+
28
+ // If this file is called directly, abort.
29
+ if ( ! defined( 'WPINC' ) ) {
30
+ die;
31
+ }
32
+
33
+ /**
34
+ * The code that runs during plugin activation.
35
+ * This action is documented in includes/class-to-top-activator.php
36
+ */
37
+ function activate_to_top() {
38
+ require_once plugin_dir_path( __FILE__ ) . 'includes/class-to-top-activator.php';
39
+ To_Top_Activator::activate();
40
+ }
41
+
42
+ /**
43
+ * The code that runs during plugin deactivation.
44
+ * This action is documented in includes/class-to-top-deactivator.php
45
+ */
46
+ function deactivate_to_top() {
47
+ require_once plugin_dir_path( __FILE__ ) . 'includes/class-to-top-deactivator.php';
48
+ To_Top_Deactivator::deactivate();
49
+ }
50
+
51
+ register_activation_hook( __FILE__, 'activate_to_top' );
52
+ register_deactivation_hook( __FILE__, 'deactivate_to_top' );
53
+
54
+ /**
55
+ * The core plugin class that is used to define internationalization,
56
+ * admin-specific hooks, and public-facing site hooks.
57
+ */
58
+ require plugin_dir_path( __FILE__ ) . 'includes/class-to-top.php';
59
+
60
+ /**
61
+ * Begins execution of the plugin.
62
+ *
63
+ * Since everything within the plugin is registered via hooks,
64
+ * then kicking off the plugin from this point in the file does
65
+ * not affect the page life cycle.
66
+ *
67
+ * @since 1.0
68
+ */
69
+ function run_to_top() {
70
+
71
+ $plugin = new To_Top();
72
+ $plugin->run();
73
+
74
+ }
75
+ run_to_top();
76
+
77
+ /**
78
+ * Returns the options array for Top options
79
+ *
80
+ * @since 1.0
81
+ */
82
+ function to_top_get_options(){
83
+ $to_top_default_options = to_top_default_options();
84
+
85
+ return array_merge( $to_top_default_options , get_option( 'to_top_options', $to_top_default_options ) ) ;
86
+ }
87
+
88
+ /**
89
+ * Return array of default options
90
+ *
91
+ * @since 1.0
92
+ * @return array default options.
93
+ */
94
+ function to_top_default_options( $option = null ) {
95
+ $default_options = array(
96
+ //Basic Settings
97
+ 'scroll_offset' => '100',
98
+ 'icon_opacity' => '50',
99
+ 'style' => 'icon',
100
+
101
+ //Icon Settings
102
+ 'icon_type' => 'dashicons-arrow-up-alt2',
103
+ 'icon_color' => '#ffffff',
104
+ 'icon_bg_color' => '#000000',
105
+ 'icon_size' => '32',
106
+ 'border_radius' => '5',
107
+
108
+ //Image Settings
109
+ 'image' => plugin_dir_url( __FILE__ ).'admin/images/default.png',
110
+ 'image_width' => '65',
111
+ 'image_alt' => '',
112
+
113
+
114
+
115
+ //Advanced Settings
116
+ 'location' => 'bottom-right',
117
+ 'margin_x' => '20',
118
+ 'margin_y' => '20',
119
+ 'show_on_admin' => 0,
120
+ 'enable_autohide' => 0,
121
+ 'autohide_time' => '2',
122
+ 'enable_hide_small_device' => 0,
123
+ 'small_device_max_width' => '640',
124
+
125
+ //Reset Settings
126
+ 'reset' => 0,
127
+ );
128
+
129
+ if ( null == $option ) {
130
+ return apply_filters( 'to_top_options', $default_options );
131
+ }
132
+ else {
133
+ return $default_options[ $option ];
134
+ }
135
+ }
uninstall.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Fired when the plugin is uninstalled.
5
+ *
6
+ * When populating this file, consider the following flow
7
+ * of control:
8
+ *
9
+ * - This method should be static
10
+ * - Check if the $_REQUEST content actually is the plugin name
11
+ * - Run an admin referrer check to make sure it goes through authentication
12
+ * - Verify the output of $_GET makes sense
13
+ * - Repeat with other user roles. Best directly by using the links/query string parameters.
14
+ * - Repeat things for multisite. Once for a single site in the network, once sitewide.
15
+ *
16
+ * This file may be updated more in future version of the Boilerplate; however, this is the
17
+ * general skeleton and outline for how the file should work.
18
+ *
19
+ * For more information, see the following discussion:
20
+ * https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/pull/123#issuecomment-28541913
21
+ *
22
+ * @link catchthemes.com
23
+ * @since 1.0
24
+ *
25
+ * @package To_Top
26
+ */
27
+
28
+ // If uninstall not called from WordPress, then exit.
29
+ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
30
+ exit;
31
+ }
32
+
33
+ $option_name = 'to_top_options';
34
+
35
+ delete_option( $option_name );
36
+
37
+ // For site options in Multisite
38
+ delete_site_option( $option_name );