WooCommerce Wishlist Plugin - Version 1.5.1

Version Description

Release Date - 14 August 2017

  • Fixed a fatal error on Dashboard menu
  • Minor CSS fixes
  • Added support for plugins/woocommerce add-ons:
    • WooCommerce Quantity Increment
Download this release

Release Info

Developer templateinvaders
Plugin Icon 128x128 WooCommerce Wishlist Plugin
Version 1.5.1
Comparing to
See all releases

Code changes from version 1.5.0 to 1.5.1

Files changed (76) hide show
  1. admin/basesection.helper.php +31 -16
  2. freemius/LICENSE.txt +340 -340
  3. freemius/README.md +253 -0
  4. freemius/assets/css/admin/account.css +1 -1
  5. freemius/assets/css/admin/add-ons.css +2 -2
  6. freemius/assets/css/admin/checkout.css +1 -1
  7. freemius/assets/css/admin/common.css +2 -2
  8. freemius/assets/css/admin/connect.css +1 -1
  9. freemius/assets/css/admin/deactivation-feedback.css +1 -1
  10. freemius/assets/css/admin/debug.css +1 -1
  11. freemius/assets/css/admin/license-activation.css +1 -1
  12. freemius/assets/index.php +2 -2
  13. freemius/assets/js/nojquery.ba-postmessage.js +139 -139
  14. freemius/assets/js/nojquery.ba-postmessage.min.js +11 -11
  15. freemius/assets/js/postmessage.js +134 -134
  16. freemius/assets/scss/admin/_deactivation-feedback.scss +54 -54
  17. freemius/assets/scss/admin/_license-activation.scss +6 -6
  18. freemius/assets/scss/admin/_license-key-resend.scss +68 -68
  19. freemius/assets/scss/admin/account.scss +249 -249
  20. freemius/assets/scss/admin/add-ons.scss +448 -448
  21. freemius/assets/scss/admin/checkout.scss +4 -4
  22. freemius/assets/scss/admin/common.scss +172 -172
  23. freemius/assets/scss/admin/debug.scss +134 -134
  24. freemius/includes/class-fs-api.php +557 -557
  25. freemius/includes/class-fs-security.php +85 -85
  26. freemius/includes/debug/index.php +2 -2
  27. freemius/includes/entities/class-fs-billing.php +94 -94
  28. freemius/includes/entities/class-fs-entity.php +148 -148
  29. freemius/includes/entities/class-fs-payment.php +93 -93
  30. freemius/includes/entities/class-fs-plugin-info.php +33 -33
  31. freemius/includes/entities/class-fs-plugin-license.php +224 -224
  32. freemius/includes/entities/class-fs-plugin-plan.php +144 -144
  33. freemius/includes/entities/class-fs-plugin-tag.php +23 -23
  34. freemius/includes/entities/class-fs-plugin.php +93 -93
  35. freemius/includes/entities/class-fs-pricing.php +140 -140
  36. freemius/includes/entities/class-fs-scope-entity.php +28 -28
  37. freemius/includes/entities/class-fs-site.php +147 -147
  38. freemius/includes/entities/class-fs-subscription.php +124 -124
  39. freemius/includes/entities/class-fs-user.php +61 -61
  40. freemius/includes/entities/index.php +2 -2
  41. freemius/includes/index.php +2 -2
  42. freemius/includes/l10n.php +250 -250
  43. freemius/includes/managers/class-fs-cache-manager.php +236 -236
  44. freemius/includes/managers/class-fs-key-value-storage.php +325 -325
  45. freemius/includes/managers/class-fs-license-manager.php +103 -103
  46. freemius/includes/managers/class-fs-option-manager.php +301 -301
  47. freemius/includes/managers/class-fs-plan-manager.php +161 -161
  48. freemius/includes/managers/class-fs-plugin-manager.php +153 -153
  49. freemius/includes/managers/index.php +2 -2
  50. freemius/includes/sdk/Exceptions/index.php +2 -2
  51. freemius/includes/sdk/LICENSE.txt +340 -340
  52. freemius/includes/sdk/index.php +2 -2
  53. freemius/includes/supplements/fs-essential-functions-1.1.7.1.php +47 -47
  54. freemius/includes/supplements/index.php +2 -2
  55. freemius/index.php +2 -2
  56. freemius/languages/index.php +2 -2
  57. freemius/templates/add-trial-to-pricing.php +30 -30
  58. freemius/templates/all-admin-notice.php +38 -38
  59. freemius/templates/checkout-legacy.php +242 -242
  60. freemius/templates/contact.php +87 -87
  61. freemius/templates/debug/index.php +2 -2
  62. freemius/templates/email.php +48 -48
  63. freemius/templates/firewall-issues-js.php +59 -59
  64. freemius/templates/forms/deactivation/index.php +2 -2
  65. freemius/templates/forms/index.php +2 -2
  66. freemius/templates/index.php +2 -2
  67. freemius/templates/plugin-icon.php +127 -127
  68. freemius/templates/plugin-info/index.php +2 -2
  69. freemius/templates/powered-by.php +38 -38
  70. freemius/templates/pricing.php +121 -121
  71. freemius/templates/sticky-admin-notice-js.php +39 -39
  72. includes/product.helper.php +1 -1
  73. readme.txt +9 -1
  74. templates/ti-wishlist-user.php +1 -1
  75. templates/ti-wishlist.php +1 -1
  76. ti-woocommerce-wishlist.php +2 -2
admin/basesection.helper.php CHANGED
@@ -30,9 +30,9 @@ abstract class TInvWL_Admin_BaseSection extends TInvWL_Admin_Base {
30
  * @param string $version Plugin version.
31
  */
32
  function __construct( $plugin_name, $version ) {
33
- $this->_n = $plugin_name;
34
- $this->_v = $version;
35
- $menu = $this->menu();
36
  if ( ! empty( $menu ) ) {
37
  add_action( $this->_n . '_admin_menu', array( $this, 'adminmenu' ), $this->priority );
38
  }
@@ -43,10 +43,17 @@ abstract class TInvWL_Admin_BaseSection extends TInvWL_Admin_Base {
43
  * Add item to admin menu
44
  *
45
  * @param array $data Menu.
 
46
  * @return array
47
  */
48
  function adminmenu( $data ) {
 
 
 
 
 
49
  $data[] = $this->menu();
 
50
  return $data;
51
  }
52
 
@@ -68,16 +75,16 @@ abstract class TInvWL_Admin_BaseSection extends TInvWL_Admin_Base {
68
  * General print
69
  *
70
  * @param integer $id Id parameter.
71
- * @param string $cat Category parameter.
72
  */
73
  function _print_general( $id = 0, $cat = '' ) {
74
- $title = $this->menu();
75
- $slug = $title['slug'];
76
- $title = isset( $title['page_title'] ) ? $title['page_title'] : $title['title'];
77
- $data = array(
78
  '_header' => $title,
79
  );
80
- $method = $cat . '_data';
81
  if ( ! method_exists( $this, $method ) ) {
82
  $method = 'constructor_data';
83
  }
@@ -86,9 +93,9 @@ abstract class TInvWL_Admin_BaseSection extends TInvWL_Admin_Base {
86
  if ( method_exists( $this, $method ) ) {
87
  $sections = apply_filters( 'tinwl_prepare_admsections_' . $method, $this->$method() );
88
  $sections = apply_filters( 'tinwl_prepare_admsections', $sections );
89
- $view = new TInvWL_ViewSection( $this->_n, $this->_v );
90
  $view->load_data( $sections );
91
- $method = $cat . '_save';
92
  if ( ! method_exists( $this, $method ) ) {
93
  $method = 'constructor_save';
94
  }
@@ -112,6 +119,7 @@ abstract class TInvWL_Admin_BaseSection extends TInvWL_Admin_Base {
112
  * Method for default settings array
113
  *
114
  * @param array $sections Sections array.
 
115
  * @return array
116
  */
117
  function get_defaults( $sections ) {
@@ -135,8 +143,8 @@ abstract class TInvWL_Admin_BaseSection extends TInvWL_Admin_Base {
135
  $defaults[ $id ] = array();
136
  }
137
  foreach ( $fields as $field ) {
138
- $name = array_key_exists( 'name', $field ) ? $field['name'] : '';
139
- $std = array_key_exists( 'std', $field ) ? $field['std'] : '';
140
 
141
  $defaults[ $id ][ $name ] = $std;
142
  }
@@ -144,6 +152,7 @@ abstract class TInvWL_Admin_BaseSection extends TInvWL_Admin_Base {
144
  unset( $defaults[ $id ][''] );
145
  }
146
  }
 
147
  return $defaults;
148
  }
149
 
@@ -159,10 +168,12 @@ abstract class TInvWL_Admin_BaseSection extends TInvWL_Admin_Base {
159
  * Form start for section
160
  *
161
  * @param string $content Sections content.
 
162
  * @return string
163
  */
164
  function start_form( $content ) {
165
  $content .= '<form method="POST" autocomplete="off">';
 
166
  return $content;
167
  }
168
 
@@ -170,10 +181,12 @@ abstract class TInvWL_Admin_BaseSection extends TInvWL_Admin_Base {
170
  * Form end for section
171
  *
172
  * @param string $content Sections content.
 
173
  * @return string
174
  */
175
  function end_form( $content ) {
176
  $content .= '</form>';
 
177
  return $content;
178
  }
179
 
@@ -181,15 +194,17 @@ abstract class TInvWL_Admin_BaseSection extends TInvWL_Admin_Base {
181
  * Load value from database
182
  *
183
  * @param array $sections Sections array.
 
184
  * @return array
185
  */
186
  function constructor_load( $sections ) {
187
- $sections = $this->get_defaults( $sections );
188
- $sections = array_keys( $sections );
189
- $data = array();
190
  foreach ( $sections as $section ) {
191
  $data[ $section ] = tinv_get_option( $section );
192
  }
 
193
  return $data;
194
  }
195
 
30
  * @param string $version Plugin version.
31
  */
32
  function __construct( $plugin_name, $version ) {
33
+ $this->_n = $plugin_name;
34
+ $this->_v = $version;
35
+ $menu = $this->menu();
36
  if ( ! empty( $menu ) ) {
37
  add_action( $this->_n . '_admin_menu', array( $this, 'adminmenu' ), $this->priority );
38
  }
43
  * Add item to admin menu
44
  *
45
  * @param array $data Menu.
46
+ *
47
  * @return array
48
  */
49
  function adminmenu( $data ) {
50
+
51
+ if ( ! is_array( $data ) ) {
52
+ $data = array();
53
+ }
54
+
55
  $data[] = $this->menu();
56
+
57
  return $data;
58
  }
59
 
75
  * General print
76
  *
77
  * @param integer $id Id parameter.
78
+ * @param string $cat Category parameter.
79
  */
80
  function _print_general( $id = 0, $cat = '' ) {
81
+ $title = $this->menu();
82
+ $slug = $title['slug'];
83
+ $title = isset( $title['page_title'] ) ? $title['page_title'] : $title['title'];
84
+ $data = array(
85
  '_header' => $title,
86
  );
87
+ $method = $cat . '_data';
88
  if ( ! method_exists( $this, $method ) ) {
89
  $method = 'constructor_data';
90
  }
93
  if ( method_exists( $this, $method ) ) {
94
  $sections = apply_filters( 'tinwl_prepare_admsections_' . $method, $this->$method() );
95
  $sections = apply_filters( 'tinwl_prepare_admsections', $sections );
96
+ $view = new TInvWL_ViewSection( $this->_n, $this->_v );
97
  $view->load_data( $sections );
98
+ $method = $cat . '_save';
99
  if ( ! method_exists( $this, $method ) ) {
100
  $method = 'constructor_save';
101
  }
119
  * Method for default settings array
120
  *
121
  * @param array $sections Sections array.
122
+ *
123
  * @return array
124
  */
125
  function get_defaults( $sections ) {
143
  $defaults[ $id ] = array();
144
  }
145
  foreach ( $fields as $field ) {
146
+ $name = array_key_exists( 'name', $field ) ? $field['name'] : '';
147
+ $std = array_key_exists( 'std', $field ) ? $field['std'] : '';
148
 
149
  $defaults[ $id ][ $name ] = $std;
150
  }
152
  unset( $defaults[ $id ][''] );
153
  }
154
  }
155
+
156
  return $defaults;
157
  }
158
 
168
  * Form start for section
169
  *
170
  * @param string $content Sections content.
171
+ *
172
  * @return string
173
  */
174
  function start_form( $content ) {
175
  $content .= '<form method="POST" autocomplete="off">';
176
+
177
  return $content;
178
  }
179
 
181
  * Form end for section
182
  *
183
  * @param string $content Sections content.
184
+ *
185
  * @return string
186
  */
187
  function end_form( $content ) {
188
  $content .= '</form>';
189
+
190
  return $content;
191
  }
192
 
194
  * Load value from database
195
  *
196
  * @param array $sections Sections array.
197
+ *
198
  * @return array
199
  */
200
  function constructor_load( $sections ) {
201
+ $sections = $this->get_defaults( $sections );
202
+ $sections = array_keys( $sections );
203
+ $data = array();
204
  foreach ( $sections as $section ) {
205
  $data[ $section ] = tinv_get_option( $section );
206
  }
207
+
208
  return $data;
209
  }
210
 
freemius/LICENSE.txt CHANGED
@@ -1,340 +1,340 @@
1
- GNU GENERAL PUBLIC LICENSE
2
- Version 2, June 1991
3
-
4
- Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
5
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
- Everyone is permitted to copy and distribute verbatim copies
7
- of this license document, but changing it is not allowed.
8
-
9
- Preamble
10
-
11
- The licenses for most software are designed to take away your
12
- freedom to share and change it. By contrast, the GNU General Public
13
- License is intended to guarantee your freedom to share and change free
14
- software--to make sure the software is free for all its users. This
15
- General Public License applies to most of the Free Software
16
- Foundation's software and to any other program whose authors commit to
17
- using it. (Some other Free Software Foundation software is covered by
18
- the GNU Lesser General Public License instead.) You can apply it to
19
- your programs, too.
20
-
21
- When we speak of free software, we are referring to freedom, not
22
- price. Our General Public Licenses are designed to make sure that you
23
- have the freedom to distribute copies of free software (and charge for
24
- this service if you wish), that you receive source code or can get it
25
- if you want it, that you can change the software or use pieces of it
26
- in new free programs; and that you know you can do these things.
27
-
28
- To protect your rights, we need to make restrictions that forbid
29
- anyone to deny you these rights or to ask you to surrender the rights.
30
- These restrictions translate to certain responsibilities for you if you
31
- distribute copies of the software, or if you modify it.
32
-
33
- For example, if you distribute copies of such a program, whether
34
- gratis or for a fee, you must give the recipients all the rights that
35
- you have. You must make sure that they, too, receive or can get the
36
- source code. And you must show them these terms so they know their
37
- rights.
38
-
39
- We protect your rights with two steps: (1) copyright the software, and
40
- (2) offer you this license which gives you legal permission to copy,
41
- distribute and/or modify the software.
42
-
43
- Also, for each author's protection and ours, we want to make certain
44
- that everyone understands that there is no warranty for this free
45
- software. If the software is modified by someone else and passed on, we
46
- want its recipients to know that what they have is not the original, so
47
- that any problems introduced by others will not reflect on the original
48
- authors' reputations.
49
-
50
- Finally, any free program is threatened constantly by software
51
- patents. We wish to avoid the danger that redistributors of a free
52
- program will individually obtain patent licenses, in effect making the
53
- program proprietary. To prevent this, we have made it clear that any
54
- patent must be licensed for everyone's free use or not licensed at all.
55
-
56
- The precise terms and conditions for copying, distribution and
57
- modification follow.
58
-
59
- GNU GENERAL PUBLIC LICENSE
60
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
-
62
- 0. This License applies to any program or other work which contains
63
- a notice placed by the copyright holder saying it may be distributed
64
- under the terms of this General Public License. The "Program", below,
65
- refers to any such program or work, and a "work based on the Program"
66
- means either the Program or any derivative work under copyright law:
67
- that is to say, a work containing the Program or a portion of it,
68
- either verbatim or with modifications and/or translated into another
69
- language. (Hereinafter, translation is included without limitation in
70
- the term "modification".) Each licensee is addressed as "you".
71
-
72
- Activities other than copying, distribution and modification are not
73
- covered by this License; they are outside its scope. The act of
74
- running the Program is not restricted, and the output from the Program
75
- is covered only if its contents constitute a work based on the
76
- Program (independent of having been made by running the Program).
77
- Whether that is true depends on what the Program does.
78
-
79
- 1. You may copy and distribute verbatim copies of the Program's
80
- source code as you receive it, in any medium, provided that you
81
- conspicuously and appropriately publish on each copy an appropriate
82
- copyright notice and disclaimer of warranty; keep intact all the
83
- notices that refer to this License and to the absence of any warranty;
84
- and give any other recipients of the Program a copy of this License
85
- along with the Program.
86
-
87
- You may charge a fee for the physical act of transferring a copy, and
88
- you may at your option offer warranty protection in exchange for a fee.
89
-
90
- 2. You may modify your copy or copies of the Program or any portion
91
- of it, thus forming a work based on the Program, and copy and
92
- distribute such modifications or work under the terms of Section 1
93
- above, provided that you also meet all of these conditions:
94
-
95
- a) You must cause the modified files to carry prominent notices
96
- stating that you changed the files and the date of any change.
97
-
98
- b) You must cause any work that you distribute or publish, that in
99
- whole or in part contains or is derived from the Program or any
100
- part thereof, to be licensed as a whole at no charge to all third
101
- parties under the terms of this License.
102
-
103
- c) If the modified program normally reads commands interactively
104
- when run, you must cause it, when started running for such
105
- interactive use in the most ordinary way, to print or display an
106
- announcement including an appropriate copyright notice and a
107
- notice that there is no warranty (or else, saying that you provide
108
- a warranty) and that users may redistribute the program under
109
- these conditions, and telling the user how to view a copy of this
110
- License. (Exception: if the Program itself is interactive but
111
- does not normally print such an announcement, your work based on
112
- the Program is not required to print an announcement.)
113
-
114
- These requirements apply to the modified work as a whole. If
115
- identifiable sections of that work are not derived from the Program,
116
- and can be reasonably considered independent and separate works in
117
- themselves, then this License, and its terms, do not apply to those
118
- sections when you distribute them as separate works. But when you
119
- distribute the same sections as part of a whole which is a work based
120
- on the Program, the distribution of the whole must be on the terms of
121
- this License, whose permissions for other licensees extend to the
122
- entire whole, and thus to each and every part regardless of who wrote it.
123
-
124
- Thus, it is not the intent of this section to claim rights or contest
125
- your rights to work written entirely by you; rather, the intent is to
126
- exercise the right to control the distribution of derivative or
127
- collective works based on the Program.
128
-
129
- In addition, mere aggregation of another work not based on the Program
130
- with the Program (or with a work based on the Program) on a volume of
131
- a storage or distribution medium does not bring the other work under
132
- the scope of this License.
133
-
134
- 3. You may copy and distribute the Program (or a work based on it,
135
- under Section 2) in object code or executable form under the terms of
136
- Sections 1 and 2 above provided that you also do one of the following:
137
-
138
- a) Accompany it with the complete corresponding machine-readable
139
- source code, which must be distributed under the terms of Sections
140
- 1 and 2 above on a medium customarily used for software interchange; or,
141
-
142
- b) Accompany it with a written offer, valid for at least three
143
- years, to give any third party, for a charge no more than your
144
- cost of physically performing source distribution, a complete
145
- machine-readable copy of the corresponding source code, to be
146
- distributed under the terms of Sections 1 and 2 above on a medium
147
- customarily used for software interchange; or,
148
-
149
- c) Accompany it with the information you received as to the offer
150
- to distribute corresponding source code. (This alternative is
151
- allowed only for noncommercial distribution and only if you
152
- received the program in object code or executable form with such
153
- an offer, in accord with Subsection b above.)
154
-
155
- The source code for a work means the preferred form of the work for
156
- making modifications to it. For an executable work, complete source
157
- code means all the source code for all modules it contains, plus any
158
- associated interface definition files, plus the scripts used to
159
- control compilation and installation of the executable. However, as a
160
- special exception, the source code distributed need not include
161
- anything that is normally distributed (in either source or binary
162
- form) with the major components (compiler, kernel, and so on) of the
163
- operating system on which the executable runs, unless that component
164
- itself accompanies the executable.
165
-
166
- If distribution of executable or object code is made by offering
167
- access to copy from a designated place, then offering equivalent
168
- access to copy the source code from the same place counts as
169
- distribution of the source code, even though third parties are not
170
- compelled to copy the source along with the object code.
171
-
172
- 4. You may not copy, modify, sublicense, or distribute the Program
173
- except as expressly provided under this License. Any attempt
174
- otherwise to copy, modify, sublicense or distribute the Program is
175
- void, and will automatically terminate your rights under this License.
176
- However, parties who have received copies, or rights, from you under
177
- this License will not have their licenses terminated so long as such
178
- parties remain in full compliance.
179
-
180
- 5. You are not required to accept this License, since you have not
181
- signed it. However, nothing else grants you permission to modify or
182
- distribute the Program or its derivative works. These actions are
183
- prohibited by law if you do not accept this License. Therefore, by
184
- modifying or distributing the Program (or any work based on the
185
- Program), you indicate your acceptance of this License to do so, and
186
- all its terms and conditions for copying, distributing or modifying
187
- the Program or works based on it.
188
-
189
- 6. Each time you redistribute the Program (or any work based on the
190
- Program), the recipient automatically receives a license from the
191
- original licensor to copy, distribute or modify the Program subject to
192
- these terms and conditions. You may not impose any further
193
- restrictions on the recipients' exercise of the rights granted herein.
194
- You are not responsible for enforcing compliance by third parties to
195
- this License.
196
-
197
- 7. If, as a consequence of a court judgment or allegation of patent
198
- infringement or for any other reason (not limited to patent issues),
199
- conditions are imposed on you (whether by court order, agreement or
200
- otherwise) that contradict the conditions of this License, they do not
201
- excuse you from the conditions of this License. If you cannot
202
- distribute so as to satisfy simultaneously your obligations under this
203
- License and any other pertinent obligations, then as a consequence you
204
- may not distribute the Program at all. For example, if a patent
205
- license would not permit royalty-free redistribution of the Program by
206
- all those who receive copies directly or indirectly through you, then
207
- the only way you could satisfy both it and this License would be to
208
- refrain entirely from distribution of the Program.
209
-
210
- If any portion of this section is held invalid or unenforceable under
211
- any particular circumstance, the balance of the section is intended to
212
- apply and the section as a whole is intended to apply in other
213
- circumstances.
214
-
215
- It is not the purpose of this section to induce you to infringe any
216
- patents or other property right claims or to contest validity of any
217
- such claims; this section has the sole purpose of protecting the
218
- integrity of the free software distribution system, which is
219
- implemented by public license practices. Many people have made
220
- generous contributions to the wide range of software distributed
221
- through that system in reliance on consistent application of that
222
- system; it is up to the author/donor to decide if he or she is willing
223
- to distribute software through any other system and a licensee cannot
224
- impose that choice.
225
-
226
- This section is intended to make thoroughly clear what is believed to
227
- be a consequence of the rest of this License.
228
-
229
- 8. If the distribution and/or use of the Program is restricted in
230
- certain countries either by patents or by copyrighted interfaces, the
231
- original copyright holder who places the Program under this License
232
- may add an explicit geographical distribution limitation excluding
233
- those countries, so that distribution is permitted only in or among
234
- countries not thus excluded. In such case, this License incorporates
235
- the limitation as if written in the body of this License.
236
-
237
- 9. The Free Software Foundation may publish revised and/or new versions
238
- of the General Public License from time to time. Such new versions will
239
- be similar in spirit to the present version, but may differ in detail to
240
- address new problems or concerns.
241
-
242
- Each version is given a distinguishing version number. If the Program
243
- specifies a version number of this License which applies to it and "any
244
- later version", you have the option of following the terms and conditions
245
- either of that version or of any later version published by the Free
246
- Software Foundation. If the Program does not specify a version number of
247
- this License, you may choose any version ever published by the Free Software
248
- Foundation.
249
-
250
- 10. If you wish to incorporate parts of the Program into other free
251
- programs whose distribution conditions are different, write to the author
252
- to ask for permission. For software which is copyrighted by the Free
253
- Software Foundation, write to the Free Software Foundation; we sometimes
254
- make exceptions for this. Our decision will be guided by the two goals
255
- of preserving the free status of all derivatives of our free software and
256
- of promoting the sharing and reuse of software generally.
257
-
258
- NO WARRANTY
259
-
260
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
- FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
- OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
- PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
- OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
- TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
- PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
- REPAIR OR CORRECTION.
269
-
270
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
- WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
- REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
- INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
- OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
- TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
- YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
- PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
- POSSIBILITY OF SUCH DAMAGES.
279
-
280
- END OF TERMS AND CONDITIONS
281
-
282
- How to Apply These Terms to Your New Programs
283
-
284
- If you develop a new program, and you want it to be of the greatest
285
- possible use to the public, the best way to achieve this is to make it
286
- free software which everyone can redistribute and change under these terms.
287
-
288
- To do so, attach the following notices to the program. It is safest
289
- to attach them to the start of each source file to most effectively
290
- convey the exclusion of warranty; and each file should have at least
291
- the "copyright" line and a pointer to where the full notice is found.
292
-
293
- {description}
294
- Copyright (C) {year} {fullname}
295
-
296
- This program is free software; you can redistribute it and/or modify
297
- it under the terms of the GNU General Public License as published by
298
- the Free Software Foundation; either version 2 of the License, or
299
- (at your option) any later version.
300
-
301
- This program is distributed in the hope that it will be useful,
302
- but WITHOUT ANY WARRANTY; without even the implied warranty of
303
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
- GNU General Public License for more details.
305
-
306
- You should have received a copy of the GNU General Public License along
307
- with this program; if not, write to the Free Software Foundation, Inc.,
308
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
-
310
- Also add information on how to contact you by electronic and paper mail.
311
-
312
- If the program is interactive, make it output a short notice like this
313
- when it starts in an interactive mode:
314
-
315
- Gnomovision version 69, Copyright (C) year name of author
316
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
- This is free software, and you are welcome to redistribute it
318
- under certain conditions; type `show c' for details.
319
-
320
- The hypothetical commands `show w' and `show c' should show the appropriate
321
- parts of the General Public License. Of course, the commands you use may
322
- be called something other than `show w' and `show c'; they could even be
323
- mouse-clicks or menu items--whatever suits your program.
324
-
325
- You should also get your employer (if you work as a programmer) or your
326
- school, if any, to sign a "copyright disclaimer" for the program, if
327
- necessary. Here is a sample; alter the names:
328
-
329
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
-
332
- {signature of Ty Coon}, 1 April 1989
333
- Ty Coon, President of Vice
334
-
335
- This General Public License does not permit incorporating your program into
336
- proprietary programs. If your program is a subroutine library, you may
337
- consider it more useful to permit linking proprietary applications with the
338
- library. If this is what you want to do, use the GNU Lesser General
339
- Public License instead of this License.
340
-
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Lesser General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
+
284
+ If you develop a new program, and you want it to be of the greatest
285
+ possible use to the public, the best way to achieve this is to make it
286
+ free software which everyone can redistribute and change under these terms.
287
+
288
+ To do so, attach the following notices to the program. It is safest
289
+ to attach them to the start of each source file to most effectively
290
+ convey the exclusion of warranty; and each file should have at least
291
+ the "copyright" line and a pointer to where the full notice is found.
292
+
293
+ {description}
294
+ Copyright (C) {year} {fullname}
295
+
296
+ This program is free software; you can redistribute it and/or modify
297
+ it under the terms of the GNU General Public License as published by
298
+ the Free Software Foundation; either version 2 of the License, or
299
+ (at your option) any later version.
300
+
301
+ This program is distributed in the hope that it will be useful,
302
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
+ GNU General Public License for more details.
305
+
306
+ You should have received a copy of the GNU General Public License along
307
+ with this program; if not, write to the Free Software Foundation, Inc.,
308
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
+
310
+ Also add information on how to contact you by electronic and paper mail.
311
+
312
+ If the program is interactive, make it output a short notice like this
313
+ when it starts in an interactive mode:
314
+
315
+ Gnomovision version 69, Copyright (C) year name of author
316
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
+ This is free software, and you are welcome to redistribute it
318
+ under certain conditions; type `show c' for details.
319
+
320
+ The hypothetical commands `show w' and `show c' should show the appropriate
321
+ parts of the General Public License. Of course, the commands you use may
322
+ be called something other than `show w' and `show c'; they could even be
323
+ mouse-clicks or menu items--whatever suits your program.
324
+
325
+ You should also get your employer (if you work as a programmer) or your
326
+ school, if any, to sign a "copyright disclaimer" for the program, if
327
+ necessary. Here is a sample; alter the names:
328
+
329
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
+
332
+ {signature of Ty Coon}, 1 April 1989
333
+ Ty Coon, President of Vice
334
+
335
+ This General Public License does not permit incorporating your program into
336
+ proprietary programs. If your program is a subroutine library, you may
337
+ consider it more useful to permit linking proprietary applications with the
338
+ library. If this is what you want to do, use the GNU Lesser General
339
+ Public License instead of this License.
340
+
freemius/README.md ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Freemius WordPress SDK
2
+ ======================
3
+
4
+ [Monetization](https://freemius.com/wordpress/), [analytics](https://freemius.com/wordpress/insights/), and marketing automation platform for plugin & theme developers. Freemius empower developers to create prosperous subscription based businesses.
5
+
6
+ You can see some of the WordPress.org plugins & themes that are utilizing the power of Freemius here:
7
+
8
+ https://includewp.com/freemius/#focus
9
+
10
+ If you are a WordPress plugin or theme developer and you are interested to monetize with Freemius you can [sign-up here for free](https://dashboard.freemius.com/register/):
11
+
12
+ https://dashboard.freemius.com/register/
13
+
14
+ **Below you'll find the integration instructions for our WordPress SDK.**
15
+
16
+ ## Code Documentation
17
+
18
+ You can find the SDK's PHP-Doc documentation here:
19
+ https://codedoc.pub/freemius/wordpress-sdk/master/
20
+
21
+ ## Initializing the SDK
22
+
23
+ Copy the code below and paste it into the top of your main plugin's PHP file, right after the plugin's header comment:
24
+
25
+ ```php
26
+ <?php
27
+ // Create a helper function for easy SDK access.
28
+ function my_prefix_fs() {
29
+ global $my_prefix_fs;
30
+ if ( ! isset( $my_prefix_fs ) ) {
31
+ // Include Freemius SDK.
32
+ require_once dirname(__FILE__) . '/freemius/start.php';
33
+
34
+ $my_prefix_fs = fs_dynamic_init( array(
35
+ 'id' => '1234',
36
+ 'slug' => 'my-plugin-slug',
37
+ 'menu_slug' => 'my_menu_slug', // You can also use __FILE__
38
+ 'public_key' => 'pk_MY_PUBLIC_KEY',
39
+ 'is_live' => true,
40
+ 'is_premium' => true,
41
+ 'has_addons' => false,
42
+ 'has_paid_plans' => false,
43
+ // Set the SDK to work in a sandbox mode (for development & testing).
44
+ // IMPORTANT: MAKE SURE TO REMOVE SECRET KEY BEFORE DEPLOYMENT.
45
+ 'secret_key' => 'sk_MY_SECRET_KEY',
46
+ ) );
47
+ }
48
+
49
+ return $my_prefix_fs;
50
+ }
51
+
52
+ // Init Freemius.
53
+ my_prefix_fs();
54
+ ?>
55
+ ```
56
+
57
+ - **1234** - Replace with your plugin's ID.
58
+ - **pk_MY_PUBLIC_KEY** - Replace with your plugin's public key.
59
+ - **sk_MY_SECRET_KEY** - Replace with your plugin's secret key.
60
+ - **my-plugin-slug** - Replace with your plugin's WordPress.org slug.
61
+ - **my_menu_slug** - Replace with your admin dashboard settings menu slug.
62
+
63
+
64
+ ## Usage example
65
+
66
+ You can call the SDK by using the shortcode function:
67
+
68
+ ```php
69
+ <?php my_prefix_fs()->get_upgrade_url(); ?>
70
+ ```
71
+
72
+ Or when calling Freemius multiple times in a scope, it's recommended to use it with the global variable:
73
+
74
+ ```php
75
+ <?php
76
+ global $my_prefix_fs;
77
+ $my_prefix_fs->get_account_url();
78
+ ?>
79
+ ```
80
+
81
+ ## Adding license based logic examples
82
+
83
+ Add marketing content to encourage your users to upgrade for your paid version:
84
+
85
+ ```php
86
+ <?php
87
+ if ( my_prefix_fs()->is_not_paying() ) {
88
+ echo '<section><h1>' . esc_html__('Awesome Premium Features', 'my-plugin-slug') . '</h1>';
89
+ echo '<a href="' . my_prefix_fs()->get_upgrade_url() . '">' .
90
+ esc_html__('Upgrade Now!', 'my-plugin-slug') .
91
+ '</a>';
92
+ echo '</section>';
93
+ }
94
+ ?>
95
+ ```
96
+
97
+ Add logic which will only be available in your premium plugin version:
98
+
99
+ ```php
100
+ <?php
101
+ // This "if" block will be auto removed from the Free version.
102
+ if ( my_prefix_fs()->is__premium_only() ) {
103
+
104
+ // ... premium only logic ...
105
+
106
+ }
107
+ ?>
108
+ ```
109
+
110
+ To add a function which will only be available in your premium plugin version, simply add __premium_only as the suffix of the function name. Just make sure that all lines that call that method directly or by hooks, are also wrapped in premium only logic:
111
+
112
+ ```php
113
+ <?php
114
+ class My_Plugin {
115
+ function init() {
116
+ ...
117
+
118
+ // This "if" block will be auto removed from the free version.
119
+ if ( my_prefix_fs()->is__premium_only() ) {
120
+ // Init premium version.
121
+ $this->admin_init__premium_only();
122
+
123
+ add_action( 'admin_init', array( &$this, 'admin_init_hook__premium_only' );
124
+ }
125
+
126
+ ...
127
+ }
128
+
129
+ // This method will be only included in the premium version.
130
+ function admin_init__premium_only() {
131
+ ...
132
+ }
133
+
134
+ // This method will be only included in the premium version.
135
+ function admin_init_hook__premium_only() {
136
+ ...
137
+ }
138
+ }
139
+ ?>
140
+ ```
141
+
142
+ Add logic which will only be executed for customers in your 'professional' plan:
143
+
144
+ ```php
145
+ <?php
146
+ if ( my_prefix_fs()->is_plan('professional', true) ) {
147
+ // .. logic related to Professional plan only ...
148
+ }
149
+ ?>
150
+ ```
151
+
152
+ Add logic which will only be executed for customers in your 'professional' plan or higher plans:
153
+
154
+ ```php
155
+ <?php
156
+ if ( my_prefix_fs()->is_plan('professional') ) {
157
+ // ... logic related to Professional plan and higher plans ...
158
+ }
159
+ ?>
160
+ ```
161
+
162
+ Add logic which will only be available in your premium plugin version AND will only be executed for customers in your 'professional' plan (and higher plans):
163
+
164
+ ```php
165
+ <?php
166
+ // This "if" block will be auto removed from the Free version.
167
+ if ( my_prefix_fs()->is_plan__premium_only('professional') ) {
168
+ // ... logic related to Professional plan and higher plans ...
169
+ }
170
+ ?>
171
+ ```
172
+
173
+ Add logic only for users in trial:
174
+
175
+ ```php
176
+ <?php
177
+ if ( my_prefix_fs()->is_trial() ) {
178
+ // ... logic for users in trial ...
179
+ }
180
+ ?>
181
+ ```
182
+
183
+ Add logic for specified paid plan:
184
+
185
+ ```php
186
+ <?php
187
+ // This "if" block will be auto removed from the Free version.
188
+ if ( my_prefix_fs()->is__premium_only() ) {
189
+ if ( my_prefix_fs()->is_plan( 'professional', true ) ) {
190
+
191
+ // ... logic related to Professional plan only ...
192
+
193
+ } else if ( my_prefix_fs()->is_plan( 'business' ) ) {
194
+
195
+ // ... logic related to Business plan and higher plans ...
196
+
197
+ }
198
+ }
199
+ ?>
200
+ ```
201
+
202
+ ## Excluding files and folders from the free plugin version
203
+ There are two ways to exclude files from your free version.
204
+
205
+ 1. Add `__premium_only` just before the file extension. For example, functions__premium_only.php will be only included in the premium plugin version. This works for all type of files, not only PHP.
206
+ 2. Add `@fs_premium_only` a sepcial meta tag to the plugin's main PHP file header. Example:
207
+ ```php
208
+ <?php
209
+ /**
210
+ * Plugin Name: My Very Awesome Plugin
211
+ * Plugin URI: http://my-awesome-plugin.com
212
+ * Description: Create and manage Awesomeness right in WordPress.
213
+ * Version: 1.0.0
214
+ * Author: Awesomattic
215
+ * Author URI: http://my-awesome-plugin.com/me/
216
+ * License: GPLv2
217
+ * Text Domain: myplugin
218
+ * Domain Path: /langs
219
+ *
220
+ * @fs_premium_only /lib/functions.php, /premium-files/
221
+ */
222
+
223
+ if ( ! defined( 'ABSPATH' ) ) {
224
+ exit;
225
+ }
226
+
227
+ // ... my code ...
228
+ ?>
229
+ ```
230
+ The file `/lib/functions.php` and the directory `/premium-files/` will be removed from the free plugin version.
231
+
232
+ # WordPress.org Compliance
233
+ Based on [WordPress.org Guidelines](https://wordpress.org/plugins/about/guidelines/) you are not allowed to submit a plugin that has premium code in it:
234
+ > All code hosted by WordPress.org servers must be free and fully-functional. If you want to sell advanced features for a plugin (such as a "pro" version), then you must sell and serve that code from your own site, we will not host it on our servers.
235
+
236
+ Therefore, if you want to deploy your free plugin's version to WordPress.org, make sure you wrap all your premium code with `if ( my_prefix_fs()->{{ method }}__premium_only() )` or the other methods provided to exclude premium features & files from the free version.
237
+
238
+ ## Deployment
239
+ Zip your plugin's root folder and upload it in the Deployment section in the *Freemius Developer's Dashboard*.
240
+ The plugin will be scanned and processed by a custom developed *PHP Processor* which will auto-generate two versions of your plugin:
241
+
242
+ 1. **Premium version**: Identical to your uploaded version, including all code (except your `secret_key`). Will be enabled for download ONLY for your paying or in trial customers.
243
+ 2. **Free version**: The code stripped from all your paid features (based on the logic added wrapped in `{ method }__premium_only()`).
244
+
245
+ The free version is the one that you should give your users to download. Therefore, download the free generated version and upload to your site. Or, if your plugin was WordPress.org complaint and you made sure to exclude all your premium code with the different provided techniques, you can deploy the downloaded free version to the .org repo.
246
+
247
+ ## Reporting Bugs
248
+ Email dev [at] freemius [dot] com
249
+
250
+ ## FAQ
251
+
252
+ ## Copyright
253
+ Freemius, Inc.
freemius/assets/css/admin/account.css CHANGED
@@ -1 +1 @@
1
- #fs_account .postbox,#fs_account .widefat{max-width:700px}#fs_account h3{font-size:1.3em;padding:12px 15px;margin:0 0 12px 0;line-height:1.4;border-bottom:1px solid #F1F1F1}#fs_account i.dashicons{font-size:1.2em;height:1.2em;width:1.2em}#fs_account .button i.dashicons{vertical-align:middle}#fs_account .fs-header-actions{position:absolute;top:17px;right:15px;font-size:0.9em}#fs_account .fs-header-actions ul{margin:0}#fs_account .fs-header-actions li{float:left}#fs_account .fs-header-actions li form{display:inline-block}#fs_account .fs-header-actions li a{text-decoration:none}#fs_account_details .button-group{float:right}.rtl #fs_account .fs-header-actions{left:15px;right:auto}.fs-key-value-table{width:100%}.fs-key-value-table form{display:inline-block}.fs-key-value-table tr td:first-child{text-align:right}.fs-key-value-table tr td:first-child nobr{font-weight:bold}.fs-key-value-table tr td:first-child form{display:block}.fs-key-value-table tr td.fs-right{text-align:right}.fs-key-value-table tr.fs-odd{background:#ebebeb}.fs-key-value-table td,.fs-key-value-table th{padding:10px}.fs-key-value-table code{line-height:28px}.fs-key-value-table var,.fs-key-value-table code,.fs-key-value-table input[type="text"]{color:#0073AA;font-size:16px;background:none}.fs-key-value-table input[type="text"]{width:100%;font-weight:bold}label.fs-tag{background:#ffba00;color:#fff;display:inline-block;border-radius:3px;padding:5px;font-size:11px;line-height:11px;vertical-align:baseline}label.fs-tag.fs-warn{background:#ffba00}label.fs-tag.fs-success{background:#46b450}label.fs-tag.fs-error{background:#dc3232}#fs_addons h3{border:none;margin-bottom:0;padding:4px 5px}#fs_addons td{vertical-align:middle}#fs_addons thead{white-space:nowrap}#fs_addons td:first-child,#fs_addons th:first-child{text-align:left;font-weight:bold}#fs_addons td:last-child,#fs_addons th:last-child{text-align:right}#fs_addons th{font-weight:bold}#fs_billing_address{width:100%}#fs_billing_address tr td{width:50%;padding:5px}#fs_billing_address tr:first-of-type td{padding-top:0}#fs_billing_address span{font-weight:bold}#fs_billing_address input,#fs_billing_address select{display:block;width:100%;margin-top:5px}#fs_billing_address input::-moz-placeholder,#fs_billing_address select::-moz-placeholder{color:transparent;opacity:1}#fs_billing_address input:-ms-input-placeholder,#fs_billing_address select:-ms-input-placeholder{color:transparent}#fs_billing_address input::-webkit-input-placeholder,#fs_billing_address select::-webkit-input-placeholder{color:transparent}#fs_billing_address input.fs-read-mode,#fs_billing_address select.fs-read-mode{border-color:transparent;color:#777;border-bottom:1px dashed #ccc;padding-left:0;background:none}#fs_billing_address.fs-read-mode td span{display:none}#fs_billing_address.fs-read-mode input,#fs_billing_address.fs-read-mode select{border-color:transparent;color:#777;border-bottom:1px dashed #ccc;padding-left:0;background:none}#fs_billing_address.fs-read-mode input::-moz-placeholder,#fs_billing_address.fs-read-mode select::-moz-placeholder{color:#ccc;opacity:1}#fs_billing_address.fs-read-mode input:-ms-input-placeholder,#fs_billing_address.fs-read-mode select:-ms-input-placeholder{color:#ccc}#fs_billing_address.fs-read-mode input::-webkit-input-placeholder,#fs_billing_address.fs-read-mode select::-webkit-input-placeholder{color:#ccc}#fs_billing_address button{display:block;width:100%}
1
+ #fs_account .postbox,#fs_account .widefat{max-width:700px}#fs_account h3{font-size:1.3em;padding:12px 15px;margin:0 0 12px 0;line-height:1.4;border-bottom:1px solid #F1F1F1}#fs_account i.dashicons{font-size:1.2em;height:1.2em;width:1.2em}#fs_account .button i.dashicons{vertical-align:middle}#fs_account .fs-header-actions{position:absolute;top:17px;right:15px;font-size:0.9em}#fs_account .fs-header-actions ul{margin:0}#fs_account .fs-header-actions li{float:left}#fs_account .fs-header-actions li form{display:inline-block}#fs_account .fs-header-actions li a{text-decoration:none}#fs_account_details .button-group{float:right}.rtl #fs_account .fs-header-actions{left:15px;right:auto}.fs-key-value-table{width:100%}.fs-key-value-table form{display:inline-block}.fs-key-value-table tr td:first-child{text-align:right}.fs-key-value-table tr td:first-child nobr{font-weight:bold}.fs-key-value-table tr td:first-child form{display:block}.fs-key-value-table tr td.fs-right{text-align:right}.fs-key-value-table tr.fs-odd{background:#ebebeb}.fs-key-value-table td,.fs-key-value-table th{padding:10px}.fs-key-value-table code{line-height:28px}.fs-key-value-table var,.fs-key-value-table code,.fs-key-value-table input[type="text"]{color:#0073AA;font-size:16px;background:none}.fs-key-value-table input[type="text"]{width:100%;font-weight:bold}label.fs-tag{background:#ffba00;color:#fff;display:inline-block;border-radius:3px;padding:5px;font-size:11px;line-height:11px;vertical-align:baseline}label.fs-tag.fs-warn{background:#ffba00}label.fs-tag.fs-success{background:#46b450}label.fs-tag.fs-error{background:#dc3232}#fs_addons h3{border:none;margin-bottom:0;padding:4px 5px}#fs_addons td{vertical-align:middle}#fs_addons thead{white-space:nowrap}#fs_addons td:first-child,#fs_addons th:first-child{text-align:left;font-weight:bold}#fs_addons td:last-child,#fs_addons th:last-child{text-align:right}#fs_addons th{font-weight:bold}#fs_billing_address{width:100%}#fs_billing_address tr td{width:50%;padding:5px}#fs_billing_address tr:first-of-type td{padding-top:0}#fs_billing_address span{font-weight:bold}#fs_billing_address input,#fs_billing_address select{display:block;width:100%;margin-top:5px}#fs_billing_address input::-moz-placeholder,#fs_billing_address select::-moz-placeholder{color:transparent;opacity:1}#fs_billing_address input:-ms-input-placeholder,#fs_billing_address select:-ms-input-placeholder{color:transparent}#fs_billing_address input::-webkit-input-placeholder,#fs_billing_address select::-webkit-input-placeholder{color:transparent}#fs_billing_address input.fs-read-mode,#fs_billing_address select.fs-read-mode{border-color:transparent;color:#777;border-bottom:1px dashed #ccc;padding-left:0;background:none}#fs_billing_address.fs-read-mode td span{display:none}#fs_billing_address.fs-read-mode input,#fs_billing_address.fs-read-mode select{border-color:transparent;color:#777;border-bottom:1px dashed #ccc;padding-left:0;background:none}#fs_billing_address.fs-read-mode input::-moz-placeholder,#fs_billing_address.fs-read-mode select::-moz-placeholder{color:#ccc;opacity:1}#fs_billing_address.fs-read-mode input:-ms-input-placeholder,#fs_billing_address.fs-read-mode select:-ms-input-placeholder{color:#ccc}#fs_billing_address.fs-read-mode input::-webkit-input-placeholder,#fs_billing_address.fs-read-mode select::-webkit-input-placeholder{color:#ccc}#fs_billing_address button{display:block;width:100%}
freemius/assets/css/admin/add-ons.css CHANGED
@@ -1,2 +1,2 @@
1
- #fs_addons .fs-cards-list{list-style:none}#fs_addons .fs-cards-list .fs-card{float:left;height:152px;width:310px;padding:0;margin:0 0 30px 30px;font-size:14px;list-style:none;border:1px solid #ddd;cursor:pointer;position:relative}#fs_addons .fs-cards-list .fs-card .fs-overlay{position:absolute;left:0;right:0;bottom:0;top:0;z-index:9}#fs_addons .fs-cards-list .fs-card .fs-inner{background-color:#fff;overflow:hidden;height:100%;position:relative}#fs_addons .fs-cards-list .fs-card .fs-inner ul{-moz-transition:all,0.15s;-o-transition:all,0.15s;-ms-transition:all,0.15s;-webkit-transition:all,0.15s;transition:all,0.15s;left:0;right:0;top:0;position:absolute}#fs_addons .fs-cards-list .fs-card .fs-inner li{list-style:none;line-height:18px;padding:0 15px;width:100%;display:block;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-card-banner{padding:0;margin:0;line-height:0;display:block;height:100px;background-repeat:repeat-x;background-size:100% 100%;-moz-transition:all,0.15s;-o-transition:all,0.15s;-ms-transition:all,0.15s;-webkit-transition:all,0.15s;transition:all,0.15s}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-title{margin:10px 0 0 0;height:18px;overflow:hidden;color:#000;white-space:nowrap;text-overflow:ellipsis;font-weight:bold}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-offer{font-size:0.9em}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-description{background-color:#f9f9f9;padding:10px 15px 100px 15px;border-top:1px solid #eee;margin:0 0 10px 0;color:#777}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-tag{position:absolute;top:10px;right:0px;background:greenyellow;display:block;padding:2px 10px;-moz-box-shadow:1px 1px 1px rgba(0,0,0,0.3);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,0.3);box-shadow:1px 1px 1px rgba(0,0,0,0.3);text-transform:uppercase;font-size:0.9em;font-weight:bold}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-cta .button{position:absolute;top:112px;right:10px}@media screen and (min-width: 960px){#fs_addons .fs-cards-list .fs-card:hover .fs-overlay{border:2px solid #29abe1;margin-left:-1px;margin-top:-1px}#fs_addons .fs-cards-list .fs-card:hover .fs-inner ul{top:-100px}#fs_addons .fs-cards-list .fs-card:hover .fs-inner .fs-title,#fs_addons .fs-cards-list .fs-card:hover .fs-inner .fs-offer{color:#29abe1}}
2
- #TB_window,#TB_window iframe{width:772px !important}#plugin-information #section-description h2,#plugin-information #section-description h3,#plugin-information #section-description p,#plugin-information #section-description b,#plugin-information #section-description i,#plugin-information #section-description blockquote,#plugin-information #section-description li,#plugin-information #section-description ul,#plugin-information #section-description ol{clear:none}#plugin-information #section-description .fs-selling-points{padding-bottom:10px;border-bottom:1px solid #ddd}#plugin-information #section-description .fs-selling-points ul{margin:0}#plugin-information #section-description .fs-selling-points ul li{padding:0;list-style:none outside none}#plugin-information #section-description .fs-selling-points ul li i.dashicons{color:#71ae00;font-size:3em;vertical-align:middle;line-height:30px;float:left;margin:0 0 0 -15px}#plugin-information #section-description .fs-selling-points ul li h3{margin:1em 30px !important}#plugin-information #section-description .fs-screenshots:after{content:"";display:table;clear:both}#plugin-information #section-description .fs-screenshots ul{list-style:none;margin:0}#plugin-information #section-description .fs-screenshots ul li{width:225px;height:225px;float:left;margin-bottom:20px;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}#plugin-information #section-description .fs-screenshots ul li a{display:block;width:100%;height:100%;border:1px solid;-moz-box-shadow:1px 1px 1px rgba(0,0,0,0.2);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,0.2);box-shadow:1px 1px 1px rgba(0,0,0,0.2);background-size:cover}#plugin-information #section-description .fs-screenshots ul li.odd{margin-right:20px}#plugin-information .plugin-information-pricing{margin:-16px;border-bottom:1px solid #ddd}#plugin-information .plugin-information-pricing .fs-plan h3{margin-top:0;padding:20px;font-size:16px}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper{border-bottom:1px solid #ddd}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab{cursor:pointer;position:relative;padding:0 10px;font-size:0.9em}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab label{text-transform:uppercase;color:green;background:greenyellow;position:absolute;left:-1px;right:-1px;bottom:100%;border:1px solid darkgreen;padding:2px;text-align:center;font-size:0.9em;line-height:1em}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab.nav-tab-active{cursor:default;background:#fffeec;border-bottom-color:#fffeec}#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle h3{background:#fffeec;margin:0;padding-bottom:0;color:#0073aa}#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle .nav-tab-wrapper,#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle .fs-billing-frequency{display:none}#plugin-information .plugin-information-pricing .fs-plan .fs-pricing-body{background:#fffeec;padding:20px}#plugin-information .plugin-information-pricing .fs-plan .button{width:100%;text-align:center;font-weight:bold;text-transform:uppercase;font-size:1.1em}#plugin-information .plugin-information-pricing .fs-plan label{white-space:nowrap}#plugin-information .plugin-information-pricing .fs-plan var{font-style:normal}#plugin-information .plugin-information-pricing .fs-plan .fs-billing-frequency,#plugin-information .plugin-information-pricing .fs-plan .fs-annual-discount{text-align:center;display:block;font-weight:bold;margin-bottom:10px;text-transform:uppercase;background:#F3F3F3;padding:2px;border:1px solid #ccc}#plugin-information .plugin-information-pricing .fs-plan .fs-annual-discount{text-transform:none;color:green;background:greenyellow}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms{font-size:0.9em}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms i{float:left;margin:0 0 0 -15px}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms li{margin:10px 0 0 0}#plugin-information #section-features .fs-features{margin:-20px -26px}#plugin-information #section-features table{width:100%;border-spacing:0;border-collapse:separate}#plugin-information #section-features table thead th{padding:10px 0}#plugin-information #section-features table thead .fs-price{color:#71ae00;font-weight:normal;display:block;text-align:center}#plugin-information #section-features table tbody td{border-top:1px solid #ccc;padding:10px 0;text-align:center;width:100px;color:#71ae00}#plugin-information #section-features table tbody td:first-child{text-align:left;width:auto;color:inherit;padding-left:26px}#plugin-information #section-features table tbody tr.fs-odd td{background:#fefefe}#plugin-information #section-features .dashicons-yes{width:30px;height:30px;font-size:30px}@media screen and (max-width: 961px){#fs_addons .fs-cards-list .fs-card{height:265px}}
1
+ #fs_addons .fs-cards-list{list-style:none}#fs_addons .fs-cards-list .fs-card{float:left;height:152px;width:310px;padding:0;margin:0 0 30px 30px;font-size:14px;list-style:none;border:1px solid #ddd;cursor:pointer;position:relative}#fs_addons .fs-cards-list .fs-card .fs-overlay{position:absolute;left:0;right:0;bottom:0;top:0;z-index:9}#fs_addons .fs-cards-list .fs-card .fs-inner{background-color:#fff;overflow:hidden;height:100%;position:relative}#fs_addons .fs-cards-list .fs-card .fs-inner ul{-moz-transition:all,0.15s;-o-transition:all,0.15s;-ms-transition:all,0.15s;-webkit-transition:all,0.15s;transition:all,0.15s;left:0;right:0;top:0;position:absolute}#fs_addons .fs-cards-list .fs-card .fs-inner li{list-style:none;line-height:18px;padding:0 15px;width:100%;display:block;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-card-banner{padding:0;margin:0;line-height:0;display:block;height:100px;background-repeat:repeat-x;background-size:100% 100%;-moz-transition:all,0.15s;-o-transition:all,0.15s;-ms-transition:all,0.15s;-webkit-transition:all,0.15s;transition:all,0.15s}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-title{margin:10px 0 0 0;height:18px;overflow:hidden;color:#000;white-space:nowrap;text-overflow:ellipsis;font-weight:bold}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-offer{font-size:0.9em}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-description{background-color:#f9f9f9;padding:10px 15px 100px 15px;border-top:1px solid #eee;margin:0 0 10px 0;color:#777}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-tag{position:absolute;top:10px;right:0px;background:greenyellow;display:block;padding:2px 10px;-moz-box-shadow:1px 1px 1px rgba(0,0,0,0.3);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,0.3);box-shadow:1px 1px 1px rgba(0,0,0,0.3);text-transform:uppercase;font-size:0.9em;font-weight:bold}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-cta .button{position:absolute;top:112px;right:10px}@media screen and (min-width: 960px){#fs_addons .fs-cards-list .fs-card:hover .fs-overlay{border:2px solid #29abe1;margin-left:-1px;margin-top:-1px}#fs_addons .fs-cards-list .fs-card:hover .fs-inner ul{top:-100px}#fs_addons .fs-cards-list .fs-card:hover .fs-inner .fs-title,#fs_addons .fs-cards-list .fs-card:hover .fs-inner .fs-offer{color:#29abe1}}
2
+ #TB_window,#TB_window iframe{width:772px !important}#plugin-information #section-description h2,#plugin-information #section-description h3,#plugin-information #section-description p,#plugin-information #section-description b,#plugin-information #section-description i,#plugin-information #section-description blockquote,#plugin-information #section-description li,#plugin-information #section-description ul,#plugin-information #section-description ol{clear:none}#plugin-information #section-description .fs-selling-points{padding-bottom:10px;border-bottom:1px solid #ddd}#plugin-information #section-description .fs-selling-points ul{margin:0}#plugin-information #section-description .fs-selling-points ul li{padding:0;list-style:none outside none}#plugin-information #section-description .fs-selling-points ul li i.dashicons{color:#71ae00;font-size:3em;vertical-align:middle;line-height:30px;float:left;margin:0 0 0 -15px}#plugin-information #section-description .fs-selling-points ul li h3{margin:1em 30px !important}#plugin-information #section-description .fs-screenshots:after{content:"";display:table;clear:both}#plugin-information #section-description .fs-screenshots ul{list-style:none;margin:0}#plugin-information #section-description .fs-screenshots ul li{width:225px;height:225px;float:left;margin-bottom:20px;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}#plugin-information #section-description .fs-screenshots ul li a{display:block;width:100%;height:100%;border:1px solid;-moz-box-shadow:1px 1px 1px rgba(0,0,0,0.2);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,0.2);box-shadow:1px 1px 1px rgba(0,0,0,0.2);background-size:cover}#plugin-information #section-description .fs-screenshots ul li.odd{margin-right:20px}#plugin-information .plugin-information-pricing{margin:-16px;border-bottom:1px solid #ddd}#plugin-information .plugin-information-pricing .fs-plan h3{margin-top:0;padding:20px;font-size:16px}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper{border-bottom:1px solid #ddd}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab{cursor:pointer;position:relative;padding:0 10px;font-size:0.9em}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab label{text-transform:uppercase;color:green;background:greenyellow;position:absolute;left:-1px;right:-1px;bottom:100%;border:1px solid darkgreen;padding:2px;text-align:center;font-size:0.9em;line-height:1em}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab.nav-tab-active{cursor:default;background:#fffeec;border-bottom-color:#fffeec}#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle h3{background:#fffeec;margin:0;padding-bottom:0;color:#0073aa}#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle .nav-tab-wrapper,#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle .fs-billing-frequency{display:none}#plugin-information .plugin-information-pricing .fs-plan .fs-pricing-body{background:#fffeec;padding:20px}#plugin-information .plugin-information-pricing .fs-plan .button{width:100%;text-align:center;font-weight:bold;text-transform:uppercase;font-size:1.1em}#plugin-information .plugin-information-pricing .fs-plan label{white-space:nowrap}#plugin-information .plugin-information-pricing .fs-plan var{font-style:normal}#plugin-information .plugin-information-pricing .fs-plan .fs-billing-frequency,#plugin-information .plugin-information-pricing .fs-plan .fs-annual-discount{text-align:center;display:block;font-weight:bold;margin-bottom:10px;text-transform:uppercase;background:#F3F3F3;padding:2px;border:1px solid #ccc}#plugin-information .plugin-information-pricing .fs-plan .fs-annual-discount{text-transform:none;color:green;background:greenyellow}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms{font-size:0.9em}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms i{float:left;margin:0 0 0 -15px}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms li{margin:10px 0 0 0}#plugin-information #section-features .fs-features{margin:-20px -26px}#plugin-information #section-features table{width:100%;border-spacing:0;border-collapse:separate}#plugin-information #section-features table thead th{padding:10px 0}#plugin-information #section-features table thead .fs-price{color:#71ae00;font-weight:normal;display:block;text-align:center}#plugin-information #section-features table tbody td{border-top:1px solid #ccc;padding:10px 0;text-align:center;width:100px;color:#71ae00}#plugin-information #section-features table tbody td:first-child{text-align:left;width:auto;color:inherit;padding-left:26px}#plugin-information #section-features table tbody tr.fs-odd td{background:#fefefe}#plugin-information #section-features .dashicons-yes{width:30px;height:30px;font-size:30px}@media screen and (max-width: 961px){#fs_addons .fs-cards-list .fs-card{height:265px}}
freemius/assets/css/admin/checkout.css CHANGED
@@ -1 +1 @@
1
- @media screen and (max-width: 782px){#wpbody-content{padding-bottom:0 !important}}
1
+ @media screen and (max-width: 782px){#wpbody-content{padding-bottom:0 !important}}
freemius/assets/css/admin/common.css CHANGED
@@ -1,2 +1,2 @@
1
- #iframe{line-height:0;font-size:0}.fs-full-size-wrapper{margin:0 0 -65px -20px}@media (max-width: 782px){.fs-full-size-wrapper{margin:0 0 -65px -10px}}
2
- .fs-notice{position:relative}.fs-notice.fs-has-title{margin-bottom:30px !important}.fs-notice.success{color:green}.fs-notice.promotion{border-color:#00a0d2 !important;background-color:#f2fcff !important}.fs-notice .fs-notice-body{margin:.5em 0;padding:2px}.fs-notice .fs-close{cursor:pointer;color:#aaa;float:right}.fs-notice .fs-close:hover{color:#666}.fs-notice .fs-close>*{margin-top:7px;display:inline-block}.fs-notice label.fs-plugin-title{background:rgba(0,0,0,0.3);color:#fff;padding:2px 10px;position:absolute;top:100%;bottom:auto;right:auto;-moz-border-radius:0 0 3px 3px;-webkit-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;left:10px;font-size:12px;font-weight:bold;cursor:auto}.rtl .fs-notice .fs-close{float:left}.fs-secure-notice{position:fixed;top:32px;left:160px;right:0;background:#ebfdeb;padding:10px 20px;color:green;z-index:9999;box-shadow:0px 2px 2px rgba(6,113,6,0.3);opacity:0.95;filter:alpha(opacity=95)}.fs-secure-notice:hover{opacity:1;filter:alpha(opacity=100)}@media screen and (max-width: 960px){.fs-secure-notice{left:36px}}@media screen and (max-width: 500px){#fs_promo_tab{display:none}}@media screen and (max-width: 782px){.fs-secure-notice{left:0;top:46px;text-align:center}}span.fs-submenu-item.fs-sub:before{content:'\21B3';padding:0 5px}.rtl span.fs-submenu-item.fs-sub:before{content:'\21B2'}.fs-submenu-item.pricing.upgrade-mode{color:greenyellow}.fs-submenu-item.pricing.trial-mode{color:#83e2ff}#adminmenu .update-plugins.fs-trial{background-color:#00b9eb}
1
+ #iframe{line-height:0;font-size:0}.fs-full-size-wrapper{margin:0 0 -65px -20px}@media (max-width: 782px){.fs-full-size-wrapper{margin:0 0 -65px -10px}}
2
+ .fs-notice{position:relative}.fs-notice.fs-has-title{margin-bottom:30px !important}.fs-notice.success{color:green}.fs-notice.promotion{border-color:#00a0d2 !important;background-color:#f2fcff !important}.fs-notice .fs-notice-body{margin:.5em 0;padding:2px}.fs-notice .fs-close{cursor:pointer;color:#aaa;float:right}.fs-notice .fs-close:hover{color:#666}.fs-notice .fs-close>*{margin-top:7px;display:inline-block}.fs-notice label.fs-plugin-title{background:rgba(0,0,0,0.3);color:#fff;padding:2px 10px;position:absolute;top:100%;bottom:auto;right:auto;-moz-border-radius:0 0 3px 3px;-webkit-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;left:10px;font-size:12px;font-weight:bold;cursor:auto}.rtl .fs-notice .fs-close{float:left}.fs-secure-notice{position:fixed;top:32px;left:160px;right:0;background:#ebfdeb;padding:10px 20px;color:green;z-index:9999;box-shadow:0px 2px 2px rgba(6,113,6,0.3);opacity:0.95;filter:alpha(opacity=95)}.fs-secure-notice:hover{opacity:1;filter:alpha(opacity=100)}@media screen and (max-width: 960px){.fs-secure-notice{left:36px}}@media screen and (max-width: 500px){#fs_promo_tab{display:none}}@media screen and (max-width: 782px){.fs-secure-notice{left:0;top:46px;text-align:center}}span.fs-submenu-item.fs-sub:before{content:'\21B3';padding:0 5px}.rtl span.fs-submenu-item.fs-sub:before{content:'\21B2'}.fs-submenu-item.pricing.upgrade-mode{color:greenyellow}.fs-submenu-item.pricing.trial-mode{color:#83e2ff}#adminmenu .update-plugins.fs-trial{background-color:#00b9eb}
freemius/assets/css/admin/connect.css CHANGED
@@ -1 +1 @@
1
- #fs_connect{width:480px;-moz-box-shadow:0px 1px 2px rgba(0,0,0,0.3);-webkit-box-shadow:0px 1px 2px rgba(0,0,0,0.3);box-shadow:0px 1px 2px rgba(0,0,0,0.3);margin:20px 0}@media screen and (max-width: 479px){#fs_connect{-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;width:auto;margin:0 0 0 -10px}}#fs_connect .fs-content{background:#fff;padding:15px 20px}#fs_connect .fs-content .fs-error{background:snow;color:#d3135a;border:1px solid #d3135a;-moz-box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);text-align:center;padding:5px;margin-bottom:10px}#fs_connect .fs-content p{margin:0;padding:0;font-size:1.2em}#fs_connect .fs-license-key-container{position:relative;width:280px;margin:10px auto 0 auto}#fs_connect .fs-license-key-container input{width:100%}#fs_connect .fs-license-key-container .dashicons{position:absolute;top:5px;right:5px}#fs_connect .fs-actions{padding:10px 20px;background:#C0C7CA}#fs_connect .fs-actions .button{padding:0 10px 1px;line-height:35px;height:37px;font-size:16px;margin-bottom:0}#fs_connect .fs-actions .button .dashicons{font-size:37px;margin-left:-8px;margin-right:12px}#fs_connect .fs-actions .button.button-primary{padding-right:15px;padding-left:15px}#fs_connect .fs-actions .button.button-primary:after{content:' \279C'}#fs_connect .fs-actions .button.button-primary.fs-loading:after{content:''}#fs_connect .fs-actions .button.button-secondary{float:right}#fs_connect.fs-anonymous-disabled .fs-actions .button.button-primary{width:100%}#fs_connect .fs-permissions{padding:10px 20px;background:#FEFEFE;-moz-transition:background 0.5s ease;-o-transition:background 0.5s ease;-ms-transition:background 0.5s ease;-webkit-transition:background 0.5s ease;transition:background 0.5s ease}#fs_connect .fs-permissions .fs-license-sync-disclaimer{text-align:center;margin-top:0}#fs_connect .fs-permissions .fs-trigger{font-size:0.9em;text-decoration:none;text-align:center;display:block}#fs_connect .fs-permissions ul{height:0;overflow:hidden;margin:0}#fs_connect .fs-permissions ul li{margin-bottom:12px}#fs_connect .fs-permissions ul li:last-child{margin-bottom:0}#fs_connect .fs-permissions ul li i.dashicons{float:left;font-size:40px;width:40px;height:40px}#fs_connect .fs-permissions ul li div{margin-left:55px}#fs_connect .fs-permissions ul li div span{font-weight:bold;text-transform:uppercase;color:#23282d}#fs_connect .fs-permissions ul li div p{margin:2px 0 0 0}#fs_connect .fs-permissions.fs-open{background:#fff}#fs_connect .fs-permissions.fs-open ul{height:auto;margin:20px 20px 10px 20px}@media screen and (max-width: 479px){#fs_connect .fs-permissions{background:#fff}#fs_connect .fs-permissions .fs-trigger{display:none}#fs_connect .fs-permissions ul{height:auto;margin:20px}}#fs_connect .fs-freemium-licensing{padding:8px;background:#777;color:#fff}#fs_connect .fs-freemium-licensing p{text-align:center;display:block;margin:0;padding:0}#fs_connect .fs-freemium-licensing a{color:#C2EEFF;text-decoration:underline}#fs_connect .fs-visual{padding:12px;line-height:0;background:#fafafa;height:80px;position:relative}#fs_connect .fs-visual .fs-site-icon{position:absolute;left:20px;top:10px}#fs_connect .fs-visual .fs-connect-logo{position:absolute;right:20px;top:10px}#fs_connect .fs-visual .fs-plugin-icon{position:absolute;top:10px;left:50%;margin-left:-40px}#fs_connect .fs-visual .fs-plugin-icon,#fs_connect .fs-visual .fs-site-icon,#fs_connect .fs-visual img,#fs_connect .fs-visual object{width:80px;height:80px}#fs_connect .fs-visual .dashicons-wordpress{font-size:64px;background:#01749a;color:#fff;width:64px;height:64px;padding:8px}#fs_connect .fs-visual .dashicons-plus{position:absolute;top:50%;font-size:30px;margin-top:-10px;color:#bbb}#fs_connect .fs-visual .dashicons-plus.fs-first{left:28%}#fs_connect .fs-visual .dashicons-plus.fs-second{left:65%}#fs_connect .fs-visual .fs-plugin-icon,#fs_connect .fs-visual .fs-connect-logo,#fs_connect .fs-visual .fs-site-icon{border:1px solid #ccc;padding:1px;background:#fff}#fs_connect .fs-terms{text-align:center;font-size:0.85em;padding:5px;background:rgba(0,0,0,0.05)}#fs_connect .fs-terms,#fs_connect .fs-terms a{color:#999}#fs_connect .fs-terms a{text-decoration:none}.rtl #fs_connect .fs-actions{padding:10px 20px;background:#C0C7CA}.rtl #fs_connect .fs-actions .button .dashicons{font-size:37px;margin-left:-8px;margin-right:12px}.rtl #fs_connect .fs-actions .button.button-primary:after{content:' \000bb'}.rtl #fs_connect .fs-actions .button.button-primary.fs-loading:after{content:''}.rtl #fs_connect .fs-actions .button.button-secondary{float:left}.rtl #fs_connect .fs-permissions ul li div{margin-right:55px;margin-left:0}.rtl #fs_connect .fs-permissions ul li i.dashicons{float:right}.rtl #fs_connect .fs-visual .fs-site-icon{right:20px;left:auto}.rtl #fs_connect .fs-visual .fs-connect-logo{right:auto;left:20px}.wp-pointer-content #fs_connect{margin:0;-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none}.fs-opt-in-pointer .wp-pointer-content{padding:0}.fs-opt-in-pointer.wp-pointer-top .wp-pointer-arrow{border-bottom-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-top .wp-pointer-arrow-inner{border-bottom-color:#fafafa}.fs-opt-in-pointer.wp-pointer-bottom .wp-pointer-arrow{border-top-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-bottom .wp-pointer-arrow-inner{border-top-color:#fafafa}.fs-opt-in-pointer.wp-pointer-left .wp-pointer-arrow{border-right-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-left .wp-pointer-arrow-inner{border-right-color:#fafafa}.fs-opt-in-pointer.wp-pointer-right .wp-pointer-arrow{border-left-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-right .wp-pointer-arrow-inner{border-left-color:#fafafa}
1
+ #fs_connect{width:480px;-moz-box-shadow:0px 1px 2px rgba(0,0,0,0.3);-webkit-box-shadow:0px 1px 2px rgba(0,0,0,0.3);box-shadow:0px 1px 2px rgba(0,0,0,0.3);margin:20px 0}@media screen and (max-width: 479px){#fs_connect{-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;width:auto;margin:0 0 0 -10px}}#fs_connect .fs-content{background:#fff;padding:15px 20px}#fs_connect .fs-content .fs-error{background:snow;color:#d3135a;border:1px solid #d3135a;-moz-box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);text-align:center;padding:5px;margin-bottom:10px}#fs_connect .fs-content p{margin:0;padding:0;font-size:1.2em}#fs_connect .fs-license-key-container{position:relative;width:280px;margin:10px auto 0 auto}#fs_connect .fs-license-key-container input{width:100%}#fs_connect .fs-license-key-container .dashicons{position:absolute;top:5px;right:5px}#fs_connect .fs-actions{padding:10px 20px;background:#C0C7CA}#fs_connect .fs-actions .button{padding:0 10px 1px;line-height:35px;height:37px;font-size:16px;margin-bottom:0}#fs_connect .fs-actions .button .dashicons{font-size:37px;margin-left:-8px;margin-right:12px}#fs_connect .fs-actions .button.button-primary{padding-right:15px;padding-left:15px}#fs_connect .fs-actions .button.button-primary:after{content:' \279C'}#fs_connect .fs-actions .button.button-primary.fs-loading:after{content:''}#fs_connect .fs-actions .button.button-secondary{float:right}#fs_connect.fs-anonymous-disabled .fs-actions .button.button-primary{width:100%}#fs_connect .fs-permissions{padding:10px 20px;background:#FEFEFE;-moz-transition:background 0.5s ease;-o-transition:background 0.5s ease;-ms-transition:background 0.5s ease;-webkit-transition:background 0.5s ease;transition:background 0.5s ease}#fs_connect .fs-permissions .fs-license-sync-disclaimer{text-align:center;margin-top:0}#fs_connect .fs-permissions .fs-trigger{font-size:0.9em;text-decoration:none;text-align:center;display:block}#fs_connect .fs-permissions ul{height:0;overflow:hidden;margin:0}#fs_connect .fs-permissions ul li{margin-bottom:12px}#fs_connect .fs-permissions ul li:last-child{margin-bottom:0}#fs_connect .fs-permissions ul li i.dashicons{float:left;font-size:40px;width:40px;height:40px}#fs_connect .fs-permissions ul li div{margin-left:55px}#fs_connect .fs-permissions ul li div span{font-weight:bold;text-transform:uppercase;color:#23282d}#fs_connect .fs-permissions ul li div p{margin:2px 0 0 0}#fs_connect .fs-permissions.fs-open{background:#fff}#fs_connect .fs-permissions.fs-open ul{height:auto;margin:20px 20px 10px 20px}@media screen and (max-width: 479px){#fs_connect .fs-permissions{background:#fff}#fs_connect .fs-permissions .fs-trigger{display:none}#fs_connect .fs-permissions ul{height:auto;margin:20px}}#fs_connect .fs-freemium-licensing{padding:8px;background:#777;color:#fff}#fs_connect .fs-freemium-licensing p{text-align:center;display:block;margin:0;padding:0}#fs_connect .fs-freemium-licensing a{color:#C2EEFF;text-decoration:underline}#fs_connect .fs-visual{padding:12px;line-height:0;background:#fafafa;height:80px;position:relative}#fs_connect .fs-visual .fs-site-icon{position:absolute;left:20px;top:10px}#fs_connect .fs-visual .fs-connect-logo{position:absolute;right:20px;top:10px}#fs_connect .fs-visual .fs-plugin-icon{position:absolute;top:10px;left:50%;margin-left:-40px}#fs_connect .fs-visual .fs-plugin-icon,#fs_connect .fs-visual .fs-site-icon,#fs_connect .fs-visual img,#fs_connect .fs-visual object{width:80px;height:80px}#fs_connect .fs-visual .dashicons-wordpress{font-size:64px;background:#01749a;color:#fff;width:64px;height:64px;padding:8px}#fs_connect .fs-visual .dashicons-plus{position:absolute;top:50%;font-size:30px;margin-top:-10px;color:#bbb}#fs_connect .fs-visual .dashicons-plus.fs-first{left:28%}#fs_connect .fs-visual .dashicons-plus.fs-second{left:65%}#fs_connect .fs-visual .fs-plugin-icon,#fs_connect .fs-visual .fs-connect-logo,#fs_connect .fs-visual .fs-site-icon{border:1px solid #ccc;padding:1px;background:#fff}#fs_connect .fs-terms{text-align:center;font-size:0.85em;padding:5px;background:rgba(0,0,0,0.05)}#fs_connect .fs-terms,#fs_connect .fs-terms a{color:#999}#fs_connect .fs-terms a{text-decoration:none}.rtl #fs_connect .fs-actions{padding:10px 20px;background:#C0C7CA}.rtl #fs_connect .fs-actions .button .dashicons{font-size:37px;margin-left:-8px;margin-right:12px}.rtl #fs_connect .fs-actions .button.button-primary:after{content:' \000bb'}.rtl #fs_connect .fs-actions .button.button-primary.fs-loading:after{content:''}.rtl #fs_connect .fs-actions .button.button-secondary{float:left}.rtl #fs_connect .fs-permissions ul li div{margin-right:55px;margin-left:0}.rtl #fs_connect .fs-permissions ul li i.dashicons{float:right}.rtl #fs_connect .fs-visual .fs-site-icon{right:20px;left:auto}.rtl #fs_connect .fs-visual .fs-connect-logo{right:auto;left:20px}.wp-pointer-content #fs_connect{margin:0;-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none}.fs-opt-in-pointer .wp-pointer-content{padding:0}.fs-opt-in-pointer.wp-pointer-top .wp-pointer-arrow{border-bottom-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-top .wp-pointer-arrow-inner{border-bottom-color:#fafafa}.fs-opt-in-pointer.wp-pointer-bottom .wp-pointer-arrow{border-top-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-bottom .wp-pointer-arrow-inner{border-top-color:#fafafa}.fs-opt-in-pointer.wp-pointer-left .wp-pointer-arrow{border-right-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-left .wp-pointer-arrow-inner{border-right-color:#fafafa}.fs-opt-in-pointer.wp-pointer-right .wp-pointer-arrow{border-left-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-right .wp-pointer-arrow-inner{border-left-color:#fafafa}
freemius/assets/css/admin/deactivation-feedback.css CHANGED
@@ -1 +1 @@
1
- .fs-modal{position:fixed;overflow:auto;height:100%;width:100%;top:0;z-index:100000;display:none;background:rgba(0,0,0,0.6)}.fs-modal .fs-modal-dialog{background:transparent;position:absolute;left:50%;margin-left:-298px;padding-bottom:30px;top:-100%;z-index:100001;width:596px}@media (max-width: 650px){.fs-modal .fs-modal-dialog{margin-left:-50%;box-sizing:border-box;padding-left:10px;padding-right:10px;width:100%}.fs-modal .fs-modal-dialog .fs-modal-panel>h3>strong{font-size:1.3em}.fs-modal .fs-modal-dialog li.reason{margin-bottom:10px}.fs-modal .fs-modal-dialog li.reason .reason-input,.fs-modal .fs-modal-dialog li.reason .internal-message{margin-left:29px}.fs-modal .fs-modal-dialog li.reason label{display:table}.fs-modal .fs-modal-dialog li.reason label>span{display:table-cell;font-size:1.3em}}.fs-modal.active{display:block}.fs-modal.active:before{display:block}.fs-modal.active .fs-modal-dialog{top:10%}.fs-modal .fs-modal-body,.fs-modal .fs-modal-footer{border:0;background:#fefefe;padding:20px}.fs-modal .fs-modal-body{border-bottom:0}.fs-modal .fs-modal-body h2{font-size:20px}.fs-modal .fs-modal-body>div{margin-top:10px}.fs-modal .fs-modal-body>div h2{font-weight:bold;font-size:20px;margin-top:0}.fs-modal .fs-modal-footer{border-top:#eeeeee solid 1px;text-align:right}.fs-modal .fs-modal-footer>.button{margin:0 7px}.fs-modal .fs-modal-footer>.button:first-child{margin:0}.fs-modal .fs-modal-panel:not(.active){display:none}.fs-modal .reason-input,.fs-modal .internal-message{margin:3px 0 3px 22px}.fs-modal .reason-input input,.fs-modal .reason-input textarea,.fs-modal .internal-message input,.fs-modal .internal-message textarea{width:100%}.fs-modal li.reason.has-internal-message .internal-message{border:1px solid #ccc;padding:7px;display:none}body.has-fs-modal{overflow:hidden}#the-list .deactivate>.fs-slug{display:none}
1
+ .fs-modal{position:fixed;overflow:auto;height:100%;width:100%;top:0;z-index:100000;display:none;background:rgba(0,0,0,0.6)}.fs-modal .fs-modal-dialog{background:transparent;position:absolute;left:50%;margin-left:-298px;padding-bottom:30px;top:-100%;z-index:100001;width:596px}@media (max-width: 650px){.fs-modal .fs-modal-dialog{margin-left:-50%;box-sizing:border-box;padding-left:10px;padding-right:10px;width:100%}.fs-modal .fs-modal-dialog .fs-modal-panel>h3>strong{font-size:1.3em}.fs-modal .fs-modal-dialog li.reason{margin-bottom:10px}.fs-modal .fs-modal-dialog li.reason .reason-input,.fs-modal .fs-modal-dialog li.reason .internal-message{margin-left:29px}.fs-modal .fs-modal-dialog li.reason label{display:table}.fs-modal .fs-modal-dialog li.reason label>span{display:table-cell;font-size:1.3em}}.fs-modal.active{display:block}.fs-modal.active:before{display:block}.fs-modal.active .fs-modal-dialog{top:10%}.fs-modal .fs-modal-body,.fs-modal .fs-modal-footer{border:0;background:#fefefe;padding:20px}.fs-modal .fs-modal-body{border-bottom:0}.fs-modal .fs-modal-body h2{font-size:20px}.fs-modal .fs-modal-body>div{margin-top:10px}.fs-modal .fs-modal-body>div h2{font-weight:bold;font-size:20px;margin-top:0}.fs-modal .fs-modal-footer{border-top:#eeeeee solid 1px;text-align:right}.fs-modal .fs-modal-footer>.button{margin:0 7px}.fs-modal .fs-modal-footer>.button:first-child{margin:0}.fs-modal .fs-modal-panel:not(.active){display:none}.fs-modal .reason-input,.fs-modal .internal-message{margin:3px 0 3px 22px}.fs-modal .reason-input input,.fs-modal .reason-input textarea,.fs-modal .internal-message input,.fs-modal .internal-message textarea{width:100%}.fs-modal li.reason.has-internal-message .internal-message{border:1px solid #ccc;padding:7px;display:none}body.has-fs-modal{overflow:hidden}#the-list .deactivate>.fs-slug{display:none}
freemius/assets/css/admin/debug.css CHANGED
@@ -1 +1 @@
1
- .switch{position:relative;display:inline-block;font-size:1.6em;font-weight:bold;color:#ccc;text-shadow:0px 1px 1px rgba(255,255,255,0.8);height:18px;padding:6px 6px 5px 6px;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);border-radius:4px;background:#ececec;box-shadow:0px 0px 4px rgba(0,0,0,0.1),inset 0px 1px 3px 0px rgba(0,0,0,0.1);cursor:pointer}.switch span{display:inline-block;width:35px;text-transform:uppercase}.switch span.on{color:#6bc406}.switch .toggle{position:absolute;top:1px;width:37px;height:25px;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.3);border-radius:4px;background:#fff;background:-moz-linear-gradient(top, #ececec 0%, #fff 100%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #ececec), color-stop(100%, #fff));background:-webkit-linear-gradient(top, #ececec 0%, #fff 100%);background:-o-linear-gradient(top, #ececec 0%, #fff 100%);background:-ms-linear-gradient(top, #ececec 0%, #fff 100%);background:linear-gradient(top, #ececec 0%, #fff 100%);box-shadow:inset 0px 1px 0px 0px rgba(255,255,255,0.5);z-index:999;-moz-transition:all 0.15s ease-in-out;-o-transition:all 0.15s ease-in-out;-ms-transition:all 0.15s ease-in-out;-webkit-transition:all 0.15s ease-in-out;transition:all 0.15s ease-in-out}.switch.on .toggle{left:2%}.switch.off .toggle{left:54%}.switch.round{padding:0px 20px;border-radius:40px}.switch.round .toggle{border-radius:40px;width:14px;height:14px}.switch.round.on .toggle{left:3%;background:#6bc406}.switch.round.off .toggle{left:58%}.switch-label{font-size:20px;line-height:31px;margin:0 5px}#fs_log_book table{font-family:Consolas,Monaco,monospace;font-size:12px}#fs_log_book table th{color:#ccc}#fs_log_book table tr{background:#232525}#fs_log_book table tr.alternate{background:#2b2b2b}#fs_log_book table tr td.fs-col--logger{color:#5a7435}#fs_log_book table tr td.fs-col--type{color:#ffc861}#fs_log_book table tr td.fs-col--function{color:#a7b7b1;font-weight:bold}#fs_log_book table tr td.fs-col--message,#fs_log_book table tr td.fs-col--message a{color:#9a73ac !important}#fs_log_book table tr td.fs-col--file{color:#d07922}#fs_log_book table tr td.fs-col--timestamp{color:#6596be}
1
+ .switch{position:relative;display:inline-block;font-size:1.6em;font-weight:bold;color:#ccc;text-shadow:0px 1px 1px rgba(255,255,255,0.8);height:18px;padding:6px 6px 5px 6px;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);border-radius:4px;background:#ececec;box-shadow:0px 0px 4px rgba(0,0,0,0.1),inset 0px 1px 3px 0px rgba(0,0,0,0.1);cursor:pointer}.switch span{display:inline-block;width:35px;text-transform:uppercase}.switch span.on{color:#6bc406}.switch .toggle{position:absolute;top:1px;width:37px;height:25px;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.3);border-radius:4px;background:#fff;background:-moz-linear-gradient(top, #ececec 0%, #fff 100%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #ececec), color-stop(100%, #fff));background:-webkit-linear-gradient(top, #ececec 0%, #fff 100%);background:-o-linear-gradient(top, #ececec 0%, #fff 100%);background:-ms-linear-gradient(top, #ececec 0%, #fff 100%);background:linear-gradient(top, #ececec 0%, #fff 100%);box-shadow:inset 0px 1px 0px 0px rgba(255,255,255,0.5);z-index:999;-moz-transition:all 0.15s ease-in-out;-o-transition:all 0.15s ease-in-out;-ms-transition:all 0.15s ease-in-out;-webkit-transition:all 0.15s ease-in-out;transition:all 0.15s ease-in-out}.switch.on .toggle{left:2%}.switch.off .toggle{left:54%}.switch.round{padding:0px 20px;border-radius:40px}.switch.round .toggle{border-radius:40px;width:14px;height:14px}.switch.round.on .toggle{left:3%;background:#6bc406}.switch.round.off .toggle{left:58%}.switch-label{font-size:20px;line-height:31px;margin:0 5px}#fs_log_book table{font-family:Consolas,Monaco,monospace;font-size:12px}#fs_log_book table th{color:#ccc}#fs_log_book table tr{background:#232525}#fs_log_book table tr.alternate{background:#2b2b2b}#fs_log_book table tr td.fs-col--logger{color:#5a7435}#fs_log_book table tr td.fs-col--type{color:#ffc861}#fs_log_book table tr td.fs-col--function{color:#a7b7b1;font-weight:bold}#fs_log_book table tr td.fs-col--message,#fs_log_book table tr td.fs-col--message a{color:#9a73ac !important}#fs_log_book table tr td.fs-col--file{color:#d07922}#fs_log_book table tr td.fs-col--timestamp{color:#6596be}
freemius/assets/css/admin/license-activation.css CHANGED
@@ -1 +1 @@
1
- .fs-modal{position:fixed;overflow:auto;height:100%;width:100%;top:0;z-index:100000;display:none;background:rgba(0,0,0,0.6)}.fs-modal .fs-modal-dialog{background:transparent;position:absolute;left:50%;margin-left:-298px;padding-bottom:30px;top:-100%;z-index:100001;width:596px}@media (max-width: 650px){.fs-modal .fs-modal-dialog{margin-left:-50%;box-sizing:border-box;padding-left:10px;padding-right:10px;width:100%}.fs-modal .fs-modal-dialog .fs-modal-panel>h3>strong{font-size:1.3em}}.fs-modal.active{display:block}.fs-modal.active:before{display:block}.fs-modal.active .fs-modal-dialog{top:10%}.fs-modal .fs-modal-body,.fs-modal .fs-modal-footer{border:0;background:#fefefe;padding:20px}.fs-modal .fs-modal-body{border-bottom:0}.fs-modal .fs-modal-body .license-activation-message{margin:0;display:none}.fs-modal .fs-modal-body input.license_key{width:100%}.fs-modal .fs-modal-body p{font-size:14px}.fs-modal .fs-modal-body h2{font-size:20px}.fs-modal .fs-modal-body>div{margin-top:10px}.fs-modal .fs-modal-body>div h2{font-weight:bold;font-size:20px;margin-top:0}.fs-modal .fs-modal-footer{border-top:#eeeeee solid 1px;text-align:right}.fs-modal .fs-modal-footer>.button{margin:0 7px}.fs-modal .fs-modal-footer>.button:first-child{margin:0}.fs-modal .fs-modal-panel:not(.active){display:none}body.has-fs-modal{overflow:hidden}
1
+ .fs-modal{position:fixed;overflow:auto;height:100%;width:100%;top:0;z-index:100000;display:none;background:rgba(0,0,0,0.6)}.fs-modal .fs-modal-dialog{background:transparent;position:absolute;left:50%;margin-left:-298px;padding-bottom:30px;top:-100%;z-index:100001;width:596px}@media (max-width: 650px){.fs-modal .fs-modal-dialog{margin-left:-50%;box-sizing:border-box;padding-left:10px;padding-right:10px;width:100%}.fs-modal .fs-modal-dialog .fs-modal-panel>h3>strong{font-size:1.3em}}.fs-modal.active{display:block}.fs-modal.active:before{display:block}.fs-modal.active .fs-modal-dialog{top:10%}.fs-modal .fs-modal-body,.fs-modal .fs-modal-footer{border:0;background:#fefefe;padding:20px}.fs-modal .fs-modal-body{border-bottom:0}.fs-modal .fs-modal-body .license-activation-message{margin:0;display:none}.fs-modal .fs-modal-body input.license_key{width:100%}.fs-modal .fs-modal-body p{font-size:14px}.fs-modal .fs-modal-body h2{font-size:20px}.fs-modal .fs-modal-body>div{margin-top:10px}.fs-modal .fs-modal-body>div h2{font-weight:bold;font-size:20px;margin-top:0}.fs-modal .fs-modal-footer{border-top:#eeeeee solid 1px;text-align:right}.fs-modal .fs-modal-footer>.button{margin:0 7px}.fs-modal .fs-modal-footer>.button:first-child{margin:0}.fs-modal .fs-modal-panel:not(.active){display:none}body.has-fs-modal{overflow:hidden}
freemius/assets/index.php CHANGED
@@ -1,3 +1,3 @@
1
- <?php
2
- // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
1
+ <?php
2
+ // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
freemius/assets/js/nojquery.ba-postmessage.js CHANGED
@@ -1,140 +1,140 @@
1
- /*!
2
- * jQuery postMessage - v0.5 - 9/11/2009
3
- * http://benalman.com/projects/jquery-postmessage-plugin/
4
- *
5
- * Copyright (c) 2009 "Cowboy" Ben Alman
6
- * Dual licensed under the MIT and GPL licenses.
7
- * http://benalman.com/about/license/
8
- *
9
- * Non-jQuery fork by Jeff Lee
10
- *
11
- * This fork consists of the following changes:
12
- * 1. Basic code cleanup and restructuring, for legibility.
13
- * 2. The `postMessage` and `receiveMessage` functions can be bound arbitrarily,
14
- * in terms of both function names and object scope. Scope is specified by
15
- * the the "this" context of NoJQueryPostMessageMixin();
16
- * 3. I've removed the check for Opera 9.64, which used `$.browser`. There were
17
- * at least three different GitHub users requesting the removal of this
18
- * "Opera sniff" on the original project's Issues page, so I figured this
19
- * would be a relatively safe change.
20
- * 4. `postMessage` no longer uses `$.param` to serialize messages that are not
21
- * strings. I actually prefer this structure anyway. `receiveMessage` does
22
- * not implement a corresponding deserialization step, and as such it seems
23
- * cleaner and more symmetric to leave both data serialization and
24
- * deserialization to the client.
25
- * 5. The use of `$.isFunction` is replaced by a functionally-identical check.
26
- * 6. The `$:nomunge` YUI option is no longer necessary.
27
- */
28
-
29
- function NoJQueryPostMessageMixin(postBinding, receiveBinding) {
30
-
31
- var setMessageCallback, unsetMessageCallback, currentMsgCallback,
32
- intervalId, lastHash, cacheBust = 1;
33
-
34
- if (window.postMessage) {
35
-
36
- if (window.addEventListener) {
37
- setMessageCallback = function(callback) {
38
- window.addEventListener('message', callback, false);
39
- }
40
-
41
- unsetMessageCallback = function(callback) {
42
- window.removeEventListener('message', callback, false);
43
- }
44
- } else {
45
- setMessageCallback = function(callback) {
46
- window.attachEvent('onmessage', callback);
47
- }
48
-
49
- unsetMessageCallback = function(callback) {
50
- window.detachEvent('onmessage', callback);
51
- }
52
- }
53
-
54
- this[postBinding] = function(message, targetUrl, target) {
55
- if (!targetUrl) {
56
- return;
57
- }
58
-
59
- // The browser supports window.postMessage, so call it with a targetOrigin
60
- // set appropriately, based on the targetUrl parameter.
61
- target.postMessage( message, targetUrl.replace( /([^:]+:\/\/[^\/]+).*/, '$1' ) );
62
- }
63
-
64
- // Since the browser supports window.postMessage, the callback will be
65
- // bound to the actual event associated with window.postMessage.
66
- this[receiveBinding] = function(callback, sourceOrigin, delay) {
67
- // Unbind an existing callback if it exists.
68
- if (currentMsgCallback) {
69
- unsetMessageCallback(currentMsgCallback);
70
- currentMsgCallback = null;
71
- }
72
-
73
- if (!callback) {
74
- return false;
75
- }
76
-
77
- // Bind the callback. A reference to the callback is stored for ease of
78
- // unbinding.
79
- currentMsgCallback = setMessageCallback(function(e) {
80
- switch(Object.prototype.toString.call(sourceOrigin)) {
81
- case '[object String]':
82
- if (sourceOrigin !== e.origin) {
83
- return false;
84
- }
85
- break;
86
- case '[object Function]':
87
- if (sourceOrigin(e.origin)) {
88
- return false;
89
- }
90
- break;
91
- }
92
-
93
- callback(e);
94
- });
95
- };
96
-
97
- } else {
98
-
99
- this[postBinding] = function(message, targetUrl, target) {
100
- if (!targetUrl) {
101
- return;
102
- }
103
-
104
- // The browser does not support window.postMessage, so set the location
105
- // of the target to targetUrl#message. A bit ugly, but it works! A cache
106
- // bust parameter is added to ensure that repeat messages trigger the
107
- // callback.
108
- target.location = targetUrl.replace( /#.*$/, '' ) + '#' + (+new Date) + (cacheBust++) + '&' + message;
109
- }
110
-
111
- // Since the browser sucks, a polling loop will be started, and the
112
- // callback will be called whenever the location.hash changes.
113
- this[receiveBinding] = function(callback, sourceOrigin, delay) {
114
- if (intervalId) {
115
- clearInterval(intervalId);
116
- intervalId = null;
117
- }
118
-
119
- if (callback) {
120
- delay = typeof sourceOrigin === 'number'
121
- ? sourceOrigin
122
- : typeof delay === 'number'
123
- ? delay
124
- : 100;
125
-
126
- intervalId = setInterval(function(){
127
- var hash = document.location.hash,
128
- re = /^#?\d+&/;
129
- if ( hash !== lastHash && re.test( hash ) ) {
130
- lastHash = hash;
131
- callback({ data: hash.replace( re, '' ) });
132
- }
133
- }, delay );
134
- }
135
- };
136
-
137
- }
138
-
139
- return this;
140
  }
1
+ /*!
2
+ * jQuery postMessage - v0.5 - 9/11/2009
3
+ * http://benalman.com/projects/jquery-postmessage-plugin/
4
+ *
5
+ * Copyright (c) 2009 "Cowboy" Ben Alman
6
+ * Dual licensed under the MIT and GPL licenses.
7
+ * http://benalman.com/about/license/
8
+ *
9
+ * Non-jQuery fork by Jeff Lee
10
+ *
11
+ * This fork consists of the following changes:
12
+ * 1. Basic code cleanup and restructuring, for legibility.
13
+ * 2. The `postMessage` and `receiveMessage` functions can be bound arbitrarily,
14
+ * in terms of both function names and object scope. Scope is specified by
15
+ * the the "this" context of NoJQueryPostMessageMixin();
16
+ * 3. I've removed the check for Opera 9.64, which used `$.browser`. There were
17
+ * at least three different GitHub users requesting the removal of this
18
+ * "Opera sniff" on the original project's Issues page, so I figured this
19
+ * would be a relatively safe change.
20
+ * 4. `postMessage` no longer uses `$.param` to serialize messages that are not
21
+ * strings. I actually prefer this structure anyway. `receiveMessage` does
22
+ * not implement a corresponding deserialization step, and as such it seems
23
+ * cleaner and more symmetric to leave both data serialization and
24
+ * deserialization to the client.
25
+ * 5. The use of `$.isFunction` is replaced by a functionally-identical check.
26
+ * 6. The `$:nomunge` YUI option is no longer necessary.
27
+ */
28
+
29
+ function NoJQueryPostMessageMixin(postBinding, receiveBinding) {
30
+
31
+ var setMessageCallback, unsetMessageCallback, currentMsgCallback,
32
+ intervalId, lastHash, cacheBust = 1;
33
+
34
+ if (window.postMessage) {
35
+
36
+ if (window.addEventListener) {
37
+ setMessageCallback = function(callback) {
38
+ window.addEventListener('message', callback, false);
39
+ }
40
+
41
+ unsetMessageCallback = function(callback) {
42
+ window.removeEventListener('message', callback, false);
43
+ }
44
+ } else {
45
+ setMessageCallback = function(callback) {
46
+ window.attachEvent('onmessage', callback);
47
+ }
48
+
49
+ unsetMessageCallback = function(callback) {
50
+ window.detachEvent('onmessage', callback);
51
+ }
52
+ }
53
+
54
+ this[postBinding] = function(message, targetUrl, target) {
55
+ if (!targetUrl) {
56
+ return;
57
+ }
58
+
59
+ // The browser supports window.postMessage, so call it with a targetOrigin
60
+ // set appropriately, based on the targetUrl parameter.
61
+ target.postMessage( message, targetUrl.replace( /([^:]+:\/\/[^\/]+).*/, '$1' ) );
62
+ }
63
+
64
+ // Since the browser supports window.postMessage, the callback will be
65
+ // bound to the actual event associated with window.postMessage.
66
+ this[receiveBinding] = function(callback, sourceOrigin, delay) {
67
+ // Unbind an existing callback if it exists.
68
+ if (currentMsgCallback) {
69
+ unsetMessageCallback(currentMsgCallback);
70
+ currentMsgCallback = null;
71
+ }
72
+
73
+ if (!callback) {
74
+ return false;
75
+ }
76
+
77
+ // Bind the callback. A reference to the callback is stored for ease of
78
+ // unbinding.
79
+ currentMsgCallback = setMessageCallback(function(e) {
80
+ switch(Object.prototype.toString.call(sourceOrigin)) {
81
+ case '[object String]':
82
+ if (sourceOrigin !== e.origin) {
83
+ return false;
84
+ }
85
+ break;
86
+ case '[object Function]':
87
+ if (sourceOrigin(e.origin)) {
88
+ return false;
89
+ }
90
+ break;
91
+ }
92
+
93
+ callback(e);
94
+ });
95
+ };
96
+
97
+ } else {
98
+
99
+ this[postBinding] = function(message, targetUrl, target) {
100
+ if (!targetUrl) {
101
+ return;
102
+ }
103
+
104
+ // The browser does not support window.postMessage, so set the location
105
+ // of the target to targetUrl#message. A bit ugly, but it works! A cache
106
+ // bust parameter is added to ensure that repeat messages trigger the
107
+ // callback.
108
+ target.location = targetUrl.replace( /#.*$/, '' ) + '#' + (+new Date) + (cacheBust++) + '&' + message;
109
+ }
110
+
111
+ // Since the browser sucks, a polling loop will be started, and the
112
+ // callback will be called whenever the location.hash changes.
113
+ this[receiveBinding] = function(callback, sourceOrigin, delay) {
114
+ if (intervalId) {
115
+ clearInterval(intervalId);
116
+ intervalId = null;
117
+ }
118
+
119
+ if (callback) {
120
+ delay = typeof sourceOrigin === 'number'
121
+ ? sourceOrigin
122
+ : typeof delay === 'number'
123
+ ? delay
124
+ : 100;
125
+
126
+ intervalId = setInterval(function(){
127
+ var hash = document.location.hash,
128
+ re = /^#?\d+&/;
129
+ if ( hash !== lastHash && re.test( hash ) ) {
130
+ lastHash = hash;
131
+ callback({ data: hash.replace( re, '' ) });
132
+ }
133
+ }, delay );
134
+ }
135
+ };
136
+
137
+ }
138
+
139
+ return this;
140
  }
freemius/assets/js/nojquery.ba-postmessage.min.js CHANGED
@@ -1,12 +1,12 @@
1
- /*
2
- * nojquery-postmessage by Jeff Lee
3
- * a non-jQuery fork of:
4
- *
5
- * jQuery postMessage - v0.5 - 9/11/2009
6
- * http://benalman.com/projects/jquery-postmessage-plugin/
7
- *
8
- * Copyright (c) 2009 "Cowboy" Ben Alman
9
- * Dual licensed under the MIT and GPL licenses.
10
- * http://benalman.com/about/license/
11
- */
12
  function NoJQueryPostMessageMixin(g,a){var b,h,e,d,f,c=1;if(window.postMessage){if(window.addEventListener){b=function(i){window.addEventListener("message",i,false)};h=function(i){window.removeEventListener("message",i,false)}}else{b=function(i){window.attachEvent("onmessage",i)};h=function(i){window.detachEvent("onmessage",i)}}this[g]=function(i,k,j){if(!k){return}j.postMessage(i,k.replace(/([^:]+:\/\/[^\/]+).*/,"$1"))};this[a]=function(k,j,i){if(e){h(e);e=null}if(!k){return false}e=b(function(l){switch(Object.prototype.toString.call(j)){case"[object String]":if(j!==l.origin){return false}break;case"[object Function]":if(j(l.origin)){return false}break}k(l)})}}else{this[g]=function(i,k,j){if(!k){return}j.location=k.replace(/#.*$/,"")+"#"+(+new Date)+(c++)+"&"+i};this[a]=function(k,j,i){if(d){clearInterval(d);d=null}if(k){i=typeof j==="number"?j:typeof i==="number"?i:100;d=setInterval(function(){var m=document.location.hash,l=/^#?\d+&/;if(m!==f&&l.test(m)){f=m;k({data:m.replace(l,"")})}},i)}}}return this};
1
+ /*
2
+ * nojquery-postmessage by Jeff Lee
3
+ * a non-jQuery fork of:
4
+ *
5
+ * jQuery postMessage - v0.5 - 9/11/2009
6
+ * http://benalman.com/projects/jquery-postmessage-plugin/
7
+ *
8
+ * Copyright (c) 2009 "Cowboy" Ben Alman
9
+ * Dual licensed under the MIT and GPL licenses.
10
+ * http://benalman.com/about/license/
11
+ */
12
  function NoJQueryPostMessageMixin(g,a){var b,h,e,d,f,c=1;if(window.postMessage){if(window.addEventListener){b=function(i){window.addEventListener("message",i,false)};h=function(i){window.removeEventListener("message",i,false)}}else{b=function(i){window.attachEvent("onmessage",i)};h=function(i){window.detachEvent("onmessage",i)}}this[g]=function(i,k,j){if(!k){return}j.postMessage(i,k.replace(/([^:]+:\/\/[^\/]+).*/,"$1"))};this[a]=function(k,j,i){if(e){h(e);e=null}if(!k){return false}e=b(function(l){switch(Object.prototype.toString.call(j)){case"[object String]":if(j!==l.origin){return false}break;case"[object Function]":if(j(l.origin)){return false}break}k(l)})}}else{this[g]=function(i,k,j){if(!k){return}j.location=k.replace(/#.*$/,"")+"#"+(+new Date)+(c++)+"&"+i};this[a]=function(k,j,i){if(d){clearInterval(d);d=null}if(k){i=typeof j==="number"?j:typeof i==="number"?i:100;d=setInterval(function(){var m=document.location.hash,l=/^#?\d+&/;if(m!==f&&l.test(m)){f=m;k({data:m.replace(l,"")})}},i)}}}return this};
freemius/assets/js/postmessage.js CHANGED
@@ -1,135 +1,135 @@
1
- (function ($, undef) {
2
- var global = this;
3
-
4
- // Namespace.
5
- global.FS = global.FS || {};
6
-
7
- global.FS.PostMessage = function ()
8
- {
9
- var
10
- _is_child = false,
11
- _postman = new NoJQueryPostMessageMixin('postMessage', 'receiveMessage'),
12
- _callbacks = {},
13
- _base_url,
14
- _parent_url = decodeURIComponent(document.location.hash.replace(/^#/, '')),
15
- _parent_subdomain = _parent_url.substring(0, _parent_url.indexOf('/', ('https://' === _parent_url.substring(0, ('https://').length)) ? 8 : 7)),
16
- _init = function () {
17
- _postman.receiveMessage(function (e) {
18
- var data = JSON.parse(e.data);
19
-
20
- if (_callbacks[data.type]) {
21
- for (var i = 0; i < _callbacks[data.type].length; i++) {
22
- // Execute type callbacks.
23
- _callbacks[data.type][i](data.data);
24
- }
25
- }
26
- }, _base_url);
27
- },
28
- _hasParent = ('' !== _parent_url),
29
- $window = $(window),
30
- $html = $('html');
31
-
32
- return {
33
- init : function (url, iframes)
34
- {
35
- _base_url = url;
36
- _init();
37
-
38
- // Automatically receive forward messages.
39
- FS.PostMessage.receiveOnce('forward', function (data){
40
- window.location = data.url;
41
- });
42
-
43
- iframes = iframes || [];
44
-
45
- if (iframes.length > 0) {
46
- $window.on('scroll', function () {
47
- for (var i = 0; i < iframes.length; i++) {
48
- FS.PostMessage.postScroll(iframes[i]);
49
- }
50
- });
51
- }
52
- },
53
- init_child : function ()
54
- {
55
- this.init(_parent_subdomain);
56
-
57
- _is_child = true;
58
-
59
- // Post height of a child right after window is loaded.
60
- $(window).bind('load', function () {
61
- FS.PostMessage.postHeight();
62
-
63
- // Post message that window was loaded.
64
- FS.PostMessage.post('loaded');
65
- });
66
- },
67
- hasParent : function ()
68
- {
69
- return _hasParent;
70
- },
71
- postHeight : function (diff, wrapper) {
72
- diff = diff || 0;
73
- wrapper = wrapper || '#wrap_section';
74
- this.post('height', {
75
- height: diff + $(wrapper).outerHeight(true)
76
- });
77
- },
78
- postScroll : function (iframe) {
79
- this.post('scroll', {
80
- top: $window.scrollTop(),
81
- height: ($window.height() - parseFloat($html.css('paddingTop')) - parseFloat($html.css('marginTop')))
82
- }, iframe);
83
- },
84
- post : function (type, data, iframe)
85
- {
86
- console.debug('PostMessage.post', type);
87
-
88
- if (iframe)
89
- {
90
- // Post to iframe.
91
- _postman.postMessage(JSON.stringify({
92
- type: type,
93
- data: data
94
- }), iframe.src, iframe.contentWindow);
95
- }
96
- else {
97
- // Post to parent.
98
- _postman.postMessage(JSON.stringify({
99
- type: type,
100
- data: data
101
- }), _parent_url, window.parent);
102
- }
103
- },
104
- receive: function (type, callback)
105
- {
106
- console.debug('PostMessage.receive', type);
107
-
108
- if (undef === _callbacks[type])
109
- _callbacks[type] = [];
110
-
111
- _callbacks[type].push(callback);
112
- },
113
- receiveOnce: function (type, callback)
114
- {
115
- if (this.is_set(type))
116
- return;
117
-
118
- this.receive(type, callback);
119
- },
120
- // Check if any callbacks assigned to a specified message type.
121
- is_set: function (type)
122
- {
123
- return (undef != _callbacks[type]);
124
- },
125
- parent_url: function ()
126
- {
127
- return _parent_url;
128
- },
129
- parent_subdomain: function ()
130
- {
131
- return _parent_subdomain;
132
- }
133
- };
134
- }();
135
  })(jQuery);
1
+ (function ($, undef) {
2
+ var global = this;
3
+
4
+ // Namespace.
5
+ global.FS = global.FS || {};
6
+
7
+ global.FS.PostMessage = function ()
8
+ {
9
+ var
10
+ _is_child = false,
11
+ _postman = new NoJQueryPostMessageMixin('postMessage', 'receiveMessage'),
12
+ _callbacks = {},
13
+ _base_url,
14
+ _parent_url = decodeURIComponent(document.location.hash.replace(/^#/, '')),
15
+ _parent_subdomain = _parent_url.substring(0, _parent_url.indexOf('/', ('https://' === _parent_url.substring(0, ('https://').length)) ? 8 : 7)),
16
+ _init = function () {
17
+ _postman.receiveMessage(function (e) {
18
+ var data = JSON.parse(e.data);
19
+
20
+ if (_callbacks[data.type]) {
21
+ for (var i = 0; i < _callbacks[data.type].length; i++) {
22
+ // Execute type callbacks.
23
+ _callbacks[data.type][i](data.data);
24
+ }
25
+ }
26
+ }, _base_url);
27
+ },
28
+ _hasParent = ('' !== _parent_url),
29
+ $window = $(window),
30
+ $html = $('html');
31
+
32
+ return {
33
+ init : function (url, iframes)
34
+ {
35
+ _base_url = url;
36
+ _init();
37
+
38
+ // Automatically receive forward messages.
39
+ FS.PostMessage.receiveOnce('forward', function (data){
40
+ window.location = data.url;
41
+ });
42
+
43
+ iframes = iframes || [];
44
+
45
+ if (iframes.length > 0) {
46
+ $window.on('scroll', function () {
47
+ for (var i = 0; i < iframes.length; i++) {
48
+ FS.PostMessage.postScroll(iframes[i]);
49
+ }
50
+ });
51
+ }
52
+ },
53
+ init_child : function ()
54
+ {
55
+ this.init(_parent_subdomain);
56
+
57
+ _is_child = true;
58
+
59
+ // Post height of a child right after window is loaded.
60
+ $(window).bind('load', function () {
61
+ FS.PostMessage.postHeight();
62
+
63
+ // Post message that window was loaded.
64
+ FS.PostMessage.post('loaded');
65
+ });
66
+ },
67
+ hasParent : function ()
68
+ {
69
+ return _hasParent;
70
+ },
71
+ postHeight : function (diff, wrapper) {
72
+ diff = diff || 0;
73
+ wrapper = wrapper || '#wrap_section';
74
+ this.post('height', {
75
+ height: diff + $(wrapper).outerHeight(true)
76
+ });
77
+ },
78
+ postScroll : function (iframe) {
79
+ this.post('scroll', {
80
+ top: $window.scrollTop(),
81
+ height: ($window.height() - parseFloat($html.css('paddingTop')) - parseFloat($html.css('marginTop')))
82
+ }, iframe);
83
+ },
84
+ post : function (type, data, iframe)
85
+ {
86
+ console.debug('PostMessage.post', type);
87
+
88
+ if (iframe)
89
+ {
90
+ // Post to iframe.
91
+ _postman.postMessage(JSON.stringify({
92
+ type: type,
93
+ data: data
94
+ }), iframe.src, iframe.contentWindow);
95
+ }
96
+ else {
97
+ // Post to parent.
98
+ _postman.postMessage(JSON.stringify({
99
+ type: type,
100
+ data: data
101
+ }), _parent_url, window.parent);
102
+ }
103
+ },
104
+ receive: function (type, callback)
105
+ {
106
+ console.debug('PostMessage.receive', type);
107
+
108
+ if (undef === _callbacks[type])
109
+ _callbacks[type] = [];
110
+
111
+ _callbacks[type].push(callback);
112
+ },
113
+ receiveOnce: function (type, callback)
114
+ {
115
+ if (this.is_set(type))
116
+ return;
117
+
118
+ this.receive(type, callback);
119
+ },
120
+ // Check if any callbacks assigned to a specified message type.
121
+ is_set: function (type)
122
+ {
123
+ return (undef != _callbacks[type]);
124
+ },
125
+ parent_url: function ()
126
+ {
127
+ return _parent_url;
128
+ },
129
+ parent_subdomain: function ()
130
+ {
131
+ return _parent_subdomain;
132
+ }
133
+ };
134
+ }();
135
  })(jQuery);
freemius/assets/scss/admin/_deactivation-feedback.scss CHANGED
@@ -1,55 +1,55 @@
1
- @import "../colors";
2
-
3
- .fs-modal.fs-modal-deactivation-feedback {
4
- .reason-input, .internal-message {
5
- margin: 3px 0 3px 22px;
6
-
7
- input, textarea {
8
- width: 100%;
9
- }
10
- }
11
-
12
- li.reason {
13
- &.has-internal-message .internal-message {
14
- border: 1px solid lighten($darkest-color, 80%);
15
- padding: 7px;
16
- display: none;
17
- }
18
-
19
- @media (max-width: 650px) {
20
- li.reason {
21
- margin-bottom: 10px;
22
-
23
- .reason-input, .internal-message {
24
- margin-left: 29px;
25
- }
26
-
27
- label {
28
- display: table;
29
-
30
- > span {
31
- display: table-cell;
32
- font-size: 1.3em;
33
- }
34
- }
35
- }
36
- }
37
- }
38
-
39
- .anonymous-feedback-label {
40
- float: left;
41
- }
42
-
43
- .fs-modal-panel {
44
- margin-top: 0 !important;
45
-
46
- h3 {
47
- margin-top: 0;
48
- line-height: 1.5em;
49
- }
50
- }
51
- }
52
-
53
- #the-list .deactivate > .fs-slug {
54
- display: none;
55
  }
1
+ @import "../colors";
2
+
3
+ .fs-modal.fs-modal-deactivation-feedback {
4
+ .reason-input, .internal-message {
5
+ margin: 3px 0 3px 22px;
6
+
7
+ input, textarea {
8
+ width: 100%;
9
+ }
10
+ }
11
+
12
+ li.reason {
13
+ &.has-internal-message .internal-message {
14
+ border: 1px solid lighten($darkest-color, 80%);
15
+ padding: 7px;
16
+ display: none;
17
+ }
18
+
19
+ @media (max-width: 650px) {
20
+ li.reason {
21
+ margin-bottom: 10px;
22
+
23
+ .reason-input, .internal-message {
24
+ margin-left: 29px;
25
+ }
26
+
27
+ label {
28
+ display: table;
29
+
30
+ > span {
31
+ display: table-cell;
32
+ font-size: 1.3em;
33
+ }
34
+ }
35
+ }
36
+ }
37
+ }
38
+
39
+ .anonymous-feedback-label {
40
+ float: left;
41
+ }
42
+
43
+ .fs-modal-panel {
44
+ margin-top: 0 !important;
45
+
46
+ h3 {
47
+ margin-top: 0;
48
+ line-height: 1.5em;
49
+ }
50
+ }
51
+ }
52
+
53
+ #the-list .deactivate > .fs-slug {
54
+ display: none;
55
  }
freemius/assets/scss/admin/_license-activation.scss CHANGED
@@ -1,7 +1,7 @@
1
- .fs-modal.fs-modal-license-activation {
2
- .fs-modal-body {
3
- input.license_key {
4
- width: 100%;
5
- }
6
- }
7
  }
1
+ .fs-modal.fs-modal-license-activation {
2
+ .fs-modal-body {
3
+ input.license_key {
4
+ width: 100%;
5
+ }
6
+ }
7
  }
freemius/assets/scss/admin/_license-key-resend.scss CHANGED
@@ -1,68 +1,68 @@
1
- .fs-modal.fs-modal-license-key-resend
2
- {
3
- .email-address-container
4
- {
5
- overflow: hidden;
6
- padding-right: 2px;
7
- }
8
-
9
- &.fs-freemium
10
- {
11
- input.email-address
12
- {
13
- width: 300px;
14
- }
15
-
16
- label
17
- {
18
- display: block;
19
- margin-bottom: 10px;
20
- }
21
- }
22
-
23
- &.fs-premium
24
- {
25
- input.email-address
26
- {
27
- width: 100%;
28
- }
29
-
30
- .button-container
31
- {
32
- float: right;
33
- margin-left: 7px;
34
-
35
- @media (max-width: 650px) {
36
- margin-top: 2px;
37
- }
38
- }
39
- }
40
- }
41
-
42
- .rtl
43
- {
44
- .fs-modal.fs-modal-license-key-resend
45
- {
46
- .fs-modal-body
47
- {
48
- .input-container > .email-address-container
49
- {
50
- padding-left: 2px;
51
- padding-right: 0;
52
- }
53
-
54
- .button-container
55
- {
56
- float: left;
57
- margin-right: 7px;
58
- margin-left: 0;
59
- }
60
- }
61
- }
62
- }
63
-
64
- a.show-license-resend-modal
65
- {
66
- margin-top: 4px;
67
- display: inline-block;
68
- }
1
+ .fs-modal.fs-modal-license-key-resend
2
+ {
3
+ .email-address-container
4
+ {
5
+ overflow: hidden;
6
+ padding-right: 2px;
7
+ }
8
+
9
+ &.fs-freemium
10
+ {
11
+ input.email-address
12
+ {
13
+ width: 300px;
14
+ }
15
+
16
+ label
17
+ {
18
+ display: block;
19
+ margin-bottom: 10px;
20
+ }
21
+ }
22
+
23
+ &.fs-premium
24
+ {
25
+ input.email-address
26
+ {
27
+ width: 100%;
28
+ }
29
+
30
+ .button-container
31
+ {
32
+ float: right;
33
+ margin-left: 7px;
34
+
35
+ @media (max-width: 650px) {
36
+ margin-top: 2px;
37
+ }
38
+ }
39
+ }
40
+ }
41
+
42
+ .rtl
43
+ {
44
+ .fs-modal.fs-modal-license-key-resend
45
+ {
46
+ .fs-modal-body
47
+ {
48
+ .input-container > .email-address-container
49
+ {
50
+ padding-left: 2px;
51
+ padding-right: 0;
52
+ }
53
+
54
+ .button-container
55
+ {
56
+ float: left;
57
+ margin-right: 7px;
58
+ margin-left: 0;
59
+ }
60
+ }
61
+ }
62
+ }
63
+
64
+ a.show-license-resend-modal
65
+ {
66
+ margin-top: 4px;
67
+ display: inline-block;
68
+ }
freemius/assets/scss/admin/account.scss CHANGED
@@ -1,250 +1,250 @@
1
- @import "../start";
2
-
3
- #fs_account
4
- {
5
- .postbox,
6
- .widefat
7
- {
8
- max-width: 700px;
9
- }
10
-
11
- h3
12
- {
13
- font-size: 1.3em;
14
- padding: 12px 15px;
15
- margin: 0 0 12px 0;
16
- line-height: 1.4;
17
- border-bottom: 1px solid #F1F1F1;
18
- }
19
-
20
- i.dashicons
21
- {
22
- font-size: 1.2em;
23
- height: 1.2em;
24
- width: 1.2em;
25
- }
26
-
27
- .button
28
- {
29
- i.dashicons
30
- {
31
- vertical-align: middle;
32
- }
33
- }
34
-
35
- .fs-header-actions
36
- {
37
- position: absolute;
38
- top: 17px;
39
- right: 15px;
40
- font-size: 0.9em;
41
-
42
- ul
43
- {
44
- margin: 0;
45
- }
46
-
47
- li
48
- {
49
- form
50
- {
51
- display: inline-block;
52
- }
53
-
54
- float: left;
55
- a
56
- {
57
- text-decoration: none;
58
- }
59
- }
60
- }
61
- }
62
-
63
- #fs_account_details .button-group {
64
- float: right;
65
- }
66
-
67
- .rtl #fs_account .fs-header-actions
68
- {
69
- left: 15px;
70
- right: auto;
71
- }
72
-
73
- .fs-key-value-table
74
- {
75
- width: 100%;
76
-
77
- form
78
- {
79
- display: inline-block;
80
- }
81
-
82
- tr
83
- {
84
- td:first-child
85
- {
86
- nobr
87
- {
88
- font-weight: bold;
89
- }
90
-
91
- text-align: right;
92
-
93
- form
94
- {
95
- display: block;
96
- }
97
- }
98
-
99
- td.fs-right
100
- {
101
- text-align: right;
102
- }
103
-
104
- &.fs-odd
105
- {
106
- background: #ebebeb;
107
- }
108
- }
109
-
110
- td, th
111
- {
112
- padding: 10px;
113
- }
114
-
115
- code {
116
- line-height: 28px;
117
- }
118
-
119
- var, code, input[type="text"]
120
- {
121
- color: #0073AA;
122
- font-size: 16px;
123
- background: none;
124
- }
125
-
126
- input[type="text"] {
127
- width: 100%;
128
- font-weight: bold;
129
- }
130
- }
131
-
132
- label.fs-tag
133
- {
134
- background: #ffba00;
135
- color: #fff;
136
- display: inline-block;
137
- border-radius: 3px;
138
- padding: 5px;
139
- font-size: 11px;
140
- line-height: 11px;
141
- vertical-align: baseline;
142
-
143
- &.fs-warn
144
- {
145
- background: #ffba00;
146
- }
147
- &.fs-success
148
- {
149
- background: #46b450;
150
- }
151
- &.fs-error
152
- {
153
- background: #dc3232;
154
- }
155
- }
156
-
157
- #fs_addons
158
- {
159
- h3
160
- {
161
- border: none;
162
- margin-bottom: 0;
163
- padding: 4px 5px;
164
- }
165
-
166
- td
167
- {
168
- vertical-align: middle;
169
- }
170
-
171
- thead {
172
- white-space: nowrap;
173
- }
174
-
175
- td:first-child,
176
- th:first-child
177
- {
178
- text-align: left;
179
- font-weight: bold;
180
- }
181
- td:last-child,
182
- th:last-child
183
- {
184
- text-align: right;
185
- }
186
- th
187
- {
188
- font-weight: bold;
189
- }
190
- }
191
-
192
- #fs_billing_address {
193
- width: 100%;
194
-
195
- tr {
196
- td {
197
- width: 50%;
198
- padding: 5px;
199
- }
200
-
201
- &:first-of-type {
202
- td {
203
- padding-top: 0;
204
- }
205
- }
206
- }
207
-
208
- @mixin read-mode {
209
- border-color: transparent;
210
- color: #777;
211
- border-bottom: 1px dashed #ccc;
212
- padding-left: 0;
213
- background: none;
214
- }
215
-
216
- span {
217
- font-weight: bold;
218
- }
219
-
220
- input, select {
221
- @include placeholder(transparent);
222
-
223
- display: block;
224
- width: 100%;
225
- margin-top: 5px;
226
-
227
- &.fs-read-mode {
228
- @include read-mode();
229
- }
230
- }
231
-
232
-
233
- &.fs-read-mode {
234
- td span {
235
- display: none;
236
- }
237
-
238
- input, select
239
- {
240
- @include read-mode();
241
- @include placeholder(#ccc);
242
- }
243
- }
244
-
245
-
246
- button {
247
- display: block;
248
- width: 100%;
249
- }
250
  }
1
+ @import "../start";
2
+
3
+ #fs_account
4
+ {
5
+ .postbox,
6
+ .widefat
7
+ {
8
+ max-width: 700px;
9
+ }
10
+
11
+ h3
12
+ {
13
+ font-size: 1.3em;
14
+ padding: 12px 15px;
15
+ margin: 0 0 12px 0;
16
+ line-height: 1.4;
17
+ border-bottom: 1px solid #F1F1F1;
18
+ }
19
+
20
+ i.dashicons
21
+ {
22
+ font-size: 1.2em;
23
+ height: 1.2em;
24
+ width: 1.2em;
25
+ }
26
+
27
+ .button
28
+ {
29
+ i.dashicons
30
+ {
31
+ vertical-align: middle;
32
+ }
33
+ }
34
+
35
+ .fs-header-actions
36
+ {
37
+ position: absolute;
38
+ top: 17px;
39
+ right: 15px;
40
+ font-size: 0.9em;
41
+
42
+ ul
43
+ {
44
+ margin: 0;
45
+ }
46
+
47
+ li
48
+ {
49
+ form
50
+ {
51
+ display: inline-block;
52
+ }
53
+
54
+ float: left;
55
+ a
56
+ {
57
+ text-decoration: none;
58
+ }
59
+ }
60
+ }
61
+ }
62
+
63
+ #fs_account_details .button-group {
64
+ float: right;
65
+ }
66
+
67
+ .rtl #fs_account .fs-header-actions
68
+ {
69
+ left: 15px;
70
+ right: auto;
71
+ }
72
+
73
+ .fs-key-value-table
74
+ {
75
+ width: 100%;
76
+
77
+ form
78
+ {
79
+ display: inline-block;
80
+ }
81
+
82
+ tr
83
+ {
84
+ td:first-child
85
+ {
86
+ nobr
87
+ {
88
+ font-weight: bold;
89
+ }
90
+
91
+ text-align: right;
92
+
93
+ form
94
+ {
95
+ display: block;
96
+ }
97
+ }
98
+
99
+ td.fs-right
100
+ {
101
+ text-align: right;
102
+ }
103
+
104
+ &.fs-odd
105
+ {
106
+ background: #ebebeb;
107
+ }
108
+ }
109
+
110
+ td, th
111
+ {
112
+ padding: 10px;
113
+ }
114
+
115
+ code {
116
+ line-height: 28px;
117
+ }
118
+
119
+ var, code, input[type="text"]
120
+ {
121
+ color: #0073AA;
122
+ font-size: 16px;
123
+ background: none;
124
+ }
125
+
126
+ input[type="text"] {
127
+ width: 100%;
128
+ font-weight: bold;
129
+ }
130
+ }
131
+
132
+ label.fs-tag
133
+ {
134
+ background: #ffba00;
135
+ color: #fff;
136
+ display: inline-block;
137
+ border-radius: 3px;
138
+ padding: 5px;
139
+ font-size: 11px;
140
+ line-height: 11px;
141
+ vertical-align: baseline;
142
+
143
+ &.fs-warn
144
+ {
145
+ background: #ffba00;
146
+ }
147
+ &.fs-success
148
+ {
149
+ background: #46b450;
150
+ }
151
+ &.fs-error
152
+ {
153
+ background: #dc3232;
154
+ }
155
+ }
156
+
157
+ #fs_addons
158
+ {
159
+ h3
160
+ {
161
+ border: none;
162
+ margin-bottom: 0;
163
+ padding: 4px 5px;
164
+ }
165
+
166
+ td
167
+ {
168
+ vertical-align: middle;
169
+ }
170
+
171
+ thead {
172
+ white-space: nowrap;
173
+ }
174
+
175
+ td:first-child,
176
+ th:first-child
177
+ {
178
+ text-align: left;
179
+ font-weight: bold;
180
+ }
181
+ td:last-child,
182
+ th:last-child
183
+ {
184
+ text-align: right;
185
+ }
186
+ th
187
+ {
188
+ font-weight: bold;
189
+ }
190
+ }
191
+
192
+ #fs_billing_address {
193
+ width: 100%;
194
+
195
+ tr {
196
+ td {
197
+ width: 50%;
198
+ padding: 5px;
199
+ }
200
+
201
+ &:first-of-type {
202
+ td {
203
+ padding-top: 0;
204
+ }
205
+ }
206
+ }
207
+
208
+ @mixin read-mode {
209
+ border-color: transparent;
210
+ color: #777;
211
+ border-bottom: 1px dashed #ccc;
212
+ padding-left: 0;
213
+ background: none;
214
+ }
215
+
216
+ span {
217
+ font-weight: bold;
218
+ }
219
+
220
+ input, select {
221
+ @include placeholder(transparent);
222
+
223
+ display: block;
224
+ width: 100%;
225
+ margin-top: 5px;
226
+
227
+ &.fs-read-mode {
228
+ @include read-mode();
229
+ }
230
+ }
231
+
232
+
233
+ &.fs-read-mode {
234
+ td span {
235
+ display: none;
236
+ }
237
+
238
+ input, select
239
+ {
240
+ @include read-mode();
241
+ @include placeholder(#ccc);
242
+ }
243
+ }
244
+
245
+
246
+ button {
247
+ display: block;
248
+ width: 100%;
249
+ }
250
  }
freemius/assets/scss/admin/add-ons.scss CHANGED
@@ -1,449 +1,449 @@
1
- @import "../start";
2
-
3
- #fs_addons
4
- {
5
- .fs-cards-list
6
- {
7
- list-style: none;
8
-
9
- .fs-card
10
- {
11
- float: left;
12
- // height: 185px; // With reviews/ratings
13
- height: 152px;
14
- width: 310px;
15
- padding: 0;
16
- margin: 0 0 30px 30px;
17
- font-size: 14px;
18
- list-style: none;
19
- border: 1px solid #ddd;
20
- cursor: pointer;
21
- position: relative;
22
-
23
- .fs-overlay
24
- {
25
- position: absolute;
26
- left: 0;
27
- right: 0;
28
- bottom: 0;
29
- top: 0;
30
- z-index: 9;
31
- }
32
-
33
- .fs-inner
34
- {
35
- background-color: #fff;
36
- overflow: hidden;
37
- height: 100%;
38
- position: relative;
39
-
40
- ul
41
- {
42
- @include transition(all, 0.15s);
43
- left: 0;
44
- right: 0;
45
- top: 0;
46
- position: absolute;
47
- }
48
-
49
- li
50
- {
51
- list-style: none;
52
- line-height: 18px;
53
- padding: 0 15px;
54
- width: 100%;
55
- display: block;
56
- @include box-sizing(border-box);
57
- }
58
-
59
- .fs-card-banner
60
- {
61
- padding: 0;
62
- margin: 0;
63
- line-height: 0;
64
- display: block;
65
- height: 100px;
66
- background-repeat: repeat-x;
67
- background-size: 100% 100%;
68
- @include transition(all, 0.15s);
69
- }
70
-
71
- .fs-title
72
- {
73
- margin: 10px 0 0 0;
74
- height: 18px;
75
- overflow: hidden;
76
- color: #000;
77
- white-space: nowrap;
78
- text-overflow: ellipsis;
79
- font-weight: bold;
80
- }
81
-
82
- .fs-offer
83
- {
84
- font-size: 0.9em;
85
- }
86
-
87
- .fs-description
88
- {
89
- background-color: #f9f9f9;
90
- padding: 10px 15px 100px 15px;
91
- border-top: 1px solid #eee;
92
- margin: 0 0 10px 0;
93
- color: #777;
94
- }
95
-
96
- .fs-tag
97
- {
98
- position: absolute;
99
- top: 10px;
100
- right: 0px;
101
- background: greenyellow;
102
- display: block;
103
- padding: 2px 10px;
104
- @include box-shadow(1px 1px 1px rgba(0,0,0,0.3));
105
- text-transform: uppercase;
106
- font-size: 0.9em;
107
- font-weight: bold;
108
- }
109
-
110
- .fs-cta
111
- {
112
- .button
113
- {
114
- position: absolute;
115
- top: 112px;
116
- right: 10px;
117
- }
118
- }
119
- }
120
-
121
- @media screen and (min-width: 960px) {
122
- &:hover
123
- {
124
- .fs-overlay
125
- {
126
- border: 2px solid $fms-link-color;
127
- margin-left: -1px;
128
- margin-top: -1px;
129
- }
130
-
131
- .fs-inner
132
- {
133
- ul
134
- {
135
- top: -100px;
136
- }
137
-
138
- .fs-card-banner
139
- {
140
- // background-position: 50% -100px;
141
- }
142
-
143
- .fs-title,
144
- .fs-offer
145
- {
146
- color: $fms-link-color;
147
- }
148
- }
149
- }
150
- }
151
- }
152
- }
153
- }
154
-
155
- #TB_window
156
- {
157
- &, iframe
158
- {
159
- width: 772px !important;
160
- }
161
- }
162
-
163
- #plugin-information
164
- {
165
- #section-description
166
- {
167
- h2, h3, p, b, i, blockquote, li, ul, ol
168
- {
169
- clear: none;
170
- }
171
-
172
- .fs-selling-points
173
- {
174
- padding-bottom: 10px;
175
- border-bottom: 1px solid #ddd;
176
-
177
- ul
178
- {
179
- margin: 0;
180
-
181
- li
182
- {
183
- padding: 0;
184
- list-style: none outside none;
185
-
186
- i.dashicons
187
- {
188
- color: $fs-logo-green-color;
189
- font-size: 3em;
190
- vertical-align: middle;
191
- line-height: 30px;
192
- float: left;
193
- margin: 0 0 0 -15px;
194
- }
195
-
196
- h3
197
- {
198
- margin: 1em 30px !important;
199
- }
200
- }
201
- }
202
- }
203
-
204
- .fs-screenshots
205
- {
206
- @include clearfix();
207
- ul
208
- {
209
- list-style: none;
210
- margin: 0;
211
-
212
- li
213
- {
214
- width: 225px;
215
- height: 225px;
216
- float: left;
217
- margin-bottom: 20px;
218
- @include box-sizing(content-box);
219
-
220
- a
221
- {
222
- display: block;
223
- width: 100%;
224
- height: 100%;
225
- border: 1px solid;
226
- @include box-shadow(1px 1px 1px rgba(0, 0, 0, 0.2));
227
- background-size: cover;
228
- }
229
-
230
- &.odd
231
- {
232
- margin-right: 20px;
233
- }
234
- }
235
- }
236
- }
237
- }
238
-
239
- .plugin-information-pricing
240
- {
241
- $pricing_color: #FFFEEC;
242
- $borders_color: #DDD;
243
- margin: -16px;
244
- // padding: 20px;
245
- border-bottom: 1px solid $borders_color;
246
-
247
- .fs-plan
248
- {
249
-
250
- h3
251
- {
252
- margin-top: 0;
253
- padding: 20px;
254
- font-size: 16px;
255
- }
256
-
257
- .nav-tab-wrapper
258
- {
259
- border-bottom: 1px solid $borders_color;
260
-
261
- .nav-tab
262
- {
263
- cursor: pointer;
264
- position: relative;
265
- padding: 0 10px;
266
- font-size: 0.9em;
267
-
268
- label
269
- {
270
- text-transform: uppercase;
271
- color: green;
272
- background: greenyellow;
273
- position: absolute;
274
- left: -1px;
275
- right: -1px;
276
- bottom: 100%;
277
- border: 1px solid darkgreen;
278
- padding: 2px;
279
- text-align: center;
280
- font-size: 0.9em;
281
- line-height: 1em;
282
- }
283
-
284
- &.nav-tab-active
285
- {
286
- cursor: default;
287
- background: $pricing_color;
288
- border-bottom-color: $pricing_color;
289
- }
290
- }
291
- }
292
-
293
- &.fs-single-cycle
294
- {
295
- h3
296
- {
297
- background: $pricing_color;
298
- margin: 0;
299
- padding-bottom: 0;
300
- color: #0073aa;
301
- }
302
-
303
- .nav-tab-wrapper,
304
- .fs-billing-frequency
305
- {
306
- display: none;
307
- }
308
- }
309
-
310
- .fs-pricing-body
311
- {
312
- background: $pricing_color;
313
- padding: 20px;
314
- }
315
-
316
- .button
317
- {
318
- width: 100%;
319
- text-align: center;
320
- font-weight: bold;
321
- text-transform: uppercase;
322
- font-size: 1.1em;
323
- }
324
-
325
- label
326
- {
327
- white-space: nowrap;
328
- }
329
-
330
- var {
331
- font-style: normal;
332
- }
333
-
334
- .fs-billing-frequency,
335
- .fs-annual-discount
336
- {
337
- text-align: center;
338
- display: block;
339
- font-weight: bold;
340
- margin-bottom: 10px;
341
- text-transform: uppercase;
342
- background: #F3F3F3;
343
- padding: 2px;
344
- border: 1px solid #ccc;
345
- }
346
-
347
- .fs-annual-discount
348
- {
349
- text-transform: none;
350
- color: green;
351
- background: greenyellow;
352
- }
353
-
354
- ul.fs-trial-terms
355
- {
356
- font-size: 0.9em;
357
-
358
- i
359
- {
360
- float: left;
361
- margin: 0 0 0 -15px;
362
- }
363
-
364
- li
365
- {
366
- margin: 10px 0 0 0;
367
- }
368
- }
369
- }
370
- }
371
-
372
- #section-features
373
- {
374
- .fs-features
375
- {
376
- margin: -20px -26px;
377
- }
378
-
379
- table
380
- {
381
- width: 100%;
382
- border-spacing: 0;
383
- border-collapse: separate;
384
-
385
- thead
386
- {
387
- th
388
- {
389
- padding: 10px 0;
390
- }
391
-
392
- .fs-price
393
- {
394
- color: $fs-logo-green-color;
395
- font-weight: normal;
396
- display: block;
397
- text-align: center;
398
- }
399
- }
400
-
401
- tbody
402
- {
403
- td
404
- {
405
- border-top: 1px solid #ccc;
406
- padding: 10px 0;
407
- text-align: center;
408
- width: 100px;
409
- color: $fs-logo-green-color;
410
-
411
- &:first-child
412
- {
413
- text-align: left;
414
- width: auto;
415
- color: inherit;
416
- padding-left: 26px;
417
- }
418
- }
419
- tr.fs-odd
420
- {
421
- td
422
- {
423
- background: #fefefe;
424
- }
425
- }
426
- }
427
- }
428
-
429
- .dashicons-yes
430
- {
431
- width: 30px;
432
- height: 30px;
433
- font-size: 30px;
434
- }
435
- }
436
- }
437
-
438
- @media screen and (max-width: 961px) {
439
- #fs_addons
440
- {
441
- .fs-cards-list
442
- {
443
- .fs-card
444
- {
445
- height: 265px;
446
- }
447
- }
448
- }
449
  }
1
+ @import "../start";
2
+
3
+ #fs_addons
4
+ {
5
+ .fs-cards-list
6
+ {
7
+ list-style: none;
8
+
9
+ .fs-card
10
+ {
11
+ float: left;
12
+ // height: 185px; // With reviews/ratings
13
+ height: 152px;
14
+ width: 310px;
15
+ padding: 0;
16
+ margin: 0 0 30px 30px;
17
+ font-size: 14px;
18
+ list-style: none;
19
+ border: 1px solid #ddd;
20
+ cursor: pointer;
21
+ position: relative;
22
+
23
+ .fs-overlay
24
+ {
25
+ position: absolute;
26
+ left: 0;
27
+ right: 0;
28
+ bottom: 0;
29
+ top: 0;
30
+ z-index: 9;
31
+ }
32
+
33
+ .fs-inner
34
+ {
35
+ background-color: #fff;
36
+ overflow: hidden;
37
+ height: 100%;
38
+ position: relative;
39
+
40
+ ul
41
+ {
42
+ @include transition(all, 0.15s);
43
+ left: 0;
44
+ right: 0;
45
+ top: 0;
46
+ position: absolute;
47
+ }
48
+
49
+ li
50
+ {
51
+ list-style: none;
52
+ line-height: 18px;
53
+ padding: 0 15px;
54
+ width: 100%;
55
+ display: block;
56
+ @include box-sizing(border-box);
57
+ }
58
+
59
+ .fs-card-banner
60
+ {
61
+ padding: 0;
62
+ margin: 0;
63
+ line-height: 0;
64
+ display: block;
65
+ height: 100px;
66
+ background-repeat: repeat-x;
67
+ background-size: 100% 100%;
68
+ @include transition(all, 0.15s);
69
+ }
70
+
71
+ .fs-title
72
+ {
73
+ margin: 10px 0 0 0;
74
+ height: 18px;
75
+ overflow: hidden;
76
+ color: #000;
77
+ white-space: nowrap;
78
+ text-overflow: ellipsis;
79
+ font-weight: bold;
80
+ }
81
+
82
+ .fs-offer
83
+ {
84
+ font-size: 0.9em;
85
+ }
86
+
87
+ .fs-description
88
+ {
89
+ background-color: #f9f9f9;
90
+ padding: 10px 15px 100px 15px;
91
+ border-top: 1px solid #eee;
92
+ margin: 0 0 10px 0;
93
+ color: #777;
94
+ }
95
+
96
+ .fs-tag
97
+ {
98
+ position: absolute;
99
+ top: 10px;
100
+ right: 0px;
101
+ background: greenyellow;
102
+ display: block;
103
+ padding: 2px 10px;
104
+ @include box-shadow(1px 1px 1px rgba(0,0,0,0.3));
105
+ text-transform: uppercase;
106
+ font-size: 0.9em;
107
+ font-weight: bold;
108
+ }
109
+
110
+ .fs-cta
111
+ {
112
+ .button
113
+ {
114
+ position: absolute;
115
+ top: 112px;
116
+ right: 10px;
117
+ }
118
+ }
119
+ }
120
+
121
+ @media screen and (min-width: 960px) {
122
+ &:hover
123
+ {
124
+ .fs-overlay
125
+ {
126
+ border: 2px solid $fms-link-color;
127
+ margin-left: -1px;
128
+ margin-top: -1px;
129
+ }
130
+
131
+ .fs-inner
132
+ {
133
+ ul
134
+ {
135
+ top: -100px;
136
+ }
137
+
138
+ .fs-card-banner
139
+ {
140
+ // background-position: 50% -100px;
141
+ }
142
+
143
+ .fs-title,
144
+ .fs-offer
145
+ {
146
+ color: $fms-link-color;
147
+ }
148
+ }
149
+ }
150
+ }
151
+ }
152
+ }
153
+ }
154
+
155
+ #TB_window
156
+ {
157
+ &, iframe
158
+ {
159
+ width: 772px !important;
160
+ }
161
+ }
162
+
163
+ #plugin-information
164
+ {
165
+ #section-description
166
+ {
167
+ h2, h3, p, b, i, blockquote, li, ul, ol
168
+ {
169
+ clear: none;
170
+ }
171
+
172
+ .fs-selling-points
173
+ {
174
+ padding-bottom: 10px;
175
+ border-bottom: 1px solid #ddd;
176
+
177
+ ul
178
+ {
179
+ margin: 0;
180
+
181
+ li
182
+ {
183
+ padding: 0;
184
+ list-style: none outside none;
185
+
186
+ i.dashicons
187
+ {
188
+ color: $fs-logo-green-color;
189
+ font-size: 3em;
190
+ vertical-align: middle;
191
+ line-height: 30px;
192
+ float: left;
193
+ margin: 0 0 0 -15px;
194
+ }
195
+
196
+ h3
197
+ {
198
+ margin: 1em 30px !important;
199
+ }
200
+ }
201
+ }
202
+ }
203
+
204
+ .fs-screenshots
205
+ {
206
+ @include clearfix();
207
+ ul
208
+ {
209
+ list-style: none;
210
+ margin: 0;
211
+
212
+ li
213
+ {
214
+ width: 225px;
215
+ height: 225px;
216
+ float: left;
217
+ margin-bottom: 20px;
218
+ @include box-sizing(content-box);
219
+
220
+ a
221
+ {
222
+ display: block;
223
+ width: 100%;
224
+ height: 100%;
225
+ border: 1px solid;
226
+ @include box-shadow(1px 1px 1px rgba(0, 0, 0, 0.2));
227
+ background-size: cover;
228
+ }
229
+
230
+ &.odd
231
+ {
232
+ margin-right: 20px;
233
+ }
234
+ }
235
+ }
236
+ }
237
+ }
238
+
239
+ .plugin-information-pricing
240
+ {
241
+ $pricing_color: #FFFEEC;
242
+ $borders_color: #DDD;
243
+ margin: -16px;
244
+ // padding: 20px;
245
+ border-bottom: 1px solid $borders_color;
246
+
247
+ .fs-plan
248
+ {
249
+
250
+ h3
251
+ {
252
+ margin-top: 0;
253
+ padding: 20px;
254
+ font-size: 16px;
255
+ }
256
+
257
+ .nav-tab-wrapper
258
+ {
259
+ border-bottom: 1px solid $borders_color;
260
+
261
+ .nav-tab
262
+ {
263
+ cursor: pointer;
264
+ position: relative;
265
+ padding: 0 10px;
266
+ font-size: 0.9em;
267
+
268
+ label
269
+ {
270
+ text-transform: uppercase;
271
+ color: green;
272
+ background: greenyellow;
273
+ position: absolute;
274
+ left: -1px;
275
+ right: -1px;
276
+ bottom: 100%;
277
+ border: 1px solid darkgreen;
278
+ padding: 2px;
279
+ text-align: center;
280
+ font-size: 0.9em;
281
+ line-height: 1em;
282
+ }
283
+
284
+ &.nav-tab-active
285
+ {
286
+ cursor: default;
287
+ background: $pricing_color;
288
+ border-bottom-color: $pricing_color;
289
+ }
290
+ }
291
+ }
292
+
293
+ &.fs-single-cycle
294
+ {
295
+ h3
296
+ {
297
+ background: $pricing_color;
298
+ margin: 0;
299
+ padding-bottom: 0;
300
+ color: #0073aa;
301
+ }
302
+
303
+ .nav-tab-wrapper,
304
+ .fs-billing-frequency
305
+ {
306
+ display: none;
307
+ }
308
+ }
309
+
310
+ .fs-pricing-body
311
+ {
312
+ background: $pricing_color;
313
+ padding: 20px;
314
+ }
315
+
316
+ .button
317
+ {
318
+ width: 100%;
319
+ text-align: center;
320
+ font-weight: bold;
321
+ text-transform: uppercase;
322
+ font-size: 1.1em;
323
+ }
324
+
325
+ label
326
+ {
327
+ white-space: nowrap;
328
+ }
329
+
330
+ var {
331
+ font-style: normal;
332
+ }
333
+
334
+ .fs-billing-frequency,
335
+ .fs-annual-discount
336
+ {
337
+ text-align: center;
338
+ display: block;
339
+ font-weight: bold;
340
+ margin-bottom: 10px;
341
+ text-transform: uppercase;
342
+ background: #F3F3F3;
343
+ padding: 2px;
344
+ border: 1px solid #ccc;
345
+ }
346
+
347
+ .fs-annual-discount
348
+ {
349
+ text-transform: none;
350
+ color: green;
351
+ background: greenyellow;
352
+ }
353
+
354
+ ul.fs-trial-terms
355
+ {
356
+ font-size: 0.9em;
357
+
358
+ i
359
+ {
360
+ float: left;
361
+ margin: 0 0 0 -15px;
362
+ }
363
+
364
+ li
365
+ {
366
+ margin: 10px 0 0 0;
367
+ }
368
+ }
369
+ }
370
+ }
371
+
372
+ #section-features
373
+ {
374
+ .fs-features
375
+ {
376
+ margin: -20px -26px;
377
+ }
378
+
379
+ table
380
+ {
381
+ width: 100%;
382
+ border-spacing: 0;
383
+ border-collapse: separate;
384
+
385
+ thead
386
+ {
387
+ th
388
+ {
389
+ padding: 10px 0;
390
+ }
391
+
392
+ .fs-price
393
+ {
394
+ color: $fs-logo-green-color;
395
+ font-weight: normal;
396
+ display: block;
397
+ text-align: center;
398
+ }
399
+ }
400
+
401
+ tbody
402
+ {
403
+ td
404
+ {
405
+ border-top: 1px solid #ccc;
406
+ padding: 10px 0;
407
+ text-align: center;
408
+ width: 100px;
409
+ color: $fs-logo-green-color;
410
+
411
+ &:first-child
412
+ {
413
+ text-align: left;
414
+ width: auto;
415
+ color: inherit;
416
+ padding-left: 26px;
417
+ }
418
+ }
419
+ tr.fs-odd
420
+ {
421
+ td
422
+ {
423
+ background: #fefefe;
424
+ }
425
+ }
426
+ }
427
+ }
428
+
429
+ .dashicons-yes
430
+ {
431
+ width: 30px;
432
+ height: 30px;
433
+ font-size: 30px;
434
+ }
435
+ }
436
+ }
437
+
438
+ @media screen and (max-width: 961px) {
439
+ #fs_addons
440
+ {
441
+ .fs-cards-list
442
+ {
443
+ .fs-card
444
+ {
445
+ height: 265px;
446
+ }
447
+ }
448
+ }
449
  }
freemius/assets/scss/admin/checkout.scss CHANGED
@@ -1,5 +1,5 @@
1
- @media screen and (max-width: 782px) {
2
- #wpbody-content {
3
- padding-bottom: 0 !important;
4
- }
5
  }
1
+ @media screen and (max-width: 782px) {
2
+ #wpbody-content {
3
+ padding-bottom: 0 !important;
4
+ }
5
  }
freemius/assets/scss/admin/common.scss CHANGED
@@ -1,173 +1,173 @@
1
- @import "../start";
2
-
3
- #iframe {
4
- line-height: 0;
5
- font-size: 0;
6
- }
7
-
8
- .fs-full-size-wrapper {
9
- margin: 0 0 -65px -20px;
10
-
11
- @media (max-width: $admin_mobile_max_width) {
12
- margin: 0 0 -65px -10px;
13
- }
14
- }
15
-
16
- .fs-notice
17
- {
18
- position: relative;
19
-
20
- &.fs-has-title
21
- {
22
- margin-bottom: 30px !important;
23
- }
24
-
25
- &.success
26
- {
27
- color: green;
28
- // font-weight: normal;
29
- }
30
-
31
- &.promotion
32
- {
33
- border-color: $fs-notice-promotion-border-color !important;
34
- background-color: $fs-notice-promotion-bkg !important;
35
- }
36
-
37
- .fs-notice-body
38
- {
39
- margin: .5em 0;
40
- padding: 2px;
41
- }
42
-
43
- .fs-close
44
- {
45
- // position: absolute;
46
- // top: 2px;
47
- // bottom: 2px;
48
- // right: 2px;
49
- // min-width: 100px;
50
- // text-align: center;
51
- // padding-right: 2px;
52
- cursor: pointer;
53
- color: #aaa;
54
- float: right;
55
-
56
- &:hover
57
- {
58
- color: #666;
59
- // background: #A9A9A9;
60
- }
61
-
62
- > *
63
- {
64
- margin-top: 7px;
65
- display: inline-block;
66
- }
67
- }
68
-
69
- label.fs-plugin-title
70
- {
71
- background: rgba(0, 0, 0, 0.3);
72
- color: #fff;
73
- padding: 2px 10px;
74
- position: absolute;
75
- top: 100%;
76
- bottom: auto;
77
- right: auto;
78
- @include border-radius(0 0 3px 3px);
79
- left: 10px;
80
- font-size: 12px;
81
- font-weight: bold;
82
- cursor: auto;
83
- }
84
- }
85
-
86
- .rtl .fs-notice
87
- {
88
- .fs-close
89
- {
90
- // left: 2px;
91
- // right: auto;
92
- // padding-right: 0;
93
- // padding-left: 2px;
94
- float: left;
95
- }
96
- }
97
-
98
- .fs-secure-notice
99
- {
100
- position: fixed;
101
- top: 32px;
102
- left: 160px;
103
- right: 0;
104
- background: rgb(235, 253, 235);
105
- padding: 10px 20px;
106
- color: green;
107
- z-index: 9999;
108
- box-shadow: 0px 2px 2px rgba(6, 113, 6, 0.3);
109
- @include opacity(0.95);
110
-
111
- &:hover
112
- {
113
- @include opacity(1);
114
- }
115
- }
116
-
117
- @media screen and (max-width: 960px) {
118
- .fs-secure-notice
119
- {
120
- left: 36px;
121
- }
122
- }
123
-
124
- @media screen and (max-width:500px) {
125
- #fs_promo_tab {
126
- display: none;
127
- }
128
- }
129
-
130
- @media screen and (max-width: 782px) {
131
- .fs-secure-notice
132
- {
133
- left: 0;
134
- top: 46px;
135
- text-align: center;
136
- }
137
- }
138
-
139
- span.fs-submenu-item.fs-sub:before
140
- {
141
- // Add small arrow.
142
- content: '\21B3';
143
- padding: 0 5px;
144
- }
145
-
146
- .rtl
147
- {
148
- span.fs-submenu-item.fs-sub:before
149
- {
150
- // Add small RTL arrow.
151
- content: '\21B2';
152
- }
153
- }
154
-
155
- .fs-submenu-item
156
- {
157
- &.pricing
158
- {
159
- &.upgrade-mode
160
- {
161
- color: greenyellow;
162
- }
163
-
164
- &.trial-mode
165
- {
166
- color: #83e2ff;
167
- }
168
- }
169
- }
170
-
171
- #adminmenu .update-plugins.fs-trial {
172
- background-color: #00b9eb;
173
  }
1
+ @import "../start";
2
+
3
+ #iframe {
4
+ line-height: 0;
5
+ font-size: 0;
6
+ }
7
+
8
+ .fs-full-size-wrapper {
9
+ margin: 0 0 -65px -20px;
10
+
11
+ @media (max-width: $admin_mobile_max_width) {
12
+ margin: 0 0 -65px -10px;
13
+ }
14
+ }
15
+
16
+ .fs-notice
17
+ {
18
+ position: relative;
19
+
20
+ &.fs-has-title
21
+ {
22
+ margin-bottom: 30px !important;
23
+ }
24
+
25
+ &.success
26
+ {
27
+ color: green;
28
+ // font-weight: normal;
29
+ }
30
+
31
+ &.promotion
32
+ {
33
+ border-color: $fs-notice-promotion-border-color !important;
34
+ background-color: $fs-notice-promotion-bkg !important;
35
+ }
36
+
37
+ .fs-notice-body
38
+ {
39
+ margin: .5em 0;
40
+ padding: 2px;
41
+ }
42
+
43
+ .fs-close
44
+ {
45
+ // position: absolute;
46
+ // top: 2px;
47
+ // bottom: 2px;
48
+ // right: 2px;
49
+ // min-width: 100px;
50
+ // text-align: center;
51
+ // padding-right: 2px;
52
+ cursor: pointer;
53
+ color: #aaa;
54
+ float: right;
55
+
56
+ &:hover
57
+ {
58
+ color: #666;
59
+ // background: #A9A9A9;
60
+ }
61
+
62
+ > *
63
+ {
64
+ margin-top: 7px;
65
+ display: inline-block;
66
+ }
67
+ }
68
+
69
+ label.fs-plugin-title
70
+ {
71
+ background: rgba(0, 0, 0, 0.3);
72
+ color: #fff;
73
+ padding: 2px 10px;
74
+ position: absolute;
75
+ top: 100%;
76
+ bottom: auto;
77
+ right: auto;
78
+ @include border-radius(0 0 3px 3px);
79
+ left: 10px;
80
+ font-size: 12px;
81
+ font-weight: bold;
82
+ cursor: auto;
83
+ }
84
+ }
85
+
86
+ .rtl .fs-notice
87
+ {
88
+ .fs-close
89
+ {
90
+ // left: 2px;
91
+ // right: auto;
92
+ // padding-right: 0;
93
+ // padding-left: 2px;
94
+ float: left;
95
+ }
96
+ }
97
+
98
+ .fs-secure-notice
99
+ {
100
+ position: fixed;
101
+ top: 32px;
102
+ left: 160px;
103
+ right: 0;
104
+ background: rgb(235, 253, 235);
105
+ padding: 10px 20px;
106
+ color: green;
107
+ z-index: 9999;
108
+ box-shadow: 0px 2px 2px rgba(6, 113, 6, 0.3);
109
+ @include opacity(0.95);
110
+
111
+ &:hover
112
+ {
113
+ @include opacity(1);
114
+ }
115
+ }
116
+
117
+ @media screen and (max-width: 960px) {
118
+ .fs-secure-notice
119
+ {
120
+ left: 36px;
121
+ }
122
+ }
123
+
124
+ @media screen and (max-width:500px) {
125
+ #fs_promo_tab {
126
+ display: none;
127
+ }
128
+ }
129
+
130
+ @media screen and (max-width: 782px) {
131
+ .fs-secure-notice
132
+ {
133
+ left: 0;
134
+ top: 46px;
135
+ text-align: center;
136
+ }
137
+ }
138
+
139
+ span.fs-submenu-item.fs-sub:before
140
+ {
141
+ // Add small arrow.
142
+ content: '\21B3';
143
+ padding: 0 5px;
144
+ }
145
+
146
+ .rtl
147
+ {
148
+ span.fs-submenu-item.fs-sub:before
149
+ {
150
+ // Add small RTL arrow.
151
+ content: '\21B2';
152
+ }
153
+ }
154
+
155
+ .fs-submenu-item
156
+ {
157
+ &.pricing
158
+ {
159
+ &.upgrade-mode
160
+ {
161
+ color: greenyellow;
162
+ }
163
+
164
+ &.trial-mode
165
+ {
166
+ color: #83e2ff;
167
+ }
168
+ }
169
+ }
170
+
171
+ #adminmenu .update-plugins.fs-trial {
172
+ background-color: #00b9eb;
173
  }
freemius/assets/scss/admin/debug.scss CHANGED
@@ -1,135 +1,135 @@
1
- @import "../start";
2
-
3
- .switch
4
- {
5
- position: relative;
6
- display: inline-block;
7
- font-size: 1.6em;
8
- font-weight: bold;
9
- color: #ccc;
10
- text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.8);
11
- height: 18px;
12
- padding: 6px 6px 5px 6px;
13
- border: 1px solid #ccc;
14
- border: 1px solid rgba(0, 0, 0, 0.2);
15
- border-radius: 4px;
16
- background: #ececec;
17
- box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.1), inset 0px 1px 3px 0px rgba(0, 0, 0, 0.1);
18
- cursor: pointer;
19
-
20
- span
21
- {
22
- display: inline-block; width: 35px;
23
- text-transform: uppercase;
24
-
25
- &.on
26
- {
27
- color: $button-primary-bkg;
28
- }
29
- }
30
-
31
- .toggle
32
- {
33
- position: absolute;
34
- top: 1px;
35
- width: 37px;
36
- height: 25px;
37
- border: 1px solid #ccc;
38
- border: 1px solid rgba(0, 0, 0, 0.3);
39
- border-radius: 4px;
40
- background: #fff;
41
- background: -moz-linear-gradient(top, #ececec 0%, #fff 100%);
42
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ececec), color-stop(100%, #fff));
43
- background: -webkit-linear-gradient(top, #ececec 0%, #fff 100%);
44
- background: -o-linear-gradient(top, #ececec 0%, #fff 100%);
45
- background: -ms-linear-gradient(top, #ececec 0%, #fff 100%);
46
- background: linear-gradient(top, #ececec 0%, #fff 100%);
47
- box-shadow: inset 0px 1px 0px 0px rgba(255, 255, 255, 0.5);
48
- z-index: 999;
49
- @include transition(all 0.15s ease-in-out);
50
- }
51
-
52
- &.on .toggle
53
- {
54
- left: 2%;
55
- }
56
- &.off .toggle
57
- {
58
- left: 54%;
59
- }
60
-
61
- /* Round switch */
62
- &.round
63
- {
64
- padding: 0px 20px;
65
- border-radius: 40px;
66
-
67
- .toggle
68
- {
69
- border-radius: 40px;
70
- width: 14px;
71
- height: 14px;
72
- }
73
-
74
- &.on .toggle
75
- {
76
- left: 3%;
77
- background: $button-primary-bkg;
78
- }
79
- &.off .toggle
80
- {
81
- left: 58%;
82
- }
83
- }
84
- }
85
-
86
- .switch-label
87
- {
88
- font-size: 20px;
89
- line-height: 31px;
90
- margin: 0 5px;
91
- }
92
-
93
- #fs_log_book {
94
- table {
95
- font-family: Consolas,Monaco,monospace;
96
- font-size: 12px;
97
-
98
- th {
99
- color: #ccc;
100
- }
101
-
102
- tr {
103
- background: #232525;
104
-
105
- &.alternate {
106
- background: #2b2b2b;
107
- }
108
-
109
- td {
110
- &.fs-col--logger {
111
- color: #5a7435;
112
- }
113
- &.fs-col--type {
114
- color: #ffc861;
115
- }
116
- &.fs-col--function {
117
- color: #a7b7b1;
118
- font-weight: bold;
119
- }
120
- &.fs-col--message {
121
- &, a
122
- {
123
- color: #9a73ac !important;
124
- }
125
- }
126
- &.fs-col--file {
127
- color: #d07922;
128
- }
129
- &.fs-col--timestamp {
130
- color: #6596be;
131
- }
132
- }
133
- }
134
- }
135
  }
1
+ @import "../start";
2
+
3
+ .switch
4
+ {
5
+ position: relative;
6
+ display: inline-block;
7
+ font-size: 1.6em;
8
+ font-weight: bold;
9
+ color: #ccc;
10
+ text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.8);
11
+ height: 18px;
12
+ padding: 6px 6px 5px 6px;
13
+ border: 1px solid #ccc;
14
+ border: 1px solid rgba(0, 0, 0, 0.2);
15
+ border-radius: 4px;
16
+ background: #ececec;
17
+ box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.1), inset 0px 1px 3px 0px rgba(0, 0, 0, 0.1);
18
+ cursor: pointer;
19
+
20
+ span
21
+ {
22
+ display: inline-block; width: 35px;
23
+ text-transform: uppercase;
24
+
25
+ &.on
26
+ {
27
+ color: $button-primary-bkg;
28
+ }
29
+ }
30
+
31
+ .toggle
32
+ {
33
+ position: absolute;
34
+ top: 1px;
35
+ width: 37px;
36
+ height: 25px;
37
+ border: 1px solid #ccc;
38
+ border: 1px solid rgba(0, 0, 0, 0.3);
39
+ border-radius: 4px;
40
+ background: #fff;
41
+ background: -moz-linear-gradient(top, #ececec 0%, #fff 100%);
42
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ececec), color-stop(100%, #fff));
43
+ background: -webkit-linear-gradient(top, #ececec 0%, #fff 100%);
44
+ background: -o-linear-gradient(top, #ececec 0%, #fff 100%);
45
+ background: -ms-linear-gradient(top, #ececec 0%, #fff 100%);
46
+ background: linear-gradient(top, #ececec 0%, #fff 100%);
47
+ box-shadow: inset 0px 1px 0px 0px rgba(255, 255, 255, 0.5);
48
+ z-index: 999;
49
+ @include transition(all 0.15s ease-in-out);
50
+ }
51
+
52
+ &.on .toggle
53
+ {
54
+ left: 2%;
55
+ }
56
+ &.off .toggle
57
+ {
58
+ left: 54%;
59
+ }
60
+
61
+ /* Round switch */
62
+ &.round
63
+ {
64
+ padding: 0px 20px;
65
+ border-radius: 40px;
66
+
67
+ .toggle
68
+ {
69
+ border-radius: 40px;
70
+ width: 14px;
71
+ height: 14px;
72
+ }
73
+
74
+ &.on .toggle
75
+ {
76
+ left: 3%;
77
+ background: $button-primary-bkg;
78
+ }
79
+ &.off .toggle
80
+ {
81
+ left: 58%;
82
+ }
83
+ }
84
+ }
85
+
86
+ .switch-label
87
+ {
88
+ font-size: 20px;
89
+ line-height: 31px;
90
+ margin: 0 5px;
91
+ }
92
+
93
+ #fs_log_book {
94
+ table {
95
+ font-family: Consolas,Monaco,monospace;
96
+ font-size: 12px;
97
+
98
+ th {
99
+ color: #ccc;
100
+ }
101
+
102
+ tr {
103
+ background: #232525;
104
+
105
+ &.alternate {
106
+ background: #2b2b2b;
107
+ }
108
+
109
+ td {
110
+ &.fs-col--logger {
111
+ color: #5a7435;
112
+ }
113
+ &.fs-col--type {
114
+ color: #ffc861;
115
+ }
116
+ &.fs-col--function {
117
+ color: #a7b7b1;
118
+ font-weight: bold;
119
+ }
120
+ &.fs-col--message {
121
+ &, a
122
+ {
123
+ color: #9a73ac !important;
124
+ }
125
+ }
126
+ &.fs-col--file {
127
+ color: #d07922;
128
+ }
129
+ &.fs-col--timestamp {
130
+ color: #6596be;
131
+ }
132
+ }
133
+ }
134
+ }
135
  }
freemius/includes/class-fs-api.php CHANGED
@@ -1,558 +1,558 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.4
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- /**
14
- * Class FS_Api
15
- *
16
- * Wraps Freemius API SDK to handle:
17
- * 1. Clock sync.
18
- * 2. Fallback to HTTP when HTTPS fails.
19
- * 3. Adds caching layer to GET requests.
20
- * 4. Adds consistency for failed requests by using last cached version.
21
- */
22
- class FS_Api {
23
- /**
24
- * @var FS_Api[]
25
- */
26
- private static $_instances = array();
27
-
28
- /**
29
- * @var FS_Option_Manager Freemius options, options-manager.
30
- */
31
- private static $_options;
32
-
33
- /**
34
- * @var FS_Cache_Manager API Caching layer
35
- */
36
- private static $_cache;
37
-
38
- /**
39
- * @var int Clock diff in seconds between current server to API server.
40
- */
41
- private static $_clock_diff;
42
-
43
- /**
44
- * @var Freemius_Api
45
- */
46
- private $_api;
47
-
48
- /**
49
- * @var string
50
- */
51
- private $_slug;
52
-
53
- /**
54
- * @var FS_Logger
55
- * @since 1.0.4
56
- */
57
- private $_logger;
58
-
59
- /**
60
- * @param string $slug
61
- * @param string $scope 'app', 'developer', 'user' or 'install'.
62
- * @param number $id Element's id.
63
- * @param string $public_key Public key.
64
- * @param bool $is_sandbox
65
- * @param bool|string $secret_key Element's secret key.
66
- *
67
- * @return FS_Api
68
- */
69
- static function instance( $slug, $scope, $id, $public_key, $is_sandbox, $secret_key = false ) {
70
- $identifier = md5( $slug . $scope . $id . $public_key . ( is_string( $secret_key ) ? $secret_key : '' ) . json_encode( $is_sandbox ) );
71
-
72
- if ( ! isset( self::$_instances[ $identifier ] ) ) {
73
- self::_init();
74
-
75
- self::$_instances[ $identifier ] = new FS_Api( $slug, $scope, $id, $public_key, $secret_key, $is_sandbox );
76
- }
77
-
78
- return self::$_instances[ $identifier ];
79
- }
80
-
81
- private static function _init() {
82
- if ( isset( self::$_options ) ) {
83
- return;
84
- }
85
-
86
- if ( ! class_exists( 'Freemius_Api' ) ) {
87
- require_once WP_FS__DIR_SDK . '/Freemius.php';
88
- }
89
-
90
- self::$_options = FS_Option_Manager::get_manager( WP_FS__OPTIONS_OPTION_NAME, true );
91
- self::$_cache = FS_Cache_Manager::get_manager( WP_FS__API_CACHE_OPTION_NAME );
92
-
93
- self::$_clock_diff = self::$_options->get_option( 'api_clock_diff', 0 );
94
- Freemius_Api::SetClockDiff( self::$_clock_diff );
95
-
96
- if ( self::$_options->get_option( 'api_force_http', false ) ) {
97
- Freemius_Api::SetHttp();
98
- }
99
- }
100
-
101
- /**
102
- * @param string $slug
103
- * @param string $scope 'app', 'developer', 'user' or 'install'.
104
- * @param number $id Element's id.
105
- * @param string $public_key Public key.
106
- * @param bool|string $secret_key Element's secret key.
107
- * @param bool $is_sandbox
108
- */
109
- private function __construct( $slug, $scope, $id, $public_key, $secret_key, $is_sandbox ) {
110
- $this->_api = new Freemius_Api( $scope, $id, $public_key, $secret_key, $is_sandbox );
111
-
112
- $this->_slug = $slug;
113
- $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $slug . '_api', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
114
- }
115
-
116
- /**
117
- * Find clock diff between server and API server, and store the diff locally.
118
- *
119
- * @param bool|int $diff
120
- *
121
- * @return bool|int False if clock diff didn't change, otherwise returns the clock diff in seconds.
122
- */
123
- private function _sync_clock_diff( $diff = false ) {
124
- $this->_logger->entrance();
125
-
126
- // Sync clock and store.
127
- $new_clock_diff = ( false === $diff ) ?
128
- Freemius_Api::FindClockDiff() :
129
- $diff;
130
-
131
- if ( $new_clock_diff === self::$_clock_diff ) {
132
- return false;
133
- }
134
-
135
- self::$_clock_diff = $new_clock_diff;
136
-
137
- // Update API clock's diff.
138
- Freemius_Api::SetClockDiff( self::$_clock_diff );
139
-
140
- // Store new clock diff in storage.
141
- self::$_options->set_option( 'api_clock_diff', self::$_clock_diff, true );
142
-
143
- return $new_clock_diff;
144
- }
145
-
146
- /**
147
- * Override API call to enable retry with servers' clock auto sync method.
148
- *
149
- * @param string $path
150
- * @param string $method
151
- * @param array $params
152
- * @param bool $retry Is in retry or first call attempt.
153
- *
154
- * @return array|mixed|string|void
155
- */
156
- private function _call( $path, $method = 'GET', $params = array(), $retry = false ) {
157
- $this->_logger->entrance( $method . ':' . $path );
158
-
159
- if ( self::is_temporary_down() ) {
160
- $result = $this->get_temporary_unavailable_error();
161
- } else {
162
- $result = $this->_api->Api( $path, $method, $params );
163
-
164
- if ( null !== $result &&
165
- isset( $result->error ) &&
166
- isset( $result->error->code ) &&
167
- 'request_expired' === $result->error->code
168
- ) {
169
- if ( ! $retry ) {
170
- $diff = isset( $result->error->timestamp ) ?
171
- ( time() - strtotime( $result->error->timestamp ) ) :
172
- false;
173
-
174
- // Try to sync clock diff.
175
- if ( false !== $this->_sync_clock_diff( $diff ) ) {
176
- // Retry call with new synced clock.
177
- return $this->_call( $path, $method, $params, true );
178
- }
179
- }
180
- }
181
- }
182
-
183
- if ( $this->_logger->is_on() && self::is_api_error( $result ) ) {
184
- // Log API errors.
185
- $this->_logger->api_error( $result );
186
- }
187
-
188
- return $result;
189
- }
190
-
191
- /**
192
- * Override API call to wrap it in servers' clock sync method.
193
- *
194
- * @param string $path
195
- * @param string $method
196
- * @param array $params
197
- *
198
- * @return array|mixed|string|void
199
- * @throws Freemius_Exception
200
- */
201
- function call( $path, $method = 'GET', $params = array() ) {
202
- return $this->_call( $path, $method, $params );
203
- }
204
-
205
- /**
206
- * Get API request URL signed via query string.
207
- *
208
- * @param string $path
209
- *
210
- * @return string
211
- */
212
- function get_signed_url( $path ) {
213
- return $this->_api->GetSignedUrl( $path );
214
- }
215
-
216
- /**
217
- * @param string $path
218
- * @param bool $flush
219
- * @param int $expiration (optional) Time until expiration in seconds from now, defaults to 24 hours
220
- *
221
- * @return stdClass|mixed
222
- */
223
- function get( $path = '/', $flush = false, $expiration = WP_FS__TIME_24_HOURS_IN_SEC ) {
224
- $this->_logger->entrance( $path );
225
-
226
- $cache_key = $this->get_cache_key( $path );
227
-
228
- // Always flush during development.
229
- if ( WP_FS__DEV_MODE || $this->_api->IsSandbox() ) {
230
- $flush = true;
231
- }
232
-
233
- $cached_result = self::$_cache->get( $cache_key );
234
-
235
- if ( $flush || ! self::$_cache->has_valid( $cache_key ) ) {
236
- $result = $this->call( $path );
237
-
238
- if ( ! is_object( $result ) || isset( $result->error ) ) {
239
- // Api returned an error.
240
- if ( is_object( $cached_result ) &&
241
- ! isset( $cached_result )
242
- ) {
243
- // If there was an error during a newer data fetch,
244
- // fallback to older data version.
245
- $result = $cached_result;
246
-
247
- if ( $this->_logger->is_on() ) {
248
- $this->_logger->warn( 'Fallback to cached API result: ' . var_export( $cached_result, true ) );
249
- }
250
- } else {
251
- // If no older data version, return result without
252
- // caching the error.
253
- return $result;
254
- }
255
- }
256
-
257
- self::$_cache->set( $cache_key, $result, $expiration );
258
-
259
- $cached_result = $result;
260
- } else {
261
- $this->_logger->log( 'Using cached API result.' );
262
- }
263
-
264
- return $cached_result;
265
- }
266
-
267
- /**
268
- * Check if there's a cached version of the API request.
269
- *
270
- * @author Vova Feldman (@svovaf)
271
- * @since 1.2.1
272
- *
273
- * @param string $path
274
- * @param string $method
275
- * @param array $params
276
- *
277
- * @return bool
278
- */
279
- function is_cached( $path, $method = 'GET', $params = array() ) {
280
- $cache_key = $this->get_cache_key( $path, $method, $params );
281
-
282
- return self::$_cache->has_valid( $cache_key );
283
- }
284
-
285
- /**
286
- * Invalidate a cached version of the API request.
287
- *
288
- * @author Vova Feldman (@svovaf)
289
- * @since 1.2.1.5
290
- *
291
- * @param string $path
292
- * @param string $method
293
- * @param array $params
294
- */
295
- function purge_cache( $path, $method = 'GET', $params = array() ) {
296
- $this->_logger->entrance( "{$method}:{$path}" );
297
-
298
- $cache_key = $this->get_cache_key( $path, $method, $params );
299
-
300
- self::$_cache->purge( $cache_key );
301
- }
302
-
303
- /**
304
- * @param string $path
305
- * @param string $method
306
- * @param array $params
307
- *
308
- * @return string
309
- * @throws \Freemius_Exception
310
- */
311
- private function get_cache_key( $path, $method = 'GET', $params = array() ) {
312
- $canonized = $this->_api->CanonizePath( $path );
313
- // $exploded = explode('/', $canonized);
314
- // return $method . '_' . array_pop($exploded) . '_' . md5($canonized . json_encode($params));
315
- return strtolower( $method . ':' . $canonized ) . ( ! empty( $params ) ? '#' . md5( json_encode( $params ) ) : '' );
316
- }
317
-
318
- /**
319
- * Test API connectivity.
320
- *
321
- * @author Vova Feldman (@svovaf)
322
- * @since 1.0.9 If fails, try to fallback to HTTP.
323
- * @since 1.1.6 Added a 5-min caching mechanism, to prevent from overloading the server if the API if
324
- * temporary down.
325
- *
326
- * @return bool True if successful connectivity to the API.
327
- */
328
- static function test() {
329
- self::_init();
330
-
331
- $cache_key = 'ping_test';
332
-
333
- $test = self::$_cache->get_valid( $cache_key, null );
334
-
335
- if ( is_null( $test ) ) {
336
- $test = Freemius_Api::Test();
337
-
338
- if ( false === $test && Freemius_Api::IsHttps() ) {
339
- // Fallback to HTTP, since HTTPS fails.
340
- Freemius_Api::SetHttp();
341
-
342
- self::$_options->set_option( 'api_force_http', true, true );
343
-
344
- $test = Freemius_Api::Test();
345
-
346
- if ( false === $test ) {
347
- /**
348
- * API connectivity test fail also in HTTP request, therefore,
349
- * fallback to HTTPS to keep connection secure.
350
- *
351
- * @since 1.1.6
352
- */
353
- self::$_options->set_option( 'api_force_http', false, true );
354
- }
355
- }
356
-
357
- self::$_cache->set( $cache_key, $test, WP_FS__TIME_5_MIN_IN_SEC );
358
- }
359
-
360
- return $test;
361
- }
362
-
363
- /**
364
- * Check if API is temporary down.
365
- *
366
- * @author Vova Feldman (@svovaf)
367
- * @since 1.1.6
368
- *
369
- * @return bool
370
- */
371
- static function is_temporary_down() {
372
- self::_init();
373
-
374
- $test = self::$_cache->get_valid( 'ping_test', null );
375
-
376
- return ( false === $test );
377
- }
378
-
379
- /**
380
- * @author Vova Feldman (@svovaf)
381
- * @since 1.1.6
382
- *
383
- * @return object
384
- */
385
- private function get_temporary_unavailable_error() {
386
- return (object) array(
387
- 'error' => (object) array(
388
- 'type' => 'TemporaryUnavailable',
389
- 'message' => 'API is temporary unavailable, please retry in ' . ( self::$_cache->get_record_expiration( 'ping_test' ) - WP_FS__SCRIPT_START_TIME ) . ' sec.',
390
- 'code' => 'temporary_unavailable',
391
- 'http' => 503
392
- )
393
- );
394
- }
395
-
396
- /**
397
- * Ping API for connectivity test, and return result object.
398
- *
399
- * @author Vova Feldman (@svovaf)
400
- * @since 1.0.9
401
- *
402
- * @param null|string $unique_anonymous_id
403
- * @param array $params
404
- *
405
- * @return object
406
- */
407
- function ping( $unique_anonymous_id = null, $params = array() ) {
408
- $this->_logger->entrance();
409
-
410
- if ( self::is_temporary_down() ) {
411
- return $this->get_temporary_unavailable_error();
412
- }
413
-
414
- $pong = is_null( $unique_anonymous_id ) ?
415
- Freemius_Api::Ping() :
416
- $this->_call( 'ping.json?' . http_build_query( array_merge(
417
- array( 'uid' => $unique_anonymous_id ),
418
- $params
419
- ) ) );
420
-
421
- if ( $this->is_valid_ping( $pong ) ) {
422
- return $pong;
423
- }
424
-
425
- if ( self::should_try_with_http( $pong ) ) {
426
- // Fallback to HTTP, since HTTPS fails.
427
- Freemius_Api::SetHttp();
428
-
429
- self::$_options->set_option( 'api_force_http', true, true );
430
-
431
- $pong = is_null( $unique_anonymous_id ) ?
432
- Freemius_Api::Ping() :
433
- $this->_call( 'ping.json?' . http_build_query( array_merge(
434
- array( 'uid' => $unique_anonymous_id ),
435
- $params
436
- ) ) );
437
-
438
- if ( ! $this->is_valid_ping( $pong ) ) {
439
- self::$_options->set_option( 'api_force_http', false, true );
440
- }
441
- }
442
-
443
- return $pong;
444
- }
445
-
446
- /**
447
- * Check if based on the API result we should try
448
- * to re-run the same request with HTTP instead of HTTPS.
449
- *
450
- * @author Vova Feldman (@svovaf)
451
- * @since 1.1.6
452
- *
453
- * @param $result
454
- *
455
- * @return bool
456
- */
457
- private static function should_try_with_http( $result ) {
458
- if ( ! Freemius_Api::IsHttps() ) {
459
- return false;
460
- }
461
-
462
- return ( ! is_object( $result ) ||
463
- ! isset( $result->error ) ||
464
- ! isset( $result->error->code ) ||
465
- ! in_array( $result->error->code, array(
466
- 'curl_missing',
467
- 'cloudflare_ddos_protection',
468
- 'maintenance_mode',
469
- 'squid_cache_block',
470
- 'too_many_requests',
471
- ) ) );
472
-
473
- }
474
-
475
- /**
476
- * Check if valid ping request result.
477
- *
478
- * @author Vova Feldman (@svovaf)
479
- * @since 1.1.1
480
- *
481
- * @param mixed $pong
482
- *
483
- * @return bool
484
- */
485
- function is_valid_ping( $pong ) {
486
- return Freemius_Api::Test( $pong );
487
- }
488
-
489
- function get_url( $path = '' ) {
490
- return Freemius_Api::GetUrl( $path, $this->_api->IsSandbox() );
491
- }
492
-
493
- /**
494
- * Clear API cache.
495
- *
496
- * @author Vova Feldman (@svovaf)
497
- * @since 1.0.9
498
- */
499
- static function clear_cache() {
500
- self::_init();
501
-
502
- self::$_cache = FS_Cache_Manager::get_manager( WP_FS__API_CACHE_OPTION_NAME );
503
- self::$_cache->clear();
504
- }
505
-
506
- #----------------------------------------------------------------------------------
507
- #region Error Handling
508
- #----------------------------------------------------------------------------------
509
-
510
- /**
511
- * @author Vova Feldman (@svovaf)
512
- * @since 1.2.1.5
513
- *
514
- * @param mixed $result
515
- *
516
- * @return bool Is API result contains an error.
517
- */
518
- static function is_api_error( $result ) {
519
- return ( is_object( $result ) && isset( $result->error ) ) ||
520
- is_string( $result );
521
- }
522
-
523
- /**
524
- * Checks if given API result is a non-empty and not an error object.
525
- *
526
- * @author Vova Feldman (@svovaf)
527
- * @since 1.2.1.5
528
- *
529
- * @param mixed $result
530
- * @param string|null $required_property Optional property we want to verify that is set.
531
- *
532
- * @return bool
533
- */
534
- static function is_api_result_object( $result, $required_property = null ) {
535
- return (
536
- is_object( $result ) &&
537
- ! isset( $result->error ) &&
538
- ( empty( $required_property ) || isset( $result->{$required_property} ) )
539
- );
540
- }
541
-
542
- /**
543
- * Checks if given API result is a non-empty entity object with non-empty ID.
544
- *
545
- * @author Vova Feldman (@svovaf)
546
- * @since 1.2.1.5
547
- *
548
- * @param mixed $result
549
- *
550
- * @return bool
551
- */
552
- static function is_api_result_entity( $result ) {
553
- return self::is_api_result_object( $result, 'id' ) &&
554
- FS_Entity::is_valid_id( $result->id );
555
- }
556
-
557
- #endregion
558
  }
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.4
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * Class FS_Api
15
+ *
16
+ * Wraps Freemius API SDK to handle:
17
+ * 1. Clock sync.
18
+ * 2. Fallback to HTTP when HTTPS fails.
19
+ * 3. Adds caching layer to GET requests.
20
+ * 4. Adds consistency for failed requests by using last cached version.
21
+ */
22
+ class FS_Api {
23
+ /**
24
+ * @var FS_Api[]
25
+ */
26
+ private static $_instances = array();
27
+
28
+ /**
29
+ * @var FS_Option_Manager Freemius options, options-manager.
30
+ */
31
+ private static $_options;
32
+
33
+ /**
34
+ * @var FS_Cache_Manager API Caching layer
35
+ */
36
+ private static $_cache;
37
+
38
+ /**
39
+ * @var int Clock diff in seconds between current server to API server.
40
+ */
41
+ private static $_clock_diff;
42
+
43
+ /**
44
+ * @var Freemius_Api
45
+ */
46
+ private $_api;
47
+
48
+ /**
49
+ * @var string
50
+ */
51
+ private $_slug;
52
+
53
+ /**
54
+ * @var FS_Logger
55
+ * @since 1.0.4
56
+ */
57
+ private $_logger;
58
+
59
+ /**
60
+ * @param string $slug
61
+ * @param string $scope 'app', 'developer', 'user' or 'install'.
62
+ * @param number $id Element's id.
63
+ * @param string $public_key Public key.
64
+ * @param bool $is_sandbox
65
+ * @param bool|string $secret_key Element's secret key.
66
+ *
67
+ * @return FS_Api
68
+ */
69
+ static function instance( $slug, $scope, $id, $public_key, $is_sandbox, $secret_key = false ) {
70
+ $identifier = md5( $slug . $scope . $id . $public_key . ( is_string( $secret_key ) ? $secret_key : '' ) . json_encode( $is_sandbox ) );
71
+
72
+ if ( ! isset( self::$_instances[ $identifier ] ) ) {
73
+ self::_init();
74
+
75
+ self::$_instances[ $identifier ] = new FS_Api( $slug, $scope, $id, $public_key, $secret_key, $is_sandbox );
76
+ }
77
+
78
+ return self::$_instances[ $identifier ];
79
+ }
80
+
81
+ private static function _init() {
82
+ if ( isset( self::$_options ) ) {
83
+ return;
84
+ }
85
+
86
+ if ( ! class_exists( 'Freemius_Api' ) ) {
87
+ require_once WP_FS__DIR_SDK . '/Freemius.php';
88
+ }
89
+
90
+ self::$_options = FS_Option_Manager::get_manager( WP_FS__OPTIONS_OPTION_NAME, true );
91
+ self::$_cache = FS_Cache_Manager::get_manager( WP_FS__API_CACHE_OPTION_NAME );
92
+
93
+ self::$_clock_diff = self::$_options->get_option( 'api_clock_diff', 0 );
94
+ Freemius_Api::SetClockDiff( self::$_clock_diff );
95
+
96
+ if ( self::$_options->get_option( 'api_force_http', false ) ) {
97
+ Freemius_Api::SetHttp();
98
+ }
99
+ }
100
+
101
+ /**
102
+ * @param string $slug
103
+ * @param string $scope 'app', 'developer', 'user' or 'install'.
104
+ * @param number $id Element's id.
105
+ * @param string $public_key Public key.
106
+ * @param bool|string $secret_key Element's secret key.
107
+ * @param bool $is_sandbox
108
+ */
109
+ private function __construct( $slug, $scope, $id, $public_key, $secret_key, $is_sandbox ) {
110
+ $this->_api = new Freemius_Api( $scope, $id, $public_key, $secret_key, $is_sandbox );
111
+
112
+ $this->_slug = $slug;
113
+ $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $slug . '_api', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
114
+ }
115
+
116
+ /**
117
+ * Find clock diff between server and API server, and store the diff locally.
118
+ *
119
+ * @param bool|int $diff
120
+ *
121
+ * @return bool|int False if clock diff didn't change, otherwise returns the clock diff in seconds.
122
+ */
123
+ private function _sync_clock_diff( $diff = false ) {
124
+ $this->_logger->entrance();
125
+
126
+ // Sync clock and store.
127
+ $new_clock_diff = ( false === $diff ) ?
128
+ Freemius_Api::FindClockDiff() :
129
+ $diff;
130
+
131
+ if ( $new_clock_diff === self::$_clock_diff ) {
132
+ return false;
133
+ }
134
+
135
+ self::$_clock_diff = $new_clock_diff;
136
+
137
+ // Update API clock's diff.
138
+ Freemius_Api::SetClockDiff( self::$_clock_diff );
139
+
140
+ // Store new clock diff in storage.
141
+ self::$_options->set_option( 'api_clock_diff', self::$_clock_diff, true );
142
+
143
+ return $new_clock_diff;
144
+ }
145
+
146
+ /**
147
+ * Override API call to enable retry with servers' clock auto sync method.
148
+ *
149
+ * @param string $path
150
+ * @param string $method
151
+ * @param array $params
152
+ * @param bool $retry Is in retry or first call attempt.
153
+ *
154
+ * @return array|mixed|string|void
155
+ */
156
+ private function _call( $path, $method = 'GET', $params = array(), $retry = false ) {
157
+ $this->_logger->entrance( $method . ':' . $path );
158
+
159
+ if ( self::is_temporary_down() ) {
160
+ $result = $this->get_temporary_unavailable_error();
161
+ } else {
162
+ $result = $this->_api->Api( $path, $method, $params );
163
+
164
+ if ( null !== $result &&
165
+ isset( $result->error ) &&
166
+ isset( $result->error->code ) &&
167
+ 'request_expired' === $result->error->code
168
+ ) {
169
+ if ( ! $retry ) {
170
+ $diff = isset( $result->error->timestamp ) ?
171
+ ( time() - strtotime( $result->error->timestamp ) ) :
172
+ false;
173
+
174
+ // Try to sync clock diff.
175
+ if ( false !== $this->_sync_clock_diff( $diff ) ) {
176
+ // Retry call with new synced clock.
177
+ return $this->_call( $path, $method, $params, true );
178
+ }
179
+ }
180
+ }
181
+ }
182
+
183
+ if ( $this->_logger->is_on() && self::is_api_error( $result ) ) {
184
+ // Log API errors.
185
+ $this->_logger->api_error( $result );
186
+ }
187
+
188
+ return $result;
189
+ }
190
+
191
+ /**
192
+ * Override API call to wrap it in servers' clock sync method.
193
+ *
194
+ * @param string $path
195
+ * @param string $method
196
+ * @param array $params
197
+ *
198
+ * @return array|mixed|string|void
199
+ * @throws Freemius_Exception
200
+ */
201
+ function call( $path, $method = 'GET', $params = array() ) {
202
+ return $this->_call( $path, $method, $params );
203
+ }
204
+
205
+ /**
206
+ * Get API request URL signed via query string.
207
+ *
208
+ * @param string $path
209
+ *
210
+ * @return string
211
+ */
212
+ function get_signed_url( $path ) {
213
+ return $this->_api->GetSignedUrl( $path );
214
+ }
215
+
216
+ /**
217
+ * @param string $path
218
+ * @param bool $flush
219
+ * @param int $expiration (optional) Time until expiration in seconds from now, defaults to 24 hours
220
+ *
221
+ * @return stdClass|mixed
222
+ */
223
+ function get( $path = '/', $flush = false, $expiration = WP_FS__TIME_24_HOURS_IN_SEC ) {
224
+ $this->_logger->entrance( $path );
225
+
226
+ $cache_key = $this->get_cache_key( $path );
227
+
228
+ // Always flush during development.
229
+ if ( WP_FS__DEV_MODE || $this->_api->IsSandbox() ) {
230
+ $flush = true;
231
+ }
232
+
233
+ $cached_result = self::$_cache->get( $cache_key );
234
+
235
+ if ( $flush || ! self::$_cache->has_valid( $cache_key ) ) {
236
+ $result = $this->call( $path );
237
+
238
+ if ( ! is_object( $result ) || isset( $result->error ) ) {
239
+ // Api returned an error.
240
+ if ( is_object( $cached_result ) &&
241
+ ! isset( $cached_result )
242
+ ) {
243
+ // If there was an error during a newer data fetch,
244
+ // fallback to older data version.
245
+ $result = $cached_result;
246
+
247
+ if ( $this->_logger->is_on() ) {
248
+ $this->_logger->warn( 'Fallback to cached API result: ' . var_export( $cached_result, true ) );
249
+ }
250
+ } else {
251
+ // If no older data version, return result without
252
+ // caching the error.
253
+ return $result;
254
+ }
255
+ }
256
+
257
+ self::$_cache->set( $cache_key, $result, $expiration );
258
+
259
+ $cached_result = $result;
260
+ } else {
261
+ $this->_logger->log( 'Using cached API result.' );
262
+ }
263
+
264
+ return $cached_result;
265
+ }
266
+
267
+ /**
268
+ * Check if there's a cached version of the API request.
269
+ *
270
+ * @author Vova Feldman (@svovaf)
271
+ * @since 1.2.1
272
+ *
273
+ * @param string $path
274
+ * @param string $method
275
+ * @param array $params
276
+ *
277
+ * @return bool
278
+ */
279
+ function is_cached( $path, $method = 'GET', $params = array() ) {
280
+ $cache_key = $this->get_cache_key( $path, $method, $params );
281
+
282
+ return self::$_cache->has_valid( $cache_key );
283
+ }
284
+
285
+ /**
286
+ * Invalidate a cached version of the API request.
287
+ *
288
+ * @author Vova Feldman (@svovaf)
289
+ * @since 1.2.1.5
290
+ *
291
+ * @param string $path
292
+ * @param string $method
293
+ * @param array $params
294
+ */
295
+ function purge_cache( $path, $method = 'GET', $params = array() ) {
296
+ $this->_logger->entrance( "{$method}:{$path}" );
297
+
298
+ $cache_key = $this->get_cache_key( $path, $method, $params );
299
+
300
+ self::$_cache->purge( $cache_key );
301
+ }
302
+
303
+ /**
304
+ * @param string $path
305
+ * @param string $method
306
+ * @param array $params
307
+ *
308
+ * @return string
309
+ * @throws \Freemius_Exception
310
+ */
311
+ private function get_cache_key( $path, $method = 'GET', $params = array() ) {
312
+ $canonized = $this->_api->CanonizePath( $path );
313
+ // $exploded = explode('/', $canonized);
314
+ // return $method . '_' . array_pop($exploded) . '_' . md5($canonized . json_encode($params));
315
+ return strtolower( $method . ':' . $canonized ) . ( ! empty( $params ) ? '#' . md5( json_encode( $params ) ) : '' );
316
+ }
317
+
318
+ /**
319
+ * Test API connectivity.
320
+ *
321
+ * @author Vova Feldman (@svovaf)
322
+ * @since 1.0.9 If fails, try to fallback to HTTP.
323
+ * @since 1.1.6 Added a 5-min caching mechanism, to prevent from overloading the server if the API if
324
+ * temporary down.
325
+ *
326
+ * @return bool True if successful connectivity to the API.
327
+ */
328
+ static function test() {
329
+ self::_init();
330
+
331
+ $cache_key = 'ping_test';
332
+
333
+ $test = self::$_cache->get_valid( $cache_key, null );
334
+
335
+ if ( is_null( $test ) ) {
336
+ $test = Freemius_Api::Test();
337
+
338
+ if ( false === $test && Freemius_Api::IsHttps() ) {
339
+ // Fallback to HTTP, since HTTPS fails.
340
+ Freemius_Api::SetHttp();
341
+
342
+ self::$_options->set_option( 'api_force_http', true, true );
343
+
344
+ $test = Freemius_Api::Test();
345
+
346
+ if ( false === $test ) {
347
+ /**
348
+ * API connectivity test fail also in HTTP request, therefore,
349
+ * fallback to HTTPS to keep connection secure.
350
+ *
351
+ * @since 1.1.6
352
+ */
353
+ self::$_options->set_option( 'api_force_http', false, true );
354
+ }
355
+ }
356
+
357
+ self::$_cache->set( $cache_key, $test, WP_FS__TIME_5_MIN_IN_SEC );
358
+ }
359
+
360
+ return $test;
361
+ }
362
+
363
+ /**
364
+ * Check if API is temporary down.
365
+ *
366
+ * @author Vova Feldman (@svovaf)
367
+ * @since 1.1.6
368
+ *
369
+ * @return bool
370
+ */
371
+ static function is_temporary_down() {
372
+ self::_init();
373
+
374
+ $test = self::$_cache->get_valid( 'ping_test', null );
375
+
376
+ return ( false === $test );
377
+ }
378
+
379
+ /**
380
+ * @author Vova Feldman (@svovaf)
381
+ * @since 1.1.6
382
+ *
383
+ * @return object
384
+ */
385
+ private function get_temporary_unavailable_error() {
386
+ return (object) array(
387
+ 'error' => (object) array(
388
+ 'type' => 'TemporaryUnavailable',
389
+ 'message' => 'API is temporary unavailable, please retry in ' . ( self::$_cache->get_record_expiration( 'ping_test' ) - WP_FS__SCRIPT_START_TIME ) . ' sec.',
390
+ 'code' => 'temporary_unavailable',
391
+ 'http' => 503
392
+ )
393
+ );
394
+ }
395
+
396
+ /**
397
+ * Ping API for connectivity test, and return result object.
398
+ *
399
+ * @author Vova Feldman (@svovaf)
400
+ * @since 1.0.9
401
+ *
402
+ * @param null|string $unique_anonymous_id
403
+ * @param array $params
404
+ *
405
+ * @return object
406
+ */
407
+ function ping( $unique_anonymous_id = null, $params = array() ) {
408
+ $this->_logger->entrance();
409
+
410
+ if ( self::is_temporary_down() ) {
411
+ return $this->get_temporary_unavailable_error();
412
+ }
413
+
414
+ $pong = is_null( $unique_anonymous_id ) ?
415
+ Freemius_Api::Ping() :
416
+ $this->_call( 'ping.json?' . http_build_query( array_merge(
417
+ array( 'uid' => $unique_anonymous_id ),
418
+ $params
419
+ ) ) );
420
+
421
+ if ( $this->is_valid_ping( $pong ) ) {
422
+ return $pong;
423
+ }
424
+
425
+ if ( self::should_try_with_http( $pong ) ) {
426
+ // Fallback to HTTP, since HTTPS fails.
427
+ Freemius_Api::SetHttp();
428
+
429
+ self::$_options->set_option( 'api_force_http', true, true );
430
+
431
+ $pong = is_null( $unique_anonymous_id ) ?
432
+ Freemius_Api::Ping() :
433
+ $this->_call( 'ping.json?' . http_build_query( array_merge(
434
+ array( 'uid' => $unique_anonymous_id ),
435
+ $params
436
+ ) ) );
437
+
438
+ if ( ! $this->is_valid_ping( $pong ) ) {
439
+ self::$_options->set_option( 'api_force_http', false, true );
440
+ }
441
+ }
442
+
443
+ return $pong;
444
+ }
445
+
446
+ /**
447
+ * Check if based on the API result we should try
448
+ * to re-run the same request with HTTP instead of HTTPS.
449
+ *
450
+ * @author Vova Feldman (@svovaf)
451
+ * @since 1.1.6
452
+ *
453
+ * @param $result
454
+ *
455
+ * @return bool
456
+ */
457
+ private static function should_try_with_http( $result ) {
458
+ if ( ! Freemius_Api::IsHttps() ) {
459
+ return false;
460
+ }
461
+
462
+ return ( ! is_object( $result ) ||
463
+ ! isset( $result->error ) ||
464
+ ! isset( $result->error->code ) ||
465
+ ! in_array( $result->error->code, array(
466
+ 'curl_missing',
467
+ 'cloudflare_ddos_protection',
468
+ 'maintenance_mode',
469
+ 'squid_cache_block',
470
+ 'too_many_requests',
471
+ ) ) );
472
+
473
+ }
474
+
475
+ /**
476
+ * Check if valid ping request result.
477
+ *
478
+ * @author Vova Feldman (@svovaf)
479
+ * @since 1.1.1
480
+ *
481
+ * @param mixed $pong
482
+ *
483
+ * @return bool
484
+ */
485
+ function is_valid_ping( $pong ) {
486
+ return Freemius_Api::Test( $pong );
487
+ }
488
+
489
+ function get_url( $path = '' ) {
490
+ return Freemius_Api::GetUrl( $path, $this->_api->IsSandbox() );
491
+ }
492
+
493
+ /**
494
+ * Clear API cache.
495
+ *
496
+ * @author Vova Feldman (@svovaf)
497
+ * @since 1.0.9
498
+ */
499
+ static function clear_cache() {
500
+ self::_init();
501
+
502
+ self::$_cache = FS_Cache_Manager::get_manager( WP_FS__API_CACHE_OPTION_NAME );
503
+ self::$_cache->clear();
504
+ }
505
+
506
+ #----------------------------------------------------------------------------------
507
+ #region Error Handling
508
+ #----------------------------------------------------------------------------------
509
+
510
+ /**
511
+ * @author Vova Feldman (@svovaf)
512
+ * @since 1.2.1.5
513
+ *
514
+ * @param mixed $result
515
+ *
516
+ * @return bool Is API result contains an error.
517
+ */
518
+ static function is_api_error( $result ) {
519
+ return ( is_object( $result ) && isset( $result->error ) ) ||
520
+ is_string( $result );
521
+ }
522
+
523
+ /**
524
+ * Checks if given API result is a non-empty and not an error object.
525
+ *
526
+ * @author Vova Feldman (@svovaf)
527
+ * @since 1.2.1.5
528
+ *
529
+ * @param mixed $result
530
+ * @param string|null $required_property Optional property we want to verify that is set.
531
+ *
532
+ * @return bool
533
+ */
534
+ static function is_api_result_object( $result, $required_property = null ) {
535
+ return (
536
+ is_object( $result ) &&
537
+ ! isset( $result->error ) &&
538
+ ( empty( $required_property ) || isset( $result->{$required_property} ) )
539
+ );
540
+ }
541
+
542
+ /**
543
+ * Checks if given API result is a non-empty entity object with non-empty ID.
544
+ *
545
+ * @author Vova Feldman (@svovaf)
546
+ * @since 1.2.1.5
547
+ *
548
+ * @param mixed $result
549
+ *
550
+ * @return bool
551
+ */
552
+ static function is_api_result_entity( $result ) {
553
+ return self::is_api_result_object( $result, 'id' ) &&
554
+ FS_Entity::is_valid_id( $result->id );
555
+ }
556
+
557
+ #endregion
558
  }
freemius/includes/class-fs-security.php CHANGED
@@ -1,85 +1,85 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.3
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- define( 'WP_FS__SECURITY_PARAMS_PREFIX', 's_' );
14
-
15
- /**
16
- * Class FS_Security
17
- */
18
- class FS_Security {
19
- /**
20
- * @var FS_Security
21
- * @since 1.0.3
22
- */
23
- private static $_instance;
24
- /**
25
- * @var FS_Logger
26
- * @since 1.0.3
27
- */
28
- private static $_logger;
29
-
30
- /**
31
- * @return \FS_Security
32
- */
33
- public static function instance() {
34
- if ( ! isset( self::$_instance ) ) {
35
- self::$_instance = new FS_Security();
36
- self::$_logger = FS_Logger::get_logger(
37
- WP_FS__SLUG,
38
- WP_FS__DEBUG_SDK,
39
- WP_FS__ECHO_DEBUG_SDK
40
- );
41
- }
42
-
43
- return self::$_instance;
44
- }
45
-
46
- private function __construct() {
47
- }
48
-
49
- /**
50
- * @param \FS_Scope_Entity $entity
51
- * @param int $timestamp
52
- * @param string $action
53
- *
54
- * @return string
55
- */
56
- function get_secure_token( FS_Scope_Entity $entity, $timestamp, $action = '' ) {
57
- return md5(
58
- $timestamp .
59
- $entity->id .
60
- $entity->secret_key .
61
- $entity->public_key .
62
- $action
63
- );
64
- }
65
-
66
- /**
67
- * @param \FS_Scope_Entity $entity
68
- * @param int|bool $timestamp
69
- * @param string $action
70
- *
71
- * @return array
72
- */
73
- function get_context_params( FS_Scope_Entity $entity, $timestamp = false, $action = '' ) {
74
- if ( false === $timestamp ) {
75
- $timestamp = time();
76
- }
77
-
78
- return array(
79
- 's_ctx_type' => $entity->get_type(),
80
- 's_ctx_id' => $entity->id,
81
- 's_ctx_ts' => $timestamp,
82
- 's_ctx_secure' => $this->get_secure_token( $entity, $timestamp, $action ),
83
- );
84
- }
85
- }
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ define( 'WP_FS__SECURITY_PARAMS_PREFIX', 's_' );
14
+
15
+ /**
16
+ * Class FS_Security
17
+ */
18
+ class FS_Security {
19
+ /**
20
+ * @var FS_Security
21
+ * @since 1.0.3
22
+ */
23
+ private static $_instance;
24
+ /**
25
+ * @var FS_Logger
26
+ * @since 1.0.3
27
+ */
28
+ private static $_logger;
29
+
30
+ /**
31
+ * @return \FS_Security
32
+ */
33
+ public static function instance() {
34
+ if ( ! isset( self::$_instance ) ) {
35
+ self::$_instance = new FS_Security();
36
+ self::$_logger = FS_Logger::get_logger(
37
+ WP_FS__SLUG,
38
+ WP_FS__DEBUG_SDK,
39
+ WP_FS__ECHO_DEBUG_SDK
40
+ );
41
+ }
42
+
43
+ return self::$_instance;
44
+ }
45
+
46
+ private function __construct() {
47
+ }
48
+
49
+ /**
50
+ * @param \FS_Scope_Entity $entity
51
+ * @param int $timestamp
52
+ * @param string $action
53
+ *
54
+ * @return string
55
+ */
56
+ function get_secure_token( FS_Scope_Entity $entity, $timestamp, $action = '' ) {
57
+ return md5(
58
+ $timestamp .
59
+ $entity->id .
60
+ $entity->secret_key .
61
+ $entity->public_key .
62
+ $action
63
+ );
64
+ }
65
+
66
+ /**
67
+ * @param \FS_Scope_Entity $entity
68
+ * @param int|bool $timestamp
69
+ * @param string $action
70
+ *
71
+ * @return array
72
+ */
73
+ function get_context_params( FS_Scope_Entity $entity, $timestamp = false, $action = '' ) {
74
+ if ( false === $timestamp ) {
75
+ $timestamp = time();
76
+ }
77
+
78
+ return array(
79
+ 's_ctx_type' => $entity->get_type(),
80
+ 's_ctx_id' => $entity->id,
81
+ 's_ctx_ts' => $timestamp,
82
+ 's_ctx_secure' => $this->get_secure_token( $entity, $timestamp, $action ),
83
+ );
84
+ }
85
+ }
freemius/includes/debug/index.php CHANGED
@@ -1,3 +1,3 @@
1
- <?php
2
- // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
1
+ <?php
2
+ // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
freemius/includes/entities/class-fs-billing.php CHANGED
@@ -1,95 +1,95 @@
1
- <?php
2
- /**
3
- * @package Freemius for EDD Add-On
4
- * @copyright Copyright (c) 2016, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.0
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- class FS_Billing extends FS_Entity {
14
-
15
- #region Properties
16
-
17
- /**
18
- * @var int
19
- */
20
- public $entity_id;
21
- /**
22
- * @var string (Enum) Linked entity type. One of: developer, plugin, user, install
23
- */
24
- public $entity_type;
25
- /**
26
- * @var string
27
- */
28
- public $business_name;
29
- /**
30
- * @var string
31
- */
32
- public $first;
33
- /**
34
- * @var string
35
- */
36
- public $last;
37
- /**
38
- * @var string
39
- */
40
- public $email;
41
- /**
42
- * @var string
43
- */
44
- public $phone;
45
- /**
46
- * @var string
47
- */
48
- public $website;
49
- /**
50
- * @var string Tax or VAT ID.
51
- */
52
- public $tax_id;
53
- /**
54
- * @var string
55
- */
56
- public $address_street;
57
- /**
58
- * @var string
59
- */
60
- public $address_apt;
61
- /**
62
- * @var string
63
- */
64
- public $address_city;
65
- /**
66
- * @var string
67
- */
68
- public $address_country;
69
- /**
70
- * @var string Two chars country code.
71
- */
72
- public $address_country_code;
73
- /**
74
- * @var string
75
- */
76
- public $address_state;
77
- /**
78
- * @var number Numeric ZIP code (cab be with leading zeros).
79
- */
80
- public $address_zip;
81
-
82
- #endregion Properties
83
-
84
-
85
- /**
86
- * @param object|bool $event
87
- */
88
- function __construct( $event = false ) {
89
- parent::__construct( $event );
90
- }
91
-
92
- static function get_type() {
93
- return 'billing';
94
- }
95
  }
1
+ <?php
2
+ /**
3
+ * @package Freemius for EDD Add-On
4
+ * @copyright Copyright (c) 2016, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.0
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Billing extends FS_Entity {
14
+
15
+ #region Properties
16
+
17
+ /**
18
+ * @var int
19
+ */
20
+ public $entity_id;
21
+ /**
22
+ * @var string (Enum) Linked entity type. One of: developer, plugin, user, install
23
+ */
24
+ public $entity_type;
25
+ /**
26
+ * @var string
27
+ */
28
+ public $business_name;
29
+ /**
30
+ * @var string
31
+ */
32
+ public $first;
33
+ /**
34
+ * @var string
35
+ */
36
+ public $last;
37
+ /**
38
+ * @var string
39
+ */
40
+ public $email;
41
+ /**
42
+ * @var string
43
+ */
44
+ public $phone;
45
+ /**
46
+ * @var string
47
+ */
48
+ public $website;
49
+ /**
50
+ * @var string Tax or VAT ID.
51
+ */
52
+ public $tax_id;
53
+ /**
54
+ * @var string
55
+ */
56
+ public $address_street;
57
+ /**
58
+ * @var string
59
+ */
60
+ public $address_apt;
61
+ /**
62
+ * @var string
63
+ */
64
+ public $address_city;
65
+ /**
66
+ * @var string
67
+ */
68
+ public $address_country;
69
+ /**
70
+ * @var string Two chars country code.
71
+ */
72
+ public $address_country_code;
73
+ /**
74
+ * @var string
75
+ */
76
+ public $address_state;
77
+ /**
78
+ * @var number Numeric ZIP code (cab be with leading zeros).
79
+ */
80
+ public $address_zip;
81
+
82
+ #endregion Properties
83
+
84
+
85
+ /**
86
+ * @param object|bool $event
87
+ */
88
+ function __construct( $event = false ) {
89
+ parent::__construct( $event );
90
+ }
91
+
92
+ static function get_type() {
93
+ return 'billing';
94
+ }
95
  }
freemius/includes/entities/class-fs-entity.php CHANGED
@@ -1,149 +1,149 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.3
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- /**
14
- * Get object's public variables.
15
- *
16
- * @author Vova Feldman (@svovaf)
17
- * @since 1.0.0
18
- *
19
- * @param object $object
20
- *
21
- * @return array
22
- */
23
- function fs_get_object_public_vars( $object ) {
24
- return get_object_vars( $object );
25
- }
26
-
27
- class FS_Entity {
28
- /**
29
- * @var number
30
- */
31
- public $id;
32
- /**
33
- * @var string Datetime value in 'YYYY-MM-DD HH:MM:SS' format.
34
- */
35
- public $updated;
36
- /**
37
- * @var string Datetime value in 'YYYY-MM-DD HH:MM:SS' format.
38
- */
39
- public $created;
40
-
41
- /**
42
- * @param bool|object $entity
43
- */
44
- function __construct( $entity = false ) {
45
- if ( ! ( $entity instanceof stdClass ) ) {
46
- return;
47
- }
48
-
49
- $props = fs_get_object_public_vars( $this );
50
-
51
- foreach ( $props as $key => $def_value ) {
52
- $this->{$key} = isset( $entity->{$key} ) ?
53
- $entity->{$key} :
54
- $def_value;
55
- }
56
- }
57
-
58
- static function get_type() {
59
- return 'type';
60
- }
61
-
62
- /**
63
- * @author Vova Feldman (@svovaf)
64
- * @since 1.0.6
65
- *
66
- * @param FS_Entity $entity1
67
- * @param FS_Entity $entity2
68
- *
69
- * @return bool
70
- */
71
- static function equals( $entity1, $entity2 ) {
72
- if ( is_null( $entity1 ) && is_null( $entity2 ) ) {
73
- return true;
74
- } else if ( is_object( $entity1 ) && is_object( $entity2 ) ) {
75
- return ( $entity1->id == $entity2->id );
76
- } else if ( is_object( $entity1 ) ) {
77
- return is_null( $entity1->id );
78
- } else {
79
- return is_null( $entity2->id );
80
- }
81
- }
82
-
83
- private $_is_updated = false;
84
-
85
- /**
86
- * Update object property.
87
- *
88
- * @author Vova Feldman (@svovaf)
89
- * @since 1.0.9
90
- *
91
- * @param string|array[string]mixed $key
92
- * @param string|bool $val
93
- *
94
- * @return bool
95
- */
96
- function update( $key, $val = false ) {
97
- if ( ! is_array( $key ) ) {
98
- $key = array( $key => $val );
99
- }
100
-
101
- $is_updated = false;
102
-
103
- foreach ( $key as $k => $v ) {
104
- if ( $this->{$k} === $v ) {
105
- continue;
106
- }
107
-
108
- if ( ( is_string( $this->{$k} ) && is_numeric( $v ) ||
109
- ( is_numeric( $this->{$k} ) && is_string( $v ) ) ) &&
110
- $this->{$k} == $v
111
- ) {
112
- continue;
113
- }
114
-
115
- // Update value.
116
- $this->{$k} = $v;
117
-
118
- $is_updated = true;
119
- }
120
-
121
- $this->_is_updated = $is_updated;
122
-
123
- return $is_updated;
124
- }
125
-
126
- /**
127
- * Checks if entity was updated.
128
- *
129
- * @author Vova Feldman (@svovaf)
130
- * @since 1.0.9
131
- *
132
- * @return bool
133
- */
134
- function is_updated() {
135
- return $this->_is_updated;
136
- }
137
-
138
- /**
139
- * @param $id
140
- *
141
- * @author Vova Feldman (@svovaf)
142
- * @since 1.1.2
143
- *
144
- * @return bool
145
- */
146
- static function is_valid_id($id){
147
- return is_numeric($id);
148
- }
149
  }
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * Get object's public variables.
15
+ *
16
+ * @author Vova Feldman (@svovaf)
17
+ * @since 1.0.0
18
+ *
19
+ * @param object $object
20
+ *
21
+ * @return array
22
+ */
23
+ function fs_get_object_public_vars( $object ) {
24
+ return get_object_vars( $object );
25
+ }
26
+
27
+ class FS_Entity {
28
+ /**
29
+ * @var number
30
+ */
31
+ public $id;
32
+ /**
33
+ * @var string Datetime value in 'YYYY-MM-DD HH:MM:SS' format.
34
+ */
35
+ public $updated;
36
+ /**
37
+ * @var string Datetime value in 'YYYY-MM-DD HH:MM:SS' format.
38
+ */
39
+ public $created;
40
+
41
+ /**
42
+ * @param bool|object $entity
43
+ */
44
+ function __construct( $entity = false ) {
45
+ if ( ! ( $entity instanceof stdClass ) ) {
46
+ return;
47
+ }
48
+
49
+ $props = fs_get_object_public_vars( $this );
50
+
51
+ foreach ( $props as $key => $def_value ) {
52
+ $this->{$key} = isset( $entity->{$key} ) ?
53
+ $entity->{$key} :
54
+ $def_value;
55
+ }
56
+ }
57
+
58
+ static function get_type() {
59
+ return 'type';
60
+ }
61
+
62
+ /**
63
+ * @author Vova Feldman (@svovaf)
64
+ * @since 1.0.6
65
+ *
66
+ * @param FS_Entity $entity1
67
+ * @param FS_Entity $entity2
68
+ *
69
+ * @return bool
70
+ */
71
+ static function equals( $entity1, $entity2 ) {
72
+ if ( is_null( $entity1 ) && is_null( $entity2 ) ) {
73
+ return true;
74
+ } else if ( is_object( $entity1 ) && is_object( $entity2 ) ) {
75
+ return ( $entity1->id == $entity2->id );
76
+ } else if ( is_object( $entity1 ) ) {
77
+ return is_null( $entity1->id );
78
+ } else {
79
+ return is_null( $entity2->id );
80
+ }
81
+ }
82
+
83
+ private $_is_updated = false;
84
+
85
+ /**
86
+ * Update object property.
87
+ *
88
+ * @author Vova Feldman (@svovaf)
89
+ * @since 1.0.9
90
+ *
91
+ * @param string|array[string]mixed $key
92
+ * @param string|bool $val
93
+ *
94
+ * @return bool
95
+ */
96
+ function update( $key, $val = false ) {
97
+ if ( ! is_array( $key ) ) {
98
+ $key = array( $key => $val );
99
+ }
100
+
101
+ $is_updated = false;
102
+
103
+ foreach ( $key as $k => $v ) {
104
+ if ( $this->{$k} === $v ) {
105
+ continue;
106
+ }
107
+
108
+ if ( ( is_string( $this->{$k} ) && is_numeric( $v ) ||
109
+ ( is_numeric( $this->{$k} ) && is_string( $v ) ) ) &&
110
+ $this->{$k} == $v
111
+ ) {
112
+ continue;
113
+ }
114
+
115
+ // Update value.
116
+ $this->{$k} = $v;
117
+
118
+ $is_updated = true;
119
+ }
120
+
121
+ $this->_is_updated = $is_updated;
122
+
123
+ return $is_updated;
124
+ }
125
+
126
+ /**
127
+ * Checks if entity was updated.
128
+ *
129
+ * @author Vova Feldman (@svovaf)
130
+ * @since 1.0.9
131
+ *
132
+ * @return bool
133
+ */
134
+ function is_updated() {
135
+ return $this->_is_updated;
136
+ }
137
+
138
+ /**
139
+ * @param $id
140
+ *
141
+ * @author Vova Feldman (@svovaf)
142
+ * @since 1.1.2
143
+ *
144
+ * @return bool
145
+ */
146
+ static function is_valid_id($id){
147
+ return is_numeric($id);
148
+ }
149
  }
freemius/includes/entities/class-fs-payment.php CHANGED
@@ -1,94 +1,94 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2016, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.0
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- class FS_Payment extends FS_Entity {
14
-
15
- #region Properties
16
-
17
- /**
18
- * @var number
19
- */
20
- public $plugin_id;
21
- /**
22
- * @var number
23
- */
24
- public $user_id;
25
- /**
26
- * @var number
27
- */
28
- public $install_id;
29
- /**
30
- * @var number
31
- */
32
- public $subscription_id;
33
- /**
34
- * @var number
35
- */
36
- public $plan_id;
37
- /**
38
- * @var number
39
- */
40
- public $license_id;
41
- /**
42
- * @var float
43
- */
44
- public $gross;
45
- /**
46
- * @var number
47
- */
48
- public $bound_payment_id;
49
- /**
50
- * @var string
51
- */
52
- public $external_id;
53
- /**
54
- * @var string
55
- */
56
- public $gateway;
57
- /**
58
- * @var string ISO 3166-1 alpha-2 - two-letter country code.
59
- *
60
- * @link http://www.wikiwand.com/en/ISO_3166-1_alpha-2
61
- */
62
- public $country_code;
63
- /**
64
- * @var string
65
- */
66
- public $vat_id;
67
- /**
68
- * @var float Actual Tax / VAT in $$$
69
- */
70
- public $vat;
71
-
72
- #endregion Properties
73
-
74
- /**
75
- * @param object|bool $payment
76
- */
77
- function __construct( $payment = false ) {
78
- parent::__construct( $payment );
79
- }
80
-
81
- static function get_type() {
82
- return 'payment';
83
- }
84
-
85
- /**
86
- * @author Vova Feldman (@svovaf)
87
- * @since 1.0.0
88
- *
89
- * @return bool
90
- */
91
- function is_refund() {
92
- return ( parent::is_valid_id( $this->bound_payment_id ) && 0 > $this->gross );
93
- }
94
  }
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2016, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.0
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Payment extends FS_Entity {
14
+
15
+ #region Properties
16
+
17
+ /**
18
+ * @var number
19
+ */
20
+ public $plugin_id;
21
+ /**
22
+ * @var number
23
+ */
24
+ public $user_id;
25
+ /**
26
+ * @var number
27
+ */
28
+ public $install_id;
29
+ /**
30
+ * @var number
31
+ */
32
+ public $subscription_id;
33
+ /**
34
+ * @var number
35
+ */
36
+ public $plan_id;
37
+ /**
38
+ * @var number
39
+ */
40
+ public $license_id;
41
+ /**
42
+ * @var float
43
+ */
44
+ public $gross;
45
+ /**
46
+ * @var number
47
+ */
48
+ public $bound_payment_id;
49
+ /**
50
+ * @var string
51
+ */
52
+ public $external_id;
53
+ /**
54
+ * @var string
55
+ */
56
+ public $gateway;
57
+ /**
58
+ * @var string ISO 3166-1 alpha-2 - two-letter country code.
59
+ *
60
+ * @link http://www.wikiwand.com/en/ISO_3166-1_alpha-2
61
+ */
62
+ public $country_code;
63
+ /**
64
+ * @var string
65
+ */
66
+ public $vat_id;
67
+ /**
68
+ * @var float Actual Tax / VAT in $$$
69
+ */
70
+ public $vat;
71
+
72
+ #endregion Properties
73
+
74
+ /**
75
+ * @param object|bool $payment
76
+ */
77
+ function __construct( $payment = false ) {
78
+ parent::__construct( $payment );
79
+ }
80
+
81
+ static function get_type() {
82
+ return 'payment';
83
+ }
84
+
85
+ /**
86
+ * @author Vova Feldman (@svovaf)
87
+ * @since 1.0.0
88
+ *
89
+ * @return bool
90
+ */
91
+ function is_refund() {
92
+ return ( parent::is_valid_id( $this->bound_payment_id ) && 0 > $this->gross );
93
+ }
94
  }
freemius/includes/entities/class-fs-plugin-info.php CHANGED
@@ -1,34 +1,34 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.3
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- class FS_Plugin_Info extends FS_Entity {
14
- public $plugin_id;
15
- public $description;
16
- public $short_description;
17
- public $banner_url;
18
- public $card_banner_url;
19
- public $selling_point_0;
20
- public $selling_point_1;
21
- public $selling_point_2;
22
- public $screenshots;
23
-
24
- /**
25
- * @param stdClass|bool $plugin_info
26
- */
27
- function __construct( $plugin_info = false ) {
28
- parent::__construct( $plugin_info );
29
- }
30
-
31
- static function get_type() {
32
- return 'plugin';
33
- }
34
  }
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Plugin_Info extends FS_Entity {
14
+ public $plugin_id;
15
+ public $description;
16
+ public $short_description;
17
+ public $banner_url;
18
+ public $card_banner_url;
19
+ public $selling_point_0;
20
+ public $selling_point_1;
21
+ public $selling_point_2;
22
+ public $screenshots;
23
+
24
+ /**
25
+ * @param stdClass|bool $plugin_info
26
+ */
27
+ function __construct( $plugin_info = false ) {
28
+ parent::__construct( $plugin_info );
29
+ }
30
+
31
+ static function get_type() {
32
+ return 'plugin';
33
+ }
34
  }
freemius/includes/entities/class-fs-plugin-license.php CHANGED
@@ -1,224 +1,224 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.5
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- /**
14
- * Class FS_Plugin_License
15
- */
16
- class FS_Plugin_License extends FS_Entity {
17
-
18
- #region Properties
19
-
20
- /**
21
- * @var number
22
- */
23
- public $plugin_id;
24
- /**
25
- * @var number
26
- */
27
- public $user_id;
28
- /**
29
- * @var number
30
- */
31
- public $plan_id;
32
- /**
33
- * @var number
34
- */
35
- public $pricing_id;
36
- /**
37
- * @var int|null
38
- */
39
- public $quota;
40
- /**
41
- * @var int
42
- */
43
- public $activated;
44
- /**
45
- * @var int
46
- */
47
- public $activated_local;
48
- /**
49
- * @var string
50
- */
51
- public $expiration;
52
- /**
53
- * @var string
54
- */
55
- public $secret_key;
56
- /**
57
- * @var bool $is_free_localhost Defaults to true. If true, allow unlimited localhost installs with the same
58
- * license.
59
- */
60
- public $is_free_localhost;
61
- /**
62
- * @var bool $is_block_features Defaults to true. If false, don't block features after license expiry - only
63
- * block updates and support.
64
- */
65
- public $is_block_features;
66
- /**
67
- * @var bool
68
- */
69
- public $is_cancelled;
70
-
71
- #endregion Properties
72
-
73
- /**
74
- * @param stdClass|bool $license
75
- */
76
- function __construct( $license = false ) {
77
- parent::__construct( $license );
78
- }
79
-
80
- /**
81
- * Get entity type.
82
- *
83
- * @return string
84
- */
85
- static function get_type() {
86
- return 'license';
87
- }
88
-
89
- /**
90
- * Check how many site activations left.
91
- *
92
- * @author Vova Feldman (@svovaf)
93
- * @since 1.0.5
94
- *
95
- * @return int
96
- */
97
- function left() {
98
- if ( ! $this->is_active() || $this->is_expired() ) {
99
- return 0;
100
- }
101
-
102
- if ( $this->is_unlimited() ) {
103
- return 999;
104
- }
105
-
106
- return ( $this->quota - $this->activated - ( $this->is_free_localhost ? 0 : $this->activated_local ) );
107
- }
108
-
109
- /**
110
- * Check if single site license.
111
- *
112
- * @author Vova Feldman (@svovaf)
113
- * @since 1.1.8.1
114
- *
115
- * @return bool
116
- */
117
- function is_single_site() {
118
- return ( is_numeric( $this->quota ) && 1 == $this->quota );
119
- }
120
-
121
- /**
122
- * @author Vova Feldman (@svovaf)
123
- * @since 1.0.5
124
- *
125
- * @return bool
126
- */
127
- function is_expired() {
128
- return ! $this->is_lifetime() && ( strtotime( $this->expiration ) < WP_FS__SCRIPT_START_TIME );
129
- }
130
-
131
- /**
132
- * Check if license is not expired.
133
- *
134
- * @author Vova Feldman (@svovaf)
135
- * @since 1.2.1
136
- *
137
- * @return bool
138
- */
139
- function is_valid() {
140
- return ! $this->is_expired();
141
- }
142
-
143
- /**
144
- * @author Vova Feldman (@svovaf)
145
- * @since 1.0.6
146
- *
147
- * @return bool
148
- */
149
- function is_lifetime() {
150
- return is_null( $this->expiration );
151
- }
152
-
153
- /**
154
- * @author Vova Feldman (@svovaf)
155
- * @since 1.2.0
156
- *
157
- * @return bool
158
- */
159
- function is_unlimited() {
160
- return is_null( $this->quota );
161
- }
162
-
163
- /**
164
- * Check if license is fully utilized.
165
- *
166
- * @author Vova Feldman (@svovaf)
167
- * @since 1.0.6
168
- *
169
- * @param bool $is_localhost
170
- *
171
- * @return bool
172
- */
173
- function is_utilized( $is_localhost = null ) {
174
- if ( is_null( $is_localhost ) ) {
175
- $is_localhost = WP_FS__IS_LOCALHOST_FOR_SERVER;
176
- }
177
-
178
- if ( $this->is_unlimited() ) {
179
- return false;
180
- }
181
-
182
- return ! ( $this->is_free_localhost && $is_localhost ) &&
183
- ( $this->quota <= $this->activated + ( $this->is_free_localhost ? 0 : $this->activated_local ) );
184
- }
185
-
186
- /**
187
- * @author Vova Feldman (@svovaf)
188
- * @since 1.2.1
189
- *
190
- * @return bool
191
- */
192
- function is_active() {
193
- return ( ! $this->is_cancelled );
194
- }
195
-
196
- /**
197
- * Check if license's plan features are enabled.
198
- *
199
- * - Either if plan not expired
200
- * - If expired, based on the configuration to block features or not.
201
- *
202
- * @author Vova Feldman (@svovaf)
203
- * @since 1.0.6
204
- *
205
- * @return bool
206
- */
207
- function is_features_enabled() {
208
- return $this->is_active() && ( ! $this->is_block_features || ! $this->is_expired() );
209
- }
210
-
211
- /**
212
- * Subscription considered to be new without any payments
213
- * if the license expires in less than 24 hours
214
- * from the license creation.
215
- *
216
- * @author Vova Feldman (@svovaf)
217
- * @since 1.0.9
218
- *
219
- * @return bool
220
- */
221
- function is_first_payment_pending() {
222
- return ( WP_FS__TIME_24_HOURS_IN_SEC >= strtotime( $this->expiration ) - strtotime( $this->created ) );
223
- }
224
- }
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.5
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * Class FS_Plugin_License
15
+ */
16
+ class FS_Plugin_License extends FS_Entity {
17
+
18
+ #region Properties
19
+
20
+ /**
21
+ * @var number
22
+ */
23
+ public $plugin_id;
24
+ /**
25
+ * @var number
26
+ */
27
+ public $user_id;
28
+ /**
29
+ * @var number
30
+ */
31
+ public $plan_id;
32
+ /**
33
+ * @var number
34
+ */
35
+ public $pricing_id;
36
+ /**
37
+ * @var int|null
38
+ */
39
+ public $quota;
40
+ /**
41
+ * @var int
42
+ */
43
+ public $activated;
44
+ /**
45
+ * @var int
46
+ */
47
+ public $activated_local;
48
+ /**
49
+ * @var string
50
+ */
51
+ public $expiration;
52
+ /**
53
+ * @var string
54
+ */
55
+ public $secret_key;
56
+ /**
57
+ * @var bool $is_free_localhost Defaults to true. If true, allow unlimited localhost installs with the same
58
+ * license.
59
+ */
60
+ public $is_free_localhost;
61
+ /**
62
+ * @var bool $is_block_features Defaults to true. If false, don't block features after license expiry - only
63
+ * block updates and support.
64
+ */
65
+ public $is_block_features;
66
+ /**
67
+ * @var bool
68
+ */
69
+ public $is_cancelled;
70
+
71
+ #endregion Properties
72
+
73
+ /**
74
+ * @param stdClass|bool $license
75
+ */
76
+ function __construct( $license = false ) {
77
+ parent::__construct( $license );
78
+ }
79
+
80
+ /**
81
+ * Get entity type.
82
+ *
83
+ * @return string
84
+ */
85
+ static function get_type() {
86
+ return 'license';
87
+ }
88
+
89
+ /**
90
+ * Check how many site activations left.
91
+ *
92
+ * @author Vova Feldman (@svovaf)
93
+ * @since 1.0.5
94
+ *
95
+ * @return int
96
+ */
97
+ function left() {
98
+ if ( ! $this->is_active() || $this->is_expired() ) {
99
+ return 0;
100
+ }
101
+
102
+ if ( $this->is_unlimited() ) {
103
+ return 999;
104
+ }
105
+
106
+ return ( $this->quota - $this->activated - ( $this->is_free_localhost ? 0 : $this->activated_local ) );
107
+ }
108
+
109
+ /**
110
+ * Check if single site license.
111
+ *
112
+ * @author Vova Feldman (@svovaf)
113
+ * @since 1.1.8.1
114
+ *
115
+ * @return bool
116
+ */
117
+ function is_single_site() {
118
+ return ( is_numeric( $this->quota ) && 1 == $this->quota );
119
+ }
120
+
121
+ /**
122
+ * @author Vova Feldman (@svovaf)
123
+ * @since 1.0.5
124
+ *
125
+ * @return bool
126
+ */
127
+ function is_expired() {
128
+ return ! $this->is_lifetime() && ( strtotime( $this->expiration ) < WP_FS__SCRIPT_START_TIME );
129
+ }
130
+
131
+ /**
132
+ * Check if license is not expired.
133
+ *
134
+ * @author Vova Feldman (@svovaf)
135
+ * @since 1.2.1
136
+ *
137
+ * @return bool
138
+ */
139
+ function is_valid() {
140
+ return ! $this->is_expired();
141
+ }
142
+
143
+ /**
144
+ * @author Vova Feldman (@svovaf)
145
+ * @since 1.0.6
146
+ *
147
+ * @return bool
148
+ */
149
+ function is_lifetime() {
150
+ return is_null( $this->expiration );
151
+ }
152
+
153
+ /**
154
+ * @author Vova Feldman (@svovaf)
155
+ * @since 1.2.0
156
+ *
157
+ * @return bool
158
+ */
159
+ function is_unlimited() {
160
+ return is_null( $this->quota );
161
+ }
162
+
163
+ /**
164
+ * Check if license is fully utilized.
165
+ *
166
+ * @author Vova Feldman (@svovaf)
167
+ * @since 1.0.6
168
+ *
169
+ * @param bool $is_localhost
170
+ *
171
+ * @return bool
172
+ */
173
+ function is_utilized( $is_localhost = null ) {
174
+ if ( is_null( $is_localhost ) ) {
175
+ $is_localhost = WP_FS__IS_LOCALHOST_FOR_SERVER;
176
+ }
177
+
178
+ if ( $this->is_unlimited() ) {
179
+ return false;
180
+ }
181
+
182
+ return ! ( $this->is_free_localhost && $is_localhost ) &&
183
+ ( $this->quota <= $this->activated + ( $this->is_free_localhost ? 0 : $this->activated_local ) );
184
+ }
185
+
186
+ /**
187
+ * @author Vova Feldman (@svovaf)
188
+ * @since 1.2.1
189
+ *
190
+ * @return bool
191
+ */
192
+ function is_active() {
193
+ return ( ! $this->is_cancelled );
194
+ }
195
+
196
+ /**
197
+ * Check if license's plan features are enabled.
198
+ *
199
+ * - Either if plan not expired
200
+ * - If expired, based on the configuration to block features or not.
201
+ *
202
+ * @author Vova Feldman (@svovaf)
203
+ * @since 1.0.6
204
+ *
205
+ * @return bool
206
+ */
207
+ function is_features_enabled() {
208
+ return $this->is_active() && ( ! $this->is_block_features || ! $this->is_expired() );
209
+ }
210
+
211
+ /**
212
+ * Subscription considered to be new without any payments
213
+ * if the license expires in less than 24 hours
214
+ * from the license creation.
215
+ *
216
+ * @author Vova Feldman (@svovaf)
217
+ * @since 1.0.9
218
+ *
219
+ * @return bool
220
+ */
221
+ function is_first_payment_pending() {
222
+ return ( WP_FS__TIME_24_HOURS_IN_SEC >= strtotime( $this->expiration ) - strtotime( $this->created ) );
223
+ }
224
+ }
freemius/includes/entities/class-fs-plugin-plan.php CHANGED
@@ -1,145 +1,145 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.5
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- /**
14
- * Class FS_Plugin_Plan
15
- *
16
- * @property FS_Pricing[] $pricing
17
- */
18
- class FS_Plugin_Plan extends FS_Entity {
19
-
20
- #region Properties
21
-
22
- /**
23
- * @var number
24
- */
25
- public $plugin_id;
26
- /**
27
- * @var string
28
- */
29
- public $name;
30
- /**
31
- * @var string
32
- */
33
- public $title;
34
- /**
35
- * @var string
36
- */
37
- public $description;
38
- /**
39
- * @var bool Defaults to true. If true, allow unlimited localhost installs with the same license.
40
- */
41
- public $is_free_localhost;
42
- /**
43
- * @var bool Defaults to true. If false, don't block features after license expiry - only block updates and
44
- * support.
45
- */
46
- public $is_block_features;
47
- /**
48
- * @var int
49
- */
50
- public $license_type;
51
- /**
52
- * @var bool
53
- */
54
- public $is_https_support;
55
- /**
56
- * @var int Trial days.
57
- */
58
- public $trial_period;
59
- /**
60
- * @var string If true, require payment for trial.
61
- */
62
- public $is_require_subscription;
63
- /**
64
- * @var string Knowledge Base URL.
65
- */
66
- public $support_kb;
67
- /**
68
- * @var string Support Forum URL.
69
- */
70
- public $support_forum;
71
- /**
72
- * @var string Support email address.
73
- */
74
- public $support_email;
75
- /**
76
- * @var string Support phone.
77
- */
78
- public $support_phone;
79
- /**
80
- * @var string Support skype username.
81
- */
82
- public $support_skype;
83
- /**
84
- * @var bool Is personal success manager supported with the plan.
85
- */
86
- public $is_success_manager;
87
- /**
88
- * @var bool Is featured plan.
89
- */
90
- public $is_featured;
91
-
92
- #endregion Properties
93
-
94
- /**
95
- * @param object|bool $plan
96
- */
97
- function __construct( $plan = false ) {
98
- parent::__construct( $plan );
99
-
100
- if ( is_object( $plan ) ) {
101
- $this->name = strtolower( $plan->name );
102
- }
103
- }
104
-
105
- static function get_type() {
106
- return 'plan';
107
- }
108
-
109
- /**
110
- * @author Vova Feldman (@svovaf)
111
- * @since 1.0.9
112
- *
113
- * @return bool
114
- */
115
- function is_free() {
116
- return ( 'free' === $this->name );
117
- }
118
-
119
- /**
120
- * Checks if this plan supports "Technical Support".
121
- *
122
- * @author Leo Fajardo (leorw)
123
- * @since 1.2.0
124
- *
125
- * @return bool
126
- */
127
- function has_technical_support() {
128
- return ( ! empty( $this->support_email ) ||
129
- ! empty( $this->support_skype ) ||
130
- ! empty( $this->support_phone ) ||
131
- ! empty( $this->is_success_manager )
132
- );
133
- }
134
-
135
- /**
136
- * @author Vova Feldman (@svovaf)
137
- * @since 1.0.9
138
- *
139
- * @return bool
140
- */
141
- function has_trial() {
142
- return ! $this->is_free() &&
143
- is_numeric( $this->trial_period ) && ( $this->trial_period > 0 );
144
- }
145
  }
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.5
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * Class FS_Plugin_Plan
15
+ *
16
+ * @property FS_Pricing[] $pricing
17
+ */
18
+ class FS_Plugin_Plan extends FS_Entity {
19
+
20
+ #region Properties
21
+
22
+ /**
23
+ * @var number
24
+ */
25
+ public $plugin_id;
26
+ /**
27
+ * @var string
28
+ */
29
+ public $name;
30
+ /**
31
+ * @var string
32
+ */
33
+ public $title;
34
+ /**
35
+ * @var string
36
+ */
37
+ public $description;
38
+ /**
39
+ * @var bool Defaults to true. If true, allow unlimited localhost installs with the same license.
40
+ */
41
+ public $is_free_localhost;
42
+ /**
43
+ * @var bool Defaults to true. If false, don't block features after license expiry - only block updates and
44
+ * support.
45
+ */
46
+ public $is_block_features;
47
+ /**
48
+ * @var int
49
+ */
50
+ public $license_type;
51
+ /**
52
+ * @var bool
53
+ */
54
+ public $is_https_support;
55
+ /**
56
+ * @var int Trial days.
57
+ */
58
+ public $trial_period;
59
+ /**
60
+ * @var string If true, require payment for trial.
61
+ */
62
+ public $is_require_subscription;
63
+ /**
64
+ * @var string Knowledge Base URL.
65
+ */
66
+ public $support_kb;
67
+ /**
68
+ * @var string Support Forum URL.
69
+ */
70
+ public $support_forum;
71
+ /**
72
+ * @var string Support email address.
73
+ */
74
+ public $support_email;
75
+ /**
76
+ * @var string Support phone.
77
+ */
78
+ public $support_phone;
79
+ /**
80
+ * @var string Support skype username.
81
+ */
82
+ public $support_skype;
83
+ /**
84
+ * @var bool Is personal success manager supported with the plan.
85
+ */
86
+ public $is_success_manager;
87
+ /**
88
+ * @var bool Is featured plan.
89
+ */
90
+ public $is_featured;
91
+
92
+ #endregion Properties
93
+
94
+ /**
95
+ * @param object|bool $plan
96
+ */
97
+ function __construct( $plan = false ) {
98
+ parent::__construct( $plan );
99
+
100
+ if ( is_object( $plan ) ) {
101
+ $this->name = strtolower( $plan->name );
102
+ }
103
+ }
104
+
105
+ static function get_type() {
106
+ return 'plan';
107
+ }
108
+
109
+ /**
110
+ * @author Vova Feldman (@svovaf)
111
+ * @since 1.0.9
112
+ *
113
+ * @return bool
114
+ */
115
+ function is_free() {
116
+ return ( 'free' === $this->name );
117
+ }
118
+
119
+ /**
120
+ * Checks if this plan supports "Technical Support".
121
+ *
122
+ * @author Leo Fajardo (leorw)
123
+ * @since 1.2.0
124
+ *
125
+ * @return bool
126
+ */
127
+ function has_technical_support() {
128
+ return ( ! empty( $this->support_email ) ||
129
+ ! empty( $this->support_skype ) ||
130
+ ! empty( $this->support_phone ) ||
131
+ ! empty( $this->is_success_manager )
132
+ );
133
+ }
134
+
135
+ /**
136
+ * @author Vova Feldman (@svovaf)
137
+ * @since 1.0.9
138
+ *
139
+ * @return bool
140
+ */
141
+ function has_trial() {
142
+ return ! $this->is_free() &&
143
+ is_numeric( $this->trial_period ) && ( $this->trial_period > 0 );
144
+ }
145
  }
freemius/includes/entities/class-fs-plugin-tag.php CHANGED
@@ -1,24 +1,24 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.4
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- class FS_Plugin_Tag extends FS_Entity {
14
- public $version;
15
- public $url;
16
-
17
- function __construct( $tag = false ) {
18
- parent::__construct( $tag );
19
- }
20
-
21
- static function get_type() {
22
- return 'tag';
23
- }
24
  }
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.4
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Plugin_Tag extends FS_Entity {
14
+ public $version;
15
+ public $url;
16
+
17
+ function __construct( $tag = false ) {
18
+ parent::__construct( $tag );
19
+ }
20
+
21
+ static function get_type() {
22
+ return 'tag';
23
+ }
24
  }
freemius/includes/entities/class-fs-plugin.php CHANGED
@@ -1,94 +1,94 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.3
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- class FS_Plugin extends FS_Scope_Entity {
14
- /**
15
- * @since 1.0.6
16
- * @var null|number
17
- */
18
- public $parent_plugin_id;
19
- /**
20
- * @var string
21
- */
22
- public $title;
23
- /**
24
- * @var string
25
- */
26
- public $slug;
27
- /**
28
- * @var string 'plugin' or 'theme'
29
- */
30
- public $type;
31
-
32
- #region Install Specific Properties
33
-
34
- /**
35
- * @var string
36
- */
37
- public $file;
38
- /**
39
- * @var string
40
- */
41
- public $version;
42
- /**
43
- * @var bool
44
- */
45
- public $auto_update;
46
- /**
47
- * @var FS_Plugin_Info
48
- */
49
- public $info;
50
- /**
51
- * @since 1.0.9
52
- *
53
- * @var bool
54
- */
55
- public $is_premium;
56
- /**
57
- * @since 1.0.9
58
- *
59
- * @var bool
60
- */
61
- public $is_live;
62
-
63
- #endregion Install Specific Properties
64
-
65
- /**
66
- * @param stdClass|bool $plugin
67
- */
68
- function __construct( $plugin = false ) {
69
- parent::__construct( $plugin );
70
-
71
- $this->is_premium = false;
72
- $this->is_live = true;
73
-
74
- if ( isset( $plugin->info ) && is_object( $plugin->info ) ) {
75
- $this->info = new FS_Plugin_Info( $plugin->info );
76
- }
77
- }
78
-
79
- /**
80
- * Check if plugin is an add-on (has parent).
81
- *
82
- * @author Vova Feldman (@svovaf)
83
- * @since 1.0.6
84
- *
85
- * @return bool
86
- */
87
- function is_addon() {
88
- return isset( $this->parent_plugin_id ) && is_numeric( $this->parent_plugin_id );
89
- }
90
-
91
- static function get_type() {
92
- return 'plugin';
93
- }
94
  }
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Plugin extends FS_Scope_Entity {
14
+ /**
15
+ * @since 1.0.6
16
+ * @var null|number
17
+ */
18
+ public $parent_plugin_id;
19
+ /**
20
+ * @var string
21
+ */
22
+ public $title;
23
+ /**
24
+ * @var string
25
+ */
26
+ public $slug;
27
+ /**
28
+ * @var string 'plugin' or 'theme'
29
+ */
30
+ public $type;
31
+
32
+ #region Install Specific Properties
33
+
34
+ /**
35
+ * @var string
36
+ */
37
+ public $file;
38
+ /**
39
+ * @var string
40
+ */
41
+ public $version;
42
+ /**
43
+ * @var bool
44
+ */
45
+ public $auto_update;
46
+ /**
47
+ * @var FS_Plugin_Info
48
+ */
49
+ public $info;
50
+ /**
51
+ * @since 1.0.9
52
+ *
53
+ * @var bool
54
+ */
55
+ public $is_premium;
56
+ /**
57
+ * @since 1.0.9
58
+ *
59
+ * @var bool
60
+ */
61
+ public $is_live;
62
+
63
+ #endregion Install Specific Properties
64
+
65
+ /**
66
+ * @param stdClass|bool $plugin
67
+ */
68
+ function __construct( $plugin = false ) {
69
+ parent::__construct( $plugin );
70
+
71
+ $this->is_premium = false;
72
+ $this->is_live = true;
73
+
74
+ if ( isset( $plugin->info ) && is_object( $plugin->info ) ) {
75
+ $this->info = new FS_Plugin_Info( $plugin->info );
76
+ }
77
+ }
78
+
79
+ /**
80
+ * Check if plugin is an add-on (has parent).
81
+ *
82
+ * @author Vova Feldman (@svovaf)
83
+ * @since 1.0.6
84
+ *
85
+ * @return bool
86
+ */
87
+ function is_addon() {
88
+ return isset( $this->parent_plugin_id ) && is_numeric( $this->parent_plugin_id );
89
+ }
90
+
91
+ static function get_type() {
92
+ return 'plugin';
93
+ }
94
  }
freemius/includes/entities/class-fs-pricing.php CHANGED
@@ -1,141 +1,141 @@
1
- <?php
2
- /**
3
- * @package Freemius for EDD Add-On
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.0
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- class FS_Pricing extends FS_Entity {
14
-
15
- #region Properties
16
-
17
- /**
18
- * @var number
19
- */
20
- public $plan_id;
21
- /**
22
- * @var int
23
- */
24
- public $licenses;
25
- /**
26
- * @var null|float
27
- */
28
- public $monthly_price;
29
- /**
30
- * @var null|float
31
- */
32
- public $annual_price;
33
- /**
34
- * @var null|float
35
- */
36
- public $lifetime_price;
37
-
38
- #endregion Properties
39
-
40
- /**
41
- * @param object|bool $pricing
42
- */
43
- function __construct( $pricing = false ) {
44
- parent::__construct( $pricing );
45
- }
46
-
47
- static function get_type() {
48
- return 'pricing';
49
- }
50
-
51
- /**
52
- * @author Vova Feldman (@svovaf)
53
- * @since 1.1.8
54
- *
55
- * @return bool
56
- */
57
- function has_monthly() {
58
- return ( is_numeric( $this->monthly_price ) && $this->monthly_price > 0 );
59
- }
60
-
61
- /**
62
- * @author Vova Feldman (@svovaf)
63
- * @since 1.1.8
64
- *
65
- * @return bool
66
- */
67
- function has_annual() {
68
- return ( is_numeric( $this->annual_price ) && $this->annual_price > 0 );
69
- }
70
-
71
- /**
72
- * @author Vova Feldman (@svovaf)
73
- * @since 1.1.8
74
- *
75
- * @return bool
76
- */
77
- function has_lifetime() {
78
- return ( is_numeric( $this->lifetime_price ) && $this->lifetime_price > 0 );
79
- }
80
-
81
- /**
82
- * Check if unlimited licenses pricing.
83
- *
84
- * @author Vova Feldman (@svovaf)
85
- * @since 1.1.8
86
- *
87
- * @return bool
88
- */
89
- function is_unlimited() {
90
- return is_null( $this->licenses );
91
- }
92
-
93
-
94
- /**
95
- * Check if pricing has more than one billing cycle.
96
- *
97
- * @author Vova Feldman (@svovaf)
98
- * @since 1.1.8
99
- *
100
- * @return bool
101
- */
102
- function is_multi_cycle() {
103
- $cycles = 0;
104
- if ( $this->has_monthly() ) {
105
- $cycles ++;
106
- }
107
- if ( $this->has_annual() ) {
108
- $cycles ++;
109
- }
110
- if ( $this->has_lifetime() ) {
111
- $cycles ++;
112
- }
113
-
114
- return $cycles > 1;
115
- }
116
-
117
- /**
118
- * Get annual over monthly discount.
119
- *
120
- * @author Vova Feldman (@svovaf)
121
- * @since 1.1.8
122
- *
123
- * @return int
124
- */
125
- function annual_discount_percentage() {
126
- return floor( $this->annual_savings() / ( $this->monthly_price * 12 * ( $this->is_unlimited() ? 1 : $this->licenses ) ) * 100 );
127
- }
128
-
129
- /**
130
- * Get annual over monthly savings.
131
- *
132
- * @author Vova Feldman (@svovaf)
133
- * @since 1.1.8
134
- *
135
- * @return float
136
- */
137
- function annual_savings() {
138
- return ( $this->monthly_price * 12 - $this->annual_price ) * ( $this->is_unlimited() ? 1 : $this->licenses );
139
- }
140
-
141
  }
1
+ <?php
2
+ /**
3
+ * @package Freemius for EDD Add-On
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.0
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Pricing extends FS_Entity {
14
+
15
+ #region Properties
16
+
17
+ /**
18
+ * @var number
19
+ */
20
+ public $plan_id;
21
+ /**
22
+ * @var int
23
+ */
24
+ public $licenses;
25
+ /**
26
+ * @var null|float
27
+ */
28
+ public $monthly_price;
29
+ /**
30
+ * @var null|float
31
+ */
32
+ public $annual_price;
33
+ /**
34
+ * @var null|float
35
+ */
36
+ public $lifetime_price;
37
+
38
+ #endregion Properties
39
+
40
+ /**
41
+ * @param object|bool $pricing
42
+ */
43
+ function __construct( $pricing = false ) {
44
+ parent::__construct( $pricing );
45
+ }
46
+
47
+ static function get_type() {
48
+ return 'pricing';
49
+ }
50
+
51
+ /**
52
+ * @author Vova Feldman (@svovaf)
53
+ * @since 1.1.8
54
+ *
55
+ * @return bool
56
+ */
57
+ function has_monthly() {
58
+ return ( is_numeric( $this->monthly_price ) && $this->monthly_price > 0 );
59
+ }
60
+
61
+ /**
62
+ * @author Vova Feldman (@svovaf)
63
+ * @since 1.1.8
64
+ *
65
+ * @return bool
66
+ */
67
+ function has_annual() {
68
+ return ( is_numeric( $this->annual_price ) && $this->annual_price > 0 );
69
+ }
70
+
71
+ /**
72
+ * @author Vova Feldman (@svovaf)
73
+ * @since 1.1.8
74
+ *
75
+ * @return bool
76
+ */
77
+ function has_lifetime() {
78
+ return ( is_numeric( $this->lifetime_price ) && $this->lifetime_price > 0 );
79
+ }
80
+
81
+ /**
82
+ * Check if unlimited licenses pricing.
83
+ *
84
+ * @author Vova Feldman (@svovaf)
85
+ * @since 1.1.8
86
+ *
87
+ * @return bool
88
+ */
89
+ function is_unlimited() {
90
+ return is_null( $this->licenses );
91
+ }
92
+
93
+
94
+ /**
95
+ * Check if pricing has more than one billing cycle.
96
+ *
97
+ * @author Vova Feldman (@svovaf)
98
+ * @since 1.1.8
99
+ *
100
+ * @return bool
101
+ */
102
+ function is_multi_cycle() {
103
+ $cycles = 0;
104
+ if ( $this->has_monthly() ) {
105
+ $cycles ++;
106
+ }
107
+ if ( $this->has_annual() ) {
108
+ $cycles ++;
109
+ }
110
+ if ( $this->has_lifetime() ) {
111
+ $cycles ++;
112
+ }
113
+
114
+ return $cycles > 1;
115
+ }
116
+
117
+ /**
118
+ * Get annual over monthly discount.
119
+ *
120
+ * @author Vova Feldman (@svovaf)
121
+ * @since 1.1.8
122
+ *
123
+ * @return int
124
+ */
125
+ function annual_discount_percentage() {
126
+ return floor( $this->annual_savings() / ( $this->monthly_price * 12 * ( $this->is_unlimited() ? 1 : $this->licenses ) ) * 100 );
127
+ }
128
+
129
+ /**
130
+ * Get annual over monthly savings.
131
+ *
132
+ * @author Vova Feldman (@svovaf)
133
+ * @since 1.1.8
134
+ *
135
+ * @return float
136
+ */
137
+ function annual_savings() {
138
+ return ( $this->monthly_price * 12 - $this->annual_price ) * ( $this->is_unlimited() ? 1 : $this->licenses );
139
+ }
140
+
141
  }
freemius/includes/entities/class-fs-scope-entity.php CHANGED
@@ -1,29 +1,29 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.4
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- class FS_Scope_Entity extends FS_Entity {
14
- /**
15
- * @var string
16
- */
17
- public $public_key;
18
- /**
19
- * @var string
20
- */
21
- public $secret_key;
22
-
23
- /**
24
- * @param bool|stdClass $scope_entity
25
- */
26
- function __construct( $scope_entity = false ) {
27
- parent::__construct( $scope_entity );
28
- }
29
  }
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.4
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Scope_Entity extends FS_Entity {
14
+ /**
15
+ * @var string
16
+ */
17
+ public $public_key;
18
+ /**
19
+ * @var string
20
+ */
21
+ public $secret_key;
22
+
23
+ /**
24
+ * @param bool|stdClass $scope_entity
25
+ */
26
+ function __construct( $scope_entity = false ) {
27
+ parent::__construct( $scope_entity );
28
+ }
29
  }
freemius/includes/entities/class-fs-site.php CHANGED
@@ -1,148 +1,148 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.3
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- class FS_Site extends FS_Scope_Entity {
14
- /**
15
- * @var string
16
- */
17
- public $slug;
18
- /**
19
- * @var number
20
- */
21
- public $site_id;
22
- /**
23
- * @var number
24
- */
25
- public $plugin_id;
26
- /**
27
- * @var number
28
- */
29
- public $user_id;
30
- /**
31
- * @var string
32
- */
33
- public $title;
34
- /**
35
- * @var string
36
- */
37
- public $url;
38
- /**
39
- * @var string
40
- */
41
- public $version;
42
- /**
43
- * @var string E.g. en-GB
44
- */
45
- public $language;
46
- /**
47
- * @var string E.g. UTF-8
48
- */
49
- public $charset;
50
- /**
51
- * @var string Platform version (e.g WordPress version).
52
- */
53
- public $platform_version;
54
- /**
55
- * Freemius SDK version
56
- *
57
- * @author Leo Fajardo (@leorw)
58
- * @since 1.2.2
59
- *
60
- * @var string SDK version (e.g.: 1.2.2)
61
- */
62
- public $sdk_version;
63
- /**
64
- * @var string Programming language version (e.g PHP version).
65
- */
66
- public $programming_language_version;
67
- /**
68
- * @var FS_Plugin_Plan $plan
69
- */
70
- public $plan;
71
- /**
72
- * @var number|null
73
- */
74
- public $license_id;
75
- /**
76
- * @var number|null
77
- */
78
- public $trial_plan_id;
79
- /**
80
- * @var string|null
81
- */
82
- public $trial_ends;
83
- /**
84
- * @since 1.0.9
85
- *
86
- * @var bool
87
- */
88
- public $is_premium = false;
89
- /**
90
- * @author Leo Fajardo (@leorw)
91
- *
92
- * @since 1.2.1.5
93
- *
94
- * @var bool
95
- */
96
- public $is_disconnected = false;
97
-
98
- /**
99
- * @param stdClass|bool $site
100
- */
101
- function __construct( $site = false ) {
102
- $this->plan = new FS_Plugin_Plan();
103
-
104
- parent::__construct( $site );
105
-
106
- if ( is_object( $site ) ) {
107
- $this->plan->id = $site->plan_id;
108
- }
109
-
110
- if ( ! is_bool( $this->is_disconnected ) ) {
111
- $this->is_disconnected = false;
112
- }
113
- }
114
-
115
- static function get_type() {
116
- return 'install';
117
- }
118
-
119
- function is_localhost() {
120
- // The server has no way to verify if localhost unless localhost appears in domain.
121
- return WP_FS__IS_LOCALHOST_FOR_SERVER;
122
- // return (substr($_SERVER['REMOTE_ADDR'], 0, 4) == '127.' || $_SERVER['REMOTE_ADDR'] == '::1');
123
- }
124
-
125
- /**
126
- * Check if site in trial.
127
- *
128
- * @author Vova Feldman (@svovaf)
129
- * @since 1.0.9
130
- *
131
- * @return bool
132
- */
133
- function is_trial() {
134
- return is_numeric( $this->trial_plan_id ) && ( strtotime( $this->trial_ends ) > WP_FS__SCRIPT_START_TIME );
135
- }
136
-
137
- /**
138
- * Check if user already utilized the trial with the current install.
139
- *
140
- * @author Vova Feldman (@svovaf)
141
- * @since 1.0.9
142
- *
143
- * @return bool
144
- */
145
- function is_trial_utilized() {
146
- return is_numeric( $this->trial_plan_id );
147
- }
148
  }
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Site extends FS_Scope_Entity {
14
+ /**
15
+ * @var string
16
+ */
17
+ public $slug;
18
+ /**
19
+ * @var number
20
+ */
21
+ public $site_id;
22
+ /**
23
+ * @var number
24
+ */
25
+ public $plugin_id;
26
+ /**
27
+ * @var number
28
+ */
29
+ public $user_id;
30
+ /**
31
+ * @var string
32
+ */
33
+ public $title;
34
+ /**
35
+ * @var string
36
+ */
37
+ public $url;
38
+ /**
39
+ * @var string
40
+ */
41
+ public $version;
42
+ /**
43
+ * @var string E.g. en-GB
44
+ */
45
+ public $language;
46
+ /**
47
+ * @var string E.g. UTF-8
48
+ */
49
+ public $charset;
50
+ /**
51
+ * @var string Platform version (e.g WordPress version).
52
+ */
53
+ public $platform_version;
54
+ /**
55
+ * Freemius SDK version
56
+ *
57
+ * @author Leo Fajardo (@leorw)
58
+ * @since 1.2.2
59
+ *
60
+ * @var string SDK version (e.g.: 1.2.2)
61
+ */
62
+ public $sdk_version;
63
+ /**
64
+ * @var string Programming language version (e.g PHP version).
65
+ */
66
+ public $programming_language_version;
67
+ /**
68
+ * @var FS_Plugin_Plan $plan
69
+ */
70
+ public $plan;
71
+ /**
72
+ * @var number|null
73
+ */
74
+ public $license_id;
75
+ /**
76
+ * @var number|null
77
+ */
78
+ public $trial_plan_id;
79
+ /**
80
+ * @var string|null
81
+ */
82
+ public $trial_ends;
83
+ /**
84
+ * @since 1.0.9
85
+ *
86
+ * @var bool
87
+ */
88
+ public $is_premium = false;
89
+ /**
90
+ * @author Leo Fajardo (@leorw)
91
+ *
92
+ * @since 1.2.1.5
93
+ *
94
+ * @var bool
95
+ */
96
+ public $is_disconnected = false;
97
+
98
+ /**
99
+ * @param stdClass|bool $site
100
+ */
101
+ function __construct( $site = false ) {
102
+ $this->plan = new FS_Plugin_Plan();
103
+
104
+ parent::__construct( $site );
105
+
106
+ if ( is_object( $site ) ) {
107
+ $this->plan->id = $site->plan_id;
108
+ }
109
+
110
+ if ( ! is_bool( $this->is_disconnected ) ) {
111
+ $this->is_disconnected = false;
112
+ }
113
+ }
114
+
115
+ static function get_type() {
116
+ return 'install';
117
+ }
118
+
119
+ function is_localhost() {
120
+ // The server has no way to verify if localhost unless localhost appears in domain.
121
+ return WP_FS__IS_LOCALHOST_FOR_SERVER;
122
+ // return (substr($_SERVER['REMOTE_ADDR'], 0, 4) == '127.' || $_SERVER['REMOTE_ADDR'] == '::1');
123
+ }
124
+
125
+ /**
126
+ * Check if site in trial.
127
+ *
128
+ * @author Vova Feldman (@svovaf)
129
+ * @since 1.0.9
130
+ *
131
+ * @return bool
132
+ */
133
+ function is_trial() {
134
+ return is_numeric( $this->trial_plan_id ) && ( strtotime( $this->trial_ends ) > WP_FS__SCRIPT_START_TIME );
135
+ }
136
+
137
+ /**
138
+ * Check if user already utilized the trial with the current install.
139
+ *
140
+ * @author Vova Feldman (@svovaf)
141
+ * @since 1.0.9
142
+ *
143
+ * @return bool
144
+ */
145
+ function is_trial_utilized() {
146
+ return is_numeric( $this->trial_plan_id );
147
+ }
148
  }
freemius/includes/entities/class-fs-subscription.php CHANGED
@@ -1,125 +1,125 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.9
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- class FS_Subscription extends FS_Entity {
14
-
15
- #region Properties
16
-
17
- /**
18
- * @var number
19
- */
20
- public $user_id;
21
- /**
22
- * @var number
23
- */
24
- public $install_id;
25
- /**
26
- * @var number
27
- */
28
- public $plan_id;
29
- /**
30
- * @var number
31
- */
32
- public $license_id;
33
- /**
34
- * @var float
35
- */
36
- public $total_gross;
37
- /**
38
- * @var float
39
- */
40
- public $amount_per_cycle;
41
- /**
42
- * @var int # of months
43
- */
44
- public $billing_cycle;
45
- /**
46
- * @var float
47
- */
48
- public $outstanding_balance;
49
- /**
50
- * @var int
51
- */
52
- public $failed_payments;
53
- /**
54
- * @var string
55
- */
56
- public $gateway;
57
- /**
58
- * @var string
59
- */
60
- public $external_id;
61
- /**
62
- * @var string|null
63
- */
64
- public $trial_ends;
65
- /**
66
- * @var string|null Datetime of the next payment, or null if cancelled
67
- */
68
- public $next_payment;
69
- /**
70
- * @var string|null
71
- */
72
- public $vat_id;
73
- /**
74
- * @var string Two characters country code
75
- */
76
- public $country_code;
77
-
78
- #endregion Properties
79
-
80
- /**
81
- * @param object|bool $subscription
82
- */
83
- function __construct( $subscription = false ) {
84
- parent::__construct( $subscription );
85
- }
86
-
87
- static function get_type() {
88
- return 'subscription';
89
- }
90
-
91
- /**
92
- * Check if subscription is active.
93
- *
94
- * @author Vova Feldman (@svovaf)
95
- * @since 1.0.9
96
- *
97
- * @return bool
98
- */
99
- function is_active() {
100
- return ! empty( $this->next_payment ) &&
101
- ( strtotime( $this->next_payment ) > WP_FS__SCRIPT_START_TIME );
102
- }
103
-
104
- /**
105
- * Subscription considered to be new without any payments
106
- * if the next payment should be made within less than 24 hours
107
- * from the subscription creation.
108
- *
109
- * @author Vova Feldman (@svovaf)
110
- * @since 1.0.9
111
- *
112
- * @return bool
113
- */
114
- function is_first_payment_pending() {
115
- return ( WP_FS__TIME_24_HOURS_IN_SEC >= strtotime( $this->next_payment ) - strtotime( $this->created ) );
116
- }
117
-
118
- /**
119
- * @author Vova Feldman (@svovaf)
120
- * @since 1.1.7
121
- */
122
- function has_trial() {
123
- return ! is_null( $this->trial_ends );
124
- }
125
  }
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.9
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Subscription extends FS_Entity {
14
+
15
+ #region Properties
16
+
17
+ /**
18
+ * @var number
19
+ */
20
+ public $user_id;
21
+ /**
22
+ * @var number
23
+ */
24
+ public $install_id;
25
+ /**
26
+ * @var number
27
+ */
28
+ public $plan_id;
29
+ /**
30
+ * @var number
31
+ */
32
+ public $license_id;
33
+ /**
34
+ * @var float
35
+ */
36
+ public $total_gross;
37
+ /**
38
+ * @var float
39
+ */
40
+ public $amount_per_cycle;
41
+ /**
42
+ * @var int # of months
43
+ */
44
+ public $billing_cycle;
45
+ /**
46
+ * @var float
47
+ */
48
+ public $outstanding_balance;
49
+ /**
50
+ * @var int
51
+ */
52
+ public $failed_payments;
53
+ /**
54
+ * @var string
55
+ */
56
+ public $gateway;
57
+ /**
58
+ * @var string
59
+ */
60
+ public $external_id;
61
+ /**
62
+ * @var string|null
63
+ */
64
+ public $trial_ends;
65
+ /**
66
+ * @var string|null Datetime of the next payment, or null if cancelled
67
+ */
68
+ public $next_payment;
69
+ /**
70
+ * @var string|null
71
+ */
72
+ public $vat_id;
73
+ /**
74
+ * @var string Two characters country code
75
+ */
76
+ public $country_code;
77
+
78
+ #endregion Properties
79
+
80
+ /**
81
+ * @param object|bool $subscription
82
+ */
83
+ function __construct( $subscription = false ) {
84
+ parent::__construct( $subscription );
85
+ }
86
+
87
+ static function get_type() {
88
+ return 'subscription';
89
+ }
90
+
91
+ /**
92
+ * Check if subscription is active.
93
+ *
94
+ * @author Vova Feldman (@svovaf)
95
+ * @since 1.0.9
96
+ *
97
+ * @return bool
98
+ */
99
+ function is_active() {
100
+ return ! empty( $this->next_payment ) &&
101
+ ( strtotime( $this->next_payment ) > WP_FS__SCRIPT_START_TIME );
102
+ }
103
+
104
+ /**
105
+ * Subscription considered to be new without any payments
106
+ * if the next payment should be made within less than 24 hours
107
+ * from the subscription creation.
108
+ *
109
+ * @author Vova Feldman (@svovaf)
110
+ * @since 1.0.9
111
+ *
112
+ * @return bool
113
+ */
114
+ function is_first_payment_pending() {
115
+ return ( WP_FS__TIME_24_HOURS_IN_SEC >= strtotime( $this->next_payment ) - strtotime( $this->created ) );
116
+ }
117
+
118
+ /**
119
+ * @author Vova Feldman (@svovaf)
120
+ * @since 1.1.7
121
+ */
122
+ function has_trial() {
123
+ return ! is_null( $this->trial_ends );
124
+ }
125
  }
freemius/includes/entities/class-fs-user.php CHANGED
@@ -1,62 +1,62 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.3
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- class FS_User extends FS_Scope_Entity {
14
-
15
- #region Properties
16
-
17
- /**
18
- * @var string
19
- */
20
- public $email;
21
- /**
22
- * @var string
23
- */
24
- public $first;
25
- /**
26
- * @var string
27
- */
28
- public $last;
29
- /**
30
- * @var bool
31
- */
32
- public $is_verified;
33
- /**
34
- * @var string|null
35
- */
36
- public $customer_id;
37
- /**
38
- * @var float
39
- */
40
- public $gross;
41
-
42
- #endregion Properties
43
-
44
- /**
45
- * @param object|bool $user
46
- */
47
- function __construct( $user = false ) {
48
- parent::__construct( $user );
49
- }
50
-
51
- function get_name() {
52
- return trim( ucfirst( trim( is_string( $this->first ) ? $this->first : '' ) ) . ' ' . ucfirst( trim( is_string( $this->last ) ? $this->last : '' ) ) );
53
- }
54
-
55
- function is_verified() {
56
- return ( isset( $this->is_verified ) && true === $this->is_verified );
57
- }
58
-
59
- static function get_type() {
60
- return 'user';
61
- }
62
  }
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_User extends FS_Scope_Entity {
14
+
15
+ #region Properties
16
+
17
+ /**
18
+ * @var string
19
+ */
20
+ public $email;
21
+ /**
22
+ * @var string
23
+ */
24
+ public $first;
25
+ /**
26
+ * @var string
27
+ */
28
+ public $last;
29
+ /**
30
+ * @var bool
31
+ */
32
+ public $is_verified;
33
+ /**
34
+ * @var string|null
35
+ */
36
+ public $customer_id;
37
+ /**
38
+ * @var float
39
+ */
40
+ public $gross;
41
+
42
+ #endregion Properties
43
+
44
+ /**
45
+ * @param object|bool $user
46
+ */
47
+ function __construct( $user = false ) {
48
+ parent::__construct( $user );
49
+ }
50
+
51
+ function get_name() {
52
+ return trim( ucfirst( trim( is_string( $this->first ) ? $this->first : '' ) ) . ' ' . ucfirst( trim( is_string( $this->last ) ? $this->last : '' ) ) );
53
+ }
54
+
55
+ function is_verified() {
56
+ return ( isset( $this->is_verified ) && true === $this->is_verified );
57
+ }
58
+
59
+ static function get_type() {
60
+ return 'user';
61
+ }
62
  }
freemius/includes/entities/index.php CHANGED
@@ -1,3 +1,3 @@
1
- <?php
2
- // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
1
+ <?php
2
+ // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
freemius/includes/index.php CHANGED
@@ -1,3 +1,3 @@
1
- <?php
2
- // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
1
+ <?php
2
+ // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
freemius/includes/l10n.php CHANGED
@@ -1,250 +1,250 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.2.1.6
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- /**
14
- * Retrieve the translation of $text.
15
- *
16
- * @since 1.2.1.6
17
- *
18
- * @param string $text
19
- *
20
- * @return string
21
- */
22
- function _fs_text( $text ) {
23
- return translate( $text, 'freemius' );
24
- }
25
-
26
- /**
27
- * Retrieve the translation of $text and escapes it for safe use in an attribute.
28
- *
29
- * @since 1.2.1.6
30
- *
31
- * @param string $text
32
- *
33
- * @return string
34
- */
35
- function _fs_esc_attr( $text ) {
36
- return esc_attr( translate( $text, 'freemius' ) );
37
- }
38
-
39
- /**
40
- * Retrieve the translation of $text and escapes it for safe use in HTML output.
41
- *
42
- * @since 1.2.1.6
43
- *
44
- * @param string $text
45
- *
46
- * @return string
47
- */
48
- function _fs_esc_html( $text ) {
49
- return esc_html( translate( $text, 'freemius' ) );
50
- }
51
-
52
- /**
53
- * Display translated text.
54
- *
55
- * @since 1.2.0
56
- *
57
- * @param string $text
58
- */
59
- function _fs_echo( $text ) {
60
- echo translate( $text, 'freemius' );
61
- }
62
-
63
- /**
64
- * Display translated text that has been escaped for safe use in an attribute.
65
- *
66
- * @since 1.2.1.6
67
- *
68
- * @param string $text
69
- */
70
- function _fs_esc_attr_echo( $text ) {
71
- echo esc_attr( translate( $text, 'freemius' ) );
72
- }
73
-
74
- /**
75
- * Display translated text that has been escaped for safe use in HTML output.
76
- *
77
- * @since 1.2.1.6
78
- *
79
- * @param string $text
80
- */
81
- function _fs_esc_html_echo( $text ) {
82
- echo esc_html( translate( $text, 'freemius' ) );
83
- }
84
-
85
- /**
86
- * Retrieve translated string with gettext context.
87
- *
88
- * Quite a few times, there will be collisions with similar translatable text
89
- * found in more than two places, but with different translated context.
90
- *
91
- * By including the context in the pot file, translators can translate the two
92
- * strings differently.
93
- *
94
- * @since 1.2.1.6
95
- *
96
- * @param string $text
97
- * @param string $context
98
- *
99
- * @return string
100
- */
101
- function _fs_x( $text, $context ) {
102
- return translate_with_gettext_context( $text, $context, 'freemius' );
103
- }
104
-
105
- /**
106
- * Display translated string with gettext context.
107
- *
108
- * @since 1.2.1.6
109
- *
110
- * @param string $text
111
- * @param string $context
112
- */
113
- function _fs_ex( $text, $context ) {
114
- // Avoid misleading Theme Check warning.
115
- $fn = '_x';
116
- echo $fn( $text, $context, 'freemius' );
117
- }
118
-
119
- /**
120
- * Translate string with gettext context, and escapes it for safe use in an attribute.
121
- *
122
- * @since 1.2.1.6
123
- *
124
- * @param string $text
125
- * @param string $context
126
- *
127
- * @return string
128
- */
129
- function _fs_esc_attr_x( $text, $context ) {
130
- return esc_attr( translate_with_gettext_context( $text, $context, 'freemius' ) );
131
- }
132
-
133
- /**
134
- * Translate string with gettext context, and escapes it for safe use in HTML output.
135
- *
136
- * @since 2.9.0
137
- *
138
- * @param string $text
139
- * @param string $context
140
- *
141
- * @return string
142
- */
143
- function _fs_esc_html_x( $text, $context ) {
144
- return esc_html( translate_with_gettext_context( $text, $context, 'freemius' ) );
145
- }
146
-
147
- /**
148
- * Translates and retrieves the singular or plural form based on the supplied number.
149
- *
150
- * @since 1.2.1.6
151
- *
152
- * @param string $single
153
- * @param string $plural
154
- * @param int $number
155
- *
156
- * @return string
157
- */
158
- function _fs_n( $single, $plural, $number ) {
159
- $translations = get_translations_for_domain( 'freemius' );
160
- $translation = $translations->translate_plural( $single, $plural, $number );
161
-
162
- /**
163
- * Filters the singular or plural form of a string.
164
- *
165
- * @since WP 2.2.0
166
- *
167
- * @param string $translation
168
- * @param string $single
169
- * @param string $plural
170
- * @param string $number
171
- * @param string $domain
172
- */
173
- return apply_filters( 'ngettext', $translation, $single, $plural, $number, 'freemius' );
174
- }
175
-
176
- /**
177
- * Translates and retrieves the singular or plural form based on the supplied number, with gettext context.
178
- *
179
- * @since 1.2.1.6
180
- *
181
- * @param string $single
182
- * @param string $plural
183
- * @param int $number
184
- * @param string $context
185
- *
186
- * @return string
187
- */
188
- function _fs_nx($single, $plural, $number, $context ) {
189
- $translations = get_translations_for_domain( 'freemius' );
190
- $translation = $translations->translate_plural( $single, $plural, $number, $context );
191
-
192
- /**
193
- * Filters the singular or plural form of a string with gettext context.
194
- *
195
- * @since WP 3.0
196
- *
197
- * @param string $translation
198
- * @param string $single
199
- * @param string $plural
200
- * @param string $number
201
- * @param string $context
202
- * @param string $domain
203
- */
204
- return apply_filters( 'ngettext_with_context', $translation, $single, $plural, $number, $context, 'freemius' );
205
- }
206
-
207
- /**
208
- * Registers plural strings in POT file, but does not translate them.
209
- *
210
- * Used when you want to keep structures with translatable plural
211
- * strings and use them later when the number is known.
212
- *
213
- * @since 1.2.1.6
214
- *
215
- * @param string $singular
216
- * @param string $plural
217
- *
218
- * @return array
219
- */
220
- function _fs_n_noop( $singular, $plural ) {
221
- return array(
222
- 'singular' => $singular,
223
- 'plural' => $plural,
224
- 'context' => null,
225
- 'domain' => 'freemius'
226
- );
227
- }
228
-
229
- /**
230
- * Registers plural strings with gettext context in POT file, but does not translate them.
231
- *
232
- * Used when you want to keep structures with translatable plural
233
- * strings and use them later when the number is known.
234
- *
235
- * @since 1.2.1.6
236
- *
237
- * @param string $singular
238
- * @param string $plural
239
- * @param string $context
240
- *
241
- * @return array
242
- */
243
- function _fs_nx_noop( $singular, $plural, $context ) {
244
- return array(
245
- 'singular' => $singular,
246
- 'plural' => $plural,
247
- 'context' => $context,
248
- 'domain' => 'freemius'
249
- );
250
- }
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.2.1.6
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * Retrieve the translation of $text.
15
+ *
16
+ * @since 1.2.1.6
17
+ *
18
+ * @param string $text
19
+ *
20
+ * @return string
21
+ */
22
+ function _fs_text( $text ) {
23
+ return translate( $text, 'freemius' );
24
+ }
25
+
26
+ /**
27
+ * Retrieve the translation of $text and escapes it for safe use in an attribute.
28
+ *
29
+ * @since 1.2.1.6
30
+ *
31
+ * @param string $text
32
+ *
33
+ * @return string
34
+ */
35
+ function _fs_esc_attr( $text ) {
36
+ return esc_attr( translate( $text, 'freemius' ) );
37
+ }
38
+
39
+ /**
40
+ * Retrieve the translation of $text and escapes it for safe use in HTML output.
41
+ *
42
+ * @since 1.2.1.6
43
+ *
44
+ * @param string $text
45
+ *
46
+ * @return string
47
+ */
48
+ function _fs_esc_html( $text ) {
49
+ return esc_html( translate( $text, 'freemius' ) );
50
+ }
51
+
52
+ /**
53
+ * Display translated text.
54
+ *
55
+ * @since 1.2.0
56
+ *
57
+ * @param string $text
58
+ */
59
+ function _fs_echo( $text ) {
60
+ echo translate( $text, 'freemius' );
61
+ }
62
+
63
+ /**
64
+ * Display translated text that has been escaped for safe use in an attribute.
65
+ *
66
+ * @since 1.2.1.6
67
+ *
68
+ * @param string $text
69
+ */
70
+ function _fs_esc_attr_echo( $text ) {
71
+ echo esc_attr( translate( $text, 'freemius' ) );
72
+ }
73
+
74
+ /**
75
+ * Display translated text that has been escaped for safe use in HTML output.
76
+ *
77
+ * @since 1.2.1.6
78
+ *
79
+ * @param string $text
80
+ */
81
+ function _fs_esc_html_echo( $text ) {
82
+ echo esc_html( translate( $text, 'freemius' ) );
83
+ }
84
+
85
+ /**
86
+ * Retrieve translated string with gettext context.
87
+ *
88
+ * Quite a few times, there will be collisions with similar translatable text
89
+ * found in more than two places, but with different translated context.
90
+ *
91
+ * By including the context in the pot file, translators can translate the two
92
+ * strings differently.
93
+ *
94
+ * @since 1.2.1.6
95
+ *
96
+ * @param string $text
97
+ * @param string $context
98
+ *
99
+ * @return string
100
+ */
101
+ function _fs_x( $text, $context ) {
102
+ return translate_with_gettext_context( $text, $context, 'freemius' );
103
+ }
104
+
105
+ /**
106
+ * Display translated string with gettext context.
107
+ *
108
+ * @since 1.2.1.6
109
+ *
110
+ * @param string $text
111
+ * @param string $context
112
+ */
113
+ function _fs_ex( $text, $context ) {
114
+ // Avoid misleading Theme Check warning.
115
+ $fn = '_x';
116
+ echo $fn( $text, $context, 'freemius' );
117
+ }
118
+
119
+ /**
120
+ * Translate string with gettext context, and escapes it for safe use in an attribute.
121
+ *
122
+ * @since 1.2.1.6
123
+ *
124
+ * @param string $text
125
+ * @param string $context
126
+ *
127
+ * @return string
128
+ */
129
+ function _fs_esc_attr_x( $text, $context ) {
130
+ return esc_attr( translate_with_gettext_context( $text, $context, 'freemius' ) );
131
+ }
132
+
133
+ /**
134
+ * Translate string with gettext context, and escapes it for safe use in HTML output.
135
+ *
136
+ * @since 2.9.0
137
+ *
138
+ * @param string $text
139
+ * @param string $context
140
+ *
141
+ * @return string
142
+ */
143
+ function _fs_esc_html_x( $text, $context ) {
144
+ return esc_html( translate_with_gettext_context( $text, $context, 'freemius' ) );
145
+ }
146
+
147
+ /**
148
+ * Translates and retrieves the singular or plural form based on the supplied number.
149
+ *
150
+ * @since 1.2.1.6
151
+ *
152
+ * @param string $single
153
+ * @param string $plural
154
+ * @param int $number
155
+ *
156
+ * @return string
157
+ */
158
+ function _fs_n( $single, $plural, $number ) {
159
+ $translations = get_translations_for_domain( 'freemius' );
160
+ $translation = $translations->translate_plural( $single, $plural, $number );
161
+
162
+ /**
163
+ * Filters the singular or plural form of a string.
164
+ *
165
+ * @since WP 2.2.0
166
+ *
167
+ * @param string $translation
168
+ * @param string $single
169
+ * @param string $plural
170
+ * @param string $number
171
+ * @param string $domain
172
+ */
173
+ return apply_filters( 'ngettext', $translation, $single, $plural, $number, 'freemius' );
174
+ }
175
+
176
+ /**
177
+ * Translates and retrieves the singular or plural form based on the supplied number, with gettext context.
178
+ *
179
+ * @since 1.2.1.6
180
+ *
181
+ * @param string $single
182
+ * @param string $plural
183
+ * @param int $number
184
+ * @param string $context
185
+ *
186
+ * @return string
187
+ */
188
+ function _fs_nx($single, $plural, $number, $context ) {
189
+ $translations = get_translations_for_domain( 'freemius' );
190
+ $translation = $translations->translate_plural( $single, $plural, $number, $context );
191
+
192
+ /**
193
+ * Filters the singular or plural form of a string with gettext context.
194
+ *
195
+ * @since WP 3.0
196
+ *
197
+ * @param string $translation
198
+ * @param string $single
199
+ * @param string $plural
200
+ * @param string $number
201
+ * @param string $context
202
+ * @param string $domain
203
+ */
204
+ return apply_filters( 'ngettext_with_context', $translation, $single, $plural, $number, $context, 'freemius' );
205
+ }
206
+
207
+ /**
208
+ * Registers plural strings in POT file, but does not translate them.
209
+ *
210
+ * Used when you want to keep structures with translatable plural
211
+ * strings and use them later when the number is known.
212
+ *
213
+ * @since 1.2.1.6
214
+ *
215
+ * @param string $singular
216
+ * @param string $plural
217
+ *
218
+ * @return array
219
+ */
220
+ function _fs_n_noop( $singular, $plural ) {
221
+ return array(
222
+ 'singular' => $singular,
223
+ 'plural' => $plural,
224
+ 'context' => null,
225
+ 'domain' => 'freemius'
226
+ );
227
+ }
228
+
229
+ /**
230
+ * Registers plural strings with gettext context in POT file, but does not translate them.
231
+ *
232
+ * Used when you want to keep structures with translatable plural
233
+ * strings and use them later when the number is known.
234
+ *
235
+ * @since 1.2.1.6
236
+ *
237
+ * @param string $singular
238
+ * @param string $plural
239
+ * @param string $context
240
+ *
241
+ * @return array
242
+ */
243
+ function _fs_nx_noop( $singular, $plural, $context ) {
244
+ return array(
245
+ 'singular' => $singular,
246
+ 'plural' => $plural,
247
+ 'context' => $context,
248
+ 'domain' => 'freemius'
249
+ );
250
+ }
freemius/includes/managers/class-fs-cache-manager.php CHANGED
@@ -1,237 +1,237 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.1.6
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- class FS_Cache_Manager {
14
- /**
15
- * @var FS_Option_Manager
16
- */
17
- private $_options;
18
- /**
19
- * @var FS_Logger
20
- */
21
- private $_logger;
22
-
23
- /**
24
- * @var FS_Cache_Manager[]
25
- */
26
- private static $_MANAGERS = array();
27
-
28
- /**
29
- * @author Vova Feldman (@svovaf)
30
- * @since 1.1.3
31
- *
32
- * @param string $id
33
- */
34
- private function __construct( $id ) {
35
- $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_cach_mngr_' . $id, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
36
-
37
- $this->_logger->entrance();
38
- $this->_logger->log( 'id = ' . $id );
39
-
40
- $this->_options = FS_Option_Manager::get_manager( $id, true );
41
- }
42
-
43
- /**
44
- * @author Vova Feldman (@svovaf)
45
- * @since 1.1.6
46
- *
47
- * @param $id
48
- *
49
- * @return FS_Cache_Manager
50
- */
51
- static function get_manager( $id ) {
52
- $id = strtolower( $id );
53
-
54
- if ( ! isset( self::$_MANAGERS[ $id ] ) ) {
55
- self::$_MANAGERS[ $id ] = new FS_Cache_Manager( $id );
56
- }
57
-
58
- return self::$_MANAGERS[ $id ];
59
- }
60
-
61
- /**
62
- * @author Vova Feldman (@svovaf)
63
- * @since 1.1.6
64
- *
65
- * @return bool
66
- */
67
- function is_empty() {
68
- $this->_logger->entrance();
69
-
70
- return $this->_options->is_empty();
71
- }
72
-
73
- /**
74
- * @author Vova Feldman (@svovaf)
75
- * @since 1.1.6
76
- */
77
- function clear() {
78
- $this->_logger->entrance();
79
-
80
- $this->_options->clear( true );
81
- }
82
-
83
- /**
84
- * Delete cache manager from DB.
85
- *
86
- * @author Vova Feldman (@svovaf)
87
- * @since 1.0.9
88
- */
89
- function delete() {
90
- $this->_options->delete();
91
- }
92
-
93
- /**
94
- * Check if there's a cached item.
95
- *
96
- * @author Vova Feldman (@svovaf)
97
- * @since 1.1.6
98
- *
99
- * @param string $key
100
- *
101
- * @return bool
102
- */
103
- function has( $key ) {
104
- $cache_entry = $this->_options->get_option( $key, false );
105
-
106
- return ( is_object( $cache_entry ) &&
107
- isset( $cache_entry->timestamp ) &&
108
- is_numeric( $cache_entry->timestamp )
109
- );
110
- }
111
-
112
- /**
113
- * Check if there's a valid cached item.
114
- *
115
- * @author Vova Feldman (@svovaf)
116
- * @since 1.1.6
117
- *
118
- * @param string $key
119
- *
120
- * @return bool
121
- */
122
- function has_valid( $key ) {
123
- $cache_entry = $this->_options->get_option( $key, false );
124
-
125
- return ( is_object( $cache_entry ) &&
126
- isset( $cache_entry->timestamp ) &&
127
- is_numeric( $cache_entry->timestamp ) &&
128
- $cache_entry->timestamp > WP_FS__SCRIPT_START_TIME
129
- );
130
- }
131
-
132
- /**
133
- * @author Vova Feldman (@svovaf)
134
- * @since 1.1.6
135
- *
136
- * @param string $key
137
- * @param mixed $default
138
- *
139
- * @return mixed
140
- */
141
- function get( $key, $default = null ) {
142
- $this->_logger->entrance( 'key = ' . $key );
143
-
144
- $cache_entry = $this->_options->get_option( $key, false );
145
-
146
- if ( is_object( $cache_entry ) &&
147
- isset( $cache_entry->timestamp ) &&
148
- is_numeric( $cache_entry->timestamp )
149
- ) {
150
- return $cache_entry->result;
151
- }
152
-
153
- return $default;
154
- }
155
-
156
- /**
157
- * @author Vova Feldman (@svovaf)
158
- * @since 1.1.6
159
- *
160
- * @param string $key
161
- * @param mixed $default
162
- *
163
- * @return mixed
164
- */
165
- function get_valid( $key, $default = null ) {
166
- $this->_logger->entrance( 'key = ' . $key );
167
-
168
- $cache_entry = $this->_options->get_option( $key, false );
169
-
170
- if ( is_object( $cache_entry ) &&
171
- isset( $cache_entry->timestamp ) &&
172
- is_numeric( $cache_entry->timestamp ) &&
173
- $cache_entry->timestamp > WP_FS__SCRIPT_START_TIME
174
- ) {
175
- return $cache_entry->result;
176
- }
177
-
178
- return $default;
179
- }
180
-
181
- /**
182
- * @author Vova Feldman (@svovaf)
183
- * @since 1.1.6
184
- *
185
- * @param string $key
186
- * @param mixed $value
187
- * @param int $expiration
188
- */
189
- function set( $key, $value, $expiration = WP_FS__TIME_24_HOURS_IN_SEC ) {
190
- $this->_logger->entrance( 'key = ' . $key );
191
-
192
- $cache_entry = new stdClass();
193
- $cache_entry->result = $value;
194
- $cache_entry->timestamp = WP_FS__SCRIPT_START_TIME + $expiration;
195
- $this->_options->set_option( $key, $cache_entry, true );
196
- }
197
-
198
- /**
199
- * Get cached record expiration, or false if not cached or expired.
200
- *
201
- * @author Vova Feldman (@svovaf)
202
- * @since 1.1.7.3
203
- *
204
- * @param string $key
205
- *
206
- * @return bool|int
207
- */
208
- function get_record_expiration( $key ) {
209
- $this->_logger->entrance( 'key = ' . $key );
210
-
211
- $cache_entry = $this->_options->get_option( $key, false );
212
-
213
- if ( is_object( $cache_entry ) &&
214
- isset( $cache_entry->timestamp ) &&
215
- is_numeric( $cache_entry->timestamp ) &&
216
- $cache_entry->timestamp > WP_FS__SCRIPT_START_TIME
217
- ) {
218
- return $cache_entry->timestamp;
219
- }
220
-
221
- return false;
222
- }
223
-
224
- /**
225
- * Purge cached item.
226
- *
227
- * @author Vova Feldman (@svovaf)
228
- * @since 1.1.6
229
- *
230
- * @param string $key
231
- */
232
- function purge( $key ) {
233
- $this->_logger->entrance( 'key = ' . $key );
234
-
235
- $this->_options->unset_option( $key, true );
236
- }
237
  }
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.1.6
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Cache_Manager {
14
+ /**
15
+ * @var FS_Option_Manager
16
+ */
17
+ private $_options;
18
+ /**
19
+ * @var FS_Logger
20
+ */
21
+ private $_logger;
22
+
23
+ /**
24
+ * @var FS_Cache_Manager[]
25
+ */
26
+ private static $_MANAGERS = array();
27
+
28
+ /**
29
+ * @author Vova Feldman (@svovaf)
30
+ * @since 1.1.3
31
+ *
32
+ * @param string $id
33
+ */
34
+ private function __construct( $id ) {
35
+ $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_cach_mngr_' . $id, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
36
+
37
+ $this->_logger->entrance();
38
+ $this->_logger->log( 'id = ' . $id );
39
+
40
+ $this->_options = FS_Option_Manager::get_manager( $id, true );
41
+ }
42
+
43
+ /**
44
+ * @author Vova Feldman (@svovaf)
45
+ * @since 1.1.6
46
+ *
47
+ * @param $id
48
+ *
49
+ * @return FS_Cache_Manager
50
+ */
51
+ static function get_manager( $id ) {
52
+ $id = strtolower( $id );
53
+
54
+ if ( ! isset( self::$_MANAGERS[ $id ] ) ) {
55
+ self::$_MANAGERS[ $id ] = new FS_Cache_Manager( $id );
56
+ }
57
+
58
+ return self::$_MANAGERS[ $id ];
59
+ }
60
+
61
+ /**
62
+ * @author Vova Feldman (@svovaf)
63
+ * @since 1.1.6
64
+ *
65
+ * @return bool
66
+ */
67
+ function is_empty() {
68
+ $this->_logger->entrance();
69
+
70
+ return $this->_options->is_empty();
71
+ }
72
+
73
+ /**
74
+ * @author Vova Feldman (@svovaf)
75
+ * @since 1.1.6
76
+ */
77
+ function clear() {
78
+ $this->_logger->entrance();
79
+
80
+ $this->_options->clear( true );
81
+ }
82
+
83
+ /**
84
+ * Delete cache manager from DB.
85
+ *
86
+ * @author Vova Feldman (@svovaf)
87
+ * @since 1.0.9
88
+ */
89
+ function delete() {
90
+ $this->_options->delete();
91
+ }
92
+
93
+ /**
94
+ * Check if there's a cached item.
95
+ *
96
+ * @author Vova Feldman (@svovaf)
97
+ * @since 1.1.6
98
+ *
99
+ * @param string $key
100
+ *
101
+ * @return bool
102
+ */
103
+ function has( $key ) {
104
+ $cache_entry = $this->_options->get_option( $key, false );
105
+
106
+ return ( is_object( $cache_entry ) &&
107
+ isset( $cache_entry->timestamp ) &&
108
+ is_numeric( $cache_entry->timestamp )
109
+ );
110
+ }
111
+
112
+ /**
113
+ * Check if there's a valid cached item.
114
+ *
115
+ * @author Vova Feldman (@svovaf)
116
+ * @since 1.1.6
117
+ *
118
+ * @param string $key
119
+ *
120
+ * @return bool
121
+ */
122
+ function has_valid( $key ) {
123
+ $cache_entry = $this->_options->get_option( $key, false );
124
+
125
+ return ( is_object( $cache_entry ) &&
126
+ isset( $cache_entry->timestamp ) &&
127
+ is_numeric( $cache_entry->timestamp ) &&
128
+ $cache_entry->timestamp > WP_FS__SCRIPT_START_TIME
129
+ );
130
+ }
131
+
132
+ /**
133
+ * @author Vova Feldman (@svovaf)
134
+ * @since 1.1.6
135
+ *
136
+ * @param string $key
137
+ * @param mixed $default
138
+ *
139
+ * @return mixed
140
+ */
141
+ function get( $key, $default = null ) {
142
+ $this->_logger->entrance( 'key = ' . $key );
143
+
144
+ $cache_entry = $this->_options->get_option( $key, false );
145
+
146
+ if ( is_object( $cache_entry ) &&
147
+ isset( $cache_entry->timestamp ) &&
148
+ is_numeric( $cache_entry->timestamp )
149
+ ) {
150
+ return $cache_entry->result;
151
+ }
152
+
153
+ return $default;
154
+ }
155
+
156
+ /**
157
+ * @author Vova Feldman (@svovaf)
158
+ * @since 1.1.6
159
+ *
160
+ * @param string $key
161
+ * @param mixed $default
162
+ *
163
+ * @return mixed
164
+ */
165
+ function get_valid( $key, $default = null ) {
166
+ $this->_logger->entrance( 'key = ' . $key );
167
+
168
+ $cache_entry = $this->_options->get_option( $key, false );
169
+
170
+ if ( is_object( $cache_entry ) &&
171
+ isset( $cache_entry->timestamp ) &&
172
+ is_numeric( $cache_entry->timestamp ) &&
173
+ $cache_entry->timestamp > WP_FS__SCRIPT_START_TIME
174
+ ) {
175
+ return $cache_entry->result;
176
+ }
177
+
178
+ return $default;
179
+ }
180
+
181
+ /**
182
+ * @author Vova Feldman (@svovaf)
183
+ * @since 1.1.6
184
+ *
185
+ * @param string $key
186
+ * @param mixed $value
187
+ * @param int $expiration
188
+ */
189
+ function set( $key, $value, $expiration = WP_FS__TIME_24_HOURS_IN_SEC ) {
190
+ $this->_logger->entrance( 'key = ' . $key );
191
+
192
+ $cache_entry = new stdClass();
193
+ $cache_entry->result = $value;
194
+ $cache_entry->timestamp = WP_FS__SCRIPT_START_TIME + $expiration;
195
+ $this->_options->set_option( $key, $cache_entry, true );
196
+ }
197
+
198
+ /**
199
+ * Get cached record expiration, or false if not cached or expired.
200
+ *
201
+ * @author Vova Feldman (@svovaf)
202
+ * @since 1.1.7.3
203
+ *
204
+ * @param string $key
205
+ *
206
+ * @return bool|int
207
+ */
208
+ function get_record_expiration( $key ) {
209
+ $this->_logger->entrance( 'key = ' . $key );
210
+
211
+ $cache_entry = $this->_options->get_option( $key, false );
212
+
213
+ if ( is_object( $cache_entry ) &&
214
+ isset( $cache_entry->timestamp ) &&
215
+ is_numeric( $cache_entry->timestamp ) &&
216
+ $cache_entry->timestamp > WP_FS__SCRIPT_START_TIME
217
+ ) {
218
+ return $cache_entry->timestamp;
219
+ }
220
+
221
+ return false;
222
+ }
223
+
224
+ /**
225
+ * Purge cached item.
226
+ *
227
+ * @author Vova Feldman (@svovaf)
228
+ * @since 1.1.6
229
+ *
230
+ * @param string $key
231
+ */
232
+ function purge( $key ) {
233
+ $this->_logger->entrance( 'key = ' . $key );
234
+
235
+ $this->_options->unset_option( $key, true );
236
+ }
237
  }
freemius/includes/managers/class-fs-key-value-storage.php CHANGED
@@ -1,326 +1,326 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.7
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- /**
14
- * Class FS_Key_Value_Storage
15
- *
16
- * @property int $install_timestamp
17
- * @property int $activation_timestamp
18
- * @property int $sync_timestamp
19
- * @property object $sync_cron
20
- * @property int $install_sync_timestamp
21
- * @property array $connectivity_test
22
- * @property array $is_on
23
- * @property object $trial_plan
24
- * @property bool $has_trial_plan
25
- * @property bool $trial_promotion_shown
26
- * @property string $sdk_version
27
- * @property string $sdk_last_version
28
- * @property bool $sdk_upgrade_mode
29
- * @property bool $sdk_downgrade_mode
30
- * @property bool $plugin_upgrade_mode
31
- * @property bool $plugin_downgrade_mode
32
- * @property string $plugin_version
33
- * @property string $plugin_last_version
34
- * @property bool $is_plugin_new_install
35
- * @property bool $was_plugin_loaded
36
- * @property object $plugin_main_file
37
- * @property bool $prev_is_premium
38
- * @property array $is_anonymous
39
- * @property bool $is_pending_activation
40
- * @property bool $sticky_optin_added
41
- * @property object $uninstall_reason
42
- * @property object $subscription
43
- */
44
- class FS_Key_Value_Storage implements ArrayAccess, Iterator, Countable {
45
- /**
46
- * @var string
47
- */
48
- protected $_id;
49
- /**
50
- * @var string
51
- */
52
- protected $_slug;
53
- /**
54
- * @var array
55
- */
56
- protected $_data;
57
-
58
- /**
59
- * @var FS_Plugin_Manager[]
60
- */
61
- private static $_instances = array();
62
- /**
63
- * @var FS_Logger
64
- */
65
- protected $_logger;
66
-
67
- /**
68
- * @param string $id
69
- * @param string $slug
70
- *
71
- * @return FS_Key_Value_Storage
72
- */
73
- static function instance( $id, $slug ) {
74
- $key = $id . ':' . $slug;
75
- if ( ! isset( self::$_instances[ $key ] ) ) {
76
- self::$_instances[ $key ] = new FS_Key_Value_Storage( $id, $slug );
77
- }
78
-
79
- return self::$_instances[ $key ];
80
- }
81
-
82
- protected function __construct( $id, $slug ) {
83
- $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $slug . '_' . $id, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
84
-
85
- $this->_slug = $slug;
86
- $this->_id = $id;
87
- $this->load();
88
- }
89
-
90
- protected function get_option_manager() {
91
- return FS_Option_Manager::get_manager( WP_FS__ACCOUNTS_OPTION_NAME, true );
92
- }
93
-
94
- protected function get_all_data() {
95
- return $this->get_option_manager()->get_option( $this->_id, array() );
96
- }
97
-
98
- /**
99
- * Load plugin data from local DB.
100
- *
101
- * @author Vova Feldman (@svovaf)
102
- * @since 1.0.7
103
- */
104
- function load() {
105
- $all_plugins_data = $this->get_all_data();
106
- $this->_data = isset( $all_plugins_data[ $this->_slug ] ) ?
107
- $all_plugins_data[ $this->_slug ] :
108
- array();
109
- }
110
-
111
- /**
112
- * @author Vova Feldman (@svovaf)
113
- * @since 1.0.7
114
- *
115
- * @param string $key
116
- * @param mixed $value
117
- * @param bool $flush
118
- */
119
- function store( $key, $value, $flush = true ) {
120
- if ( $this->_logger->is_on() ) {
121
- $this->_logger->entrance( $key . ' = ' . var_export( $value, true ) );
122
- }
123
-
124
- if ( array_key_exists( $key, $this->_data ) && $value === $this->_data[ $key ] ) {
125
- // No need to store data if the value wasn't changed.
126
- return;
127
- }
128
-
129
- $all_data = $this->get_all_data();
130
-
131
- $this->_data[ $key ] = $value;
132
-
133
- $all_data[ $this->_slug ] = $this->_data;
134
-
135
- $options_manager = $this->get_option_manager();
136
- $options_manager->set_option( $this->_id, $all_data, $flush );
137
- }
138
-
139
- /**
140
- * @author Vova Feldman (@svovaf)
141
- * @since 1.0.7
142
- *
143
- * @param bool $store
144
- * @param string[] $exceptions Set of keys to keep and not clear.
145
- */
146
- function clear_all( $store = true, $exceptions = array() ) {
147
- $new_data = array();
148
- foreach ( $exceptions as $key ) {
149
- if ( isset( $this->_data[ $key ] ) ) {
150
- $new_data[ $key ] = $this->_data[ $key ];
151
- }
152
- }
153
-
154
- $this->_data = $new_data;
155
-
156
- if ( $store ) {
157
- $all_data = $this->get_all_data();
158
- $all_data[ $this->_slug ] = $this->_data;
159
- $options_manager = $this->get_option_manager();
160
- $options_manager->set_option( $this->_id, $all_data, true );
161
- }
162
- }
163
-
164
- /**
165
- * Delete key-value storage.
166
- *
167
- * @author Vova Feldman (@svovaf)
168
- * @since 1.0.9
169
- */
170
- function delete() {
171
- $this->_data = array();
172
-
173
- $all_data = $this->get_all_data();
174
- unset( $all_data[ $this->_slug ] );
175
- $options_manager = $this->get_option_manager();
176
- $options_manager->set_option( $this->_id, $all_data, true );
177
- }
178
-
179
- /**
180
- * @author Vova Feldman (@svovaf)
181
- * @since 1.0.7
182
- *
183
- * @param string $key
184
- * @param bool $store
185
- */
186
- function remove( $key, $store = true ) {
187
- if ( ! array_key_exists( $key, $this->_data ) ) {
188
- return;
189
- }
190
-
191
- unset( $this->_data[ $key ] );
192
-
193
- if ( $store ) {
194
- $all_data = $this->get_all_data();
195
- $all_data[ $this->_slug ] = $this->_data;
196
- $options_manager = $this->get_option_manager();
197
- $options_manager->set_option( $this->_id, $all_data, true );
198
- }
199
- }
200
-
201
- /**
202
- * @author Vova Feldman (@svovaf)
203
- * @since 1.0.7
204
- *
205
- * @param string $key
206
- * @param mixed $default
207
- *
208
- * @return bool|\FS_Plugin
209
- */
210
- function get( $key, $default = false ) {
211
- return array_key_exists( $key, $this->_data ) ?
212
- $this->_data[ $key ] :
213
- $default;
214
- }
215
-
216
-
217
- /* ArrayAccess + Magic Access (better for refactoring)
218
- -----------------------------------------------------------------------------------*/
219
- function __set( $k, $v ) {
220
- $this->store( $k, $v );
221
- }
222
-
223
- function __isset( $k ) {
224
- return array_key_exists( $k, $this->_data );
225
- }
226
-
227
- function __unset( $k ) {
228
- $this->remove( $k );
229
- }
230
-
231
- function __get( $k ) {
232
- return $this->get( $k, null );
233
- }
234
-
235
- function offsetSet( $k, $v ) {
236
- if ( is_null( $k ) ) {
237
- throw new Exception( 'Can\'t append value to request params.' );
238
- } else {
239
- $this->{$k} = $v;
240
- }
241
- }
242
-
243
- function offsetExists( $k ) {
244
- return array_key_exists( $k, $this->_data );
245
- }
246
-
247
- function offsetUnset( $k ) {
248
- unset( $this->$k );
249
- }
250
-
251
- function offsetGet( $k ) {
252
- return $this->get( $k, null );
253
- }
254
-
255
- /**
256
- * (PHP 5 &gt;= 5.0.0)<br/>
257
- * Return the current element
258
- *
259
- * @link http://php.net/manual/en/iterator.current.php
260
- * @return mixed Can return any type.
261
- */
262
- public function current() {
263
- return current( $this->_data );
264
- }
265
-
266
- /**
267
- * (PHP 5 &gt;= 5.0.0)<br/>
268
- * Move forward to next element
269
- *
270
- * @link http://php.net/manual/en/iterator.next.php
271
- * @return void Any returned value is ignored.
272
- */
273
- public function next() {
274
- next( $this->_data );
275
- }
276
-
277
- /**
278
- * (PHP 5 &gt;= 5.0.0)<br/>
279
- * Return the key of the current element
280
- *
281
- * @link http://php.net/manual/en/iterator.key.php
282
- * @return mixed scalar on success, or null on failure.
283
- */
284
- public function key() {
285
- return key( $this->_data );
286
- }
287
-
288
- /**
289
- * (PHP 5 &gt;= 5.0.0)<br/>
290
- * Checks if current position is valid
291
- *
292
- * @link http://php.net/manual/en/iterator.valid.php
293
- * @return boolean The return value will be casted to boolean and then evaluated.
294
- * Returns true on success or false on failure.
295
- */
296
- public function valid() {
297
- $key = key( $this->_data );
298
-
299
- return ( $key !== null && $key !== false );
300
- }
301
-
302
- /**
303
- * (PHP 5 &gt;= 5.0.0)<br/>
304
- * Rewind the Iterator to the first element
305
- *
306
- * @link http://php.net/manual/en/iterator.rewind.php
307
- * @return void Any returned value is ignored.
308
- */
309
- public function rewind() {
310
- reset( $this->_data );
311
- }
312
-
313
- /**
314
- * (PHP 5 &gt;= 5.1.0)<br/>
315
- * Count elements of an object
316
- *
317
- * @link http://php.net/manual/en/countable.count.php
318
- * @return int The custom count as an integer.
319
- * </p>
320
- * <p>
321
- * The return value is cast to an integer.
322
- */
323
- public function count() {
324
- return count( $this->_data );
325
- }
326
  }
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.7
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * Class FS_Key_Value_Storage
15
+ *
16
+ * @property int $install_timestamp
17
+ * @property int $activation_timestamp
18
+ * @property int $sync_timestamp
19
+ * @property object $sync_cron
20
+ * @property int $install_sync_timestamp
21
+ * @property array $connectivity_test
22
+ * @property array $is_on
23
+ * @property object $trial_plan
24
+ * @property bool $has_trial_plan
25
+ * @property bool $trial_promotion_shown
26
+ * @property string $sdk_version
27
+ * @property string $sdk_last_version
28
+ * @property bool $sdk_upgrade_mode
29
+ * @property bool $sdk_downgrade_mode
30
+ * @property bool $plugin_upgrade_mode
31
+ * @property bool $plugin_downgrade_mode
32
+ * @property string $plugin_version
33
+ * @property string $plugin_last_version
34
+ * @property bool $is_plugin_new_install
35
+ * @property bool $was_plugin_loaded
36
+ * @property object $plugin_main_file
37
+ * @property bool $prev_is_premium
38
+ * @property array $is_anonymous
39
+ * @property bool $is_pending_activation
40
+ * @property bool $sticky_optin_added
41
+ * @property object $uninstall_reason
42
+ * @property object $subscription
43
+ */
44
+ class FS_Key_Value_Storage implements ArrayAccess, Iterator, Countable {
45
+ /**
46
+ * @var string
47
+ */
48
+ protected $_id;
49
+ /**
50
+ * @var string
51
+ */
52
+ protected $_slug;
53
+ /**
54
+ * @var array
55
+ */
56
+ protected $_data;
57
+
58
+ /**
59
+ * @var FS_Plugin_Manager[]
60
+ */
61
+ private static $_instances = array();
62
+ /**
63
+ * @var FS_Logger
64
+ */
65
+ protected $_logger;
66
+
67
+ /**
68
+ * @param string $id
69
+ * @param string $slug
70
+ *
71
+ * @return FS_Key_Value_Storage
72
+ */
73
+ static function instance( $id, $slug ) {
74
+ $key = $id . ':' . $slug;
75
+ if ( ! isset( self::$_instances[ $key ] ) ) {
76
+ self::$_instances[ $key ] = new FS_Key_Value_Storage( $id, $slug );
77
+ }
78
+
79
+ return self::$_instances[ $key ];
80
+ }
81
+
82
+ protected function __construct( $id, $slug ) {
83
+ $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $slug . '_' . $id, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
84
+
85
+ $this->_slug = $slug;
86
+ $this->_id = $id;
87
+ $this->load();
88
+ }
89
+
90
+ protected function get_option_manager() {
91
+ return FS_Option_Manager::get_manager( WP_FS__ACCOUNTS_OPTION_NAME, true );
92
+ }
93
+
94
+ protected function get_all_data() {
95
+ return $this->get_option_manager()->get_option( $this->_id, array() );
96
+ }
97
+
98
+ /**
99
+ * Load plugin data from local DB.
100
+ *
101
+ * @author Vova Feldman (@svovaf)
102
+ * @since 1.0.7
103
+ */
104
+ function load() {
105
+ $all_plugins_data = $this->get_all_data();
106
+ $this->_data = isset( $all_plugins_data[ $this->_slug ] ) ?
107
+ $all_plugins_data[ $this->_slug ] :
108
+ array();
109
+ }
110
+
111
+ /**
112
+ * @author Vova Feldman (@svovaf)
113
+ * @since 1.0.7
114
+ *
115
+ * @param string $key
116
+ * @param mixed $value
117
+ * @param bool $flush
118
+ */
119
+ function store( $key, $value, $flush = true ) {
120
+ if ( $this->_logger->is_on() ) {
121
+ $this->_logger->entrance( $key . ' = ' . var_export( $value, true ) );
122
+ }
123
+
124
+ if ( array_key_exists( $key, $this->_data ) && $value === $this->_data[ $key ] ) {
125
+ // No need to store data if the value wasn't changed.
126
+ return;
127
+ }
128
+
129
+ $all_data = $this->get_all_data();
130
+
131
+ $this->_data[ $key ] = $value;
132
+
133
+ $all_data[ $this->_slug ] = $this->_data;
134
+
135
+ $options_manager = $this->get_option_manager();
136
+ $options_manager->set_option( $this->_id, $all_data, $flush );
137
+ }
138
+
139
+ /**
140
+ * @author Vova Feldman (@svovaf)
141
+ * @since 1.0.7
142
+ *
143
+ * @param bool $store
144
+ * @param string[] $exceptions Set of keys to keep and not clear.
145
+ */
146
+ function clear_all( $store = true, $exceptions = array() ) {
147
+ $new_data = array();
148
+ foreach ( $exceptions as $key ) {
149
+ if ( isset( $this->_data[ $key ] ) ) {
150
+ $new_data[ $key ] = $this->_data[ $key ];
151
+ }
152
+ }
153
+
154
+ $this->_data = $new_data;
155
+
156
+ if ( $store ) {
157
+ $all_data = $this->get_all_data();
158
+ $all_data[ $this->_slug ] = $this->_data;
159
+ $options_manager = $this->get_option_manager();
160
+ $options_manager->set_option( $this->_id, $all_data, true );
161
+ }
162
+ }
163
+
164
+ /**
165
+ * Delete key-value storage.
166
+ *
167
+ * @author Vova Feldman (@svovaf)
168
+ * @since 1.0.9
169
+ */
170
+ function delete() {
171
+ $this->_data = array();
172
+
173
+ $all_data = $this->get_all_data();
174
+ unset( $all_data[ $this->_slug ] );
175
+ $options_manager = $this->get_option_manager();
176
+ $options_manager->set_option( $this->_id, $all_data, true );
177
+ }
178
+
179
+ /**
180
+ * @author Vova Feldman (@svovaf)
181
+ * @since 1.0.7
182
+ *
183
+ * @param string $key
184
+ * @param bool $store
185
+ */
186
+ function remove( $key, $store = true ) {
187
+ if ( ! array_key_exists( $key, $this->_data ) ) {
188
+ return;
189
+ }
190
+
191
+ unset( $this->_data[ $key ] );
192
+
193
+ if ( $store ) {
194
+ $all_data = $this->get_all_data();
195
+ $all_data[ $this->_slug ] = $this->_data;
196
+ $options_manager = $this->get_option_manager();
197
+ $options_manager->set_option( $this->_id, $all_data, true );
198
+ }
199
+ }
200
+
201
+ /**
202
+ * @author Vova Feldman (@svovaf)
203
+ * @since 1.0.7
204
+ *
205
+ * @param string $key
206
+ * @param mixed $default
207
+ *
208
+ * @return bool|\FS_Plugin
209
+ */
210
+ function get( $key, $default = false ) {
211
+ return array_key_exists( $key, $this->_data ) ?
212
+ $this->_data[ $key ] :
213
+ $default;
214
+ }
215
+
216
+
217
+ /* ArrayAccess + Magic Access (better for refactoring)
218
+ -----------------------------------------------------------------------------------*/
219
+ function __set( $k, $v ) {
220
+ $this->store( $k, $v );
221
+ }
222
+
223
+ function __isset( $k ) {
224
+ return array_key_exists( $k, $this->_data );
225
+ }
226
+
227
+ function __unset( $k ) {
228
+ $this->remove( $k );
229
+ }
230
+
231
+ function __get( $k ) {
232
+ return $this->get( $k, null );
233
+ }
234
+
235
+ function offsetSet( $k, $v ) {
236
+ if ( is_null( $k ) ) {
237
+ throw new Exception( 'Can\'t append value to request params.' );
238
+ } else {
239
+ $this->{$k} = $v;
240
+ }
241
+ }
242
+
243
+ function offsetExists( $k ) {
244
+ return array_key_exists( $k, $this->_data );
245
+ }
246
+
247
+ function offsetUnset( $k ) {
248
+ unset( $this->$k );
249
+ }
250
+
251
+ function offsetGet( $k ) {
252
+ return $this->get( $k, null );
253
+ }
254
+
255
+ /**
256
+ * (PHP 5 &gt;= 5.0.0)<br/>
257
+ * Return the current element
258
+ *
259
+ * @link http://php.net/manual/en/iterator.current.php
260
+ * @return mixed Can return any type.
261
+ */
262
+ public function current() {
263
+ return current( $this->_data );
264
+ }
265
+
266
+ /**
267
+ * (PHP 5 &gt;= 5.0.0)<br/>
268
+ * Move forward to next element
269
+ *
270
+ * @link http://php.net/manual/en/iterator.next.php
271
+ * @return void Any returned value is ignored.
272
+ */
273
+ public function next() {
274
+ next( $this->_data );
275
+ }
276
+
277
+ /**
278
+ * (PHP 5 &gt;= 5.0.0)<br/>
279
+ * Return the key of the current element
280
+ *
281
+ * @link http://php.net/manual/en/iterator.key.php
282
+ * @return mixed scalar on success, or null on failure.
283
+ */
284
+ public function key() {
285
+ return key( $this->_data );
286
+ }
287
+
288
+ /**
289
+ * (PHP 5 &gt;= 5.0.0)<br/>
290
+ * Checks if current position is valid
291
+ *
292
+ * @link http://php.net/manual/en/iterator.valid.php
293
+ * @return boolean The return value will be casted to boolean and then evaluated.
294
+ * Returns true on success or false on failure.
295
+ */
296
+ public function valid() {
297
+ $key = key( $this->_data );
298
+
299
+ return ( $key !== null && $key !== false );
300
+ }
301
+
302
+ /**
303
+ * (PHP 5 &gt;= 5.0.0)<br/>
304
+ * Rewind the Iterator to the first element
305
+ *
306
+ * @link http://php.net/manual/en/iterator.rewind.php
307
+ * @return void Any returned value is ignored.
308
+ */
309
+ public function rewind() {
310
+ reset( $this->_data );
311
+ }
312
+
313
+ /**
314
+ * (PHP 5 &gt;= 5.1.0)<br/>
315
+ * Count elements of an object
316
+ *
317
+ * @link http://php.net/manual/en/countable.count.php
318
+ * @return int The custom count as an integer.
319
+ * </p>
320
+ * <p>
321
+ * The return value is cast to an integer.
322
+ */
323
+ public function count() {
324
+ return count( $this->_data );
325
+ }
326
  }
freemius/includes/managers/class-fs-license-manager.php CHANGED
@@ -1,104 +1,104 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.6
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- class FS_License_Manager /*extends FS_Abstract_Manager*/
14
- {
15
- //
16
- //
17
- // /**
18
- // * @var FS_License_Manager[]
19
- // */
20
- // private static $_instances = array();
21
- //
22
- // static function instance( Freemius $fs ) {
23
- // $slug = strtolower( $fs->get_slug() );
24
- //
25
- // if ( ! isset( self::$_instances[ $slug ] ) ) {
26
- // self::$_instances[ $slug ] = new FS_License_Manager( $slug, $fs );
27
- // }
28
- //
29
- // return self::$_instances[ $slug ];
30
- // }
31
- //
32
- //// private function __construct($slug) {
33
- //// parent::__construct($slug);
34
- //// }
35
- //
36
- // function entry_id() {
37
- // return 'licenses';
38
- // }
39
- //
40
- // function sync( $id ) {
41
- //
42
- // }
43
- //
44
- // /**
45
- // * @author Vova Feldman (@svovaf)
46
- // * @since 1.0.5
47
- // * @uses FS_Api
48
- // *
49
- // * @param number|bool $plugin_id
50
- // *
51
- // * @return FS_Plugin_License[]|stdClass Licenses or API error.
52
- // */
53
- // function api_get_user_plugin_licenses( $plugin_id = false ) {
54
- // $api = $this->_fs->get_api_user_scope();
55
- //
56
- // if ( ! is_numeric( $plugin_id ) ) {
57
- // $plugin_id = $this->_fs->get_id();
58
- // }
59
- //
60
- // $result = $api->call( "/plugins/{$plugin_id}/licenses.json" );
61
- //
62
- // if ( ! isset( $result->error ) ) {
63
- // for ( $i = 0, $len = count( $result->licenses ); $i < $len; $i ++ ) {
64
- // $result->licenses[ $i ] = new FS_Plugin_License( $result->licenses[ $i ] );
65
- // }
66
- //
67
- // $result = $result->licenses;
68
- // }
69
- //
70
- // return $result;
71
- // }
72
- //
73
- // function api_get_many() {
74
- //
75
- // }
76
- //
77
- // function api_activate( $id ) {
78
- //
79
- // }
80
- //
81
- // function api_deactivate( $id ) {
82
- //
83
- // }
84
-
85
- /**
86
- * @param FS_Plugin_License[] $licenses
87
- *
88
- * @return bool
89
- */
90
- static function has_premium_license( $licenses ) {
91
- if ( is_array( $licenses ) ) {
92
- foreach ( $licenses as $license ) {
93
- /**
94
- * @var FS_Plugin_License $license
95
- */
96
- if ( ! $license->is_utilized() && $license->is_features_enabled() ) {
97
- return true;
98
- }
99
- }
100
- }
101
-
102
- return false;
103
- }
104
  }
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.6
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_License_Manager /*extends FS_Abstract_Manager*/
14
+ {
15
+ //
16
+ //
17
+ // /**
18
+ // * @var FS_License_Manager[]
19
+ // */
20
+ // private static $_instances = array();
21
+ //
22
+ // static function instance( Freemius $fs ) {
23
+ // $slug = strtolower( $fs->get_slug() );
24
+ //
25
+ // if ( ! isset( self::$_instances[ $slug ] ) ) {
26
+ // self::$_instances[ $slug ] = new FS_License_Manager( $slug, $fs );
27
+ // }
28
+ //
29
+ // return self::$_instances[ $slug ];
30
+ // }
31
+ //
32
+ //// private function __construct($slug) {
33
+ //// parent::__construct($slug);
34
+ //// }
35
+ //
36
+ // function entry_id() {
37
+ // return 'licenses';
38
+ // }
39
+ //
40
+ // function sync( $id ) {
41
+ //
42
+ // }
43
+ //
44
+ // /**
45
+ // * @author Vova Feldman (@svovaf)
46
+ // * @since 1.0.5
47
+ // * @uses FS_Api
48
+ // *
49
+ // * @param number|bool $plugin_id
50
+ // *
51
+ // * @return FS_Plugin_License[]|stdClass Licenses or API error.
52
+ // */
53
+ // function api_get_user_plugin_licenses( $plugin_id = false ) {
54
+ // $api = $this->_fs->get_api_user_scope();
55
+ //
56
+ // if ( ! is_numeric( $plugin_id ) ) {
57
+ // $plugin_id = $this->_fs->get_id();
58
+ // }
59
+ //
60
+ // $result = $api->call( "/plugins/{$plugin_id}/licenses.json" );
61
+ //
62
+ // if ( ! isset( $result->error ) ) {
63
+ // for ( $i = 0, $len = count( $result->licenses ); $i < $len; $i ++ ) {
64
+ // $result->licenses[ $i ] = new FS_Plugin_License( $result->licenses[ $i ] );
65
+ // }
66
+ //
67
+ // $result = $result->licenses;
68
+ // }
69
+ //
70
+ // return $result;
71
+ // }
72
+ //
73
+ // function api_get_many() {
74
+ //
75
+ // }
76
+ //
77
+ // function api_activate( $id ) {
78
+ //
79
+ // }
80
+ //
81
+ // function api_deactivate( $id ) {
82
+ //
83
+ // }
84
+
85
+ /**
86
+ * @param FS_Plugin_License[] $licenses
87
+ *
88
+ * @return bool
89
+ */
90
+ static function has_premium_license( $licenses ) {
91
+ if ( is_array( $licenses ) ) {
92
+ foreach ( $licenses as $license ) {
93
+ /**
94
+ * @var FS_Plugin_License $license
95
+ */
96
+ if ( ! $license->is_utilized() && $license->is_features_enabled() ) {
97
+ return true;
98
+ }
99
+ }
100
+ }
101
+
102
+ return false;
103
+ }
104
  }
freemius/includes/managers/class-fs-option-manager.php CHANGED
@@ -1,302 +1,302 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.3
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- /**
14
- * 3-layer lazy options manager.
15
- * layer 3: Memory
16
- * layer 2: Cache (if there's any caching plugin and if WP_FS__DEBUG_SDK is FALSE)
17
- * layer 1: Database (options table). All options stored as one option record in the DB to reduce number of DB
18
- * queries.
19
- *
20
- * If load() is not explicitly called, starts as empty manager. Same thing about saving the data - you have to
21
- * explicitly call store().
22
- *
23
- * Class Freemius_Option_Manager
24
- */
25
- class FS_Option_Manager {
26
- /**
27
- * @var string
28
- */
29
- private $_id;
30
- /**
31
- * @var array
32
- */
33
- private $_options;
34
- /**
35
- * @var FS_Logger
36
- */
37
- private $_logger;
38
-
39
- /**
40
- * @var FS_Option_Manager[]
41
- */
42
- private static $_MANAGERS = array();
43
-
44
- /**
45
- * @author Vova Feldman (@svovaf)
46
- * @since 1.0.3
47
- *
48
- * @param string $id
49
- * @param bool $load
50
- */
51
- private function __construct( $id, $load = false ) {
52
- $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_opt_mngr_' . $id, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
53
-
54
- $this->_logger->entrance();
55
- $this->_logger->log( 'id = ' . $id );
56
-
57
- $this->_id = $id;
58
-
59
- if ( $load ) {
60
- $this->load();
61
- }
62
- }
63
-
64
- /**
65
- * @author Vova Feldman (@svovaf)
66
- * @since 1.0.3
67
- *
68
- * @param $id
69
- * @param $load
70
- *
71
- * @return FS_Option_Manager
72
- */
73
- static function get_manager( $id, $load = false ) {
74
- $id = strtolower( $id );
75
-
76
- if ( ! isset( self::$_MANAGERS[ $id ] ) ) {
77
- self::$_MANAGERS[ $id ] = new FS_Option_Manager( $id, $load );
78
- } // If load required but not yet loaded, load.
79
- else if ( $load && ! self::$_MANAGERS[ $id ]->is_loaded() ) {
80
- self::$_MANAGERS[ $id ]->load();
81
- }
82
-
83
- return self::$_MANAGERS[ $id ];
84
- }
85
-
86
- private function _get_option_manager_name() {
87
- // return WP_FS__SLUG . '_' . $this->_id;
88
- return $this->_id;
89
- }
90
-
91
- /**
92
- * @author Vova Feldman (@svovaf)
93
- * @since 1.0.3
94
- *
95
- * @param bool $flush
96
- */
97
- function load( $flush = false ) {
98
- $this->_logger->entrance();
99
-
100
- $option_name = $this->_get_option_manager_name();
101
-
102
- if ( $flush || ! isset( $this->_options ) ) {
103
- if ( isset( $this->_options ) ) {
104
- // Clear prev options.
105
- $this->clear();
106
- }
107
-
108
- if ( ! WP_FS__DEBUG_SDK ) {
109
- $this->_options = wp_cache_get( $option_name, WP_FS__SLUG );
110
- }
111
-
112
- // $this->_logger->info('wp_cache_get = ' . var_export($this->_options, true));
113
-
114
- // if ( is_array( $this->_options ) ) {
115
- // $this->clear();
116
- // }
117
-
118
- $cached = true;
119
-
120
- if ( empty( $this->_options ) ) {
121
- $this->_options = get_option( $option_name );
122
-
123
- if ( is_string( $this->_options ) ) {
124
- $this->_options = json_decode( $this->_options );
125
- }
126
-
127
- // $this->_logger->info('get_option = ' . var_export($this->_options, true));
128
-
129
- if ( false === $this->_options ) {
130
- $this->clear();
131
- }
132
-
133
- $cached = false;
134
- }
135
-
136
- if ( ! WP_FS__DEBUG_SDK && ! $cached ) // Set non encoded cache.
137
- {
138
- wp_cache_set( $option_name, $this->_options, WP_FS__SLUG );
139
- }
140
- }
141
- }
142
-
143
- /**
144
- * @author Vova Feldman (@svovaf)
145
- * @since 1.0.3
146
- *
147
- * @return bool
148
- */
149
- function is_loaded() {
150
- return isset( $this->_options );
151
- }
152
-
153
- /**
154
- * @author Vova Feldman (@svovaf)
155
- * @since 1.0.3
156
- *
157
- * @return bool
158
- */
159
- function is_empty() {
160
- return ( $this->is_loaded() && false === $this->_options );
161
- }
162
-
163
- /**
164
- * @author Vova Feldman (@svovaf)
165
- * @since 1.0.6
166
- *
167
- * @param bool $flush
168
- */
169
- function clear( $flush = false ) {
170
- $this->_logger->entrance();
171
-
172
- $this->_options = array();
173
-
174
- if ( $flush ) {
175
- $this->store();
176
- }
177
- }
178
-
179
- /**
180
- * Delete options manager from DB.
181
- *
182
- * @author Vova Feldman (@svovaf)
183
- * @since 1.0.9
184
- */
185
- function delete() {
186
- delete_option( $this->_get_option_manager_name() );
187
- }
188
-
189
- /**
190
- * @author Vova Feldman (@svovaf)
191
- * @since 1.0.6
192
- *
193
- * @param string $option
194
- *
195
- * @return bool
196
- */
197
- function has_option( $option ) {
198
- return array_key_exists( $option, $this->_options );
199
- }
200
-
201
- /**
202
- * @author Vova Feldman (@svovaf)
203
- * @since 1.0.3
204
- *
205
- * @param string $option
206
- * @param mixed $default
207
- *
208
- * @return mixed
209
- */
210
- function get_option( $option, $default = null ) {
211
- $this->_logger->entrance( 'option = ' . $option );
212
-
213
- if ( is_array( $this->_options ) ) {
214
- return isset( $this->_options[ $option ] ) ? $this->_options[ $option ] : $default;
215
- } else if ( is_object( $this->_options ) ) {
216
- return isset( $this->_options->{$option} ) ? $this->_options->{$option} : $default;
217
- }
218
-
219
- return $default;
220
- }
221
-
222
- /**
223
- * @author Vova Feldman (@svovaf)
224
- * @since 1.0.3
225
- *
226
- * @param string $option
227
- * @param mixed $value
228
- * @param bool $flush
229
- */
230
- function set_option( $option, $value, $flush = false ) {
231
- $this->_logger->entrance( 'option = ' . $option );
232
-
233
- if ( ! $this->is_loaded() ) {
234
- $this->clear();
235
- }
236
-
237
- if ( is_array( $this->_options ) ) {
238
- $this->_options[ $option ] = $value;
239
- } else if ( is_object( $this->_options ) ) {
240
- $this->_options->{$option} = $value;
241
- }
242
-
243
- if ( $flush ) {
244
- $this->store();
245
- }
246
- }
247
-
248
- /**
249
- * Unset option.
250
- *
251
- * @author Vova Feldman (@svovaf)
252
- * @since 1.0.3
253
- *
254
- * @param string $option
255
- * @param bool $flush
256
- */
257
- function unset_option( $option, $flush = false ) {
258
- $this->_logger->entrance( 'option = ' . $option );
259
-
260
- if ( is_array( $this->_options ) ) {
261
- if ( ! isset( $this->_options[ $option ] ) ) {
262
- return;
263
- }
264
-
265
- unset( $this->_options[ $option ] );
266
-
267
- } else if ( is_object( $this->_options ) ) {
268
- if ( ! isset( $this->_options->{$option} ) ) {
269
- return;
270
- }
271
-
272
- unset( $this->_options->{$option} );
273
- }
274
-
275
- if ( $flush ) {
276
- $this->store();
277
- }
278
- }
279
-
280
- /**
281
- * Dump options to database.
282
- *
283
- * @author Vova Feldman (@svovaf)
284
- * @since 1.0.3
285
- */
286
- function store() {
287
- $this->_logger->entrance();
288
-
289
- $option_name = $this->_get_option_manager_name();
290
-
291
- if ( $this->_logger->is_on() ) {
292
- $this->_logger->info( $option_name . ' = ' . var_export( $this->_options, true ) );
293
- }
294
-
295
- // Update DB.
296
- update_option( $option_name, $this->_options );
297
-
298
- if ( ! WP_FS__DEBUG_SDK ) {
299
- wp_cache_set( $option_name, $this->_options, WP_FS__SLUG );
300
- }
301
- }
302
  }
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * 3-layer lazy options manager.
15
+ * layer 3: Memory
16
+ * layer 2: Cache (if there's any caching plugin and if WP_FS__DEBUG_SDK is FALSE)
17
+ * layer 1: Database (options table). All options stored as one option record in the DB to reduce number of DB
18
+ * queries.
19
+ *
20
+ * If load() is not explicitly called, starts as empty manager. Same thing about saving the data - you have to
21
+ * explicitly call store().
22
+ *
23
+ * Class Freemius_Option_Manager
24
+ */
25
+ class FS_Option_Manager {
26
+ /**
27
+ * @var string
28
+ */
29
+ private $_id;
30
+ /**
31
+ * @var array
32
+ */
33
+ private $_options;
34
+ /**
35
+ * @var FS_Logger
36
+ */
37
+ private $_logger;
38
+
39
+ /**
40
+ * @var FS_Option_Manager[]
41
+ */
42
+ private static $_MANAGERS = array();
43
+
44
+ /**
45
+ * @author Vova Feldman (@svovaf)
46
+ * @since 1.0.3
47
+ *
48
+ * @param string $id
49
+ * @param bool $load
50
+ */
51
+ private function __construct( $id, $load = false ) {
52
+ $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_opt_mngr_' . $id, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
53
+
54
+ $this->_logger->entrance();
55
+ $this->_logger->log( 'id = ' . $id );
56
+
57
+ $this->_id = $id;
58
+
59
+ if ( $load ) {
60
+ $this->load();
61
+ }
62
+ }
63
+
64
+ /**
65
+ * @author Vova Feldman (@svovaf)
66
+ * @since 1.0.3
67
+ *
68
+ * @param $id
69
+ * @param $load
70
+ *
71
+ * @return FS_Option_Manager
72
+ */
73
+ static function get_manager( $id, $load = false ) {
74
+ $id = strtolower( $id );
75
+
76
+ if ( ! isset( self::$_MANAGERS[ $id ] ) ) {
77
+ self::$_MANAGERS[ $id ] = new FS_Option_Manager( $id, $load );
78
+ } // If load required but not yet loaded, load.
79
+ else if ( $load && ! self::$_MANAGERS[ $id ]->is_loaded() ) {
80
+ self::$_MANAGERS[ $id ]->load();
81
+ }
82
+
83
+ return self::$_MANAGERS[ $id ];
84
+ }
85
+
86
+ private function _get_option_manager_name() {
87
+ // return WP_FS__SLUG . '_' . $this->_id;
88
+ return $this->_id;
89
+ }
90
+
91
+ /**
92
+ * @author Vova Feldman (@svovaf)
93
+ * @since 1.0.3
94
+ *
95
+ * @param bool $flush
96
+ */
97
+ function load( $flush = false ) {
98
+ $this->_logger->entrance();
99
+
100
+ $option_name = $this->_get_option_manager_name();
101
+
102
+ if ( $flush || ! isset( $this->_options ) ) {
103
+ if ( isset( $this->_options ) ) {
104
+ // Clear prev options.
105
+ $this->clear();
106
+ }
107
+
108
+ if ( ! WP_FS__DEBUG_SDK ) {
109
+ $this->_options = wp_cache_get( $option_name, WP_FS__SLUG );
110
+ }
111
+
112
+ // $this->_logger->info('wp_cache_get = ' . var_export($this->_options, true));
113
+
114
+ // if ( is_array( $this->_options ) ) {
115
+ // $this->clear();
116
+ // }
117
+
118
+ $cached = true;
119
+
120
+ if ( empty( $this->_options ) ) {
121
+ $this->_options = get_option( $option_name );
122
+
123
+ if ( is_string( $this->_options ) ) {
124
+ $this->_options = json_decode( $this->_options );
125
+ }
126
+
127
+ // $this->_logger->info('get_option = ' . var_export($this->_options, true));
128
+
129
+ if ( false === $this->_options ) {
130
+ $this->clear();
131
+ }
132
+
133
+ $cached = false;
134
+ }
135
+
136
+ if ( ! WP_FS__DEBUG_SDK && ! $cached ) // Set non encoded cache.
137
+ {
138
+ wp_cache_set( $option_name, $this->_options, WP_FS__SLUG );
139
+ }
140
+ }
141
+ }
142
+
143
+ /**
144
+ * @author Vova Feldman (@svovaf)
145
+ * @since 1.0.3
146
+ *
147
+ * @return bool
148
+ */
149
+ function is_loaded() {
150
+ return isset( $this->_options );
151
+ }
152
+
153
+ /**
154
+ * @author Vova Feldman (@svovaf)
155
+ * @since 1.0.3
156
+ *
157
+ * @return bool
158
+ */
159
+ function is_empty() {
160
+ return ( $this->is_loaded() && false === $this->_options );
161
+ }
162
+
163
+ /**
164
+ * @author Vova Feldman (@svovaf)
165
+ * @since 1.0.6
166
+ *
167
+ * @param bool $flush
168
+ */
169
+ function clear( $flush = false ) {
170
+ $this->_logger->entrance();
171
+
172
+ $this->_options = array();
173
+
174
+ if ( $flush ) {
175
+ $this->store();
176
+ }
177
+ }
178
+
179
+ /**
180
+ * Delete options manager from DB.
181
+ *
182
+ * @author Vova Feldman (@svovaf)
183
+ * @since 1.0.9
184
+ */
185
+ function delete() {
186
+ delete_option( $this->_get_option_manager_name() );
187
+ }
188
+
189
+ /**
190
+ * @author Vova Feldman (@svovaf)
191
+ * @since 1.0.6
192
+ *
193
+ * @param string $option
194
+ *
195
+ * @return bool
196
+ */
197
+ function has_option( $option ) {
198
+ return array_key_exists( $option, $this->_options );
199
+ }
200
+
201
+ /**
202
+ * @author Vova Feldman (@svovaf)
203
+ * @since 1.0.3
204
+ *
205
+ * @param string $option
206
+ * @param mixed $default
207
+ *
208
+ * @return mixed
209
+ */
210
+ function get_option( $option, $default = null ) {
211
+ $this->_logger->entrance( 'option = ' . $option );
212
+
213
+ if ( is_array( $this->_options ) ) {
214
+ return isset( $this->_options[ $option ] ) ? $this->_options[ $option ] : $default;
215
+ } else if ( is_object( $this->_options ) ) {
216
+ return isset( $this->_options->{$option} ) ? $this->_options->{$option} : $default;
217
+ }
218
+
219
+ return $default;
220
+ }
221
+
222
+ /**
223
+ * @author Vova Feldman (@svovaf)
224
+ * @since 1.0.3
225
+ *
226
+ * @param string $option
227
+ * @param mixed $value
228
+ * @param bool $flush
229
+ */
230
+ function set_option( $option, $value, $flush = false ) {
231
+ $this->_logger->entrance( 'option = ' . $option );
232
+
233
+ if ( ! $this->is_loaded() ) {
234
+ $this->clear();
235
+ }
236
+
237
+ if ( is_array( $this->_options ) ) {
238
+ $this->_options[ $option ] = $value;
239
+ } else if ( is_object( $this->_options ) ) {
240
+ $this->_options->{$option} = $value;
241
+ }
242
+
243
+ if ( $flush ) {
244
+ $this->store();
245
+ }
246
+ }
247
+
248
+ /**
249
+ * Unset option.
250
+ *
251
+ * @author Vova Feldman (@svovaf)
252
+ * @since 1.0.3
253
+ *
254
+ * @param string $option
255
+ * @param bool $flush
256
+ */
257
+ function unset_option( $option, $flush = false ) {
258
+ $this->_logger->entrance( 'option = ' . $option );
259
+
260
+ if ( is_array( $this->_options ) ) {
261
+ if ( ! isset( $this->_options[ $option ] ) ) {
262
+ return;
263
+ }
264
+
265
+ unset( $this->_options[ $option ] );
266
+
267
+ } else if ( is_object( $this->_options ) ) {
268
+ if ( ! isset( $this->_options->{$option} ) ) {
269
+ return;
270
+ }
271
+
272
+ unset( $this->_options->{$option} );
273
+ }
274
+
275
+ if ( $flush ) {
276
+ $this->store();
277
+ }
278
+ }
279
+
280
+ /**
281
+ * Dump options to database.
282
+ *
283
+ * @author Vova Feldman (@svovaf)
284
+ * @since 1.0.3
285
+ */
286
+ function store() {
287
+ $this->_logger->entrance();
288
+
289
+ $option_name = $this->_get_option_manager_name();
290
+
291
+ if ( $this->_logger->is_on() ) {
292
+ $this->_logger->info( $option_name . ' = ' . var_export( $this->_options, true ) );
293
+ }
294
+
295
+ // Update DB.
296
+ update_option( $option_name, $this->_options );
297
+
298
+ if ( ! WP_FS__DEBUG_SDK ) {
299
+ wp_cache_set( $option_name, $this->_options, WP_FS__SLUG );
300
+ }
301
+ }
302
  }
freemius/includes/managers/class-fs-plan-manager.php CHANGED
@@ -1,162 +1,162 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.6
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- class FS_Plan_Manager {
14
- /**
15
- * @var FS_Plan_Manager
16
- */
17
- private static $_instance;
18
-
19
- /**
20
- * @return FS_Plan_Manager
21
- */
22
- static function instance() {
23
- if ( ! isset( self::$_instance ) ) {
24
- self::$_instance = new FS_Plan_Manager();
25
- }
26
-
27
- return self::$_instance;
28
- }
29
-
30
- private function __construct() {
31
- }
32
-
33
- /**
34
- * @param FS_Plugin_License[] $licenses
35
- *
36
- * @return bool
37
- */
38
- function has_premium_license( $licenses ) {
39
- if ( is_array( $licenses ) ) {
40
- /**
41
- * @var FS_Plugin_License[] $licenses
42
- */
43
- foreach ( $licenses as $license ) {
44
- if ( ! $license->is_utilized() && $license->is_features_enabled() ) {
45
- return true;
46
- }
47
- }
48
- }
49
-
50
- return false;
51
- }
52
-
53
- /**
54
- * Check if plugin has any paid plans.
55
- *
56
- * @author Vova Feldman (@svovaf)
57
- * @since 1.0.7
58
- *
59
- * @param FS_Plugin_Plan[] $plans
60
- *
61
- * @return bool
62
- */
63
- function has_paid_plan( $plans ) {
64
- if ( ! is_array( $plans ) || 0 === count( $plans ) ) {
65
- return false;
66
- }
67
-
68
- /**
69
- * @var FS_Plugin_Plan[] $plans
70
- */
71
- for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
72
- if ( ! $plans[ $i ]->is_free() ) {
73
- return true;
74
- }
75
- }
76
-
77
- return false;
78
- }
79
-
80
- /**
81
- * Check if plugin has any free plan, or is it premium only.
82
- *
83
- * Note: If no plans configured, assume plugin is free.
84
- *
85
- * @author Vova Feldman (@svovaf)
86
- * @since 1.0.7
87
- *
88
- * @param FS_Plugin_Plan[] $plans
89
- *
90
- * @return bool
91
- */
92
- function has_free_plan( $plans ) {
93
- if ( ! is_array( $plans ) || 0 === count( $plans ) ) {
94
- return true;
95
- }
96
-
97
- /**
98
- * @var FS_Plugin_Plan[] $plans
99
- */
100
- for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
101
- if ( $plans[ $i ]->is_free() ) {
102
- return true;
103
- }
104
- }
105
-
106
- return false;
107
- }
108
-
109
- /**
110
- * Find all plans that have trial.
111
- *
112
- * @author Vova Feldman (@svovaf)
113
- * @since 1.0.9
114
- *
115
- * @param FS_Plugin_Plan[] $plans
116
- *
117
- * @return FS_Plugin_Plan[]
118
- */
119
- function get_trial_plans( $plans ) {
120
- $trial_plans = array();
121
-
122
- if ( is_array( $plans ) && 0 < count( $plans ) ) {
123
- /**
124
- * @var FS_Plugin_Plan[] $plans
125
- */
126
- for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
127
- if ( $plans[ $i ]->has_trial() ) {
128
- $trial_plans[] = $plans[ $i ];
129
- }
130
- }
131
- }
132
-
133
- return $trial_plans;
134
- }
135
-
136
- /**
137
- * Check if plugin has any trial plan.
138
- *
139
- * @author Vova Feldman (@svovaf)
140
- * @since 1.0.9
141
- *
142
- * @param FS_Plugin_Plan[] $plans
143
- *
144
- * @return bool
145
- */
146
- function has_trial_plan( $plans ) {
147
- if ( ! is_array( $plans ) || 0 === count( $plans ) ) {
148
- return true;
149
- }
150
-
151
- /**
152
- * @var FS_Plugin_Plan[] $plans
153
- */
154
- for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
155
- if ( $plans[ $i ]->has_trial() ) {
156
- return true;
157
- }
158
- }
159
-
160
- return false;
161
- }
162
  }
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.6
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Plan_Manager {
14
+ /**
15
+ * @var FS_Plan_Manager
16
+ */
17
+ private static $_instance;
18
+
19
+ /**
20
+ * @return FS_Plan_Manager
21
+ */
22
+ static function instance() {
23
+ if ( ! isset( self::$_instance ) ) {
24
+ self::$_instance = new FS_Plan_Manager();
25
+ }
26
+
27
+ return self::$_instance;
28
+ }
29
+
30
+ private function __construct() {
31
+ }
32
+
33
+ /**
34
+ * @param FS_Plugin_License[] $licenses
35
+ *
36
+ * @return bool
37
+ */
38
+ function has_premium_license( $licenses ) {
39
+ if ( is_array( $licenses ) ) {
40
+ /**
41
+ * @var FS_Plugin_License[] $licenses
42
+ */
43
+ foreach ( $licenses as $license ) {
44
+ if ( ! $license->is_utilized() && $license->is_features_enabled() ) {
45
+ return true;
46
+ }
47
+ }
48
+ }
49
+
50
+ return false;
51
+ }
52
+
53
+ /**
54
+ * Check if plugin has any paid plans.
55
+ *
56
+ * @author Vova Feldman (@svovaf)
57
+ * @since 1.0.7
58
+ *
59
+ * @param FS_Plugin_Plan[] $plans
60
+ *
61
+ * @return bool
62
+ */
63
+ function has_paid_plan( $plans ) {
64
+ if ( ! is_array( $plans ) || 0 === count( $plans ) ) {
65
+ return false;
66
+ }
67
+
68
+ /**
69
+ * @var FS_Plugin_Plan[] $plans
70
+ */
71
+ for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
72
+ if ( ! $plans[ $i ]->is_free() ) {
73
+ return true;
74
+ }
75
+ }
76
+
77
+ return false;
78
+ }
79
+
80
+ /**
81
+ * Check if plugin has any free plan, or is it premium only.
82
+ *
83
+ * Note: If no plans configured, assume plugin is free.
84
+ *
85
+ * @author Vova Feldman (@svovaf)
86
+ * @since 1.0.7
87
+ *
88
+ * @param FS_Plugin_Plan[] $plans
89
+ *
90
+ * @return bool
91
+ */
92
+ function has_free_plan( $plans ) {
93
+ if ( ! is_array( $plans ) || 0 === count( $plans ) ) {
94
+ return true;
95
+ }
96
+
97
+ /**
98
+ * @var FS_Plugin_Plan[] $plans
99
+ */
100
+ for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
101
+ if ( $plans[ $i ]->is_free() ) {
102
+ return true;
103
+ }
104
+ }
105
+
106
+ return false;
107
+ }
108
+
109
+ /**
110
+ * Find all plans that have trial.
111
+ *
112
+ * @author Vova Feldman (@svovaf)
113
+ * @since 1.0.9
114
+ *
115
+ * @param FS_Plugin_Plan[] $plans
116
+ *
117
+ * @return FS_Plugin_Plan[]
118
+ */
119
+ function get_trial_plans( $plans ) {
120
+ $trial_plans = array();
121
+
122
+ if ( is_array( $plans ) && 0 < count( $plans ) ) {
123
+ /**
124
+ * @var FS_Plugin_Plan[] $plans
125
+ */
126
+ for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
127
+ if ( $plans[ $i ]->has_trial() ) {
128
+ $trial_plans[] = $plans[ $i ];
129
+ }
130
+ }
131
+ }
132
+
133
+ return $trial_plans;
134
+ }
135
+
136
+ /**
137
+ * Check if plugin has any trial plan.
138
+ *
139
+ * @author Vova Feldman (@svovaf)
140
+ * @since 1.0.9
141
+ *
142
+ * @param FS_Plugin_Plan[] $plans
143
+ *
144
+ * @return bool
145
+ */
146
+ function has_trial_plan( $plans ) {
147
+ if ( ! is_array( $plans ) || 0 === count( $plans ) ) {
148
+ return true;
149
+ }
150
+
151
+ /**
152
+ * @var FS_Plugin_Plan[] $plans
153
+ */
154
+ for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
155
+ if ( $plans[ $i ]->has_trial() ) {
156
+ return true;
157
+ }
158
+ }
159
+
160
+ return false;
161
+ }
162
  }
freemius/includes/managers/class-fs-plugin-manager.php CHANGED
@@ -1,154 +1,154 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.6
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- class FS_Plugin_Manager {
14
- /**
15
- * @var string
16
- */
17
- protected $_slug;
18
- /**
19
- * @var FS_Plugin
20
- */
21
- protected $_plugin;
22
-
23
- /**
24
- * @var FS_Plugin_Manager[]
25
- */
26
- private static $_instances = array();
27
- /**
28
- * @var FS_Logger
29
- */
30
- protected $_logger;
31
-
32
- /**
33
- * @param string $slug
34
- *
35
- * @return FS_Plugin_Manager
36
- */
37
- static function instance( $slug ) {
38
- if ( ! isset( self::$_instances[ $slug ] ) ) {
39
- self::$_instances[ $slug ] = new FS_Plugin_Manager( $slug );
40
- }
41
-
42
- return self::$_instances[ $slug ];
43
- }
44
-
45
- protected function __construct( $slug ) {
46
- $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $slug . '_' . 'plugins', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
47
-
48
- $this->_slug = $slug;
49
- $this->load();
50
- }
51
-
52
- protected function get_option_manager() {
53
- return FS_Option_Manager::get_manager( WP_FS__ACCOUNTS_OPTION_NAME, true );
54
- }
55
-
56
- protected function get_all_plugins() {
57
- return $this->get_option_manager()->get_option( 'plugins', array() );
58
- }
59
-
60
- /**
61
- * Load plugin data from local DB.
62
- *
63
- * @author Vova Feldman (@svovaf)
64
- * @since 1.0.6
65
- */
66
- function load() {
67
- $all_plugins = $this->get_all_plugins();
68
- $this->_plugin = isset( $all_plugins[ $this->_slug ] ) ?
69
- $all_plugins[ $this->_slug ] :
70
- null;
71
- }
72
-
73
- /**
74
- * Store plugin on local DB.
75
- *
76
- * @author Vova Feldman (@svovaf)
77
- * @since 1.0.6
78
- *
79
- * @param bool|FS_Plugin $plugin
80
- * @param bool $flush
81
- *
82
- * @return bool|\FS_Plugin
83
- */
84
- function store( $plugin = false, $flush = true ) {
85
- $all_plugins = $this->get_all_plugins();
86
-
87
- if ( false !== $plugin ) {
88
- $this->_plugin = $plugin;
89
- }
90
-
91
- $all_plugins[ $this->_slug ] = $this->_plugin;
92
-
93
- $options_manager = $this->get_option_manager();
94
- $options_manager->set_option( 'plugins', $all_plugins, $flush );
95
-
96
- return $this->_plugin;
97
- }
98
-
99
- /**
100
- * Update local plugin data if different.
101
- *
102
- * @author Vova Feldman (@svovaf)
103
- * @since 1.0.6
104
- *
105
- * @param \FS_Plugin $plugin
106
- * @param bool $store
107
- *
108
- * @return bool True if plugin was updated.
109
- */
110
- function update( FS_Plugin $plugin, $store = true ) {
111
- if ( ! ( $this->_plugin instanceof FS_Plugin ) ||
112
- $this->_plugin->slug != $plugin->slug ||
113
- $this->_plugin->public_key != $plugin->public_key ||
114
- $this->_plugin->secret_key != $plugin->secret_key ||
115
- $this->_plugin->parent_plugin_id != $plugin->parent_plugin_id ||
116
- $this->_plugin->title != $plugin->title
117
- ) {
118
- $this->store( $plugin, $store );
119
-
120
- return true;
121
- }
122
-
123
- return false;
124
- }
125
-
126
- /**
127
- * @author Vova Feldman (@svovaf)
128
- * @since 1.0.6
129
- *
130
- * @param FS_Plugin $plugin
131
- * @param bool $store
132
- */
133
- function set( FS_Plugin $plugin, $store = false ) {
134
- $this->_plugin = $plugin;
135
-
136
- if ( $store ) {
137
- $this->store();
138
- }
139
- }
140
-
141
- /**
142
- * @author Vova Feldman (@svovaf)
143
- * @since 1.0.6
144
- *
145
- * @return bool|\FS_Plugin
146
- */
147
- function get() {
148
- return isset( $this->_plugin ) ?
149
- $this->_plugin :
150
- false;
151
- }
152
-
153
-
154
  }
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.6
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Plugin_Manager {
14
+ /**
15
+ * @var string
16
+ */
17
+ protected $_slug;
18
+ /**
19
+ * @var FS_Plugin
20
+ */
21
+ protected $_plugin;
22
+
23
+ /**
24
+ * @var FS_Plugin_Manager[]
25
+ */
26
+ private static $_instances = array();
27
+ /**
28
+ * @var FS_Logger
29
+ */
30
+ protected $_logger;
31
+
32
+ /**
33
+ * @param string $slug
34
+ *
35
+ * @return FS_Plugin_Manager
36
+ */
37
+ static function instance( $slug ) {
38
+ if ( ! isset( self::$_instances[ $slug ] ) ) {
39
+ self::$_instances[ $slug ] = new FS_Plugin_Manager( $slug );
40
+ }
41
+
42
+ return self::$_instances[ $slug ];
43
+ }
44
+
45
+ protected function __construct( $slug ) {
46
+ $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $slug . '_' . 'plugins', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
47
+
48
+ $this->_slug = $slug;
49
+ $this->load();
50
+ }
51
+
52
+ protected function get_option_manager() {
53
+ return FS_Option_Manager::get_manager( WP_FS__ACCOUNTS_OPTION_NAME, true );
54
+ }
55
+
56
+ protected function get_all_plugins() {
57
+ return $this->get_option_manager()->get_option( 'plugins', array() );
58
+ }
59
+
60
+ /**
61
+ * Load plugin data from local DB.
62
+ *
63
+ * @author Vova Feldman (@svovaf)
64
+ * @since 1.0.6
65
+ */
66
+ function load() {
67
+ $all_plugins = $this->get_all_plugins();
68
+ $this->_plugin = isset( $all_plugins[ $this->_slug ] ) ?
69
+ $all_plugins[ $this->_slug ] :
70
+ null;
71
+ }
72
+
73
+ /**
74
+ * Store plugin on local DB.
75
+ *
76
+ * @author Vova Feldman (@svovaf)
77
+ * @since 1.0.6
78
+ *
79
+ * @param bool|FS_Plugin $plugin
80
+ * @param bool $flush
81
+ *
82
+ * @return bool|\FS_Plugin
83
+ */
84
+ function store( $plugin = false, $flush = true ) {
85
+ $all_plugins = $this->get_all_plugins();
86
+
87
+ if ( false !== $plugin ) {
88
+ $this->_plugin = $plugin;
89
+ }
90
+
91
+ $all_plugins[ $this->_slug ] = $this->_plugin;
92
+
93
+ $options_manager = $this->get_option_manager();
94
+ $options_manager->set_option( 'plugins', $all_plugins, $flush );
95
+
96
+ return $this->_plugin;
97
+ }
98
+
99
+ /**
100
+ * Update local plugin data if different.
101
+ *
102
+ * @author Vova Feldman (@svovaf)
103
+ * @since 1.0.6
104
+ *
105
+ * @param \FS_Plugin $plugin
106
+ * @param bool $store
107
+ *
108
+ * @return bool True if plugin was updated.
109
+ */
110
+ function update( FS_Plugin $plugin, $store = true ) {
111
+ if ( ! ( $this->_plugin instanceof FS_Plugin ) ||
112
+ $this->_plugin->slug != $plugin->slug ||
113
+ $this->_plugin->public_key != $plugin->public_key ||
114
+ $this->_plugin->secret_key != $plugin->secret_key ||
115
+ $this->_plugin->parent_plugin_id != $plugin->parent_plugin_id ||
116
+ $this->_plugin->title != $plugin->title
117
+ ) {
118
+ $this->store( $plugin, $store );
119
+
120
+ return true;
121
+ }
122
+
123
+ return false;
124
+ }
125
+
126
+ /**
127
+ * @author Vova Feldman (@svovaf)
128
+ * @since 1.0.6
129
+ *
130
+ * @param FS_Plugin $plugin
131
+ * @param bool $store
132
+ */
133
+ function set( FS_Plugin $plugin, $store = false ) {
134
+ $this->_plugin = $plugin;
135
+
136
+ if ( $store ) {
137
+ $this->store();
138
+ }
139
+ }
140
+
141
+ /**
142
+ * @author Vova Feldman (@svovaf)
143
+ * @since 1.0.6
144
+ *
145
+ * @return bool|\FS_Plugin
146
+ */
147
+ function get() {
148
+ return isset( $this->_plugin ) ?
149
+ $this->_plugin :
150
+ false;
151
+ }
152
+
153
+
154
  }
freemius/includes/managers/index.php CHANGED
@@ -1,3 +1,3 @@
1
- <?php
2
- // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
1
+ <?php
2
+ // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
freemius/includes/sdk/Exceptions/index.php CHANGED
@@ -1,3 +1,3 @@
1
- <?php
2
- // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
1
+ <?php
2
+ // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
freemius/includes/sdk/LICENSE.txt CHANGED
@@ -1,340 +1,340 @@
1
- GNU GENERAL PUBLIC LICENSE
2
- Version 2, June 1991
3
-
4
- Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
5
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
- Everyone is permitted to copy and distribute verbatim copies
7
- of this license document, but changing it is not allowed.
8
-
9
- Preamble
10
-
11
- The licenses for most software are designed to take away your
12
- freedom to share and change it. By contrast, the GNU General Public
13
- License is intended to guarantee your freedom to share and change free
14
- software--to make sure the software is free for all its users. This
15
- General Public License applies to most of the Free Software
16
- Foundation's software and to any other program whose authors commit to
17
- using it. (Some other Free Software Foundation software is covered by
18
- the GNU Lesser General Public License instead.) You can apply it to
19
- your programs, too.
20
-
21
- When we speak of free software, we are referring to freedom, not
22
- price. Our General Public Licenses are designed to make sure that you
23
- have the freedom to distribute copies of free software (and charge for
24
- this service if you wish), that you receive source code or can get it
25
- if you want it, that you can change the software or use pieces of it
26
- in new free programs; and that you know you can do these things.
27
-
28
- To protect your rights, we need to make restrictions that forbid
29
- anyone to deny you these rights or to ask you to surrender the rights.
30
- These restrictions translate to certain responsibilities for you if you
31
- distribute copies of the software, or if you modify it.
32
-
33
- For example, if you distribute copies of such a program, whether
34
- gratis or for a fee, you must give the recipients all the rights that
35
- you have. You must make sure that they, too, receive or can get the
36
- source code. And you must show them these terms so they know their
37
- rights.
38
-
39
- We protect your rights with two steps: (1) copyright the software, and
40
- (2) offer you this license which gives you legal permission to copy,
41
- distribute and/or modify the software.
42
-
43
- Also, for each author's protection and ours, we want to make certain
44
- that everyone understands that there is no warranty for this free
45
- software. If the software is modified by someone else and passed on, we
46
- want its recipients to know that what they have is not the original, so
47
- that any problems introduced by others will not reflect on the original
48
- authors' reputations.
49
-
50
- Finally, any free program is threatened constantly by software
51
- patents. We wish to avoid the danger that redistributors of a free
52
- program will individually obtain patent licenses, in effect making the
53
- program proprietary. To prevent this, we have made it clear that any
54
- patent must be licensed for everyone's free use or not licensed at all.
55
-
56
- The precise terms and conditions for copying, distribution and
57
- modification follow.
58
-
59
- GNU GENERAL PUBLIC LICENSE
60
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
-
62
- 0. This License applies to any program or other work which contains
63
- a notice placed by the copyright holder saying it may be distributed
64
- under the terms of this General Public License. The "Program", below,
65
- refers to any such program or work, and a "work based on the Program"
66
- means either the Program or any derivative work under copyright law:
67
- that is to say, a work containing the Program or a portion of it,
68
- either verbatim or with modifications and/or translated into another
69
- language. (Hereinafter, translation is included without limitation in
70
- the term "modification".) Each licensee is addressed as "you".
71
-
72
- Activities other than copying, distribution and modification are not
73
- covered by this License; they are outside its scope. The act of
74
- running the Program is not restricted, and the output from the Program
75
- is covered only if its contents constitute a work based on the
76
- Program (independent of having been made by running the Program).
77
- Whether that is true depends on what the Program does.
78
-
79
- 1. You may copy and distribute verbatim copies of the Program's
80
- source code as you receive it, in any medium, provided that you
81
- conspicuously and appropriately publish on each copy an appropriate
82
- copyright notice and disclaimer of warranty; keep intact all the
83
- notices that refer to this License and to the absence of any warranty;
84
- and give any other recipients of the Program a copy of this License
85
- along with the Program.
86
-
87
- You may charge a fee for the physical act of transferring a copy, and
88
- you may at your option offer warranty protection in exchange for a fee.
89
-
90
- 2. You may modify your copy or copies of the Program or any portion
91
- of it, thus forming a work based on the Program, and copy and
92
- distribute such modifications or work under the terms of Section 1
93
- above, provided that you also meet all of these conditions:
94
-
95
- a) You must cause the modified files to carry prominent notices
96
- stating that you changed the files and the date of any change.
97
-
98
- b) You must cause any work that you distribute or publish, that in
99
- whole or in part contains or is derived from the Program or any
100
- part thereof, to be licensed as a whole at no charge to all third
101
- parties under the terms of this License.
102
-
103
- c) If the modified program normally reads commands interactively
104
- when run, you must cause it, when started running for such
105
- interactive use in the most ordinary way, to print or display an
106
- announcement including an appropriate copyright notice and a
107
- notice that there is no warranty (or else, saying that you provide
108
- a warranty) and that users may redistribute the program under
109
- these conditions, and telling the user how to view a copy of this
110
- License. (Exception: if the Program itself is interactive but
111
- does not normally print such an announcement, your work based on
112
- the Program is not required to print an announcement.)
113
-
114
- These requirements apply to the modified work as a whole. If
115
- identifiable sections of that work are not derived from the Program,
116
- and can be reasonably considered independent and separate works in
117
- themselves, then this License, and its terms, do not apply to those
118
- sections when you distribute them as separate works. But when you
119
- distribute the same sections as part of a whole which is a work based
120
- on the Program, the distribution of the whole must be on the terms of
121
- this License, whose permissions for other licensees extend to the
122
- entire whole, and thus to each and every part regardless of who wrote it.
123
-
124
- Thus, it is not the intent of this section to claim rights or contest
125
- your rights to work written entirely by you; rather, the intent is to
126
- exercise the right to control the distribution of derivative or
127
- collective works based on the Program.
128
-
129
- In addition, mere aggregation of another work not based on the Program
130
- with the Program (or with a work based on the Program) on a volume of
131
- a storage or distribution medium does not bring the other work under
132
- the scope of this License.
133
-
134
- 3. You may copy and distribute the Program (or a work based on it,
135
- under Section 2) in object code or executable form under the terms of
136
- Sections 1 and 2 above provided that you also do one of the following:
137
-
138
- a) Accompany it with the complete corresponding machine-readable
139
- source code, which must be distributed under the terms of Sections
140
- 1 and 2 above on a medium customarily used for software interchange; or,
141
-
142
- b) Accompany it with a written offer, valid for at least three
143
- years, to give any third party, for a charge no more than your
144
- cost of physically performing source distribution, a complete
145
- machine-readable copy of the corresponding source code, to be
146
- distributed under the terms of Sections 1 and 2 above on a medium
147
- customarily used for software interchange; or,
148
-
149
- c) Accompany it with the information you received as to the offer
150
- to distribute corresponding source code. (This alternative is
151
- allowed only for noncommercial distribution and only if you
152
- received the program in object code or executable form with such
153
- an offer, in accord with Subsection b above.)
154
-
155
- The source code for a work means the preferred form of the work for
156
- making modifications to it. For an executable work, complete source
157
- code means all the source code for all modules it contains, plus any
158
- associated interface definition files, plus the scripts used to
159
- control compilation and installation of the executable. However, as a
160
- special exception, the source code distributed need not include
161
- anything that is normally distributed (in either source or binary
162
- form) with the major components (compiler, kernel, and so on) of the
163
- operating system on which the executable runs, unless that component
164
- itself accompanies the executable.
165
-
166
- If distribution of executable or object code is made by offering
167
- access to copy from a designated place, then offering equivalent
168
- access to copy the source code from the same place counts as
169
- distribution of the source code, even though third parties are not
170
- compelled to copy the source along with the object code.
171
-
172
- 4. You may not copy, modify, sublicense, or distribute the Program
173
- except as expressly provided under this License. Any attempt
174
- otherwise to copy, modify, sublicense or distribute the Program is
175
- void, and will automatically terminate your rights under this License.
176
- However, parties who have received copies, or rights, from you under
177
- this License will not have their licenses terminated so long as such
178
- parties remain in full compliance.
179
-
180
- 5. You are not required to accept this License, since you have not
181
- signed it. However, nothing else grants you permission to modify or
182
- distribute the Program or its derivative works. These actions are
183
- prohibited by law if you do not accept this License. Therefore, by
184
- modifying or distributing the Program (or any work based on the
185
- Program), you indicate your acceptance of this License to do so, and
186
- all its terms and conditions for copying, distributing or modifying
187
- the Program or works based on it.
188
-
189
- 6. Each time you redistribute the Program (or any work based on the
190
- Program), the recipient automatically receives a license from the
191
- original licensor to copy, distribute or modify the Program subject to
192
- these terms and conditions. You may not impose any further
193
- restrictions on the recipients' exercise of the rights granted herein.
194
- You are not responsible for enforcing compliance by third parties to
195
- this License.
196
-
197
- 7. If, as a consequence of a court judgment or allegation of patent
198
- infringement or for any other reason (not limited to patent issues),
199
- conditions are imposed on you (whether by court order, agreement or
200
- otherwise) that contradict the conditions of this License, they do not
201
- excuse you from the conditions of this License. If you cannot
202
- distribute so as to satisfy simultaneously your obligations under this
203
- License and any other pertinent obligations, then as a consequence you
204
- may not distribute the Program at all. For example, if a patent
205
- license would not permit royalty-free redistribution of the Program by
206
- all those who receive copies directly or indirectly through you, then
207
- the only way you could satisfy both it and this License would be to
208
- refrain entirely from distribution of the Program.
209
-
210
- If any portion of this section is held invalid or unenforceable under
211
- any particular circumstance, the balance of the section is intended to
212
- apply and the section as a whole is intended to apply in other
213
- circumstances.
214
-
215
- It is not the purpose of this section to induce you to infringe any
216
- patents or other property right claims or to contest validity of any
217
- such claims; this section has the sole purpose of protecting the
218
- integrity of the free software distribution system, which is
219
- implemented by public license practices. Many people have made
220
- generous contributions to the wide range of software distributed
221
- through that system in reliance on consistent application of that
222
- system; it is up to the author/donor to decide if he or she is willing
223
- to distribute software through any other system and a licensee cannot
224
- impose that choice.
225
-
226
- This section is intended to make thoroughly clear what is believed to
227
- be a consequence of the rest of this License.
228
-
229
- 8. If the distribution and/or use of the Program is restricted in
230
- certain countries either by patents or by copyrighted interfaces, the
231
- original copyright holder who places the Program under this License
232
- may add an explicit geographical distribution limitation excluding
233
- those countries, so that distribution is permitted only in or among
234
- countries not thus excluded. In such case, this License incorporates
235
- the limitation as if written in the body of this License.
236
-
237
- 9. The Free Software Foundation may publish revised and/or new versions
238
- of the General Public License from time to time. Such new versions will
239
- be similar in spirit to the present version, but may differ in detail to
240
- address new problems or concerns.
241
-
242
- Each version is given a distinguishing version number. If the Program
243
- specifies a version number of this License which applies to it and "any
244
- later version", you have the option of following the terms and conditions
245
- either of that version or of any later version published by the Free
246
- Software Foundation. If the Program does not specify a version number of
247
- this License, you may choose any version ever published by the Free Software
248
- Foundation.
249
-
250
- 10. If you wish to incorporate parts of the Program into other free
251
- programs whose distribution conditions are different, write to the author
252
- to ask for permission. For software which is copyrighted by the Free
253
- Software Foundation, write to the Free Software Foundation; we sometimes
254
- make exceptions for this. Our decision will be guided by the two goals
255
- of preserving the free status of all derivatives of our free software and
256
- of promoting the sharing and reuse of software generally.
257
-
258
- NO WARRANTY
259
-
260
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
- FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
- OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
- PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
- OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
- TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
- PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
- REPAIR OR CORRECTION.
269
-
270
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
- WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
- REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
- INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
- OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
- TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
- YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
- PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
- POSSIBILITY OF SUCH DAMAGES.
279
-
280
- END OF TERMS AND CONDITIONS
281
-
282
- How to Apply These Terms to Your New Programs
283
-
284
- If you develop a new program, and you want it to be of the greatest
285
- possible use to the public, the best way to achieve this is to make it
286
- free software which everyone can redistribute and change under these terms.
287
-
288
- To do so, attach the following notices to the program. It is safest
289
- to attach them to the start of each source file to most effectively
290
- convey the exclusion of warranty; and each file should have at least
291
- the "copyright" line and a pointer to where the full notice is found.
292
-
293
- {description}
294
- Copyright (C) {year} {fullname}
295
-
296
- This program is free software; you can redistribute it and/or modify
297
- it under the terms of the GNU General Public License as published by
298
- the Free Software Foundation; either version 2 of the License, or
299
- (at your option) any later version.
300
-
301
- This program is distributed in the hope that it will be useful,
302
- but WITHOUT ANY WARRANTY; without even the implied warranty of
303
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
- GNU General Public License for more details.
305
-
306
- You should have received a copy of the GNU General Public License along
307
- with this program; if not, write to the Free Software Foundation, Inc.,
308
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
-
310
- Also add information on how to contact you by electronic and paper mail.
311
-
312
- If the program is interactive, make it output a short notice like this
313
- when it starts in an interactive mode:
314
-
315
- Gnomovision version 69, Copyright (C) year name of author
316
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
- This is free software, and you are welcome to redistribute it
318
- under certain conditions; type `show c' for details.
319
-
320
- The hypothetical commands `show w' and `show c' should show the appropriate
321
- parts of the General Public License. Of course, the commands you use may
322
- be called something other than `show w' and `show c'; they could even be
323
- mouse-clicks or menu items--whatever suits your program.
324
-
325
- You should also get your employer (if you work as a programmer) or your
326
- school, if any, to sign a "copyright disclaimer" for the program, if
327
- necessary. Here is a sample; alter the names:
328
-
329
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
-
332
- {signature of Ty Coon}, 1 April 1989
333
- Ty Coon, President of Vice
334
-
335
- This General Public License does not permit incorporating your program into
336
- proprietary programs. If your program is a subroutine library, you may
337
- consider it more useful to permit linking proprietary applications with the
338
- library. If this is what you want to do, use the GNU Lesser General
339
- Public License instead of this License.
340
-
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Lesser General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
+
284
+ If you develop a new program, and you want it to be of the greatest
285
+ possible use to the public, the best way to achieve this is to make it
286
+ free software which everyone can redistribute and change under these terms.
287
+
288
+ To do so, attach the following notices to the program. It is safest
289
+ to attach them to the start of each source file to most effectively
290
+ convey the exclusion of warranty; and each file should have at least
291
+ the "copyright" line and a pointer to where the full notice is found.
292
+
293
+ {description}
294
+ Copyright (C) {year} {fullname}
295
+
296
+ This program is free software; you can redistribute it and/or modify
297
+ it under the terms of the GNU General Public License as published by
298
+ the Free Software Foundation; either version 2 of the License, or
299
+ (at your option) any later version.
300
+
301
+ This program is distributed in the hope that it will be useful,
302
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
+ GNU General Public License for more details.
305
+
306
+ You should have received a copy of the GNU General Public License along
307
+ with this program; if not, write to the Free Software Foundation, Inc.,
308
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
+
310
+ Also add information on how to contact you by electronic and paper mail.
311
+
312
+ If the program is interactive, make it output a short notice like this
313
+ when it starts in an interactive mode:
314
+
315
+ Gnomovision version 69, Copyright (C) year name of author
316
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
+ This is free software, and you are welcome to redistribute it
318
+ under certain conditions; type `show c' for details.
319
+
320
+ The hypothetical commands `show w' and `show c' should show the appropriate
321
+ parts of the General Public License. Of course, the commands you use may
322
+ be called something other than `show w' and `show c'; they could even be
323
+ mouse-clicks or menu items--whatever suits your program.
324
+
325
+ You should also get your employer (if you work as a programmer) or your
326
+ school, if any, to sign a "copyright disclaimer" for the program, if
327
+ necessary. Here is a sample; alter the names:
328
+
329
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
+
332
+ {signature of Ty Coon}, 1 April 1989
333
+ Ty Coon, President of Vice
334
+
335
+ This General Public License does not permit incorporating your program into
336
+ proprietary programs. If your program is a subroutine library, you may
337
+ consider it more useful to permit linking proprietary applications with the
338
+ library. If this is what you want to do, use the GNU Lesser General
339
+ Public License instead of this License.
340
+
freemius/includes/sdk/index.php CHANGED
@@ -1,3 +1,3 @@
1
- <?php
2
- // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
1
+ <?php
2
+ // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
freemius/includes/supplements/fs-essential-functions-1.1.7.1.php CHANGED
@@ -1,47 +1,47 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.1.7
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- /**
14
- * Find the plugin main file path based on any give file inside the plugin's folder.
15
- *
16
- * @author Vova Feldman (@svovaf)
17
- * @since 1.1.7.1
18
- *
19
- * @param string $file Absolute path to a file inside a plugin's folder.
20
- *
21
- * @return string
22
- */
23
- function fs_find_direct_caller_plugin_file( $file ) {
24
- /**
25
- * All the code below will be executed once on activation.
26
- * If the user changes the main plugin's file name, the file_exists()
27
- * will catch it.
28
- */
29
- if ( ! function_exists( 'get_plugins' ) ) {
30
- require_once ABSPATH . 'wp-admin/includes/plugin.php';
31
- }
32
-
33
- $all_plugins = get_plugins();
34
-
35
- $file_real_path = fs_normalize_path( realpath( $file ) );
36
-
37
- // Get active plugin's main files real full names (might be symlinks).
38
- foreach ( $all_plugins as $relative_path => &$data ) {
39
- if ( 0 === strpos( $file_real_path, fs_normalize_path( dirname( realpath( WP_PLUGIN_DIR . '/' . $relative_path ) ) ) ) ) {
40
- if ( '.' !== dirname( trailingslashit( $relative_path ) ) ) {
41
- return $relative_path;
42
- }
43
- }
44
- }
45
-
46
- return null;
47
- }
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.1.7
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * Find the plugin main file path based on any give file inside the plugin's folder.
15
+ *
16
+ * @author Vova Feldman (@svovaf)
17
+ * @since 1.1.7.1
18
+ *
19
+ * @param string $file Absolute path to a file inside a plugin's folder.
20
+ *
21
+ * @return string
22
+ */
23
+ function fs_find_direct_caller_plugin_file( $file ) {
24
+ /**
25
+ * All the code below will be executed once on activation.
26
+ * If the user changes the main plugin's file name, the file_exists()
27
+ * will catch it.
28
+ */
29
+ if ( ! function_exists( 'get_plugins' ) ) {
30
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
31
+ }
32
+
33
+ $all_plugins = get_plugins();
34
+
35
+ $file_real_path = fs_normalize_path( realpath( $file ) );
36
+
37
+ // Get active plugin's main files real full names (might be symlinks).
38
+ foreach ( $all_plugins as $relative_path => &$data ) {
39
+ if ( 0 === strpos( $file_real_path, fs_normalize_path( dirname( realpath( WP_PLUGIN_DIR . '/' . $relative_path ) ) ) ) ) {
40
+ if ( '.' !== dirname( trailingslashit( $relative_path ) ) ) {
41
+ return $relative_path;
42
+ }
43
+ }
44
+ }
45
+
46
+ return null;
47
+ }
freemius/includes/supplements/index.php CHANGED
@@ -1,3 +1,3 @@
1
- <?php
2
- // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
1
+ <?php
2
+ // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
freemius/index.php CHANGED
@@ -1,3 +1,3 @@
1
- <?php
2
- // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
1
+ <?php
2
+ // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
freemius/languages/index.php CHANGED
@@ -1,3 +1,3 @@
1
- <?php
2
- // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
1
+ <?php
2
+ // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
freemius/templates/add-trial-to-pricing.php CHANGED
@@ -1,31 +1,31 @@
1
- <?php
2
- /**
3
- * Add "&trial=true" to pricing menu item href when running in trial
4
- * promotion context.
5
- *
6
- * @package Freemius
7
- * @copyright Copyright (c) 2016, Freemius, Inc.
8
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
- * @since 1.2.1.5
10
- */
11
-
12
- if ( ! defined( 'ABSPATH' ) ) {
13
- exit;
14
- }
15
-
16
- /**
17
- * @var array $VARS
18
- */
19
- $slug = $VARS['slug'];
20
- ?>
21
- <script type="text/javascript">
22
- (function ($) {
23
- $(document).ready(function () {
24
- var $pricingMenu = $('.fs-submenu-item.<?php echo $slug ?>.pricing'),
25
- $pricingMenuLink = $pricingMenu.parents('a');
26
-
27
- // Add trial querystring param.
28
- $pricingMenuLink.attr('href', $pricingMenuLink.attr('href') + '&trial=true');
29
- });
30
- })(jQuery);
31
  </script>
1
+ <?php
2
+ /**
3
+ * Add "&trial=true" to pricing menu item href when running in trial
4
+ * promotion context.
5
+ *
6
+ * @package Freemius
7
+ * @copyright Copyright (c) 2016, Freemius, Inc.
8
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+ * @since 1.2.1.5
10
+ */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+
16
+ /**
17
+ * @var array $VARS
18
+ */
19
+ $slug = $VARS['slug'];
20
+ ?>
21
+ <script type="text/javascript">
22
+ (function ($) {
23
+ $(document).ready(function () {
24
+ var $pricingMenu = $('.fs-submenu-item.<?php echo $slug ?>.pricing'),
25
+ $pricingMenuLink = $pricingMenu.parents('a');
26
+
27
+ // Add trial querystring param.
28
+ $pricingMenuLink.attr('href', $pricingMenuLink.attr('href') + '&trial=true');
29
+ });
30
+ })(jQuery);
31
  </script>
freemius/templates/all-admin-notice.php CHANGED
@@ -1,39 +1,39 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.3
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- /**
14
- * @var array $VARS
15
- */
16
- ?>
17
- <div class="<?php
18
- switch ($VARS['type']) {
19
- case 'error':
20
- echo 'error form-invalid';
21
- break;
22
- case 'update-nag':
23
- echo 'update-nag ';
24
- break;
25
- case 'update':
26
- case 'success':
27
- default:
28
- echo 'updated success';
29
- break;
30
- }
31
- ?> fs-notice">
32
- <?php if ('update-nag' !== $VARS['type']) : ?><p><?php endif ?>
33
- <?php if (!empty($VARS['title'])) : ?>
34
- <b><?php echo $VARS['title'] ?></b>
35
- <?php endif ?>
36
- <?php echo $VARS['message'] ?>
37
- <?php if ('update-nag' !== $VARS['type']) : ?></p><?php endif ?>
38
- <?php if ($VARS['sticky']) : ?><i class="dashicons dashicons-no"></i><?php endif ?>
39
  </div>
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * @var array $VARS
15
+ */
16
+ ?>
17
+ <div class="<?php
18
+ switch ($VARS['type']) {
19
+ case 'error':
20
+ echo 'error form-invalid';
21
+ break;
22
+ case 'update-nag':
23
+ echo 'update-nag ';
24
+ break;
25
+ case 'update':
26
+ case 'success':
27
+ default:
28
+ echo 'updated success';
29
+ break;
30
+ }
31
+ ?> fs-notice">
32
+ <?php if ('update-nag' !== $VARS['type']) : ?><p><?php endif ?>
33
+ <?php if (!empty($VARS['title'])) : ?>
34
+ <b><?php echo $VARS['title'] ?></b>
35
+ <?php endif ?>
36
+ <?php echo $VARS['message'] ?>
37
+ <?php if ('update-nag' !== $VARS['type']) : ?></p><?php endif ?>
38
+ <?php if ($VARS['sticky']) : ?><i class="dashicons dashicons-no"></i><?php endif ?>
39
  </div>
freemius/templates/checkout-legacy.php CHANGED
@@ -1,242 +1,242 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.3
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- wp_enqueue_script( 'jquery' );
14
- wp_enqueue_script( 'json2' );
15
- fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.min.js' );
16
- fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
17
- fs_enqueue_local_style( 'fs_common', '/admin/common.css' );
18
-
19
- /**
20
- * @var array $VARS
21
- */
22
- $slug = $VARS['slug'];
23
- $fs = freemius( $slug );
24
-
25
- $timestamp = time();
26
-
27
- $context_params = array(
28
- 'plugin_id' => $fs->get_id(),
29
- 'plugin_public_key' => $fs->get_public_key(),
30
- 'plugin_version' => $fs->get_plugin_version(),
31
- );
32
-
33
- // Get site context secure params.
34
- if ( $fs->is_registered() ) {
35
- $site = $fs->get_site();
36
- $plugin_id = fs_request_get( 'plugin_id', $fs->get_id() );
37
-
38
- if ( $plugin_id != $fs->get_id() ) {
39
- if ( $fs->is_addon_activated( $plugin_id ) ) {
40
- $fs_addon = Freemius::get_instance_by_id( $plugin_id );
41
- $site = $fs_addon->get_site();
42
- }
43
- }
44
-
45
- $context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
46
- $site,
47
- $timestamp,
48
- 'checkout'
49
- ) );
50
- } else {
51
- $current_user = Freemius::_get_current_wp_user();
52
-
53
- // Add site and user info to the request, this information
54
- // is NOT being stored unless the user complete the purchase
55
- // and agrees to the TOS.
56
- $context_params = array_merge( $context_params, array(
57
- 'user_firstname' => $current_user->user_firstname,
58
- 'user_lastname' => $current_user->user_lastname,
59
- 'user_email' => $current_user->user_email,
60
- 'home_url' => home_url(),
61
- ) );
62
-
63
- $fs_user = Freemius::_get_user_by_email( $current_user->user_email );
64
-
65
- if ( is_object( $fs_user ) ) {
66
- $context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
67
- $fs_user,
68
- $timestamp,
69
- 'checkout'
70
- ) );
71
- }
72
- }
73
-
74
- if ( $fs->is_payments_sandbox() ) {
75
- // Append plugin secure token for sandbox mode authentication.
76
- $context_params['sandbox'] = FS_Security::instance()->get_secure_token(
77
- $fs->get_plugin(),
78
- $timestamp,
79
- 'checkout'
80
- );
81
-
82
- /**
83
- * @since 1.1.7.3 Add security timestamp for sandbox even for anonymous user.
84
- */
85
- if ( empty( $context_params['s_ctx_ts'] ) ) {
86
- $context_params['s_ctx_ts'] = $timestamp;
87
- }
88
- }
89
-
90
- $return_url = $fs->_get_sync_license_url( isset( $_GET['plugin_id'] ) ? $_GET['plugin_id'] : $fs->get_id() );
91
-
92
- $query_params = array_merge( $context_params, $_GET, array(
93
- // Current plugin version.
94
- 'plugin_version' => $fs->get_plugin_version(),
95
- 'sdk_version' => WP_FS__SDK_VERSION,
96
- 'return_url' => $return_url,
97
- // Admin CSS URL for style/design competability.
98
- // 'wp_admin_css' => get_bloginfo('wpurl') . "/wp-admin/load-styles.php?c=1&load=buttons,wp-admin,dashicons",
99
- ) );
100
- ?>
101
- <div id="fs_checkout" class="wrap" style="margin: 0 0 -65px -20px;">
102
- <div id="iframe"></div>
103
- <script type="text/javascript">
104
- // http://stackoverflow.com/questions/4583703/jquery-post-request-not-ajax
105
- jQuery(function ($) {
106
- $.extend({
107
- form: function (url, data, method) {
108
- if (method == null) method = 'POST';
109
- if (data == null) data = {};
110
-
111
- var form = $('<form>').attr({
112
- method: method,
113
- action: url
114
- }).css({
115
- display: 'none'
116
- });
117
-
118
- var addData = function (name, data) {
119
- if ($.isArray(data)) {
120
- for (var i = 0; i < data.length; i++) {
121
- var value = data[i];
122
- addData(name + '[]', value);
123
- }
124
- } else if (typeof data === 'object') {
125
- for (var key in data) {
126
- if (data.hasOwnProperty(key)) {
127
- addData(name + '[' + key + ']', data[key]);
128
- }
129
- }
130
- } else if (data != null) {
131
- form.append($('<input>').attr({
132
- type : 'hidden',
133
- name : String(name),
134
- value: String(data)
135
- }));
136
- }
137
- };
138
-
139
- for (var key in data) {
140
- if (data.hasOwnProperty(key)) {
141
- addData(key, data[key]);
142
- }
143
- }
144
-
145
- return form.appendTo('body');
146
- }
147
- });
148
- });
149
-
150
- (function ($) {
151
- $(function () {
152
-
153
- var
154
- // Keep track of the iframe height.
155
- iframe_height = 800,
156
- base_url = '<?php echo WP_FS__ADDRESS ?>',
157
- // Pass the parent page URL into the Iframe in a meaningful way (this URL could be
158
- // passed via query string or hard coded into the child page, it depends on your needs).
159
- src = base_url + '/checkout/?<?php echo ( isset( $_REQUEST['XDEBUG_SESSION'] ) ? 'XDEBUG_SESSION=' . $_REQUEST['XDEBUG_SESSION'] . '&' : '' ) . http_build_query( $query_params ) ?>#' + encodeURIComponent(document.location.href),
160
-
161
- // Append the Iframe into the DOM.
162
- iframe = $('<iframe " src="' + src + '" width="100%" height="' + iframe_height + 'px" scrolling="no" frameborder="0" style="background: transparent;"><\/iframe>')
163
- .appendTo('#iframe');
164
-
165
- FS.PostMessage.init(base_url, [iframe[0]]);
166
- FS.PostMessage.receiveOnce('height', function (data) {
167
- var h = data.height;
168
- if (!isNaN(h) && h > 0 && h != iframe_height) {
169
- iframe_height = h;
170
- iframe.height(iframe_height + 'px');
171
-
172
- FS.PostMessage.postScroll(iframe[0]);
173
- }
174
- });
175
-
176
- FS.PostMessage.receiveOnce('install', function (data) {
177
- // Post data to activation URL.
178
- $.form('<?php echo fs_nonce_url( $fs->_get_admin_page_url( 'account', array(
179
- 'fs_action' => $slug . '_activate_new',
180
- 'plugin_id' => isset( $_GET['plugin_id'] ) ? $_GET['plugin_id'] : $fs->get_id()
181
- ) ), $slug . '_activate_new' ) ?>', {
182
- user_id : data.user.id,
183
- user_secret_key : data.user.secret_key,
184
- user_public_key : data.user.public_key,
185
- install_id : data.install.id,
186
- install_secret_key: data.install.secret_key,
187
- install_public_key: data.install.public_key
188
- }).submit();
189
- });
190
-
191
- FS.PostMessage.receiveOnce('pending_activation', function (data) {
192
- $.form('<?php echo fs_nonce_url( $fs->_get_admin_page_url( 'account', array(
193
- 'fs_action' => $slug . '_activate_new',
194
- 'plugin_id' => fs_request_get( 'plugin_id', $fs->get_id() ),
195
- 'pending_activation' => true,
196
- ) ), $slug . '_activate_new' ) ?>', {
197
- user_email: data.user_email
198
- }).submit();
199
- });
200
-
201
- FS.PostMessage.receiveOnce('get_context', function () {
202
- console.debug('receiveOnce', 'get_context');
203
-
204
- // If the user didn't connect his account with Freemius,
205
- // once he accepts the Terms of Service and Privacy Policy,
206
- // and then click the purchase button, the context information
207
- // of the user will be shared with Freemius in order to complete the
208
- // purchase workflow and activate the license for the right user.
209
- <?php $install_data = array_merge( $fs->get_opt_in_params(),
210
- array(
211
- 'activation_url' => fs_nonce_url( $fs->_get_admin_page_url( '',
212
- array(
213
- 'fs_action' => $slug . '_activate_new',
214
- 'plugin_id' => fs_request_get( 'plugin_id', $fs->get_id() ),
215
-
216
- ) ),
217
- $slug . '_activate_new' )
218
- ) ) ?>
219
- FS.PostMessage.post('context', <?php echo json_encode( $install_data ) ?>, iframe[0]);
220
- });
221
-
222
- FS.PostMessage.receiveOnce('get_dimensions', function (data) {
223
- console.debug('receiveOnce', 'get_dimensions');
224
-
225
- FS.PostMessage.post('dimensions', {
226
- height : $(document.body).height(),
227
- scrollTop: $(document).scrollTop()
228
- }, iframe[0]);
229
- });
230
- });
231
- })(jQuery);
232
- </script>
233
- </div>
234
- <?php
235
- $params = array(
236
- 'page' => 'checkout',
237
- 'module_id' => $fs->get_id(),
238
- 'module_slug' => $slug,
239
- 'module_version' => $fs->get_plugin_version(),
240
- );
241
- fs_require_template( 'powered-by.php', $params );
242
- ?>
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ wp_enqueue_script( 'jquery' );
14
+ wp_enqueue_script( 'json2' );
15
+ fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.min.js' );
16
+ fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
17
+ fs_enqueue_local_style( 'fs_common', '/admin/common.css' );
18
+
19
+ /**
20
+ * @var array $VARS
21
+ */
22
+ $slug = $VARS['slug'];
23
+ $fs = freemius( $slug );
24
+
25
+ $timestamp = time();
26
+
27
+ $context_params = array(
28
+ 'plugin_id' => $fs->get_id(),
29
+ 'plugin_public_key' => $fs->get_public_key(),
30
+ 'plugin_version' => $fs->get_plugin_version(),
31
+ );
32
+
33
+ // Get site context secure params.
34
+ if ( $fs->is_registered() ) {
35
+ $site = $fs->get_site();
36
+ $plugin_id = fs_request_get( 'plugin_id', $fs->get_id() );
37
+
38
+ if ( $plugin_id != $fs->get_id() ) {
39
+ if ( $fs->is_addon_activated( $plugin_id ) ) {
40
+ $fs_addon = Freemius::get_instance_by_id( $plugin_id );
41
+ $site = $fs_addon->get_site();
42
+ }
43
+ }
44
+
45
+ $context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
46
+ $site,
47
+ $timestamp,
48
+ 'checkout'
49
+ ) );
50
+ } else {
51
+ $current_user = Freemius::_get_current_wp_user();
52
+
53
+ // Add site and user info to the request, this information
54
+ // is NOT being stored unless the user complete the purchase
55
+ // and agrees to the TOS.
56
+ $context_params = array_merge( $context_params, array(
57
+ 'user_firstname' => $current_user->user_firstname,
58
+ 'user_lastname' => $current_user->user_lastname,
59
+ 'user_email' => $current_user->user_email,
60
+ 'home_url' => home_url(),
61
+ ) );
62
+
63
+ $fs_user = Freemius::_get_user_by_email( $current_user->user_email );
64
+
65
+ if ( is_object( $fs_user ) ) {
66
+ $context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
67
+ $fs_user,
68
+ $timestamp,
69
+ 'checkout'
70
+ ) );
71
+ }
72
+ }
73
+
74
+ if ( $fs->is_payments_sandbox() ) {
75
+ // Append plugin secure token for sandbox mode authentication.
76
+ $context_params['sandbox'] = FS_Security::instance()->get_secure_token(
77
+ $fs->get_plugin(),
78
+ $timestamp,
79
+ 'checkout'
80
+ );
81
+
82
+ /**
83
+ * @since 1.1.7.3 Add security timestamp for sandbox even for anonymous user.
84
+ */
85
+ if ( empty( $context_params['s_ctx_ts'] ) ) {
86
+ $context_params['s_ctx_ts'] = $timestamp;
87
+ }
88
+ }
89
+
90
+ $return_url = $fs->_get_sync_license_url( isset( $_GET['plugin_id'] ) ? $_GET['plugin_id'] : $fs->get_id() );
91
+
92
+ $query_params = array_merge( $context_params, $_GET, array(
93
+ // Current plugin version.
94
+ 'plugin_version' => $fs->get_plugin_version(),
95
+ 'sdk_version' => WP_FS__SDK_VERSION,
96
+ 'return_url' => $return_url,
97
+ // Admin CSS URL for style/design competability.
98
+ // 'wp_admin_css' => get_bloginfo('wpurl') . "/wp-admin/load-styles.php?c=1&load=buttons,wp-admin,dashicons",
99
+ ) );
100
+ ?>
101
+ <div id="fs_checkout" class="wrap" style="margin: 0 0 -65px -20px;">
102
+ <div id="iframe"></div>
103
+ <script type="text/javascript">
104
+ // http://stackoverflow.com/questions/4583703/jquery-post-request-not-ajax
105
+ jQuery(function ($) {
106
+ $.extend({
107
+ form: function (url, data, method) {
108
+ if (method == null) method = 'POST';
109
+ if (data == null) data = {};
110
+
111
+ var form = $('<form>').attr({
112
+ method: method,
113
+ action: url
114
+ }).css({
115
+ display: 'none'
116
+ });
117
+
118
+ var addData = function (name, data) {
119
+ if ($.isArray(data)) {
120
+ for (var i = 0; i < data.length; i++) {
121
+ var value = data[i];
122
+ addData(name + '[]', value);
123
+ }
124
+ } else if (typeof data === 'object') {
125
+ for (var key in data) {
126
+ if (data.hasOwnProperty(key)) {
127
+ addData(name + '[' + key + ']', data[key]);
128
+ }
129
+ }
130
+ } else if (data != null) {
131
+ form.append($('<input>').attr({
132
+ type : 'hidden',
133
+ name : String(name),
134
+ value: String(data)
135
+ }));
136
+ }
137
+ };
138
+
139
+ for (var key in data) {
140
+ if (data.hasOwnProperty(key)) {
141
+ addData(key, data[key]);
142
+ }
143
+ }
144
+
145
+ return form.appendTo('body');
146
+ }
147
+ });
148
+ });
149
+
150
+ (function ($) {
151
+ $(function () {
152
+
153
+ var
154
+ // Keep track of the iframe height.
155
+ iframe_height = 800,
156
+ base_url = '<?php echo WP_FS__ADDRESS ?>',
157
+ // Pass the parent page URL into the Iframe in a meaningful way (this URL could be
158
+ // passed via query string or hard coded into the child page, it depends on your needs).
159
+ src = base_url + '/checkout/?<?php echo ( isset( $_REQUEST['XDEBUG_SESSION'] ) ? 'XDEBUG_SESSION=' . $_REQUEST['XDEBUG_SESSION'] . '&' : '' ) . http_build_query( $query_params ) ?>#' + encodeURIComponent(document.location.href),
160
+
161
+ // Append the Iframe into the DOM.
162
+ iframe = $('<iframe " src="' + src + '" width="100%" height="' + iframe_height + 'px" scrolling="no" frameborder="0" style="background: transparent;"><\/iframe>')
163
+ .appendTo('#iframe');
164
+
165
+ FS.PostMessage.init(base_url, [iframe[0]]);
166
+ FS.PostMessage.receiveOnce('height', function (data) {
167
+ var h = data.height;
168
+ if (!isNaN(h) && h > 0 && h != iframe_height) {
169
+ iframe_height = h;
170
+ iframe.height(iframe_height + 'px');
171
+
172
+ FS.PostMessage.postScroll(iframe[0]);
173
+ }
174
+ });
175
+
176
+ FS.PostMessage.receiveOnce('install', function (data) {
177
+ // Post data to activation URL.
178
+ $.form('<?php echo fs_nonce_url( $fs->_get_admin_page_url( 'account', array(
179
+ 'fs_action' => $slug . '_activate_new',
180
+ 'plugin_id' => isset( $_GET['plugin_id'] ) ? $_GET['plugin_id'] : $fs->get_id()
181
+ ) ), $slug . '_activate_new' ) ?>', {
182
+ user_id : data.user.id,
183
+ user_secret_key : data.user.secret_key,
184
+ user_public_key : data.user.public_key,
185
+ install_id : data.install.id,
186
+ install_secret_key: data.install.secret_key,
187
+ install_public_key: data.install.public_key
188
+ }).submit();
189
+ });
190
+
191
+ FS.PostMessage.receiveOnce('pending_activation', function (data) {
192
+ $.form('<?php echo fs_nonce_url( $fs->_get_admin_page_url( 'account', array(
193
+ 'fs_action' => $slug . '_activate_new',
194
+ 'plugin_id' => fs_request_get( 'plugin_id', $fs->get_id() ),
195
+ 'pending_activation' => true,
196
+ ) ), $slug . '_activate_new' ) ?>', {
197
+ user_email: data.user_email
198
+ }).submit();
199
+ });
200
+
201
+ FS.PostMessage.receiveOnce('get_context', function () {
202
+ console.debug('receiveOnce', 'get_context');
203
+
204
+ // If the user didn't connect his account with Freemius,
205
+ // once he accepts the Terms of Service and Privacy Policy,
206
+ // and then click the purchase button, the context information
207
+ // of the user will be shared with Freemius in order to complete the
208
+ // purchase workflow and activate the license for the right user.
209
+ <?php $install_data = array_merge( $fs->get_opt_in_params(),
210
+ array(
211
+ 'activation_url' => fs_nonce_url( $fs->_get_admin_page_url( '',
212
+ array(
213
+ 'fs_action' => $slug . '_activate_new',
214
+ 'plugin_id' => fs_request_get( 'plugin_id', $fs->get_id() ),
215
+
216
+ ) ),
217
+ $slug . '_activate_new' )
218
+ ) ) ?>
219
+ FS.PostMessage.post('context', <?php echo json_encode( $install_data ) ?>, iframe[0]);
220
+ });
221
+
222
+ FS.PostMessage.receiveOnce('get_dimensions', function (data) {
223
+ console.debug('receiveOnce', 'get_dimensions');
224
+
225
+ FS.PostMessage.post('dimensions', {
226
+ height : $(document.body).height(),
227
+ scrollTop: $(document).scrollTop()
228
+ }, iframe[0]);
229
+ });
230
+ });
231
+ })(jQuery);
232
+ </script>
233
+ </div>
234
+ <?php
235
+ $params = array(
236
+ 'page' => 'checkout',
237
+ 'module_id' => $fs->get_id(),
238
+ 'module_slug' => $slug,
239
+ 'module_version' => $fs->get_plugin_version(),
240
+ );
241
+ fs_require_template( 'powered-by.php', $params );
242
+ ?>
freemius/templates/contact.php CHANGED
@@ -1,88 +1,88 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.3
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- wp_enqueue_script( 'jquery' );
14
- wp_enqueue_script( 'json2' );
15
- fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.min.js' );
16
- fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
17
- fs_enqueue_local_style( 'fs_checkout', '/admin/common.css' );
18
-
19
- /**
20
- * @var array $VARS
21
- */
22
- $slug = $VARS['slug'];
23
- $fs = freemius( $slug );
24
-
25
- $context_params = array(
26
- 'plugin_id' => $fs->get_id(),
27
- 'plugin_public_key' => $fs->get_public_key(),
28
- 'plugin_version' => $fs->get_plugin_version(),
29
- );
30
-
31
-
32
- // Get site context secure params.
33
- if ( $fs->is_registered() ) {
34
- $context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
35
- $fs->get_site(),
36
- time(),
37
- 'contact'
38
- ) );
39
- }
40
-
41
- $query_params = array_merge( $_GET, array_merge( $context_params, array(
42
- 'plugin_version' => $fs->get_plugin_version(),
43
- 'wp_login_url' => wp_login_url(),
44
- 'site_url' => get_site_url(),
45
- // 'wp_admin_css' => get_bloginfo('wpurl') . "/wp-admin/load-styles.php?c=1&load=buttons,wp-admin,dashicons",
46
- ) ) );
47
- ?>
48
- <div class="fs-secure-notice">
49
- <i class="dashicons dashicons-lock"></i>
50
- <span><b>Secure HTTPS contact page</b>, running via iframe from external domain</span>
51
- </div>
52
- <div id="fs_contact" class="wrap" style="margin: 40px 0 -65px -20px;">
53
- <div id="iframe"></div>
54
- <script type="text/javascript">
55
- (function ($) {
56
- $(function () {
57
-
58
- var
59
- // Keep track of the iframe height.
60
- iframe_height = 800,
61
- base_url = '<?php echo WP_FS__ADDRESS ?>',
62
- src = base_url + '/contact/?<?php echo http_build_query($query_params) ?>#' + encodeURIComponent(document.location.href),
63
-
64
- // Append the Iframe into the DOM.
65
- iframe = $('<iframe " src="' + src + '" width="100%" height="' + iframe_height + 'px" scrolling="no" frameborder="0" style="background: transparent;"><\/iframe>')
66
- .appendTo('#iframe');
67
-
68
- FS.PostMessage.init(base_url);
69
- FS.PostMessage.receive('height', function (data) {
70
- var h = data.height;
71
- if (!isNaN(h) && h > 0 && h != iframe_height) {
72
- iframe_height = h;
73
- $("#iframe iframe").height(iframe_height + 'px');
74
- }
75
- });
76
- });
77
- })(jQuery);
78
- </script>
79
- </div>
80
- <?php
81
- $params = array(
82
- 'page' => 'contact',
83
- 'module_id' => $fs->get_id(),
84
- 'module_slug' => $slug,
85
- 'module_version' => $fs->get_plugin_version(),
86
- );
87
- fs_require_template( 'powered-by.php', $params );
88
  ?>
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ wp_enqueue_script( 'jquery' );
14
+ wp_enqueue_script( 'json2' );
15
+ fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.min.js' );
16
+ fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
17
+ fs_enqueue_local_style( 'fs_checkout', '/admin/common.css' );
18
+
19
+ /**
20
+ * @var array $VARS
21
+ */
22
+ $slug = $VARS['slug'];
23
+ $fs = freemius( $slug );
24
+
25
+ $context_params = array(
26
+ 'plugin_id' => $fs->get_id(),
27
+ 'plugin_public_key' => $fs->get_public_key(),
28
+ 'plugin_version' => $fs->get_plugin_version(),
29
+ );
30
+
31
+
32
+ // Get site context secure params.
33
+ if ( $fs->is_registered() ) {
34
+ $context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
35
+ $fs->get_site(),
36
+ time(),
37
+ 'contact'
38
+ ) );
39
+ }
40
+
41
+ $query_params = array_merge( $_GET, array_merge( $context_params, array(
42
+ 'plugin_version' => $fs->get_plugin_version(),
43
+ 'wp_login_url' => wp_login_url(),
44
+ 'site_url' => get_site_url(),
45
+ // 'wp_admin_css' => get_bloginfo('wpurl') . "/wp-admin/load-styles.php?c=1&load=buttons,wp-admin,dashicons",
46
+ ) ) );
47
+ ?>
48
+ <div class="fs-secure-notice">
49
+ <i class="dashicons dashicons-lock"></i>
50
+ <span><b>Secure HTTPS contact page</b>, running via iframe from external domain</span>
51
+ </div>
52
+ <div id="fs_contact" class="wrap" style="margin: 40px 0 -65px -20px;">
53
+ <div id="iframe"></div>
54
+ <script type="text/javascript">
55
+ (function ($) {
56
+ $(function () {
57
+
58
+ var
59
+ // Keep track of the iframe height.
60
+ iframe_height = 800,
61
+ base_url = '<?php echo WP_FS__ADDRESS ?>',
62
+ src = base_url + '/contact/?<?php echo http_build_query($query_params) ?>#' + encodeURIComponent(document.location.href),
63
+
64
+ // Append the Iframe into the DOM.
65
+ iframe = $('<iframe " src="' + src + '" width="100%" height="' + iframe_height + 'px" scrolling="no" frameborder="0" style="background: transparent;"><\/iframe>')
66
+ .appendTo('#iframe');
67
+
68
+ FS.PostMessage.init(base_url);
69
+ FS.PostMessage.receive('height', function (data) {
70
+ var h = data.height;
71
+ if (!isNaN(h) && h > 0 && h != iframe_height) {
72
+ iframe_height = h;
73
+ $("#iframe iframe").height(iframe_height + 'px');
74
+ }
75
+ });
76
+ });
77
+ })(jQuery);
78
+ </script>
79
+ </div>
80
+ <?php
81
+ $params = array(
82
+ 'page' => 'contact',
83
+ 'module_id' => $fs->get_id(),
84
+ 'module_slug' => $slug,
85
+ 'module_version' => $fs->get_plugin_version(),
86
+ );
87
+ fs_require_template( 'powered-by.php', $params );
88
  ?>
freemius/templates/debug/index.php CHANGED
@@ -1,3 +1,3 @@
1
- <?php
2
- // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
1
+ <?php
2
+ // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
freemius/templates/email.php CHANGED
@@ -1,49 +1,49 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.1.1
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- /**
14
- * @var array $VARS
15
- */
16
- $sections = $VARS['sections'];
17
- ?>
18
- <table>
19
- <?php
20
- foreach ( $sections as $section_id => $section ) {
21
- ?>
22
- <thead>
23
- <tr><th colspan="2" style="text-align: left; background: #333; color: #fff; padding: 5px;"><?php echo esc_html($section['title']) ?></th></tr>
24
- </thead>
25
- <tbody>
26
- <?php
27
- foreach ( $section['rows'] as $row_id => $row ) {
28
- $col_count = count( $row );
29
- ?>
30
- <tr>
31
- <?php
32
- if ( 1 === $col_count ) { ?>
33
- <td style="vertical-align: top;" colspan="2"><?php echo $row[0] ?></td>
34
- <?php
35
- } else { ?>
36
- <td style="vertical-align: top;"><b><?php echo esc_html($row[0]) ?>:</b></td>
37
- <td><?php echo $row[1]; ?></td>
38
- <?php
39
- }
40
- ?>
41
- </tr>
42
- <?php
43
- }
44
- ?>
45
- </tbody>
46
- <?php
47
- }
48
- ?>
49
  </table>
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.1.1
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * @var array $VARS
15
+ */
16
+ $sections = $VARS['sections'];
17
+ ?>
18
+ <table>
19
+ <?php
20
+ foreach ( $sections as $section_id => $section ) {
21
+ ?>
22
+ <thead>
23
+ <tr><th colspan="2" style="text-align: left; background: #333; color: #fff; padding: 5px;"><?php echo esc_html($section['title']) ?></th></tr>
24
+ </thead>
25
+ <tbody>
26
+ <?php
27
+ foreach ( $section['rows'] as $row_id => $row ) {
28
+ $col_count = count( $row );
29
+ ?>
30
+ <tr>
31
+ <?php
32
+ if ( 1 === $col_count ) { ?>
33
+ <td style="vertical-align: top;" colspan="2"><?php echo $row[0] ?></td>
34
+ <?php
35
+ } else { ?>
36
+ <td style="vertical-align: top;"><b><?php echo esc_html($row[0]) ?>:</b></td>
37
+ <td><?php echo $row[1]; ?></td>
38
+ <?php
39
+ }
40
+ ?>
41
+ </tr>
42
+ <?php
43
+ }
44
+ ?>
45
+ </tbody>
46
+ <?php
47
+ }
48
+ ?>
49
  </table>
freemius/templates/firewall-issues-js.php CHANGED
@@ -1,60 +1,60 @@
1
- <?php
2
- /**
3
- * API connectivity issues (CloudFlare's firewall) handler for handling different
4
- * scenarios selected by the user after connectivity issue is detected, by sending
5
- * AJAX call to the server in order to make the actual actions.
6
- *
7
- * @package Freemius
8
- * @copyright Copyright (c) 2015, Freemius, Inc.
9
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
10
- * @since 1.0.9
11
- */
12
-
13
- if ( ! defined( 'ABSPATH' ) ) {
14
- exit;
15
- }
16
- ?>
17
- <script type="text/javascript">
18
- jQuery(document).ready(function ($) {
19
- $('#fs_firewall_issue_options a.fs-resolve').click(function () {
20
- var
21
- error_type = $(this).attr('data-type'),
22
- notice = $(this).parents('.fs-notice'),
23
- slug = notice.attr('data-slug');
24
-
25
- var data = {
26
- action : 'fs_resolve_firewall_issues_' + slug,
27
- slug : slug,
28
- error_type: error_type
29
- };
30
-
31
- if ('squid' === error_type) {
32
- data.hosting_company = prompt('What is the name or URL of your hosting company?');
33
- if (null == data.hosting_company)
34
- return false;
35
-
36
- if ('' === data.hosting_company) {
37
- alert('We won\'t be able to help without knowing your hosting company.');
38
- return false;
39
- }
40
- }
41
-
42
- if ('retry_ping' === error_type) {
43
- data.action = 'fs_retry_connectivity_test_' + slug;
44
- }
45
-
46
- $(this).css({'cursor': 'wait'});
47
-
48
- // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
49
- $.post(ajaxurl, data, function (response) {
50
- if (1 == response) {
51
- // Refresh page on success.
52
- location.reload();
53
- } else if ('http' === response.substr(0, 4)) {
54
- // Ping actually worked, redirect.
55
- window.location = response;
56
- }
57
- });
58
- });
59
- });
60
  </script>
1
+ <?php
2
+ /**
3
+ * API connectivity issues (CloudFlare's firewall) handler for handling different
4
+ * scenarios selected by the user after connectivity issue is detected, by sending
5
+ * AJAX call to the server in order to make the actual actions.
6
+ *
7
+ * @package Freemius
8
+ * @copyright Copyright (c) 2015, Freemius, Inc.
9
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
10
+ * @since 1.0.9
11
+ */
12
+
13
+ if ( ! defined( 'ABSPATH' ) ) {
14
+ exit;
15
+ }
16
+ ?>
17
+ <script type="text/javascript">
18
+ jQuery(document).ready(function ($) {
19
+ $('#fs_firewall_issue_options a.fs-resolve').click(function () {
20
+ var
21
+ error_type = $(this).attr('data-type'),
22
+ notice = $(this).parents('.fs-notice'),
23
+ slug = notice.attr('data-slug');
24
+
25
+ var data = {
26
+ action : 'fs_resolve_firewall_issues_' + slug,
27
+ slug : slug,
28
+ error_type: error_type
29
+ };
30
+
31
+ if ('squid' === error_type) {
32
+ data.hosting_company = prompt('What is the name or URL of your hosting company?');
33
+ if (null == data.hosting_company)
34
+ return false;
35
+
36
+ if ('' === data.hosting_company) {
37
+ alert('We won\'t be able to help without knowing your hosting company.');
38
+ return false;
39
+ }
40
+ }
41
+
42
+ if ('retry_ping' === error_type) {
43
+ data.action = 'fs_retry_connectivity_test_' + slug;
44
+ }
45
+
46
+ $(this).css({'cursor': 'wait'});
47
+
48
+ // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
49
+ $.post(ajaxurl, data, function (response) {
50
+ if (1 == response) {
51
+ // Refresh page on success.
52
+ location.reload();
53
+ } else if ('http' === response.substr(0, 4)) {
54
+ // Ping actually worked, redirect.
55
+ window.location = response;
56
+ }
57
+ });
58
+ });
59
+ });
60
  </script>
freemius/templates/forms/deactivation/index.php CHANGED
@@ -1,3 +1,3 @@
1
- <?php
2
- // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
1
+ <?php
2
+ // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
freemius/templates/forms/index.php CHANGED
@@ -1,3 +1,3 @@
1
- <?php
2
- // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
1
+ <?php
2
+ // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
freemius/templates/index.php CHANGED
@@ -1,3 +1,3 @@
1
- <?php
2
- // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
1
+ <?php
2
+ // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
freemius/templates/plugin-icon.php CHANGED
@@ -1,127 +1,127 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.1.4
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- /**
14
- * @var array $VARS
15
- */
16
- $slug = $VARS['slug'];
17
- $fs = freemius( $slug );
18
-
19
- /**
20
- * @since 1.1.7.5
21
- */
22
- $local_path = $fs->apply_filters( 'plugin_icon', false );
23
-
24
- if ( is_string( $local_path ) ) {
25
- $icons = array( $local_path );
26
- } else {
27
- global $fs_active_plugins;
28
-
29
- $img_dir = WP_FS__DIR_IMG;
30
-
31
- if ( 1 < count( $fs_active_plugins->plugins ) ) {
32
- $plugin_or_theme_img_dir = WP_PLUGIN_DIR;
33
-
34
- foreach ( $fs_active_plugins->plugins as $sdk_path => &$data ) {
35
- if ( $data->plugin_path == $fs->get_plugin_basename() ) {
36
- $img_dir = $plugin_or_theme_img_dir
37
- . '/'
38
- . str_replace( '../themes/', '', $sdk_path )
39
- . '/assets/img';
40
-
41
- break;
42
- }
43
- }
44
- }
45
-
46
- $icons = glob( fs_normalize_path( $img_dir . '/' . $slug . '.*' ) );
47
- if ( ! is_array( $icons ) || 0 === count( $icons ) ) {
48
- $icon_found = false;
49
- $local_path = fs_normalize_path( $img_dir . '/' . $slug . '.png' );
50
-
51
- $have_write_permissions = ( 'direct' === get_filesystem_method( array(), fs_normalize_path( $img_dir ) ) );
52
-
53
- if ( WP_FS__IS_LOCALHOST && $fs->is_org_repo_compliant() && $have_write_permissions ) {
54
- /**
55
- * IMPORTANT: THIS CODE WILL NEVER RUN AFTER THE PLUGIN IS IN THE REPO.
56
- *
57
- * This code will only be executed once during the testing
58
- * of the plugin in a local environment. The plugin icon file WILL
59
- * already exist in the assets folder when the plugin is deployed to
60
- * the repository.
61
- */
62
- if ( ! function_exists( 'plugins_api' ) ) {
63
- require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
64
- }
65
-
66
- $plugin_information = plugins_api( 'plugin_information', array(
67
- 'slug' => $slug,
68
- 'fields' => array(
69
- 'sections' => false,
70
- 'tags' => false,
71
- 'icons' => true
72
- )
73
- ) );
74
-
75
- if (
76
- ! is_wp_error( $plugin_information )
77
- && isset( $plugin_information->icons )
78
- && ! empty( $plugin_information->icons )
79
- ) {
80
- /**
81
- * Get the smallest icon.
82
- *
83
- * @author Leo Fajardo (@leorw)
84
- * @since 1.2.2
85
- */
86
- $icon = end( $plugin_information->icons );
87
-
88
- if ( 0 !== strpos( $icon, 'http' ) ) {
89
- $icon = 'http:' . $icon;
90
- }
91
-
92
- /**
93
- * Get a clean file extension, e.g.: "jpg" and not "jpg?rev=1305765".
94
- *
95
- * @author Leo Fajardo (@leorw)
96
- * @since 1.2.2
97
- */
98
- $ext = pathinfo( strtok( $icon, '?' ), PATHINFO_EXTENSION );
99
-
100
- $local_path = fs_normalize_path( $img_dir . '/' . $slug . '.' . $ext );
101
- fs_download_image( $icon, $local_path );
102
-
103
- $icon_found = true;
104
- }
105
- }
106
-
107
- if ( ! $icon_found ) {
108
- // No icons found, fallback to default icon.
109
- if ( $have_write_permissions ) {
110
- // If have write permissions, copy default icon.
111
- copy( fs_normalize_path( $img_dir . '/plugin-icon.png' ), $local_path );
112
- } else {
113
- // If doesn't have write permissions, use default icon path.
114
- $local_path = fs_normalize_path( $img_dir . '/plugin-icon.png' );
115
- }
116
- }
117
-
118
- $icons = array( $local_path );
119
- }
120
- }
121
-
122
- $icon_dir = dirname( $icons[0] );
123
- $relative_url = fs_img_url( substr( $icons[0], strlen( $icon_dir ) ), $icon_dir );
124
- ?>
125
- <div class="fs-plugin-icon">
126
- <img src="<?php echo $relative_url ?>" width="80" height="80"/>
127
- </div>
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.1.4
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * @var array $VARS
15
+ */
16
+ $slug = $VARS['slug'];
17
+ $fs = freemius( $slug );
18
+
19
+ /**
20
+ * @since 1.1.7.5
21
+ */
22
+ $local_path = $fs->apply_filters( 'plugin_icon', false );
23
+
24
+ if ( is_string( $local_path ) ) {
25
+ $icons = array( $local_path );
26
+ } else {
27
+ global $fs_active_plugins;
28
+
29
+ $img_dir = WP_FS__DIR_IMG;
30
+
31
+ if ( 1 < count( $fs_active_plugins->plugins ) ) {
32
+ $plugin_or_theme_img_dir = WP_PLUGIN_DIR;
33
+
34
+ foreach ( $fs_active_plugins->plugins as $sdk_path => &$data ) {
35
+ if ( $data->plugin_path == $fs->get_plugin_basename() ) {
36
+ $img_dir = $plugin_or_theme_img_dir
37
+ . '/'
38
+ . str_replace( '../themes/', '', $sdk_path )
39
+ . '/assets/img';
40
+
41
+ break;
42
+ }
43
+ }
44
+ }
45
+
46
+ $icons = glob( fs_normalize_path( $img_dir . '/' . $slug . '.*' ) );
47
+ if ( ! is_array( $icons ) || 0 === count( $icons ) ) {
48
+ $icon_found = false;
49
+ $local_path = fs_normalize_path( $img_dir . '/' . $slug . '.png' );
50
+
51
+ $have_write_permissions = ( 'direct' === get_filesystem_method( array(), fs_normalize_path( $img_dir ) ) );
52
+
53
+ if ( WP_FS__IS_LOCALHOST && $fs->is_org_repo_compliant() && $have_write_permissions ) {
54
+ /**
55
+ * IMPORTANT: THIS CODE WILL NEVER RUN AFTER THE PLUGIN IS IN THE REPO.
56
+ *
57
+ * This code will only be executed once during the testing
58
+ * of the plugin in a local environment. The plugin icon file WILL
59
+ * already exist in the assets folder when the plugin is deployed to
60
+ * the repository.
61
+ */
62
+ if ( ! function_exists( 'plugins_api' ) ) {
63
+ require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
64
+ }
65
+
66
+ $plugin_information = plugins_api( 'plugin_information', array(
67
+ 'slug' => $slug,
68
+ 'fields' => array(
69
+ 'sections' => false,
70
+ 'tags' => false,
71
+ 'icons' => true
72
+ )
73
+ ) );
74
+
75
+ if (
76
+ ! is_wp_error( $plugin_information )
77
+ && isset( $plugin_information->icons )
78
+ && ! empty( $plugin_information->icons )
79
+ ) {
80
+ /**
81
+ * Get the smallest icon.
82
+ *
83
+ * @author Leo Fajardo (@leorw)
84
+ * @since 1.2.2
85
+ */
86
+ $icon = end( $plugin_information->icons );
87
+
88
+ if ( 0 !== strpos( $icon, 'http' ) ) {
89
+ $icon = 'http:' . $icon;
90
+ }
91
+
92
+ /**
93
+ * Get a clean file extension, e.g.: "jpg" and not "jpg?rev=1305765".
94
+ *
95
+ * @author Leo Fajardo (@leorw)
96
+ * @since 1.2.2
97
+ */
98
+ $ext = pathinfo( strtok( $icon, '?' ), PATHINFO_EXTENSION );
99
+
100
+ $local_path = fs_normalize_path( $img_dir . '/' . $slug . '.' . $ext );
101
+ fs_download_image( $icon, $local_path );
102
+
103
+ $icon_found = true;
104
+ }
105
+ }
106
+
107
+ if ( ! $icon_found ) {
108
+ // No icons found, fallback to default icon.
109
+ if ( $have_write_permissions ) {
110
+ // If have write permissions, copy default icon.
111
+ copy( fs_normalize_path( $img_dir . '/plugin-icon.png' ), $local_path );
112
+ } else {
113
+ // If doesn't have write permissions, use default icon path.
114
+ $local_path = fs_normalize_path( $img_dir . '/plugin-icon.png' );
115
+ }
116
+ }
117
+
118
+ $icons = array( $local_path );
119
+ }
120
+ }
121
+
122
+ $icon_dir = dirname( $icons[0] );
123
+ $relative_url = fs_img_url( substr( $icons[0], strlen( $icon_dir ) ), $icon_dir );
124
+ ?>
125
+ <div class="fs-plugin-icon">
126
+ <img src="<?php echo $relative_url ?>" width="80" height="80"/>
127
+ </div>
freemius/templates/plugin-info/index.php CHANGED
@@ -1,3 +1,3 @@
1
- <?php
2
- // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
1
+ <?php
2
+ // Silence is golden.
3
  // Hide file structure from users on unprotected servers.
freemius/templates/powered-by.php CHANGED
@@ -1,39 +1,39 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.5
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- $VARS = isset($VARS) ? $VARS : array();
14
-
15
- wp_enqueue_script( 'jquery' );
16
- wp_enqueue_script( 'json2' );
17
- fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.min.js' );
18
- fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
19
- ?>
20
-
21
- <div id="piframe"></div>
22
- <script type="text/javascript">
23
- (function ($) {
24
- $(function () {
25
- var
26
- base_url = '<?php echo WP_FS__ADDRESS ?>',
27
- piframe = $('<iframe id="fs_promo_tab" src="' + base_url + '/promotional-tab/?<?php echo http_build_query($VARS) ?>#' + encodeURIComponent(document.location.href) + '" height="350" width="60" frameborder="0" style=" background: transparent; position: fixed; top: 20%; right: 0;" scrolling="no"></iframe>')
28
- .appendTo('#piframe');
29
-
30
- FS.PostMessage.init(base_url);
31
- FS.PostMessage.receive('state', function (state) {
32
- if ('closed' === state)
33
- $('#fs_promo_tab').css('width', '60px');
34
- else
35
- $('#fs_promo_tab').css('width', '345px');
36
- });
37
- });
38
- })(jQuery);
39
  </script>
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.5
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ $VARS = isset($VARS) ? $VARS : array();
14
+
15
+ wp_enqueue_script( 'jquery' );
16
+ wp_enqueue_script( 'json2' );
17
+ fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.min.js' );
18
+ fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
19
+ ?>
20
+
21
+ <div id="piframe"></div>
22
+ <script type="text/javascript">
23
+ (function ($) {
24
+ $(function () {
25
+ var
26
+ base_url = '<?php echo WP_FS__ADDRESS ?>',
27
+ piframe = $('<iframe id="fs_promo_tab" src="' + base_url + '/promotional-tab/?<?php echo http_build_query($VARS) ?>#' + encodeURIComponent(document.location.href) + '" height="350" width="60" frameborder="0" style=" background: transparent; position: fixed; top: 20%; right: 0;" scrolling="no"></iframe>')
28
+ .appendTo('#piframe');
29
+
30
+ FS.PostMessage.init(base_url);
31
+ FS.PostMessage.receive('state', function (state) {
32
+ if ('closed' === state)
33
+ $('#fs_promo_tab').css('width', '60px');
34
+ else
35
+ $('#fs_promo_tab').css('width', '345px');
36
+ });
37
+ });
38
+ })(jQuery);
39
  </script>
freemius/templates/pricing.php CHANGED
@@ -1,122 +1,122 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
- * @since 1.0.3
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- wp_enqueue_script( 'jquery' );
14
- wp_enqueue_script( 'json2' );
15
- fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.min.js' );
16
- fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
17
-
18
- /**
19
- * @var array $VARS
20
- */
21
- $slug = $VARS['slug'];
22
- $fs = freemius( $slug );
23
- $timestamp = time();
24
-
25
- $context_params = array(
26
- 'plugin_id' => $fs->get_id(),
27
- 'plugin_public_key' => $fs->get_public_key(),
28
- 'plugin_version' => $fs->get_plugin_version(),
29
- );
30
-
31
- // Get site context secure params.
32
- if ( $fs->is_registered() ) {
33
- $context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
34
- $fs->get_site(),
35
- $timestamp,
36
- 'upgrade'
37
- ) );
38
- } else {
39
- $context_params['home_url'] = home_url();
40
- }
41
-
42
- if ( $fs->is_payments_sandbox() ) // Append plugin secure token for sandbox mode authentication.)
43
- {
44
- $context_params['sandbox'] = FS_Security::instance()->get_secure_token(
45
- $fs->get_plugin(),
46
- $timestamp,
47
- 'checkout'
48
- );
49
- }
50
-
51
- $query_params = array_merge( $context_params, $_GET, array(
52
- 'next' => $fs->_get_sync_license_url( false, false ),
53
- 'plugin_version' => $fs->get_plugin_version(),
54
- // Billing cycle.
55
- 'billing_cycle' => fs_request_get( 'billing_cycle', WP_FS__PERIOD_ANNUALLY ),
56
- ) );
57
- ?>
58
- <?php if ( ! $fs->is_registered() ) {
59
- $template_data = array(
60
- 'slug' => $slug,
61
- );
62
- fs_require_template( 'forms/trial-start.php', $template_data);
63
- } ?>
64
- <div id="fs_pricing" class="wrap" style="margin: 0 0 -65px -20px;">
65
- <div id="iframe"></div>
66
- <form action="" method="POST">
67
- <input type="hidden" name="user_id"/>
68
- <input type="hidden" name="user_email"/>
69
- <input type="hidden" name="site_id"/>
70
- <input type="hidden" name="public_key"/>
71
- <input type="hidden" name="secret_key"/>
72
- <input type="hidden" name="action" value="account"/>
73
- </form>
74
-
75
- <script type="text/javascript">
76
- (function ($, undef) {
77
- $(function () {
78
- var
79
- // Keep track of the iframe height.
80
- iframe_height = 800,
81
- base_url = '<?php echo WP_FS__ADDRESS ?>',
82
- // Pass the parent page URL into the Iframe in a meaningful way (this URL could be
83
- // passed via query string or hard coded into the child page, it depends on your needs).
84
- src = base_url + '/pricing/?<?php echo http_build_query( $query_params ) ?>#' + encodeURIComponent(document.location.href),
85
-
86
- // Append the Iframe into the DOM.
87
- iframe = $('<iframe " src="' + src + '" width="100%" height="' + iframe_height + 'px" scrolling="no" frameborder="0" style="background: transparent;"><\/iframe>')
88
- .appendTo('#iframe');
89
-
90
- FS.PostMessage.init(base_url);
91
-
92
- FS.PostMessage.receive('height', function (data) {
93
- var h = data.height;
94
- if (!isNaN(h) && h > 0 && h != iframe_height) {
95
- iframe_height = h;
96
- $("#iframe iframe").height(iframe_height + 'px');
97
- }
98
- });
99
-
100
- FS.PostMessage.receive('get_dimensions', function (data) {
101
- FS.PostMessage.post('dimensions', {
102
- height : $(document.body).height(),
103
- scrollTop: $(document).scrollTop()
104
- }, iframe[0]);
105
- });
106
-
107
- FS.PostMessage.receive('start_trial', function (data) {
108
- openTrialConfirmationModal(data);
109
- });
110
- });
111
- })(jQuery);
112
- </script>
113
- </div>
114
- <?php
115
- $params = array(
116
- 'page' => 'pricing',
117
- 'module_id' => $fs->get_id(),
118
- 'module_slug' => $slug,
119
- 'module_version' => $fs->get_plugin_version(),
120
- );
121
- fs_require_template( 'powered-by.php', $params );
122
  ?>
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ wp_enqueue_script( 'jquery' );
14
+ wp_enqueue_script( 'json2' );
15
+ fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.min.js' );
16
+ fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
17
+
18
+ /**
19
+ * @var array $VARS
20
+ */
21
+ $slug = $VARS['slug'];
22
+ $fs = freemius( $slug );
23
+ $timestamp = time();
24
+
25
+ $context_params = array(
26
+ 'plugin_id' => $fs->get_id(),
27
+ 'plugin_public_key' => $fs->get_public_key(),
28
+ 'plugin_version' => $fs->get_plugin_version(),
29
+ );
30
+
31
+ // Get site context secure params.
32
+ if ( $fs->is_registered() ) {
33
+ $context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
34
+ $fs->get_site(),
35
+ $timestamp,
36
+ 'upgrade'
37
+ ) );
38
+ } else {
39
+ $context_params['home_url'] = home_url();
40
+ }
41
+
42
+ if ( $fs->is_payments_sandbox() ) // Append plugin secure token for sandbox mode authentication.)
43
+ {
44
+ $context_params['sandbox'] = FS_Security::instance()->get_secure_token(
45
+ $fs->get_plugin(),
46
+ $timestamp,
47
+ 'checkout'
48
+ );
49
+ }
50
+
51
+ $query_params = array_merge( $context_params, $_GET, array(
52
+ 'next' => $fs->_get_sync_license_url( false, false ),
53
+ 'plugin_version' => $fs->get_plugin_version(),
54
+ // Billing cycle.
55
+ 'billing_cycle' => fs_request_get( 'billing_cycle', WP_FS__PERIOD_ANNUALLY ),
56
+ ) );
57
+ ?>
58
+ <?php if ( ! $fs->is_registered() ) {
59
+ $template_data = array(
60
+ 'slug' => $slug,
61
+ );
62
+ fs_require_template( 'forms/trial-start.php', $template_data);
63
+ } ?>
64
+ <div id="fs_pricing" class="wrap" style="margin: 0 0 -65px -20px;">
65
+ <div id="iframe"></div>
66
+ <form action="" method="POST">
67
+ <input type="hidden" name="user_id"/>
68
+ <input type="hidden" name="user_email"/>
69
+ <input type="hidden" name="site_id"/>
70
+ <input type="hidden" name="public_key"/>
71
+ <input type="hidden" name="secret_key"/>
72
+ <input type="hidden" name="action" value="account"/>
73
+ </form>
74
+
75
+ <script type="text/javascript">
76
+ (function ($, undef) {
77
+ $(function () {
78
+ var
79
+ // Keep track of the iframe height.
80
+ iframe_height = 800,
81
+ base_url = '<?php echo WP_FS__ADDRESS ?>',
82
+ // Pass the parent page URL into the Iframe in a meaningful way (this URL could be
83
+ // passed via query string or hard coded into the child page, it depends on your needs).
84
+ src = base_url + '/pricing/?<?php echo http_build_query( $query_params ) ?>#' + encodeURIComponent(document.location.href),
85
+
86
+ // Append the Iframe into the DOM.
87
+ iframe = $('<iframe " src="' + src + '" width="100%" height="' + iframe_height + 'px" scrolling="no" frameborder="0" style="background: transparent;"><\/iframe>')
88
+ .appendTo('#iframe');
89
+
90
+ FS.PostMessage.init(base_url);
91
+
92
+ FS.PostMessage.receive('height', function (data) {
93
+ var h = data.height;
94
+ if (!isNaN(h) && h > 0 && h != iframe_height) {
95
+ iframe_height = h;
96
+ $("#iframe iframe").height(iframe_height + 'px');
97
+ }
98
+ });
99
+
100
+ FS.PostMessage.receive('get_dimensions', function (data) {
101
+ FS.PostMessage.post('dimensions', {
102
+ height : $(document.body).height(),
103
+ scrollTop: $(document).scrollTop()
104
+ }, iframe[0]);
105
+ });
106
+
107
+ FS.PostMessage.receive('start_trial', function (data) {
108
+ openTrialConfirmationModal(data);
109
+ });
110
+ });
111
+ })(jQuery);
112
+ </script>
113
+ </div>
114
+ <?php
115
+ $params = array(
116
+ 'page' => 'pricing',
117
+ 'module_id' => $fs->get_id(),
118
+ 'module_slug' => $slug,
119
+ 'module_version' => $fs->get_plugin_version(),
120
+ );
121
+ fs_require_template( 'powered-by.php', $params );
122
  ?>
freemius/templates/sticky-admin-notice-js.php CHANGED
@@ -1,40 +1,40 @@
1
- <?php
2
- /**
3
- * Sticky admin notices JavaScript handler for dismissing notice messages
4
- * by sending AJAX call to the server in order to remove the message from the Database.
5
- *
6
- * @package Freemius
7
- * @copyright Copyright (c) 2015, Freemius, Inc.
8
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
- * @since 1.0.7
10
- */
11
-
12
- if ( ! defined( 'ABSPATH' ) ) {
13
- exit;
14
- }
15
- ?>
16
- <script type="text/javascript" >
17
- jQuery(document).ready(function($) {
18
- $('.fs-notice.fs-sticky .fs-close').click(function(){
19
- var
20
- notice = $(this).parents('.fs-notice'),
21
- id = notice.attr('data-id'),
22
- slug = notice.attr('data-slug');
23
-
24
- notice.fadeOut('fast', function(){
25
- var data = {
26
- action: 'fs_dismiss_notice_action_' + slug,
27
- slug: slug,
28
- message_id: id
29
- };
30
-
31
- // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
32
- $.post(ajaxurl, data, function(response) {
33
-
34
- });
35
-
36
- notice.remove();
37
- });
38
- });
39
- });
40
  </script>
1
+ <?php
2
+ /**
3
+ * Sticky admin notices JavaScript handler for dismissing notice messages
4
+ * by sending AJAX call to the server in order to remove the message from the Database.
5
+ *
6
+ * @package Freemius
7
+ * @copyright Copyright (c) 2015, Freemius, Inc.
8
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+ * @since 1.0.7
10
+ */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ ?>
16
+ <script type="text/javascript" >
17
+ jQuery(document).ready(function($) {
18
+ $('.fs-notice.fs-sticky .fs-close').click(function(){
19
+ var
20
+ notice = $(this).parents('.fs-notice'),
21
+ id = notice.attr('data-id'),
22
+ slug = notice.attr('data-slug');
23
+
24
+ notice.fadeOut('fast', function(){
25
+ var data = {
26
+ action: 'fs_dismiss_notice_action_' + slug,
27
+ slug: slug,
28
+ message_id: id
29
+ };
30
+
31
+ // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
32
+ $.post(ajaxurl, data, function(response) {
33
+
34
+ });
35
+
36
+ notice.remove();
37
+ });
38
+ });
39
+ });
40
  </script>
includes/product.helper.php CHANGED
@@ -524,7 +524,7 @@ class TInvWL_Product {
524
  $meta = array();
525
  }
526
  $meta = apply_filters( 'tinvwl_product_prepare_meta', $meta );
527
- foreach ( array( 'add-to-cart', 'product_id', 'variation_id', 'quantity' ) as $field ) {
528
  if ( array_key_exists( $field, $meta ) ) {
529
  unset( $meta[ $field ] );
530
  }
524
  $meta = array();
525
  }
526
  $meta = apply_filters( 'tinvwl_product_prepare_meta', $meta );
527
+ foreach ( array( 'add-to-cart', 'product_id', 'variation_id', 'quantity', 'undefined' ) as $field ) {
528
  if ( array_key_exists( $field, $meta ) ) {
529
  unset( $meta[ $field ] );
530
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://templateinvaders.com/?utm_source=wordpressorg&utm_content=d
4
  Tags: wishlist, woocommerce, products, e-commerce, shop, ecommerce wishlist, woocommerce wishlist, woocommerce , shop wishlist, wishlist for Woocommerce
5
  Requires at least: 4.5
6
  Tested up to: 4.8
7
- Stable tag: 1.5.0
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -125,6 +125,14 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
125
 
126
  == Changelog ==
127
 
 
 
 
 
 
 
 
 
128
  = 1.5.0 =
129
  *Release Date - 11 August 2017*
130
 
4
  Tags: wishlist, woocommerce, products, e-commerce, shop, ecommerce wishlist, woocommerce wishlist, woocommerce , shop wishlist, wishlist for Woocommerce
5
  Requires at least: 4.5
6
  Tested up to: 4.8
7
+ Stable tag: 1.5.1
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
125
 
126
  == Changelog ==
127
 
128
+ = 1.5.1 =
129
+ *Release Date - 14 August 2017*
130
+
131
+ * Fixed a fatal error on Dashboard menu
132
+ * Minor CSS fixes
133
+ * Added support for plugins/woocommerce add-ons:
134
+ * WooCommerce Quantity Increment
135
+
136
  = 1.5.0 =
137
  *Release Date - 11 August 2017*
138
 
templates/ti-wishlist-user.php CHANGED
@@ -107,7 +107,7 @@ if ( ! defined( 'ABSPATH' ) ) {
107
  if ( ! array_key_exists( 'class', $availability ) ) {
108
  $availability['class'] = '';
109
  }
110
- $availability_html = empty( $availability['availability'] ) ? '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="fa fa-check"></i></span><span class="tinvwl-txt">' . esc_html__( 'In stock', 'ti-woocommerce-wishlist-premium' ) . '</span></p>' : '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="fa fa-times"></i></span><span>' . esc_html( $availability['availability'] ) . '</span></p>';
111
 
112
  echo apply_filters( 'tinvwl_wishlist_item_status', $availability_html, $availability['availability'], $wl_product, $product ); // WPCS: xss ok.
113
  ?>
107
  if ( ! array_key_exists( 'class', $availability ) ) {
108
  $availability['class'] = '';
109
  }
110
+ $availability_html = empty( $availability['availability'] ) ? '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="fa fa-check"></i></span><span class="tinvwl-txt">' . esc_html__( 'In stock', 'ti-woocommerce-wishlist-premium' ) . '</span></p>' : '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="fa fa-check"></i></span><span>' . esc_html( $availability['availability'] ) . '</span></p>';
111
 
112
  echo apply_filters( 'tinvwl_wishlist_item_status', $availability_html, $availability['availability'], $wl_product, $product ); // WPCS: xss ok.
113
  ?>
templates/ti-wishlist.php CHANGED
@@ -111,7 +111,7 @@ if ( ! defined( 'ABSPATH' ) ) {
111
  if ( ! array_key_exists( 'class', $availability ) ) {
112
  $availability['class'] = '';
113
  }
114
- $availability_html = empty( $availability['availability'] ) ? '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="fa fa-check"></i></span><span class="tinvwl-txt">' . esc_html__( 'In stock', 'ti-woocommerce-wishlist-premium' ) . '</span></p>' : '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="fa fa-times"></i></span><span>' . esc_html( $availability['availability'] ) . '</span></p>';
115
 
116
  echo apply_filters( 'tinvwl_wishlist_item_status', $availability_html, $availability['availability'], $wl_product, $product ); // WPCS: xss ok.
117
  ?>
111
  if ( ! array_key_exists( 'class', $availability ) ) {
112
  $availability['class'] = '';
113
  }
114
+ $availability_html = empty( $availability['availability'] ) ? '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="fa fa-check"></i></span><span class="tinvwl-txt">' . esc_html__( 'In stock', 'ti-woocommerce-wishlist-premium' ) . '</span></p>' : '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="fa fa-check"></i></span><span>' . esc_html( $availability['availability'] ) . '</span></p>';
115
 
116
  echo apply_filters( 'tinvwl_wishlist_item_status', $availability_html, $availability['availability'], $wl_product, $product ); // WPCS: xss ok.
117
  ?>
ti-woocommerce-wishlist.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: WooCommerce Wishlist Plugin
5
  * Plugin URI: https://wordpress.org/plugins/ti-woocommerce-wishlist/
6
  * Description: Wishlist functionality for your WooCommerce store.
7
- * Version: 1.5.0
8
  * Author: TemplateInvaders
9
  * Author URI: https://templateinvaders.com/
10
  * License: GPL-2.0+
@@ -37,7 +37,7 @@ if ( ! defined( 'TINVWL_DOMAIN' ) ) {
37
  }
38
 
39
  if ( ! defined( 'TINVWL_FVERSION' ) ) {
40
- define( 'TINVWL_FVERSION', '1.5.0' );
41
  }
42
 
43
  if ( ! defined( 'TINVWL_LOAD_FREE' ) ) {
4
  * Plugin Name: WooCommerce Wishlist Plugin
5
  * Plugin URI: https://wordpress.org/plugins/ti-woocommerce-wishlist/
6
  * Description: Wishlist functionality for your WooCommerce store.
7
+ * Version: 1.5.1
8
  * Author: TemplateInvaders
9
  * Author URI: https://templateinvaders.com/
10
  * License: GPL-2.0+
37
  }
38
 
39
  if ( ! defined( 'TINVWL_FVERSION' ) ) {
40
+ define( 'TINVWL_FVERSION', '1.5.1' );
41
  }
42
 
43
  if ( ! defined( 'TINVWL_LOAD_FREE' ) ) {