Widgets for SiteOrigin - Version 1.3.0

Version Description

  • October 30 2016 =
  • Added new template design options to Person Widget.
  • Added new template design options to Testimonial Widget.
  • Added option to choose from all available image sizes for Blog Widget.
  • Major update to Slider Widget.
  • Fixed bug in Circle Counter Widget.
  • Removed freemius from plugin.
  • Changed help link to new docs.
  • Other minor bug fixes.
Download this release

Release Info

Developer iamadi
Plugin Icon 128x128 Widgets for SiteOrigin
Version 1.3.0
Comparing to
See all releases

Code changes from version 1.2.4 to 1.3.0

Files changed (187) hide show
  1. admin/admin.css +221 -0
  2. admin/admin.php +166 -0
  3. admin/img/animation.jpg +0 -0
  4. admin/img/blog-enhanced.jpg +0 -0
  5. admin/img/blog-slider.jpg +0 -0
  6. admin/img/chart.jpg +0 -0
  7. admin/img/coming-soon.jpg +0 -0
  8. admin/img/go-pro.jpg +0 -0
  9. admin/img/helpscout-beacon-docs.png +0 -0
  10. admin/img/helpscout-beacon-message.png +0 -0
  11. admin/img/helpscout-beacon.png +0 -0
  12. admin/img/menu-icon.png +0 -0
  13. admin/img/plugin-logo.png +0 -0
  14. admin/img/prsn-testi-sliders.jpg +0 -0
  15. freemius/LICENSE.txt +0 -340
  16. freemius/README.md +0 -250
  17. freemius/assets/css/admin/account.css +0 -1
  18. freemius/assets/css/admin/add-ons.css +0 -2
  19. freemius/assets/css/admin/common.css +0 -1
  20. freemius/assets/css/admin/connect.css +0 -1
  21. freemius/assets/css/admin/deactivation-feedback.css +0 -1
  22. freemius/assets/css/admin/debug.css +0 -1
  23. freemius/assets/css/admin/dialog-boxes.css +0 -3
  24. freemius/assets/css/admin/license-activation.css +0 -1
  25. freemius/assets/css/common.css +0 -1
  26. freemius/assets/img/plugin-icon.png +0 -0
  27. freemius/assets/scss/_colors.scss +0 -58
  28. freemius/assets/scss/_functions.scss +0 -0
  29. freemius/assets/scss/_load.scss +0 -4
  30. freemius/assets/scss/_mixins.scss +0 -224
  31. freemius/assets/scss/_start.scss +0 -4
  32. freemius/assets/scss/_vars.scss +0 -5
  33. freemius/assets/scss/admin/_deactivation-feedback.scss +0 -42
  34. freemius/assets/scss/admin/_license-activation.scss +0 -7
  35. freemius/assets/scss/admin/_license-key-resend.scss +0 -35
  36. freemius/assets/scss/admin/_modal-common.scss +0 -104
  37. freemius/assets/scss/admin/account.scss +0 -184
  38. freemius/assets/scss/admin/add-ons.scss +0 -449
  39. freemius/assets/scss/admin/common.scss +0 -134
  40. freemius/assets/scss/admin/connect.scss +0 -471
  41. freemius/assets/scss/admin/debug.scss +0 -91
  42. freemius/assets/scss/admin/dialog-boxes.scss +0 -4
  43. freemius/composer.json +0 -10
  44. freemius/config.php +0 -229
  45. freemius/includes/class-freemius-abstract.php +0 -454
  46. freemius/includes/class-freemius.php +0 -10148
  47. freemius/includes/class-fs-api.php +0 -455
  48. freemius/includes/class-fs-logger.php +0 -179
  49. freemius/includes/class-fs-plugin-updater.php +0 -334
  50. freemius/includes/class-fs-security.php +0 -61
  51. freemius/includes/debug/class-fs-debug-bar-panel.php +0 -64
  52. freemius/includes/debug/debug-bar-start.php +0 -52
  53. freemius/includes/entities/class-fs-entity.php +0 -149
  54. freemius/includes/entities/class-fs-payment.php +0 -94
  55. freemius/includes/entities/class-fs-plugin-info.php +0 -34
  56. freemius/includes/entities/class-fs-plugin-license.php +0 -194
  57. freemius/includes/entities/class-fs-plugin-plan.php +0 -140
  58. freemius/includes/entities/class-fs-plugin-tag.php +0 -24
  59. freemius/includes/entities/class-fs-plugin.php +0 -90
  60. freemius/includes/entities/class-fs-pricing.php +0 -141
  61. freemius/includes/entities/class-fs-scope-entity.php +0 -29
  62. freemius/includes/entities/class-fs-site.php +0 -127
  63. freemius/includes/entities/class-fs-subscription.php +0 -125
  64. freemius/includes/entities/class-fs-user.php +0 -62
  65. freemius/includes/fs-core-functions.php +0 -453
  66. freemius/includes/fs-essential-functions.php +0 -412
  67. freemius/includes/fs-plugin-info-dialog.php +0 -936
  68. freemius/includes/i18n.php +0 -384
  69. freemius/includes/managers/class-fs-admin-menu-manager.php +0 -549
  70. freemius/includes/managers/class-fs-admin-notice-manager.php +0 -310
  71. freemius/includes/managers/class-fs-cache-manager.php +0 -237
  72. freemius/includes/managers/class-fs-key-value-storage.php +0 -326
  73. freemius/includes/managers/class-fs-license-manager.php +0 -101
  74. freemius/includes/managers/class-fs-option-manager.php +0 -302
  75. freemius/includes/managers/class-fs-plan-manager.php +0 -162
  76. freemius/includes/managers/class-fs-plugin-manager.php +0 -154
  77. freemius/includes/sdk/Exceptions/ArgumentNotExistException.php +0 -6
  78. freemius/includes/sdk/Exceptions/EmptyArgumentException.php +0 -6
  79. freemius/includes/sdk/Exceptions/Exception.php +0 -75
  80. freemius/includes/sdk/Exceptions/InvalidArgumentException.php +0 -6
  81. freemius/includes/sdk/Exceptions/OAuthException.php +0 -12
  82. freemius/includes/sdk/Freemius.php +0 -576
  83. freemius/includes/sdk/FreemiusBase.php +0 -178
  84. freemius/includes/sdk/LICENSE.txt +0 -340
  85. freemius/includes/supplements/fs-essential-functions-1.1.7.1.php +0 -45
  86. freemius/require.php +0 -43
  87. freemius/start.php +0 -310
  88. freemius/templates/account.php +0 -688
  89. freemius/templates/add-ons.php +0 -152
  90. freemius/templates/admin-notice.php +0 -46
  91. freemius/templates/all-admin-notice.php +0 -35
  92. freemius/templates/billing.php +0 -106
  93. freemius/templates/checkout.php +0 -262
  94. freemius/templates/connect.php +0 -346
  95. freemius/templates/contact.php +0 -85
  96. freemius/templates/debug.php +0 -295
  97. freemius/templates/debug/api-calls.php +0 -138
  98. freemius/templates/debug/logger.php +0 -60
  99. freemius/templates/debug/plugins-themes-sync.php +0 -68
  100. freemius/templates/debug/scheduled-crons.php +0 -100
  101. freemius/templates/email.php +0 -46
  102. freemius/templates/firewall-issues-js.php +0 -60
  103. freemius/templates/forms/deactivation/contact.php +0 -20
  104. freemius/templates/forms/deactivation/form.php +0 -311
  105. freemius/templates/forms/deactivation/retry-skip.php +0 -21
  106. freemius/templates/forms/license-activation.php +0 -211
  107. freemius/templates/forms/resend-key.php +0 -203
  108. freemius/templates/plugin-icon.php +0 -93
  109. freemius/templates/plugin-info/description.php +0 -75
  110. freemius/templates/plugin-info/features.php +0 -97
  111. freemius/templates/plugin-info/screenshots.php +0 -33
  112. freemius/templates/powered-by.php +0 -39
  113. freemius/templates/pricing.php +0 -108
  114. freemius/templates/sticky-admin-notice-js.php +0 -40
  115. inc/enqueue.php +1 -0
  116. inc/functions.php +42 -2
  117. inc/template-functions.php +108 -0
  118. readme.txt +46 -24
  119. widgets-for-siteorigin.php +7 -32
  120. widgets/ink-alrt-widget/assets/banner.svg +11 -11
  121. widgets/ink-alrt-widget/ink-alrt-widget.php +1 -1
  122. widgets/ink-ardn-widget/assets/banner.svg +11 -11
  123. widgets/ink-ardn-widget/ink-ardn-widget.php +1 -1
  124. widgets/ink-ardn-widget/js/accordion.js +19 -3
  125. widgets/ink-ardn-widget/js/accordion.min.js +1 -1
  126. widgets/ink-ardn-widget/tpl/accordion.php +1 -1
  127. widgets/ink-auds-widget/assets/banner.svg +15 -15
  128. widgets/ink-auds-widget/ink-auds-widget.php +1 -1
  129. widgets/ink-barc-widget/assets/banner.svg +17 -13
  130. widgets/ink-barc-widget/ink-barc-widget.php +2 -3
  131. widgets/ink-blgs-widget/assets/banner.svg +21 -17
  132. widgets/ink-blgs-widget/css/blog.css +4 -1
  133. widgets/ink-blgs-widget/ink-blgs-widget.php +45 -32
  134. widgets/ink-blgs-widget/styles/thumb-above.less +5 -0
  135. widgets/ink-blgs-widget/styles/thumb-behind.less +5 -0
  136. widgets/ink-blgs-widget/styles/thumb-left.less +5 -0
  137. widgets/ink-blgs-widget/styles/thumb-none.less +5 -0
  138. widgets/ink-blgs-widget/styles/thumb-right.less +5 -0
  139. widgets/ink-blgs-widget/tpl/thumb-above.php +2 -2
  140. widgets/ink-blgs-widget/tpl/thumb-behind.php +2 -2
  141. widgets/ink-blgs-widget/tpl/thumb-left.php +2 -2
  142. widgets/ink-blgs-widget/tpl/thumb-none.php +2 -2
  143. widgets/ink-blgs-widget/tpl/thumb-right.php +2 -2
  144. widgets/ink-btns-widget/assets/banner.svg +18 -14
  145. widgets/ink-btns-widget/ink-btns-widget.php +1 -1
  146. widgets/ink-crlc-widget/assets/banner.svg +16 -15
  147. widgets/ink-crlc-widget/ink-crlc-widget.php +2 -3
  148. widgets/ink-crlc-widget/js/circle-counter.js +1 -0
  149. widgets/ink-crlc-widget/js/circle-counter.min.js +1 -1
  150. widgets/ink-dvdr-widget/assets/banner.svg +17 -13
  151. widgets/ink-dvdr-widget/ink-dvdr-widget.php +5 -9
  152. widgets/ink-fard-widget/assets/banner.svg +21 -17
  153. widgets/ink-fard-widget/css/filter-accordion.css +11 -11
  154. widgets/ink-fard-widget/ink-fard-widget.php +3 -3
  155. widgets/ink-fard-widget/js/filter-accordion.js +2 -2
  156. widgets/ink-fard-widget/js/filter-accordion.min.js +1 -1
  157. widgets/ink-fard-widget/styles/filter-accordion.less +2 -2
  158. widgets/ink-fard-widget/tpl/filter-accordion.php +1 -1
  159. widgets/ink-mbox-widget/assets/banner.svg +18 -14
  160. widgets/ink-mbox-widget/ink-mbox-widget.php +4 -7
  161. widgets/ink-numc-widget/assets/banner.svg +15 -11
  162. widgets/ink-numc-widget/ink-numc-widget.php +2 -3
  163. widgets/ink-prit-widget/assets/banner.svg +15 -11
  164. widgets/ink-prit-widget/ink-prit-widget.php +1 -1
  165. widgets/ink-prsn-widget/assets/banner.svg +16 -12
  166. widgets/ink-prsn-widget/css/person.css +82 -48
  167. widgets/ink-prsn-widget/ink-prsn-widget.php +19 -1
  168. widgets/ink-prsn-widget/styles/person.less +8 -0
  169. widgets/ink-prsn-widget/tpl/person.php +1 -45
  170. widgets/ink-ptfl-widget/assets/banner.svg +26 -17
  171. widgets/ink-ptfl-widget/ink-ptfl-widget.php +1 -1
  172. widgets/ink-ptfl-widget/js/portfolio.js +10 -6
  173. widgets/ink-ptfl-widget/js/portfolio.min.js +1 -1
  174. widgets/ink-sldr-widget/assets/banner.svg +28 -0
  175. widgets/ink-sldr-widget/css/slider.css +23 -0
  176. widgets/ink-sldr-widget/ink-sldr-widget.php +183 -118
  177. widgets/ink-sldr-widget/styles/slider.less +49 -7
  178. widgets/ink-sldr-widget/tpl/slider.php +6 -0
  179. widgets/ink-tabb-widget/assets/banner.svg +18 -10
  180. widgets/ink-tabb-widget/ink-tabb-widget.php +1 -1
  181. widgets/ink-tsml-widget/assets/banner.svg +20 -16
  182. widgets/ink-tsml-widget/css/testimonial.css +37 -0
  183. widgets/ink-tsml-widget/ink-tsml-widget.php +110 -93
  184. widgets/ink-tsml-widget/styles/testimonial.less +6 -0
  185. widgets/ink-tsml-widget/tpl/testimonial.php +1 -35
  186. widgets/ink-vids-widget/assets/banner.svg +14 -10
  187. widgets/ink-vids-widget/ink-vids-widget.php +1 -1
admin/admin.css ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import url('https://fonts.googleapis.com/css?family=Open+Sans:300,400');
2
+
3
+ .iw-admin-page {
4
+ padding: 0 40px;
5
+ font-family: 'Open Sans', sans-serif;
6
+ }
7
+
8
+ .iw-admin-page h1,
9
+ .iw-admin-page h2 {
10
+ font-weight: 300;
11
+ }
12
+
13
+ .iw-page-header {
14
+ position: relative;
15
+ margin-bottom: 50px;
16
+ }
17
+
18
+ .iw-page-header-text {
19
+ margin-right: 150px;
20
+ }
21
+
22
+ .iw-page-header-logo {
23
+ position: absolute;
24
+ top: 0;
25
+ right: 0;
26
+ }
27
+
28
+ @media ( max-width: 600px ) {
29
+ .iw-page-header-text {
30
+ margin-right: 0;
31
+ }
32
+
33
+ .iw-admin-welcome {
34
+ margin-right: 100px !important;
35
+ }
36
+
37
+ .iw-page-header img {
38
+ width: 90px;
39
+ }
40
+ }
41
+
42
+ .iw-admin-page p,
43
+ .iw-admin-page li {
44
+ color: #555d66;
45
+ font-weight: 400;
46
+ line-height: 1.6em;
47
+ font-size: 20px;
48
+ }
49
+
50
+ .iw-admin-page .iw-admin-welcome {
51
+ margin: 25px 0;
52
+ padding: 0;
53
+ color: #32373c;
54
+ line-height: 1.2em;
55
+ font-size: 45px;
56
+ }
57
+
58
+ .iw-admin-page .iw-admin-rate {
59
+ font-size: 20px;
60
+ font-weight: 300;
61
+ }
62
+
63
+ @media ( max-width: 768px ) {
64
+ .iw-admin-page .iw-admin-rate {
65
+ font-size: 15px;
66
+ }
67
+ }
68
+
69
+ .iw-admin-page {
70
+ width: 90%;
71
+ margin: 0 auto;
72
+ }
73
+
74
+ @media ( max-width: 768px ) {
75
+ .iw-admin-page {
76
+ width: 97%;
77
+ padding: 0;
78
+ }
79
+ }
80
+
81
+ .iw-page-content img {
82
+ max-width: 100%;
83
+ }
84
+
85
+ .iw-page-content center,
86
+ .iw-page-content .premium-upgrade,
87
+ .iw-page-content .get-it-now {
88
+ background: #fff;
89
+ margin-bottom: 30px;
90
+ padding: 50px;
91
+ }
92
+
93
+ @media ( max-width: 768px ) {
94
+ .iw-page-content center,
95
+ .iw-page-content .premium-upgrade,
96
+ .iw-page-content .get-it-now {
97
+ padding: 15px;
98
+ }
99
+ }
100
+
101
+ .iw-page-content .get-it-now {
102
+ text-align: center;
103
+ }
104
+
105
+ .iw-page-content .get-it-now .upgrade-link {
106
+ padding: 15px 30px;
107
+ background: #e40046;
108
+ color: #fff;
109
+ text-decoration: none;
110
+ font-size: 15px;
111
+ letter-spacing: 1px;
112
+ display: inline-block;
113
+ outline: none;
114
+ }
115
+
116
+ .iw-page-content .get-it-now .docs-support-link,
117
+ .iw-page-content .get-it-now .demo-link {
118
+ padding: 15px 30px;
119
+ margin-left: 10px;
120
+ background: #232323;
121
+ color: #fff;
122
+ text-decoration: none;
123
+ font-size: 15px;
124
+ letter-spacing: 1px;
125
+ display: inline-block;
126
+ outline: none;
127
+ }
128
+
129
+ .iw-page-content .button-primary,
130
+ .iw-page-content .button-primary:hover,
131
+ .iw-page-content .button-primary:focus {
132
+ padding: 10px 20px;
133
+ background: #e40046;
134
+ color: #fff;
135
+ text-decoration: none;
136
+ font-size: 12px;
137
+ letter-spacing: 1px;
138
+ display: inline-block;
139
+ outline: none;
140
+ border-width: 0;
141
+ box-shadow: none;
142
+ -webkit-box-shadow: none;
143
+ text-shadow: none;
144
+ line-height: 1;
145
+ height: auto;
146
+ text-transform: uppercase;
147
+ }
148
+
149
+ .iw-page-content .button-secondary,
150
+ .iw-page-content .button-secondary:hover,
151
+ .iw-page-content .button-secondary:focus {
152
+ padding: 10px 20px;
153
+ background: #232323;
154
+ color: #fff;
155
+ text-decoration: none;
156
+ font-size: 12px;
157
+ letter-spacing: 1px;
158
+ display: inline-block;
159
+ outline: none;
160
+ border-width: 0;
161
+ box-shadow: none;
162
+ -webkit-box-shadow: none;
163
+ text-shadow: none;
164
+ line-height: 1;
165
+ height: auto;
166
+ }
167
+
168
+ .iw-admin-page.pro-license .iw-page-content {
169
+ background: #fff;
170
+ margin-bottom: 30px;
171
+ padding: 50px;
172
+ }
173
+
174
+ .iw-admin-page.pro-license .description {
175
+ font-size: 11px;
176
+ }
177
+
178
+ .iw-page-content .premium-upgrade .premium-upgrade-text {
179
+ font-size: 45px;
180
+ color: #232323;
181
+ margin: 0;
182
+ text-align: center;
183
+ }
184
+
185
+ .iw-so-admin-changelog li {
186
+ font-size: 18px;
187
+ line-height: 1.5;
188
+ color: #555d66;
189
+ }
190
+
191
+ .iw-so-admin-changelog li {
192
+ font-weight: bold;
193
+ margin-bottom: 40px;
194
+ }
195
+
196
+ .iw-so-admin-changelog ul {
197
+ margin-left: 45px;
198
+ list-style: disc;
199
+ }
200
+
201
+ .iw-so-admin-changelog ul li {
202
+ font-weight: lighter;
203
+ padding: 5px 0;
204
+ margin-bottom: 0;
205
+ font-size: 16px;
206
+ }
207
+
208
+ .iw-admin-page .use-beacon {
209
+ font-size: 15px;
210
+ }
211
+
212
+ .iw-admin-page.docs-support img {
213
+ margin-bottom: 50px;
214
+ }
215
+
216
+ @media ( max-width: 1300px ) {
217
+ .iw-admin-page.docs-support img {
218
+ display: block;
219
+ margin: 0 auto;
220
+ }
221
+ }
admin/admin.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Weclome Page Class
4
+ *
5
+ * @since 1.3.0
6
+ */
7
+
8
+ // Exit if accessed directly
9
+ if ( ! defined( 'ABSPATH' ) ) exit;
10
+
11
+ function wpinked_so_admin_page() {
12
+ add_menu_page(
13
+ 'Widgets for SiteOrigin',
14
+ __( 'WPinked Widgets', 'wpinked-widgets' ),
15
+ 'manage_options',
16
+ 'wpinked-widgets',
17
+ 'wpinked_so_admin_page_content',
18
+ plugin_dir_url(__FILE__) . 'img/menu-icon.png',
19
+ 99
20
+ );
21
+
22
+ add_submenu_page(
23
+ 'wpinked-widgets',
24
+ 'Upgrade to Pro',
25
+ __( 'Get Addons', 'wpinked-widgets' ),
26
+ 'manage_options',
27
+ 'wpinked-widgets',
28
+ 'wpinked_so_admin_page_content'
29
+ );
30
+
31
+ add_submenu_page(
32
+ 'wpinked-widgets',
33
+ 'Docs & Support',
34
+ __( 'Docs & Support', 'wpinked-widgets' ),
35
+ 'manage_options',
36
+ 'wpinked-widgets-docs-support',
37
+ 'wpinked_so_admin_page_docs_support'
38
+ );
39
+ }
40
+ add_action( 'admin_menu', 'wpinked_so_admin_page' );
41
+
42
+ function wpinked_so_admin_beacon( $screen ) {
43
+
44
+ $screen = get_current_screen();
45
+ if ( strpos( $screen->id, 'wpinked-widgets-docs-support') == false ) return;
46
+ $current_user = wp_get_current_user(); ?>
47
+
48
+ <script>
49
+
50
+ !function(e,o,n){window.HSCW=o,window.HS=n,n.beacon=n.beacon||{};var t=n.beacon;t.userConfig={},t.readyQueue=[],t.config=function(e){this.userConfig=e},t.ready=function(e){this.readyQueue.push(e)},o.config={docs:{enabled:!0,baseUrl:"//wpinked-widgets.helpscoutdocs.com/"},contact:{enabled:!0,formId:"6a408b97-9b94-11e6-91aa-0a5fecc78a4d"}};var r=e.getElementsByTagName("script")[0],c=e.createElement("script");c.type="text/javascript",c.async=!0,c.src="https://djtflbt20bdde.cloudfront.net/",r.parentNode.insertBefore(c,r)}(document,window.HSCW||{},window.HS||{});
51
+
52
+ HS.beacon.config( {
53
+ color: '#e40046',
54
+ icon: 'beacon',
55
+ topArticles: true,
56
+ topics: [
57
+ { val: 'technical-support', label: 'Technical Support' },
58
+ { val: 'billing', label: 'Billing'},
59
+ { val: 'feature-request', label: 'Feature Request' },
60
+ { val: 'customization', label: 'Customization'},
61
+ { val: 'pre-sale', label: 'Pre-Sale Question' },
62
+ { val: 'bug', label: 'Bug'},
63
+ { val: 'other', label: 'Other'}
64
+ ],
65
+ attachment: true,
66
+ instructions:'We will be with you as soon as we are able.'
67
+ } );
68
+
69
+ HS.beacon.ready( function() {
70
+ HS.beacon.identify( {
71
+ name: '<?php echo $current_user->display_name; ?>',
72
+ email: '<?php echo $current_user->user_email; ?>',
73
+ } );
74
+ } );
75
+
76
+ </script>
77
+ <?php }
78
+ add_action( 'admin_footer', 'wpinked_so_admin_beacon' );
79
+
80
+ function wpinked_so_admin_page_content() {
81
+ ?>
82
+ <div class="iw-admin-page">
83
+
84
+ <div class="iw-page-header">
85
+
86
+ <div class="iw-page-header-text">
87
+
88
+ <h1 class="iw-admin-welcome">Welcome to Widgets for SiteOrigin <?php echo INKED_SO_VER; ?></h1>
89
+ <p class="iw-admin-rate">Thank you for updating to the latest version! Please consider giving it a
90
+ <strong><a href="https://wordpress.org/support/view/plugin-reviews/widgets-for-siteorigin#postform" class="thankyou" target="_new" title="Ok, you deserved it" style="font-weight:bold;">
91
+ 5-star rating
92
+ </a></strong> on Wordpress? This will help motivate us to do more.<br>
93
+ Your help is much appreciated. Thank you very much. <i>~ Adi Rao</i></p>
94
+
95
+ </div>
96
+
97
+ <div class="iw-page-header-logo">
98
+
99
+ <img src="<?php echo plugin_dir_url(__FILE__); ?>img/plugin-logo.png">
100
+
101
+ </div>
102
+
103
+ </div>
104
+
105
+ <div class="iw-page-content">
106
+
107
+ <div class="premium-upgrade">
108
+ <h2 class="premium-upgrade-text">Upgrade to Widgets for SiteOrigin Pro</h2>
109
+ </div>
110
+
111
+ <center><img src="<?php echo plugin_dir_url(__FILE__); ?>img/go-pro.jpg"></center>
112
+
113
+ <center><img src="<?php echo plugin_dir_url(__FILE__); ?>img/blog-enhanced.jpg"></center>
114
+
115
+ <center><img src="<?php echo plugin_dir_url(__FILE__); ?>img/blog-slider.jpg"></center>
116
+
117
+ <center><img src="<?php echo plugin_dir_url(__FILE__); ?>img/prsn-testi-sliders.jpg"></center>
118
+
119
+ <center><img src="<?php echo plugin_dir_url(__FILE__); ?>img/chart.jpg"></center>
120
+
121
+ <center><img src="<?php echo plugin_dir_url(__FILE__); ?>img/animation.jpg"></center>
122
+
123
+ <center><img src="<?php echo plugin_dir_url(__FILE__); ?>img/coming-soon.jpg"></center>
124
+
125
+ <div class="get-it-now">
126
+ <a class="upgrade-link" href="https://wpinked.com/downloads/widgets-for-siteorigin-pro/" target="_blank">GET IT NOW</a>
127
+ <a class="docs-support-link" href="<?php echo admin_url( 'admin.php?page=wpinked-widgets-docs-support' ); ?>">DOCS & SUPPORT</a>
128
+ <a class="demo-link" href="http://widgets.wpinked.com/" target="_blank">DEMO</a>
129
+ </div>
130
+
131
+ </div>
132
+
133
+ </div>
134
+
135
+ <?php
136
+ }
137
+
138
+ function wpinked_so_admin_page_docs_support() { ?>
139
+
140
+ <div class="iw-admin-page docs-support">
141
+
142
+ <div class="iw-page-header">
143
+
144
+ <h1 class="iw-admin-welcome">Welcome to Documentation and Support</h1>
145
+ <p class="use-beacon">You can use Helpscout's Beacon at the bottom right of this page to quickly and easily browse through the docs or get in touch with us.</p>
146
+
147
+ </div>
148
+
149
+ <div class="iw-page-content">
150
+
151
+ <img src="<?php echo plugin_dir_url(__FILE__); ?>img/helpscout-beacon.png">
152
+ <img src="<?php echo plugin_dir_url(__FILE__); ?>img/helpscout-beacon-docs.png">
153
+ <img src="<?php echo plugin_dir_url(__FILE__); ?>img/helpscout-beacon-message.png">
154
+
155
+ <div class="get-it-now">
156
+ <a class="upgrade-link" href="https://wpinked.com/downloads/widgets-for-siteorigin-pro/" target="_blank">GO PRO</a>
157
+ <a class="docs-support-link" href="http://widgets-docs.wpinked.com/">DOCUMENTATION</a>
158
+ <a class="demo-link" href="http://widgets.wpinked.com/" target="_blank">DEMO</a>
159
+ </div>
160
+
161
+ </div>
162
+
163
+ </div>
164
+
165
+ <?php
166
+ }
admin/img/animation.jpg ADDED
Binary file
admin/img/blog-enhanced.jpg ADDED
Binary file
admin/img/blog-slider.jpg ADDED
Binary file
admin/img/chart.jpg ADDED
Binary file
admin/img/coming-soon.jpg ADDED
Binary file
admin/img/go-pro.jpg ADDED
Binary file
admin/img/helpscout-beacon-docs.png ADDED
Binary file
admin/img/helpscout-beacon-message.png ADDED
Binary file
admin/img/helpscout-beacon.png ADDED
Binary file
admin/img/menu-icon.png ADDED
Binary file
admin/img/plugin-logo.png ADDED
Binary file
admin/img/prsn-testi-sliders.jpg ADDED
Binary file
freemius/LICENSE.txt DELETED
@@ -1,340 +0,0 @@
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 DELETED
@@ -1,250 +0,0 @@
1
- Freemius WordPress SDK
2
- ======================
3
-
4
- Freemius is an [analytics](https://freemius.com/wordpress/insights/) & [monetization](https://freemius.com/wordpress/) platform for plugin developers. Freemius empower developers with advanced real-time analytics and helps turning any plugin into a commercial product in less than 10 min.
5
-
6
- The platform is fully functional and running in production. Having said that, the monetization platform is still in closed beta.
7
- If you are a WordPress plugin developer and you are interested to monetize with Freemius [apply to our closed beta here](http://bit.ly/freemius-beta):
8
-
9
- http://bit.ly/freemius-beta
10
-
11
- **Below you'll find the integration instructions for our WordPress SDK.**
12
-
13
- ## Code Documentation
14
-
15
- You can find the SDK's PHP-Doc documentation here:
16
- https://codedoc.pub/freemius/wordpress-sdk/master/
17
-
18
- ## Initializing the SDK
19
-
20
- Copy the code below and paste it into the top of your main plugin's PHP file, right after the plugin's header comment:
21
-
22
- ```php
23
- <?php
24
- // Create a helper function for easy SDK access.
25
- function my_prefix_fs() {
26
- global $my_prefix_fs;
27
- if ( ! isset( $my_prefix_fs ) ) {
28
- // Include Freemius SDK.
29
- require_once dirname(__FILE__) . '/freemius/start.php';
30
-
31
- $my_prefix_fs = fs_dynamic_init( array(
32
- 'id' => '1234',
33
- 'slug' => 'my-plugin-slug',
34
- 'menu_slug' => 'my_menu_slug', // You can also use __FILE__
35
- 'public_key' => 'pk_MY_PUBLIC_KEY',
36
- 'is_live' => true,
37
- 'is_premium' => true,
38
- 'has_addons' => false,
39
- 'has_paid_plans' => false,
40
- // Set the SDK to work in a sandbox mode (for development & testing).
41
- // IMPORTANT: MAKE SURE TO REMOVE SECRET KEY BEFORE DEPLOYMENT.
42
- 'secret_key' => 'sk_MY_SECRET_KEY',
43
- ) );
44
- }
45
-
46
- return $my_prefix_fs;
47
- }
48
-
49
- // Init Freemius.
50
- my_prefix_fs();
51
- ?>
52
- ```
53
-
54
- - **1234** - Replace with your plugin's ID.
55
- - **pk_MY_PUBLIC_KEY** - Replace with your plugin's public key.
56
- - **sk_MY_SECRET_KEY** - Replace with your plugin's secret key.
57
- - **my-plugin-slug** - Replace with your plugin's WordPress.org slug.
58
- - **my_menu_slug** - Replace with your admin dashboard settings menu slug.
59
-
60
-
61
- ## Usage example
62
-
63
- You can call the SDK by using the shortcode function:
64
-
65
- ```php
66
- <?php my_prefix_fs()->get_upgrade_url(); ?>
67
- ```
68
-
69
- Or when calling Freemius multiple times in a scope, it's recommended to use it with the global variable:
70
-
71
- ```php
72
- <?php
73
- global $my_prefix_fs;
74
- $my_prefix_fs->get_account_url();
75
- ?>
76
- ```
77
-
78
- ## Adding license based logic examples
79
-
80
- Add marketing content to encourage your users to upgrade for your paid version:
81
-
82
- ```php
83
- <?php
84
- if ( my_prefix_fs()->is_not_paying() ) {
85
- echo '<section><h1>' . esc_html__('Awesome Premium Features', 'my-plugin-slug') . '</h1>';
86
- echo '<a href="' . my_prefix_fs()->get_upgrade_url() . '">' .
87
- esc_html__('Upgrade Now!', 'my-plugin-slug') .
88
- '</a>';
89
- echo '</section>';
90
- }
91
- ?>
92
- ```
93
-
94
- Add logic which will only be available in your premium plugin version:
95
-
96
- ```php
97
- <?php
98
- // This "if" block will be auto removed from the Free version.
99
- if ( my_prefix_fs()->is__premium_only() ) {
100
-
101
- // ... premium only logic ...
102
-
103
- }
104
- ?>
105
- ```
106
-
107
- 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:
108
-
109
- ```php
110
- <?php
111
- class My_Plugin {
112
- function init() {
113
- ...
114
-
115
- // This "if" block will be auto removed from the free version.
116
- if ( my_prefix_fs()->is__premium_only() ) {
117
- // Init premium version.
118
- $this->admin_init__premium_only();
119
-
120
- add_action( 'admin_init', array( &$this, 'admin_init_hook__premium_only' );
121
- }
122
-
123
- ...
124
- }
125
-
126
- // This method will be only included in the premium version.
127
- function admin_init__premium_only() {
128
- ...
129
- }
130
-
131
- // This method will be only included in the premium version.
132
- function admin_init_hook__premium_only() {
133
- ...
134
- }
135
- }
136
- ?>
137
- ```
138
-
139
- Add logic which will only be executed for customers in your 'professional' plan:
140
-
141
- ```php
142
- <?php
143
- if ( my_prefix_fs()->is_plan('professional', true) ) {
144
- // .. logic related to Professional plan only ...
145
- }
146
- ?>
147
- ```
148
-
149
- Add logic which will only be executed for customers in your 'professional' plan or higher plans:
150
-
151
- ```php
152
- <?php
153
- if ( my_prefix_fs()->is_plan('professional') ) {
154
- // ... logic related to Professional plan and higher plans ...
155
- }
156
- ?>
157
- ```
158
-
159
- 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):
160
-
161
- ```php
162
- <?php
163
- // This "if" block will be auto removed from the Free version.
164
- if ( my_prefix_fs()->is_plan__premium_only('professional') ) {
165
- // ... logic related to Professional plan and higher plans ...
166
- }
167
- ?>
168
- ```
169
-
170
- Add logic only for users in trial:
171
-
172
- ```php
173
- <?php
174
- if ( my_prefix_fs()->is_trial() ) {
175
- // ... logic for users in trial ...
176
- }
177
- ?>
178
- ```
179
-
180
- Add logic for specified paid plan:
181
-
182
- ```php
183
- <?php
184
- // This "if" block will be auto removed from the Free version.
185
- if ( my_prefix_fs()->is__premium_only() ) {
186
- if ( my_prefix_fs()->is_plan( 'professional', true ) ) {
187
-
188
- // ... logic related to Professional plan only ...
189
-
190
- } else if ( my_prefix_fs()->is_plan( 'business' ) ) {
191
-
192
- // ... logic related to Business plan and higher plans ...
193
-
194
- }
195
- }
196
- ?>
197
- ```
198
-
199
- ## Excluding files and folders from the free plugin version
200
- There are two ways to exclude files from your free version.
201
-
202
- 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.
203
- 2. Add `@fs_premium_only` a sepcial meta tag to the plugin's main PHP file header. Example:
204
- ```php
205
- <?php
206
- /**
207
- * Plugin Name: My Very Awesome Plugin
208
- * Plugin URI: http://my-awesome-plugin.com
209
- * Description: Create and manage Awesomeness right in WordPress.
210
- * Version: 1.0.0
211
- * Author: Awesomattic
212
- * Author URI: http://my-awesome-plugin.com/me/
213
- * License: GPLv2
214
- * Text Domain: myplugin
215
- * Domain Path: /langs
216
- *
217
- * @fs_premium_only /lib/functions.php, /premium-files/
218
- */
219
-
220
- if ( ! defined( 'ABSPATH' ) ) {
221
- exit;
222
- }
223
-
224
- // ... my code ...
225
- ?>
226
- ```
227
- The file `/lib/functions.php` and the directory `/premium-files/` will be removed from the free plugin version.
228
-
229
- # WordPress.org Compliance
230
- 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:
231
- > 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.
232
-
233
- 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.
234
-
235
- ## Deployment
236
- Zip your plugin's root folder and upload it in the Deployment section in the *Freemius Developer's Dashboard*.
237
- The plugin will be scanned and processed by a custom developed *PHP Processor* which will auto-generate two versions of your plugin:
238
-
239
- 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.
240
- 2. **Free version**: The code stripped from all your paid features (based on the logic added wrapped in `{ method }__premium_only()`).
241
-
242
- 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.
243
-
244
- ## Reporting Bugs
245
- Email dev [at] freemius [dot] com
246
-
247
- ## FAQ
248
-
249
- ## Copyright
250
- Freemius, Inc.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/assets/css/admin/account.css DELETED
@@ -1 +0,0 @@
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 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}
 
freemius/assets/css/admin/add-ons.css DELETED
@@ -1,2 +0,0 @@
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/common.css DELETED
@@ -1 +0,0 @@
1
- .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: 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'}
 
freemius/assets/css/admin/connect.css DELETED
@@ -1 +0,0 @@
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 DELETED
@@ -1 +0,0 @@
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 DELETED
@@ -1 +0,0 @@
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}
 
freemius/assets/css/admin/dialog-boxes.css DELETED
@@ -1,3 +0,0 @@
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 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>.notice.inline{margin:0;display:none}.fs-modal .fs-modal-panel:not(.active){display:none}body.has-fs-modal{overflow:hidden}.fs-modal.fs-modal-deactivation-feedback .reason-input,.fs-modal.fs-modal-deactivation-feedback .internal-message{margin:3px 0 3px 22px}.fs-modal.fs-modal-deactivation-feedback .reason-input input,.fs-modal.fs-modal-deactivation-feedback .reason-input textarea,.fs-modal.fs-modal-deactivation-feedback .internal-message input,.fs-modal.fs-modal-deactivation-feedback .internal-message textarea{width:100%}.fs-modal.fs-modal-deactivation-feedback li.reason.has-internal-message .internal-message{border:1px solid #ccc;padding:7px;display:none}@media (max-width: 650px){.fs-modal.fs-modal-deactivation-feedback li.reason li.reason{margin-bottom:10px}.fs-modal.fs-modal-deactivation-feedback li.reason li.reason .reason-input,.fs-modal.fs-modal-deactivation-feedback li.reason li.reason .internal-message{margin-left:29px}.fs-modal.fs-modal-deactivation-feedback li.reason li.reason label{display:table}.fs-modal.fs-modal-deactivation-feedback li.reason li.reason label>span{display:table-cell;font-size:1.3em}}
2
- #the-list .deactivate>.fs-slug{display:none}.fs-modal.fs-modal-license-activation .fs-modal-body input.license_key{width:100%}.fs-modal.fs-modal-license-key-resend .button-close{float:right;margin:5px}.fs-modal.fs-modal-license-key-resend .button-close:hover{cursor:pointer}.fs-modal.fs-modal-license-key-resend .fs-modal-body .input-container>.email-address-container{overflow:hidden;padding-right:2px}.fs-modal.fs-modal-license-key-resend .fs-modal-body input.email-address{width:100%}.fs-modal.fs-modal-license-key-resend .fs-modal-body .button-container{float:right;margin-left:7px}@media (max-width: 650px){.fs-modal.fs-modal-license-key-resend .fs-modal-body .button-container{margin-top:2px}}
3
- a.show-license-resend-modal{margin-top:4px;display:inline-block}
 
 
 
freemius/assets/css/admin/license-activation.css DELETED
@@ -1 +0,0 @@
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/css/common.css DELETED
@@ -1 +0,0 @@
1
- .fs-notice.success{color:green;font-weight:700}
 
freemius/assets/img/plugin-icon.png DELETED
Binary file
freemius/assets/scss/_colors.scss DELETED
@@ -1,58 +0,0 @@
1
- $menu-hover-color: #333;
2
- $darkest-color: #000;
3
- $fms-live-color: #71ae00;
4
- $fms-test-color: #f7941d;
5
- $fms-link-color: #29abe1;
6
- $fms-link-hover-color: darken(#29abe1, 10%);
7
- $body-bkg: #111;
8
- $special-color: #d3135a;
9
- $body-color: #f1f1f1;
10
- $fms-white: #f1f1f1;
11
- $container-bkg: #222;
12
- $container-bkg-odd: #262626;
13
- $container-border-color: #333;
14
- $table-head-bkg: #333;
15
- $table-head-color: #999;
16
- $info-color: #999;
17
- $error-color: #ff0000;
18
-
19
- $fs-logo-blue-color: #29abe1;
20
- $fs-logo-green-color: #71ae00;
21
- $fs-logo-magenta-color: #d3135a;
22
-
23
- $fs-notice-promotion-border-color: #00a0d2;
24
- $fs-notice-promotion-bkg: #f2fcff;
25
-
26
- // WordPress colors.
27
- $page-header-bkg: #333;
28
- $page-header-color: $fms-white;
29
- $text-dark-color: #333;
30
- $text-light-color: #666;
31
- $text-lightest-color: #999;
32
-
33
- // WP Buttons.
34
- $button-primary-bkg: #6bc406;
35
- $button-primary-color: $fms-white;
36
- $button-secondary-bkg: #333;
37
- $button-secondary-color: $fms-white;
38
- $featured-color: #6bc406;
39
- $wp-selected-color: #0074a3;
40
-
41
- $wordpress_color: #01749A;
42
- $blogger_color: #ff8100;
43
- $wix_color: #fac102;
44
- $shopify_color: #80d100;
45
- $addthis_color: #fe6d4e;
46
- $tumblr_color: #34506b;
47
- $zepo_color: #00baf2;
48
- $jquery_color: #000919;
49
- $javascript_color: #00baf2;
50
- $squarespace_color: #000;
51
-
52
- $blog_color: #ff6600;
53
- $facebook_color: #3b5998;
54
- $twitter_color: #4099ff;
55
- $linkedin_color: #4875b4;
56
- $youtube_color: #ff3333;
57
- $gplus_color: #c63d2d;
58
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/assets/scss/_functions.scss DELETED
File without changes
freemius/assets/scss/_load.scss DELETED
@@ -1,4 +0,0 @@
1
- @import 'mixins';
2
- @import "vars";
3
- @import "functions";
4
- @import "colors";
 
 
 
 
freemius/assets/scss/_mixins.scss DELETED
@@ -1,224 +0,0 @@
1
- // ---- CSS3 SASS MIXINS ----
2
- // https://github.com/madr/css3-sass-mixins
3
- //
4
- // Copyright (C) 2011 by Anders Ytterström
5
- //
6
- // Permission is hereby granted, free of charge, to any person obtaining a copy
7
- // of this software and associated documentation files (the "Software"), to deal
8
- // in the Software without restriction, including without limitation the rights
9
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- // copies of the Software, and to permit persons to whom the Software is
11
- // furnished to do so, subject to the following conditions:
12
- //
13
- // The above copyright notice and this permission notice shall be included in
14
- // all copies or substantial portions of the Software.
15
- //
16
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- // THE SOFTWARE.
23
- //
24
-
25
- // ---- LEGACY IE SUPPORT USING FILTERS ----
26
- // Should IE filters be used or not?
27
- // PROS: gradients, drop shadows etc will be handled by css.
28
- // CONS: will harm the site performance badly,
29
- // especially on sites with heavy rendering and scripting.
30
- $useIEFilters: 0;
31
- // might be 0 or 1. disabled by default.
32
- // ---- /LEGACY IE SUPPORT USING FILTERS ----
33
-
34
-
35
- @mixin background-size ($value) {
36
- -webkit-background-size: $value;
37
- background-size: $value;
38
- }
39
-
40
- @mixin border-image ($path, $offsets, $repeats) {
41
- -moz-border-image: $path $offsets $repeats;
42
- -o-border-image: $path $offsets $repeats;
43
- -webkit-border-image: $path $offsets $repeats;
44
- border-image: $path $offsets $repeats;
45
- }
46
-
47
- @mixin border-radius ($values...) {
48
- -moz-border-radius: $values;
49
- -webkit-border-radius: $values;
50
- border-radius: $values;
51
- /*-moz-background-clip: padding;
52
- -webkit-background-clip: padding-box;
53
- background-clip: padding-box;*/
54
- }
55
-
56
- @mixin box-shadow ($values...) {
57
- -moz-box-shadow: $values;
58
- -webkit-box-shadow: $values;
59
- box-shadow: $values;
60
- }
61
-
62
- //@mixin box-shadow ($x, $y, $offset, $hex, $ie: $useIEFilters, $inset: null, $spread:null) {
63
- // -moz-box-shadow: $x $y $offset $spread $hex $inset;
64
- // -webkit-box-shadow: $x $y $offset $spread $hex $inset;
65
- // box-shadow: $x $y $offset $spread $hex $inset;
66
- //
67
- // @if $ie == 1 {
68
- // $iecolor: '#' + red($hex) + green($hex) + blue($hex);
69
- // filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=#{$x}, OffY=#{$y}, Color='#{$iecolor}');
70
- // -ms-filter: quote(progid:DXImageTransform.Microsoft.dropshadow(OffX=#{$x}, OffY=#{$y}, Color='#{$iecolor}'));
71
- // }
72
- //}
73
-
74
- @mixin box-sizing($value) {
75
- -moz-box-sizing: $value;
76
- -webkit-box-sizing: $value;
77
- box-sizing: $value;
78
- }
79
-
80
- // requires sass 3.2
81
- //@mixin keyframes {
82
- // @-moz-keyframes { @content; }
83
- // @-ms-keyframes { @content; }
84
- // @-o-keyframes { @content; }
85
- // @-webkit-keyframes { @content; }
86
- // @keyframes { @content; }
87
- //}
88
-
89
- @mixin linear-gradient($from, $to, $ie: $useIEFilters) {
90
- @if $ie != 1 { background-color: $to; }
91
-
92
- background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, $from),color-stop(1, $to));
93
- background-image: -webkit-linear-gradient(top, $from, $to);
94
- background-image: -moz-linear-gradient(top, $from, $to);
95
- background-image: -ms-linear-gradient(top, $from, $to);
96
- background-image: -o-linear-gradient(top, $from, $to);
97
- background-image: linear-gradient(top, bottom, $from, $to);
98
-
99
- @if $ie == 1 {
100
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$from}', endColorstr='#{$to}');
101
- }
102
- }
103
-
104
- @mixin horizontal-gradient($startColor: #555, $endColor: #333, $ie: $useIEFilters) {
105
- @if $ie != 1 { background-color: $endColor; }
106
-
107
- background-color: $endColor;
108
- background-image: -webkit-gradient(linear, 0 0, 100% 0, from($startColor), to($endColor)); // Safari 4+, Chrome 2+
109
- background-image: -webkit-linear-gradient(left, $startColor, $endColor); // Safari 5.1+, Chrome 10+
110
- background-image: -moz-linear-gradient(left, $startColor, $endColor); // FF 3.6+
111
- background-image: -o-linear-gradient(left, $startColor, $endColor); // Opera 11.10
112
- background-image: linear-gradient(to right, $startColor, $endColor); // Standard, IE10
113
- background-repeat: repeat-x;
114
- @if $ie == 1 {
115
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$startColor}', endColorstr='#{$endColor}', GradientType=1);
116
- }
117
- }
118
-
119
- @mixin radial-gradient($from, $to, $ie: $useIEFilters) {
120
- @if $ie != 1 { background-color: $to; }
121
-
122
- background: -moz-radial-gradient(center, circle cover, $from 0%, $to 100%);
123
- background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, $from), color-stop(100%, $to));
124
- background: -webkit-radial-gradient(center, circle cover, $from 0%, $to 100%);
125
- background: -o-radial-gradient(center, circle cover, $from 0%, $to 100%);
126
- background: -ms-radial-gradient(center, circle cover, $from 0%, $to 100%);
127
- background: radial-gradient(center, circle cover, $from 0%, $to 100%);
128
- background-color: $from;
129
-
130
- @if $ie == 1 {
131
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$from}', endColorstr='#{$to}', GradientType=1); /* IE6-9 fallback on horizontal gradient */
132
- }
133
- }
134
-
135
- /*@mixin rgba-bg ($hex, $alpha, $ie: $useIEFilters) {
136
- @if $ie == 1 {
137
- background-color: none;
138
- $hexopac: ie-hex-str(rgba($hex, $alpha));
139
- filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#{$hexopac}',EndColorStr='#{$hexopac}}');
140
- -ms-filter: quote(progid:DXImageTransform.Microsoft.gradient(startColorStr='#{$hexopac}',EndColorStr='#{$hexopac}'));
141
- }
142
- @else {
143
- background-color: $hex;
144
- background-color: rgba($hex, $alpha);
145
- }
146
- }*/
147
-
148
- @mixin perspective($perspective) {
149
- -moz-perspective: $perspective;
150
- -ms-perspective: $perspective;
151
- -webkit-perspective: $perspective;
152
- perspective: $perspective;
153
- -moz-transform-style: preserve-3d;
154
- -ms-transform-style: preserve-3d;
155
- -webkit-transform-style: preserve-3d;
156
- transform-style: preserve-3d;
157
- }
158
-
159
- @mixin transform ($transforms) {
160
- -moz-transform: $transforms;
161
- -o-transform: $transforms;
162
- -ms-transform: $transforms;
163
- -webkit-transform: $transforms;
164
- transform: $transforms;
165
- }
166
-
167
- @mixin matrix ($a, $b, $c, $d, $e, $f) {
168
- -moz-transform: matrix($a, $b, $c, $d, #{$e}px, #{$f}px);
169
- -o-transform: matrix($a, $b, $c, $d, $e, $f);
170
- -ms-transform: matrix($a, $b, $c, $d, $e, $f);
171
- -webkit-transform: matrix($a, $b, $c, $d, $e, $f);
172
- transform: matrix($a, $b, $c, $d, $e, $f);
173
- }
174
-
175
- @mixin rotate ($deg) {
176
- @include transform(rotate(#{$deg}deg));
177
- }
178
-
179
- @mixin scale ($size) {
180
- @include transform(scale(#{$size}));
181
- }
182
-
183
- @mixin translate ($x, $y) {
184
- @include transform(translate($x, $y));
185
- }
186
-
187
- @mixin transition ($value...) {
188
- -moz-transition: $value;
189
- -o-transition: $value;
190
- -ms-transition: $value;
191
- -webkit-transition: $value;
192
- transition: $value;
193
- }
194
-
195
- // ==== /CSS3 SASS MIXINS ====
196
-
197
- @mixin opacity($opacity) {
198
- opacity: $opacity;
199
- $opacity-ie: $opacity * 100;
200
- filter: alpha(opacity=$opacity-ie); //IE8
201
- }
202
-
203
- @mixin sprite($img, $width, $height: $width, $display: block)
204
- {
205
- display: $display;
206
- background-image: url('#{$img}');
207
-
208
- @include size($width, $height);
209
- }
210
-
211
- @mixin size($width, $height: $width)
212
- {
213
- width: $width;
214
- height: $height;
215
- }
216
-
217
- @mixin clearfix
218
- {
219
- &:after {
220
- content: "";
221
- display: table;
222
- clear: both;
223
- }
224
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/assets/scss/_start.scss DELETED
@@ -1,4 +0,0 @@
1
- @import "vars";
2
- @import "colors";
3
- @import "mixins";
4
- @import "functions";
 
 
 
 
freemius/assets/scss/_vars.scss DELETED
@@ -1,5 +0,0 @@
1
- $is_production: true;
2
-
3
- $img_common: if($is_production == true, '//img.freemius.com', 'http://img.freemius:8080');
4
-
5
- $layout_width: 960px;
 
 
 
 
 
freemius/assets/scss/admin/_deactivation-feedback.scss DELETED
@@ -1,42 +0,0 @@
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
-
40
- #the-list .deactivate > .fs-slug {
41
- display: none;
42
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/assets/scss/admin/_license-activation.scss DELETED
@@ -1,7 +0,0 @@
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 DELETED
@@ -1,35 +0,0 @@
1
- .fs-modal.fs-modal-license-key-resend {
2
- .button-close {
3
- float: right;
4
- margin: 5px;
5
-
6
- &:hover {
7
- cursor: pointer;
8
- }
9
- }
10
-
11
- .fs-modal-body {
12
- .input-container > .email-address-container {
13
- overflow: hidden;
14
- padding-right: 2px;
15
- }
16
-
17
- input.email-address {
18
- width: 100%;
19
- }
20
-
21
- .button-container {
22
- float: right;
23
- margin-left: 7px;
24
-
25
- @media (max-width: 650px) {
26
- margin-top: 2px;
27
- }
28
- }
29
- }
30
- }
31
-
32
- a.show-license-resend-modal {
33
- margin-top: 4px;
34
- display: inline-block;
35
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/assets/scss/admin/_modal-common.scss DELETED
@@ -1,104 +0,0 @@
1
- @import "../colors";
2
-
3
- .fs-modal {
4
- position: fixed;
5
- overflow: auto;
6
- height: 100%;
7
- width: 100%;
8
- top: 0;
9
- z-index: 100000;
10
- display: none;
11
- background: rgba(0, 0, 0, 0.6);
12
-
13
- .fs-modal-dialog {
14
- background: transparent;
15
- position: absolute;
16
- left: 50%;
17
- margin-left: -298px;
18
- padding-bottom: 30px;
19
- top: -100%;
20
- z-index: 100001;
21
- width: 596px;
22
-
23
- @media (max-width: 650px) {
24
- margin-left: -50%;
25
- box-sizing: border-box;
26
- padding-left: 10px;
27
- padding-right: 10px;
28
- width: 100%;
29
-
30
- .fs-modal-panel > h3 > strong {
31
- font-size: 1.3em;
32
- }
33
- }
34
- }
35
-
36
- &.active {
37
- display: block;
38
-
39
- &:before {
40
- display: block;
41
- }
42
-
43
- .fs-modal-dialog {
44
- top: 10%;
45
- }
46
- }
47
-
48
- .fs-modal-body,
49
- .fs-modal-footer {
50
- border: 0;
51
- background: #fefefe;
52
- padding: 20px;
53
- }
54
-
55
- .fs-modal-body {
56
- border-bottom: 0;
57
-
58
- p {
59
- font-size: 14px;
60
- }
61
-
62
- h2 {
63
- font-size: 20px;
64
- }
65
-
66
- > div {
67
- margin-top: 10px;
68
-
69
- h2 {
70
- font-weight: bold;
71
- font-size: 20px;
72
- margin-top: 0;
73
- }
74
- }
75
- }
76
-
77
- .fs-modal-footer {
78
- border-top: #eeeeee solid 1px;
79
- text-align: right;
80
-
81
- > .button {
82
- margin: 0 7px;
83
-
84
- &:first-child {
85
- margin: 0;
86
- }
87
- }
88
- }
89
-
90
- .fs-modal-panel {
91
- > .notice.inline {
92
- margin: 0;
93
- display: none;
94
- }
95
-
96
- &:not(.active) {
97
- display: none;
98
- }
99
- }
100
- }
101
-
102
- body.has-fs-modal {
103
- overflow: hidden;
104
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/assets/scss/admin/account.scss DELETED
@@ -1,184 +0,0 @@
1
- #fs_account
2
- {
3
- .postbox,
4
- .widefat
5
- {
6
- max-width: 700px;
7
- }
8
-
9
- h3
10
- {
11
- font-size: 1.3em;
12
- padding: 12px 15px;
13
- margin: 0 0 12px 0;
14
- line-height: 1.4;
15
- border-bottom: 1px solid #F1F1F1;
16
- }
17
-
18
- i.dashicons
19
- {
20
- font-size: 1.2em;
21
- height: 1.2em;
22
- width: 1.2em;
23
- }
24
-
25
- .button
26
- {
27
- i.dashicons
28
- {
29
- vertical-align: middle;
30
- }
31
- }
32
-
33
- .fs-header-actions
34
- {
35
- position: absolute;
36
- top: 17px;
37
- right: 15px;
38
- font-size: 0.9em;
39
-
40
- ul
41
- {
42
- margin: 0;
43
- }
44
-
45
- li
46
- {
47
- form
48
- {
49
- display: inline-block;
50
- }
51
-
52
- float: left;
53
- a
54
- {
55
- text-decoration: none;
56
- }
57
- }
58
- }
59
- }
60
-
61
- #fs_account_details .button-group {
62
- float: right;
63
- }
64
-
65
- .rtl #fs_account .fs-header-actions
66
- {
67
- left: 15px;
68
- right: auto;
69
- }
70
-
71
- .fs-key-value-table
72
- {
73
- width: 100%;
74
-
75
- form
76
- {
77
- display: inline-block;
78
- }
79
-
80
- tr
81
- {
82
- td:first-child
83
- {
84
- nobr
85
- {
86
- font-weight: bold;
87
- }
88
-
89
- text-align: right;
90
-
91
- form
92
- {
93
- display: block;
94
- }
95
- }
96
-
97
- td.fs-right
98
- {
99
- text-align: right;
100
- }
101
-
102
- &.fs-odd
103
- {
104
- background: #ebebeb;
105
- }
106
- }
107
-
108
- td, th
109
- {
110
- padding: 10px;
111
- }
112
-
113
- code {
114
- line-height: 28px;
115
- }
116
-
117
- var, code, input[type="text"]
118
- {
119
- color: #0073AA;
120
- font-size: 16px;
121
- background: none;
122
- }
123
-
124
- input[type="text"] {
125
- width: 100%;
126
- font-weight: bold;
127
- }
128
- }
129
-
130
- label.fs-tag
131
- {
132
- background: #ffba00;
133
- color: #fff;
134
- display: inline-block;
135
- border-radius: 3px;
136
- padding: 5px;
137
- font-size: 11px;
138
- line-height: 11px;
139
- vertical-align: baseline;
140
-
141
- &.fs-warn
142
- {
143
- background: #ffba00;
144
- }
145
- &.fs-success
146
- {
147
- background: #46b450;
148
- }
149
- &.fs-error
150
- {
151
- background: #dc3232;
152
- }
153
- }
154
-
155
- #fs_addons
156
- {
157
- h3
158
- {
159
- border: none;
160
- margin-bottom: 0;
161
- padding: 4px 5px;
162
- }
163
-
164
- td
165
- {
166
- vertical-align: middle;
167
- }
168
-
169
- td:first-child,
170
- th:first-child
171
- {
172
- text-align: left;
173
- font-weight: bold;
174
- }
175
- td:last-child,
176
- th:last-child
177
- {
178
- text-align: right;
179
- }
180
- th
181
- {
182
- font-weight: bold;
183
- }
184
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/assets/scss/admin/add-ons.scss DELETED
@@ -1,449 +0,0 @@
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/common.scss DELETED
@@ -1,134 +0,0 @@
1
- @import "../start";
2
-
3
- .fs-notice
4
- {
5
- position: relative;
6
-
7
- &.fs-has-title
8
- {
9
- margin-bottom: 30px !important;
10
- }
11
-
12
- &.success
13
- {
14
- color: green;
15
- // font-weight: normal;
16
- }
17
-
18
- &.promotion
19
- {
20
- border-color: $fs-notice-promotion-border-color !important;
21
- background-color: $fs-notice-promotion-bkg !important;
22
- }
23
-
24
- .fs-notice-body
25
- {
26
- margin: .5em 0;
27
- padding: 2px;
28
- }
29
-
30
- .fs-close
31
- {
32
- // position: absolute;
33
- // top: 2px;
34
- // bottom: 2px;
35
- // right: 2px;
36
- // min-width: 100px;
37
- // text-align: center;
38
- // padding-right: 2px;
39
- cursor: pointer;
40
- color: #aaa;
41
- float: right;
42
-
43
- &:hover
44
- {
45
- color: #666;
46
- // background: #A9A9A9;
47
- }
48
-
49
- > *
50
- {
51
- margin-top: 7px;
52
- display: inline-block;
53
- }
54
- }
55
-
56
- label.fs-plugin-title
57
- {
58
- background: rgba(0, 0, 0, 0.3);
59
- color: #fff;
60
- padding: 2px 10px;
61
- position: absolute;
62
- top: 100%;
63
- bottom: auto;
64
- right: auto;
65
- @include border-radius(0 0 3px 3px);
66
- left: 10px;
67
- font-size: 12px;
68
- font-weight: bold;
69
- cursor: auto;
70
- }
71
- }
72
-
73
- .rtl .fs-notice
74
- {
75
- .fs-close
76
- {
77
- // left: 2px;
78
- // right: auto;
79
- // padding-right: 0;
80
- // padding-left: 2px;
81
- float: left;
82
- }
83
- }
84
-
85
- .fs-secure-notice
86
- {
87
- position: fixed;
88
- top: 32px;
89
- left: 160px;
90
- right: 0;
91
- background: rgb(235, 253, 235);
92
- padding: 10px 20px;
93
- color: green;
94
- z-index: 9999;
95
- box-shadow: 0px 2px 2px rgba(6, 113, 6, 0.3);
96
- @include opacity(0.95);
97
-
98
- &:hover
99
- {
100
- @include opacity(1);
101
- }
102
- }
103
-
104
- @media screen and (max-width: 960px) {
105
- .fs-secure-notice
106
- {
107
- left: 36px;
108
- }
109
- }
110
-
111
- @media screen and (max-width: 782px) {
112
- .fs-secure-notice
113
- {
114
- left: 0;
115
- top: 46px;
116
- text-align: center;
117
- }
118
- }
119
-
120
- span.fs-submenu-item.fs-sub:before
121
- {
122
- // Add small arrow.
123
- content: '\21B3';
124
- padding: 0 5px;
125
- }
126
-
127
- .rtl
128
- {
129
- span.fs-submenu-item.fs-sub:before
130
- {
131
- // Add small RTL arrow.
132
- content: '\21B2';
133
- }
134
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/assets/scss/admin/connect.scss DELETED
@@ -1,471 +0,0 @@
1
- @import "../start";
2
-
3
- $form_width: 480px;
4
-
5
- #fs_connect
6
- {
7
- width: $form_width;
8
- @include box-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));
9
- margin: 20px 0;
10
-
11
- @media screen and (max-width: ($form_width - 1)) {
12
- @include box-shadow(none);
13
- width: auto;
14
- margin: 0 0 0 -10px;
15
- }
16
-
17
- .fs-content
18
- {
19
- background: #fff;
20
- padding: 15px 20px;
21
-
22
- .fs-error {
23
- background: snow;
24
- color: $fs-logo-magenta-color;
25
- border: 1px solid $fs-logo-magenta-color;
26
- @include box-shadow(0 1px 1px 0 rgba(0,0,0,.1));
27
- text-align: center;
28
- padding: 5px;
29
- margin-bottom: 10px;
30
- }
31
-
32
- p
33
- {
34
- margin: 0;
35
- padding: 0;
36
- font-size: 1.2em;
37
- }
38
- }
39
-
40
- .fs-license-key-container {
41
- position: relative;
42
- width: 280px;
43
- margin: 10px auto 0 auto;
44
-
45
- input {
46
- width: 100%;
47
- }
48
-
49
- .dashicons {
50
- position: absolute;
51
- top: 5px;
52
- right: 5px;
53
- }
54
- }
55
-
56
- .fs-actions
57
- {
58
- padding: 10px 20px;
59
- background: #C0C7CA;
60
-
61
- .button
62
- {
63
- padding: 0 10px 1px;
64
- line-height: 35px;
65
- height: 37px;
66
- font-size: 16px;
67
- margin-bottom: 0;
68
-
69
- .dashicons
70
- {
71
- font-size: 37px;
72
- margin-left: -8px;
73
- margin-right: 12px;
74
- }
75
-
76
- &.button-primary
77
- {
78
- padding-right: 15px;
79
- padding-left: 15px;
80
-
81
- &:after
82
- {
83
- content: ' \279C';
84
- }
85
-
86
- &.fs-loading
87
- {
88
- &:after
89
- {
90
- content: '';
91
- }
92
- }
93
- }
94
-
95
- &.button-secondary
96
- {
97
- float: right;
98
- }
99
- }
100
-
101
- // .fs-skip
102
- // {
103
- // line-height: 38px;
104
- // vertical-align: middle;
105
- // text-decoration: none;
106
- // margin-left: 10px;
107
- // }
108
- }
109
-
110
- &.fs-anonymous-disabled
111
- {
112
- .fs-actions
113
- {
114
- .button.button-primary
115
- {
116
- width: 100%;
117
- }
118
- }
119
- }
120
-
121
- .fs-permissions
122
- {
123
- padding: 10px 20px;
124
- background: #FEFEFE;
125
- // background: #F1F1F1;
126
- @include transition(background 0.5s ease);
127
-
128
- .fs-license-sync-disclaimer {
129
- text-align: center;
130
- margin-top: 0;
131
- }
132
-
133
- .fs-trigger
134
- {
135
- font-size: 0.9em;
136
- text-decoration: none;
137
- text-align: center;
138
- display: block;
139
- }
140
-
141
- ul
142
- {
143
- height: 0;
144
- overflow: hidden;
145
- margin: 0;
146
-
147
- li
148
- {
149
- margin-bottom: 12px;
150
-
151
- &:last-child
152
- {
153
- margin-bottom: 0;
154
- }
155
-
156
- i.dashicons
157
- {
158
- float: left;
159
- font-size: 40px;
160
- width: 40px;
161
- height: 40px;
162
- }
163
-
164
- div
165
- {
166
- margin-left: 55px;
167
-
168
- span
169
- {
170
- font-weight: bold;
171
- text-transform: uppercase;
172
- color: #23282d;
173
- }
174
-
175
- p
176
- {
177
- margin: 2px 0 0 0;
178
- }
179
- }
180
- }
181
- }
182
-
183
- &.fs-open
184
- {
185
- background: #fff;
186
-
187
- ul
188
- {
189
- height: auto;
190
- margin: 20px 20px 10px 20px;
191
- }
192
- }
193
-
194
- @media screen and (max-width: ($form_width - 1)) {
195
- background: #fff;
196
-
197
- .fs-trigger
198
- {
199
- display: none;
200
- }
201
-
202
- ul
203
- {
204
- height: auto;
205
- margin: 20px;
206
- }
207
- }
208
- }
209
-
210
- .fs-freemium-licensing {
211
- padding: 8px;
212
- // background: #0085BA;
213
- background: #777;
214
- color: #fff;
215
-
216
- p {
217
- text-align: center;
218
- display: block;
219
- margin: 0;
220
- padding: 0;
221
- }
222
-
223
- a {
224
- color: #C2EEFF;
225
- text-decoration: underline;
226
- }
227
- }
228
-
229
- $icon_size: 80px;
230
- $wp_logo_padding: $icon_size / 10;
231
- $icons_top: 10px;
232
-
233
- .fs-visual
234
- {
235
- padding: 12px;
236
- line-height: 0;
237
- background: #fafafa;
238
- height: $icon_size;
239
- position: relative;
240
-
241
- .fs-site-icon
242
- {
243
- position: absolute;
244
- left: 20px;
245
- top: $icons_top;
246
- }
247
-
248
- .fs-connect-logo
249
- {
250
- position: absolute;
251
- right: 20px;
252
- top: $icons_top;
253
- }
254
-
255
- .fs-plugin-icon
256
- {
257
- position: absolute;
258
- top: $icons_top;
259
- left: 50%;
260
- margin-left: - ($icon_size / 2);
261
- }
262
-
263
- .fs-plugin-icon,
264
- .fs-site-icon,
265
- img,
266
- object
267
- {
268
- width: $icon_size;
269
- height: $icon_size;
270
- }
271
-
272
- .dashicons-wordpress
273
- {
274
- font-size: $icon_size - ($wp_logo_padding * 2);
275
- background: $wordpress_color;
276
- color: #fff;
277
- width: $icon_size - ($wp_logo_padding * 2);
278
- height: $icon_size - ($wp_logo_padding * 2);
279
- padding: $wp_logo_padding;
280
- }
281
-
282
- .dashicons-plus
283
- {
284
- position: absolute;
285
- top: 50%;
286
- font-size: 30px;
287
- margin-top: -10px;
288
- color: #bbb;
289
-
290
- &.fs-first
291
- {
292
- left: 28%;
293
- }
294
- &.fs-second
295
- {
296
- left: 65%;
297
- }
298
- }
299
-
300
- .fs-plugin-icon,
301
- .fs-connect-logo,
302
- .fs-site-icon
303
- {
304
- border: 1px solid #ccc;
305
- padding: 1px;
306
- background: #fff;
307
- }
308
- }
309
-
310
- .fs-terms
311
- {
312
- text-align: center;
313
- font-size: 0.85em;
314
- padding: 5px;
315
- background: rgba(0, 0, 0, 0.05);
316
-
317
- &, a
318
- {
319
- color: #999;
320
- }
321
-
322
- a
323
- {
324
- text-decoration: none;
325
- }
326
- }
327
- }
328
-
329
- .rtl
330
- {
331
- #fs_connect
332
- {
333
- .fs-actions
334
- {
335
- padding: 10px 20px;
336
- background: #C0C7CA;
337
-
338
- .button
339
- {
340
- .dashicons
341
- {
342
- font-size: 37px;
343
- margin-left: -8px;
344
- margin-right: 12px;
345
- }
346
-
347
- &.button-primary
348
- {
349
- &:after
350
- {
351
- content: ' \000bb';
352
- }
353
-
354
- &.fs-loading
355
- {
356
- &:after
357
- {
358
- content: '';
359
- }
360
- }
361
- }
362
-
363
- &.button-secondary
364
- {
365
- float: left;
366
- }
367
- }
368
- }
369
-
370
- .fs-permissions
371
- {
372
- ul
373
- {
374
- li
375
- {
376
- div
377
- {
378
- margin-right: 55px;
379
- margin-left: 0;
380
- }
381
-
382
- i.dashicons
383
- {
384
- float: right;
385
- }
386
-
387
- }
388
- }
389
- }
390
-
391
- .fs-visual
392
- {
393
- .fs-site-icon
394
- {
395
- right: 20px;
396
- left: auto;
397
- }
398
-
399
- .fs-connect-logo
400
- {
401
- right: auto;
402
- left: 20px;
403
- }
404
- }
405
- }
406
- }
407
-
408
- .wp-pointer-content
409
- {
410
- #fs_connect
411
- {
412
- margin: 0;
413
- @include box-shadow(none);
414
- }
415
- }
416
-
417
- .fs-opt-in-pointer
418
- {
419
- .wp-pointer-content
420
- {
421
- padding: 0;
422
- }
423
-
424
- &.wp-pointer-top
425
- {
426
- .wp-pointer-arrow
427
- {
428
- border-bottom-color: #dfdfdf;
429
- }
430
- .wp-pointer-arrow-inner
431
- {
432
- border-bottom-color: #fafafa;
433
- }
434
- }
435
-
436
- &.wp-pointer-bottom
437
- {
438
- .wp-pointer-arrow
439
- {
440
- border-top-color: #dfdfdf;
441
- }
442
- .wp-pointer-arrow-inner
443
- {
444
- border-top-color: #fafafa;
445
- }
446
- }
447
-
448
- &.wp-pointer-left
449
- {
450
- .wp-pointer-arrow
451
- {
452
- border-right-color: #dfdfdf;
453
- }
454
- .wp-pointer-arrow-inner
455
- {
456
- border-right-color: #fafafa;
457
- }
458
- }
459
-
460
- &.wp-pointer-right
461
- {
462
- .wp-pointer-arrow
463
- {
464
- border-left-color: #dfdfdf;
465
- }
466
- .wp-pointer-arrow-inner
467
- {
468
- border-left-color: #fafafa;
469
- }
470
- }
471
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/assets/scss/admin/debug.scss DELETED
@@ -1,91 +0,0 @@
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/assets/scss/admin/dialog-boxes.scss DELETED
@@ -1,4 +0,0 @@
1
- @import "modal-common";
2
- @import "deactivation-feedback";
3
- @import "license-activation";
4
- @import "license-key-resend";
 
 
 
 
freemius/composer.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "name": "freemius/wordpress-sdk",
3
- "description": "Freemius WordPress SDK",
4
- "keywords": ["freemius", "wordpress", "plugin", "sdk"],
5
- "homepage": "https://freemius.com",
6
- "license": "GPL-2.0+",
7
- "require": {
8
- "php": ">=5.2"
9
- }
10
- }
 
 
 
 
 
 
 
 
 
 
freemius/config.php DELETED
@@ -1,229 +0,0 @@
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
- define( 'WP_FS__SLUG', 'freemius' );
14
- if ( ! defined( 'WP_FS__DEV_MODE' ) ) {
15
- define( 'WP_FS__DEV_MODE', false );
16
- }
17
-
18
- /**
19
- * API Connectivity Simulation
20
- */
21
- if ( ! defined( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY' ) ) {
22
- define( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY', false );
23
- }
24
- if ( ! defined( 'WP_FS__SIMULATE_NO_CURL' ) ) {
25
- define( 'WP_FS__SIMULATE_NO_CURL', false );
26
- }
27
- if ( ! defined( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE' ) ) {
28
- define( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE', false );
29
- }
30
- if ( ! defined( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL' ) ) {
31
- define( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL', false );
32
- }
33
- if ( WP_FS__SIMULATE_NO_CURL ) {
34
- define( 'FS_SDK__SIMULATE_NO_CURL', true );
35
- }
36
- if ( WP_FS__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE ) {
37
- define( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE', true );
38
- }
39
- if ( WP_FS__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL ) {
40
- define( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL', true );
41
- }
42
-
43
- if ( ! defined( 'WP_FS__SIMULATE_FREEMIUS_OFF' ) ) {
44
- define( 'WP_FS__SIMULATE_FREEMIUS_OFF', false );
45
- }
46
-
47
- if ( ! defined( 'WP_FS__PING_API_ON_IP_OR_HOST_CHANGES' ) ) {
48
- /**
49
- * @since 1.1.7.3
50
- * @author Vova Feldman (@svovaf)
51
- *
52
- * I'm not sure if shared servers periodically change IP, or the subdomain of the
53
- * admin dashboard. Also, I've seen sites that have strange loop of switching
54
- * between domains on a daily basis. Therefore, to eliminate the risk of
55
- * multiple unwanted connectivity test pings, temporary ignore domain or
56
- * server IP changes.
57
- */
58
- define( 'WP_FS__PING_API_ON_IP_OR_HOST_CHANGES', false );
59
- }
60
-
61
- /**
62
- * If your dev environment supports custom public network IP setup
63
- * like VVV, please update WP_FS__LOCALHOST_IP with your public IP
64
- * and uncomment it during dev.
65
- */
66
- if ( ! defined( 'WP_FS__LOCALHOST_IP' ) ) {
67
- // VVV default public network IP.
68
- define( 'WP_FS__VVV_DEFAULT_PUBLIC_IP', '192.168.50.4' );
69
-
70
- // define( 'WP_FS__LOCALHOST_IP', WP_FS__VVV_DEFAULT_PUBLIC_IP );
71
- }
72
-
73
- /**
74
- * If true and running with secret key, the opt-in process
75
- * will skip the email activation process which is invoked
76
- * when the email of the context user already exist in Freemius
77
- * database (as a security precaution, to prevent sharing user
78
- * secret with unauthorized entity).
79
- *
80
- * IMPORTANT:
81
- * AS A SECURITY PRECAUTION, WE VALIDATE THE TIMESTAMP OF THE OPT-IN REQUEST.
82
- * THEREFORE, MAKE SURE THAT WHEN USING THIS PARAMETER,YOUR TESTING ENVIRONMENT'S
83
- * CLOCK IS SYNCED.
84
- */
85
- if ( ! defined( 'WP_FS__SKIP_EMAIL_ACTIVATION' ) ) {
86
- define( 'WP_FS__SKIP_EMAIL_ACTIVATION', false );
87
- }
88
-
89
-
90
- /**
91
- * Directories
92
- */
93
- define( 'WP_FS__DIR', dirname( __FILE__ ) );
94
- define( 'WP_FS__DIR_INCLUDES', WP_FS__DIR . '/includes' );
95
- define( 'WP_FS__DIR_TEMPLATES', WP_FS__DIR . '/templates' );
96
- define( 'WP_FS__DIR_ASSETS', WP_FS__DIR . '/assets' );
97
- define( 'WP_FS__DIR_CSS', WP_FS__DIR_ASSETS . '/css' );
98
- define( 'WP_FS__DIR_JS', WP_FS__DIR_ASSETS . '/js' );
99
- define( 'WP_FS__DIR_IMG', WP_FS__DIR_ASSETS . '/img' );
100
- define( 'WP_FS__DIR_SDK', WP_FS__DIR_INCLUDES . '/sdk' );
101
-
102
-
103
- /**
104
- * Domain / URL / Address
105
- */
106
- define( 'WP_FS__DOMAIN_PRODUCTION', 'wp.freemius.com' );
107
- define( 'WP_FS__ADDRESS_PRODUCTION', 'https://' . WP_FS__DOMAIN_PRODUCTION );
108
-
109
- if ( ! defined( 'WP_FS__DOMAIN_LOCALHOST' ) ) {
110
- define( 'WP_FS__DOMAIN_LOCALHOST', 'wp.freemius' );
111
- }
112
- if ( ! defined( 'WP_FS__ADDRESS_LOCALHOST' ) ) {
113
- define( 'WP_FS__ADDRESS_LOCALHOST', 'http://' . WP_FS__DOMAIN_LOCALHOST . ':8080' );
114
- }
115
-
116
- if ( ! defined( 'WP_FS__TESTING_DOMAIN' ) ) {
117
- define( 'WP_FS__TESTING_DOMAIN', 'fswp' );
118
- }
119
-
120
- if ( ! defined( 'WP_FS__API_ADDRESS_LOCALHOST' ) ) {
121
- define( 'WP_FS__API_ADDRESS_LOCALHOST', 'http://api.freemius:8080' );
122
- }
123
- if ( ! defined( 'WP_FS__API_SANDBOX_ADDRESS_LOCALHOST' ) ) {
124
- define( 'WP_FS__API_SANDBOX_ADDRESS_LOCALHOST', 'http://sandbox-api.freemius:8080' );
125
- }
126
-
127
- define( 'WP_FS__IS_HTTP_REQUEST', isset( $_SERVER['HTTP_HOST'] ) );
128
- define( 'WP_FS__REMOTE_ADDR', fs_get_ip() );
129
-
130
- if ( ! defined( 'WP_FS__IS_PRODUCTION_MODE' ) ) {
131
- // By default, run with Freemius production servers.
132
- define( 'WP_FS__IS_PRODUCTION_MODE', true );
133
- }
134
-
135
- define( 'WP_FS__ADDRESS', ( WP_FS__IS_PRODUCTION_MODE ? WP_FS__ADDRESS_PRODUCTION : WP_FS__ADDRESS_LOCALHOST ) );
136
-
137
- if ( defined( 'WP_FS__LOCALHOST_IP' ) ) {
138
- define( 'WP_FS__IS_LOCALHOST', ( WP_FS__LOCALHOST_IP === WP_FS__REMOTE_ADDR ) );
139
- } else {
140
- define( 'WP_FS__IS_LOCALHOST', WP_FS__IS_HTTP_REQUEST &&
141
- is_string( WP_FS__REMOTE_ADDR ) &&
142
- ( substr( WP_FS__REMOTE_ADDR, 0, 4 ) == '127.' ||
143
- WP_FS__REMOTE_ADDR == '::1' )
144
- );
145
- }
146
-
147
- define( 'WP_FS__IS_LOCALHOST_FOR_SERVER', ( ! WP_FS__IS_HTTP_REQUEST ||
148
- false !== strpos( $_SERVER['HTTP_HOST'], 'localhost' ) ) );
149
-
150
- // Set API address for local testing.
151
- if ( ! WP_FS__IS_PRODUCTION_MODE ) {
152
- define( 'FS_API__ADDRESS', WP_FS__API_ADDRESS_LOCALHOST );
153
- define( 'FS_API__SANDBOX_ADDRESS', WP_FS__API_SANDBOX_ADDRESS_LOCALHOST );
154
- }
155
-
156
- define( 'WP_FS___OPTION_PREFIX', 'fs' . ( WP_FS__IS_PRODUCTION_MODE ? '' : '_dbg' ) . '_' );
157
-
158
- if ( ! defined( 'WP_FS__ACCOUNTS_OPTION_NAME' ) ) {
159
- define( 'WP_FS__ACCOUNTS_OPTION_NAME', WP_FS___OPTION_PREFIX . 'accounts' );
160
- }
161
- if ( ! defined( 'WP_FS__API_CACHE_OPTION_NAME' ) ) {
162
- define( 'WP_FS__API_CACHE_OPTION_NAME', WP_FS___OPTION_PREFIX . 'api_cache' );
163
- }
164
- define( 'WP_FS__OPTIONS_OPTION_NAME', WP_FS___OPTION_PREFIX . 'options' );
165
-
166
- define( 'WP_FS__IS_HTTPS', ( WP_FS__IS_HTTP_REQUEST &&
167
- // Checks if CloudFlare's HTTPS (Flexible SSL support)
168
- isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && 'https' === strtolower( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ) ||
169
- // Check if HTTPS request.
170
- ( isset( $_SERVER['HTTPS'] ) && 'on' == $_SERVER['HTTPS'] ) ||
171
- ( isset( $_SERVER['SERVER_PORT'] ) && 443 == $_SERVER['SERVER_PORT'] )
172
- );
173
-
174
- define( 'WP_FS__IS_POST_REQUEST', ( WP_FS__IS_HTTP_REQUEST &&
175
- strtoupper( $_SERVER['REQUEST_METHOD'] ) == 'POST' ) );
176
-
177
- /**
178
- * Billing Frequencies
179
- */
180
- define( 'WP_FS__PERIOD_ANNUALLY', 'annual' );
181
- define( 'WP_FS__PERIOD_MONTHLY', 'monthly' );
182
- define( 'WP_FS__PERIOD_LIFETIME', 'lifetime' );
183
-
184
- /**
185
- * Plans
186
- */
187
- define( 'WP_FS__PLAN_DEFAULT_PAID', false );
188
- define( 'WP_FS__PLAN_FREE', 'free' );
189
- define( 'WP_FS__PLAN_TRIAL', 'trial' );
190
-
191
- /**
192
- * Times in seconds
193
- */
194
- define( 'WP_FS__TIME_5_MIN_IN_SEC', 300 );
195
- define( 'WP_FS__TIME_10_MIN_IN_SEC', 600 );
196
- // define( 'WP_FS__TIME_15_MIN_IN_SEC', 900 );
197
- define( 'WP_FS__TIME_24_HOURS_IN_SEC', 86400 );
198
-
199
- /**
200
- * Debugging
201
- */
202
- if ( ! defined( 'WP_FS__DEBUG_SDK' ) ) {
203
- $debug_mode = get_option( 'fs_debug_mode', null );
204
-
205
- if ( $debug_mode === null ) {
206
- $debug_mode = false;
207
- add_option( 'fs_debug_mode', $debug_mode );
208
- }
209
-
210
- define( 'WP_FS__DEBUG_SDK', is_numeric( $debug_mode ) ? ( 0 < $debug_mode ) : WP_FS__DEV_MODE );
211
- }
212
-
213
- define( 'WP_FS__ECHO_DEBUG_SDK', WP_FS__DEV_MODE && ! empty( $_GET['fs_dbg_echo'] ) );
214
- define( 'WP_FS__LOG_DATETIME_FORMAT', 'Y-n-d H:i:s' );
215
- if ( ! defined( 'FS_API__LOGGER_ON' ) ) {
216
- define( 'FS_API__LOGGER_ON', WP_FS__DEBUG_SDK );
217
- }
218
-
219
- if ( WP_FS__ECHO_DEBUG_SDK ) {
220
- error_reporting( E_ALL );
221
- ini_set( 'error_reporting', E_ALL );
222
- ini_set( 'display_errors', true );
223
- ini_set( 'html_errors', true );
224
- }
225
-
226
-
227
- define( 'WP_FS__SCRIPT_START_TIME', time() );
228
- define( 'WP_FS__DEFAULT_PRIORITY', 10 );
229
- define( 'WP_FS__LOWEST_PRIORITY', 999999999 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/class-freemius-abstract.php DELETED
@@ -1,454 +0,0 @@
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
- if ( ! defined( 'ABSPATH' ) ) {
9
- exit;
10
- }
11
-
12
-
13
- /**
14
- * - Each instance of Freemius class represents a single plugin
15
- * install by a single user (the installer of the plugin).
16
- *
17
- * - Each website can only have one install of the same plugin.
18
- *
19
- * - Install entity is only created after a user connects his account with Freemius.
20
- *
21
- * Class Freemius_Abstract
22
- */
23
- abstract class Freemius_Abstract {
24
-
25
- #region Identity ------------------------------------------------------------------
26
-
27
- /**
28
- * Check if user registered with Freemius by connecting his account.
29
- *
30
- * @since 1.0.1
31
- * @return bool
32
- */
33
- abstract function is_registered();
34
-
35
- /**
36
- * Check if the user skipped connecting the account with Freemius.
37
- *
38
- * @since 1.0.7
39
- *
40
- * @return bool
41
- */
42
- abstract function is_anonymous();
43
-
44
- /**
45
- * Check if the user currently in activation mode.
46
- *
47
- * @since 1.0.7
48
- *
49
- * @return bool
50
- */
51
- abstract function is_activation_mode();
52
-
53
- #endregion Identity ------------------------------------------------------------------
54
-
55
- #region Permissions ------------------------------------------------------------------
56
-
57
- /**
58
- * Check if plugin must be WordPress.org compliant.
59
- *
60
- * @since 1.0.7
61
- *
62
- * @return bool
63
- */
64
- abstract function is_org_repo_compliant();
65
-
66
- /**
67
- * Check if plugin is allowed to install executable files.
68
- *
69
- * @author Vova Feldman (@svovaf)
70
- * @since 1.0.5
71
- *
72
- * @return bool
73
- */
74
- function is_allowed_to_install() {
75
- return ( $this->is_premium() || ! $this->is_org_repo_compliant() );
76
- }
77
-
78
- #endregion Permissions ------------------------------------------------------------------
79
-
80
- /**
81
- * Check if user in trial or in free plan (not paying).
82
- *
83
- * @author Vova Feldman (@svovaf)
84
- * @since 1.0.4
85
- *
86
- * @return bool
87
- */
88
- function is_not_paying() {
89
- return ( $this->is_trial() || $this->is_free_plan() );
90
- }
91
-
92
- /**
93
- * Check if the user has an activated and valid paid license on current plugin's install.
94
- *
95
- * @since 1.0.9
96
- *
97
- * @return bool
98
- */
99
- abstract function is_paying();
100
-
101
- /**
102
- * Check if the user is paying or in trial.
103
- *
104
- * @since 1.0.9
105
- *
106
- * @return bool
107
- */
108
- function is_paying_or_trial() {
109
- return ( $this->is_paying() || $this->is_trial() );
110
- }
111
-
112
- /**
113
- * Check if user in a trial or have feature enabled license.
114
- *
115
- * @author Vova Feldman (@svovaf)
116
- * @since 1.1.7
117
- *
118
- * @return bool
119
- */
120
- abstract function can_use_premium_code();
121
-
122
- #region Premium Only ------------------------------------------------------------------
123
-
124
- /**
125
- * All logic wrapped in methods with "__premium_only()" suffix will be only
126
- * included in the premium code.
127
- *
128
- * Example:
129
- * if ( freemius()->is__premium_only() ) {
130
- * ...
131
- * }
132
- */
133
-
134
- /**
135
- * Returns true when running premium plugin code.
136
- *
137
- * @since 1.0.9
138
- *
139
- * @return bool
140
- */
141
- function is__premium_only() {
142
- return $this->is_premium();
143
- }
144
-
145
- /**
146
- * Check if the user has an activated and valid paid license on current plugin's install.
147
- *
148
- * @since 1.0.9
149
- *
150
- * @return bool
151
- *
152
- */
153
- function is_paying__premium_only() {
154
- return ( $this->is__premium_only() && $this->is_paying() );
155
- }
156
-
157
- /**
158
- * All code wrapped in this statement will be only included in the premium code.
159
- *
160
- * @since 1.0.9
161
- *
162
- * @param string $plan Plan name
163
- * @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
164
- *
165
- * @return bool
166
- */
167
- function is_plan__premium_only( $plan, $exact = false ) {
168
- return ( $this->is_premium() && $this->is_plan( $plan, $exact ) );
169
- }
170
-
171
- /**
172
- * Check if plan matches active license' plan or active trial license' plan.
173
- *
174
- * All code wrapped in this statement will be only included in the premium code.
175
- *
176
- * @since 1.0.9
177
- *
178
- * @param string $plan Plan name
179
- * @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
180
- *
181
- * @return bool
182
- */
183
- function is_plan_or_trial__premium_only( $plan, $exact = false ) {
184
- return ( $this->is_premium() && $this->is_plan_or_trial( $plan, $exact ) );
185
- }
186
-
187
- /**
188
- * Check if the user is paying or in trial.
189
- *
190
- * All code wrapped in this statement will be only included in the premium code.
191
- *
192
- * @since 1.0.9
193
- *
194
- * @return bool
195
- */
196
- function is_paying_or_trial__premium_only() {
197
- return $this->is_premium() && $this->is_paying_or_trial();
198
- }
199
-
200
- /**
201
- * Check if the user has an activated and valid paid license on current plugin's install.
202
- *
203
- * @since 1.0.4
204
- *
205
- * @return bool
206
- *
207
- * @deprecated Method name is confusing since it's not clear from the name the code will be removed.
208
- * @using Alias to is_paying__premium_only()
209
- */
210
- function is_paying__fs__() {
211
- return $this->is_paying__premium_only();
212
- }
213
-
214
- /**
215
- * Check if user in a trial or have feature enabled license.
216
- *
217
- * All code wrapped in this statement will be only included in the premium code.
218
- *
219
- * @author Vova Feldman (@svovaf)
220
- * @since 1.1.9
221
- *
222
- * @return bool
223
- */
224
- function can_use_premium_code__premium_only() {
225
- return $this->is_premium() && $this->can_use_premium_code();
226
- }
227
-
228
- #endregion Premium Only ------------------------------------------------------------------
229
-
230
- #region Trial ------------------------------------------------------------------
231
-
232
- /**
233
- * Check if the user in a trial.
234
- *
235
- * @since 1.0.3
236
- *
237
- * @return bool
238
- */
239
- abstract function is_trial();
240
-
241
- /**
242
- * Check if trial already utilized.
243
- *
244
- * @since 1.0.9
245
- *
246
- * @return bool
247
- */
248
- abstract function is_trial_utilized();
249
-
250
- #endregion Trial ------------------------------------------------------------------
251
-
252
- #region Plans ------------------------------------------------------------------
253
-
254
- /**
255
- * Check if plugin using the free plan.
256
- *
257
- * @since 1.0.4
258
- *
259
- * @return bool
260
- */
261
- abstract function is_free_plan();
262
-
263
- /**
264
- * @since 1.0.2
265
- *
266
- * @param string $plan Plan name
267
- * @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
268
- *
269
- * @return bool
270
- */
271
- abstract function is_plan( $plan, $exact = false );
272
-
273
- /**
274
- * Check if plan based on trial. If not in trial mode, should return false.
275
- *
276
- * @since 1.0.9
277
- *
278
- * @param string $plan Plan name
279
- * @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
280
- *
281
- * @return bool
282
- */
283
- abstract function is_trial_plan( $plan, $exact = false );
284
-
285
- /**
286
- * Check if plan matches active license' plan or active trial license' plan.
287
- *
288
- * @since 1.0.9
289
- *
290
- * @param string $plan Plan name
291
- * @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
292
- *
293
- * @return bool
294
- */
295
- function is_plan_or_trial( $plan, $exact = false ) {
296
- return $this->is_plan( $plan, $exact ) ||
297
- $this->is_trial_plan( $plan, $exact );
298
- }
299
-
300
- /**
301
- * Check if plugin has any paid plans.
302
- *
303
- * @author Vova Feldman (@svovaf)
304
- * @since 1.0.7
305
- *
306
- * @return bool
307
- */
308
- abstract function has_paid_plan();
309
-
310
- /**
311
- * Check if plugin has any free plan, or is it premium only.
312
- *
313
- * Note: If no plans configured, assume plugin is free.
314
- *
315
- * @author Vova Feldman (@svovaf)
316
- * @since 1.0.7
317
- *
318
- * @return bool
319
- */
320
- abstract function has_free_plan();
321
-
322
- /**
323
- * Check if plugin is premium only (no free plans).
324
- *
325
- * NOTE: is__premium_only() is very different method, don't get confused.
326
- *
327
- * @author Vova Feldman (@svovaf)
328
- * @since 1.1.9
329
- *
330
- * @return bool
331
- */
332
- abstract function is_only_premium();
333
-
334
- /**
335
- * Checks if it's a freemium plugin.
336
- *
337
- * @author Vova Feldman (@svovaf)
338
- * @since 1.1.9
339
- *
340
- * @return bool
341
- */
342
- function is_freemium() {
343
- return ! $this->is_only_premium() &&
344
- $this->has_paid_plan() &&
345
- $this->has_free_plan();
346
- }
347
-
348
- #endregion Plans ------------------------------------------------------------------
349
-
350
- /**
351
- * Check if running payments in sandbox mode.
352
- *
353
- * @since 1.0.4
354
- *
355
- * @return bool
356
- */
357
- abstract function is_payments_sandbox();
358
-
359
- /**
360
- * Check if running test vs. live plugin.
361
- *
362
- * @since 1.0.5
363
- *
364
- * @return bool
365
- */
366
- abstract function is_live();
367
-
368
- /**
369
- * Check if running premium plugin code.
370
- *
371
- * @since 1.0.5
372
- *
373
- * @return bool
374
- */
375
- abstract function is_premium();
376
-
377
- /**
378
- * Get upgrade URL.
379
- *
380
- * @author Vova Feldman (@svovaf)
381
- * @since 1.0.2
382
- *
383
- * @param string $period Billing cycle
384
- *
385
- * @return string
386
- */
387
- abstract function get_upgrade_url( $period = WP_FS__PERIOD_ANNUALLY );
388
-
389
- /**
390
- * Check if Freemius was first added in a plugin update.
391
- *
392
- * @author Vova Feldman (@svovaf)
393
- * @since 1.1.5
394
- *
395
- * @return bool
396
- */
397
- function is_plugin_update() {
398
- return ! $this->is_plugin_new_install();
399
- }
400
-
401
- /**
402
- * Check if Freemius was part of the plugin when the user installed it first.
403
- *
404
- * @author Vova Feldman (@svovaf)
405
- * @since 1.1.5
406
- *
407
- * @return bool
408
- */
409
- abstract function is_plugin_new_install();
410
-
411
- #region Marketing ------------------------------------------------------------------
412
-
413
- /**
414
- * Check if current user purchased any other plugins before.
415
- *
416
- * @author Vova Feldman (@svovaf)
417
- * @since 1.0.9
418
- *
419
- * @return bool
420
- */
421
- abstract function has_purchased_before();
422
-
423
- /**
424
- * Check if current user classified as an agency.
425
- *
426
- * @author Vova Feldman (@svovaf)
427
- * @since 1.0.9
428
- *
429
- * @return bool
430
- */
431
- abstract function is_agency();
432
-
433
- /**
434
- * Check if current user classified as a developer.
435
- *
436
- * @author Vova Feldman (@svovaf)
437
- * @since 1.0.9
438
- *
439
- * @return bool
440
- */
441
- abstract function is_developer();
442
-
443
- /**
444
- * Check if current user classified as a business.
445
- *
446
- * @author Vova Feldman (@svovaf)
447
- * @since 1.0.9
448
- *
449
- * @return bool
450
- */
451
- abstract function is_business();
452
-
453
- #endregion ------------------------------------------------------------------
454
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/class-freemius.php DELETED
@@ -1,10148 +0,0 @@
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
- if ( ! defined( 'ABSPATH' ) ) {
9
- exit;
10
- }
11
-
12
- // "final class"
13
- class Freemius extends Freemius_Abstract {
14
- /**
15
- * SDK Version
16
- *
17
- * @var string
18
- */
19
- public $version = WP_FS__SDK_VERSION;
20
-
21
- #region Plugin Info
22
-
23
- /**
24
- * @since 1.0.1
25
- *
26
- * @var string
27
- */
28
- private $_slug;
29
-
30
- /**
31
- * @since 1.0.0
32
- *
33
- * @var string
34
- */
35
- private $_plugin_basename;
36
- /**
37
- * @since 1.0.0
38
- *
39
- * @var string
40
- */
41
- private $_free_plugin_basename;
42
- /**
43
- * @since 1.0.0
44
- *
45
- * @var string
46
- */
47
- private $_plugin_dir_path;
48
- /**
49
- * @since 1.0.0
50
- *
51
- * @var string
52
- */
53
- private $_plugin_dir_name;
54
- /**
55
- * @since 1.0.0
56
- *
57
- * @var string
58
- */
59
- private $_plugin_main_file_path;
60
- /**
61
- * @var string[]
62
- */
63
- private $_plugin_data;
64
- /**
65
- * @since 1.0.9
66
- *
67
- * @var string
68
- */
69
- private $_plugin_name;
70
-
71
- #endregion Plugin Info
72
-
73
- /**
74
- * @since 1.0.9
75
- *
76
- * @var bool If false, don't turn Freemius on.
77
- */
78
- private $_is_on;
79
-
80
- /**
81
- * @since 1.1.3
82
- *
83
- * @var bool If false, don't turn Freemius on.
84
- */
85
- private $_is_anonymous;
86
-
87
- /**
88
- * @since 1.0.9
89
- * @var bool If false, issues with connectivity to Freemius API.
90
- */
91
- private $_has_api_connection;
92
-
93
- /**
94
- * @since 1.0.9
95
- * @var bool Hints the SDK if plugin can support anonymous mode (if skip connect is visible).
96
- */
97
- private $_enable_anonymous;
98
-
99
- /**
100
- * @since 1.1.7.5
101
- * @var bool Hints the SDK if plugin should run in anonymous mode (only adds feedback form).
102
- */
103
- private $_anonymous_mode;
104
-
105
- /**
106
- * @since 1.1.9
107
- * @var bool Hints the SDK if plugin have any free plans.
108
- */
109
- private $_is_premium_only;
110
-
111
- /**
112
- * @since 1.0.8
113
- * @var bool Hints the SDK if the plugin has any paid plans.
114
- */
115
- private $_has_paid_plans;
116
-
117
- /**
118
- * @since 1.0.7
119
- * @var bool Hints the SDK if the plugin is WordPress.org compliant.
120
- */
121
- private $_is_org_compliant;
122
-
123
- /**
124
- * @since 1.0.7
125
- * @var bool Hints the SDK if the plugin is has add-ons.
126
- */
127
- private $_has_addons;
128
-
129
- /**
130
- * @since 1.1.6
131
- * @var string[]bool.
132
- */
133
- private $_permissions;
134
-
135
- /**
136
- * @var FS_Key_Value_Storage
137
- */
138
- private $_storage;
139
-
140
- /**
141
- * @since 1.0.0
142
- *
143
- * @var FS_Logger
144
- */
145
- private $_logger;
146
- /**
147
- * @since 1.0.4
148
- *
149
- * @var FS_Plugin
150
- */
151
- private $_plugin = false;
152
- /**
153
- * @since 1.0.4
154
- *
155
- * @var FS_Plugin|false
156
- */
157
- private $_parent_plugin = false;
158
- /**
159
- * @since 1.1.1
160
- *
161
- * @var Freemius
162
- */
163
- private $_parent = false;
164
- /**
165
- * @since 1.0.1
166
- *
167
- * @var FS_User
168
- */
169
- private $_user = false;
170
- /**
171
- * @since 1.0.1
172
- *
173
- * @var FS_Site
174
- */
175
- private $_site = false;
176
- /**
177
- * @since 1.0.1
178
- *
179
- * @var FS_Plugin_License
180
- */
181
- private $_license;
182
- /**
183
- * @since 1.0.2
184
- *
185
- * @var FS_Plugin_Plan[]
186
- */
187
- private $_plans = false;
188
- /**
189
- * @var FS_Plugin_License[]
190
- * @since 1.0.5
191
- */
192
- private $_licenses = false;
193
-
194
- /**
195
- * @since 1.0.1
196
- *
197
- * @var FS_Admin_Menu_Manager
198
- */
199
- private $_menu;
200
-
201
- /**
202
- * @var FS_Admin_Notice_Manager
203
- */
204
- private $_admin_notices;
205
-
206
- /**
207
- * @since 1.1.6
208
- *
209
- * @var FS_Admin_Notice_Manager
210
- */
211
- private static $_global_admin_notices;
212
-
213
- /**
214
- * @var FS_Logger
215
- * @since 1.0.0
216
- */
217
- private static $_static_logger;
218
-
219
- /**
220
- * @var FS_Option_Manager
221
- * @since 1.0.2
222
- */
223
- private static $_accounts;
224
-
225
- /**
226
- * @var Freemius[]
227
- */
228
- private static $_instances = array();
229
-
230
-
231
- /* Ctor
232
- ------------------------------------------------------------------------------------------------------------------*/
233
-
234
- private function __construct( $slug ) {
235
- $this->_slug = $slug;
236
-
237
- $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $slug, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
238
-
239
- $this->_storage = FS_Key_Value_Storage::instance( 'plugin_data', $this->_slug );
240
-
241
- $this->_plugin_main_file_path = $this->_find_caller_plugin_file();
242
- $this->_plugin_dir_path = plugin_dir_path( $this->_plugin_main_file_path );
243
- $this->_plugin_basename = plugin_basename( $this->_plugin_main_file_path );
244
- $this->_free_plugin_basename = str_replace( '-premium/', '/', $this->_plugin_basename );
245
-
246
- $base_name_split = explode( '/', $this->_plugin_basename );
247
- $this->_plugin_dir_name = $base_name_split[0];
248
-
249
- if ( $this->_logger->is_on() ) {
250
- $this->_logger->info( 'plugin_main_file_path = ' . $this->_plugin_main_file_path );
251
- $this->_logger->info( 'plugin_dir_path = ' . $this->_plugin_dir_path );
252
- $this->_logger->info( 'plugin_basename = ' . $this->_plugin_basename );
253
- $this->_logger->info( 'free_plugin_basename = ' . $this->_free_plugin_basename );
254
- $this->_logger->info( 'plugin_dir_name = ' . $this->_plugin_dir_name );
255
- }
256
-
257
- // Remember link between file to slug.
258
- $this->store_file_slug_map();
259
-
260
- // Store plugin's initial install timestamp.
261
- if ( ! isset( $this->_storage->install_timestamp ) ) {
262
- $this->_storage->install_timestamp = WP_FS__SCRIPT_START_TIME;
263
- }
264
-
265
- $this->_plugin = FS_Plugin_Manager::instance( $this->_slug )->get();
266
-
267
- $this->_admin_notices = FS_Admin_Notice_Manager::instance(
268
- $slug,
269
- is_object( $this->_plugin ) ? $this->_plugin->title : ''
270
- );
271
-
272
- if ( 'true' === fs_request_get( 'fs_clear_api_cache' ) ||
273
- 'true' === fs_request_is_action( 'restart_freemius' )
274
- ) {
275
- FS_Api::clear_cache();
276
- }
277
-
278
- $this->_register_hooks();
279
-
280
- $this->_load_account();
281
-
282
- $this->_version_updates_handler();
283
- }
284
-
285
- /**
286
- * @author Vova Feldman (@svovaf)
287
- * @since 1.0.9
288
- */
289
- private function _version_updates_handler() {
290
- if ( ! isset( $this->_storage->sdk_version ) || $this->_storage->sdk_version != $this->version ) {
291
- // Freemius version upgrade mode.
292
- $this->_storage->sdk_last_version = $this->_storage->sdk_version;
293
- $this->_storage->sdk_version = $this->version;
294
-
295
- if ( empty( $this->_storage->sdk_last_version ) ||
296
- version_compare( $this->_storage->sdk_last_version, $this->version, '<' )
297
- ) {
298
- $this->_storage->sdk_upgrade_mode = true;
299
- $this->_storage->sdk_downgrade_mode = false;
300
- } else {
301
- $this->_storage->sdk_downgrade_mode = true;
302
- $this->_storage->sdk_upgrade_mode = false;
303
-
304
- }
305
-
306
- $this->do_action( 'sdk_version_update', $this->_storage->sdk_last_version, $this->version );
307
- }
308
-
309
- $plugin_version = $this->get_plugin_version();
310
- if ( ! isset( $this->_storage->plugin_version ) || $this->_storage->plugin_version != $plugin_version ) {
311
- // Plugin version upgrade mode.
312
- $this->_storage->plugin_last_version = $this->_storage->plugin_version;
313
- $this->_storage->plugin_version = $plugin_version;
314
-
315
- if ( empty( $this->_storage->plugin_last_version ) ||
316
- version_compare( $this->_storage->plugin_last_version, $plugin_version, '<' )
317
- ) {
318
- $this->_storage->plugin_upgrade_mode = true;
319
- $this->_storage->plugin_downgrade_mode = false;
320
- } else {
321
- $this->_storage->plugin_downgrade_mode = true;
322
- $this->_storage->plugin_upgrade_mode = false;
323
- }
324
-
325
- if ( ! empty( $this->_storage->plugin_last_version ) ) {
326
- // Different version of the plugin was installed before, therefore it's an update.
327
- $this->_storage->is_plugin_new_install = false;
328
- }
329
-
330
- $this->do_action( 'plugin_version_update', $this->_storage->plugin_last_version, $plugin_version );
331
- }
332
- }
333
-
334
- /**
335
- * @author Vova Feldman (@svovaf)
336
- * @since 1.1.5
337
- *
338
- * @param string $sdk_prev_version
339
- * @param string $sdk_version
340
- */
341
- function _data_migration( $sdk_prev_version, $sdk_version ) {
342
- /**
343
- * @since 1.1.7.3 Fixed unwanted connectivity test cleanup.
344
- */
345
- if ( empty( $sdk_prev_version ) ) {
346
- return;
347
- }
348
-
349
- if ( version_compare( $sdk_prev_version, '1.1.5', '<' ) &&
350
- version_compare( $sdk_version, '1.1.5', '>=' )
351
- ) {
352
- // On version 1.1.5 merged connectivity and is_on data.
353
- if ( isset( $this->_storage->connectivity_test ) ) {
354
- if ( ! isset( $this->_storage->is_on ) ) {
355
- unset( $this->_storage->connectivity_test );
356
- } else {
357
- $connectivity_data = $this->_storage->connectivity_test;
358
- $connectivity_data['is_active'] = $this->_storage->is_on['is_active'];
359
- $connectivity_data['timestamp'] = $this->_storage->is_on['timestamp'];
360
-
361
- // Override.
362
- $this->_storage->connectivity_test = $connectivity_data;
363
-
364
- // Remove previous structure.
365
- unset( $this->_storage->is_on );
366
- }
367
-
368
- }
369
- }
370
- }
371
-
372
- /**
373
- * This action is connected to the 'plugins_loaded' hook and helps to determine
374
- * if this is a new plugin installation or a plugin update.
375
- *
376
- * There are 3 different use-cases:
377
- * 1) New plugin installation right with Freemius:
378
- * 1.1 _activate_plugin_event_hook() will be executed first
379
- * 1.2 Since $this->_storage->is_plugin_new_install is not set,
380
- * and $this->_storage->plugin_last_version is not set,
381
- * $this->_storage->is_plugin_new_install will be set to TRUE.
382
- * 1.3 When _plugins_loaded() will be executed, $this->_storage->is_plugin_new_install will
383
- * be already set to TRUE.
384
- *
385
- * 2) Plugin update, didn't have Freemius before, and now have the SDK:
386
- * 2.1 _activate_plugin_event_hook() will not be executed, because
387
- * the activation hook do NOT fires on updates since WP 3.1.
388
- * 2.2 When _plugins_loaded() will be executed, $this->_storage->is_plugin_new_install will
389
- * be empty, therefore, it will be set to FALSE.
390
- *
391
- * 3) Plugin update, had Freemius in prev version as well:
392
- * 3.1 _version_updates_handler() will be executed 1st, since FS was installed
393
- * before, $this->_storage->plugin_last_version will NOT be empty,
394
- * therefore, $this->_storage->is_plugin_new_install will be set to FALSE.
395
- * 3.2 When _plugins_loaded() will be executed, $this->_storage->is_plugin_new_install is
396
- * already set, therefore, it will not be modified.
397
- *
398
- * Use-case #3 is backward compatible, #3.1 will be executed since 1.0.9.
399
- *
400
- * NOTE:
401
- * The only fallback of this mechanism is if an admin updates a plugin based on use-case #2,
402
- * and then, the next immediate PageView is the plugin's main settings page, it will not
403
- * show the opt-in right away. The reason it will happen is because Freemius execution
404
- * will be turned off till the plugin is fully loaded at least once
405
- * (till $this->_storage->was_plugin_loaded is TRUE).
406
- *
407
- * @author Vova Feldman (@svovaf)
408
- * @since 1.1.9
409
- *
410
- */
411
- function _plugins_loaded() {
412
- // Update flag that plugin was loaded with Freemius at least once.
413
- $this->_storage->was_plugin_loaded = true;
414
-
415
- if ( ! isset( $this->_storage->is_plugin_new_install ) ) {
416
- $this->_storage->is_plugin_new_install = false;
417
- }
418
- }
419
-
420
- /**
421
- * @author Vova Feldman (@svovaf)
422
- * @since 1.0.9
423
- */
424
- private function _register_hooks() {
425
- if ( is_admin() ) {
426
- // Hook to plugin activation
427
- register_activation_hook( $this->_plugin_main_file_path, array(
428
- &$this,
429
- '_activate_plugin_event_hook'
430
- ) );
431
-
432
- /**
433
- * Part of the mechanism to identify new plugin install vs. plugin update.
434
- *
435
- * @author Vova Feldman (@svovaf)
436
- * @since 1.1.9
437
- */
438
- if ( empty( $this->_storage->was_plugin_loaded ) ) {
439
- if ( $this->is_activation_mode( false ) ) {
440
- add_action( 'plugins_loaded', array( &$this, '_plugins_loaded' ) );
441
- } else {
442
- // If was activated before, then it was already loaded before.
443
- $this->_plugins_loaded();
444
- }
445
- }
446
-
447
- if ( ! $this->is_ajax() ) {
448
- if ( ! $this->is_addon() ) {
449
- add_action( 'init', array( &$this, '_add_default_submenu_items' ), WP_FS__LOWEST_PRIORITY );
450
- add_action( 'admin_menu', array( &$this, '_prepare_admin_menu' ), WP_FS__LOWEST_PRIORITY );
451
- }
452
- }
453
- }
454
-
455
- register_deactivation_hook( $this->_plugin_main_file_path, array( &$this, '_deactivate_plugin_hook' ) );
456
-
457
- add_action( 'init', array( &$this, '_redirect_on_clicked_menu_link' ), WP_FS__LOWEST_PRIORITY );
458
-
459
- $this->add_action( 'after_plans_sync', array( &$this, '_check_for_trial_plans' ) );
460
-
461
- $this->add_action( 'sdk_version_update', array( &$this, '_data_migration' ), WP_FS__DEFAULT_PRIORITY, 2 );
462
- }
463
-
464
- /**
465
- * Keeping the uninstall hook registered for free or premium plugin version may result to a fatal error that
466
- * could happen when a user tries to uninstall either version while one of them is still active. Uninstalling a
467
- * plugin will trigger inclusion of the free or premium version and if one of them is active during the
468
- * uninstallation, a fatal error may occur in case the plugin's class or functions are already defined.
469
- *
470
- * @author Leo Fajardo (leorw)
471
- *
472
- * @since 1.2.0
473
- */
474
- private function unregister_uninstall_hook() {
475
- $uninstallable_plugins = (array) get_option( 'uninstall_plugins' );
476
- unset( $uninstallable_plugins[ $this->_free_plugin_basename ] );
477
- unset( $uninstallable_plugins[ $this->premium_plugin_basename() ] );
478
-
479
- update_option( 'uninstall_plugins', $uninstallable_plugins );
480
- }
481
-
482
- /**
483
- * @since 1.2.0 Invalidate module's main file cache, otherwise, FS_Plugin_Updater will not fetch updates.
484
- */
485
- private function clear_module_main_file_cache() {
486
- unset( $this->_storage->plugin_main_file );
487
- }
488
-
489
- /**
490
- * @author Vova Feldman (@svovaf)
491
- * @since 1.0.9
492
- */
493
- private function _register_account_hooks() {
494
- if ( is_admin() ) {
495
- if ( ! $this->is_ajax() ) {
496
- if ( $this->apply_filters( 'show_trial', true ) && $this->has_trial_plan() ) {
497
- $last_time_trial_promotion_shown = $this->_storage->get( 'trial_promotion_shown', false );
498
- if ( ! $this->_site->is_trial_utilized() &&
499
- (
500
- // Show promotion if never shown it yet and 24 hours after initial activation.
501
- ( false === $last_time_trial_promotion_shown && $this->_storage->activation_timestamp < ( time() - WP_FS__TIME_24_HOURS_IN_SEC ) ) ||
502
- // Show promotion in every 30 days.
503
- ( is_numeric( $last_time_trial_promotion_shown ) && 30 * WP_FS__TIME_24_HOURS_IN_SEC < time() - $last_time_trial_promotion_shown ) )
504
- ) {
505
- $this->add_action( 'after_init_plugin_registered', array( &$this, '_add_trial_notice' ) );
506
- }
507
- }
508
- }
509
-
510
- // If user is paying or in trial and have the free version installed,
511
- // assume that the deactivation is for the upgrade process.
512
- if ( ! $this->is_paying_or_trial() || $this->is_premium() ) {
513
- add_action( 'wp_ajax_submit-uninstall-reason', array( &$this, '_submit_uninstall_reason_action' ) );
514
-
515
- global $pagenow;
516
- if ( 'plugins.php' === $pagenow ) {
517
- add_action( 'admin_footer', array( &$this, '_add_deactivation_feedback_dialog_box' ) );
518
- }
519
- }
520
-
521
- if ( ! $this->is_addon() ) {
522
- if ( $this->is_registered() ) {
523
- $this->add_filter( 'after_code_type_change', array( &$this, '_after_code_type_change' ) );
524
- }
525
- }
526
- }
527
- }
528
-
529
- /**
530
- * Leverage backtrace to find caller plugin file path.
531
- *
532
- * @author Vova Feldman (@svovaf)
533
- * @since 1.0.6
534
- *
535
- * @return string
536
- *
537
- * @uses fs_find_caller_plugin_file
538
- */
539
- private function _find_caller_plugin_file() {
540
- // Try to load the cached value of the file path.
541
- if ( isset( $this->_storage->plugin_main_file ) ) {
542
- if ( file_exists( $this->_storage->plugin_main_file->path ) ) {
543
- return $this->_storage->plugin_main_file->path;
544
- }
545
- }
546
-
547
- $plugin_file = fs_find_caller_plugin_file();
548
-
549
- $this->_storage->plugin_main_file = (object) array(
550
- 'path' => fs_normalize_path( $plugin_file ),
551
- );
552
-
553
- return $plugin_file;
554
- }
555
-
556
-
557
- #region Deactivation Feedback Form ------------------------------------------------------------------
558
-
559
- /**
560
- * Displays a confirmation and feedback dialog box when the user clicks on the "Deactivate" link on the plugins
561
- * page.
562
- *
563
- * @author Vova Feldman (@svovaf)
564
- * @author Leo Fajardo (@leorw)
565
- * @since 1.1.2
566
- */
567
- function _add_deactivation_feedback_dialog_box() {
568
- /* Check the type of user:
569
- * 1. Long-term (long-term)
570
- * 2. Non-registered and non-anonymous short-term (non-registered-and-non-anonymous-short-term).
571
- * 3. Short-term (short-term)
572
- */
573
- $is_long_term_user = true;
574
-
575
- // Check if the site is at least 2 days old.
576
- $time_installed = $this->_storage->install_timestamp;
577
-
578
- // Difference in seconds.
579
- $date_diff = time() - $time_installed;
580
-
581
- // Convert seconds to days.
582
- $date_diff_days = floor( $date_diff / ( 60 * 60 * 24 ) );
583
-
584
- if ( $date_diff_days < 2 ) {
585
- $is_long_term_user = false;
586
- }
587
-
588
- $is_long_term_user = $this->apply_filters( 'is_long_term_user', $is_long_term_user );
589
-
590
- if ( $is_long_term_user ) {
591
- $user_type = 'long-term';
592
- } else {
593
- if ( ! $this->is_registered() && ! $this->is_anonymous() ) {
594
- $user_type = 'non-registered-and-non-anonymous-short-term';
595
- } else {
596
- $user_type = 'short-term';
597
- }
598
- }
599
-
600
- $uninstall_reasons = $this->_get_uninstall_reasons( $user_type );
601
-
602
- // Load the HTML template for the deactivation feedback dialog box.
603
- $vars = array(
604
- 'reasons' => $uninstall_reasons,
605
- 'slug' => $this->_slug
606
- );
607
-
608
- /**
609
- * @todo Deactivation form core functions should be loaded only once! Otherwise, when there are multiple Freemius powered plugins the same code is loaded multiple times. The only thing that should be loaded differently is the various deactivation reasons object based on the state of the plugin.
610
- */
611
- fs_require_template( 'forms/deactivation/form.php', $vars );
612
- }
613
-
614
- /**
615
- * @author Leo Fajardo (leorw)
616
- * @since 1.1.2
617
- *
618
- * @param string $user_type
619
- *
620
- * @return array The uninstall reasons for the specified user type.
621
- */
622
- function _get_uninstall_reasons( $user_type = 'long-term' ) {
623
- $internal_message_template_var = array(
624
- 'slug' => $this->_slug
625
- );
626
-
627
- if ( $this->is_registered() && false !== $this->get_plan() && $this->get_plan()->has_technical_support() ) {
628
- $contact_support_template = fs_get_template( 'forms/deactivation/contact.php', $internal_message_template_var );
629
- } else {
630
- $contact_support_template = '';
631
- }
632
-
633
- $reason_found_better_plugin = array(
634
- 'id' => 2,
635
- 'text' => __fs( 'reason-found-a-better-plugin', $this->_slug ),
636
- 'input_type' => 'textfield',
637
- 'input_placeholder' => __fs( 'placeholder-plugin-name', $this->_slug )
638
- );
639
-
640
- $reason_temporary_deactivation = array(
641
- 'id' => 15,
642
- 'text' => __fs( 'reason-temporary-deactivation', $this->_slug ),
643
- 'input_type' => '',
644
- 'input_placeholder' => ''
645
- );
646
-
647
- $reason_other = array(
648
- 'id' => 7,
649
- 'text' => __fs( 'reason-other', $this->_slug ),
650
- 'input_type' => 'textfield',
651
- 'input_placeholder' => ''
652
- );
653
-
654
- $long_term_user_reasons = array(
655
- array(
656
- 'id' => 1,
657
- 'text' => __fs( 'reason-no-longer-needed', $this->_slug ),
658
- 'input_type' => '',
659
- 'input_placeholder' => ''
660
- ),
661
- $reason_found_better_plugin,
662
- array(
663
- 'id' => 3,
664
- 'text' => __fs( 'reason-needed-for-a-short-period', $this->_slug ),
665
- 'input_type' => '',
666
- 'input_placeholder' => ''
667
- ),
668
- array(
669
- 'id' => 4,
670
- 'text' => __fs( 'reason-broke-my-site', $this->_slug ),
671
- 'input_type' => '',
672
- 'input_placeholder' => '',
673
- 'internal_message' => $contact_support_template
674
- ),
675
- array(
676
- 'id' => 5,
677
- 'text' => __fs( 'reason-suddenly-stopped-working', $this->_slug ),
678
- 'input_type' => '',
679
- 'input_placeholder' => '',
680
- 'internal_message' => $contact_support_template
681
- )
682
- );
683
-
684
- if ( $this->is_paying() ) {
685
- $long_term_user_reasons[] = array(
686
- 'id' => 6,
687
- 'text' => __fs( 'reason-cant-pay-anymore', $this->_slug ),
688
- 'input_type' => 'textfield',
689
- 'input_placeholder' => __fs( 'placeholder-comfortable-price', $this->_slug )
690
- );
691
- }
692
-
693
- $reason_dont_share_info = array(
694
- 'id' => 9,
695
- 'text' => __fs( 'reason-dont-like-to-share-my-information', $this->_slug ),
696
- 'input_type' => '',
697
- 'input_placeholder' => ''
698
- );
699
-
700
- /**
701
- * If the current user has selected the "don't share data" reason in the deactivation feedback modal, inform the
702
- * user by showing additional message that he doesn't have to share data and can just choose to skip the opt-in
703
- * (the Skip button is included in the message to show). This message will only be shown if anonymous mode is
704
- * enabled and the user's account is currently not in pending activation state (similar to the way the Skip
705
- * button in the opt-in form is shown/hidden).
706
- */
707
- if ( $this->is_enable_anonymous() && ! $this->is_pending_activation() ) {
708
- $reason_dont_share_info['internal_message'] = fs_get_template( 'forms/deactivation/retry-skip.php', $internal_message_template_var );
709
- }
710
-
711
- $long_term_user_reasons[] = $reason_temporary_deactivation;
712
- $long_term_user_reasons[] = $reason_other;
713
-
714
- $uninstall_reasons = array(
715
- 'long-term' => $long_term_user_reasons,
716
- 'non-registered-and-non-anonymous-short-term' => array(
717
- array(
718
- 'id' => 8,
719
- 'text' => __fs( 'reason-didnt-work', $this->_slug ),
720
- 'input_type' => '',
721
- 'input_placeholder' => ''
722
- ),
723
- $reason_dont_share_info,
724
- $reason_found_better_plugin,
725
- $reason_temporary_deactivation,
726
- $reason_other
727
- ),
728
- 'short-term' => array(
729
- array(
730
- 'id' => 10,
731
- 'text' => __fs( 'reason-couldnt-make-it-work', $this->_slug ),
732
- 'input_type' => '',
733
- 'input_placeholder' => '',
734
- 'internal_message' => $contact_support_template
735
- ),
736
- $reason_found_better_plugin,
737
- array(
738
- 'id' => 11,
739
- 'text' => __fs( 'reason-great-but-need-specific-feature', $this->_slug ),
740
- 'input_type' => 'textarea',
741
- 'input_placeholder' => __fs( 'placeholder-feature', $this->_slug )
742
- ),
743
- array(
744
- 'id' => 12,
745
- 'text' => __fs( 'reason-not-working', $this->_slug ),
746
- 'input_type' => 'textarea',
747
- 'input_placeholder' => __fs( 'placeholder-share-what-didnt-work', $this->_slug )
748
- ),
749
- array(
750
- 'id' => 13,
751
- 'text' => __fs( 'reason-not-what-i-was-looking-for', $this->_slug ),
752
- 'input_type' => 'textarea',
753
- 'input_placeholder' => __fs( 'placeholder-what-youve-been-looking-for', $this->_slug )
754
- ),
755
- array(
756
- 'id' => 14,
757
- 'text' => __fs( 'reason-didnt-work-as-expected', $this->_slug ),
758
- 'input_type' => 'textarea',
759
- 'input_placeholder' => __fs( 'placeholder-what-did-you-expect', $this->_slug )
760
- ),
761
- $reason_temporary_deactivation,
762
- $reason_other
763
- )
764
- );
765
-
766
- $uninstall_reasons = $this->apply_filters( 'uninstall_reasons', $uninstall_reasons );
767
-
768
- return $uninstall_reasons[ $user_type ];
769
- }
770
-
771
- /**
772
- * Called after the user has submitted his reason for deactivating the plugin.
773
- *
774
- * @author Leo Fajardo (@leorw)
775
- * @since 1.1.2
776
- */
777
- function _submit_uninstall_reason_action() {
778
- if ( ! isset( $_POST['reason_id'] ) ) {
779
- exit;
780
- }
781
-
782
- $reason_info = isset( $_REQUEST['reason_info'] ) ? trim( stripslashes( $_REQUEST['reason_info'] ) ) : '';
783
-
784
- $reason = (object) array(
785
- 'id' => $_POST['reason_id'],
786
- 'info' => substr( $reason_info, 0, 128 )
787
- );
788
-
789
- $this->_storage->store( 'uninstall_reason', $reason );
790
-
791
- // Print '1' for successful operation.
792
- echo 1;
793
- exit;
794
- }
795
-
796
- #endregion Deactivation Feedback Form ------------------------------------------------------------------
797
-
798
- #region Instance ------------------------------------------------------------------
799
-
800
- /**
801
- * Main singleton instance.
802
- *
803
- * @author Vova Feldman (@svovaf)
804
- * @since 1.0.0
805
- *
806
- * @param $slug
807
- *
808
- * @return Freemius
809
- */
810
- static function instance( $slug ) {
811
- $slug = strtolower( $slug );
812
-
813
- if ( ! isset( self::$_instances[ $slug ] ) ) {
814
- if ( 0 === count( self::$_instances ) ) {
815
- self::_load_required_static();
816
- }
817
-
818
- self::$_instances[ $slug ] = new Freemius( $slug );
819
- }
820
-
821
- return self::$_instances[ $slug ];
822
- }
823
-
824
- /**
825
- * @author Vova Feldman (@svovaf)
826
- * @since 1.0.6
827
- *
828
- * @param string|number $slug_or_id
829
- *
830
- * @return bool
831
- */
832
- private static function has_instance( $slug_or_id ) {
833
- return ! is_numeric( $slug_or_id ) ?
834
- isset( self::$_instances[ strtolower( $slug_or_id ) ] ) :
835
- ( false !== self::get_instance_by_id( $slug_or_id ) );
836
- }
837
-
838
- /**
839
- * @author Vova Feldman (@svovaf)
840
- * @since 1.0.6
841
- *
842
- * @param $id
843
- *
844
- * @return false|Freemius
845
- */
846
- static function get_instance_by_id( $id ) {
847
- foreach ( self::$_instances as $slug => $instance ) {
848
- if ( $id == $instance->get_id() ) {
849
- return $instance;
850
- }
851
- }
852
-
853
- return false;
854
- }
855
-
856
- /**
857
- *
858
- * @author Vova Feldman (@svovaf)
859
- * @since 1.0.1
860
- *
861
- * @param $plugin_file
862
- *
863
- * @return false|Freemius
864
- */
865
- static function get_instance_by_file( $plugin_file ) {
866
- $slug = self::find_slug_by_basename( $plugin_file );
867
-
868
- return ( false !== $slug ) ?
869
- self::instance( $slug ) :
870
- false;
871
- }
872
-
873
- /**
874
- * @author Vova Feldman (@svovaf)
875
- * @since 1.0.6
876
- *
877
- * @return false|Freemius
878
- */
879
- function get_parent_instance() {
880
- return self::get_instance_by_id( $this->_plugin->parent_plugin_id );
881
- }
882
-
883
- /**
884
- * @author Vova Feldman (@svovaf)
885
- * @since 1.0.6
886
- *
887
- * @param $slug_or_id
888
- *
889
- * @return bool|Freemius
890
- */
891
- function get_addon_instance( $slug_or_id ) {
892
- return ! is_numeric( $slug_or_id ) ?
893
- self::instance( strtolower( $slug_or_id ) ) :
894
- self::get_instance_by_id( $slug_or_id );
895
- }
896
-
897
- #endregion ------------------------------------------------------------------
898
-
899
- /**
900
- * @author Vova Feldman (@svovaf)
901
- * @since 1.0.6
902
- *
903
- * @return bool
904
- */
905
- function is_parent_plugin_installed() {
906
- return self::has_instance( $this->_plugin->parent_plugin_id );
907
- }
908
-
909
- /**
910
- * Check if add-on parent plugin in activation mode.
911
- *
912
- * @author Vova Feldman (@svovaf)
913
- * @since 1.0.7
914
- *
915
- * @return bool
916
- */
917
- function is_parent_in_activation() {
918
- $parent_fs = $this->get_parent_instance();
919
- if ( ! is_object( $parent_fs ) ) {
920
- return false;
921
- }
922
-
923
- return ( $parent_fs->is_activation_mode() );
924
- }
925
-
926
- /**
927
- * Is plugin in activation mode.
928
- *
929
- * @author Vova Feldman (@svovaf)
930
- * @since 1.0.7
931
- *
932
- * @param bool $and_on
933
- *
934
- * @return bool
935
- */
936
- function is_activation_mode( $and_on = true ) {
937
- return (
938
- ( $this->is_on() || ! $and_on ) &&
939
- ! $this->is_registered() &&
940
- ( ! $this->is_enable_anonymous() ||
941
- ( ! $this->is_anonymous() && ! $this->is_pending_activation() ) )
942
- );
943
- }
944
-
945
- /**
946
- * Get collection of all active plugins.
947
- *
948
- * @author Vova Feldman (@svovaf)
949
- * @since 1.0.9
950
- *
951
- * @return array[string]array
952
- */
953
- private static function get_active_plugins() {
954
- self::require_plugin_essentials();
955
-
956
- $active_plugin = array();
957
- $all_plugins = get_plugins();
958
- $active_plugins_basenames = get_option( 'active_plugins' );
959
-
960
- foreach ( $active_plugins_basenames as $plugin_basename ) {
961
- $active_plugin[ $plugin_basename ] = $all_plugins[ $plugin_basename ];
962
- }
963
-
964
- return $active_plugin;
965
- }
966
-
967
- /**
968
- * Get collection of all plugins.
969
- *
970
- * @author Vova Feldman (@svovaf)
971
- * @since 1.1.8
972
- *
973
- * @return array Key is the plugin file path and the value is an array of the plugin data.
974
- */
975
- private static function get_all_plugins() {
976
- self::require_plugin_essentials();
977
-
978
- $all_plugins = get_plugins();
979
- $active_plugins_basenames = get_option( 'active_plugins' );
980
-
981
- foreach ( $all_plugins as $basename => &$data ) {
982
- // By default set to inactive (next foreach update the active plugins).
983
- $data['is_active'] = false;
984
- // Enrich with plugin slug.
985
- $data['slug'] = self::get_plugin_slug( $basename );
986
- }
987
-
988
- // Flag active plugins.
989
- foreach ( $active_plugins_basenames as $basename ) {
990
- if ( isset( $all_plugins[ $basename ] ) ) {
991
- $all_plugins[ $basename ]['is_active'] = true;
992
- }
993
- }
994
-
995
- return $all_plugins;
996
- }
997
-
998
-
999
- /**
1000
- * Cached result of get_site_transient( 'update_plugins' )
1001
- *
1002
- * @author Vova Feldman (@svovaf)
1003
- * @since 1.1.8
1004
- *
1005
- * @var object
1006
- */
1007
- private static $_plugins_info;
1008
-
1009
- /**
1010
- * Helper function to get specified plugin's slug.
1011
- *
1012
- * @author Vova Feldman (@svovaf)
1013
- * @since 1.1.8
1014
- *
1015
- * @param $basename
1016
- *
1017
- * @return string
1018
- */
1019
- private static function get_plugin_slug( $basename ) {
1020
- if ( ! isset( self::$_plugins_info ) ) {
1021
- self::$_plugins_info = get_site_transient( 'update_plugins' );
1022
- }
1023
-
1024
- $slug = '';
1025
-
1026
- if ( is_object( self::$_plugins_info ) ) {
1027
- if ( isset( self::$_plugins_info->no_update ) &&
1028
- isset( self::$_plugins_info->no_update[ $basename ] ) &&
1029
- ! empty( self::$_plugins_info->no_update[ $basename ]->slug )
1030
- ) {
1031
- $slug = self::$_plugins_info->no_update[ $basename ]->slug;
1032
- } else if ( isset( self::$_plugins_info->response ) &&
1033
- isset( self::$_plugins_info->response[ $basename ] ) &&
1034
- ! empty( self::$_plugins_info->response[ $basename ]->slug )
1035
- ) {
1036
- $slug = self::$_plugins_info->response[ $basename ]->slug;
1037
- }
1038
- }
1039
-
1040
- if ( empty( $slug ) ) {
1041
- // Try to find slug from FS data.
1042
- $slug = self::find_slug_by_basename( $basename );
1043
- }
1044
-
1045
- if ( empty( $slug ) ) {
1046
- // Fallback to plugin's folder name.
1047
- $slug = dirname( $basename );
1048
- }
1049
-
1050
- return $slug;
1051
- }
1052
-
1053
- private static $_statics_loaded = false;
1054
-
1055
- /**
1056
- * Load static resources.
1057
- *
1058
- * @author Vova Feldman (@svovaf)
1059
- * @since 1.0.1
1060
- */
1061
- private static function _load_required_static() {
1062
- if ( self::$_statics_loaded ) {
1063
- return;
1064
- }
1065
-
1066
- self::$_static_logger = FS_Logger::get_logger( WP_FS__SLUG, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
1067
-
1068
- self::$_static_logger->entrance();
1069
-
1070
- self::$_accounts = FS_Option_Manager::get_manager( WP_FS__ACCOUNTS_OPTION_NAME, true );
1071
-
1072
- self::$_global_admin_notices = FS_Admin_Notice_Manager::instance( 'global' );
1073
-
1074
- // Configure which Freemius powered plugins should be auto updated.
1075
- // add_filter( 'auto_update_plugin', '_include_plugins_in_auto_update', 10, 2 );
1076
-
1077
- add_action( 'admin_menu', array( 'Freemius', 'add_debug_page' ) );
1078
-
1079
- add_action( "wp_ajax_fs_toggle_debug_mode", array( 'Freemius', '_toggle_debug_mode' ) );
1080
-
1081
- self::$_statics_loaded = true;
1082
- }
1083
-
1084
- #region Debugging ------------------------------------------------------------------
1085
-
1086
- /**
1087
- * @author Vova Feldman (@svovaf)
1088
- * @since 1.0.8
1089
- */
1090
- static function add_debug_page() {
1091
- if ( ! current_user_can( 'activate_plugins' ) ) {
1092
- return;
1093
- }
1094
-
1095
- self::$_static_logger->entrance();
1096
-
1097
- $title = sprintf( '%s [v.%s]', __fs( 'freemius-debug' ), WP_FS__SDK_VERSION );
1098
-
1099
- if ( WP_FS__DEV_MODE ) {
1100
- // Add top-level debug menu item.
1101
- $hook = add_menu_page(
1102
- $title,
1103
- $title,
1104
- 'manage_options',
1105
- 'freemius',
1106
- array( 'Freemius', '_debug_page_render' )
1107
- );
1108
- } else {
1109
- // Add hidden debug page.
1110
- $hook = add_submenu_page(
1111
- null,
1112
- $title,
1113
- $title,
1114
- 'manage_options',
1115
- 'freemius',
1116
- array( 'Freemius', '_debug_page_render' )
1117
- );
1118
- }
1119
-
1120
- add_action( "load-$hook", array( 'Freemius', '_debug_page_actions' ) );
1121
- }
1122
-
1123
- /**
1124
- * @author Vova Feldman (@svovaf)
1125
- * @since 1.1.7.3
1126
- */
1127
- static function _toggle_debug_mode() {
1128
- if ( in_array( $_POST['is_on'], array( 0, 1 ) ) ) {
1129
- update_option( 'fs_debug_mode', $_POST['is_on'] );
1130
- }
1131
-
1132
- exit;
1133
- }
1134
-
1135
- /**
1136
- * @author Vova Feldman (@svovaf)
1137
- * @since 1.0.8
1138
- */
1139
- static function _debug_page_actions() {
1140
- self::_clean_admin_content_section();
1141
-
1142
- if ( fs_request_is_action( 'restart_freemius' ) ) {
1143
- check_admin_referer( 'restart_freemius' );
1144
-
1145
- self::$_accounts->clear( true );
1146
-
1147
-
1148
- return;
1149
- }
1150
- }
1151
-
1152
- /**
1153
- * @author Vova Feldman (@svovaf)
1154
- * @since 1.0.8
1155
- */
1156
- static function _debug_page_render() {
1157
- self::$_static_logger->entrance();
1158
-
1159
- $sites = self::get_all_sites();
1160
- $users = self::get_all_users();
1161
- $addons = self::get_all_addons();
1162
- $account_addons = self::get_all_account_addons();
1163
- $licenses = self::get_all_licenses();
1164
-
1165
- // $plans = self::get_all_plans();
1166
- // $licenses = self::get_all_licenses();
1167
-
1168
- $vars = array(
1169
- 'sites' => $sites,
1170
- 'users' => $users,
1171
- 'addons' => $addons,
1172
- 'account_addons' => $account_addons,
1173
- 'licenses' => $licenses,
1174
- );
1175
-
1176
- fs_enqueue_local_style( 'fs_account', '/admin/debug.css' );
1177
- fs_require_once_template( 'debug.php', $vars );
1178
- }
1179
-
1180
- #endregion ------------------------------------------------------------------
1181
-
1182
- #region Connectivity Issues ------------------------------------------------------------------
1183
-
1184
- /**
1185
- * Check if Freemius should be turned on for the current plugin install.
1186
- *
1187
- * Note:
1188
- * $this->_is_on is updated in has_api_connectivity()
1189
- *
1190
- * @author Vova Feldman (@svovaf)
1191
- * @since 1.0.9
1192
- *
1193
- * @return bool
1194
- */
1195
- function is_on() {
1196
- self::$_static_logger->entrance();
1197
-
1198
- if ( isset( $this->_is_on ) ) {
1199
- return $this->_is_on;
1200
- }
1201
-
1202
- // If already installed or pending then sure it's on :)
1203
- if ( $this->is_registered() || $this->is_pending_activation() ) {
1204
- $this->_is_on = true;
1205
-
1206
- return true;
1207
- }
1208
-
1209
- return false;
1210
- }
1211
-
1212
- /**
1213
- * @author Vova Feldman (@svovaf)
1214
- * @since 1.1.7.3
1215
- *
1216
- * @param bool $flush_if_no_connectivity
1217
- *
1218
- * @return bool
1219
- */
1220
- private function should_run_connectivity_test( $flush_if_no_connectivity = false ) {
1221
- if ( ! isset( $this->_storage->connectivity_test ) ) {
1222
- // Connectivity test was never executed, or cache was cleared.
1223
- return true;
1224
- }
1225
-
1226
- if ( WP_FS__PING_API_ON_IP_OR_HOST_CHANGES ) {
1227
- if ( WP_FS__IS_HTTP_REQUEST ) {
1228
- if ( $_SERVER['HTTP_HOST'] != $this->_storage->connectivity_test['host'] ) {
1229
- // Domain changed.
1230
- return true;
1231
- }
1232
-
1233
- if ( WP_FS__REMOTE_ADDR != $this->_storage->connectivity_test['server_ip'] ) {
1234
- // Server IP changed.
1235
- return true;
1236
- }
1237
- }
1238
- }
1239
-
1240
- if ( $this->_storage->connectivity_test['is_connected'] &&
1241
- $this->_storage->connectivity_test['is_active']
1242
- ) {
1243
- // API connected and Freemius is active - no need to run connectivity check.
1244
- return false;
1245
- }
1246
-
1247
- if ( $flush_if_no_connectivity ) {
1248
- /**
1249
- * If explicitly asked to flush when no connectivity - do it only
1250
- * if at least 10 sec passed from the last API connectivity test.
1251
- */
1252
- return ( isset( $this->_storage->connectivity_test['timestamp'] ) &&
1253
- ( WP_FS__SCRIPT_START_TIME - $this->_storage->connectivity_test['timestamp'] ) > 10 );
1254
- }
1255
-
1256
- /**
1257
- * @since 1.1.7 Don't check for connectivity on plugin downgrade.
1258
- */
1259
- $version = $this->get_plugin_version();
1260
- if ( version_compare( $version, $this->_storage->connectivity_test['version'], '>' ) ) {
1261
- // If it's a plugin version upgrade and Freemius is off or no connectivity, run connectivity test.
1262
- return true;
1263
- }
1264
-
1265
- return false;
1266
- }
1267
-
1268
- /**
1269
- * @author Vova Feldman (@svovaf)
1270
- * @since 1.1.7.4
1271
- *
1272
- * @return object|false
1273
- */
1274
- private function ping() {
1275
- if ( WP_FS__SIMULATE_NO_API_CONNECTIVITY ) {
1276
- return false;
1277
- }
1278
-
1279
- $version = $this->get_plugin_version();
1280
-
1281
- $is_update = $this->apply_filters( 'is_plugin_update', $this->is_plugin_update() );
1282
-
1283
- return $this->get_api_plugin_scope()->ping(
1284
- $this->get_anonymous_id(),
1285
- array(
1286
- 'is_update' => json_encode( $is_update ),
1287
- 'version' => $version,
1288
- 'sdk' => $this->version,
1289
- 'is_admin' => json_encode( is_admin() ),
1290
- 'is_ajax' => json_encode( $this->is_ajax() ),
1291
- 'is_cron' => json_encode( $this->is_cron() ),
1292
- 'is_http' => json_encode( WP_FS__IS_HTTP_REQUEST ),
1293
- )
1294
- );
1295
- }
1296
-
1297
- /**
1298
- * Check if there's any connectivity issue to Freemius API.
1299
- *
1300
- * @author Vova Feldman (@svovaf)
1301
- * @since 1.0.9
1302
- *
1303
- * @param bool $flush_if_no_connectivity
1304
- *
1305
- * @return bool
1306
- */
1307
- function has_api_connectivity( $flush_if_no_connectivity = false ) {
1308
- $this->_logger->entrance();
1309
-
1310
- if ( isset( $this->_has_api_connection ) && ( $this->_has_api_connection || ! $flush_if_no_connectivity ) ) {
1311
- return $this->_has_api_connection;
1312
- }
1313
-
1314
- if ( WP_FS__SIMULATE_NO_API_CONNECTIVITY &&
1315
- isset( $this->_storage->connectivity_test ) &&
1316
- true === $this->_storage->connectivity_test['is_connected']
1317
- ) {
1318
- unset( $this->_storage->connectivity_test );
1319
- }
1320
-
1321
- if ( ! $this->should_run_connectivity_test( $flush_if_no_connectivity ) ) {
1322
- $this->_has_api_connection = $this->_storage->connectivity_test['is_connected'];
1323
- /**
1324
- * @since 1.1.6 During dev mode, if there's connectivity - turn Freemius on regardless the configuration.
1325
- */
1326
- $this->_is_on = $this->_storage->connectivity_test['is_active'] ||
1327
- ( WP_FS__DEV_MODE && $this->_has_api_connection && ! WP_FS__SIMULATE_FREEMIUS_OFF );
1328
-
1329
- return $this->_has_api_connection;
1330
- }
1331
-
1332
- $pong = $this->ping();
1333
- $is_connected = $this->get_api_plugin_scope()->is_valid_ping( $pong );
1334
-
1335
- if ( ! $is_connected ) {
1336
- // API failure.
1337
- $this->_add_connectivity_issue_message( $pong );
1338
- }
1339
-
1340
- $this->store_connectivity_info( $pong, $is_connected );
1341
-
1342
- return $this->_has_api_connection;
1343
- }
1344
-
1345
- /**
1346
- * @author Vova Feldman (@svovaf)
1347
- * @since 1.1.7.4
1348
- *
1349
- * @param object $pong
1350
- * @param bool $is_connected
1351
- */
1352
- private function store_connectivity_info( $pong, $is_connected ) {
1353
- $this->_logger->entrance();
1354
-
1355
- $version = $this->get_plugin_version();
1356
-
1357
- if ( ! $is_connected || WP_FS__SIMULATE_FREEMIUS_OFF ) {
1358
- $is_active = false;
1359
- } else {
1360
- $is_active = ( isset( $pong->is_active ) && true == $pong->is_active );
1361
- }
1362
-
1363
- $is_active = $this->apply_filters(
1364
- 'is_on',
1365
- $is_active,
1366
- $this->is_plugin_update(),
1367
- $version
1368
- );
1369
-
1370
- $this->_storage->connectivity_test = array(
1371
- 'is_connected' => $is_connected,
1372
- 'host' => $_SERVER['HTTP_HOST'],
1373
- 'server_ip' => WP_FS__REMOTE_ADDR,
1374
- 'is_active' => $is_active,
1375
- 'timestamp' => WP_FS__SCRIPT_START_TIME,
1376
- // Last version with connectivity attempt.
1377
- 'version' => $version,
1378
- );
1379
-
1380
- $this->_has_api_connection = $is_connected;
1381
- $this->_is_on = $is_active || ( WP_FS__DEV_MODE && $is_connected && ! WP_FS__SIMULATE_FREEMIUS_OFF );
1382
- }
1383
-
1384
- /**
1385
- * Force turning Freemius on.
1386
- *
1387
- * @author Vova Feldman (@svovaf)
1388
- * @since 1.1.8.1
1389
- *
1390
- * @return bool TRUE if successfully turned on.
1391
- */
1392
- private function turn_on() {
1393
- $this->_logger->entrance();
1394
-
1395
- if ( $this->is_on() || ! isset( $this->_storage->connectivity_test['is_active'] ) ) {
1396
- return false;
1397
- }
1398
-
1399
- $updated_connectivity = $this->_storage->connectivity_test;
1400
- $updated_connectivity['is_active'] = true;
1401
- $updated_connectivity['timestamp'] = WP_FS__SCRIPT_START_TIME;
1402
- $this->_storage->connectivity_test = $updated_connectivity;
1403
-
1404
- $this->_is_on = true;
1405
-
1406
- return true;
1407
- }
1408
-
1409
- /**
1410
- * Anonymous and unique site identifier (Hash).
1411
- *
1412
- * @author Vova Feldman (@svovaf)
1413
- * @since 1.1.0
1414
- *
1415
- * @return string
1416
- */
1417
- function get_anonymous_id() {
1418
- $unique_id = self::$_accounts->get_option( 'unique_id' );
1419
-
1420
- if ( empty( $unique_id ) || ! is_string( $unique_id ) ) {
1421
- $key = get_site_url();
1422
-
1423
- // If localhost, assign microtime instead of domain.
1424
- if ( WP_FS__IS_LOCALHOST ||
1425
- false !== strpos( $key, 'localhost' ) ||
1426
- false === strpos( $key, '.' )
1427
- ) {
1428
- $key = microtime();
1429
- }
1430
-
1431
- $unique_id = md5( $key );
1432
-
1433
- self::$_accounts->set_option( 'unique_id', $unique_id, true );
1434
- }
1435
-
1436
- $this->_logger->departure( $unique_id );
1437
-
1438
- return $unique_id;
1439
- }
1440
-
1441
- /**
1442
- * @author Vova Feldman (@svovaf)
1443
- * @since 1.1.7.4
1444
- *
1445
- * @return \WP_User
1446
- */
1447
- static function _get_current_wp_user() {
1448
- self::require_pluggable_essentials();
1449
-
1450
- return wp_get_current_user();
1451
- }
1452
-
1453
- /**
1454
- * Generate API connectivity issue message.
1455
- *
1456
- * @author Vova Feldman (@svovaf)
1457
- * @since 1.0.9
1458
- *
1459
- * @param mixed $api_result
1460
- * @param bool $is_first_failure
1461
- */
1462
- function _add_connectivity_issue_message( $api_result, $is_first_failure = true ) {
1463
- if ( $this->_enable_anonymous ) {
1464
- // Don't add message if can run anonymously.
1465
- return;
1466
- }
1467
-
1468
- if ( ! function_exists( 'wp_nonce_url' ) ) {
1469
- require_once( ABSPATH . 'wp-includes/functions.php' );
1470
- }
1471
-
1472
- $current_user = self::_get_current_wp_user();
1473
- // $admin_email = get_option( 'admin_email' );
1474
- $admin_email = $current_user->user_email;
1475
-
1476
- $message = false;
1477
- if ( is_object( $api_result ) &&
1478
- isset( $api_result->error ) &&
1479
- isset( $api_result->error->code )
1480
- ) {
1481
- switch ( $api_result->error->code ) {
1482
- case 'curl_missing':
1483
- $message = sprintf(
1484
- __fs( 'x-requires-access-to-api', $this->_slug ) . ' ' .
1485
- __fs( 'curl-missing-message', $this->_slug ) . ' ' .
1486
- ' %s',
1487
- '<b>' . $this->get_plugin_name() . '</b>',
1488
- sprintf(
1489
- '<ol id="fs_firewall_issue_options"><li>%s</li><li>%s</li><li>%s</li></ol>',
1490
- sprintf(
1491
- '<a class="fs-resolve" data-type="curl" href="#"><b>%s</b></a>%s',
1492
- __fs( 'curl-missing-no-clue-title', $this->_slug ),
1493
- ' - ' . sprintf(
1494
- __fs( 'curl-missing-no-clue-desc', $this->_slug ),
1495
- '<a href="mailto:' . $admin_email . '">' . $admin_email . '</a>'
1496
- )
1497
- ),
1498
- sprintf(
1499
- '<b>%s</b> - %s',
1500
- __fs( 'sysadmin-title', $this->_slug ),
1501
- __fs( 'curl-missing-sysadmin-desc', $this->_slug )
1502
- ),
1503
- sprintf(
1504
- '<a href="%s"><b>%s</b></a>%s',
1505
- wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . $this->_plugin_basename . '&amp;plugin_status=' . 'all' . '&amp;paged=' . '1' . '&amp;s=' . '', 'deactivate-plugin_' . $this->_plugin_basename ),
1506
- __fs( 'deactivate-plugin-title', $this->_slug ),
1507
- ' - ' . __fs( 'deactivate-plugin-desc', 'freemius', $this->_slug )
1508
- )
1509
- )
1510
- );
1511
- break;
1512
- case 'cloudflare_ddos_protection':
1513
- $message = sprintf(
1514
- __fs( 'x-requires-access-to-api', $this->_slug ) . ' ' .
1515
- __fs( 'cloudflare-blocks-connection-message', $this->_slug ) . ' ' .
1516
- __fs( 'happy-to-resolve-issue-asap', $this->_slug ) .
1517
- ' %s',
1518
- '<b>' . $this->get_plugin_name() . '</b>',
1519
- sprintf(
1520
- '<ol id="fs_firewall_issue_options"><li>%s</li><li>%s</li><li>%s</li></ol>',
1521
- sprintf(
1522
- '<a class="fs-resolve" data-type="cloudflare" href="#"><b>%s</b></a>%s',
1523
- __fs( 'fix-issue-title', $this->_slug ),
1524
- ' - ' . sprintf(
1525
- __fs( 'fix-issue-desc', $this->_slug ),
1526
- '<a href="mailto:' . $admin_email . '">' . $admin_email . '</a>'
1527
- )
1528
- ),
1529
- sprintf(
1530
- '<a href="%s" target="_blank"><b>%s</b></a>%s',
1531
- sprintf( 'https://wordpress.org/plugins/%s/download/', $this->_slug ),
1532
- __fs( 'install-previous-title', $this->_slug ),
1533
- ' - ' . __fs( 'install-previous-desc', $this->_slug )
1534
- ),
1535
- sprintf(
1536
- '<a href="%s"><b>%s</b></a>%s',
1537
- wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . $this->_plugin_basename . '&amp;plugin_status=' . 'all' . '&amp;paged=' . '1' . '&amp;s=' . '', 'deactivate-plugin_' . $this->_plugin_basename ),
1538
- __fs( 'deactivate-plugin-title', $this->_slug ),
1539
- ' - ' . __fs( 'deactivate-plugin-desc', $this->_slug )
1540
- )
1541
- )
1542
- );
1543
- break;
1544
- case 'squid_cache_block':
1545
- $message = sprintf(
1546
- __fs( 'x-requires-access-to-api', $this->_slug ) . ' ' .
1547
- __fs( 'squid-blocks-connection-message', $this->_slug ) .
1548
- ' %s',
1549
- '<b>' . $this->get_plugin_name() . '</b>',
1550
- sprintf(
1551
- '<ol id="fs_firewall_issue_options"><li>%s</li><li>%s</li><li>%s</li></ol>',
1552
- sprintf(
1553
- '<a class="fs-resolve" data-type="squid" href="#"><b>%s</b></a>%s',
1554
- __fs( 'squid-no-clue-title', $this->_slug ),
1555
- ' - ' . sprintf(
1556
- __fs( 'squid-no-clue-desc', $this->_slug ),
1557
- '<a href="mailto:' . $admin_email . '">' . $admin_email . '</a>'
1558
- )
1559
- ),
1560
- sprintf(
1561
- '<b>%s</b> - %s',
1562
- __fs( 'sysadmin-title', $this->_slug ),
1563
- sprintf(
1564
- __fs( 'squid-sysadmin-desc', $this->_slug ),
1565
- // We use a filter since the plugin might require additional API connectivity.
1566
- '<b>' . implode( ', ', $this->apply_filters( 'api_domains', array( 'api.freemius.com' ) ) ) . '</b>' )
1567
- ),
1568
- sprintf(
1569
- '<a href="%s"><b>%s</b></a>%s',
1570
- wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . $this->_plugin_basename . '&amp;plugin_status=' . 'all' . '&amp;paged=' . '1' . '&amp;s=' . '', 'deactivate-plugin_' . $this->_plugin_basename ),
1571
- __fs( 'deactivate-plugin-title', $this->_slug ),
1572
- ' - ' . __fs( 'deactivate-plugin-desc', $this->_slug )
1573
- )
1574
- )
1575
- );
1576
- break;
1577
- // default:
1578
- // $message = __fs( 'connectivity-test-fails-message', $this->_slug );
1579
- // break;
1580
- }
1581
- }
1582
-
1583
- $message_id = 'failed_connect_api';
1584
- $type = 'error';
1585
-
1586
- if ( false === $message ) {
1587
- if ( $is_first_failure ) {
1588
- // First attempt failed.
1589
- $message = sprintf(
1590
- __fs( 'x-requires-access-to-api', $this->_slug ) . ' ' .
1591
- __fs( 'connectivity-test-fails-message', $this->_slug ) . ' ' .
1592
- __fs( 'connectivity-test-maybe-temporary', $this->_slug ) . '<br><br>' .
1593
- '%s',
1594
- '<b>' . $this->get_plugin_name() . '</b>',
1595
- sprintf(
1596
- '<div id="fs_firewall_issue_options">%s %s</div>',
1597
- sprintf(
1598
- '<a class="button button-primary fs-resolve" data-type="retry_ping" href="#">%s</a>',
1599
- __fs( 'yes-do-your-thing', $this->_slug )
1600
- ),
1601
- sprintf(
1602
- '<a href="%s" class="button">%s</a>',
1603
- wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . $this->_plugin_basename . '&amp;plugin_status=' . 'all' . '&amp;paged=' . '1' . '&amp;s=' . '', 'deactivate-plugin_' . $this->_plugin_basename ),
1604
- __fs( 'no-deactivate', $this->_slug )
1605
- )
1606
- )
1607
- );
1608
-
1609
- $message_id = 'failed_connect_api_first';
1610
- $type = 'promotion';
1611
- } else {
1612
- // Second connectivity attempt failed.
1613
- $message = sprintf(
1614
- __fs( 'x-requires-access-to-api', $this->_slug ) . ' ' .
1615
- __fs( 'connectivity-test-fails-message', $this->_slug ) . ' ' .
1616
- __fs( 'happy-to-resolve-issue-asap', $this->_slug ) .
1617
- ' %s',
1618
- '<b>' . $this->get_plugin_name() . '</b>',
1619
- sprintf(
1620
- '<ol id="fs_firewall_issue_options"><li>%s</li><li>%s</li><li>%s</li></ol>',
1621
- sprintf(
1622
- '<a class="fs-resolve" data-type="general" href="#"><b>%s</b></a>%s',
1623
- __fs( 'fix-issue-title', $this->_slug ),
1624
- ' - ' . sprintf(
1625
- __fs( 'fix-issue-desc', $this->_slug ),
1626
- '<a href="mailto:' . $admin_email . '">' . $admin_email . '</a>'
1627
- )
1628
- ),
1629
- sprintf(
1630
- '<a href="%s" target="_blank"><b>%s</b></a>%s',
1631
- sprintf( 'https://wordpress.org/plugins/%s/download/', $this->_slug ),
1632
- __fs( 'install-previous-title', $this->_slug ),
1633
- ' - ' . __fs( 'install-previous-desc', $this->_slug )
1634
- ),
1635
- sprintf(
1636
- '<a href="%s"><b>%s</b></a>%s',
1637
- wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . $this->_plugin_basename . '&amp;plugin_status=' . 'all' . '&amp;paged=' . '1' . '&amp;s=' . '', 'deactivate-plugin_' . $this->_plugin_basename ),
1638
- __fs( 'deactivate-plugin-title', $this->_slug ),
1639
- ' - ' . __fs( 'deactivate-plugin-desc', $this->_slug )
1640
- )
1641
- )
1642
- );
1643
- }
1644
- }
1645
-
1646
- $this->_admin_notices->add_sticky(
1647
- $message,
1648
- $message_id,
1649
- __fs( 'oops', $this->_slug ) . '...',
1650
- $type
1651
- );
1652
- }
1653
-
1654
- /**
1655
- * Handle user request to resolve connectivity issue.
1656
- * This method will send an email to Freemius API technical staff for resolution.
1657
- * The email will contain server's info and installed plugins (might be caching issue).
1658
- *
1659
- * @author Vova Feldman (@svovaf)
1660
- * @since 1.0.9
1661
- */
1662
- function _email_about_firewall_issue() {
1663
- $this->_admin_notices->remove_sticky( 'failed_connect_api' );
1664
-
1665
- $pong = $this->ping();
1666
-
1667
- $is_connected = $this->get_api_plugin_scope()->is_valid_ping( $pong );
1668
-
1669
- if ( $is_connected ) {
1670
- $this->store_connectivity_info( $pong, $is_connected );
1671
-
1672
- echo $this->get_after_plugin_activation_redirect_url();
1673
- exit;
1674
- }
1675
-
1676
- $current_user = self::_get_current_wp_user();
1677
- $admin_email = $current_user->user_email;
1678
-
1679
- $error_type = fs_request_get( 'error_type', 'general' );
1680
-
1681
- switch ( $error_type ) {
1682
- case 'squid':
1683
- $title = 'Squid ACL Blocking Issue';
1684
- break;
1685
- case 'cloudflare':
1686
- $title = 'CloudFlare Blocking Issue';
1687
- break;
1688
- default:
1689
- $title = 'API Connectivity Issue';
1690
- break;
1691
- }
1692
-
1693
- $custom_email_sections = array();
1694
-
1695
- if ( 'squid' === $error_type ) {
1696
- // Override the 'Site' email section.
1697
- $custom_email_sections['site'] = array(
1698
- 'rows' => array(
1699
- 'hosting_company' => array( 'Hosting Company', fs_request_get( 'hosting_company' ) )
1700
- )
1701
- );
1702
- }
1703
-
1704
- // Add 'API Error' custom email section.
1705
- $custom_email_sections['api_error'] = array(
1706
- 'title' => 'API Error',
1707
- 'rows' => array(
1708
- 'ping' => array( is_string( $pong ) ? htmlentities( $pong ) : json_encode( $pong ) )
1709
- )
1710
- );
1711
-
1712
- // Add PHP info for deeper investigation.
1713
- ob_start();
1714
- phpinfo();
1715
- $php_info = ob_get_clean();
1716
- $custom_email_sections['php_info'] = array(
1717
- 'title' => 'PHP Info',
1718
- 'rows' => array(
1719
- 'info' => array( $php_info )
1720
- )
1721
- );
1722
-
1723
- // Send email with technical details to resolve CloudFlare's firewall unnecessary protection.
1724
- $this->send_email(
1725
- 'api@freemius.com', // recipient
1726
- $title . ' [' . $this->get_plugin_name() . ']', // subject
1727
- $custom_email_sections,
1728
- array( "Reply-To: $admin_email <$admin_email>" ) // headers
1729
- );
1730
-
1731
- $this->_admin_notices->add_sticky(
1732
- sprintf(
1733
- __fs( 'fix-request-sent-message', $this->_slug ),
1734
- '<a href="mailto:' . $admin_email . '">' . $admin_email . '</a>'
1735
- ),
1736
- 'server_details_sent'
1737
- );
1738
-
1739
- // Action was taken, tell that API connectivity troubleshooting should be off now.
1740
-
1741
- echo "1";
1742
- exit;
1743
- }
1744
-
1745
- /**
1746
- * Handle connectivity test retry approved by the user.
1747
- *
1748
- * @author Vova Feldman (@svovaf)
1749
- * @since 1.1.7.4
1750
- */
1751
- function _retry_connectivity_test() {
1752
- $this->_admin_notices->remove_sticky( 'failed_connect_api_first' );
1753
-
1754
- $pong = $this->ping();
1755
-
1756
- $is_connected = $this->get_api_plugin_scope()->is_valid_ping( $pong );
1757
-
1758
- if ( $is_connected ) {
1759
- $this->store_connectivity_info( $pong, $is_connected );
1760
-
1761
- echo $this->get_after_plugin_activation_redirect_url();
1762
- } else {
1763
- // Add connectivity issue message after 2nd failed attempt.
1764
- $this->_add_connectivity_issue_message( $pong, false );
1765
-
1766
- echo "1";
1767
- }
1768
-
1769
- exit;
1770
- }
1771
-
1772
- static function _add_firewall_issues_javascript() {
1773
- $params = array();
1774
- fs_require_once_template( 'firewall-issues-js.php', $params );
1775
- }
1776
-
1777
- #endregion Connectivity Issues ------------------------------------------------------------------
1778
-
1779
- #region Email ------------------------------------------------------------------
1780
-
1781
- /**
1782
- * Generates and sends an HTML email with customizable sections.
1783
- *
1784
- * @author Leo Fajardo (@leorw)
1785
- * @since 1.1.2
1786
- *
1787
- * @param string $to_address
1788
- * @param string $subject
1789
- * @param array $sections
1790
- * @param array $headers
1791
- *
1792
- * @return bool Whether the email contents were sent successfully.
1793
- */
1794
- private function send_email(
1795
- $to_address,
1796
- $subject,
1797
- $sections = array(),
1798
- $headers = array()
1799
- ) {
1800
- $default_sections = $this->get_email_sections();
1801
-
1802
- // Insert new sections or replace the default email sections.
1803
- if ( is_array( $sections ) && ! empty( $sections ) ) {
1804
- foreach ( $sections as $section_id => $custom_section ) {
1805
- if ( ! isset( $default_sections[ $section_id ] ) ) {
1806
- // If the section does not exist, add it.
1807
- $default_sections[ $section_id ] = $custom_section;
1808
- } else {
1809
- // If the section already exists, override it.
1810
- $current_section = $default_sections[ $section_id ];
1811
-
1812
- // Replace the current section's title if a custom section title exists.
1813
- if ( isset( $custom_section['title'] ) ) {
1814
- $current_section['title'] = $custom_section['title'];
1815
- }
1816
-
1817
- // Insert new rows under the current section or replace the default rows.
1818
- if ( isset( $custom_section['rows'] ) && is_array( $custom_section['rows'] ) && ! empty( $custom_section['rows'] ) ) {
1819
- foreach ( $custom_section['rows'] as $row_id => $row ) {
1820
- $current_section['rows'][ $row_id ] = $row;
1821
- }
1822
- }
1823
-
1824
- $default_sections[ $section_id ] = $current_section;
1825
- }
1826
- }
1827
- }
1828
-
1829
- $vars = array( 'sections' => $default_sections );
1830
- $message = fs_get_template( 'email.php', $vars );
1831
-
1832
- // Set the type of email to HTML.
1833
- $headers[] = 'Content-type: text/html';
1834
-
1835
- $header_string = implode( "\r\n", $headers );
1836
-
1837
- return wp_mail(
1838
- $to_address,
1839
- $subject,
1840
- $message,
1841
- $header_string
1842
- );
1843
- }
1844
-
1845
- /**
1846
- * Generates the data for the sections of the email content.
1847
- *
1848
- * @author Leo Fajardo (@leorw)
1849
- * @since 1.1.2
1850
- *
1851
- * @return array
1852
- */
1853
- private function get_email_sections() {
1854
- // Retrieve the current user's information so that we can get the user's email, first name, and last name below.
1855
- $current_user = self::_get_current_wp_user();
1856
-
1857
- // Retrieve the cURL version information so that we can get the version number below.
1858
- $curl_version_information = curl_version();
1859
-
1860
- $active_plugin = self::get_active_plugins();
1861
-
1862
- // Generate the list of active plugins separated by new line.
1863
- $active_plugin_string = '';
1864
- foreach ( $active_plugin as $plugin ) {
1865
- $active_plugin_string .= sprintf(
1866
- '<a href="%s">%s</a> [v%s]<br>',
1867
- $plugin['PluginURI'],
1868
- $plugin['Name'],
1869
- $plugin['Version']
1870
- );
1871
- }
1872
-
1873
- $server_ip = WP_FS__REMOTE_ADDR;
1874
-
1875
- // Generate the default email sections.
1876
- $sections = array(
1877
- 'sdk' => array(
1878
- 'title' => 'SDK',
1879
- 'rows' => array(
1880
- 'fs_version' => array( 'FS Version', $this->version ),
1881
- 'curl_version' => array( 'cURL Version', $curl_version_information['version'] )
1882
- )
1883
- ),
1884
- 'plugin' => array(
1885
- 'title' => 'Plugin',
1886
- 'rows' => array(
1887
- 'name' => array( 'Name', $this->get_plugin_name() ),
1888
- 'version' => array( 'Version', $this->get_plugin_version() )
1889
- )
1890
- ),
1891
- 'site' => array(
1892
- 'title' => 'Site',
1893
- 'rows' => array(
1894
- 'unique_id' => array( 'Address', $this->get_anonymous_id() ),
1895
- 'address' => array( 'Address', site_url() ),
1896
- 'host' => array(
1897
- 'HTTP_HOST',
1898
- ( ! empty( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : '' )
1899
- ),
1900
- 'server_addr' => array(
1901
- 'SERVER_ADDR',
1902
- '<a href="http://www.projecthoneypot.org/ip_' . $server_ip . '">' . $server_ip . '</a>'
1903
- )
1904
- )
1905
- ),
1906
- 'user' => array(
1907
- 'title' => 'User',
1908
- 'rows' => array(
1909
- 'email' => array( 'Email', $current_user->user_email ),
1910
- 'first' => array( 'First', $current_user->user_firstname ),
1911
- 'last' => array( 'Last', $current_user->user_lastname )
1912
- )
1913
- ),
1914
- 'plugins' => array(
1915
- 'title' => 'Plugins',
1916
- 'rows' => array(
1917
- 'active_plugins' => array( 'Active Plugins', $active_plugin_string )
1918
- )
1919
- ),
1920
- );
1921
-
1922
- // Allow the sections to be modified by other code.
1923
- $sections = $this->apply_filters( 'email_template_sections', $sections );
1924
-
1925
- return $sections;
1926
- }
1927
-
1928
- #endregion Email ------------------------------------------------------------------
1929
-
1930
- #region Initialization ------------------------------------------------------------------
1931
-
1932
- /**
1933
- * Init plugin's Freemius instance.
1934
- *
1935
- * @author Vova Feldman (@svovaf)
1936
- * @since 1.0.1
1937
- *
1938
- * @param number $id
1939
- * @param string $public_key
1940
- * @param bool $is_live
1941
- * @param bool $is_premium
1942
- */
1943
- function init( $id, $public_key, $is_live = true, $is_premium = true ) {
1944
- $this->_logger->entrance();
1945
-
1946
- $this->dynamic_init( array(
1947
- 'id' => $id,
1948
- 'public_key' => $public_key,
1949
- 'is_live' => $is_live,
1950
- 'is_premium' => $is_premium,
1951
- ) );
1952
- }
1953
-
1954
- /**
1955
- * Dynamic initiator, originally created to support initiation
1956
- * with parent_id for add-ons.
1957
- *
1958
- * @author Vova Feldman (@svovaf)
1959
- * @since 1.0.6
1960
- *
1961
- * @param array $plugin_info
1962
- *
1963
- * @throws Freemius_Exception
1964
- */
1965
- function dynamic_init( array $plugin_info ) {
1966
- $this->_logger->entrance();
1967
-
1968
- $this->parse_settings( $plugin_info );
1969
-
1970
- if ( $this->should_stop_execution() ) {
1971
- return;
1972
- }
1973
-
1974
- if ( ! $this->is_registered() ) {
1975
- if ( $this->is_anonymous() ) {
1976
- // If user skipped, no need to test connectivity.
1977
- $this->_has_api_connection = true;
1978
- $this->_is_on = true;
1979
- } else {
1980
- if ( ! $this->has_api_connectivity() ) {
1981
- if ( $this->_admin_notices->has_sticky( 'failed_connect_api_first' ) ||
1982
- $this->_admin_notices->has_sticky( 'failed_connect_api' )
1983
- ) {
1984
- if ( ! $this->_enable_anonymous ) {
1985
- // If anonymous mode is disabled, add firewall admin-notice message.
1986
- add_action( 'admin_footer', array( 'Freemius', '_add_firewall_issues_javascript' ) );
1987
-
1988
- add_action( "wp_ajax_{$this->_slug}_resolve_firewall_issues", array(
1989
- &$this,
1990
- '_email_about_firewall_issue'
1991
- ) );
1992
-
1993
- add_action( "wp_ajax_{$this->_slug}_retry_connectivity_test", array(
1994
- &$this,
1995
- '_retry_connectivity_test'
1996
- ) );
1997
- }
1998
- }
1999
-
2000
- return;
2001
- } else {
2002
- $this->_admin_notices->remove_sticky( array(
2003
- 'failed_connect_api_first',
2004
- 'failed_connect_api',
2005
- ) );
2006
-
2007
- if ( $this->_anonymous_mode ) {
2008
- // Simulate anonymous mode.
2009
- $this->_is_anonymous = true;
2010
- }
2011
- }
2012
- }
2013
-
2014
- // Check if Freemius is on for the current plugin.
2015
- // This MUST be executed after all the plugin variables has been loaded.
2016
- if ( ! $this->is_on() ) {
2017
- return;
2018
- }
2019
- }
2020
-
2021
- if ( $this->has_api_connectivity() && $this->is_user_in_admin() ) {
2022
- /**
2023
- * Schedule daily data sync cron if:
2024
- *
2025
- * 1. User opted-in (for tracking).
2026
- * 2. If plugin has add-ons (update add-ons data).
2027
- * 3. If skipped, but later upgraded (opted-in via upgrade).
2028
- *
2029
- * @author Vova Feldman (@svovaf)
2030
- * @since 1.1.7.3
2031
- *
2032
- */
2033
- if ( $this->is_registered() ||
2034
- ( ! $this->is_activation_mode() && $this->_has_addons )
2035
- ) {
2036
-
2037
- $this->hook_callback_to_sync_cron();
2038
-
2039
- if ( ! $this->is_sync_cron_on() ) {
2040
- $this->schedule_sync_cron();
2041
- }
2042
- }
2043
-
2044
- /**
2045
- * Check if requested for manual blocking background sync.
2046
- */
2047
- if ( fs_request_has( 'background_sync' ) ) {
2048
- $this->run_manual_sync();
2049
- }
2050
- }
2051
-
2052
- if ( $this->is_registered() ) {
2053
- $this->hook_callback_to_install_sync();
2054
- }
2055
-
2056
- if ( $this->is_addon() ) {
2057
- if ( $this->is_parent_plugin_installed() ) {
2058
- // Link to parent FS.
2059
- $this->_parent = self::get_instance_by_id( $this->_plugin->parent_plugin_id );
2060
-
2061
- // Get parent plugin reference.
2062
- $this->_parent_plugin = $this->_parent->get_plugin();
2063
- }
2064
- }
2065
-
2066
- if ( $this->is_user_in_admin() ) {
2067
- global $pagenow;
2068
- if ( 'plugins.php' === $pagenow ) {
2069
- $this->hook_plugin_action_links();
2070
- }
2071
-
2072
- if ( $this->is_addon() ) {
2073
- if ( ! $this->is_parent_plugin_installed() ) {
2074
- $parent_name = $this->get_option( $plugin_info, 'parent_name', null );
2075
-
2076
- if ( isset( $plugin_info['parent'] ) ) {
2077
- $parent_name = $this->get_option( $plugin_info['parent'], 'name', null );
2078
- }
2079
-
2080
- $this->_admin_notices->add(
2081
- ( ! empty( $parent_name ) ?
2082
- sprintf( __fs( 'addon-x-cannot-run-without-y', $this->_slug ), $this->get_plugin_name(), $parent_name ) :
2083
- sprintf( __fs( 'addon-x-cannot-run-without-parent', $this->_slug ), $this->get_plugin_name() )
2084
- ),
2085
- __fs( 'oops', $this->_slug ) . '...',
2086
- 'error'
2087
- );
2088
-
2089
- return;
2090
- } else {
2091
- if ( $this->_parent->is_registered() && ! $this->is_registered() ) {
2092
- // If parent plugin activated, automatically install add-on for the user.
2093
- $this->_activate_addon_account( $this->_parent );
2094
- }
2095
-
2096
- // @todo This should be only executed on activation. It should be migrated to register_activation_hook() together with other activation related logic.
2097
- if ( $this->is_premium() ) {
2098
- // Remove add-on download admin-notice.
2099
- $this->_parent->_admin_notices->remove_sticky( array(
2100
- 'addon_plan_upgraded_' . $this->_slug,
2101
- 'no_addon_license_' . $this->_slug,
2102
- ) );
2103
- }
2104
-
2105
- $this->deactivate_premium_only_addon_without_license();
2106
- }
2107
- } else {
2108
- add_action( 'admin_init', array( &$this, '_admin_init_action' ) );
2109
-
2110
- if ( $this->has_addons() &&
2111
- 'plugin-information' === fs_request_get( 'tab', false ) &&
2112
- $this->get_id() == fs_request_get( 'parent_plugin_id', false )
2113
- ) {
2114
- require_once WP_FS__DIR_INCLUDES . '/fs-plugin-info-dialog.php';
2115
-
2116
- new FS_Plugin_Info_Dialog( $this );
2117
- }
2118
- }
2119
-
2120
- if ( $this->is_premium() ) {
2121
- new FS_Plugin_Updater( $this );
2122
- }
2123
-
2124
- // if ( $this->is_registered() ||
2125
- // $this->is_anonymous() ||
2126
- // $this->is_pending_activation()
2127
- // ) {
2128
- // $this->_init_admin();
2129
- // }
2130
- }
2131
-
2132
- $this->do_action( 'initiated' );
2133
-
2134
- if ( $this->_storage->prev_is_premium !== $this->_plugin->is_premium ) {
2135
- if ( isset( $this->_storage->prev_is_premium ) ) {
2136
- $this->apply_filters(
2137
- 'after_code_type_change',
2138
- // New code type.
2139
- $this->_plugin->is_premium
2140
- );
2141
- } else {
2142
- // Set for code type for the first time.
2143
- $this->_storage->prev_is_premium = $this->_plugin->is_premium;
2144
- }
2145
- }
2146
-
2147
- if ( ! $this->is_addon() ) {
2148
- if ( $this->is_registered() ) {
2149
- // Fix for upgrade from versions < 1.0.9.
2150
- if ( ! isset( $this->_storage->activation_timestamp ) ) {
2151
- $this->_storage->activation_timestamp = WP_FS__SCRIPT_START_TIME;
2152
- }
2153
-
2154
- $this->do_action( 'after_init_plugin_registered' );
2155
- } else if ( $this->is_anonymous() ) {
2156
- $this->do_action( 'after_init_plugin_anonymous' );
2157
- } else if ( $this->is_pending_activation() ) {
2158
- $this->do_action( 'after_init_plugin_pending_activations' );
2159
- }
2160
- } else {
2161
- if ( $this->is_registered() ) {
2162
- $this->do_action( 'after_init_addon_registered' );
2163
- } else if ( $this->is_anonymous() ) {
2164
- $this->do_action( 'after_init_addon_anonymous' );
2165
- } else if ( $this->is_pending_activation() ) {
2166
- $this->do_action( 'after_init_addon_pending_activations' );
2167
- }
2168
- }
2169
-
2170
- // Add license activation link and AJAX request handler.
2171
- if ( $this->has_paid_plan() ) {
2172
- global $pagenow;
2173
- if ( 'plugins.php' === $pagenow ) {
2174
- /**
2175
- * @since 1.2.0 Add license action link only on plugins page.
2176
- */
2177
- $this->_add_license_action_link();
2178
- $this->_require_license_activation_dialog();
2179
- }
2180
-
2181
- if ( $this->is_ajax_action( array(
2182
- 'activate_license',
2183
- 'resend_license_key'
2184
- ) )
2185
- ) {
2186
- // Hook license activation and resend AJAX callbacks.
2187
- $this->_require_license_activation_dialog();
2188
- }
2189
- }
2190
- }
2191
-
2192
- /**
2193
- * Parse plugin's settings (as defined by the plugin dev).
2194
- *
2195
- * @author Vova Feldman (@svovaf)
2196
- * @since 1.1.7.3
2197
- *
2198
- * @param array $plugin_info
2199
- *
2200
- * @throws \Freemius_Exception
2201
- */
2202
- private function parse_settings( &$plugin_info ) {
2203
- $this->_logger->entrance();
2204
-
2205
- $id = $this->get_numeric_option( $plugin_info, 'id', false );
2206
- $public_key = $this->get_option( $plugin_info, 'public_key', false );
2207
- $secret_key = $this->get_option( $plugin_info, 'secret_key', null );
2208
- $parent_id = $this->get_numeric_option( $plugin_info, 'parent_id', null );
2209
- $parent_name = $this->get_option( $plugin_info, 'parent_name', null );
2210
-
2211
- /**
2212
- * @author Vova Feldman (@svovaf)
2213
- * @since 1.1.9 Try to pull secret key from external config.
2214
- */
2215
- if ( is_null( $secret_key ) && defined( "WP_FS__{$this->_slug}_SECRET_KEY" ) ) {
2216
- $secret_key = constant( "WP_FS__{$this->_slug}_SECRET_KEY" );
2217
- }
2218
-
2219
- if ( isset( $plugin_info['parent'] ) ) {
2220
- $parent_id = $this->get_numeric_option( $plugin_info['parent'], 'id', null );
2221
- // $parent_slug = $this->get_option( $plugin_info['parent'], 'slug', null );
2222
- // $parent_public_key = $this->get_option( $plugin_info['parent'], 'public_key', null );
2223
- $parent_name = $this->get_option( $plugin_info['parent'], 'name', null );
2224
- }
2225
-
2226
- if ( false === $id ) {
2227
- throw new Freemius_Exception( 'Plugin id parameter is not set.' );
2228
- }
2229
- if ( false === $public_key ) {
2230
- throw new Freemius_Exception( 'Plugin public_key parameter is not set.' );
2231
- }
2232
-
2233
- $plugin = ( $this->_plugin instanceof FS_Plugin ) ?
2234
- $this->_plugin :
2235
- new FS_Plugin();
2236
-
2237
- $plugin->update( array(
2238
- 'id' => $id,
2239
- 'public_key' => $public_key,
2240
- 'slug' => $this->_slug,
2241
- 'parent_plugin_id' => $parent_id,
2242
- 'version' => $this->get_plugin_version(),
2243
- 'title' => $this->get_plugin_name(),
2244
- 'file' => $this->_plugin_basename,
2245
- 'is_premium' => $this->get_bool_option( $plugin_info, 'is_premium', true ),
2246
- 'is_live' => $this->get_bool_option( $plugin_info, 'is_live', true ),
2247
- // 'secret_key' => $secret_key,
2248
- ) );
2249
-
2250
- if ( $plugin->is_updated() ) {
2251
- // Update plugin details.
2252
- $this->_plugin = FS_Plugin_Manager::instance( $this->_slug )->store( $plugin );
2253
- }
2254
- // Set the secret key after storing the plugin, we don't want to store the key in the storage.
2255
- $this->_plugin->secret_key = $secret_key;
2256
-
2257
- if ( ! isset( $plugin_info['menu'] ) ) {
2258
- // Back compatibility to 1.1.2
2259
- $plugin_info['menu'] = array(
2260
- 'slug' => isset( $plugin_info['menu_slug'] ) ?
2261
- $plugin_info['menu_slug'] :
2262
- $this->_slug
2263
- );
2264
- }
2265
-
2266
- $this->_menu = FS_Admin_Menu_Manager::instance( $this->_slug );
2267
- $this->_menu->init( $plugin_info['menu'], $this->is_addon() );
2268
-
2269
- $this->_has_addons = $this->get_bool_option( $plugin_info, 'has_addons', false );
2270
- $this->_has_paid_plans = $this->get_bool_option( $plugin_info, 'has_paid_plans', true );
2271
- $this->_is_org_compliant = $this->get_bool_option( $plugin_info, 'is_org_compliant', true );
2272
- $this->_is_premium_only = $this->get_bool_option( $plugin_info, 'is_premium_only', false );
2273
- if ( $this->_is_premium_only ) {
2274
- // If premium only plugin, disable anonymous mode.
2275
- $this->_enable_anonymous = false;
2276
- $this->_anonymous_mode = false;
2277
- } else {
2278
- $this->_enable_anonymous = $this->get_bool_option( $plugin_info, 'enable_anonymous', true );
2279
- $this->_anonymous_mode = $this->get_bool_option( $plugin_info, 'anonymous_mode', false );
2280
- }
2281
- $this->_permissions = $this->get_option( $plugin_info, 'permissions', array() );
2282
- }
2283
-
2284
- /**
2285
- * @param string[] $options
2286
- * @param string $key
2287
- * @param mixed $default
2288
- *
2289
- * @return bool
2290
- */
2291
- private function get_option( &$options, $key, $default = false ) {
2292
- return ! empty( $options[ $key ] ) ? $options[ $key ] : $default;
2293
- }
2294
-
2295
- private function get_bool_option( &$options, $key, $default = false ) {
2296
- return isset( $options[ $key ] ) && is_bool( $options[ $key ] ) ? $options[ $key ] : $default;
2297
- }
2298
-
2299
- private function get_numeric_option( &$options, $key, $default = false ) {
2300
- return isset( $options[ $key ] ) && is_numeric( $options[ $key ] ) ? $options[ $key ] : $default;
2301
- }
2302
-
2303
- /**
2304
- * Gate keeper.
2305
- *
2306
- * @author Vova Feldman (@svovaf)
2307
- * @since 1.1.7.3
2308
- *
2309
- * @return bool
2310
- */
2311
- private function should_stop_execution() {
2312
- if ( empty( $this->_storage->was_plugin_loaded ) ) {
2313
- /**
2314
- * Don't execute Freemius until plugin was fully loaded at least once,
2315
- * to give the opportunity for the activation hook to run before pinging
2316
- * the API for connectivity test. This logic is relevant for the
2317
- * identification of new plugin install vs. plugin update.
2318
- *
2319
- * @author Vova Feldman (@svovaf)
2320
- * @since 1.1.9
2321
- */
2322
- return true;
2323
- }
2324
-
2325
- if ( $this->is_activation_mode() ) {
2326
- if ( ! is_admin() ) {
2327
- /**
2328
- * If in activation mode, don't execute Freemius outside of the
2329
- * admin dashboard.
2330
- *
2331
- * @author Vova Feldman (@svovaf)
2332
- * @since 1.1.7.3
2333
- */
2334
- return true;
2335
- }
2336
-
2337
- if ( ! WP_FS__IS_HTTP_REQUEST ) {
2338
- /**
2339
- * If in activation and executed without HTTP context (e.g. CLI, Cronjob),
2340
- * then don't start Freemius.
2341
- *
2342
- * @author Vova Feldman (@svovaf)
2343
- * @since 1.1.6.3
2344
- *
2345
- * @link https://wordpress.org/support/topic/errors-in-the-freemius-class-when-running-in-wordpress-in-cli
2346
- */
2347
- return true;
2348
- }
2349
-
2350
- if ( $this->is_cron() ) {
2351
- /**
2352
- * If in activation mode, don't execute Freemius during wp crons
2353
- * (wp crons have HTTP context - called as HTTP request).
2354
- *
2355
- * @author Vova Feldman (@svovaf)
2356
- * @since 1.1.7.3
2357
- */
2358
- return true;
2359
- }
2360
-
2361
- if ( $this->is_ajax() &&
2362
- ! $this->_admin_notices->has_sticky( 'failed_connect_api_first' ) &&
2363
- ! $this->_admin_notices->has_sticky( 'failed_connect_api' )
2364
- ) {
2365
- /**
2366
- * During activation, if running in AJAX mode, unless there's a sticky
2367
- * connectivity issue notice, don't run Freemius.
2368
- *
2369
- * @author Vova Feldman (@svovaf)
2370
- * @since 1.1.7.3
2371
- */
2372
- return true;
2373
- }
2374
- }
2375
-
2376
- return false;
2377
- }
2378
-
2379
- /**
2380
- * Triggered after code type has changed.
2381
- *
2382
- * @author Vova Feldman (@svovaf)
2383
- * @since 1.1.9.1
2384
- */
2385
- function _after_code_type_change() {
2386
- $this->_logger->entrance();
2387
-
2388
- add_action( is_admin() ? 'admin_init' : 'init', array(
2389
- &$this,
2390
- '_plugin_code_type_changed'
2391
- ) );
2392
- }
2393
-
2394
- /**
2395
- * Handles plugin's code type change (free <--> premium).
2396
- *
2397
- * @author Vova Feldman (@svovaf)
2398
- * @since 1.0.9
2399
- */
2400
- function _plugin_code_type_changed() {
2401
- $this->_logger->entrance();
2402
-
2403
- // Schedule code type changes event.
2404
- // $this->sync_install();
2405
- $this->schedule_install_sync();
2406
-
2407
- if ( $this->is_premium() ) {
2408
- // Activated premium code.
2409
- $this->do_action( 'after_premium_version_activation' );
2410
-
2411
- // Remove all sticky messages related to download of the premium version.
2412
- $this->_admin_notices->remove_sticky( array(
2413
- 'trial_started',
2414
- 'plan_upgraded',
2415
- 'plan_changed',
2416
- ) );
2417
-
2418
- $this->_admin_notices->add_sticky(
2419
- __fs( 'premium-activated-message', $this->_slug ),
2420
- 'premium_activated',
2421
- __fs( 'woot', $this->_slug ) . '!'
2422
- );
2423
- } else {
2424
- // Activated free code (after had the premium before).
2425
- $this->do_action( 'after_free_version_reactivation' );
2426
-
2427
- if ( $this->is_paying() && ! $this->is_premium() ) {
2428
- $this->_admin_notices->add_sticky(
2429
- sprintf(
2430
- __fs( 'you-have-x-license', $this->_slug ),
2431
- $this->_site->plan->title
2432
- ) . ' ' . $this->_get_latest_download_link( sprintf(
2433
- __fs( 'download-x-version-now', $this->_slug ),
2434
- $this->_site->plan->title
2435
- ) ),
2436
- 'plan_upgraded',
2437
- __fs( 'yee-haw', $this->_slug ) . '!'
2438
- );
2439
- }
2440
- }
2441
-
2442
- /**
2443
- * Unregister the uninstall hook for the other version of the plugin (with different code type) to avoid
2444
- * triggering a fatal error when uninstalling that plugin. For example, after deactivating the "free" version
2445
- * of a specific plugin, its uninstall hook should be unregistered after the "premium" version has been
2446
- * activated. If we don't do that, a fatal error will occur when we try to uninstall the "free" version since
2447
- * the main file of the "free" version will be loaded first before calling the hooked callback. Since the
2448
- * free and premium versions are almost identical (same class or have same functions), a fatal error like
2449
- * "Cannot redeclare class MyClass" or "Cannot redeclare my_function()" will occur.
2450
- */
2451
- $this->unregister_uninstall_hook();
2452
-
2453
- $this->clear_module_main_file_cache();
2454
-
2455
- // Update is_premium of latest version.
2456
- $this->_storage->prev_is_premium = $this->_plugin->is_premium;
2457
- }
2458
-
2459
- #endregion Initialization ------------------------------------------------------------------
2460
-
2461
- #region Add-ons -------------------------------------------------------------------------
2462
-
2463
- /**
2464
- * Check if add-on installed and activated on site.
2465
- *
2466
- * @author Vova Feldman (@svovaf)
2467
- * @since 1.0.6
2468
- *
2469
- * @param string|number $slug_or_id
2470
- *
2471
- * @return bool
2472
- */
2473
- function is_addon_activated( $slug_or_id ) {
2474
- return self::has_instance( $slug_or_id );
2475
- }
2476
-
2477
- /**
2478
- * Check if add-on was connected to install
2479
- *
2480
- * @author Vova Feldman (@svovaf)
2481
- * @since 1.1.7
2482
- *
2483
- * @param string $slug
2484
- *
2485
- * @return bool
2486
- */
2487
- function is_addon_connected( $slug ) {
2488
- $sites = self::get_all_sites();
2489
-
2490
- if ( ! isset( $sites[ $slug ] ) ) {
2491
- return false;
2492
- }
2493
-
2494
- $site = $sites[ $slug ];
2495
-
2496
- $plugin = FS_Plugin_Manager::instance( $slug )->get();
2497
-
2498
- if ( $plugin->parent_plugin_id != $this->_plugin->id ) {
2499
- // The given slug do NOT belong to any of the plugin's add-ons.
2500
- return false;
2501
- }
2502
-
2503
- return ( is_object( $site ) &&
2504
- is_numeric( $site->id ) &&
2505
- is_numeric( $site->user_id ) &&
2506
- is_object( $site->plan )
2507
- );
2508
- }
2509
-
2510
- /**
2511
- * Determines if add-on installed.
2512
- *
2513
- * NOTE: This is a heuristic and only works if the folder/file named as the slug.
2514
- *
2515
- * @author Vova Feldman (@svovaf)
2516
- * @since 1.0.6
2517
- *
2518
- * @param string $slug
2519
- *
2520
- * @return bool
2521
- */
2522
- function is_addon_installed( $slug ) {
2523
- return file_exists( fs_normalize_path( WP_PLUGIN_DIR . '/' . $this->get_addon_basename( $slug ) ) );
2524
- }
2525
-
2526
- /**
2527
- * Get add-on basename.
2528
- *
2529
- * @author Vova Feldman (@svovaf)
2530
- * @since 1.0.6
2531
- *
2532
- * @param string $slug
2533
- *
2534
- * @return string
2535
- */
2536
- function get_addon_basename( $slug ) {
2537
- if ( $this->is_addon_activated( $slug ) ) {
2538
- self::instance( $slug )->get_plugin_basename();
2539
- }
2540
-
2541
- $premium_basename = $slug . '-premium/' . $slug . '.php';
2542
-
2543
- if ( file_exists( fs_normalize_path( WP_PLUGIN_DIR . '/' . $premium_basename ) ) ) {
2544
- return $premium_basename;
2545
- }
2546
-
2547
- $free_basename = $slug . '/' . $slug . '.php';
2548
-
2549
- return $free_basename;
2550
- }
2551
-
2552
- /**
2553
- * Get installed add-ons instances.
2554
- *
2555
- * @author Vova Feldman (@svovaf)
2556
- * @since 1.0.6
2557
- *
2558
- * @return Freemius[]
2559
- */
2560
- function get_installed_addons() {
2561
- $installed_addons = array();
2562
- foreach ( self::$_instances as $slug => $instance ) {
2563
- if ( $instance->is_addon() && is_object( $instance->_parent_plugin ) ) {
2564
- if ( $this->_plugin->id == $instance->_parent_plugin->id ) {
2565
- $installed_addons[] = $instance;
2566
- }
2567
- }
2568
- }
2569
-
2570
- return $installed_addons;
2571
- }
2572
-
2573
- /**
2574
- * Check if any add-ons of the plugin are installed.
2575
- *
2576
- * @author Leo Fajardo (@leorw)
2577
- * @since 1.1.1
2578
- *
2579
- * @return bool
2580
- */
2581
- function has_installed_addons() {
2582
- if ( ! $this->has_addons() ) {
2583
- return false;
2584
- }
2585
-
2586
- foreach ( self::$_instances as $slug => $instance ) {
2587
- if ( $instance->is_addon() && is_object( $instance->_parent_plugin ) ) {
2588
- if ( $this->_plugin->id == $instance->_parent_plugin->id ) {
2589
- return true;
2590
- }
2591
- }
2592
- }
2593
-
2594
- return false;
2595
- }
2596
-
2597
- /**
2598
- * Tell Freemius that the current plugin is an add-on.
2599
- *
2600
- * @author Vova Feldman (@svovaf)
2601
- * @since 1.0.6
2602
- *
2603
- * @param number $parent_plugin_id The parent plugin ID
2604
- */
2605
- function init_addon( $parent_plugin_id ) {
2606
- $this->_plugin->parent_plugin_id = $parent_plugin_id;
2607
- }
2608
-
2609
- /**
2610
- * @author Vova Feldman (@svovaf)
2611
- * @since 1.0.6
2612
- *
2613
- * @return bool
2614
- */
2615
- function is_addon() {
2616
- return isset( $this->_plugin->parent_plugin_id ) && is_numeric( $this->_plugin->parent_plugin_id );
2617
- }
2618
-
2619
- /**
2620
- * Deactivate add-on if it's premium only and the user does't have a valid license.
2621
- *
2622
- * @param bool $is_after_trial_cancel
2623
- *
2624
- * @return bool If add-on was deactivated.
2625
- */
2626
- private function deactivate_premium_only_addon_without_license( $is_after_trial_cancel = false ) {
2627
- if ( ! $this->has_free_plan() &&
2628
- ! $this->has_features_enabled_license() &&
2629
- ! $this->_has_premium_license()
2630
- ) {
2631
- // IF wrapper is turned off because activation_timestamp is currently only stored for plugins (not addons).
2632
- // if (empty($this->_storage->activation_timestamp) ||
2633
- // (WP_FS__SCRIPT_START_TIME - $this->_storage->activation_timestamp) > 30
2634
- // ) {
2635
- /**
2636
- * @todo When it's first fail, there's no reason to try and re-sync because the licenses were just synced after initial activation.
2637
- *
2638
- * Retry syncing the user add-on licenses.
2639
- */
2640
- // Sync licenses.
2641
- $this->_sync_licenses();
2642
- // }
2643
-
2644
- // Try to activate premium license.
2645
- $this->_activate_license( true );
2646
-
2647
- if ( ! $this->has_free_plan() &&
2648
- ! $this->has_features_enabled_license() &&
2649
- ! $this->_has_premium_license()
2650
- ) {
2651
- // @todo Check if deactivate plugins also call the deactivation hook.
2652
-
2653
- deactivate_plugins( array( $this->_plugin_basename ), true );
2654
-
2655
- $this->_parent->_admin_notices->add_sticky(
2656
- sprintf(
2657
- __fs( ( $is_after_trial_cancel ?
2658
- 'addon-trial-cancelled-message' :
2659
- 'addon-no-license-message' ),
2660
- $this->_parent->_slug
2661
- ),
2662
- '<b>' . $this->_plugin->title . '</b>'
2663
- ) . ' ' . sprintf(
2664
- '<a href="%s" aria-label="%s" class="button button-primary" style="margin-left: 10px; vertical-align: middle;">%s &nbsp;&#10140;</a>',
2665
- $this->_parent->addon_url( $this->_slug ),
2666
- esc_attr( sprintf( __fs( 'more-information-about-x', $this->_parent->_slug ), $this->_plugin->title ) ),
2667
- __fs( 'purchase-license', $this->_parent->_slug )
2668
- ),
2669
- 'no_addon_license_' . $this->_slug,
2670
- ( $is_after_trial_cancel ? '' : __fs( 'oops', $this->_parent->_slug ) . '...' ),
2671
- ( $is_after_trial_cancel ? 'success' : 'error' )
2672
- );
2673
-
2674
- return true;
2675
- }
2676
- }
2677
-
2678
- return false;
2679
- }
2680
-
2681
- #endregion ------------------------------------------------------------------
2682
-
2683
- #region Sandbox ------------------------------------------------------------------
2684
-
2685
- /**
2686
- * Set Freemius into sandbox mode for debugging.
2687
- *
2688
- * @author Vova Feldman (@svovaf)
2689
- * @since 1.0.4
2690
- *
2691
- * @param string $secret_key
2692
- */
2693
- function init_sandbox( $secret_key ) {
2694
- $this->_plugin->secret_key = $secret_key;
2695
-
2696
- // Update plugin details.
2697
- FS_Plugin_Manager::instance( $this->_slug )->update( $this->_plugin, true );
2698
- }
2699
-
2700
- /**
2701
- * Check if running payments in sandbox mode.
2702
- *
2703
- * @author Vova Feldman (@svovaf)
2704
- * @since 1.0.4
2705
- *
2706
- * @return bool
2707
- */
2708
- function is_payments_sandbox() {
2709
- return ( ! $this->is_live() ) || isset( $this->_plugin->secret_key );
2710
- }
2711
-
2712
- #endregion Sandbox ------------------------------------------------------------------
2713
-
2714
- /**
2715
- * Check if running test vs. live plugin.
2716
- *
2717
- * @author Vova Feldman (@svovaf)
2718
- * @since 1.0.5
2719
- *
2720
- * @return bool
2721
- */
2722
- function is_live() {
2723
- return $this->_plugin->is_live;
2724
- }
2725
-
2726
- /**
2727
- * Check if the user skipped connecting the account with Freemius.
2728
- *
2729
- * @author Vova Feldman (@svovaf)
2730
- * @since 1.0.7
2731
- *
2732
- * @return bool
2733
- */
2734
- function is_anonymous() {
2735
- if ( ! isset( $this->_is_anonymous ) ) {
2736
- if ( ! isset( $this->_storage->is_anonymous ) ) {
2737
- // Not skipped.
2738
- $this->_is_anonymous = false;
2739
- } else if ( is_bool( $this->_storage->is_anonymous ) ) {
2740
- // For back compatibility, since the variable was boolean before.
2741
- $this->_is_anonymous = $this->_storage->is_anonymous;
2742
-
2743
- // Upgrade stored data format to 1.1.3 format.
2744
- $this->set_anonymous_mode( $this->_storage->is_anonymous );
2745
- } else {
2746
- // Version 1.1.3 and later.
2747
- $this->_is_anonymous = $this->_storage->is_anonymous['is'];
2748
- }
2749
- }
2750
-
2751
- return $this->_is_anonymous;
2752
- }
2753
-
2754
- /**
2755
- * Check if user connected his account and install pending email activation.
2756
- *
2757
- * @author Vova Feldman (@svovaf)
2758
- * @since 1.0.7
2759
- *
2760
- * @return bool
2761
- */
2762
- function is_pending_activation() {
2763
- return $this->_storage->get( 'is_pending_activation', false );
2764
- }
2765
-
2766
- /**
2767
- * Check if plugin must be WordPress.org compliant.
2768
- *
2769
- * @since 1.0.7
2770
- *
2771
- * @return bool
2772
- */
2773
- function is_org_repo_compliant() {
2774
- return $this->_is_org_compliant;
2775
- }
2776
-
2777
- #region Daily Sync Cron ------------------------------------------------------------------
2778
-
2779
- /**
2780
- * @author Vova Feldman (@svovaf)
2781
- * @since 1.1.7.3
2782
- */
2783
- private function run_manual_sync() {
2784
- $this->require_pluggable_essentials();
2785
-
2786
- if ( ! current_user_can( 'activate_plugins' ) ) {
2787
- return;
2788
- }
2789
-
2790
- // Run manual sync.
2791
- $this->_sync_cron();
2792
-
2793
- // Reschedule next cron to run 24 hours from now (performance optimization).
2794
- $this->clear_sync_cron();
2795
-
2796
- $this->schedule_sync_cron( time() + WP_FS__TIME_24_HOURS_IN_SEC, false );
2797
- }
2798
-
2799
- /**
2800
- * Data sync cron job. Replaces the background sync non blocking HTTP request
2801
- * that doesn't halt page loading.
2802
- *
2803
- * @author Vova Feldman (@svovaf)
2804
- * @since 1.1.7.3
2805
- */
2806
- function _sync_cron() {
2807
- $this->_logger->entrance();
2808
-
2809
- // Store the last time data sync was executed.
2810
- $this->_storage->sync_timestamp = time();
2811
-
2812
- // Check if API is temporary down.
2813
- if ( FS_Api::is_temporary_down() ) {
2814
- return;
2815
- }
2816
-
2817
- // @todo Add logic that identifies API latency, and reschedule the next background sync randomly between 8-16 hours.
2818
-
2819
- if ( $this->is_registered() ) {
2820
- if ( $this->has_paid_plan() ) {
2821
- // Initiate background plan sync.
2822
- $this->_sync_license( true );
2823
-
2824
- if ( $this->is_paying() ) {
2825
- // Check for premium plugin updates.
2826
- $this->_check_updates( true );
2827
- }
2828
- } else {
2829
- // Sync install (only if something changed locally).
2830
- $this->sync_install();
2831
- }
2832
- }
2833
-
2834
- if ( ! $this->is_addon() && $this->_has_addons ) {
2835
- // Sync add-ons collection.
2836
- $this->_sync_addons( true );
2837
- }
2838
-
2839
- $this->do_action( 'after_sync_cron' );
2840
- }
2841
-
2842
- /**
2843
- * Check if sync was executed in the last $period of seconds.
2844
- *
2845
- * @author Vova Feldman (@svovaf)
2846
- * @since 1.1.7.3
2847
- *
2848
- * @param int $period In seconds
2849
- *
2850
- * @return bool
2851
- */
2852
- private function is_sync_executed( $period = WP_FS__TIME_24_HOURS_IN_SEC ) {
2853
- if ( ! isset( $this->_storage->sync_timestamp ) ) {
2854
- return false;
2855
- }
2856
-
2857
- return ( $this->_storage->sync_timestamp > ( WP_FS__SCRIPT_START_TIME - $period ) );
2858
- }
2859
-
2860
- /**
2861
- * @author Vova Feldman (@svovaf)
2862
- * @since 1.1.7.3
2863
- *
2864
- * @return bool
2865
- */
2866
- private function is_sync_cron_on() {
2867
- /**
2868
- * @var object $sync_cron_data
2869
- */
2870
- $sync_cron_data = $this->_storage->get( 'sync_cron', null );
2871
-
2872
- return ( ! is_null( $sync_cron_data ) && true === $sync_cron_data->on );
2873
- }
2874
-
2875
- /**
2876
- * @author Vova Feldman (@svovaf)
2877
- * @since 1.1.7.3
2878
- *
2879
- * @param int $start_at Defaults to now.
2880
- * @param bool $randomize_start If true, schedule first job randomly during the next 12 hours. Otherwise,
2881
- * schedule job to start right away.
2882
- */
2883
- private function schedule_sync_cron( $start_at = WP_FS__SCRIPT_START_TIME, $randomize_start = true ) {
2884
- $this->_logger->entrance();
2885
-
2886
- if ( $randomize_start ) {
2887
- // Schedule first sync with a random 12 hour time range from now.
2888
- $start_at += rand( 0, ( WP_FS__TIME_24_HOURS_IN_SEC / 2 ) );
2889
- }
2890
-
2891
- // Schedule daily WP cron.
2892
- wp_schedule_event(
2893
- $start_at,
2894
- 'daily',
2895
- $this->get_action_tag( 'data_sync' )
2896
- );
2897
-
2898
- $this->_storage->store( 'sync_cron', (object) array(
2899
- 'version' => $this->get_plugin_version(),
2900
- 'sdk_version' => $this->version,
2901
- 'timestamp' => WP_FS__SCRIPT_START_TIME,
2902
- 'on' => true,
2903
- ) );
2904
- }
2905
-
2906
- /**
2907
- * Add the actual sync function to the cron job hook.
2908
- *
2909
- * @author Vova Feldman (@svovaf)
2910
- * @since 1.1.7.3
2911
- */
2912
- private function hook_callback_to_sync_cron() {
2913
- $this->add_action( 'data_sync', array( &$this, '_sync_cron' ) );
2914
- }
2915
-
2916
- /**
2917
- * @author Vova Feldman (@svovaf)
2918
- * @since 1.1.7.3
2919
- */
2920
- private function clear_sync_cron() {
2921
- $this->_logger->entrance();
2922
-
2923
- if ( ! $this->is_sync_cron_on() ) {
2924
- return;
2925
- }
2926
-
2927
- $this->_storage->remove( 'sync_cron' );
2928
-
2929
- wp_clear_scheduled_hook( $this->get_action_tag( 'data_sync' ) );
2930
- }
2931
-
2932
- /**
2933
- * Unix timestamp for next sync cron execution or false if not scheduled.
2934
- *
2935
- * @author Vova Feldman (@svovaf)
2936
- * @since 1.1.7.3
2937
- *
2938
- * @return int|false
2939
- */
2940
- function next_sync_cron() {
2941
- $this->_logger->entrance();
2942
-
2943
- if ( ! $this->is_sync_cron_on() ) {
2944
- return false;
2945
- }
2946
-
2947
- return wp_next_scheduled( $this->get_action_tag( 'data_sync' ) );
2948
- }
2949
-
2950
- /**
2951
- * Unix timestamp for previous sync cron execution or false if never executed.
2952
- *
2953
- * @author Vova Feldman (@svovaf)
2954
- * @since 1.1.7.3
2955
- *
2956
- * @return int|false
2957
- */
2958
- function last_sync_cron() {
2959
- $this->_logger->entrance();
2960
-
2961
- return $this->_storage->get( 'sync_timestamp' );
2962
- }
2963
-
2964
- #endregion Daily Sync Cron ------------------------------------------------------------------
2965
-
2966
- #region Async Install Sync ------------------------------------------------------------------
2967
-
2968
- /**
2969
- * @author Vova Feldman (@svovaf)
2970
- * @since 1.1.7.3
2971
- *
2972
- * @return bool
2973
- */
2974
- private function is_install_sync_scheduled() {
2975
- /**
2976
- * @var object $cron_data
2977
- */
2978
- $cron_data = $this->_storage->get( 'install_sync_cron', null );
2979
-
2980
- return ( ! is_null( $cron_data ) && true === $cron_data->on );
2981
- }
2982
-
2983
- /**
2984
- * Instead of running blocking install sync event, execute non blocking scheduled wp-cron.
2985
- *
2986
- * @author Vova Feldman (@svovaf)
2987
- * @since 1.1.7.3
2988
- */
2989
- private function schedule_install_sync() {
2990
- $this->_logger->entrance();
2991
-
2992
- $this->clear_install_sync_cron();
2993
-
2994
- // Schedule immediate install sync.
2995
- wp_schedule_single_event(
2996
- WP_FS__SCRIPT_START_TIME,
2997
- $this->get_action_tag( 'install_sync' )
2998
- );
2999
-
3000
- $this->_storage->store( 'install_sync_cron', (object) array(
3001
- 'version' => $this->get_plugin_version(),
3002
- 'sdk_version' => $this->version,
3003
- 'timestamp' => WP_FS__SCRIPT_START_TIME,
3004
- 'on' => true,
3005
- ) );
3006
- }
3007
-
3008
- /**
3009
- * Unix timestamp for previous install sync cron execution or false if never executed.
3010
- *
3011
- * @todo There's some very strange bug that $this->_storage->install_sync_timestamp value is not being
3012
- * updated. But for sure the sync event is working.
3013
- *
3014
- * @author Vova Feldman (@svovaf)
3015
- * @since 1.1.7.3
3016
- *
3017
- * @return int|false
3018
- */
3019
- function last_install_sync() {
3020
- $this->_logger->entrance();
3021
-
3022
- return $this->_storage->get( 'install_sync_timestamp' );
3023
- }
3024
-
3025
- /**
3026
- * Unix timestamp for next install sync cron execution or false if not scheduled.
3027
- *
3028
- * @author Vova Feldman (@svovaf)
3029
- * @since 1.1.7.3
3030
- *
3031
- * @return int|false
3032
- */
3033
- function next_install_sync() {
3034
- $this->_logger->entrance();
3035
-
3036
- if ( ! $this->is_install_sync_scheduled() ) {
3037
- return false;
3038
- }
3039
-
3040
- return wp_next_scheduled( $this->get_action_tag( 'install_sync' ) );
3041
- }
3042
-
3043
- /**
3044
- * Add the actual install sync function to the cron job hook.
3045
- *
3046
- * @author Vova Feldman (@svovaf)
3047
- * @since 1.1.7.3
3048
- */
3049
- private function hook_callback_to_install_sync() {
3050
- $this->add_action( 'install_sync', array( &$this, '_run_sync_install' ) );
3051
- }
3052
-
3053
- /**
3054
- * @author Vova Feldman (@svovaf)
3055
- * @since 1.1.7.3
3056
- */
3057
- private function clear_install_sync_cron() {
3058
- $this->_logger->entrance();
3059
-
3060
- if ( ! $this->is_install_sync_scheduled() ) {
3061
- return;
3062
- }
3063
-
3064
- $this->_storage->remove( 'install_sync_cron' );
3065
-
3066
- wp_clear_scheduled_hook( $this->get_action_tag( 'install_sync' ) );
3067
- }
3068
-
3069
- /**
3070
- * @author Vova Feldman (@svovaf)
3071
- * @since 1.1.7.3
3072
- */
3073
- public function _run_sync_install() {
3074
- $this->_logger->entrance();
3075
-
3076
- // Update last install sync timestamp.
3077
- $this->_storage->install_sync_timestamp = time();
3078
-
3079
- $this->sync_install( array(), true );
3080
- }
3081
-
3082
- #endregion Async Install Sync ------------------------------------------------------------------
3083
-
3084
- /**
3085
- * Show a notice that activation is currently pending.
3086
- *
3087
- * @author Vova Feldman (@svovaf)
3088
- * @since 1.0.7
3089
- *
3090
- * @param bool|string $email
3091
- */
3092
- function _add_pending_activation_notice( $email = false ) {
3093
- if ( ! is_string( $email ) ) {
3094
- $current_user = self::_get_current_wp_user();
3095
- $email = $current_user->user_email;
3096
- }
3097
-
3098
- $this->_admin_notices->add_sticky(
3099
- sprintf(
3100
- __fs( 'pending-activation-message', $this->_slug ),
3101
- '<b>' . $this->get_plugin_name() . '</b>',
3102
- '<b>' . $email . '</b>'
3103
- ),
3104
- 'activation_pending',
3105
- 'Thanks!'
3106
- );
3107
- }
3108
-
3109
- /**
3110
- * Check if currently in plugin activation.
3111
- *
3112
- * @author Vova Feldman (@svovaf)
3113
- * @since 1.1.4
3114
- *
3115
- * @return bool
3116
- */
3117
- function is_plugin_activation() {
3118
- return get_option( "fs_{$this->_slug}_activated", false );
3119
- }
3120
-
3121
- /**
3122
- *
3123
- * NOTE: admin_menu action executed before admin_init.
3124
- *
3125
- * @author Vova Feldman (@svovaf)
3126
- * @since 1.0.7
3127
- */
3128
- function _admin_init_action() {
3129
- /**
3130
- * Automatically redirect to connect/activation page after plugin activation.
3131
- *
3132
- * @since 1.1.7 Do NOT redirect to opt-in when running in network admin mode.
3133
- */
3134
- if ( $this->is_plugin_activation() ) {
3135
- delete_option( "fs_{$this->_slug}_activated" );
3136
-
3137
- if ( ! function_exists( 'is_network_admin' ) || ! is_network_admin() ) {
3138
- $this->_redirect_on_activation_hook();
3139
-
3140
- return;
3141
- }
3142
- }
3143
-
3144
- if ( fs_request_is_action( $this->_slug . '_skip_activation' ) ) {
3145
- check_admin_referer( $this->_slug . '_skip_activation' );
3146
-
3147
- $this->skip_connection();
3148
-
3149
- if ( fs_redirect( $this->get_after_activation_url( 'after_skip_url' ) ) ) {
3150
- exit();
3151
- }
3152
- }
3153
-
3154
- if ( ! $this->is_addon() && ! $this->is_registered() && ! $this->is_anonymous() ) {
3155
- if ( ! $this->is_pending_activation() ) {
3156
- if ( ! $this->_menu->is_activation_page() ) {
3157
- if ( $this->is_plugin_new_install() || $this->is_only_premium() ) {
3158
- // Show notice for new plugin installations.
3159
- $this->_admin_notices->add(
3160
- sprintf(
3161
- __fs( 'you-are-step-away', $this->_slug ),
3162
- sprintf( '<b><a href="%s">%s</a></b>',
3163
- $this->get_activation_url(),
3164
- sprintf( __fs( 'activate-x-now', $this->_slug ), $this->get_plugin_name() )
3165
- )
3166
- ),
3167
- '',
3168
- 'update-nag'
3169
- );
3170
- } else {
3171
- if ( ! isset( $this->_storage->sticky_optin_added ) ) {
3172
- $this->_storage->sticky_optin_added = true;
3173
-
3174
- // Show notice for new plugin installations.
3175
- $this->_admin_notices->add_sticky(
3176
- sprintf(
3177
- __fs( 'few-plugin-tweaks', $this->_slug ),
3178
- sprintf( '<b><a href="%s">%s</a></b>',
3179
- $this->get_activation_url(),
3180
- sprintf( __fs( 'optin-x-now', $this->_slug ), $this->get_plugin_name() )
3181
- )
3182
- ),
3183
- 'connect_account',
3184
- '',
3185
- 'update-nag'
3186
- );
3187
- }
3188
-
3189
- if ( $this->has_filter( 'optin_pointer_element' ) ) {
3190
- // Don't show admin nag if plugin update.
3191
- wp_enqueue_script( 'wp-pointer' );
3192
- wp_enqueue_style( 'wp-pointer' );
3193
-
3194
- $this->_enqueue_connect_essentials();
3195
-
3196
- add_action( 'admin_print_footer_scripts', array(
3197
- $this,
3198
- '_add_connect_pointer_script'
3199
- ) );
3200
- }
3201
-
3202
- }
3203
- }
3204
- }
3205
- }
3206
-
3207
- $this->_add_upgrade_action_link();
3208
- }
3209
-
3210
- /**
3211
- * Enqueue connect requires scripts and styles.
3212
- *
3213
- * @author Vova Feldman (@svovaf)
3214
- * @since 1.1.4
3215
- */
3216
- function _enqueue_connect_essentials() {
3217
- wp_enqueue_script( 'jquery' );
3218
- wp_enqueue_script( 'json2' );
3219
-
3220
- fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.min.js' );
3221
- fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
3222
-
3223
- fs_enqueue_local_style( 'fs_connect', '/admin/connect.css' );
3224
- }
3225
-
3226
- /**
3227
- * Add connect / opt-in pointer.
3228
- *
3229
- * @author Vova Feldman (@svovaf)
3230
- * @since 1.1.4
3231
- */
3232
- function _add_connect_pointer_script() {
3233
- $vars = array( 'slug' => $this->_slug );
3234
- $pointer_content = fs_get_template( 'connect.php', $vars );
3235
- ?>
3236
- <script type="text/javascript">// <![CDATA[
3237
- jQuery(document).ready(function ($) {
3238
- if ('undefined' !== typeof(jQuery().pointer)) {
3239
-
3240
- var element = <?php echo $this->apply_filters('optin_pointer_element', '$("#non_existing_element");') ?>;
3241
-
3242
- if (element.length > 0) {
3243
- var optin = $(element).pointer($.extend(true, {}, {
3244
- content : <?php echo json_encode($pointer_content) ?>,
3245
- position : {
3246
- edge : 'left',
3247
- align: 'center'
3248
- },
3249
- buttons : function () {
3250
- // Don't show pointer buttons.
3251
- return '';
3252
- },
3253
- pointerWidth: 482
3254
- }, <?php echo $this->apply_filters('optin_pointer_options_json', '{}') ?>));
3255
-
3256
- <?php
3257
- echo $this->apply_filters('optin_pointer_execute', "
3258
-
3259
- optin.pointer('open');
3260
-
3261
- // Tag the opt-in pointer with custom class.
3262
- $('.wp-pointer #fs_connect')
3263
- .parents('.wp-pointer.wp-pointer-top')
3264
- .addClass('fs-opt-in-pointer');
3265
-
3266
- ", 'element', 'optin') ?>
3267
- }
3268
- }
3269
- });
3270
- // ]]></script>
3271
- <?php
3272
- }
3273
-
3274
- /**
3275
- * Return current page's URL.
3276
- *
3277
- * @author Vova Feldman (@svovaf)
3278
- * @since 1.0.7
3279
- *
3280
- * @return string
3281
- */
3282
- function current_page_url() {
3283
- $url = 'http';
3284
-
3285
- if ( isset( $_SERVER["HTTPS"] ) ) {
3286
- if ( $_SERVER["HTTPS"] == "on" ) {
3287
- $url .= "s";
3288
- }
3289
- }
3290
- $url .= "://";
3291
- if ( $_SERVER["SERVER_PORT"] != "80" ) {
3292
- $url .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
3293
- } else {
3294
- $url .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
3295
- }
3296
-
3297
- return esc_url( $url );
3298
- }
3299
-
3300
- /**
3301
- * Check if the current page is the plugin's main admin settings page.
3302
- *
3303
- * @author Vova Feldman (@svovaf)
3304
- * @since 1.0.7
3305
- *
3306
- * @return bool
3307
- */
3308
- function _is_plugin_page() {
3309
- return fs_is_plugin_page( $this->_menu->get_raw_slug() ) ||
3310
- fs_is_plugin_page( $this->_slug );
3311
- }
3312
-
3313
- /* Events
3314
- ------------------------------------------------------------------------------------------------------------------*/
3315
- /**
3316
- * Delete site install from Database.
3317
- *
3318
- * @author Vova Feldman (@svovaf)
3319
- * @since 1.0.1
3320
- *
3321
- * @param bool $store
3322
- */
3323
- function _delete_site( $store = true ) {
3324
- $sites = self::get_all_sites();
3325
-
3326
- if ( isset( $sites[ $this->_slug ] ) ) {
3327
- unset( $sites[ $this->_slug ] );
3328
- }
3329
-
3330
- self::$_accounts->set_option( 'sites', $sites, $store );
3331
- }
3332
-
3333
- /**
3334
- * Delete plugin's plans information.
3335
- *
3336
- * @param bool $store Flush to Database if true.
3337
- *
3338
- * @author Vova Feldman (@svovaf)
3339
- * @since 1.0.9
3340
- */
3341
- private function _delete_plans( $store = true ) {
3342
- $this->_logger->entrance();
3343
-
3344
- $plans = self::get_all_plans();
3345
-
3346
- unset( $plans[ $this->_slug ] );
3347
-
3348
- self::$_accounts->set_option( 'plans', $plans, $store );
3349
- }
3350
-
3351
- /**
3352
- * Delete all plugin licenses.
3353
- *
3354
- * @author Vova Feldman (@svovaf)
3355
- * @since 1.0.9
3356
- *
3357
- * @param bool $store
3358
- * @param string|bool $plugin_slug
3359
- */
3360
- private function _delete_licenses( $store = true, $plugin_slug = false ) {
3361
- $this->_logger->entrance();
3362
-
3363
- $all_licenses = self::get_all_licenses();
3364
-
3365
- if ( ! is_string( $plugin_slug ) ) {
3366
- $plugin_slug = $this->_slug;
3367
- }
3368
-
3369
- unset( $all_licenses[ $plugin_slug ] );
3370
-
3371
- self::$_accounts->set_option( 'licenses', $all_licenses, $store );
3372
- }
3373
-
3374
- /**
3375
- * Check if Freemius was added on new plugin installation.
3376
- *
3377
- * @author Vova Feldman (@svovaf)
3378
- * @since 1.1.5
3379
- *
3380
- * @return bool
3381
- */
3382
- function is_plugin_new_install() {
3383
- return isset( $this->_storage->is_plugin_new_install ) &&
3384
- $this->_storage->is_plugin_new_install;
3385
- }
3386
-
3387
- /**
3388
- * Plugin activated hook.
3389
- *
3390
- * @author Vova Feldman (@svovaf)
3391
- * @since 1.0.1
3392
- *
3393
- * @uses FS_Api
3394
- */
3395
- function _activate_plugin_event_hook() {
3396
- $this->_logger->entrance( 'slug = ' . $this->_slug );
3397
-
3398
- if ( ! current_user_can( 'activate_plugins' ) ) {
3399
- return;
3400
- }
3401
-
3402
- $this->unregister_uninstall_hook();
3403
-
3404
- // Clear API cache on activation.
3405
- FS_Api::clear_cache();
3406
-
3407
- if ( $this->is_registered() ) {
3408
- // Schedule re-activation event and sync.
3409
- // $this->sync_install( array(), true );
3410
- $this->schedule_install_sync();
3411
-
3412
- /**
3413
- * @todo Work on automatic deactivation of the Free plugin version. It doesn't work since the slug of the free & premium versions is identical. Therefore, only one instance of Freemius is created and the activation hook of the premium version is not being added.
3414
- */
3415
- if ( $this->_plugin_basename !== $this->_free_plugin_basename ) {
3416
- // Deactivate Free plugin version on premium plugin activation.
3417
- deactivate_plugins( $this->_free_plugin_basename );
3418
-
3419
- $this->_admin_notices->add(
3420
- sprintf( __fs( 'successful-version-upgrade-message', $this->_slug ), sprintf( '<b>%s</b>', $this->_plugin->title ) ),
3421
- __fs( 'woot', $this->_slug ) . '!'
3422
- );
3423
- }
3424
- } else if ( $this->is_anonymous() ) {
3425
- /**
3426
- * Reset "skipped" click cache on the following:
3427
- * 1. Development mode.
3428
- * 2. If the user skipped the exact same version before.
3429
- *
3430
- * @todo 3. If explicitly asked to retry after every activation.
3431
- */
3432
- if ( WP_FS__DEV_MODE ||
3433
- $this->get_plugin_version() == $this->_storage->is_anonymous['version']
3434
- ) {
3435
- $this->reset_anonymous_mode();
3436
- }
3437
- }
3438
-
3439
- if ( ! isset( $this->_storage->is_plugin_new_install ) ) {
3440
- /**
3441
- * If no previous version of plugin's version exist, it means that it's either
3442
- * the first time that the plugin installed on the site, or the plugin was installed
3443
- * before but didn't have Freemius integrated.
3444
- *
3445
- * Since register_activation_hook() do NOT fires on updates since 3.1, and only fires
3446
- * on manual activation via the dashboard, is_plugin_activation() is TRUE
3447
- * only after immediate activation.
3448
- *
3449
- * @since 1.1.4
3450
- * @link https://make.wordpress.org/core/2010/10/27/plugin-activation-hooks-no-longer-fire-for-updates/
3451
- */
3452
- $this->_storage->is_plugin_new_install = empty( $this->_storage->plugin_last_version );
3453
- }
3454
-
3455
- if ( ! $this->_anonymous_mode && $this->has_api_connectivity( WP_FS__DEV_MODE ) ) {
3456
- // Store hint that the plugin was just activated to enable auto-redirection to settings.
3457
- add_option( "fs_{$this->_slug}_activated", true );
3458
- }
3459
-
3460
- /**
3461
- * Activation hook is executed after the plugin's main file is loaded, therefore,
3462
- * after the plugin was loaded. The logic is located at activate_plugin()
3463
- * ./wp-admin/includes/plugin.php.
3464
- *
3465
- * @author Vova Feldman (@svovaf)
3466
- * @since 1.1.9
3467
- */
3468
- $this->_storage->was_plugin_loaded = true;
3469
- }
3470
-
3471
- /**
3472
- * Delete account.
3473
- *
3474
- * @author Vova Feldman (@svovaf)
3475
- * @since 1.0.3
3476
- *
3477
- * @param bool $check_user Enforce checking if user have plugins activation privileges.
3478
- */
3479
- function delete_account_event( $check_user = true ) {
3480
- $this->_logger->entrance( 'slug = ' . $this->_slug );
3481
-
3482
- if ( $check_user && ! current_user_can( 'activate_plugins' ) ) {
3483
- return;
3484
- }
3485
-
3486
- $this->do_action( 'before_account_delete' );
3487
-
3488
- // Clear all admin notices.
3489
- $this->_admin_notices->clear_all_sticky();
3490
-
3491
- $this->_delete_site( false );
3492
-
3493
- $this->_delete_plans( false );
3494
-
3495
- $this->_delete_licenses( false );
3496
-
3497
- // Delete add-ons related to plugin's account.
3498
- $this->_delete_account_addons( false );
3499
-
3500
- // @todo Delete plans and licenses of add-ons.
3501
-
3502
- self::$_accounts->store();
3503
-
3504
- /**
3505
- * IMPORTANT:
3506
- * Clear crons must be executed before clearing all storage.
3507
- * Otherwise, the cron will not be cleared.
3508
- */
3509
- $this->clear_sync_cron();
3510
- $this->clear_install_sync_cron();
3511
-
3512
- // Clear all storage data.
3513
- $this->_storage->clear_all( true, array(
3514
- 'connectivity_test',
3515
- 'is_on',
3516
- ) );
3517
-
3518
- // Send delete event.
3519
- $this->get_api_site_scope()->call( '/', 'delete' );
3520
-
3521
- $this->do_action( 'after_account_delete' );
3522
- }
3523
-
3524
- /**
3525
- * Plugin deactivation hook.
3526
- *
3527
- * @author Vova Feldman (@svovaf)
3528
- * @since 1.0.1
3529
- */
3530
- function _deactivate_plugin_hook() {
3531
- $this->_logger->entrance( 'slug = ' . $this->_slug );
3532
-
3533
- if ( ! current_user_can( 'activate_plugins' ) ) {
3534
- return;
3535
- }
3536
-
3537
- $this->_admin_notices->clear_all_sticky();
3538
- if ( isset( $this->_storage->sticky_optin_added ) ) {
3539
- unset( $this->_storage->sticky_optin_added );
3540
- }
3541
-
3542
- if ( ! isset( $this->_storage->is_plugin_new_install ) ) {
3543
- // Remember that plugin was already installed.
3544
- $this->_storage->is_plugin_new_install = false;
3545
- }
3546
-
3547
- // Hook to plugin uninstall.
3548
- register_uninstall_hook( $this->_plugin_main_file_path, array( 'Freemius', '_uninstall_plugin_hook' ) );
3549
-
3550
- $this->clear_module_main_file_cache();
3551
- $this->clear_sync_cron();
3552
- $this->clear_install_sync_cron();
3553
-
3554
- if ( $this->is_registered() ) {
3555
- // Send deactivation event.
3556
- $this->sync_install( array(
3557
- 'is_active' => false,
3558
- ) );
3559
- } else {
3560
- if ( ! $this->has_api_connectivity() ) {
3561
- // Reset connectivity test cache.
3562
- unset( $this->_storage->connectivity_test );
3563
- }
3564
- }
3565
-
3566
- // Clear API cache on deactivation.
3567
- FS_Api::clear_cache();
3568
-
3569
- $this->remove_sdk_reference();
3570
- }
3571
-
3572
- /**
3573
- * @author Vova Feldman (@svovaf)
3574
- * @since 1.1.6
3575
- */
3576
- private function remove_sdk_reference() {
3577
- global $fs_active_plugins;
3578
-
3579
- foreach ( $fs_active_plugins->plugins as $sdk_path => &$data ) {
3580
- if ( $this->_plugin_basename == $data->plugin_path ) {
3581
- unset( $fs_active_plugins->plugins[ $sdk_path ] );
3582
- break;
3583
- }
3584
- }
3585
-
3586
- fs_fallback_to_newest_active_sdk();
3587
- }
3588
-
3589
- /**
3590
- * @author Vova Feldman (@svovaf)
3591
- * @since 1.1.3
3592
- *
3593
- * @param bool $is_anonymous
3594
- */
3595
- private function set_anonymous_mode( $is_anonymous = true ) {
3596
- // Store information regarding skip to try and opt-in the user
3597
- // again in the future.
3598
- $this->_storage->is_anonymous = array(
3599
- 'is' => $is_anonymous,
3600
- 'timestamp' => WP_FS__SCRIPT_START_TIME,
3601
- 'version' => $this->get_plugin_version(),
3602
- );
3603
-
3604
- // Update anonymous mode cache.
3605
- $this->_is_anonymous = $is_anonymous;
3606
- }
3607
-
3608
- /**
3609
- * @author Vova Feldman (@svovaf)
3610
- * @since 1.1.3
3611
- */
3612
- private function reset_anonymous_mode() {
3613
- unset( $this->_storage->is_anonymous );
3614
- }
3615
-
3616
- /**
3617
- * Clears the anonymous mode and redirects to the opt-in screen.
3618
- *
3619
- * @author Vova Feldman (@svovaf)
3620
- * @since 1.1.7
3621
- */
3622
- function connect_again() {
3623
- if ( ! $this->is_anonymous() ) {
3624
- return;
3625
- }
3626
-
3627
- $this->reset_anonymous_mode();
3628
-
3629
- if ( fs_redirect( $this->get_activation_url() ) ) {
3630
- exit();
3631
- }
3632
- }
3633
-
3634
- /**
3635
- * Skip account connect, and set anonymous mode.
3636
- *
3637
- * @author Vova Feldman (@svovaf)
3638
- * @since 1.1.1
3639
- */
3640
- private function skip_connection() {
3641
- $this->_logger->entrance();
3642
-
3643
- $this->_admin_notices->remove_sticky( 'connect_account' );
3644
-
3645
- $this->set_anonymous_mode();
3646
-
3647
- // Send anonymous skip event.
3648
- // No user identified info nor any tracking will be sent after the user skips the opt-in.
3649
- $this->get_api_plugin_scope()->call( 'skip.json', 'put', array(
3650
- 'uid' => $this->get_anonymous_id(),
3651
- ) );
3652
- }
3653
-
3654
- /**
3655
- * Plugin version update hook.
3656
- *
3657
- * @author Vova Feldman (@svovaf)
3658
- * @since 1.0.4
3659
- */
3660
- private function update_plugin_version_event() {
3661
- $this->_logger->entrance();
3662
-
3663
- if ( ! $this->is_registered() ) {
3664
- return;
3665
- }
3666
-
3667
- $this->schedule_install_sync();
3668
- // $this->sync_install( array(), true );
3669
- }
3670
-
3671
- /**
3672
- * Return a list of modified plugins since the last sync.
3673
- *
3674
- * Note:
3675
- * There's no point to store a plugins counter since even if the number of
3676
- * plugins didn't change, we still need to check if the versions are all the
3677
- * same and the activity state is similar.
3678
- *
3679
- * @author Vova Feldman (@svovaf)
3680
- * @since 1.1.8
3681
- *
3682
- * @return array|false
3683
- */
3684
- private function get_plugins_data_for_api() {
3685
- // Alias.
3686
- $option_name = 'all_plugins';
3687
-
3688
- $all_cached_plugins = self::$_accounts->get_option( $option_name );
3689
-
3690
- if ( ! is_object( $all_cached_plugins ) ) {
3691
- $all_cached_plugins = (object) array(
3692
- 'timestamp' => '',
3693
- 'md5' => '',
3694
- 'plugins' => array(),
3695
- );
3696
- }
3697
-
3698
- $time = time();
3699
-
3700
- if ( ! empty( $all_cached_plugins->timestamp ) &&
3701
- ( $time - $all_cached_plugins->timestamp ) < WP_FS__TIME_5_MIN_IN_SEC
3702
- ) {
3703
- // Don't send plugin updates if last update was in the past 5 min.
3704
- return false;
3705
- }
3706
-
3707
- // Write timestamp to lock the logic.
3708
- $all_cached_plugins->timestamp = $time;
3709
- self::$_accounts->set_option( $option_name, $all_cached_plugins, true );
3710
-
3711
- // Reload options from DB.
3712
- self::$_accounts->load( true );
3713
- $all_cached_plugins = self::$_accounts->get_option( $option_name );
3714
-
3715
- if ( $time != $all_cached_plugins->timestamp ) {
3716
- // If timestamp is different, then another thread captured the lock.
3717
- return false;
3718
- }
3719
-
3720
- // Check if there's a change in plugins.
3721
- $all_plugins = self::get_all_plugins();
3722
-
3723
- // Check if plugins changed.
3724
- ksort( $all_plugins );
3725
-
3726
- $plugins_signature = '';
3727
- foreach ( $all_plugins as $basename => $data ) {
3728
- $plugins_signature .= $data['slug'] . ',' .
3729
- $data['Version'] . ',' .
3730
- ( $data['is_active'] ? '1' : '0' ) . ';';
3731
- }
3732
-
3733
- // Check if plugins status changed (version or active/inactive).
3734
- $plugins_changed = ( $all_cached_plugins->md5 !== md5( $plugins_signature ) );
3735
-
3736
- $plugins_update_data = array();
3737
-
3738
- if ( $plugins_changed ) {
3739
- // Change in plugins, report changes.
3740
-
3741
- // Update existing plugins info.
3742
- foreach ( $all_cached_plugins->plugins as $basename => $data ) {
3743
- if ( ! isset( $all_plugins[ $basename ] ) ) {
3744
- // Plugin uninstalled.
3745
- $uninstalled_plugin_data = $data;
3746
- $uninstalled_plugin_data['is_active'] = false;
3747
- $uninstalled_plugin_data['is_uninstalled'] = true;
3748
- $plugins_update_data[] = $uninstalled_plugin_data;
3749
-
3750
- unset( $all_plugins[ $basename ] );
3751
- unset( $all_cached_plugins->plugins[ $basename ] );
3752
- } else if ( $data['is_active'] !== $all_plugins[ $basename ]['is_active'] ||
3753
- $data['version'] !== $all_plugins[ $basename ]['Version']
3754
- ) {
3755
- // Plugin activated or deactivated, or version changed.
3756
- $all_cached_plugins->plugins[ $basename ]['is_active'] = $all_plugins[ $basename ]['is_active'];
3757
- $all_cached_plugins->plugins[ $basename ]['version'] = $all_plugins[ $basename ]['Version'];
3758
-
3759
- $plugins_update_data[] = $all_cached_plugins->plugins[ $basename ];
3760
- }
3761
- }
3762
-
3763
- // Find new plugins that weren't yet seen before.
3764
- foreach ( $all_plugins as $basename => $data ) {
3765
- if ( ! isset( $all_cached_plugins->plugins[ $basename ] ) ) {
3766
- // New plugin.
3767
- $new_plugin = array(
3768
- 'slug' => $data['slug'],
3769
- 'version' => $data['Version'],
3770
- 'title' => $data['Name'],
3771
- 'is_active' => $data['is_active'],
3772
- 'is_uninstalled' => false,
3773
- );
3774
-
3775
- $plugins_update_data[] = $new_plugin;
3776
- $all_cached_plugins->plugins[ $basename ] = $new_plugin;
3777
- }
3778
- }
3779
-
3780
- $all_cached_plugins->md5 = md5( $plugins_signature );
3781
- $all_cached_plugins->timestamp = $time;
3782
- self::$_accounts->set_option( $option_name, $all_cached_plugins, true );
3783
- }
3784
-
3785
- return $plugins_update_data;
3786
- }
3787
-
3788
- /**
3789
- * Return a list of modified themes since the last sync.
3790
- *
3791
- * Note:
3792
- * There's no point to store a themes counter since even if the number of
3793
- * themes didn't change, we still need to check if the versions are all the
3794
- * same and the activity state is similar.
3795
- *
3796
- * @author Vova Feldman (@svovaf)
3797
- * @since 1.1.8
3798
- *
3799
- * @return array|false
3800
- */
3801
- private function get_themes_data_for_api() {
3802
- // Alias.
3803
- $option_name = 'all_themes';
3804
-
3805
- $all_cached_themes = self::$_accounts->get_option( $option_name );
3806
-
3807
- if ( ! is_object( $all_cached_themes ) ) {
3808
- $all_cached_themes = (object) array(
3809
- 'timestamp' => '',
3810
- 'md5' => '',
3811
- 'themes' => array(),
3812
- );
3813
- }
3814
-
3815
- $time = time();
3816
-
3817
- if ( ! empty( $all_cached_themes->timestamp ) &&
3818
- ( $time - $all_cached_themes->timestamp ) < WP_FS__TIME_5_MIN_IN_SEC
3819
- ) {
3820
- // Don't send theme updates if last update was in the past 5 min.
3821
- return false;
3822
- }
3823
-
3824
- // Write timestamp to lock the logic.
3825
- $all_cached_themes->timestamp = $time;
3826
- self::$_accounts->set_option( $option_name, $all_cached_themes, true );
3827
-
3828
- // Reload options from DB.
3829
- self::$_accounts->load( true );
3830
- $all_cached_themes = self::$_accounts->get_option( $option_name );
3831
-
3832
- if ( $time != $all_cached_themes->timestamp ) {
3833
- // If timestamp is different, then another thread captured the lock.
3834
- return false;
3835
- }
3836
-
3837
- // Get active theme.
3838
- $active_theme = wp_get_theme();
3839
-
3840
- // Check if there's a change in themes.
3841
- $all_themes = wp_get_themes();
3842
-
3843
- // Check if themes changed.
3844
- ksort( $all_themes );
3845
-
3846
- $themes_signature = '';
3847
- foreach ( $all_themes as $slug => $data ) {
3848
- $is_active = ( $slug === $active_theme->stylesheet );
3849
- $themes_signature .= $slug . ',' .
3850
- $data->version . ',' .
3851
- ( $is_active ? '1' : '0' ) . ';';
3852
- }
3853
-
3854
- // Check if themes status changed (version or active/inactive).
3855
- $themes_changed = ( $all_cached_themes->md5 !== md5( $themes_signature ) );
3856
-
3857
- $themes_update_data = array();
3858
-
3859
- if ( $themes_changed ) {
3860
- // Change in themes, report changes.
3861
-
3862
- // Update existing themes info.
3863
- foreach ( $all_cached_themes->themes as $slug => $data ) {
3864
- $is_active = ( $slug === $active_theme->stylesheet );
3865
-
3866
- if ( ! isset( $all_themes[ $slug ] ) ) {
3867
- // Plugin uninstalled.
3868
- $uninstalled_theme_data = $data;
3869
- $uninstalled_theme_data['is_active'] = false;
3870
- $uninstalled_theme_data['is_uninstalled'] = true;
3871
- $themes_update_data[] = $uninstalled_theme_data;
3872
-
3873
- unset( $all_themes[ $slug ] );
3874
- unset( $all_cached_themes->themes[ $slug ] );
3875
- } else if ( $data['is_active'] !== $is_active ||
3876
- $data['version'] !== $all_themes[ $slug ]->version
3877
- ) {
3878
- // Plugin activated or deactivated, or version changed.
3879
-
3880
- $all_cached_themes->themes[ $slug ]['is_active'] = $is_active;
3881
- $all_cached_themes->themes[ $slug ]['version'] = $all_themes[ $slug ]->version;
3882
-
3883
- $themes_update_data[] = $all_cached_themes->themes[ $slug ];
3884
- }
3885
- }
3886
-
3887
- // Find new themes that weren't yet seen before.
3888
- foreach ( $all_themes as $slug => $data ) {
3889
- if ( ! isset( $all_cached_themes->themes[ $slug ] ) ) {
3890
- $is_active = ( $slug === $active_theme->stylesheet );
3891
-
3892
- // New plugin.
3893
- $new_plugin = array(
3894
- 'slug' => $slug,
3895
- 'version' => $data->version,
3896
- 'title' => $data->name,
3897
- 'is_active' => $is_active,
3898
- 'is_uninstalled' => false,
3899
- );
3900
-
3901
- $themes_update_data[] = $new_plugin;
3902
- $all_cached_themes->themes[ $slug ] = $new_plugin;
3903
- }
3904
- }
3905
-
3906
- $all_cached_themes->md5 = md5( $themes_signature );
3907
- $all_cached_themes->timestamp = time();
3908
- self::$_accounts->set_option( $option_name, $all_cached_themes, true );
3909
- }
3910
-
3911
- return $themes_update_data;
3912
- }
3913
-
3914
- /**
3915
- * Update install details.
3916
- *
3917
- * @author Vova Feldman (@svovaf)
3918
- * @since 1.1.2
3919
- *
3920
- * @param string[] string $override
3921
- * @param bool $include_plugins Since 1.1.8 by default include plugin changes.
3922
- * @param bool $include_themes Since 1.1.8 by default include plugin changes.
3923
- *
3924
- * @return array
3925
- */
3926
- private function get_install_data_for_api(
3927
- array $override,
3928
- $include_plugins = true,
3929
- $include_themes = true
3930
- ) {
3931
- /**
3932
- * @since 1.1.8 Also send plugin updates.
3933
- */
3934
- if ( $include_plugins && ! isset( $override['plugins'] ) ) {
3935
- $plugins = $this->get_plugins_data_for_api();
3936
- if ( ! empty( $plugins ) ) {
3937
- $override['plugins'] = $plugins;
3938
- }
3939
- }
3940
- /**
3941
- * @since 1.1.8 Also send themes updates.
3942
- */
3943
- if ( $include_themes && ! isset( $override['themes'] ) ) {
3944
- $themes = $this->get_themes_data_for_api();
3945
- if ( ! empty( $themes ) ) {
3946
- $override['themes'] = $themes;
3947
- }
3948
- }
3949
-
3950
- return array_merge( array(
3951
- 'version' => $this->get_plugin_version(),
3952
- 'is_premium' => $this->is_premium(),
3953
- 'language' => get_bloginfo( 'language' ),
3954
- 'charset' => get_bloginfo( 'charset' ),
3955
- 'platform_version' => get_bloginfo( 'version' ),
3956
- 'programming_language_version' => phpversion(),
3957
- 'title' => get_bloginfo( 'name' ),
3958
- 'url' => get_site_url(),
3959
- // Special params.
3960
- 'is_active' => true,
3961
- 'is_uninstalled' => false,
3962
- ), $override );
3963
- }
3964
-
3965
- /**
3966
- * Update install only if changed.
3967
- *
3968
- * @author Vova Feldman (@svovaf)
3969
- * @since 1.0.9
3970
- *
3971
- * @param string[] string $override
3972
- * @param bool $flush
3973
- *
3974
- * @return false|object|string
3975
- */
3976
- private function send_install_update( $override = array(), $flush = false ) {
3977
- $this->_logger->entrance();
3978
-
3979
- $check_properties = $this->get_install_data_for_api( $override );
3980
-
3981
- if ( $flush ) {
3982
- $params = $check_properties;
3983
- } else {
3984
- $params = array();
3985
- $special = array();
3986
- $special_override = false;
3987
-
3988
- foreach ( $check_properties as $p => $v ) {
3989
- if ( property_exists( $this->_site, $p ) ) {
3990
- if ( ! empty( $this->_site->{$p} ) &&
3991
- $this->_site->{$p} != $v
3992
- ) {
3993
- $this->_site->{$p} = $v;
3994
- $params[ $p ] = $v;
3995
- }
3996
- } else {
3997
- $special[ $p ] = $v;
3998
-
3999
- if ( isset( $override[ $p ] ) ||
4000
- 'plugins' === $p ||
4001
- 'themes' === $p
4002
- ) {
4003
- $special_override = true;
4004
- }
4005
- }
4006
- }
4007
-
4008
- if ( $special_override || 0 < count( $params ) ) {
4009
- // Add special params only if has at least one
4010
- // standard param, or if explicitly requested to
4011
- // override a special param or a param which is not exist
4012
- // in the install object.
4013
- $params = array_merge( $params, $special );
4014
- }
4015
- }
4016
-
4017
- if ( 0 < count( $params ) ) {
4018
- // Update last install sync timestamp.
4019
- $this->_storage->install_sync_timestamp = time();
4020
-
4021
- $params['uid'] = $this->get_anonymous_id();
4022
-
4023
- // Send updated values to FS.
4024
- $site = $this->get_api_site_scope()->call( '/', 'put', $params );
4025
-
4026
- if ( ! $this->is_api_error( $site ) ) {
4027
- // I successfully sent install update, clear scheduled sync if exist.
4028
- $this->clear_install_sync_cron();
4029
- }
4030
-
4031
- return $site;
4032
- }
4033
-
4034
- return false;
4035
- }
4036
-
4037
- /**
4038
- * Update install only if changed.
4039
- *
4040
- * @author Vova Feldman (@svovaf)
4041
- * @since 1.0.9
4042
- *
4043
- * @param string[] string $override
4044
- * @param bool $flush
4045
- *
4046
- * @return false|object|string
4047
- */
4048
- private function sync_install( $override = array(), $flush = false ) {
4049
- $this->_logger->entrance();
4050
-
4051
- $site = $this->send_install_update( $override, $flush );
4052
-
4053
- if ( false === $site ) {
4054
- // No sync required.
4055
- return;
4056
- }
4057
-
4058
- if ( $this->is_api_error( $site ) ) {
4059
- // Failed to sync, don't update locally.
4060
- return;
4061
- }
4062
-
4063
- $plan = $this->get_plan();
4064
- $this->_site = new FS_Site( $site );
4065
- $this->_site->plan = $plan;
4066
-
4067
- $this->_store_site( true );
4068
- }
4069
-
4070
- /**
4071
- * Plugin uninstall hook.
4072
- *
4073
- * @author Vova Feldman (@svovaf)
4074
- * @since 1.0.1
4075
- *
4076
- * @param bool $check_user Enforce checking if user have plugins activation privileges.
4077
- */
4078
- function _uninstall_plugin_event( $check_user = true ) {
4079
- $this->_logger->entrance( 'slug = ' . $this->_slug );
4080
-
4081
- if ( $check_user && ! current_user_can( 'activate_plugins' ) ) {
4082
- return;
4083
- }
4084
-
4085
- $params = array();
4086
- if ( isset( $this->_storage->uninstall_reason ) ) {
4087
- $params['reason_id'] = $this->_storage->uninstall_reason->id;
4088
- $params['reason_info'] = $this->_storage->uninstall_reason->info;
4089
- }
4090
-
4091
- if ( ! $this->is_registered() && isset( $this->_storage->uninstall_reason ) ) {
4092
- // Send anonymous uninstall event only if user submitted a feedback.
4093
- $params['uid'] = $this->get_anonymous_id();
4094
- $this->get_api_plugin_scope()->call( 'uninstall.json', 'put', $params );
4095
- } else {
4096
- // Send uninstall event.
4097
- $this->send_install_update( array_merge( $params, array(
4098
- 'is_active' => false,
4099
- 'is_uninstalled' => true,
4100
- ) ) );
4101
- }
4102
-
4103
- // @todo Decide if we want to delete plugin information from db.
4104
- }
4105
-
4106
- /**
4107
- * @author Vova Feldman (@svovaf)
4108
- * @since 1.1.1
4109
- *
4110
- * @return string
4111
- */
4112
- private function premium_plugin_basename() {
4113
- return preg_replace( '/\//', '-premium/', $this->_free_plugin_basename, 1 );
4114
- }
4115
-
4116
- /**
4117
- * Uninstall plugin hook. Called only when connected his account with Freemius for active sites tracking.
4118
- *
4119
- * @author Vova Feldman (@svovaf)
4120
- * @since 1.0.2
4121
- */
4122
- public static function _uninstall_plugin_hook() {
4123
- self::_load_required_static();
4124
-
4125
- self::$_static_logger->entrance();
4126
-
4127
- if ( ! current_user_can( 'activate_plugins' ) ) {
4128
- return;
4129
- }
4130
-
4131
- $plugin_file = substr( current_filter(), strlen( 'uninstall_' ) );
4132
-
4133
- self::$_static_logger->info( 'plugin = ' . $plugin_file );
4134
-
4135
- define( 'WP_FS__UNINSTALL_MODE', true );
4136
-
4137
- $fs = self::get_instance_by_file( $plugin_file );
4138
-
4139
- if ( is_object( $fs ) ) {
4140
- self::require_plugin_essentials();
4141
-
4142
- if ( is_plugin_active( $fs->_free_plugin_basename ) ||
4143
- is_plugin_active( $fs->premium_plugin_basename() )
4144
- ) {
4145
- // Deleting Free or Premium plugin version while the other version still installed.
4146
- return;
4147
- }
4148
-
4149
- $fs->_uninstall_plugin_event();
4150
-
4151
- $fs->do_action( 'after_uninstall' );
4152
- }
4153
- }
4154
-
4155
- #region Plugin Information ------------------------------------------------------------------
4156
-
4157
- /**
4158
- * Load WordPress core plugin.php essential module.
4159
- *
4160
- * @author Vova Feldman (@svovaf)
4161
- * @since 1.1.1
4162
- */
4163
- private static function require_plugin_essentials() {
4164
- if ( ! function_exists( 'get_plugins' ) ) {
4165
- require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
4166
- }
4167
- }
4168
-
4169
- /**
4170
- * Load WordPress core pluggable.php module.
4171
- *
4172
- * @author Vova Feldman (@svovaf)
4173
- * @since 1.1.2
4174
- */
4175
- private static function require_pluggable_essentials() {
4176
- if ( ! function_exists( 'wp_get_current_user' ) ) {
4177
- require_once( ABSPATH . 'wp-includes/pluggable.php' );
4178
- }
4179
- }
4180
-
4181
- /**
4182
- * Return plugin data.
4183
- *
4184
- * @author Vova Feldman (@svovaf)
4185
- * @since 1.0.1
4186
- *
4187
- * @return array
4188
- */
4189
- function get_plugin_data() {
4190
- if ( ! isset( $this->_plugin_data ) ) {
4191
- self::require_plugin_essentials();
4192
-
4193
- /**
4194
- * @author Vova Feldman (@svovaf)
4195
- * @since 1.2.0 When using get_plugin_data() do NOT translate plugin data.
4196
- *
4197
- * @link https://github.com/Freemius/wordpress-sdk/issues/77
4198
- */
4199
- $this->_plugin_data = get_plugin_data(
4200
- $this->_plugin_main_file_path,
4201
- false,
4202
- false
4203
- );
4204
- }
4205
-
4206
- return $this->_plugin_data;
4207
- }
4208
-
4209
- /**
4210
- * @author Vova Feldman (@svovaf)
4211
- * @since 1.0.1
4212
- *
4213
- * @return string Plugin slug.
4214
- */
4215
- function get_slug() {
4216
- return $this->_slug;
4217
- }
4218
-
4219
- /**
4220
- * @author Vova Feldman (@svovaf)
4221
- * @since 1.0.1
4222
- *
4223
- * @return number Plugin ID.
4224
- */
4225
- function get_id() {
4226
- return $this->_plugin->id;
4227
- }
4228
-
4229
- /**
4230
- * @author Vova Feldman (@svovaf)
4231
- * @since 1.0.1
4232
- *
4233
- * @return string Plugin public key.
4234
- */
4235
- function get_public_key() {
4236
- return $this->_plugin->public_key;
4237
- }
4238
-
4239
- /**
4240
- * Will be available only on sandbox mode.
4241
- *
4242
- * @author Vova Feldman (@svovaf)
4243
- * @since 1.0.4
4244
- *
4245
- * @return mixed Plugin secret key.
4246
- */
4247
- function get_secret_key() {
4248
- return $this->_plugin->secret_key;
4249
- }
4250
-
4251
- /**
4252
- * @author Vova Feldman (@svovaf)
4253
- * @since 1.1.1
4254
- *
4255
- * @return bool
4256
- */
4257
- function has_secret_key() {
4258
- return ! empty( $this->_plugin->secret_key );
4259
- }
4260
-
4261
- /**
4262
- * @author Vova Feldman (@svovaf)
4263
- * @since 1.0.9
4264
- *
4265
- * @return string
4266
- */
4267
- function get_plugin_name() {
4268
- $this->_logger->entrance();
4269
-
4270
- if ( ! isset( $this->_plugin_name ) ) {
4271
- $plugin_data = $this->get_plugin_data();
4272
-
4273
- // Get name.
4274
- $this->_plugin_name = $plugin_data['Name'];
4275
-
4276
- // Check if plugin name contains [Premium] suffix and remove it.
4277
- $suffix = '[premium]';
4278
- $suffix_len = strlen( $suffix );
4279
-
4280
- if ( strlen( $plugin_data['Name'] ) > $suffix_len &&
4281
- $suffix === substr( strtolower( $plugin_data['Name'] ), - $suffix_len )
4282
- ) {
4283
- $this->_plugin_name = substr( $plugin_data['Name'], 0, - $suffix_len );
4284
- }
4285
-
4286
- $this->_logger->departure( 'Name = ' . $this->_plugin_name );
4287
- }
4288
-
4289
- return $this->_plugin_name;
4290
- }
4291
-
4292
- /**
4293
- * @author Vova Feldman (@svovaf)
4294
- * @since 1.0.0
4295
- *
4296
- * @return string
4297
- */
4298
- function get_plugin_version() {
4299
- $this->_logger->entrance();
4300
-
4301
- $plugin_data = $this->get_plugin_data();
4302
-
4303
- $this->_logger->departure( 'Version = ' . $plugin_data['Version'] );
4304
-
4305
- return $this->apply_filters( 'plugin_version', $plugin_data['Version'] );
4306
- }
4307
-
4308
- /**
4309
- * @author Vova Feldman (@svovaf)
4310
- * @since 1.0.4
4311
- *
4312
- * @return string
4313
- */
4314
- function get_plugin_basename() {
4315
- return $this->_plugin_basename;
4316
- }
4317
-
4318
- function get_plugin_folder_name() {
4319
- $this->_logger->entrance();
4320
-
4321
- $plugin_folder = $this->_plugin_basename;
4322
-
4323
- while ( '.' !== dirname( $plugin_folder ) ) {
4324
- $plugin_folder = dirname( $plugin_folder );
4325
- }
4326
-
4327
- $this->_logger->departure( 'Folder Name = ' . $plugin_folder );
4328
-
4329
- return $plugin_folder;
4330
- }
4331
-
4332
- #endregion ------------------------------------------------------------------
4333
-
4334
- /* Account
4335
- ------------------------------------------------------------------------------------------------------------------*/
4336
-
4337
- /**
4338
- * Find plugin's slug by plugin's basename.
4339
- *
4340
- * @author Vova Feldman (@svovaf)
4341
- * @since 1.0.9
4342
- *
4343
- * @param string $plugin_base_name
4344
- *
4345
- * @return false|string
4346
- */
4347
- private static function find_slug_by_basename( $plugin_base_name ) {
4348
- $file_slug_map = self::$_accounts->get_option( 'file_slug_map', array() );
4349
-
4350
- if ( ! array( $file_slug_map ) || ! isset( $file_slug_map[ $plugin_base_name ] ) ) {
4351
- return false;
4352
- }
4353
-
4354
- return $file_slug_map[ $plugin_base_name ];
4355
- }
4356
-
4357
- /**
4358
- * Store the map between the plugin's basename to the slug.
4359
- *
4360
- * @author Vova Feldman (@svovaf)
4361
- * @since 1.0.9
4362
- */
4363
- private function store_file_slug_map() {
4364
- $file_slug_map = self::$_accounts->get_option( 'file_slug_map', array() );
4365
-
4366
- if ( ! array( $file_slug_map ) ) {
4367
- $file_slug_map = array();
4368
- }
4369
-
4370
- if ( ! isset( $file_slug_map[ $this->_plugin_basename ] ) ||
4371
- $file_slug_map[ $this->_plugin_basename ] !== $this->_slug
4372
- ) {
4373
- $file_slug_map[ $this->_plugin_basename ] = $this->_slug;
4374
- self::$_accounts->set_option( 'file_slug_map', $file_slug_map, true );
4375
- }
4376
- }
4377
-
4378
- /**
4379
- * @return FS_User[]
4380
- */
4381
- static function get_all_users() {
4382
- $users = self::$_accounts->get_option( 'users', array() );
4383
-
4384
- if ( ! is_array( $users ) ) {
4385
- $users = array();
4386
- }
4387
-
4388
- return $users;
4389
- }
4390
-
4391
- /**
4392
- * @return FS_Site[]
4393
- */
4394
- private static function get_all_sites() {
4395
- $sites = self::$_accounts->get_option( 'sites', array() );
4396
-
4397
- if ( ! is_array( $sites ) ) {
4398
- $sites = array();
4399
- }
4400
-
4401
- return $sites;
4402
- }
4403
-
4404
- /**
4405
- * @author Vova Feldman (@svovaf)
4406
- * @since 1.0.6
4407
- *
4408
- * @return FS_Plugin_License[]
4409
- */
4410
- private static function get_all_licenses() {
4411
- $licenses = self::$_accounts->get_option( 'licenses', array() );
4412
-
4413
- if ( ! is_array( $licenses ) ) {
4414
- $licenses = array();
4415
- }
4416
-
4417
- return $licenses;
4418
- }
4419
-
4420
- /**
4421
- * @return FS_Plugin_Plan[]
4422
- */
4423
- private static function get_all_plans() {
4424
- $plans = self::$_accounts->get_option( 'plans', array() );
4425
-
4426
- if ( ! is_array( $plans ) ) {
4427
- $plans = array();
4428
- }
4429
-
4430
- return $plans;
4431
- }
4432
-
4433
- /**
4434
- * @author Vova Feldman (@svovaf)
4435
- * @since 1.0.4
4436
- *
4437
- * @return FS_Plugin_Tag[]
4438
- */
4439
- private static function get_all_updates() {
4440
- $updates = self::$_accounts->get_option( 'updates', array() );
4441
-
4442
- if ( ! is_array( $updates ) ) {
4443
- $updates = array();
4444
- }
4445
-
4446
- return $updates;
4447
- }
4448
-
4449
- /**
4450
- * @author Vova Feldman (@svovaf)
4451
- * @since 1.0.6
4452
- *
4453
- * @return FS_Plugin[]|false
4454
- */
4455
- private static function get_all_addons() {
4456
- $addons = self::$_accounts->get_option( 'addons', array() );
4457
-
4458
- if ( ! is_array( $addons ) ) {
4459
- $addons = array();
4460
- }
4461
-
4462
- return $addons;
4463
- }
4464
-
4465
- /**
4466
- * @author Vova Feldman (@svovaf)
4467
- * @since 1.0.6
4468
- *
4469
- * @return FS_Plugin[]|false
4470
- */
4471
- private static function get_all_account_addons() {
4472
- $addons = self::$_accounts->get_option( 'account_addons', array() );
4473
-
4474
- if ( ! is_array( $addons ) ) {
4475
- $addons = array();
4476
- }
4477
-
4478
- return $addons;
4479
- }
4480
-
4481
- /**
4482
- * Check if user is registered.
4483
- *
4484
- * @author Vova Feldman (@svovaf)
4485
- * @since 1.0.1
4486
- * @return bool
4487
- */
4488
- function is_registered() {
4489
- return is_object( $this->_user );
4490
- }
4491
-
4492
- /**
4493
- * @author Vova Feldman (@svovaf)
4494
- * @since 1.0.4
4495
- *
4496
- * @return FS_Plugin
4497
- */
4498
- function get_plugin() {
4499
- return $this->_plugin;
4500
- }
4501
-
4502
- /**
4503
- * @author Vova Feldman (@svovaf)
4504
- * @since 1.0.3
4505
- *
4506
- * @return FS_User
4507
- */
4508
- function get_user() {
4509
- return $this->_user;
4510
- }
4511
-
4512
- /**
4513
- * @author Vova Feldman (@svovaf)
4514
- * @since 1.0.3
4515
- *
4516
- * @return FS_Site
4517
- */
4518
- function get_site() {
4519
- return $this->_site;
4520
- }
4521
-
4522
- /**
4523
- * Get plugin add-ons.
4524
- *
4525
- * @author Vova Feldman (@svovaf)
4526
- * @since 1.0.6
4527
- *
4528
- * @since 1.1.7.3 If not yet loaded, fetch data from the API.
4529
- *
4530
- * @return FS_Plugin[]|false
4531
- */
4532
- function get_addons() {
4533
- $this->_logger->entrance();
4534
-
4535
- $all_addons = self::get_all_addons();
4536
-
4537
- /**
4538
- * @since 1.1.7.3 If not yet loaded, fetch data from the API.
4539
- */
4540
- if ( ! is_array( $all_addons ) ||
4541
- ! isset( $all_addons[ $this->_plugin->id ] ) ||
4542
- ! is_array( $all_addons[ $this->_plugin->id ] ) ||
4543
- empty( $all_addons[ $this->_plugin->id ] )
4544
- ) {
4545
- if ( $this->_has_addons ) {
4546
- $addons = $this->_sync_addons();
4547
-
4548
- if ( ! empty( $addons ) ) {
4549
- $all_addons = self::get_all_addons();
4550
- }
4551
- }
4552
- }
4553
-
4554
- if ( ! is_array( $all_addons ) ||
4555
- ! isset( $all_addons[ $this->_plugin->id ] ) ||
4556
- ! is_array( $all_addons[ $this->_plugin->id ] ) ||
4557
- empty( $all_addons[ $this->_plugin->id ] )
4558
- ) {
4559
- return false;
4560
- }
4561
-
4562
- return $all_addons[ $this->_plugin->id ];
4563
- }
4564
-
4565
- /**
4566
- * @author Vova Feldman (@svovaf)
4567
- * @since 1.0.6
4568
- *
4569
- * @return FS_Plugin[]|false
4570
- */
4571
- function get_account_addons() {
4572
- $this->_logger->entrance();
4573
-
4574
- $addons = self::get_all_account_addons();
4575
-
4576
- if ( ! is_array( $addons ) ||
4577
- ! isset( $addons[ $this->_plugin->id ] ) ||
4578
- ! is_array( $addons[ $this->_plugin->id ] ) ||
4579
- 0 === count( $addons[ $this->_plugin->id ] )
4580
- ) {
4581
- return false;
4582
- }
4583
-
4584
- return $addons[ $this->_plugin->id ];
4585
- }
4586
-
4587
- /**
4588
- * Check if user has any
4589
- *
4590
- * @author Vova Feldman (@svovaf)
4591
- * @since 1.1.6
4592
- *
4593
- * @return bool
4594
- */
4595
- function has_account_addons() {
4596
- $addons = $this->get_account_addons();
4597
-
4598
- return is_array( $addons ) && ( 0 < count( $addons ) );
4599
- }
4600
-
4601
-
4602
- /**
4603
- * Get add-on by ID (from local data).
4604
- *
4605
- * @author Vova Feldman (@svovaf)
4606
- * @since 1.0.6
4607
- *
4608
- * @param number $id
4609
- *
4610
- * @return FS_Plugin|false
4611
- */
4612
- function get_addon( $id ) {
4613
- $this->_logger->entrance();
4614
-
4615
- $addons = $this->get_addons();
4616
-
4617
- if ( is_array( $addons ) ) {
4618
- foreach ( $addons as $addon ) {
4619
- if ( $id == $addon->id ) {
4620
- return $addon;
4621
- }
4622
- }
4623
- }
4624
-
4625
- return false;
4626
- }
4627
-
4628
- /**
4629
- * Get add-on by slug (from local data).
4630
- *
4631
- * @author Vova Feldman (@svovaf)
4632
- * @since 1.0.6
4633
- *
4634
- * @param string $slug
4635
- *
4636
- * @return FS_Plugin|false
4637
- */
4638
- function get_addon_by_slug( $slug ) {
4639
- $this->_logger->entrance();
4640
-
4641
- $addons = $this->get_addons();
4642
-
4643
- if ( is_array( $addons ) ) {
4644
- foreach ( $addons as $addon ) {
4645
- if ( $slug == $addon->slug ) {
4646
- return $addon;
4647
- }
4648
- }
4649
- }
4650
-
4651
- return false;
4652
- }
4653
-
4654
- #region Plans & Licensing ------------------------------------------------------------------
4655
-
4656
- /**
4657
- * Check if running premium plugin code.
4658
- *
4659
- * @author Vova Feldman (@svovaf)
4660
- * @since 1.0.5
4661
- *
4662
- * @return bool
4663
- */
4664
- function is_premium() {
4665
- return $this->_plugin->is_premium;
4666
- }
4667
-
4668
- /**
4669
- * Get site's plan ID.
4670
- *
4671
- * @author Vova Feldman (@svovaf)
4672
- * @since 1.0.2
4673
- *
4674
- * @return number
4675
- */
4676
- function get_plan_id() {
4677
- return $this->_site->plan->id;
4678
- }
4679
-
4680
- /**
4681
- * Get site's plan title.
4682
- *
4683
- * @author Vova Feldman (@svovaf)
4684
- * @since 1.0.2
4685
- *
4686
- * @return string
4687
- */
4688
- function get_plan_title() {
4689
- return $this->_site->plan->title;
4690
- }
4691
-
4692
- /**
4693
- * @author Vova Feldman (@svovaf)
4694
- * @since 1.0.9
4695
- *
4696
- * @return FS_Plugin_Plan
4697
- */
4698
- function get_plan() {
4699
- return is_object( $this->_site->plan ) ? $this->_site->plan : false;
4700
- }
4701
-
4702
- /**
4703
- * @author Vova Feldman (@svovaf)
4704
- * @since 1.0.3
4705
- *
4706
- * @return bool
4707
- */
4708
- function is_trial() {
4709
- $this->_logger->entrance();
4710
-
4711
- if ( ! $this->is_registered() ) {
4712
- return false;
4713
- }
4714
-
4715
- return $this->_site->is_trial();
4716
- }
4717
-
4718
- /**
4719
- * Check if currently in a trial with payment method (credit card or paypal).
4720
- *
4721
- * @author Vova Feldman (@svovaf)
4722
- * @since 1.1.7
4723
- *
4724
- * @return bool
4725
- */
4726
- function is_paid_trial() {
4727
- $this->_logger->entrance();
4728
-
4729
- if ( ! $this->is_trial() ) {
4730
- return false;
4731
- }
4732
-
4733
- return $this->has_active_license() && ( $this->_site->trial_plan_id == $this->_license->plan_id );
4734
- }
4735
-
4736
- /**
4737
- * Check if trial already utilized.
4738
- *
4739
- * @since 1.0.9
4740
- *
4741
- * @return bool
4742
- */
4743
- function is_trial_utilized() {
4744
- $this->_logger->entrance();
4745
-
4746
- if ( ! $this->is_registered() ) {
4747
- return false;
4748
- }
4749
-
4750
- return $this->_site->is_trial_utilized();
4751
- }
4752
-
4753
- /**
4754
- * Get trial plan information (if in trial).
4755
- *
4756
- * @author Vova Feldman (@svovaf)
4757
- * @since 1.0.9
4758
- *
4759
- * @return bool|FS_Plugin_Plan
4760
- */
4761
- function get_trial_plan() {
4762
- $this->_logger->entrance();
4763
-
4764
- if ( ! $this->is_trial() ) {
4765
- return false;
4766
- }
4767
-
4768
- return $this->_storage->trial_plan;
4769
- }
4770
-
4771
- /**
4772
- * Check if the user has an activated and valid paid license on current plugin's install.
4773
- *
4774
- * @since 1.0.9
4775
- *
4776
- * @return bool
4777
- */
4778
- function is_paying() {
4779
- $this->_logger->entrance();
4780
-
4781
- if ( ! $this->is_registered() ) {
4782
- return false;
4783
- }
4784
-
4785
- if ( ! $this->has_paid_plan() ) {
4786
- return false;
4787
- }
4788
-
4789
- return (
4790
- ! $this->is_trial() &&
4791
- 'free' !== $this->_site->plan->name &&
4792
- $this->has_features_enabled_license()
4793
- );
4794
- }
4795
-
4796
- /**
4797
- * @author Vova Feldman (@svovaf)
4798
- * @since 1.0.4
4799
- *
4800
- * @return bool
4801
- */
4802
- function is_free_plan() {
4803
- if ( ! $this->is_registered() ) {
4804
- return true;
4805
- }
4806
-
4807
- if ( ! $this->has_paid_plan() ) {
4808
- return true;
4809
- }
4810
-
4811
- return (
4812
- 'free' === $this->_site->plan->name ||
4813
- ! $this->has_features_enabled_license()
4814
- );
4815
- }
4816
-
4817
- /**
4818
- * @author Vova Feldman (@svovaf)
4819
- * @since 1.0.5
4820
- *
4821
- * @return bool
4822
- */
4823
- function _has_premium_license() {
4824
- $this->_logger->entrance();
4825
-
4826
- $premium_license = $this->_get_available_premium_license();
4827
-
4828
- return ( false !== $premium_license );
4829
- }
4830
-
4831
- /**
4832
- * Check if user has any licenses associated with the plugin (including expired or blocking).
4833
- *
4834
- * @author Vova Feldman (@svovaf)
4835
- * @since 1.1.7.3
4836
- *
4837
- * @return bool
4838
- */
4839
- private function has_any_license() {
4840
- return is_array( $this->_licenses ) && ( 0 < count( $this->_licenses ) );
4841
- }
4842
-
4843
- /**
4844
- * @author Vova Feldman (@svovaf)
4845
- * @since 1.0.5
4846
- *
4847
- * @return FS_Plugin_License
4848
- */
4849
- function _get_available_premium_license() {
4850
- $this->_logger->entrance();
4851
-
4852
- if ( ! $this->has_paid_plan() ) {
4853
- return false;
4854
- }
4855
-
4856
- if ( is_array( $this->_licenses ) ) {
4857
- foreach ( $this->_licenses as $license ) {
4858
- if ( ! $license->is_utilized() && $license->is_features_enabled() ) {
4859
- return $license;
4860
- }
4861
- }
4862
- }
4863
-
4864
- return false;
4865
- }
4866
-
4867
- /**
4868
- * Sync local plugin plans with remote server.
4869
- *
4870
- * @author Vova Feldman (@svovaf)
4871
- * @since 1.0.5
4872
- *
4873
- * @return FS_Plugin_Plan[]|object
4874
- */
4875
- function _sync_plans() {
4876
- $plans = $this->_fetch_plugin_plans();
4877
- if ( ! $this->is_api_error( $plans ) ) {
4878
- $this->_plans = $plans;
4879
- $this->_store_plans();
4880
- }
4881
-
4882
- $this->do_action( 'after_plans_sync', $plans );
4883
-
4884
- return $this->_plans;
4885
- }
4886
-
4887
- /**
4888
- * @author Vova Feldman (@svovaf)
4889
- * @since 1.0.5
4890
- *
4891
- * @param number $id
4892
- *
4893
- * @return FS_Plugin_Plan
4894
- */
4895
- function _get_plan_by_id( $id ) {
4896
- $this->_logger->entrance();
4897
-
4898
- if ( ! is_array( $this->_plans ) || 0 === count( $this->_plans ) ) {
4899
- $this->_sync_plans();
4900
- }
4901
-
4902
- foreach ( $this->_plans as $plan ) {
4903
- if ( $id == $plan->id ) {
4904
- return $plan;
4905
- }
4906
- }
4907
-
4908
- return false;
4909
- }
4910
-
4911
- /**
4912
- * @author Vova Feldman (@svovaf)
4913
- * @since 1.1.8.1
4914
- *
4915
- * @param string $name
4916
- *
4917
- * @return FS_Plugin_Plan|false
4918
- */
4919
- private function get_plan_by_name( $name ) {
4920
- $this->_logger->entrance();
4921
-
4922
- if ( ! is_array( $this->_plans ) || 0 === count( $this->_plans ) ) {
4923
- $this->_sync_plans();
4924
- }
4925
-
4926
- foreach ( $this->_plans as $plan ) {
4927
- if ( $name == $plan->name ) {
4928
- return $plan;
4929
- }
4930
- }
4931
-
4932
- return false;
4933
- }
4934
-
4935
- /**
4936
- * Sync local plugin plans with remote server.
4937
- *
4938
- * @author Vova Feldman (@svovaf)
4939
- * @since 1.0.6
4940
- *
4941
- * @param number|bool $site_license_id
4942
- *
4943
- * @return FS_Plugin_License[]|object
4944
- */
4945
- function _sync_licenses( $site_license_id = false ) {
4946
- $licenses = $this->_fetch_licenses( false, $site_license_id );
4947
- if ( ! $this->is_api_error( $licenses ) ) {
4948
- $this->_licenses = $licenses;
4949
- $this->_store_licenses();
4950
- }
4951
-
4952
- // Update current license.
4953
- if ( is_object( $this->_license ) ) {
4954
- $this->_license = $this->_get_license_by_id( $this->_license->id );
4955
- }
4956
-
4957
- return $this->_licenses;
4958
- }
4959
-
4960
- /**
4961
- * @author Vova Feldman (@svovaf)
4962
- * @since 1.0.5
4963
- *
4964
- * @param number $id
4965
- *
4966
- * @return FS_Plugin_License
4967
- */
4968
- function _get_license_by_id( $id ) {
4969
- $this->_logger->entrance();
4970
-
4971
- if ( ! is_numeric( $id ) ) {
4972
- return false;
4973
- }
4974
-
4975
- if ( ! $this->has_any_license() ) {
4976
- $this->_sync_licenses();
4977
- }
4978
-
4979
- foreach ( $this->_licenses as $license ) {
4980
- if ( $id == $license->id ) {
4981
- return $license;
4982
- }
4983
- }
4984
-
4985
- return false;
4986
- }
4987
-
4988
- /**
4989
- * Sync site's license with user licenses.
4990
- *
4991
- * @author Vova Feldman (@svovaf)
4992
- * @since 1.0.6
4993
- *
4994
- * @param FS_Plugin_License|null $new_license
4995
- */
4996
- function _update_site_license( $new_license ) {
4997
- $this->_logger->entrance();
4998
-
4999
- $this->_license = $new_license;
5000
-
5001
- if ( ! is_object( $new_license ) ) {
5002
- $this->_site->license_id = null;
5003
- $this->_sync_site_subscription( null );
5004
-
5005
- return;
5006
- }
5007
-
5008
- $this->_site->license_id = $this->_license->id;
5009
-
5010
- if ( ! is_array( $this->_licenses ) ) {
5011
- $this->_licenses = array();
5012
- }
5013
-
5014
- $is_license_found = false;
5015
- for ( $i = 0, $len = count( $this->_licenses ); $i < $len; $i ++ ) {
5016
- if ( $new_license->id == $this->_licenses[ $i ]->id ) {
5017
- $this->_licenses[ $i ] = $new_license;
5018
-
5019
- $is_license_found = true;
5020
- break;
5021
- }
5022
- }
5023
-
5024
- // If new license just append.
5025
- if ( ! $is_license_found ) {
5026
- $this->_licenses[] = $new_license;
5027
- }
5028
-
5029
- $this->_sync_site_subscription( $new_license );
5030
- }
5031
-
5032
- /**
5033
- * Sync site's subscription.
5034
- *
5035
- * @author Vova Feldman (@svovaf)
5036
- * @since 1.0.9
5037
- *
5038
- * @param FS_Plugin_License|null $license
5039
- *
5040
- * @return bool|\FS_Subscription
5041
- */
5042
- private function _sync_site_subscription( $license ) {
5043
- if ( ! is_object( $license ) ) {
5044
- unset( $this->_storage->subscription );
5045
-
5046
- return false;
5047
- }
5048
-
5049
- // Load subscription details if not lifetime.
5050
- $subscription = $license->is_lifetime() ?
5051
- false :
5052
- $this->_fetch_site_license_subscription();
5053
-
5054
- if ( is_object( $subscription ) && ! isset( $subscription->error ) ) {
5055
- $this->_storage->subscription = $subscription;
5056
- } else {
5057
- unset( $this->_storage->subscription );
5058
- }
5059
-
5060
- return $subscription;
5061
- }
5062
-
5063
- /**
5064
- * @author Vova Feldman (@svovaf)
5065
- * @since 1.0.6
5066
- *
5067
- * @return bool|\FS_Plugin_License
5068
- */
5069
- function _get_license() {
5070
- return $this->_license;
5071
- }
5072
-
5073
- /**
5074
- * @return bool|\FS_Subscription
5075
- */
5076
- function _get_subscription() {
5077
- return isset( $this->_storage->subscription ) ?
5078
- $this->_storage->subscription :
5079
- false;
5080
- }
5081
-
5082
- /**
5083
- * @author Vova Feldman (@svovaf)
5084
- * @since 1.0.2
5085
- *
5086
- * @param string $plan Plan name
5087
- * @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
5088
- *
5089
- * @return bool
5090
- */
5091
- function is_plan( $plan, $exact = false ) {
5092
- $this->_logger->entrance();
5093
-
5094
- if ( ! $this->is_registered() ) {
5095
- return false;
5096
- }
5097
-
5098
- $plan = strtolower( $plan );
5099
-
5100
- if ( $this->_site->plan->name === $plan ) // Exact plan.
5101
- {
5102
- return true;
5103
- } else if ( $exact ) // Required exact, but plans are different.
5104
- {
5105
- return false;
5106
- }
5107
-
5108
- $current_plan_order = - 1;
5109
- $required_plan_order = - 1;
5110
- for ( $i = 0, $len = count( $this->_plans ); $i < $len; $i ++ ) {
5111
- if ( $plan === $this->_plans[ $i ]->name ) {
5112
- $required_plan_order = $i;
5113
- } else if ( $this->_site->plan->name === $this->_plans[ $i ]->name ) {
5114
- $current_plan_order = $i;
5115
- }
5116
- }
5117
-
5118
- return ( $current_plan_order > $required_plan_order );
5119
- }
5120
-
5121
- /**
5122
- * Check if plan based on trial. If not in trial mode, should return false.
5123
- *
5124
- * @since 1.0.9
5125
- *
5126
- * @param string $plan Plan name
5127
- * @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
5128
- *
5129
- * @return bool
5130
- */
5131
- function is_trial_plan( $plan, $exact = false ) {
5132
- $this->_logger->entrance();
5133
-
5134
- if ( ! $this->is_registered() ) {
5135
- return false;
5136
- }
5137
-
5138
- if ( ! $this->is_trial() ) {
5139
- return false;
5140
- }
5141
-
5142
- if ( ! isset( $this->_storage->trial_plan ) ) {
5143
- // Store trial plan information.
5144
- $this->_enrich_site_trial_plan( true );
5145
- }
5146
-
5147
- if ( $this->_storage->trial_plan->name === $plan ) // Exact plan.
5148
- {
5149
- return true;
5150
- } else if ( $exact ) // Required exact, but plans are different.
5151
- {
5152
- return false;
5153
- }
5154
-
5155
- $current_plan_order = - 1;
5156
- $required_plan_order = - 1;
5157
- for ( $i = 0, $len = count( $this->_plans ); $i < $len; $i ++ ) {
5158
- if ( $plan === $this->_plans[ $i ]->name ) {
5159
- $required_plan_order = $i;
5160
- } else if ( $this->_storage->trial_plan->name === $this->_plans[ $i ]->name ) {
5161
- $current_plan_order = $i;
5162
- }
5163
- }
5164
-
5165
- return ( $current_plan_order > $required_plan_order );
5166
- }
5167
-
5168
- /**
5169
- * Check if plugin has any paid plans.
5170
- *
5171
- * @author Vova Feldman (@svovaf)
5172
- * @since 1.0.7
5173
- *
5174
- * @return bool
5175
- */
5176
- function has_paid_plan() {
5177
- return $this->_has_paid_plans || FS_Plan_Manager::instance()->has_paid_plan( $this->_plans );
5178
- }
5179
-
5180
- /**
5181
- * Check if plugin has any plan with a trail.
5182
- *
5183
- * @author Vova Feldman (@svovaf)
5184
- * @since 1.0.9
5185
- *
5186
- * @return bool
5187
- */
5188
- function has_trial_plan() {
5189
- if ( ! $this->is_registered() ) {
5190
- return false;
5191
- }
5192
-
5193
- return $this->_storage->get( 'has_trial_plan', false );
5194
- }
5195
-
5196
- /**
5197
- * Check if plugin has any free plan, or is it premium only.
5198
- *
5199
- * Note: If no plans configured, assume plugin is free.
5200
- *
5201
- * @author Vova Feldman (@svovaf)
5202
- * @since 1.0.7
5203
- *
5204
- * @return bool
5205
- */
5206
- function has_free_plan() {
5207
- return ! $this->is_only_premium() && FS_Plan_Manager::instance()->has_free_plan( $this->_plans );
5208
- }
5209
-
5210
- /**
5211
- * Displays a license activation dialog box when the user clicks on the "Activate License"
5212
- * or "Change License" link on the plugins
5213
- * page.
5214
- *
5215
- * @author Leo Fajardo (@leorw)
5216
- * @since 1.1.9
5217
- */
5218
- function _add_license_activation_dialog_box() {
5219
- if ( $this->is_addon() ) {
5220
- $sync_license_url = $this->get_parent_instance()->_get_sync_license_url( $this->_plugin->id, true );
5221
- } else {
5222
- $sync_license_url = $this->_get_sync_license_url( $this->_plugin->id, true );
5223
- }
5224
-
5225
- $vars = array(
5226
- 'slug' => $this->_slug,
5227
- // Avoid having HTML entity like "&amp;" in the URL which breaks the redirection to the "Account" page.
5228
- 'sync-license-url' => html_entity_decode( $sync_license_url )
5229
- );
5230
-
5231
- fs_require_template( 'forms/license-activation.php', $vars );
5232
- fs_require_template( 'forms/resend-key.php', $vars );
5233
- }
5234
-
5235
- /**
5236
- * Prepare page to include all required UI and logic for the license activation dialog.
5237
- *
5238
- * @author Vova Feldman (@svovaf)
5239
- * @since 1.2.0
5240
- */
5241
- function _require_license_activation_dialog() {
5242
- if ( $this->is_ajax() ) {
5243
- if ( fs_request_is_action( 'activate_license' ) ) {
5244
- // Add license activation AJAX callback.
5245
- add_action( 'wp_ajax_activate_license', array( &$this, '_activate_license_ajax_action' ) );
5246
- }
5247
-
5248
- if ( fs_request_is_action( 'resend_license_key' ) ) {
5249
- // Add resend license AJAX callback.
5250
- add_action( 'wp_ajax_resend_license_key', array(
5251
- &$this,
5252
- '_resend_license_key_ajax_action'
5253
- ) );
5254
- }
5255
- } else {
5256
- // Inject license activation dialog UI and client side code.
5257
- add_action( 'admin_footer', array( &$this, '_add_license_activation_dialog_box' ) );
5258
- }
5259
- }
5260
-
5261
- /**
5262
- * @author Leo Fajardo (@leorw)
5263
- * @since 1.1.9
5264
- */
5265
- function _activate_license_ajax_action() {
5266
- $license_key = trim( fs_request_get('license_key') );
5267
-
5268
- if ( empty( $license_key ) ) {
5269
- exit;
5270
- }
5271
-
5272
- $slug = $_POST['slug'];
5273
- $fs = ( ( $slug === $this->_slug ) ? $this : self::instance( $slug ) );
5274
- $error = false;
5275
-
5276
- if ( $this->is_registered() ) {
5277
- $api = $fs->get_api_site_scope();
5278
- $install = $api->call( '/', 'put',
5279
- array(
5280
- 'license_key' => $license_key
5281
- )
5282
- );
5283
-
5284
- if ( isset( $install->error ) ) {
5285
- $error = $install->error->message;
5286
- }
5287
- } else {
5288
- $this->opt_in( false, false, false, $license_key );
5289
- }
5290
-
5291
- $result = array(
5292
- 'success' => ( false === $error )
5293
- );
5294
-
5295
- if ( false !== $error ) {
5296
- $result['error'] = $error;
5297
- }
5298
-
5299
- echo json_encode( $result );
5300
-
5301
- exit;
5302
- }
5303
-
5304
- /**
5305
- * @author Leo Fajardo (@leorw)
5306
- * @since 1.2.0
5307
- */
5308
- function _resend_license_key_ajax_action() {
5309
- if ( ! isset( $_POST['email'] ) ) {
5310
- exit;
5311
- }
5312
-
5313
- $email_address = trim( $_POST['email'] );
5314
- if ( empty( $email_address ) ) {
5315
- exit;
5316
- }
5317
-
5318
- $error = false;
5319
-
5320
- $api = $this->get_api_plugin_scope();
5321
- $result = $api->call( '/licenses/resend.json', 'post',
5322
- array(
5323
- 'email' => $email_address,
5324
- 'is_localhost' => WP_FS__IS_LOCALHOST
5325
- )
5326
- );
5327
-
5328
- if ( is_object( $result ) && isset( $result->error ) ) {
5329
- $error = $result->error;
5330
-
5331
- if ( in_array( $error->code, array( 'invalid_email', 'no_user' ) ) ) {
5332
- $error = __fs( 'email-not-found' );
5333
- } else if ( 'no_license' === $error->code ) {
5334
- $error = __fs( 'no-active-licenses' );
5335
- } else {
5336
- $error = $error->message;
5337
- }
5338
- }
5339
-
5340
- $licenses = array(
5341
- 'success' => ( false === $error )
5342
- );
5343
-
5344
- if ( false !== $error ) {
5345
- $licenses['error'] = sprintf( '%s... %s', __fs( 'oops', $this->_slug ), strtolower( $error ) );
5346
- }
5347
-
5348
- echo json_encode( $licenses );
5349
-
5350
- exit;
5351
- }
5352
-
5353
- #region URL Generators
5354
-
5355
- /**
5356
- * Alias to pricing_url().
5357
- *
5358
- * @author Vova Feldman (@svovaf)
5359
- * @since 1.0.2
5360
- *
5361
- * @uses pricing_url()
5362
- *
5363
- * @param string $period Billing cycle
5364
- * @param bool $is_trial
5365
- *
5366
- * @return string
5367
- */
5368
- function get_upgrade_url( $period = WP_FS__PERIOD_ANNUALLY, $is_trial = false ) {
5369
- return $this->pricing_url( $period, $is_trial );
5370
- }
5371
-
5372
- /**
5373
- * @author Vova Feldman (@svovaf)
5374
- * @since 1.0.9
5375
- *
5376
- * @uses get_upgrade_url()
5377
- *
5378
- * @return string
5379
- */
5380
- function get_trial_url() {
5381
- return $this->get_upgrade_url( WP_FS__PERIOD_ANNUALLY, true );
5382
- }
5383
-
5384
- /**
5385
- * Plugin's pricing URL.
5386
- *
5387
- * @author Vova Feldman (@svovaf)
5388
- * @since 1.0.4
5389
- *
5390
- * @param string $billing_cycle Billing cycle
5391
- *
5392
- * @param bool $is_trial
5393
- *
5394
- * @return string
5395
- */
5396
- function pricing_url( $billing_cycle = WP_FS__PERIOD_ANNUALLY, $is_trial = false ) {
5397
- $this->_logger->entrance();
5398
-
5399
- $params = array(
5400
- 'billing_cycle' => $billing_cycle
5401
- );
5402
-
5403
- if ( $is_trial ) {
5404
- $params['trial'] = 'true';
5405
- }
5406
-
5407
- return $this->_get_admin_page_url( 'pricing', $params );
5408
- }
5409
-
5410
- /**
5411
- * Checkout page URL.
5412
- *
5413
- * @author Vova Feldman (@svovaf)
5414
- * @since 1.0.6
5415
- *
5416
- * @param string $billing_cycle Billing cycle
5417
- * @param bool $is_trial
5418
- * @param array $extra (optional) Extra parameters, override other query params.
5419
- *
5420
- * @return string
5421
- */
5422
- function checkout_url(
5423
- $billing_cycle = WP_FS__PERIOD_ANNUALLY,
5424
- $is_trial = false,
5425
- $extra = array()
5426
- ) {
5427
- $this->_logger->entrance();
5428
-
5429
- $params = array(
5430
- 'checkout' => 'true',
5431
- 'billing_cycle' => $billing_cycle,
5432
- );
5433
-
5434
- if ( $is_trial ) {
5435
- $params['trial'] = 'true';
5436
- }
5437
-
5438
- /**
5439
- * Params in extra override other params.
5440
- */
5441
- $params = array_merge( $params, $extra );
5442
-
5443
- return $this->_get_admin_page_url( 'pricing', $params );
5444
- }
5445
-
5446
- /**
5447
- * Add-on checkout URL.
5448
- *
5449
- * @author Vova Feldman (@svovaf)
5450
- * @since 1.1.7
5451
- *
5452
- * @param number $addon_id
5453
- * @param number $pricing_id
5454
- * @param string $billing_cycle
5455
- * @param bool $is_trial
5456
- *
5457
- * @return string
5458
- */
5459
- function addon_checkout_url(
5460
- $addon_id,
5461
- $pricing_id,
5462
- $billing_cycle = WP_FS__PERIOD_ANNUALLY,
5463
- $is_trial = false
5464
- ) {
5465
- return $this->checkout_url( $billing_cycle, $is_trial, array(
5466
- 'plugin_id' => $addon_id,
5467
- 'pricing_id' => $pricing_id,
5468
- ) );
5469
- }
5470
-
5471
- #endregion
5472
-
5473
- #endregion ------------------------------------------------------------------
5474
-
5475
- /**
5476
- * Check if plugin has any add-ons.
5477
- *
5478
- * @author Vova Feldman (@svovaf)
5479
- * @since 1.0.5
5480
- *
5481
- * @since 1.1.7.3 Base logic only on the parameter provided by the developer in the init function.
5482
- *
5483
- * @return bool
5484
- */
5485
- function has_addons() {
5486
- $this->_logger->entrance();
5487
-
5488
- return $this->_has_addons;
5489
- }
5490
-
5491
- /**
5492
- * Check if plugin can work in anonymous mode.
5493
- *
5494
- * @author Vova Feldman (@svovaf)
5495
- * @since 1.0.9
5496
- *
5497
- * @return bool
5498
- *
5499
- * @deprecated Please use is_enable_anonymous() instead
5500
- */
5501
- function enable_anonymous() {
5502
- return $this->_enable_anonymous;
5503
- }
5504
-
5505
- /**
5506
- * Check if plugin can work in anonymous mode.
5507
- *
5508
- * @author Vova Feldman (@svovaf)
5509
- * @since 1.1.9
5510
- *
5511
- * @return bool
5512
- */
5513
- function is_enable_anonymous() {
5514
- return $this->_enable_anonymous;
5515
- }
5516
-
5517
- /**
5518
- * Check if plugin is premium only (no free plans).
5519
- *
5520
- * @author Vova Feldman (@svovaf)
5521
- * @since 1.1.9
5522
- *
5523
- * @return bool
5524
- */
5525
- function is_only_premium() {
5526
- return $this->_is_premium_only;
5527
- }
5528
-
5529
- /**
5530
- * Check if feature supported with current site's plan.
5531
- *
5532
- * @author Vova Feldman (@svovaf)
5533
- * @since 1.0.1
5534
- *
5535
- * @todo IMPLEMENT
5536
- *
5537
- * @param number $feature_id
5538
- *
5539
- * @throws Exception
5540
- */
5541
- function is_feature_supported( $feature_id ) {
5542
- throw new Exception( 'not implemented' );
5543
- }
5544
-
5545
- /**
5546
- * @author Vova Feldman (@svovaf)
5547
- * @since 1.0.1
5548
- *
5549
- * @return bool Is running in SSL/HTTPS
5550
- */
5551
- function is_ssl() {
5552
- return WP_FS__IS_HTTPS;
5553
- }
5554
-
5555
- /**
5556
- * @author Vova Feldman (@svovaf)
5557
- * @since 1.0.9
5558
- *
5559
- * @return bool Is running in AJAX call.
5560
- *
5561
- * @link http://wordpress.stackexchange.com/questions/70676/how-to-check-if-i-am-in-admin-ajax
5562
- */
5563
- function is_ajax() {
5564
- return ( defined( 'DOING_AJAX' ) && DOING_AJAX );
5565
- }
5566
-
5567
- /**
5568
- * Check if it's an AJAX call targeted for the current module.
5569
- *
5570
- * @author Vova Feldman (@svovaf)
5571
- * @since 1.2.0
5572
- *
5573
- * @param array|string $actions Collection of AJAX actions.
5574
- *
5575
- * @return bool
5576
- */
5577
- function is_ajax_action( $actions ) {
5578
- // Verify it's an ajax call.
5579
- if ( ! $this->is_ajax() ) {
5580
- return false;
5581
- }
5582
-
5583
- // Verify the call is relevant for the plugin.
5584
- if ( $this->_slug !== fs_request_get( 'slug' ) ) {
5585
- return false;
5586
- }
5587
-
5588
- // Verify it's one of the specified actions.
5589
- if ( is_string( $actions ) ) {
5590
- $actions = explode( ',', $actions );
5591
- }
5592
-
5593
- if ( is_array( $actions ) && 0 < count( $actions ) ) {
5594
- $ajax_action = fs_request_get( 'action' );
5595
-
5596
- foreach ( $actions as $action ) {
5597
- if ( $ajax_action === $action ) {
5598
- return true;
5599
- }
5600
- }
5601
- }
5602
-
5603
- return false;
5604
- }
5605
-
5606
- /**
5607
- * @author Vova Feldman (@svovaf)
5608
- * @since 1.1.7
5609
- *
5610
- * @return bool
5611
- */
5612
- function is_cron() {
5613
- return ( defined( 'DOING_CRON' ) && DOING_CRON );
5614
- }
5615
-
5616
- /**
5617
- * Check if a real user is visiting the admin dashboard.
5618
- *
5619
- * @author Vova Feldman (@svovaf)
5620
- * @since 1.1.7
5621
- *
5622
- * @return bool
5623
- */
5624
- function is_user_in_admin() {
5625
- return is_admin() && ! $this->is_ajax() && ! $this->is_cron();
5626
- }
5627
-
5628
- /**
5629
- * Check if running in HTTPS and if site's plan matching the specified plan.
5630
- *
5631
- * @param string $plan
5632
- * @param bool $exact
5633
- *
5634
- * @return bool
5635
- */
5636
- function is_ssl_and_plan( $plan, $exact = false ) {
5637
- return ( $this->is_ssl() && $this->is_plan( $plan, $exact ) );
5638
- }
5639
-
5640
- /**
5641
- * Construct plugin's settings page URL.
5642
- *
5643
- * @author Vova Feldman (@svovaf)
5644
- * @since 1.0.4
5645
- *
5646
- * @param string $page
5647
- * @param array $params
5648
- *
5649
- * @return string
5650
- */
5651
- function _get_admin_page_url( $page = '', $params = array() ) {
5652
- if ( ! $this->_menu->is_top_level() ) {
5653
- $parent_slug = $this->_menu->get_parent_slug();
5654
- $menu_file = ( false !== strpos( $parent_slug, '.php' ) ) ?
5655
- $parent_slug :
5656
- 'admin.php';
5657
-
5658
- return add_query_arg( array_merge( $params, array(
5659
- 'page' => $this->_menu->get_slug( $page ),
5660
- ) ), admin_url( $menu_file, 'admin' ) );
5661
- }
5662
-
5663
- if ( $this->_menu->is_cpt() ) {
5664
- if ( empty( $page ) && $this->is_activation_mode() ) {
5665
- return add_query_arg( array_merge( $params, array(
5666
- 'page' => $this->_menu->get_slug()
5667
- ) ), admin_url( 'admin.php', 'admin' ) );
5668
- } else {
5669
- if ( ! empty( $page ) ) {
5670
- $params['page'] = $this->_menu->get_slug( $page );
5671
- }
5672
-
5673
- return add_query_arg( $params, admin_url( $this->_menu->get_raw_slug(), 'admin' ) );
5674
- }
5675
- } else {
5676
- return add_query_arg( array_merge( $params, array(
5677
- 'page' => $this->_menu->get_slug( $page ),
5678
- ) ), admin_url( 'admin.php', 'admin' ) );
5679
- }
5680
- }
5681
-
5682
- /**
5683
- * Plugin's account page + sync license URL.
5684
- *
5685
- * @author Vova Feldman (@svovaf)
5686
- * @since 1.1.9.1
5687
- *
5688
- * @param bool|number $plugin_id
5689
- * @param bool $add_action_nonce
5690
- *
5691
- * @return string
5692
- */
5693
- function _get_sync_license_url( $plugin_id = false, $add_action_nonce = true ) {
5694
- $params = array();
5695
-
5696
- if ( is_numeric( $plugin_id ) ) {
5697
- $params['plugin_id'] = $plugin_id;
5698
- }
5699
-
5700
- return $this->get_account_url(
5701
- $this->_slug . '_sync_license',
5702
- $params,
5703
- $add_action_nonce
5704
- );
5705
- }
5706
-
5707
- /**
5708
- * Plugin's account URL.
5709
- *
5710
- * @author Vova Feldman (@svovaf)
5711
- * @since 1.0.4
5712
- *
5713
- * @param bool|string $action
5714
- * @param array $params
5715
- *
5716
- * @param bool $add_action_nonce
5717
- *
5718
- * @return string
5719
- */
5720
- function get_account_url( $action = false, $params = array(), $add_action_nonce = true ) {
5721
- if ( is_string( $action ) ) {
5722
- $params['fs_action'] = $action;
5723
- }
5724
-
5725
- self::require_pluggable_essentials();
5726
-
5727
- return ( $add_action_nonce && is_string( $action ) ) ?
5728
- wp_nonce_url( $this->_get_admin_page_url( 'account', $params ), $action ) :
5729
- $this->_get_admin_page_url( 'account', $params );
5730
- }
5731
-
5732
- /**
5733
- * @author Vova Feldman (@svovaf)
5734
- * @since 1.2.0
5735
- *
5736
- * @param string $tab
5737
- * @param bool $action
5738
- * @param array $params
5739
- * @param bool $add_action_nonce
5740
- *
5741
- * @return string
5742
- *
5743
- * @uses get_account_url()
5744
- */
5745
- function get_account_tab_url( $tab, $action = false, $params = array(), $add_action_nonce = true ) {
5746
- $params['tab'] = $tab;
5747
-
5748
- return $this->get_account_url( $action, $params, $add_action_nonce );
5749
- }
5750
-
5751
- /**
5752
- * Plugin's account URL.
5753
- *
5754
- * @author Vova Feldman (@svovaf)
5755
- * @since 1.0.4
5756
- *
5757
- * @param bool|string $topic
5758
- * @param bool|string $message
5759
- *
5760
- * @return string
5761
- */
5762
- function contact_url( $topic = false, $message = false ) {
5763
- $params = array();
5764
- if ( is_string( $topic ) ) {
5765
- $params['topic'] = $topic;
5766
- }
5767
- if ( is_string( $message ) ) {
5768
- $params['message'] = $message;
5769
- }
5770
-
5771
- if ( $this->is_addon() ) {
5772
- $params['addon_id'] = $this->get_id();
5773
-
5774
- return $this->get_parent_instance()->_get_admin_page_url( 'contact', $params );
5775
- } else {
5776
- return $this->_get_admin_page_url( 'contact', $params );
5777
- }
5778
- }
5779
-
5780
- /**
5781
- * Add-on direct info URL.
5782
- *
5783
- * @author Vova Feldman (@svovaf)
5784
- * @since 1.1.0
5785
- *
5786
- * @param string $slug
5787
- *
5788
- * @return string
5789
- */
5790
- function addon_url( $slug ) {
5791
- return $this->_get_admin_page_url( 'addons', array(
5792
- 'slug' => $slug
5793
- ) );
5794
- }
5795
-
5796
- /* Logger
5797
- ------------------------------------------------------------------------------------------------------------------*/
5798
- /**
5799
- * @param string $id
5800
- * @param bool $prefix_slug
5801
- *
5802
- * @return FS_Logger
5803
- */
5804
- function get_logger( $id = '', $prefix_slug = true ) {
5805
- return FS_Logger::get_logger( ( $prefix_slug ? $this->_slug : '' ) . ( ( ! $prefix_slug || empty( $id ) ) ? '' : '_' ) . $id );
5806
- }
5807
-
5808
- /**
5809
- * @param $id
5810
- * @param bool $load_options
5811
- * @param bool $prefix_slug
5812
- *
5813
- * @return FS_Option_Manager
5814
- */
5815
- function get_options_manager( $id, $load_options = false, $prefix_slug = true ) {
5816
- return FS_Option_Manager::get_manager( ( $prefix_slug ? $this->_slug : '' ) . ( ( ! $prefix_slug || empty( $id ) ) ? '' : '_' ) . $id, $load_options );
5817
- }
5818
-
5819
- /* Security
5820
- ------------------------------------------------------------------------------------------------------------------*/
5821
- private function _encrypt( $str ) {
5822
- if ( is_null( $str ) ) {
5823
- return null;
5824
- }
5825
-
5826
- return base64_encode( $str );
5827
- }
5828
-
5829
- private function _decrypt( $str ) {
5830
- if ( is_null( $str ) ) {
5831
- return null;
5832
- }
5833
-
5834
- return base64_decode( $str );
5835
- }
5836
-
5837
- /**
5838
- * @author Vova Feldman (@svovaf)
5839
- * @since 1.0.5
5840
- *
5841
- * @param FS_Entity $entity
5842
- *
5843
- * @return FS_Entity Return an encrypted clone entity.
5844
- */
5845
- private function _encrypt_entity( FS_Entity $entity ) {
5846
- $clone = clone $entity;
5847
- $props = get_object_vars( $entity );
5848
-
5849
- foreach ( $props as $key => $val ) {
5850
- $clone->{$key} = $this->_encrypt( $val );
5851
- }
5852
-
5853
- return $clone;
5854
- }
5855
-
5856
- /**
5857
- * @author Vova Feldman (@svovaf)
5858
- * @since 1.0.5
5859
- *
5860
- * @param FS_Entity $entity
5861
- *
5862
- * @return FS_Entity Return an decrypted clone entity.
5863
- */
5864
- private function _decrypt_entity( FS_Entity $entity ) {
5865
- $clone = clone $entity;
5866
- $props = get_object_vars( $entity );
5867
-
5868
- foreach ( $props as $key => $val ) {
5869
- $clone->{$key} = $this->_decrypt( $val );
5870
- }
5871
-
5872
- return $clone;
5873
- }
5874
-
5875
- /**
5876
- * Tries to activate account based on POST params.
5877
- *
5878
- * @author Vova Feldman (@svovaf)
5879
- * @since 1.0.2
5880
- */
5881
- function _activate_account() {
5882
- if ( $this->is_registered() ) {
5883
- // Already activated.
5884
- return;
5885
- }
5886
-
5887
- self::_clean_admin_content_section();
5888
-
5889
- if ( fs_request_is_action( 'activate' ) && fs_request_is_post() ) {
5890
- // check_admin_referer( 'activate_' . $this->_plugin->public_key );
5891
-
5892
- // Verify matching plugin details.
5893
- if ( $this->_plugin->id != fs_request_get( 'plugin_id' ) || $this->_slug != fs_request_get( 'plugin_slug' ) ) {
5894
- return;
5895
- }
5896
-
5897
- $user = new FS_User();
5898
- $user->id = fs_request_get( 'user_id' );
5899
- $user->public_key = fs_request_get( 'user_public_key' );
5900
- $user->secret_key = fs_request_get( 'user_secret_key' );
5901
- $user->email = fs_request_get( 'user_email' );
5902
- $user->first = fs_request_get( 'user_first' );
5903
- $user->last = fs_request_get( 'user_last' );
5904
- $user->is_verified = fs_request_get_bool( 'user_is_verified' );
5905
-
5906
- $site = new FS_Site();
5907
- $site->id = fs_request_get( 'install_id' );
5908
- $site->public_key = fs_request_get( 'install_public_key' );
5909
- $site->secret_key = fs_request_get( 'install_secret_key' );
5910
- $site->plan->id = fs_request_get( 'plan_id' );
5911
- $site->plan->title = fs_request_get( 'plan_title' );
5912
- $site->plan->name = fs_request_get( 'plan_name' );
5913
-
5914
- $plans = array();
5915
- $plans_data = json_decode( urldecode( fs_request_get( 'plans' ) ) );
5916
- foreach ( $plans_data as $p ) {
5917
- $plans[] = new FS_Plugin_Plan( $p );
5918
- }
5919
-
5920
- $this->_set_account( $user, $site, $plans );
5921
-
5922
- // Reload the page with the keys.
5923
- if ( fs_redirect( $this->_get_admin_page_url() ) ) {
5924
- exit();
5925
- }
5926
- }
5927
- }
5928
-
5929
- /**
5930
- * @author Vova Feldman (@svovaf)
5931
- * @since 1.0.7
5932
- *
5933
- * @param string $email
5934
- *
5935
- * @return FS_User|bool
5936
- */
5937
- static function _get_user_by_email( $email ) {
5938
- self::$_static_logger->entrance();
5939
-
5940
- $email = trim( strtolower( $email ) );
5941
- $users = self::get_all_users();
5942
- if ( is_array( $users ) ) {
5943
- foreach ( $users as $u ) {
5944
- if ( $email === trim( strtolower( $u->email ) ) ) {
5945
- return $u;
5946
- }
5947
- }
5948
- }
5949
-
5950
- return false;
5951
- }
5952
-
5953
- #region Account (Loading, Updates & Activation) ------------------------------------------------------------------
5954
-
5955
- /***
5956
- * Load account information (user + site).
5957
- *
5958
- * @author Vova Feldman (@svovaf)
5959
- * @since 1.0.1
5960
- */
5961
- private function _load_account() {
5962
- $this->_logger->entrance();
5963
-
5964
- $this->do_action( 'before_account_load' );
5965
-
5966
- $sites = self::get_all_sites();
5967
- $users = self::get_all_users();
5968
- $plans = self::get_all_plans();
5969
- $licenses = self::get_all_licenses();
5970
-
5971
- if ( $this->_logger->is_on() && is_admin() ) {
5972
- $this->_logger->log( 'sites = ' . var_export( $sites, true ) );
5973
- $this->_logger->log( 'users = ' . var_export( $users, true ) );
5974
- $this->_logger->log( 'plans = ' . var_export( $plans, true ) );
5975
- $this->_logger->log( 'licenses = ' . var_export( $licenses, true ) );
5976
- }
5977
-
5978
- $site = isset( $sites[ $this->_slug ] ) ? $sites[ $this->_slug ] : false;
5979
-
5980
- if ( is_object( $site ) &&
5981
- is_numeric( $site->id ) &&
5982
- is_numeric( $site->user_id ) &&
5983
- is_object( $site->plan )
5984
- ) {
5985
- // Load site.
5986
- $this->_site = clone $site;
5987
- $this->_site->plan = $this->_decrypt_entity( $this->_site->plan );
5988
-
5989
- // Load relevant user.
5990
- $this->_user = clone $users[ $this->_site->user_id ];
5991
-
5992
- // Load plans.
5993
- $this->_plans = $plans[ $this->_slug ];
5994
- if ( ! is_array( $this->_plans ) || empty( $this->_plans ) ) {
5995
- $this->_sync_plans( true );
5996
- } else {
5997
- for ( $i = 0, $len = count( $this->_plans ); $i < $len; $i ++ ) {
5998
- if ( $this->_plans[ $i ] instanceof FS_Plugin_Plan ) {
5999
- $this->_plans[ $i ] = $this->_decrypt_entity( $this->_plans[ $i ] );
6000
- } else {
6001
- unset( $this->_plans[ $i ] );
6002
- }
6003
- }
6004
- }
6005
-
6006
- // Load licenses.
6007
- $this->_licenses = array();
6008
- if ( is_array( $licenses ) &&
6009
- isset( $licenses[ $this->_slug ] ) &&
6010
- isset( $licenses[ $this->_slug ][ $this->_user->id ] )
6011
- ) {
6012
- $this->_licenses = $licenses[ $this->_slug ][ $this->_user->id ];
6013
- }
6014
-
6015
- $this->_license = $this->_get_license_by_id( $this->_site->license_id );
6016
-
6017
- if ( $this->_site->version != $this->get_plugin_version() ) {
6018
- // If stored install version is different than current installed plugin version,
6019
- // then update plugin version event.
6020
- $this->update_plugin_version_event();
6021
- }
6022
- }
6023
-
6024
- $this->_register_account_hooks();
6025
- }
6026
-
6027
- /**
6028
- * @author Vova Feldman (@svovaf)
6029
- * @since 1.0.1
6030
- *
6031
- * @param FS_User $user
6032
- * @param FS_Site $site
6033
- * @param bool|array $plans
6034
- */
6035
- private function _set_account( FS_User $user, FS_Site $site, $plans = false ) {
6036
- $site->slug = $this->_slug;
6037
- $site->user_id = $user->id;
6038
-
6039
- $this->_site = $site;
6040
- $this->_user = $user;
6041
- if ( false !== $plans ) {
6042
- $this->_plans = $plans;
6043
- }
6044
-
6045
- $this->send_install_update();
6046
-
6047
- $this->_store_account();
6048
-
6049
- }
6050
-
6051
- /**
6052
- * @author Vova Feldman (@svovaf)
6053
- * @since 1.1.7.4
6054
- *
6055
- * @param array $override_with
6056
- *
6057
- * @return array
6058
- */
6059
- function get_opt_in_params( $override_with = array() ) {
6060
- $this->_logger->entrance();
6061
-
6062
- $current_user = self::_get_current_wp_user();
6063
-
6064
- $params = array(
6065
- 'user_firstname' => $current_user->user_firstname,
6066
- 'user_lastname' => $current_user->user_lastname,
6067
- 'user_nickname' => $current_user->user_nicename,
6068
- 'user_email' => $current_user->user_email,
6069
- 'user_ip' => WP_FS__REMOTE_ADDR,
6070
- 'plugin_slug' => $this->_slug,
6071
- 'plugin_id' => $this->get_id(),
6072
- 'plugin_public_key' => $this->get_public_key(),
6073
- 'plugin_version' => $this->get_plugin_version(),
6074
- 'return_url' => wp_nonce_url( $this->_get_admin_page_url(
6075
- '',
6076
- array( 'fs_action' => $this->_slug . '_activate_new' )
6077
- ), $this->_slug . '_activate_new' ),
6078
- 'account_url' => wp_nonce_url( $this->_get_admin_page_url(
6079
- 'account',
6080
- array( 'fs_action' => 'sync_user' )
6081
- ), 'sync_user' ),
6082
- 'site_uid' => $this->get_anonymous_id(),
6083
- 'site_url' => get_site_url(),
6084
- 'site_name' => get_bloginfo( 'name' ),
6085
- 'platform_version' => get_bloginfo( 'version' ),
6086
- 'php_version' => phpversion(),
6087
- 'language' => get_bloginfo( 'language' ),
6088
- 'charset' => get_bloginfo( 'charset' ),
6089
- );
6090
-
6091
- if ( WP_FS__SKIP_EMAIL_ACTIVATION && $this->has_secret_key() ) {
6092
- // Even though rand() is known for its security issues,
6093
- // the timestamp adds another layer of protection.
6094
- // It would be very hard for an attacker to get the secret key form here.
6095
- // Plus, this should never run in production since the secret should never
6096
- // be included in the production version.
6097
- $params['ts'] = WP_FS__SCRIPT_START_TIME;
6098
- $params['salt'] = md5( uniqid( rand() ) );
6099
- $params['secure'] = md5(
6100
- $params['ts'] .
6101
- $params['salt'] .
6102
- $this->get_secret_key()
6103
- );
6104
- }
6105
-
6106
- return array_merge( $params, $override_with );
6107
- }
6108
-
6109
- /**
6110
- * @author Vova Feldman (@svovaf)
6111
- * @since 1.1.7.4
6112
- *
6113
- * @param string|bool $email
6114
- * @param string|bool $first
6115
- * @param string|bool $last
6116
- * @param string|bool $license_secret_key
6117
- *
6118
- * @return bool Is successful opt-in (or set to pending).
6119
- */
6120
- function opt_in( $email = false, $first = false, $last = false, $license_secret_key = false ) {
6121
- $this->_logger->entrance();
6122
-
6123
- if ( false === $email ) {
6124
- $current_user = self::_get_current_wp_user();
6125
- $email = $current_user->user_email;
6126
- }
6127
-
6128
- $fs_user = Freemius::_get_user_by_email( $email );
6129
- if ( is_object( $fs_user ) && ! $this->is_pending_activation() ) {
6130
- $this->install_with_current_user( false );
6131
-
6132
- return true;
6133
- }
6134
-
6135
- $user_info = array();
6136
- if ( ! empty( $email ) ) {
6137
- $user_info['user_email'] = $email;
6138
- }
6139
- if ( ! empty( $first ) ) {
6140
- $user_info['user_firstname'] = $first;
6141
- }
6142
- if ( ! empty( $last ) ) {
6143
- $user_info['user_lastname'] = $last;
6144
- }
6145
-
6146
- $params = $this->get_opt_in_params( $user_info );
6147
-
6148
- if ( is_string( $license_secret_key ) ) {
6149
- $params['license_secret_key'] = $license_secret_key;
6150
- }
6151
-
6152
- $params['format'] = 'json';
6153
-
6154
- $url = WP_FS__ADDRESS . '/action/service/user/install/';
6155
- if ( isset( $_COOKIE['XDEBUG_SESSION'] ) ) {
6156
- $url = add_query_arg( 'XDEBUG_SESSION', 'PHPSTORM', $url );
6157
- }
6158
-
6159
- $response = wp_remote_post( $url, array(
6160
- 'method' => 'POST',
6161
- 'body' => $params,
6162
- 'timeout' => 15,
6163
- ) );
6164
-
6165
- if ( $response instanceof WP_Error ) {
6166
- if ( 'https://' === substr( $url, 0, 8 ) &&
6167
- isset( $response->errors ) &&
6168
- isset( $response->errors['http_request_failed'] ) &&
6169
- false !== strpos( $response->errors['http_request_failed'][0], 'sslv3 alert handshake' )
6170
- ) {
6171
- // Failed due to old version of cURL or Open SSL (SSLv3 is not supported by CloudFlare).
6172
- $url = 'http://' . substr( $url, 8 );
6173
-
6174
- $response = wp_remote_post( $url, array(
6175
- 'method' => 'POST',
6176
- 'body' => $params,
6177
- 'timeout' => 15,
6178
- ) );
6179
- }
6180
-
6181
- if ( $response instanceof WP_Error ) {
6182
- return false;
6183
- }
6184
- }
6185
-
6186
- if ( is_wp_error( $response ) ) {
6187
- return false;
6188
- }
6189
-
6190
- $decoded = @json_decode( $response['body'] );
6191
-
6192
- if ( empty( $decoded ) ) {
6193
- return false;
6194
- }
6195
-
6196
- if ( isset( $decoded->error ) ) {
6197
- return false;
6198
- } else if ( isset( $decoded->pending_activation ) && $decoded->pending_activation ) {
6199
- // Pending activation, add message.
6200
- $this->set_pending_confirmation( false, false );
6201
-
6202
- return true;
6203
- } else if ( isset( $decoded->install_secret_key ) ) {
6204
- $this->install_with_new_user(
6205
- $decoded->user_id,
6206
- $decoded->user_public_key,
6207
- $decoded->user_secret_key,
6208
- $decoded->install_id,
6209
- $decoded->install_public_key,
6210
- $decoded->install_secret_key,
6211
- false
6212
- );
6213
-
6214
- return true;
6215
- }
6216
-
6217
- return false;
6218
- }
6219
-
6220
- /**
6221
- * Set user and site identities.
6222
- *
6223
- * @author Vova Feldman (@svovaf)
6224
- * @since 1.0.9
6225
- *
6226
- * @param FS_User $user
6227
- * @param FS_Site $site
6228
- * @param bool $redirect
6229
- *
6230
- * @return bool False if account already set.
6231
- */
6232
- function setup_account( FS_User $user, FS_Site $site, $redirect = true ) {
6233
- $this->_user = $user;
6234
- $this->_site = $site;
6235
-
6236
- $this->_sync_plans();
6237
-
6238
- $this->_enrich_site_plan( false );
6239
-
6240
- $this->_set_account( $user, $site );
6241
-
6242
- if ( $this->is_trial() ) {
6243
- // Store trial plan information.
6244
- $this->_enrich_site_trial_plan( true );
6245
- }
6246
-
6247
- // If Freemius was OFF before, turn it on.
6248
- $this->turn_on();
6249
-
6250
- $this->do_action( 'after_account_connection', $user, $site );
6251
-
6252
- if ( is_numeric( $site->license_id ) ) {
6253
- $this->_license = $this->_get_license_by_id( $site->license_id );
6254
- }
6255
-
6256
- if ( $this->is_pending_activation() ) {
6257
- // Remove pending activation sticky notice (if still exist).
6258
- $this->_admin_notices->remove_sticky( 'activation_pending' );
6259
-
6260
- // Remove plugin from pending activation mode.
6261
- unset( $this->_storage->is_pending_activation );
6262
-
6263
- if ( ! $this->is_paying() ) {
6264
- $this->_admin_notices->add_sticky(
6265
- sprintf( __fs( 'plugin-x-activation-message', $this->_slug ), '<b>' . $this->get_plugin_name() . '</b>' ),
6266
- 'activation_complete'
6267
- );
6268
- }
6269
- }
6270
-
6271
- if ( $this->is_paying() && ! $this->is_premium() ) {
6272
- $this->_admin_notices->add_sticky(
6273
- sprintf(
6274
- __fs( 'activation-with-plan-x-message', $this->_slug ),
6275
- $this->_site->plan->title
6276
- ) . ' ' . $this->_get_latest_download_link( sprintf(
6277
- __fs( 'download-latest-x-version', $this->_slug ),
6278
- $this->_site->plan->title
6279
- ) ),
6280
- 'plan_upgraded',
6281
- __fs( 'yee-haw', $this->_slug ) . '!'
6282
- );
6283
- }
6284
-
6285
- $plugin_id = fs_request_get( 'plugin_id', false );
6286
-
6287
- // Store activation time ONLY for plugins (not add-ons).
6288
- if ( ! is_numeric( $plugin_id ) || ( $plugin_id == $this->_plugin->id ) ) {
6289
- $this->_storage->activation_timestamp = WP_FS__SCRIPT_START_TIME;
6290
- }
6291
-
6292
- if ( is_numeric( $plugin_id ) ) {
6293
- if ( $plugin_id != $this->_plugin->id ) {
6294
- // Add-on was installed - sync license right after install.
6295
- if ( $redirect && fs_redirect( $this->_get_sync_license_url( $plugin_id ) )
6296
- ) {
6297
- exit();
6298
- }
6299
-
6300
- }
6301
- } else {
6302
- /**
6303
- * @author Vova Feldman (@svovaf)
6304
- * @since 1.1.9 If site installed with a valid license, sync license.
6305
- */
6306
- if ( $this->is_paying() ) {
6307
- $this->_sync_plugin_license( true );
6308
- }
6309
-
6310
- // Reload the page with the keys.
6311
- if ( $redirect && fs_redirect( $this->get_after_activation_url( 'after_connect_url' ) ) ) {
6312
- exit();
6313
- }
6314
- }
6315
- }
6316
-
6317
- /**
6318
- * Install plugin with new user information after approval.
6319
- *
6320
- * @author Vova Feldman (@svovaf)
6321
- * @since 1.0.7
6322
- */
6323
- function _install_with_new_user() {
6324
- $this->_logger->entrance();
6325
-
6326
- if ( $this->is_registered() ) {
6327
- return;
6328
- }
6329
-
6330
- if ( fs_request_is_action( $this->_slug . '_activate_new' ) ) {
6331
- // check_admin_referer( $this->_slug . '_activate_new' );
6332
-
6333
- $this->_admin_notices->remove_sticky( 'connect_account' );
6334
-
6335
- if ( fs_request_has( 'user_secret_key' ) ) {
6336
- $this->install_with_new_user(
6337
- fs_request_get( 'user_id' ),
6338
- fs_request_get( 'user_public_key' ),
6339
- fs_request_get( 'user_secret_key' ),
6340
- fs_request_get( 'install_id' ),
6341
- fs_request_get( 'install_public_key' ),
6342
- fs_request_get( 'install_secret_key' )
6343
- );
6344
- } else if ( fs_request_has( 'pending_activation' ) ) {
6345
- $this->set_pending_confirmation( fs_request_get( 'user_email' ), true );
6346
- }
6347
- }
6348
- }
6349
-
6350
- /**
6351
- * Install plugin with new user.
6352
- *
6353
- * @author Vova Feldman (@svovaf)
6354
- * @since 1.1.7.4
6355
- *
6356
- * @param number $user_id
6357
- * @param string $user_public_key
6358
- * @param string $user_secret_key
6359
- * @param number $install_id
6360
- * @param string $install_public_key
6361
- * @param string $install_secret_key
6362
- * @param bool $redirect
6363
- */
6364
- private function install_with_new_user(
6365
- $user_id,
6366
- $user_public_key,
6367
- $user_secret_key,
6368
- $install_id,
6369
- $install_public_key,
6370
- $install_secret_key,
6371
- $redirect = true
6372
- ) {
6373
- $user = new FS_User();
6374
- $user->id = $user_id;
6375
- $user->public_key = $user_public_key;
6376
- $user->secret_key = $user_secret_key;
6377
-
6378
- $this->_user = $user;
6379
- $user_result = $this->get_api_user_scope()->get();
6380
- $user = new FS_User( $user_result );
6381
- $this->_user = $user;
6382
-
6383
- $site = new FS_Site();
6384
- $site->id = $install_id;
6385
- $site->public_key = $install_public_key;
6386
- $site->secret_key = $install_secret_key;
6387
-
6388
- $this->_site = $site;
6389
- $site_result = $this->get_api_site_scope()->get();
6390
- $site = new FS_Site( $site_result );
6391
- $this->_site = $site;
6392
-
6393
- $this->setup_account( $this->_user, $this->_site, $redirect );
6394
- }
6395
-
6396
- /**
6397
- * @author Vova Feldman (@svovaf)
6398
- * @since 1.1.7.4
6399
- *
6400
- * @param bool $email
6401
- * @param bool $redirect
6402
- */
6403
- private function set_pending_confirmation( $email = false, $redirect = true ) {
6404
- // Install must be activated via email since
6405
- // user with the same email already exist.
6406
- $this->_storage->is_pending_activation = true;
6407
- $this->_add_pending_activation_notice( $email );
6408
-
6409
- // Reload the page with with pending activation message.
6410
- if ( $redirect && fs_redirect( $this->get_after_activation_url( 'after_pending_connect_url' ) ) ) {
6411
- exit();
6412
- }
6413
- }
6414
-
6415
- /**
6416
- * Install plugin with current logged WP user info.
6417
- *
6418
- * @author Vova Feldman (@svovaf)
6419
- * @since 1.0.7
6420
- */
6421
- function _install_with_current_user() {
6422
- $this->_logger->entrance();
6423
-
6424
- if ( $this->is_registered() ) {
6425
- return;
6426
- }
6427
-
6428
- if ( fs_request_is_action( $this->_slug . '_activate_existing' ) && fs_request_is_post() ) {
6429
- // check_admin_referer( 'activate_existing_' . $this->_plugin->public_key );
6430
-
6431
- $this->install_with_current_user();
6432
- }
6433
- }
6434
-
6435
-
6436
- /**
6437
- * @author Vova Feldman (@svovaf)
6438
- * @since 1.1.7.4
6439
- *
6440
- * @param bool $redirect
6441
- */
6442
- private function install_with_current_user( $redirect = true ) {
6443
- $this->_admin_notices->remove_sticky( 'connect_account' );
6444
-
6445
- // Get current logged WP user.
6446
- $current_user = self::_get_current_wp_user();
6447
-
6448
- // Find the relevant FS user by the email.
6449
- $user = self::_get_user_by_email( $current_user->user_email );
6450
-
6451
- // We have to set the user before getting user scope API handler.
6452
- $this->_user = $user;
6453
-
6454
- $extra_install_params = array(
6455
- 'uid' => $this->get_anonymous_id(),
6456
- );
6457
-
6458
- /**
6459
- * @author Vova Feldman (@svovaf)
6460
- * @since 1.1.9 Add license key if given.
6461
- */
6462
- $license_key = fs_request_get( 'license_secret_key' );
6463
-
6464
- if ( ! empty( $license_key ) ) {
6465
- $extra_install_params['license_secret_key'] = $license_key;
6466
- }
6467
-
6468
- // Install the plugin.
6469
- $install = $this->get_api_user_scope()->call(
6470
- "/plugins/{$this->get_id()}/installs.json",
6471
- 'post',
6472
- $this->get_install_data_for_api( $extra_install_params, false, false )
6473
- );
6474
-
6475
- if ( isset( $install->error ) ) {
6476
- $this->_admin_notices->add(
6477
- sprintf( __fs( 'could-not-activate-x', $this->_slug ), $this->get_plugin_name() ) . ' ' .
6478
- __fs( 'contact-us-with-error-message', $this->_slug ) . ' ' . '<b>' . $install->error->message . '</b>',
6479
- __fs( 'oops', $this->_slug ) . '...',
6480
- 'error'
6481
- );
6482
-
6483
- return;
6484
- }
6485
-
6486
- $site = new FS_Site( $install );
6487
- $this->_site = $site;
6488
- // $this->_enrich_site_plan( false );
6489
-
6490
- // $this->_set_account( $user, $site );
6491
- // $this->_sync_plans();
6492
-
6493
- $this->setup_account( $this->_user, $this->_site, $redirect );
6494
- }
6495
-
6496
- /**
6497
- * Tries to activate add-on account based on parent plugin info.
6498
- *
6499
- * @author Vova Feldman (@svovaf)
6500
- * @since 1.0.6
6501
- *
6502
- * @param Freemius $parent_fs
6503
- */
6504
- private function _activate_addon_account( Freemius $parent_fs ) {
6505
- if ( $this->is_registered() ) {
6506
- // Already activated.
6507
- return;
6508
- }
6509
-
6510
- // Activate add-on with parent plugin credentials.
6511
- $addon_install = $parent_fs->get_api_site_scope()->call(
6512
- "/addons/{$this->_plugin->id}/installs.json",
6513
- 'post',
6514
- $this->get_install_data_for_api( array(
6515
- 'uid' => $this->get_anonymous_id(),
6516
- ), false, false )
6517
- );
6518
-
6519
- if ( isset( $addon_install->error ) ) {
6520
- $this->_admin_notices->add(
6521
- sprintf( __fs( 'could-not-activate-x', $this->_slug ), $this->get_plugin_name() ) . ' ' .
6522
- __fs( 'contact-us-with-error-message', $this->_slug ) . ' ' . '<b>' . $addon_install->error->message . '</b>',
6523
- __fs( 'oops', $this->_slug ) . '...',
6524
- 'error'
6525
- );
6526
-
6527
- return;
6528
- }
6529
-
6530
- // First of all, set site info - otherwise we won't
6531
- // be able to invoke API calls.
6532
- $this->_site = new FS_Site( $addon_install );
6533
-
6534
- // Sync add-on plans.
6535
- $this->_sync_plans();
6536
-
6537
- // Get site's current plan.
6538
- $this->_site->plan = $this->_get_plan_by_id( $this->_site->plan->id );
6539
-
6540
- // Get user information based on parent's plugin.
6541
- $user = $parent_fs->get_user();
6542
-
6543
- $this->_set_account( $user, $this->_site );
6544
-
6545
- // Sync licenses.
6546
- $this->_sync_licenses();
6547
-
6548
- // Try to activate premium license.
6549
- $this->_activate_license( true );
6550
- }
6551
-
6552
- #endregion ------------------------------------------------------------------
6553
-
6554
- #region Admin Menu Items ------------------------------------------------------------------
6555
-
6556
- private $_menu_items = array();
6557
-
6558
- /**
6559
- * @author Vova Feldman (@svovaf)
6560
- * @since 1.0.7
6561
- *
6562
- * @return string
6563
- */
6564
- function get_menu_slug() {
6565
- return $this->_menu->get_slug();
6566
- }
6567
-
6568
- /**
6569
- * @author Vova Feldman (@svovaf)
6570
- * @since 1.0.9
6571
- */
6572
- function _prepare_admin_menu() {
6573
- // if ( ! $this->is_on() ) {
6574
- // return;
6575
- // }
6576
-
6577
- if ( ! $this->has_api_connectivity() && ! $this->is_enable_anonymous() ) {
6578
- $this->_menu->remove_menu_item();
6579
- } else {
6580
- $this->do_action( 'before_admin_menu_init' );
6581
-
6582
- $this->add_menu_action();
6583
- $this->add_submenu_items();
6584
- }
6585
- }
6586
-
6587
- /**
6588
- * Admin dashboard menu items modifications.
6589
- *
6590
- * NOTE: admin_menu action executed before admin_init.
6591
- *
6592
- * @author Vova Feldman (@svovaf)
6593
- * @since 1.0.7
6594
- *
6595
- */
6596
- private function add_menu_action() {
6597
- if ( $this->is_activation_mode() ) {
6598
- $this->override_plugin_menu_with_activation();
6599
- } else {
6600
- // If not registered try to install user.
6601
- if ( ! $this->is_registered() &&
6602
- fs_request_is_action( $this->_slug . '_activate_new' )
6603
- ) {
6604
- $this->_install_with_new_user();
6605
- }
6606
- }
6607
- }
6608
-
6609
- /**
6610
- * @author Vova Feldman (@svovaf)
6611
- * @since 1.0.1
6612
- *
6613
- * @return string
6614
- */
6615
- function _redirect_on_clicked_menu_link() {
6616
- $this->_logger->entrance();
6617
-
6618
- $page = strtolower( isset( $_REQUEST['page'] ) ? $_REQUEST['page'] : '' );
6619
-
6620
- $this->_logger->log( 'page = ' . $page );
6621
-
6622
- foreach ( $this->_menu_items as $priority => $items ) {
6623
- foreach ( $items as $item ) {
6624
- if ( isset( $item['url'] ) ) {
6625
- if ( $page === strtolower( $item['menu_slug'] ) ) {
6626
- $this->_logger->log( 'Redirecting to ' . $item['url'] );
6627
-
6628
- fs_redirect( $item['url'] );
6629
- }
6630
- }
6631
- }
6632
- }
6633
- }
6634
-
6635
- /**
6636
- * Remove plugin's all admin menu items & pages, and replace with activation page.
6637
- *
6638
- * @author Vova Feldman (@svovaf)
6639
- * @since 1.0.1
6640
- */
6641
- private function override_plugin_menu_with_activation() {
6642
- $this->_logger->entrance();
6643
-
6644
- $hook = false;
6645
-
6646
- if ( $this->_menu->is_top_level() ) {
6647
- $hook = $this->_menu->override_menu_item( array( &$this, '_connect_page_render' ) );
6648
-
6649
- if ( false === $hook ) {
6650
- // Create new menu item just for the opt-in.
6651
- $hook = add_menu_page(
6652
- $this->get_plugin_name(),
6653
- $this->get_plugin_name(),
6654
- 'manage_options',
6655
- $this->_menu->get_slug(),
6656
- array( &$this, '_connect_page_render' )
6657
- );
6658
- }
6659
- } else {
6660
- $menus = array( $this->_menu->get_parent_slug() );
6661
-
6662
- if ( $this->_menu->is_override_exact() ) {
6663
- // Make sure the current page is matching the activation page.
6664
- $activation_url = strtolower( $this->get_activation_url() );
6665
- $request_url = strtolower( $_SERVER['REQUEST_URI'] );
6666
-
6667
- if ( parse_url( $activation_url, PHP_URL_PATH ) !== parse_url( $request_url, PHP_URL_PATH ) ) {
6668
- // Different path - DO NOT OVERRIDE PAGE.
6669
- return;
6670
- }
6671
-
6672
- $activation_url_params = array();
6673
- parse_str( parse_url( $activation_url, PHP_URL_QUERY ), $activation_url_params );
6674
-
6675
- $request_url_params = array();
6676
- parse_str( parse_url( $request_url, PHP_URL_QUERY ), $request_url_params );
6677
-
6678
-
6679
- foreach ( $activation_url_params as $key => $val ) {
6680
- if ( ! isset( $request_url_params[ $key ] ) || $val != $request_url_params[ $key ] ) {
6681
- // Not matching query string - DO NOT OVERRIDE PAGE.
6682
- return;
6683
- }
6684
- }
6685
- }
6686
-
6687
- foreach ( $menus as $parent_slug ) {
6688
- $hook = $this->_menu->override_submenu_action(
6689
- $parent_slug,
6690
- $this->_menu->get_raw_slug(),
6691
- array( &$this, '_connect_page_render' )
6692
- );
6693
-
6694
- if ( false !== $hook ) {
6695
- // Found plugin's submenu item.
6696
- break;
6697
- }
6698
- }
6699
- }
6700
-
6701
- if ( $this->_menu->is_activation_page() ) {
6702
- // Clean admin page from distracting content.
6703
- self::_clean_admin_content_section();
6704
- }
6705
-
6706
- if ( false !== $hook ) {
6707
- if ( fs_request_is_action( $this->_slug . '_activate_existing' ) ) {
6708
- add_action( "load-$hook", array( &$this, '_install_with_current_user' ) );
6709
- } else if ( fs_request_is_action( $this->_slug . '_activate_new' ) ) {
6710
- add_action( "load-$hook", array( &$this, '_install_with_new_user' ) );
6711
- }
6712
- }
6713
- }
6714
-
6715
- /**
6716
- * @author Vova Feldman (@svovaf)
6717
- * @since 1.0.0
6718
- *
6719
- * @return string
6720
- */
6721
- private function get_top_level_menu_slug() {
6722
- return ( $this->is_addon() ?
6723
- $this->get_parent_instance()->_menu->get_top_level_menu_slug() :
6724
- $this->_menu->get_top_level_menu_slug() );
6725
- }
6726
-
6727
- /**
6728
- * Add default Freemius menu items.
6729
- *
6730
- * @author Vova Feldman (@svovaf)
6731
- * @since 1.0.0
6732
- */
6733
- private function add_submenu_items() {
6734
- $this->_logger->entrance();
6735
-
6736
- if ( ! $this->is_addon() ) {
6737
- if ( ! $this->is_activation_mode() ) {
6738
- if ( $this->is_registered() ) {
6739
- // Add user account page.
6740
- $this->add_submenu_item(
6741
- __fs( 'account', $this->_slug ),
6742
- array( &$this, '_account_page_render' ),
6743
- $this->get_plugin_name() . ' &ndash; ' . __fs( 'account', $this->_slug ),
6744
- 'manage_options',
6745
- 'account',
6746
- array( &$this, '_account_page_load' ),
6747
- WP_FS__DEFAULT_PRIORITY,
6748
- $this->_menu->is_submenu_item_visible( 'account' )
6749
- );
6750
- }
6751
-
6752
- // Add contact page.
6753
- $this->add_submenu_item(
6754
- __fs( 'contact-us', $this->_slug ),
6755
- array( &$this, '_contact_page_render' ),
6756
- $this->get_plugin_name() . ' &ndash; ' . __fs( 'contact-us', $this->_slug ),
6757
- 'manage_options',
6758
- 'contact',
6759
- 'Freemius::_clean_admin_content_section',
6760
- WP_FS__DEFAULT_PRIORITY,
6761
- $this->_menu->is_submenu_item_visible( 'contact' )
6762
- );
6763
-
6764
- if ( $this->has_addons() ) {
6765
- $this->add_submenu_item(
6766
- __fs( 'add-ons', $this->_slug ),
6767
- array( &$this, '_addons_page_render' ),
6768
- $this->get_plugin_name() . ' &ndash; ' . __fs( 'add-ons', $this->_slug ),
6769
- 'manage_options',
6770
- 'addons',
6771
- array( &$this, '_addons_page_load' ),
6772
- WP_FS__LOWEST_PRIORITY - 1,
6773
- $this->_menu->is_submenu_item_visible( 'addons' )
6774
- );
6775
- }
6776
-
6777
- $show_pricing = ( $this->has_paid_plan() && $this->_menu->is_submenu_item_visible( 'pricing' ) );
6778
- // If user don't have paid plans, add pricing page
6779
- // to support add-ons checkout but don't add the submenu item.
6780
- // || (isset( $_GET['page'] ) && $this->_menu->get_slug( 'pricing' ) == $_GET['page']);
6781
-
6782
- // Add upgrade/pricing page.
6783
- $this->add_submenu_item(
6784
- ( $this->is_paying() ? __fs( 'pricing', $this->_slug ) : __fs( 'upgrade', $this->_slug ) . '&nbsp;&nbsp;&#x27a4;' ),
6785
- array( &$this, '_pricing_page_render' ),
6786
- $this->get_plugin_name() . ' &ndash; ' . __fs( 'pricing', $this->_slug ),
6787
- 'manage_options',
6788
- 'pricing',
6789
- 'Freemius::_clean_admin_content_section',
6790
- WP_FS__LOWEST_PRIORITY,
6791
- $show_pricing
6792
- );
6793
- }
6794
- }
6795
-
6796
-
6797
- if ( 0 < count( $this->_menu_items ) ) {
6798
- if ( ! $this->_menu->is_top_level() ) {
6799
- fs_enqueue_local_style( 'fs_common', '/admin/common.css' );
6800
-
6801
- // Append submenu items right after the plugin's submenu item.
6802
- $this->order_sub_submenu_items();
6803
- } else {
6804
- // Append submenu items.
6805
- $this->embed_submenu_items();
6806
- }
6807
- }
6808
- }
6809
-
6810
- /**
6811
- * Moved the actual submenu item additions to a separated function,
6812
- * in order to support sub-submenu items when the plugin's settings
6813
- * only have a submenu and not top-level menu item.
6814
- *
6815
- * @author Vova Feldman (@svovaf)
6816
- * @since 1.1.4
6817
- */
6818
- private function embed_submenu_items() {
6819
- $item_template = $this->_menu->is_top_level() ?
6820
- '<span class="fs-submenu-item">%s</span>' :
6821
- '<span class="fs-submenu-item fs-sub">%s</span>';
6822
-
6823
- ksort( $this->_menu_items );
6824
-
6825
- foreach ( $this->_menu_items as $priority => $items ) {
6826
- foreach ( $items as $item ) {
6827
- if ( ! isset( $item['url'] ) ) {
6828
- $hook = add_submenu_page(
6829
- $item['show_submenu'] ?
6830
- $this->get_top_level_menu_slug() :
6831
- null,
6832
- $item['page_title'],
6833
- sprintf( $item_template, $item['menu_title'] ),
6834
- $item['capability'],
6835
- $item['menu_slug'],
6836
- $item['render_function']
6837
- );
6838
-
6839
- if ( false !== $item['before_render_function'] ) {
6840
- add_action( "load-$hook", $item['before_render_function'] );
6841
- }
6842
- } else {
6843
- add_submenu_page(
6844
- $this->get_top_level_menu_slug(),
6845
- $item['page_title'],
6846
- sprintf( $item_template, $item['menu_title'] ),
6847
- $item['capability'],
6848
- $item['menu_slug'],
6849
- array( $this, '' )
6850
- );
6851
- }
6852
- }
6853
- }
6854
- }
6855
-
6856
- /**
6857
- * Re-order the submenu items so all Freemius added new submenu items
6858
- * are added right after the plugin's settings submenu item.
6859
- *
6860
- * @author Vova Feldman (@svovaf)
6861
- * @since 1.1.4
6862
- */
6863
- private function order_sub_submenu_items() {
6864
- global $submenu;
6865
-
6866
- $menu_slug = $this->_menu->get_top_level_menu_slug();
6867
-
6868
- if ( empty( $submenu[ $menu_slug ] ) ) {
6869
- return;
6870
- }
6871
-
6872
- $top_level_menu = &$submenu[ $menu_slug ];
6873
-
6874
- $all_submenu_items_after = array();
6875
-
6876
- $found_submenu_item = false;
6877
-
6878
- foreach ( $top_level_menu as $submenu_id => $meta ) {
6879
- if ( $found_submenu_item ) {
6880
- // Remove all submenu items after the plugin's submenu item.
6881
- $all_submenu_items_after[] = $meta;
6882
- unset( $top_level_menu[ $submenu_id ] );
6883
- }
6884
-
6885
- if ( $this->_menu->get_raw_slug() === $meta[2] ) {
6886
- // Found the submenu item, put all below.
6887
- $found_submenu_item = true;
6888
- continue;
6889
- }
6890
- }
6891
-
6892
- // Embed all plugin's new submenu items.
6893
- $this->embed_submenu_items();
6894
-
6895
- // Start with specially high number to make sure it's appended.
6896
- $i = max( 10000, max( array_keys( $top_level_menu ) ) + 1 );
6897
- foreach ( $all_submenu_items_after as $meta ) {
6898
- $top_level_menu[ $i ] = $meta;
6899
- $i ++;
6900
- }
6901
-
6902
- // Sort submenu items.
6903
- ksort( $top_level_menu );
6904
- }
6905
-
6906
- /**
6907
- * Displays the Support Forum link when enabled.
6908
- *
6909
- * Can be filtered like so:
6910
- *
6911
- * function _fs_show_support_menu( $is_visible, $menu_id ) {
6912
- * if ( 'support' === $menu_id ) {
6913
- * return _fs->is_registered();
6914
- * }
6915
- * return $is_visible;
6916
- * }
6917
- * _fs()->add_filter('is_submenu_visible', '_fs_show_support_menu', 10, 2);
6918
- *
6919
- */
6920
- function _add_default_submenu_items() {
6921
- if ( ! $this->is_on() ) {
6922
- return;
6923
- }
6924
-
6925
- if ( ! $this->is_activation_mode() ) {
6926
- if ( $this->_menu->is_submenu_item_visible( 'support' ) ) {
6927
- $this->add_submenu_link_item(
6928
- $this->apply_filters( 'support_forum_submenu', __fs( 'support-forum', $this->_slug ) ),
6929
- $this->apply_filters( 'support_forum_url', 'https://wordpress.org/support/plugin/' . $this->_slug ),
6930
- 'wp-support-forum',
6931
- 'read',
6932
- 50
6933
- );
6934
- }
6935
- }
6936
- }
6937
-
6938
- /**
6939
- * @author Vova Feldman (@svovaf)
6940
- * @since 1.0.1
6941
- *
6942
- * @param string $menu_title
6943
- * @param callable $render_function
6944
- * @param bool|string $page_title
6945
- * @param string $capability
6946
- * @param bool|string $menu_slug
6947
- * @param bool|callable $before_render_function
6948
- * @param int $priority
6949
- * @param bool $show_submenu
6950
- */
6951
- function add_submenu_item(
6952
- $menu_title,
6953
- $render_function,
6954
- $page_title = false,
6955
- $capability = 'manage_options',
6956
- $menu_slug = false,
6957
- $before_render_function = false,
6958
- $priority = WP_FS__DEFAULT_PRIORITY,
6959
- $show_submenu = true
6960
- ) {
6961
- $this->_logger->entrance( 'Title = ' . $menu_title );
6962
-
6963
- if ( $this->is_addon() ) {
6964
- $parent_fs = $this->get_parent_instance();
6965
-
6966
- if ( is_object( $parent_fs ) ) {
6967
- $parent_fs->add_submenu_item(
6968
- $menu_title,
6969
- $render_function,
6970
- $page_title,
6971
- $capability,
6972
- $menu_slug,
6973
- $before_render_function,
6974
- $priority,
6975
- $show_submenu
6976
- );
6977
-
6978
- return;
6979
- }
6980
- }
6981
-
6982
- if ( ! isset( $this->_menu_items[ $priority ] ) ) {
6983
- $this->_menu_items[ $priority ] = array();
6984
- }
6985
-
6986
- $this->_menu_items[ $priority ][] = array(
6987
- 'page_title' => is_string( $page_title ) ? $page_title : $menu_title,
6988
- 'menu_title' => $menu_title,
6989
- 'capability' => $capability,
6990
- 'menu_slug' => $this->_menu->get_slug( is_string( $menu_slug ) ? $menu_slug : strtolower( $menu_title ) ),
6991
- 'render_function' => $render_function,
6992
- 'before_render_function' => $before_render_function,
6993
- 'show_submenu' => $show_submenu,
6994
- );
6995
- }
6996
-
6997
- /**
6998
- * @author Vova Feldman (@svovaf)
6999
- * @since 1.0.1
7000
- *
7001
- * @param string $menu_title
7002
- * @param string $url
7003
- * @param bool $menu_slug
7004
- * @param string $capability
7005
- * @param int $priority
7006
- *
7007
- */
7008
- function add_submenu_link_item(
7009
- $menu_title,
7010
- $url,
7011
- $menu_slug = false,
7012
- $capability = 'read',
7013
- $priority = WP_FS__DEFAULT_PRIORITY
7014
- ) {
7015
- $this->_logger->entrance( 'Title = ' . $menu_title . '; Url = ' . $url );
7016
-
7017
- if ( $this->is_addon() ) {
7018
- $parent_fs = $this->get_parent_instance();
7019
-
7020
- if ( is_object( $parent_fs ) ) {
7021
- $parent_fs->add_submenu_link_item(
7022
- $menu_title,
7023
- $url,
7024
- $menu_slug,
7025
- $capability,
7026
- $priority
7027
- );
7028
-
7029
- return;
7030
- }
7031
- }
7032
-
7033
- if ( ! isset( $this->_menu_items[ $priority ] ) ) {
7034
- $this->_menu_items[ $priority ] = array();
7035
- }
7036
-
7037
- $this->_menu_items[ $priority ][] = array(
7038
- 'menu_title' => $menu_title,
7039
- 'capability' => $capability,
7040
- 'menu_slug' => $this->_menu->get_slug( is_string( $menu_slug ) ? $menu_slug : strtolower( $menu_title ) ),
7041
- 'url' => $url,
7042
- 'page_title' => $menu_title,
7043
- 'render_function' => 'fs_dummy',
7044
- 'before_render_function' => '',
7045
- );
7046
- }
7047
-
7048
- #endregion ------------------------------------------------------------------
7049
-
7050
- /* Actions / Hooks / Filters
7051
- ------------------------------------------------------------------------------------------------------------------*/
7052
- /**
7053
- * @author Vova Feldman (@svovaf)
7054
- * @since 1.1.7
7055
- *
7056
- * @param string $tag
7057
- *
7058
- * @return string
7059
- */
7060
- private function get_action_tag( $tag ) {
7061
- return 'fs_' . $tag . '_' . $this->_slug;
7062
- }
7063
-
7064
- /**
7065
- * Do action, specific for the current context plugin.
7066
- *
7067
- * @author Vova Feldman (@svovaf)
7068
- * @since 1.0.1
7069
- *
7070
- * @param string $tag The name of the action to be executed.
7071
- * @param mixed $arg,... Optional. Additional arguments which are passed on to the
7072
- * functions hooked to the action. Default empty.
7073
- *
7074
- * @uses do_action()
7075
- */
7076
- function do_action( $tag, $arg = '' ) {
7077
- $this->_logger->entrance( $tag );
7078
-
7079
- $args = func_get_args();
7080
-
7081
- call_user_func_array( 'do_action', array_merge(
7082
- array( $this->get_action_tag( $tag ) ),
7083
- array_slice( $args, 1 ) )
7084
- );
7085
- }
7086
-
7087
- /**
7088
- * Add action, specific for the current context plugin.
7089
- *
7090
- * @author Vova Feldman (@svovaf)
7091
- * @since 1.0.1
7092
- *
7093
- * @param string $tag
7094
- * @param callable $function_to_add
7095
- * @param int $priority
7096
- * @param int $accepted_args
7097
- *
7098
- * @uses add_action()
7099
- */
7100
- function add_action( $tag, $function_to_add, $priority = WP_FS__DEFAULT_PRIORITY, $accepted_args = 1 ) {
7101
- $this->_logger->entrance( $tag );
7102
-
7103
- add_action( $this->get_action_tag( $tag ), $function_to_add, $priority, $accepted_args );
7104
- }
7105
-
7106
- /**
7107
- * Apply filter, specific for the current context plugin.
7108
- *
7109
- * @author Vova Feldman (@svovaf)
7110
- * @since 1.0.9
7111
- *
7112
- * @param string $tag The name of the filter hook.
7113
- * @param mixed $value The value on which the filters hooked to `$tag` are applied on.
7114
- *
7115
- * @return mixed The filtered value after all hooked functions are applied to it.
7116
- *
7117
- * @uses apply_filters()
7118
- */
7119
- function apply_filters( $tag, $value ) {
7120
- $this->_logger->entrance( $tag );
7121
-
7122
- $args = func_get_args();
7123
- array_unshift( $args, $this->_slug );
7124
-
7125
- return call_user_func_array( 'fs_apply_filter', $args );
7126
- }
7127
-
7128
- /**
7129
- * Add filter, specific for the current context plugin.
7130
- *
7131
- * @author Vova Feldman (@svovaf)
7132
- * @since 1.0.9
7133
- *
7134
- * @param string $tag
7135
- * @param callable $function_to_add
7136
- * @param int $priority
7137
- * @param int $accepted_args
7138
- *
7139
- * @uses add_filter()
7140
- */
7141
- function add_filter( $tag, $function_to_add, $priority = WP_FS__DEFAULT_PRIORITY, $accepted_args = 1 ) {
7142
- $this->_logger->entrance( $tag );
7143
-
7144
- add_filter( $this->get_action_tag( $tag ), $function_to_add, $priority, $accepted_args );
7145
- }
7146
-
7147
- /**
7148
- * Check if has filter.
7149
- *
7150
- * @author Vova Feldman (@svovaf)
7151
- * @since 1.1.4
7152
- *
7153
- * @param string $tag
7154
- * @param callable|bool $function_to_check Optional. The callback to check for. Default false.
7155
- *
7156
- * @return false|int
7157
- *
7158
- * @uses has_filter()
7159
- */
7160
- function has_filter( $tag, $function_to_check = false ) {
7161
- $this->_logger->entrance( $tag );
7162
-
7163
- return has_filter( $this->get_action_tag( $tag ), $function_to_check );
7164
- }
7165
-
7166
- /**
7167
- * Override default i18n text phrases.
7168
- *
7169
- * @author Vova Feldman (@svovaf)
7170
- * @since 1.1.6
7171
- *
7172
- * @param string[] string $key_value
7173
- *
7174
- * @uses fs_override_i18n()
7175
- */
7176
- function override_i18n( $key_value ) {
7177
- fs_override_i18n( $key_value, $this->_slug );
7178
- }
7179
-
7180
- /* Account Page
7181
- ------------------------------------------------------------------------------------------------------------------*/
7182
- /**
7183
- * Update site information.
7184
- *
7185
- * @author Vova Feldman (@svovaf)
7186
- * @since 1.0.1
7187
- *
7188
- * @param bool $store Flush to Database if true.
7189
- */
7190
- private function _store_site( $store = true ) {
7191
- $this->_logger->entrance();
7192
-
7193
- $encrypted_site = clone $this->_site;
7194
- $encrypted_site->plan = $this->_encrypt_entity( $this->_site->plan );
7195
-
7196
- $sites = self::get_all_sites();
7197
- $sites[ $this->_slug ] = $encrypted_site;
7198
- self::$_accounts->set_option( 'sites', $sites, $store );
7199
- }
7200
-
7201
- /**
7202
- * Update plugin's plans information.
7203
- *
7204
- * @author Vova Feldman (@svovaf)
7205
- * @since 1.0.2
7206
- *
7207
- * @param bool $store Flush to Database if true.
7208
- */
7209
- private function _store_plans( $store = true ) {
7210
- $this->_logger->entrance();
7211
-
7212
- $plans = self::get_all_plans();
7213
-
7214
- // Copy plans.
7215
- $encrypted_plans = array();
7216
- for ( $i = 0, $len = count( $this->_plans ); $i < $len; $i ++ ) {
7217
- $encrypted_plans[] = $this->_encrypt_entity( $this->_plans[ $i ] );
7218
- }
7219
-
7220
- $plans[ $this->_slug ] = $encrypted_plans;
7221
- self::$_accounts->set_option( 'plans', $plans, $store );
7222
- }
7223
-
7224
- /**
7225
- * Update user's plugin licenses.
7226
- *
7227
- * @author Vova Feldman (@svovaf)
7228
- * @since 1.0.5
7229
- *
7230
- * @param bool $store
7231
- * @param string|bool $plugin_slug
7232
- * @param FS_Plugin_License[] $licenses
7233
- */
7234
- private function _store_licenses( $store = true, $plugin_slug = false, $licenses = array() ) {
7235
- $this->_logger->entrance();
7236
-
7237
- $all_licenses = self::get_all_licenses();
7238
-
7239
- if ( ! is_string( $plugin_slug ) ) {
7240
- $plugin_slug = $this->_slug;
7241
- $licenses = $this->_licenses;
7242
- }
7243
-
7244
- if ( ! isset( $all_licenses[ $plugin_slug ] ) ) {
7245
- $all_licenses[ $plugin_slug ] = array();
7246
- }
7247
-
7248
- $all_licenses[ $plugin_slug ][ $this->_user->id ] = $licenses;
7249
-
7250
- self::$_accounts->set_option( 'licenses', $all_licenses, $store );
7251
- }
7252
-
7253
- /**
7254
- * Update user information.
7255
- *
7256
- * @author Vova Feldman (@svovaf)
7257
- * @since 1.0.1
7258
- *
7259
- * @param bool $store Flush to Database if true.
7260
- */
7261
- private function _store_user( $store = true ) {
7262
- $this->_logger->entrance();
7263
-
7264
- $users = self::get_all_users();
7265
- $users[ $this->_user->id ] = $this->_user;
7266
- self::$_accounts->set_option( 'users', $users, $store );
7267
- }
7268
-
7269
- /**
7270
- * Update new updates information.
7271
- *
7272
- * @author Vova Feldman (@svovaf)
7273
- * @since 1.0.4
7274
- *
7275
- * @param FS_Plugin_Tag|null $update
7276
- * @param bool $store Flush to Database if true.
7277
- * @param bool|number $plugin_id
7278
- */
7279
- private function _store_update( $update, $store = true, $plugin_id = false ) {
7280
- $this->_logger->entrance();
7281
-
7282
- if ( $update instanceof FS_Plugin_Tag ) {
7283
- $update->updated = time();
7284
- }
7285
-
7286
- if ( ! is_numeric( $plugin_id ) ) {
7287
- $plugin_id = $this->_plugin->id;
7288
- }
7289
-
7290
- $updates = self::get_all_updates();
7291
- $updates[ $plugin_id ] = $update;
7292
- self::$_accounts->set_option( 'updates', $updates, $store );
7293
- }
7294
-
7295
- /**
7296
- * Update new updates information.
7297
- *
7298
- * @author Vova Feldman (@svovaf)
7299
- * @since 1.0.6
7300
- *
7301
- * @param FS_Plugin[] $plugin_addons
7302
- * @param bool $store Flush to Database if true.
7303
- */
7304
- private function _store_addons( $plugin_addons, $store = true ) {
7305
- $this->_logger->entrance();
7306
-
7307
- $addons = self::get_all_addons();
7308
- $addons[ $this->_plugin->id ] = $plugin_addons;
7309
- self::$_accounts->set_option( 'addons', $addons, $store );
7310
- }
7311
-
7312
- /**
7313
- * Delete plugin's associated add-ons.
7314
- *
7315
- * @author Vova Feldman (@svovaf)
7316
- * @since 1.0.8
7317
- *
7318
- * @param bool $store
7319
- *
7320
- * @return bool
7321
- */
7322
- private function _delete_account_addons( $store = true ) {
7323
- $all_addons = self::get_all_account_addons();
7324
-
7325
- if ( ! isset( $all_addons[ $this->_plugin->id ] ) ) {
7326
- return false;
7327
- }
7328
-
7329
- unset( $all_addons[ $this->_plugin->id ] );
7330
-
7331
- self::$_accounts->set_option( 'account_addons', $all_addons, $store );
7332
-
7333
- return true;
7334
- }
7335
-
7336
- /**
7337
- * Update account add-ons list.
7338
- *
7339
- * @author Vova Feldman (@svovaf)
7340
- * @since 1.0.6
7341
- *
7342
- * @param FS_Plugin[] $addons
7343
- * @param bool $store Flush to Database if true.
7344
- */
7345
- private function _store_account_addons( $addons, $store = true ) {
7346
- $this->_logger->entrance();
7347
-
7348
- $all_addons = self::get_all_account_addons();
7349
- $all_addons[ $this->_plugin->id ] = $addons;
7350
- self::$_accounts->set_option( 'account_addons', $all_addons, $store );
7351
- }
7352
-
7353
- /**
7354
- * Store account params in the Database.
7355
- *
7356
- * @author Vova Feldman (@svovaf)
7357
- * @since 1.0.1
7358
- */
7359
- private function _store_account() {
7360
- $this->_logger->entrance();
7361
-
7362
- $this->_store_site( false );
7363
- $this->_store_user( false );
7364
- $this->_store_plans( false );
7365
- $this->_store_licenses( false );
7366
-
7367
- self::$_accounts->store();
7368
- }
7369
-
7370
- /**
7371
- * Sync user's information.
7372
- *
7373
- * @author Vova Feldman (@svovaf)
7374
- * @since 1.0.3
7375
- * @uses FS_Api
7376
- */
7377
- private function _handle_account_user_sync() {
7378
- $this->_logger->entrance();
7379
-
7380
- $api = $this->get_api_user_scope();
7381
-
7382
- // Get user's information.
7383
- $user = $api->get( '/', true );
7384
-
7385
- if ( isset( $user->id ) ) {
7386
- $this->_user->first = $user->first;
7387
- $this->_user->last = $user->last;
7388
- $this->_user->email = $user->email;
7389
-
7390
- $is_menu_item_account_visible = $this->_menu->is_submenu_item_visible( 'account' );
7391
-
7392
- if ( $user->is_verified &&
7393
- ( ! isset( $this->_user->is_verified ) || false === $this->_user->is_verified )
7394
- ) {
7395
- $this->_user->is_verified = true;
7396
-
7397
- $this->do_action( 'account_email_verified', $user->email );
7398
-
7399
- $this->_admin_notices->add(
7400
- __fs( 'email-verified-message', $this->_slug ),
7401
- __fs( 'right-on', $this->_slug ) . '!',
7402
- 'success',
7403
- // Make admin sticky if account menu item is invisible,
7404
- // since the page will be auto redirected to the plugin's
7405
- // main settings page, and the non-sticky message
7406
- // will disappear.
7407
- ! $is_menu_item_account_visible,
7408
- false,
7409
- 'email_verified'
7410
- );
7411
- }
7412
-
7413
- // Flush user details to DB.
7414
- $this->_store_user();
7415
-
7416
- $this->do_action( 'after_account_user_sync', $user );
7417
-
7418
- /**
7419
- * If account menu item is hidden, redirect to plugin's main settings page.
7420
- *
7421
- * @author Vova Feldman (@svovaf)
7422
- * @since 1.1.6
7423
- *
7424
- * @link https://github.com/Freemius/wordpress-sdk/issues/6
7425
- */
7426
- if ( ! $is_menu_item_account_visible ) {
7427
- if ( fs_redirect( $this->_get_admin_page_url() ) ) {
7428
- exit();
7429
- }
7430
- }
7431
- }
7432
- }
7433
-
7434
- /**
7435
- * @author Vova Feldman (@svovaf)
7436
- * @since 1.0.5
7437
- * @uses FS_Api
7438
- *
7439
- * @param bool $flush
7440
- *
7441
- * @return object|\FS_Site
7442
- */
7443
- private function _fetch_site( $flush = false ) {
7444
- $this->_logger->entrance();
7445
- $api = $this->get_api_site_scope();
7446
-
7447
- $site = $api->get( '/', $flush );
7448
-
7449
- if ( ! isset( $site->error ) ) {
7450
- $site = new FS_Site( $site );
7451
- $site->slug = $this->_slug;
7452
- $site->version = $this->get_plugin_version();
7453
- }
7454
-
7455
- return $site;
7456
- }
7457
-
7458
- /**
7459
- * @param bool $store
7460
- *
7461
- * @return FS_Plugin_Plan|object|false
7462
- */
7463
- private function _enrich_site_plan( $store = true ) {
7464
- // Try to load plan from local cache.
7465
- $plan = $this->_get_plan_by_id( $this->_site->plan->id );
7466
-
7467
- if ( false === $plan ) {
7468
- $plan = $this->_fetch_site_plan();
7469
- }
7470
-
7471
- if ( $plan instanceof FS_Plugin_Plan ) {
7472
- $this->_update_plan( $plan, $store );
7473
- }
7474
-
7475
- return $plan;
7476
- }
7477
-
7478
- /**
7479
- * @author Vova Feldman (@svovaf)
7480
- * @since 1.0.9
7481
- * @uses FS_Api
7482
- *
7483
- * @param bool $store
7484
- *
7485
- * @return FS_Plugin_Plan|object|false
7486
- */
7487
- private function _enrich_site_trial_plan( $store = true ) {
7488
- // Try to load plan from local cache.
7489
- $trial_plan = $this->_get_plan_by_id( $this->_site->trial_plan_id );
7490
-
7491
- if ( false === $trial_plan ) {
7492
- $trial_plan = $this->_fetch_site_plan( $this->_site->trial_plan_id );
7493
- }
7494
-
7495
- if ( $trial_plan instanceof FS_Plugin_Plan ) {
7496
- $this->_storage->store( 'trial_plan', $trial_plan, $store );
7497
- }
7498
-
7499
- return $trial_plan;
7500
- }
7501
-
7502
- /**
7503
- * @author Vova Feldman (@svovaf)
7504
- * @since 1.0.9
7505
- * @uses FS_Api
7506
- *
7507
- * @param number|bool $license_id
7508
- *
7509
- * @return FS_Subscription|object|bool
7510
- */
7511
- private function _fetch_site_license_subscription( $license_id = false ) {
7512
- $this->_logger->entrance();
7513
- $api = $this->get_api_site_scope();
7514
-
7515
- if ( ! is_numeric( $license_id ) ) {
7516
- $license_id = $this->_license->id;
7517
- }
7518
-
7519
- $result = $api->get( "/licenses/{$license_id}/subscriptions.json", true );
7520
-
7521
- return ! isset( $result->error ) ?
7522
- ( ( is_array( $result->subscriptions ) && 0 < count( $result->subscriptions ) ) ?
7523
- new FS_Subscription( $result->subscriptions[0] ) :
7524
- false
7525
- ) :
7526
- $result;
7527
- }
7528
-
7529
- /**
7530
- * @author Vova Feldman (@svovaf)
7531
- * @since 1.0.4
7532
- * @uses FS_Api
7533
- *
7534
- * @param number|bool $plan_id
7535
- *
7536
- * @return FS_Plugin_Plan|object
7537
- */
7538
- private function _fetch_site_plan( $plan_id = false ) {
7539
- $this->_logger->entrance();
7540
- $api = $this->get_api_site_scope();
7541
-
7542
- if ( ! is_numeric( $plan_id ) ) {
7543
- $plan_id = $this->_site->plan->id;
7544
- }
7545
-
7546
- $plan = $api->get( "/plans/{$plan_id}.json", true );
7547
-
7548
- return ! isset( $plan->error ) ? new FS_Plugin_Plan( $plan ) : $plan;
7549
- }
7550
-
7551
- /**
7552
- * @author Vova Feldman (@svovaf)
7553
- * @since 1.0.5
7554
- * @uses FS_Api
7555
- *
7556
- * @return FS_Plugin_Plan[]|object
7557
- */
7558
- private function _fetch_plugin_plans() {
7559
- $this->_logger->entrance();
7560
- $api = $this->get_api_site_scope();
7561
-
7562
- $result = $api->get( '/plans.json', true );
7563
-
7564
- if ( ! $this->is_api_error( $result ) ) {
7565
- for ( $i = 0, $len = count( $result->plans ); $i < $len; $i ++ ) {
7566
- $result->plans[ $i ] = new FS_Plugin_Plan( $result->plans[ $i ] );
7567
- }
7568
-
7569
- $result = $result->plans;
7570
- }
7571
-
7572
- return $result;
7573
- }
7574
-
7575
- /**
7576
- * @author Vova Feldman (@svovaf)
7577
- * @since 1.0.5
7578
- * @uses FS_Api
7579
- *
7580
- * @param number|bool $plugin_id
7581
- * @param number|bool $site_license_id
7582
- *
7583
- * @return FS_Plugin_License[]|object
7584
- */
7585
- private function _fetch_licenses( $plugin_id = false, $site_license_id = false ) {
7586
- $this->_logger->entrance();
7587
-
7588
- $api = $this->get_api_user_scope();
7589
-
7590
- if ( ! is_numeric( $plugin_id ) ) {
7591
- $plugin_id = $this->_plugin->id;
7592
- }
7593
-
7594
- $result = $api->get( "/plugins/{$plugin_id}/licenses.json", true );
7595
-
7596
- $is_site_license_synced = false;
7597
-
7598
- if ( ! isset( $result->error ) ) {
7599
- for ( $i = 0, $len = count( $result->licenses ); $i < $len; $i ++ ) {
7600
- $result->licenses[ $i ] = new FS_Plugin_License( $result->licenses[ $i ] );
7601
-
7602
- if ( ( ! $is_site_license_synced ) && is_numeric( $site_license_id ) ) {
7603
- $is_site_license_synced = ( $site_license_id == $result->licenses[ $i ]->id );
7604
- }
7605
- }
7606
-
7607
- $result = $result->licenses;
7608
- }
7609
-
7610
- if ( ! $is_site_license_synced ) {
7611
- $api = $this->get_api_site_scope();
7612
-
7613
- if ( is_numeric( $site_license_id ) ) {
7614
- // Try to retrieve a foreign license that is linked to the install.
7615
- $api_result = $api->call( '/licenses.json' );
7616
-
7617
- if ( ! isset( $api_result->error ) ) {
7618
- $licenses = $api_result->licenses;
7619
-
7620
- if ( ! empty( $licenses ) ) {
7621
- $result[] = new FS_Plugin_License( $licenses[0] );
7622
- }
7623
- }
7624
- } else if ( is_object( $this->_license ) ) {
7625
- // Fetch foreign license by ID and license key.
7626
- $license = $api->get( "/licenses/{$this->_license->id}.json?license_key=" .
7627
- urlencode( $this->_license->secret_key ) );
7628
-
7629
- if ( ! isset( $license->error ) ) {
7630
- $result[] = new FS_Plugin_License( $license );
7631
- }
7632
- }
7633
- }
7634
-
7635
- return $result;
7636
- }
7637
-
7638
- /**
7639
- * @author Vova Feldman (@svovaf)
7640
- * @since 1.2.0
7641
- * @uses FS_Api
7642
- *
7643
- * @param number|bool $plugin_id
7644
- *
7645
- * @return FS_Payment[]|object
7646
- */
7647
- function _fetch_payments( $plugin_id = false ) {
7648
- $this->_logger->entrance();
7649
-
7650
- $api = $this->get_api_user_scope();
7651
-
7652
- if ( ! is_numeric( $plugin_id ) ) {
7653
- $plugin_id = $this->_plugin->id;
7654
- }
7655
-
7656
- $result = $api->get( "/plugins/{$plugin_id}/payments.json", true );
7657
-
7658
- if ( ! isset( $result->error ) ) {
7659
- for ( $i = 0, $len = count( $result->payments ); $i < $len; $i ++ ) {
7660
- $result->payments[ $i ] = new FS_Payment( $result->payments[ $i ] );
7661
- }
7662
- $result = $result->payments;
7663
- }
7664
-
7665
- return $result;
7666
- }
7667
-
7668
- /**
7669
- * @author Vova Feldman (@svovaf)
7670
- * @since 1.0.4
7671
- *
7672
- * @param FS_Plugin_Plan $plan
7673
- * @param bool $store
7674
- */
7675
- private function _update_plan( $plan, $store = false ) {
7676
- $this->_logger->entrance();
7677
-
7678
- $this->_site->plan = $plan;
7679
- $this->_store_site( $store );
7680
- }
7681
-
7682
- /**
7683
- * @author Vova Feldman (@svovaf)
7684
- * @since 1.0.5
7685
- *
7686
- * @param FS_Plugin_License[] $licenses
7687
- * @param string|bool $plugin_slug
7688
- */
7689
- private function _update_licenses( $licenses, $plugin_slug = false ) {
7690
- $this->_logger->entrance();
7691
-
7692
- if ( is_array( $licenses ) ) {
7693
- for ( $i = 0, $len = count( $licenses ); $i < $len; $i ++ ) {
7694
- $licenses[ $i ]->updated = time();
7695
- }
7696
- }
7697
-
7698
- if ( ! is_string( $plugin_slug ) ) {
7699
- $this->_licenses = $licenses;
7700
- }
7701
-
7702
- $this->_store_licenses( true, $plugin_slug, $licenses );
7703
- }
7704
-
7705
- /**
7706
- * @author Vova Feldman (@svovaf)
7707
- * @since 1.0.4
7708
- *
7709
- * @param bool|number $plugin_id
7710
- * @param bool $flush Since 1.1.7.3
7711
- *
7712
- * @return object|false New plugin tag info if exist.
7713
- */
7714
- private function _fetch_newer_version( $plugin_id = false, $flush = true ) {
7715
- $latest_tag = $this->_fetch_latest_version( $plugin_id, $flush );
7716
-
7717
- if ( ! is_object( $latest_tag ) ) {
7718
- return false;
7719
- }
7720
-
7721
- // Check if version is actually newer.
7722
- $has_new_version =
7723
- // If it's an non-installed add-on then always return latest.
7724
- ( $this->_is_addon_id( $plugin_id ) && ! $this->is_addon_activated( $plugin_id ) ) ||
7725
- // Compare versions.
7726
- version_compare( $this->get_plugin_version(), $latest_tag->version, '<' );
7727
-
7728
- $this->_logger->departure( $has_new_version ? 'Found newer plugin version ' . $latest_tag->version : 'No new version' );
7729
-
7730
- return $has_new_version ? $latest_tag : false;
7731
- }
7732
-
7733
- /**
7734
- * @author Vova Feldman (@svovaf)
7735
- * @since 1.0.5
7736
- *
7737
- * @param bool|number $plugin_id
7738
- * @param bool $flush Since 1.1.7.3
7739
- *
7740
- * @return bool|FS_Plugin_Tag
7741
- */
7742
- function get_update( $plugin_id = false, $flush = true ) {
7743
- $this->_logger->entrance();
7744
-
7745
- if ( ! is_numeric( $plugin_id ) ) {
7746
- $plugin_id = $this->_plugin->id;
7747
- }
7748
-
7749
- $this->_check_updates( true, $plugin_id, $flush );
7750
- $updates = $this->get_all_updates();
7751
-
7752
- return isset( $updates[ $plugin_id ] ) && is_object( $updates[ $plugin_id ] ) ? $updates[ $plugin_id ] : false;
7753
- }
7754
-
7755
- /**
7756
- * Check if site assigned with active license.
7757
- *
7758
- * @author Vova Feldman (@svovaf)
7759
- * @since 1.0.6
7760
- */
7761
- function has_active_license() {
7762
- return (
7763
- is_object( $this->_license ) &&
7764
- is_numeric( $this->_license->id ) &&
7765
- ! $this->_license->is_expired()
7766
- );
7767
- }
7768
-
7769
- /**
7770
- * Check if site assigned with license with enabled features.
7771
- *
7772
- * @author Vova Feldman (@svovaf)
7773
- * @since 1.0.6
7774
- *
7775
- * @return bool
7776
- */
7777
- function has_features_enabled_license() {
7778
- return (
7779
- is_object( $this->_license ) &&
7780
- is_numeric( $this->_license->id ) &&
7781
- $this->_license->is_features_enabled()
7782
- );
7783
- }
7784
-
7785
- /**
7786
- * Check if user is a trial or have feature enabled license.
7787
- *
7788
- * @author Vova Feldman (@svovaf)
7789
- * @since 1.1.7
7790
- *
7791
- * @return bool
7792
- */
7793
- function can_use_premium_code() {
7794
- return $this->is_trial() || $this->has_features_enabled_license();
7795
- }
7796
-
7797
- /**
7798
- * Sync site's plan.
7799
- *
7800
- * @author Vova Feldman (@svovaf)
7801
- * @since 1.0.3
7802
- *
7803
- * @uses FS_Api
7804
- *
7805
- * @param bool $background Hints the method if it's a background sync. If false, it means that was initiated by
7806
- * the admin.
7807
- */
7808
- private function _sync_license( $background = false ) {
7809
- $this->_logger->entrance();
7810
-
7811
- $plugin_id = fs_request_get( 'plugin_id', $this->get_id() );
7812
-
7813
- $is_addon_sync = ( ! $this->_plugin->is_addon() && $plugin_id != $this->get_id() );
7814
-
7815
- if ( $is_addon_sync ) {
7816
- $this->_sync_addon_license( $plugin_id, $background );
7817
- } else {
7818
- $this->_sync_plugin_license( $background );
7819
- }
7820
-
7821
- $this->do_action( 'after_account_plan_sync', $this->_site->plan->name );
7822
- }
7823
-
7824
- /**
7825
- * Sync plugin's add-on license.
7826
- *
7827
- * @author Vova Feldman (@svovaf)
7828
- * @since 1.0.6
7829
- * @uses FS_Api
7830
- *
7831
- * @param number $addon_id
7832
- * @param bool $background
7833
- */
7834
- private function _sync_addon_license( $addon_id, $background ) {
7835
- $this->_logger->entrance();
7836
-
7837
- if ( $this->is_addon_activated( $addon_id ) ) {
7838
- // If already installed, use add-on sync.
7839
- $fs_addon = self::get_instance_by_id( $addon_id );
7840
- $fs_addon->_sync_license( $background );
7841
-
7842
- return;
7843
- }
7844
-
7845
- // Validate add-on exists.
7846
- $addon = $this->get_addon( $addon_id );
7847
-
7848
- if ( ! is_object( $addon ) ) {
7849
- return;
7850
- }
7851
-
7852
- // Add add-on into account add-ons.
7853
- $account_addons = $this->get_account_addons();
7854
- if ( ! is_array( $account_addons ) ) {
7855
- $account_addons = array();
7856
- }
7857
- $account_addons[] = $addon->id;
7858
- $account_addons = array_unique( $account_addons );
7859
- $this->_store_account_addons( $account_addons );
7860
-
7861
- // Load add-on licenses.
7862
- $licenses = $this->_fetch_licenses( $addon->id );
7863
-
7864
- // Sync add-on licenses.
7865
- if ( ! isset( $licenses->error ) ) {
7866
- $this->_update_licenses( $licenses, $addon->slug );
7867
-
7868
- if ( ! $this->is_addon_installed( $addon->slug ) && FS_License_Manager::has_premium_license( $licenses ) ) {
7869
- $plans_result = $this->get_api_site_or_plugin_scope()->get( "/addons/{$addon_id}/plans.json" );
7870
-
7871
- if ( ! isset( $plans_result->error ) ) {
7872
- $plans = array();
7873
- foreach ( $plans_result->plans as $plan ) {
7874
- $plans[] = new FS_Plugin_Plan( $plan );
7875
- }
7876
-
7877
- $this->_admin_notices->add_sticky(
7878
- FS_Plan_Manager::instance()->has_free_plan( $plans ) ?
7879
- sprintf(
7880
- __fs( 'addon-successfully-upgraded-message', $this->_slug ),
7881
- $addon->title
7882
- ) . ' ' . $this->_get_latest_download_link(
7883
- __fs( 'download-latest-version', $this->_slug ),
7884
- $addon_id
7885
- )
7886
- :
7887
- sprintf(
7888
- __fs( 'addon-successfully-purchased-message', $this->_slug ),
7889
- $addon->title
7890
- ) . ' ' . $this->_get_latest_download_link(
7891
- __fs( 'download-latest-version', $this->_slug ),
7892
- $addon_id
7893
- ),
7894
- 'addon_plan_upgraded_' . $addon->slug,
7895
- __fs( 'yee-haw', $this->_slug ) . '!'
7896
- );
7897
- }
7898
- }
7899
- }
7900
- }
7901
-
7902
- /**
7903
- * Sync site's plugin plan.
7904
- *
7905
- * @author Vova Feldman (@svovaf)
7906
- * @since 1.0.6
7907
- * @uses FS_Api
7908
- *
7909
- * @param bool $background Hints the method if it's a background sync. If false, it means that was initiated by
7910
- * the admin.
7911
- */
7912
- private function _sync_plugin_license( $background = false ) {
7913
- $this->_logger->entrance();
7914
-
7915
- // Sync site info.
7916
- $site = $this->send_install_update( array(), true );
7917
-
7918
- $plan_change = 'none';
7919
-
7920
- if ( $this->is_api_error( $site ) ) {
7921
- // Show API messages only if not background sync or if paying customer.
7922
- if ( ! $background || $this->is_paying() ) {
7923
- // Try to ping API to see if not blocked.
7924
- if ( ! FS_Api::test() ) {
7925
- /**
7926
- * Failed to ping API - blocked!
7927
- *
7928
- * @author Vova Feldman (@svovaf)
7929
- * @since 1.1.6 Only show message related to one of the Freemius powered plugins. Once it will be resolved it will fix the issue for all plugins anyways. There's no point to scare users with multiple error messages.
7930
- */
7931
- $api = $this->get_api_site_scope();
7932
-
7933
- if ( ! self::$_global_admin_notices->has_sticky( 'api_blocked' ) ) {
7934
- self::$_global_admin_notices->add(
7935
- sprintf(
7936
- __fs( 'server-blocking-access', $this->_slug ),
7937
- $this->get_plugin_name(),
7938
- '<a href="' . $api->get_url() . '" target="_blank">' . $api->get_url() . '</a>'
7939
- ) . '<br> ' . __fs( 'server-error-message', $this->_slug ) . var_export( $site->error, true ),
7940
- __fs( 'oops', $this->_slug ) . '...',
7941
- 'error',
7942
- $background,
7943
- false,
7944
- 'api_blocked'
7945
- );
7946
- }
7947
- } else {
7948
- // Authentication params are broken.
7949
- $this->_admin_notices->add(
7950
- __fs( 'wrong-authentication-param-message', $this->_slug ),
7951
- __fs( 'oops', $this->_slug ) . '...',
7952
- 'error'
7953
- );
7954
- }
7955
- }
7956
-
7957
- // No reason to continue with license sync while there are API issues.
7958
- return;
7959
- }
7960
-
7961
- // Remove sticky API connectivity message.
7962
- self::$_global_admin_notices->remove_sticky( 'api_blocked' );
7963
-
7964
- $site = new FS_Site( $site );
7965
-
7966
- // Sync plans.
7967
- $this->_sync_plans();
7968
-
7969
- if ( ! $this->has_paid_plan() ) {
7970
- $this->_site = $site;
7971
- $this->_enrich_site_plan( true );
7972
- $this->_store_site();
7973
- } else {
7974
- /**
7975
- * Sync licenses. Pass the site's license ID so that the foreign licenses will be fetched if the license
7976
- * associated with that ID is not included in the user's licenses collection.
7977
- */
7978
- $this->_sync_licenses( $site->license_id );
7979
-
7980
- // Check if plan / license changed.
7981
- if ( ! FS_Entity::equals( $site->plan, $this->_site->plan ) ||
7982
- // Check if trial started.
7983
- $site->trial_plan_id != $this->_site->trial_plan_id ||
7984
- $site->trial_ends != $this->_site->trial_ends ||
7985
- // Check if license changed.
7986
- $site->license_id != $this->_site->license_id
7987
- ) {
7988
- if ( $site->is_trial() && ( ! $this->_site->is_trial() || $site->trial_ends != $this->_site->trial_ends ) ) {
7989
- // New trial started.
7990
- $this->_site = $site;
7991
- $plan_change = 'trial_started';
7992
-
7993
- // Store trial plan information.
7994
- $this->_enrich_site_trial_plan( true );
7995
-
7996
- // For trial with subscription use-case.
7997
- $new_license = is_null( $site->license_id ) ? null : $this->_get_license_by_id( $site->license_id );
7998
-
7999
- if ( is_object( $new_license ) && ! $new_license->is_expired() ) {
8000
- $this->_site = $site;
8001
- $this->_update_site_license( $new_license );
8002
- $this->_store_licenses();
8003
- $this->_enrich_site_plan( true );
8004
-
8005
- $this->_sync_site_subscription( $this->_license );
8006
- }
8007
- } else if ( $this->_site->is_trial() && ! $site->is_trial() && ! is_numeric( $site->license_id ) ) {
8008
- // Was in trial, but now trial expired and no license ID.
8009
- // New trial started.
8010
- $this->_site = $site;
8011
- $plan_change = 'trial_expired';
8012
-
8013
- // Clear trial plan information.
8014
- $this->_storage->trial_plan = null;
8015
-
8016
- } else {
8017
- $is_free = $this->is_free_plan();
8018
-
8019
- // Make sure license exist and not expired.
8020
- $new_license = is_null( $site->license_id ) ?
8021
- null :
8022
- $this->_get_license_by_id( $site->license_id );
8023
-
8024
- if ( $is_free && is_null( $new_license ) && $this->has_any_license() && $this->_license->is_cancelled ) {
8025
- // License cancelled.
8026
- $this->_site = $site;
8027
- $this->_update_site_license( $new_license );
8028
- $this->_store_licenses();
8029
- $this->_enrich_site_plan( true );
8030
-
8031
- $plan_change = 'cancelled';
8032
- } else if ( $is_free && ( ( ! is_object( $new_license ) || $new_license->is_expired() ) ) ) {
8033
- // The license is expired, so ignore upgrade method.
8034
- } else {
8035
- // License changed.
8036
- $this->_site = $site;
8037
- $this->_update_site_license( $new_license );
8038
- $this->_store_licenses();
8039
- $this->_enrich_site_plan( true );
8040
-
8041
- $plan_change = $is_free ?
8042
- 'upgraded' :
8043
- ( is_object( $new_license ) ?
8044
- 'changed' :
8045
- 'downgraded' );
8046
- }
8047
- }
8048
-
8049
- // Store updated site info.
8050
- $this->_store_site();
8051
- } else {
8052
- if ( is_object( $this->_license ) && $this->_license->is_expired() ) {
8053
- if ( ! $this->has_features_enabled_license() ) {
8054
- $this->_deactivate_license();
8055
- $plan_change = 'downgraded';
8056
- } else {
8057
- $plan_change = 'expired';
8058
- }
8059
- }
8060
-
8061
- if ( is_numeric( $site->license_id ) && is_object( $this->_license ) ) {
8062
- $this->_sync_site_subscription( $this->_license );
8063
- }
8064
- }
8065
- }
8066
-
8067
- if ( $this->has_paid_plan() ) {
8068
- switch ( $plan_change ) {
8069
- case 'none':
8070
- if ( ! $background && is_admin() ) {
8071
- $plan = $this->is_trial() ?
8072
- $this->_storage->trial_plan :
8073
- $this->_site->plan;
8074
-
8075
- $this->_admin_notices->add(
8076
- sprintf(
8077
- __fs( 'plan-did-not-change-message', $this->_slug ) . ' ' .
8078
- sprintf(
8079
- '<a href="%s">%s</a>',
8080
- $this->contact_url(
8081
- 'bug',
8082
- sprintf( __fs( 'plan-did-not-change-email-message', $this->_slug ),
8083
- strtoupper( $plan->name )
8084
- )
8085
- ),
8086
- __fs( 'contact-us-here', $this->_slug )
8087
- ),
8088
- '<i><b>' . $plan->title . ( $this->is_trial() ? ' ' . __fs( 'trial', $this->_slug ) : '' ) . '</b></i>'
8089
- ),
8090
- __fs( 'hmm', $this->_slug ) . '...'
8091
- );
8092
- }
8093
- break;
8094
- case 'upgraded':
8095
- $this->_admin_notices->add_sticky(
8096
- sprintf(
8097
- __fs( 'plan-upgraded-message', $this->_slug ),
8098
- '<i>' . $this->get_plugin_name() . '</i>'
8099
- ) . ( $this->is_premium() ? '' : ' ' . $this->_get_latest_download_link( sprintf(
8100
- __fs( 'download-latest-x-version', $this->_slug ),
8101
- $this->_site->plan->title
8102
- ) )
8103
- ),
8104
- 'plan_upgraded',
8105
- __fs( 'yee-haw', $this->_slug ) . '!'
8106
- );
8107
-
8108
- $this->_admin_notices->remove_sticky( array(
8109
- 'trial_started',
8110
- 'trial_promotion',
8111
- 'trial_expired',
8112
- 'activation_complete',
8113
- ) );
8114
- break;
8115
- case 'changed':
8116
- $this->_admin_notices->add_sticky(
8117
- sprintf(
8118
- __fs( 'plan-changed-to-x-message', $this->_slug ),
8119
- $this->_site->plan->title
8120
- ),
8121
- 'plan_changed'
8122
- );
8123
-
8124
- $this->_admin_notices->remove_sticky( array(
8125
- 'trial_started',
8126
- 'trial_promotion',
8127
- 'trial_expired',
8128
- 'activation_complete',
8129
- ) );
8130
- break;
8131
- case 'downgraded':
8132
- $this->_admin_notices->add_sticky(
8133
- sprintf( __fs( 'license-expired-blocking-message', $this->_slug ) ),
8134
- 'license_expired',
8135
- __fs( 'hmm', $this->_slug ) . '...'
8136
- );
8137
- $this->_admin_notices->remove_sticky( 'plan_upgraded' );
8138
- break;
8139
- case 'cancelled':
8140
- $this->_admin_notices->add(
8141
- __fs( 'license-cancelled', $this->_slug ) . ' ' .
8142
- sprintf(
8143
- '<a href="%s">%s</a>',
8144
- $this->contact_url( 'bug' ),
8145
- __fs( 'contact-us-here', $this->_slug )
8146
- ),
8147
- __fs( 'hmm', $this->_slug ) . '...',
8148
- 'error'
8149
- );
8150
- $this->_admin_notices->remove_sticky( 'plan_upgraded' );
8151
- break;
8152
- case 'expired':
8153
- $this->_admin_notices->add_sticky(
8154
- sprintf( __fs( 'license-expired-non-blocking-message', $this->_slug ), $this->_site->plan->title ),
8155
- 'license_expired',
8156
- __fs( 'hmm', $this->_slug ) . '...'
8157
- );
8158
- $this->_admin_notices->remove_sticky( 'plan_upgraded' );
8159
- break;
8160
- case 'trial_started':
8161
- $this->_admin_notices->add_sticky(
8162
- sprintf(
8163
- __fs( 'trial-started-message', $this->_slug ),
8164
- '<i>' . $this->get_plugin_name() . '</i>'
8165
- ) . ( $this->is_premium() ? '' : ' ' . $this->_get_latest_download_link( sprintf(
8166
- __fs( 'download-latest-x-version', $this->_slug ),
8167
- $this->_storage->trial_plan->title
8168
- ) ) ),
8169
- 'trial_started',
8170
- __fs( 'yee-haw', $this->_slug ) . '!'
8171
- );
8172
-
8173
- $this->_admin_notices->remove_sticky( array(
8174
- 'trial_promotion',
8175
- ) );
8176
- break;
8177
- case 'trial_expired':
8178
- $this->_admin_notices->add_sticky(
8179
- __fs( 'trial-expired-message', $this->_slug ),
8180
- 'trial_expired',
8181
- __fs( 'hmm', $this->_slug ) . '...'
8182
- );
8183
- $this->_admin_notices->remove_sticky( array(
8184
- 'trial_started',
8185
- 'trial_promotion',
8186
- 'plan_upgraded',
8187
- ) );
8188
- break;
8189
- }
8190
- }
8191
-
8192
- if ( 'none' !== $plan_change ) {
8193
- $this->do_action( 'after_license_change', $plan_change, $this->_site->plan );
8194
- }
8195
- }
8196
-
8197
- /**
8198
- * @author Vova Feldman (@svovaf)
8199
- * @since 1.0.5
8200
- *
8201
- * @param bool $background
8202
- */
8203
- protected function _activate_license( $background = false ) {
8204
- $this->_logger->entrance();
8205
-
8206
- $license_id = fs_request_get( 'license_id' );
8207
-
8208
- if ( FS_Plugin_License::is_valid_id( $license_id ) && $license_id == $this->_site->license_id ) {
8209
- // License is already activated.
8210
- return;
8211
- }
8212
-
8213
- $premium_license = FS_Plugin_License::is_valid_id( $license_id ) ?
8214
- $this->_get_license_by_id( $license_id ) :
8215
- $this->_get_available_premium_license();
8216
-
8217
- if ( ! is_object( $premium_license ) ) {
8218
- return;
8219
- }
8220
-
8221
- /**
8222
- * If the premium license is already associated with the install, just
8223
- * update the license reference (activation is not required).
8224
- *
8225
- * @since 1.1.9
8226
- */
8227
- if ( $premium_license->id == $this->_site->license_id ) {
8228
- // License is already activated.
8229
- $this->_update_site_license( $premium_license );
8230
- $this->_enrich_site_plan( false );
8231
- $this->_store_account();
8232
-
8233
- return;
8234
- }
8235
-
8236
- if ( $this->_site->user_id != $premium_license->user_id ) {
8237
- $api_request_params = array( 'license_key' => $premium_license->secret_key );
8238
- } else {
8239
- $api_request_params = array();
8240
- }
8241
-
8242
- $api = $this->get_api_site_scope();
8243
- $license = $api->call( "/licenses/{$premium_license->id}.json", 'put', $api_request_params );
8244
-
8245
- if ( $this->is_api_error( $license ) ) {
8246
- if ( ! $background ) {
8247
- $this->_admin_notices->add(
8248
- __fs( 'license-activation-failed-message', $this->_slug ) . '<br> ' .
8249
- __fs( 'server-error-message', $this->_slug ) . ' ' . var_export( $license, true ),
8250
- __fs( 'hmm', $this->_slug ) . '...',
8251
- 'error'
8252
- );
8253
- }
8254
-
8255
- return;
8256
- }
8257
-
8258
- $premium_license = new FS_Plugin_License( $license );
8259
-
8260
- // Updated site plan.
8261
- $site = $this->get_api_site_scope()->get( '/', true );
8262
- if ( ! $this->is_api_error( $site ) ) {
8263
- $this->_site = new FS_Site( $site );
8264
- }
8265
- $this->_update_site_license( $premium_license );
8266
- $this->_enrich_site_plan( false );
8267
-
8268
- $this->_store_account();
8269
-
8270
- if ( ! $background ) {
8271
- $this->_admin_notices->add_sticky(
8272
- __fs( 'license-activated-message', $this->_slug ) .
8273
- ( $this->is_premium() ? '' : ' ' . $this->_get_latest_download_link( sprintf(
8274
- __fs( 'download-latest-x-version', $this->_slug ),
8275
- $this->_site->plan->title
8276
- ) ) ),
8277
- 'license_activated',
8278
- __fs( 'yee-haw', $this->_slug ) . '!'
8279
- );
8280
- }
8281
-
8282
- $this->_admin_notices->remove_sticky( array(
8283
- 'trial_promotion',
8284
- 'license_expired',
8285
- ) );
8286
- }
8287
-
8288
- /**
8289
- * @author Vova Feldman (@svovaf)
8290
- * @since 1.0.5
8291
- *
8292
- * @param bool $show_notice
8293
- */
8294
- protected function _deactivate_license( $show_notice = true ) {
8295
- $this->_logger->entrance();
8296
-
8297
- if ( ! is_object( $this->_license ) ) {
8298
- $this->_admin_notices->add(
8299
- sprintf( __fs( 'no-active-license-message', $this->_slug ), $this->_site->plan->title ),
8300
- __fs( 'hmm', $this->_slug ) . '...'
8301
- );
8302
-
8303
- return;
8304
- }
8305
-
8306
- $api = $this->get_api_site_scope();
8307
- $license = $api->call( "/licenses/{$this->_site->license_id}.json", 'delete' );
8308
-
8309
- if ( isset( $license->error ) ) {
8310
- $this->_admin_notices->add(
8311
- __fs( 'license-deactivation-failed-message', $this->_slug ) . '<br> ' .
8312
- __fs( 'server-error-message', $this->_slug ) . ' ' . var_export( $license->error, true ),
8313
- __fs( 'hmm', $this->_slug ) . '...',
8314
- 'error'
8315
- );
8316
-
8317
- return;
8318
- }
8319
-
8320
- // Update license cache.
8321
- for ( $i = 0, $len = count( $this->_licenses ); $i < $len; $i ++ ) {
8322
- if ( $license->id == $this->_licenses[ $i ]->id ) {
8323
- $this->_licenses[ $i ] = new FS_Plugin_License( $license );
8324
- }
8325
- }
8326
-
8327
- // Updated site plan to default.
8328
- $this->_sync_plans();
8329
- $this->_site->plan->id = $this->_plans[0]->id;
8330
- // Unlink license from site.
8331
- $this->_update_site_license( null );
8332
- $this->_enrich_site_plan( false );
8333
-
8334
- $this->_store_account();
8335
-
8336
- if ( $show_notice ) {
8337
- $this->_admin_notices->add(
8338
- sprintf( __fs( 'license-deactivation-message', $this->_slug ), $this->_site->plan->title ),
8339
- __fs( 'ok', $this->_slug )
8340
- );
8341
- }
8342
-
8343
- $this->_admin_notices->remove_sticky( array(
8344
- 'plan_upgraded',
8345
- 'license_activated',
8346
- ) );
8347
- }
8348
-
8349
- /**
8350
- * Site plan downgrade.
8351
- *
8352
- * @author Vova Feldman (@svovaf)
8353
- * @since 1.0.4
8354
- *
8355
- * @uses FS_Api
8356
- */
8357
- private function _downgrade_site() {
8358
- $this->_logger->entrance();
8359
-
8360
- $api = $this->get_api_site_scope();
8361
- $site = $api->call( 'downgrade.json', 'put' );
8362
-
8363
- $plan_downgraded = false;
8364
- $plan = false;
8365
- if ( ! isset( $site->error ) ) {
8366
- $prev_plan_id = $this->_site->plan->id;
8367
-
8368
- // Update new site plan id.
8369
- $this->_site->plan->id = $site->plan_id;
8370
-
8371
- $plan = $this->_enrich_site_plan();
8372
- $subscription = $this->_sync_site_subscription( $this->_license );
8373
-
8374
- // Plan downgraded if plan was changed or subscription was cancelled.
8375
- $plan_downgraded = ( $plan instanceof FS_Plugin_Plan && $prev_plan_id != $plan->id ) ||
8376
- ( is_object( $subscription ) && ! isset( $subscription->error ) && ! $subscription->is_active() );
8377
- } else {
8378
- // handle different error cases.
8379
-
8380
- }
8381
-
8382
- if ( $plan_downgraded ) {
8383
- // Remove previous sticky message about upgrade (if exist).
8384
- $this->_admin_notices->remove_sticky( 'plan_upgraded' );
8385
-
8386
- $this->_admin_notices->add(
8387
- sprintf( __fs( 'plan-x-downgraded-message', $this->_slug ),
8388
- $plan->title,
8389
- human_time_diff( time(), strtotime( $this->_license->expiration ) )
8390
- )
8391
- );
8392
-
8393
- // Store site updates.
8394
- $this->_store_site();
8395
- } else {
8396
- $this->_admin_notices->add(
8397
- __fs( 'plan-downgraded-failure-message', $this->_slug ),
8398
- __fs( 'oops', $this->_slug ) . '...',
8399
- 'error'
8400
- );
8401
- }
8402
- }
8403
-
8404
- /**
8405
- * @author Vova Feldman (@svovaf)
8406
- * @since 1.1.8.1
8407
- *
8408
- * @param bool|string $plan_name
8409
- *
8410
- * @return bool If trial was successfully started.
8411
- */
8412
- function start_trial( $plan_name = false ) {
8413
- $this->_logger->entrance();
8414
-
8415
- if ( $this->is_trial() ) {
8416
- // Already in trial mode.
8417
- $this->_admin_notices->add(
8418
- __fs( 'in-trial-mode', $this->_slug ),
8419
- __fs( 'oops', $this->_slug ) . '...',
8420
- 'error'
8421
- );
8422
-
8423
- return false;
8424
- }
8425
-
8426
- if ( $this->_site->is_trial_utilized() ) {
8427
- // Trial was already utilized.
8428
- $this->_admin_notices->add(
8429
- __fs( 'trial-utilized', $this->_slug ),
8430
- __fs( 'oops', $this->_slug ) . '...',
8431
- 'error'
8432
- );
8433
-
8434
- return false;
8435
- }
8436
-
8437
- if ( false !== $plan_name ) {
8438
- $plan = $this->get_plan_by_name( $plan_name );
8439
-
8440
- if ( false === $plan ) {
8441
- // Plan doesn't exist.
8442
- $this->_admin_notices->add(
8443
- sprintf( __fs( 'trial-plan-x-not-exist', $this->_slug ), $plan_name ),
8444
- __fs( 'oops', $this->_slug ) . '...',
8445
- 'error'
8446
- );
8447
-
8448
- return false;
8449
- }
8450
-
8451
- if ( ! $plan->has_trial() ) {
8452
- // Plan doesn't exist.
8453
- $this->_admin_notices->add(
8454
- sprintf( __fs( 'plan-x-no-trial', $this->_slug ), $plan_name ),
8455
- __fs( 'oops', $this->_slug ) . '...',
8456
- 'error'
8457
- );
8458
-
8459
- return false;
8460
- }
8461
- } else {
8462
- if ( ! $this->has_trial_plan() ) {
8463
- // None of the plans have a trial.
8464
- $this->_admin_notices->add(
8465
- __fs( 'no-trials', $this->_slug ),
8466
- __fs( 'oops', $this->_slug ) . '...',
8467
- 'error'
8468
- );
8469
-
8470
- return false;
8471
- }
8472
-
8473
- $plans_with_trial = FS_Plan_Manager::instance()->get_trial_plans( $this->_plans );
8474
-
8475
- $plan = $plans_with_trial[0];
8476
- }
8477
-
8478
- $api = $this->get_api_site_scope();
8479
- $plan = $api->call( "plans/{$plan->id}/trials.json", 'post' );
8480
-
8481
- if ( $this->is_api_error( $plan ) ) {
8482
- // Some API error while trying to start the trial.
8483
- $this->_admin_notices->add(
8484
- __fs( 'unexpected-api-error', $this->_slug ) . ' ' . var_export( $plan, true ),
8485
- __fs( 'oops', $this->_slug ) . '...',
8486
- 'error'
8487
- );
8488
-
8489
- return false;
8490
- }
8491
-
8492
- // Sync license.
8493
- $this->_sync_license();
8494
-
8495
- return $this->is_trial();
8496
- }
8497
-
8498
- /**
8499
- * Cancel site trial.
8500
- *
8501
- * @author Vova Feldman (@svovaf)
8502
- * @since 1.0.9
8503
- *
8504
- * @uses FS_Api
8505
- */
8506
- private function _cancel_trial() {
8507
- $this->_logger->entrance();
8508
-
8509
- if ( ! $this->is_trial() ) {
8510
- $this->_admin_notices->add(
8511
- __fs( 'trial-cancel-no-trial-message', $this->_slug ),
8512
- __fs( 'oops', $this->_slug ) . '...',
8513
- 'error'
8514
- );
8515
-
8516
- return;
8517
- }
8518
-
8519
- $api = $this->get_api_site_scope();
8520
- $site = $api->call( 'trials.json', 'delete' );
8521
-
8522
- $trial_cancelled = false;
8523
-
8524
- if ( ! $this->is_api_error( $site ) ) {
8525
- $prev_trial_ends = $this->_site->trial_ends;
8526
-
8527
- if ( $this->is_paid_trial() ) {
8528
- $this->_license->expiration = $site->trial_ends;
8529
- $this->_license->is_cancelled = true;
8530
- $this->_update_site_license( $this->_license );
8531
- $this->_store_licenses();
8532
-
8533
- // Clear subscription reference.
8534
- $this->_sync_site_subscription( null );
8535
- }
8536
-
8537
- // Update site info.
8538
- $this->_site = new FS_Site( $site );
8539
- $this->_enrich_site_plan();
8540
-
8541
- $trial_cancelled = ( $prev_trial_ends != $site->trial_ends );
8542
- } else {
8543
- // handle different error cases.
8544
-
8545
- }
8546
-
8547
- if ( $trial_cancelled ) {
8548
- // Remove previous sticky messages about upgrade or trial (if exist).
8549
- $this->_admin_notices->remove_sticky( array(
8550
- 'trial_started',
8551
- 'trial_promotion',
8552
- 'plan_upgraded',
8553
- ) );
8554
-
8555
- // Store site updates.
8556
- $this->_store_site();
8557
-
8558
- // Clear trial plan information.
8559
- unset( $this->_storage->trial_plan );
8560
-
8561
- if ( ! $this->is_addon() ||
8562
- ! $this->deactivate_premium_only_addon_without_license( true )
8563
- ) {
8564
- $this->_admin_notices->add(
8565
- sprintf( __fs( 'trial-cancel-message', $this->_slug ), $this->_storage->trial_plan->title )
8566
- );
8567
- }
8568
- } else {
8569
- $this->_admin_notices->add(
8570
- __fs( 'trial-cancel-failure-message', $this->_slug ),
8571
- __fs( 'oops', $this->_slug ) . '...',
8572
- 'error'
8573
- );
8574
- }
8575
- }
8576
-
8577
- /**
8578
- * @author Vova Feldman (@svovaf)
8579
- * @since 1.0.6
8580
- *
8581
- * @param bool|number $plugin_id
8582
- *
8583
- * @return bool
8584
- */
8585
- private function _is_addon_id( $plugin_id ) {
8586
- return is_numeric( $plugin_id ) && ( $this->get_id() != $plugin_id );
8587
- }
8588
-
8589
- /**
8590
- * Check if user eligible to download premium version updates.
8591
- *
8592
- * @author Vova Feldman (@svovaf)
8593
- * @since 1.0.6
8594
- *
8595
- * @return bool
8596
- */
8597
- private function _can_download_premium() {
8598
- return $this->has_active_license() ||
8599
- ( $this->is_trial() && ! $this->get_trial_plan()->is_free() );
8600
- }
8601
-
8602
- /**
8603
- *
8604
- * @author Vova Feldman (@svovaf)
8605
- * @since 1.0.6
8606
- *
8607
- * @param bool|number $addon_id
8608
- * @param string $type "json" or "zip"
8609
- *
8610
- * @return string
8611
- */
8612
- private function _get_latest_version_endpoint( $addon_id = false, $type = 'json' ) {
8613
-
8614
- $is_addon = $this->_is_addon_id( $addon_id );
8615
-
8616
- $is_premium = null;
8617
- if ( ! $is_addon ) {
8618
- $is_premium = $this->_can_download_premium();
8619
- } else if ( $this->is_addon_activated( $addon_id ) ) {
8620
- $is_premium = self::get_instance_by_id( $addon_id )->_can_download_premium();
8621
- }
8622
-
8623
- return // If add-on, then append add-on ID.
8624
- ( $is_addon ? "/addons/$addon_id" : '' ) .
8625
- '/updates/latest.' . $type .
8626
- // If add-on and not yet activated, try to fetch based on server licensing.
8627
- ( is_bool( $is_premium ) ? '?is_premium=' . json_encode( $is_premium ) : '' );
8628
- }
8629
-
8630
- /**
8631
- * @author Vova Feldman (@svovaf)
8632
- * @since 1.0.4
8633
- *
8634
- * @param bool|number $addon_id
8635
- * @param bool $flush Since 1.1.7.3
8636
- *
8637
- * @return object|false Plugin latest tag info.
8638
- */
8639
- function _fetch_latest_version( $addon_id = false, $flush = true ) {
8640
- $this->_logger->entrance();
8641
-
8642
- /**
8643
- * @since 1.1.7.3 Check for plugin updates from Freemius only if opted-in.
8644
- * @since 1.1.7.4 Also check updates for add-ons.
8645
- */
8646
- if ( ! $this->is_registered() &&
8647
- ! $this->_is_addon_id( $addon_id )
8648
- ) {
8649
- return false;
8650
- }
8651
-
8652
- $tag = $this->get_api_site_or_plugin_scope()->get(
8653
- $this->_get_latest_version_endpoint( $addon_id, 'json' ),
8654
- $flush
8655
- );
8656
-
8657
- $latest_version = ( is_object( $tag ) && isset( $tag->version ) ) ? $tag->version : 'couldn\'t get';
8658
-
8659
- $this->_logger->departure( 'Latest version ' . $latest_version );
8660
-
8661
- return ( is_object( $tag ) && isset( $tag->version ) ) ? $tag : false;
8662
- }
8663
-
8664
- #region Download Plugin ------------------------------------------------------------------
8665
-
8666
- /**
8667
- * Download latest plugin version, based on plan.
8668
- * The download will be fetched via the API first.
8669
- *
8670
- * @author Vova Feldman (@svovaf)
8671
- * @since 1.0.4
8672
- *
8673
- * @param bool|number $plugin_id
8674
- *
8675
- * @uses FS_Api
8676
- *
8677
- * @deprecated
8678
- */
8679
- private function _download_latest( $plugin_id = false ) {
8680
- $this->_logger->entrance();
8681
-
8682
- $is_addon = $this->_is_addon_id( $plugin_id );
8683
-
8684
- $is_premium = $this->_can_download_premium();
8685
-
8686
- $latest = $this->get_api_site_scope()->call(
8687
- $this->_get_latest_version_endpoint( $plugin_id, 'zip' )
8688
- );
8689
-
8690
- $slug = $this->_slug;
8691
- if ( $is_addon ) {
8692
- $addon = $this->get_addon( $plugin_id );
8693
- $slug = is_object( $addon ) ? $addon->slug : 'addon';
8694
- }
8695
-
8696
- if ( ! is_object( $latest ) ) {
8697
- header( "Content-Type: application/zip" );
8698
- header( "Content-Disposition: attachment; filename={$slug}" . ( ! $is_addon && $is_premium ? '-premium' : '' ) . ".zip" );
8699
- header( "Content-Length: " . strlen( $latest ) );
8700
- echo $latest;
8701
-
8702
- exit();
8703
- }
8704
- }
8705
-
8706
- /**
8707
- * Download latest plugin version, based on plan.
8708
- *
8709
- * Not like _download_latest(), this will redirect the page
8710
- * to secure download url to prevent dual download (from FS to WP server,
8711
- * and then from WP server to the client / browser).
8712
- *
8713
- * @author Vova Feldman (@svovaf)
8714
- * @since 1.0.9
8715
- *
8716
- * @param bool|number $plugin_id
8717
- *
8718
- * @uses FS_Api
8719
- * @uses wp_redirect()
8720
- */
8721
- private function _download_latest_directly( $plugin_id = false ) {
8722
- $this->_logger->entrance();
8723
-
8724
- wp_redirect( $this->_get_latest_download_api_url( $plugin_id ) );
8725
- }
8726
-
8727
- /**
8728
- * Get latest plugin FS API download URL.
8729
- *
8730
- * @author Vova Feldman (@svovaf)
8731
- * @since 1.0.9
8732
- *
8733
- * @param bool|number $plugin_id
8734
- *
8735
- * @return string
8736
- */
8737
- private function _get_latest_download_api_url( $plugin_id = false ) {
8738
- $this->_logger->entrance();
8739
-
8740
- return $this->get_api_site_scope()->get_signed_url(
8741
- $this->_get_latest_version_endpoint( $plugin_id, 'zip' )
8742
- );
8743
- }
8744
-
8745
- /**
8746
- * Get payment invoice URL.
8747
- *
8748
- * @author Vova Feldman (@svovaf)
8749
- * @since 1.2.0
8750
- *
8751
- * @param bool|number $payment_id
8752
- *
8753
- * @return string
8754
- */
8755
- function _get_invoice_api_url( $payment_id = false ) {
8756
- $this->_logger->entrance();
8757
-
8758
- return $this->get_api_user_scope()->get_signed_url(
8759
- "/payments/{$payment_id}/invoice.pdf"
8760
- );
8761
- }
8762
-
8763
- /**
8764
- * Get latest plugin download link.
8765
- *
8766
- * @author Vova Feldman (@svovaf)
8767
- * @since 1.0.9
8768
- *
8769
- * @param string $label
8770
- * @param bool|number $plugin_id
8771
- *
8772
- * @return string
8773
- */
8774
- private function _get_latest_download_link( $label, $plugin_id = false ) {
8775
- return sprintf(
8776
- '<a target="_blank" href="%s">%s</a>',
8777
- $this->_get_latest_download_local_url( $plugin_id ),
8778
- $label
8779
- );
8780
- }
8781
-
8782
- /**
8783
- * Get latest plugin download local URL.
8784
- *
8785
- * @author Vova Feldman (@svovaf)
8786
- * @since 1.0.9
8787
- *
8788
- * @param bool|number $plugin_id
8789
- *
8790
- * @return string
8791
- */
8792
- function _get_latest_download_local_url( $plugin_id = false ) {
8793
- // Add timestamp to protect from caching.
8794
- $params = array( 'ts' => WP_FS__SCRIPT_START_TIME );
8795
-
8796
- if ( ! empty( $plugin_id ) ) {
8797
- $params['plugin_id'] = $plugin_id;
8798
- }
8799
-
8800
- return $this->get_account_url( 'download_latest', $params );
8801
- }
8802
-
8803
- #endregion Download Plugin ------------------------------------------------------------------
8804
-
8805
- /**
8806
- * @author Vova Feldman (@svovaf)
8807
- * @since 1.0.4
8808
- *
8809
- * @uses FS_Api
8810
- *
8811
- * @param bool $background Hints the method if it's a background updates check. If false, it means that
8812
- * was initiated by the admin.
8813
- * @param bool|number $plugin_id
8814
- * @param bool $flush Since 1.1.7.3
8815
- */
8816
- private function _check_updates( $background = false, $plugin_id = false, $flush = true ) {
8817
- $this->_logger->entrance();
8818
-
8819
- // Check if there's a newer version for download.
8820
- $new_version = $this->_fetch_newer_version( $plugin_id, $flush );
8821
-
8822
- $update = null;
8823
- if ( is_object( $new_version ) ) {
8824
- $update = new FS_Plugin_Tag( $new_version );
8825
-
8826
- if ( ! $background ) {
8827
- $this->_admin_notices->add(
8828
- sprintf(
8829
- __fs( 'version-x-released', $this->_slug ) . ' ' . __fs( 'please-download-x', $this->_slug ),
8830
- $update->version,
8831
- sprintf(
8832
- '<a href="%s" target="_blank">%s</a>',
8833
- $this->get_account_url( 'download_latest' ),
8834
- sprintf( __fs( 'latest-x-version', $this->_slug ), $this->_site->plan->title )
8835
- )
8836
- ),
8837
- __fs( 'new', $this->_slug ) . '!'
8838
- );
8839
- }
8840
- } else if ( false === $new_version && ! $background ) {
8841
- $this->_admin_notices->add(
8842
- __fs( 'you-have-latest', $this->_slug ),
8843
- __fs( 'you-are-good', $this->_slug )
8844
- );
8845
- }
8846
-
8847
- $this->_store_update( $update, true, $plugin_id );
8848
- }
8849
-
8850
- /**
8851
- * @author Vova Feldman (@svovaf)
8852
- * @since 1.0.4
8853
- *
8854
- * @param bool $flush Since 1.1.7.3 by default add 24 hour cache.
8855
- *
8856
- * @return FS_Plugin[]
8857
- *
8858
- * @uses FS_Api
8859
- */
8860
- private function _sync_addons( $flush = false ) {
8861
- $this->_logger->entrance();
8862
-
8863
- $result = $this->get_api_site_or_plugin_scope()->get( '/addons.json?enriched=true', $flush );
8864
-
8865
- $addons = array();
8866
- if ( ! $this->is_api_error( $result ) ) {
8867
- for ( $i = 0, $len = count( $result->plugins ); $i < $len; $i ++ ) {
8868
- $addons[ $i ] = new FS_Plugin( $result->plugins[ $i ] );
8869
- }
8870
-
8871
- $this->_store_addons( $addons, true );
8872
- }
8873
-
8874
- return $addons;
8875
- }
8876
-
8877
- /**
8878
- * Handle user email update.
8879
- *
8880
- * @author Vova Feldman (@svovaf)
8881
- * @since 1.0.3
8882
- * @uses FS_Api
8883
- *
8884
- * @param string $new_email
8885
- *
8886
- * @return object
8887
- */
8888
- private function _update_email( $new_email ) {
8889
- $this->_logger->entrance();
8890
-
8891
-
8892
- $api = $this->get_api_user_scope();
8893
- $user = $api->call( "?plugin_id={$this->_plugin->id}&fields=id,email,is_verified", 'put', array(
8894
- 'email' => $new_email,
8895
- 'after_email_confirm_url' => $this->_get_admin_page_url(
8896
- 'account',
8897
- array( 'fs_action' => 'sync_user' )
8898
- ),
8899
- ) );
8900
-
8901
- if ( ! isset( $user->error ) ) {
8902
- $this->_user->email = $user->email;
8903
- $this->_user->is_verified = $user->is_verified;
8904
- $this->_store_user();
8905
- } else {
8906
- // handle different error cases.
8907
-
8908
- }
8909
-
8910
- return $user;
8911
- }
8912
-
8913
- /**
8914
- * @author Vova Feldman (@svovaf)
8915
- * @since 1.1.1
8916
- *
8917
- * @param mixed $result
8918
- *
8919
- * @return bool Is API result contains an error.
8920
- */
8921
- private function is_api_error( $result ) {
8922
- return ( is_object( $result ) && isset( $result->error ) ) ||
8923
- is_string( $result );
8924
- }
8925
-
8926
- /**
8927
- * Start install ownership change.
8928
- *
8929
- * @author Vova Feldman (@svovaf)
8930
- * @since 1.1.1
8931
- * @uses FS_Api
8932
- *
8933
- * @param string $candidate_email
8934
- *
8935
- * @return bool Is ownership change successfully initiated.
8936
- */
8937
- private function init_change_owner( $candidate_email ) {
8938
- $this->_logger->entrance();
8939
-
8940
- $api = $this->get_api_site_scope();
8941
- $result = $api->call( "/users/{$this->_user->id}.json", 'put', array(
8942
- 'email' => $candidate_email,
8943
- 'after_confirm_url' => $this->_get_admin_page_url(
8944
- 'account',
8945
- array( 'fs_action' => 'change_owner' )
8946
- ),
8947
- ) );
8948
-
8949
- return ! $this->is_api_error( $result );
8950
- }
8951
-
8952
- /**
8953
- * Handle install ownership change.
8954
- *
8955
- * @author Vova Feldman (@svovaf)
8956
- * @since 1.1.1
8957
- * @uses FS_Api
8958
- *
8959
- * @return bool Was ownership change successfully complete.
8960
- */
8961
- private function complete_change_owner() {
8962
- $this->_logger->entrance();
8963
-
8964
- $site_result = $this->get_api_site_scope( true )->get();
8965
- $site = new FS_Site( $site_result );
8966
- $this->_site = $site;
8967
-
8968
- $user = new FS_User();
8969
- $user->id = fs_request_get( 'user_id' );
8970
-
8971
- // Validate install's user and given user.
8972
- if ( $user->id != $this->_site->user_id ) {
8973
- return false;
8974
- }
8975
-
8976
- $user->public_key = fs_request_get( 'user_public_key' );
8977
- $user->secret_key = fs_request_get( 'user_secret_key' );
8978
-
8979
- // Fetch new user information.
8980
- $this->_user = $user;
8981
- $user_result = $this->get_api_user_scope( true )->get();
8982
- $user = new FS_User( $user_result );
8983
- $this->_user = $user;
8984
-
8985
- $this->_set_account( $user, $site );
8986
-
8987
- return true;
8988
- }
8989
-
8990
- /**
8991
- * Handle user name update.
8992
- *
8993
- * @author Vova Feldman (@svovaf)
8994
- * @since 1.0.9
8995
- * @uses FS_Api
8996
- *
8997
- * @return object
8998
- */
8999
- private function update_user_name() {
9000
- $this->_logger->entrance();
9001
- $name = fs_request_get( 'fs_user_name_' . $this->_slug, '' );
9002
-
9003
- $api = $this->get_api_user_scope();
9004
- $user = $api->call( "?plugin_id={$this->_plugin->id}&fields=id,first,last", 'put', array(
9005
- 'name' => $name,
9006
- ) );
9007
-
9008
- if ( ! isset( $user->error ) ) {
9009
- $this->_user->first = $user->first;
9010
- $this->_user->last = $user->last;
9011
- $this->_store_user();
9012
- } else {
9013
- // handle different error cases.
9014
-
9015
- }
9016
-
9017
- return $user;
9018
- }
9019
-
9020
- /**
9021
- * Verify user email.
9022
- *
9023
- * @author Vova Feldman (@svovaf)
9024
- * @since 1.0.3
9025
- * @uses FS_Api
9026
- */
9027
- private function verify_email() {
9028
- $this->_handle_account_user_sync();
9029
-
9030
- if ( $this->_user->is_verified() ) {
9031
- return;
9032
- }
9033
-
9034
- $api = $this->get_api_site_scope();
9035
- $result = $api->call( "/users/{$this->_user->id}/verify.json", 'put', array(
9036
- 'after_email_confirm_url' => $this->_get_admin_page_url(
9037
- 'account',
9038
- array( 'fs_action' => 'sync_user' )
9039
- )
9040
- ) );
9041
-
9042
- if ( ! isset( $result->error ) ) {
9043
- $this->_admin_notices->add( sprintf(
9044
- __fs( 'verification-email-sent-message', $this->_slug ),
9045
- sprintf( '<a href="mailto:%1s">%2s</a>', esc_url( $this->_user->email ), $this->_user->email )
9046
- ) );
9047
- } else {
9048
- // handle different error cases.
9049
-
9050
- }
9051
- }
9052
-
9053
- /**
9054
- * @author Vova Feldman (@svovaf)
9055
- * @since 1.1.2
9056
- *
9057
- * @return string
9058
- */
9059
- private function get_activation_url() {
9060
- return $this->apply_filters( 'connect_url', $this->_get_admin_page_url() );
9061
- }
9062
-
9063
- /**
9064
- * Get the URL of the page that should be loaded after the user connect or skip in the opt-in screen.
9065
- *
9066
- * @author Vova Feldman (@svovaf)
9067
- * @since 1.1.3
9068
- *
9069
- * @param string $filter Filter name.
9070
- *
9071
- * @return string
9072
- */
9073
- private function get_after_activation_url( $filter ) {
9074
- $first_time_path = $this->_menu->get_first_time_path();
9075
-
9076
- return $this->apply_filters(
9077
- $filter,
9078
- empty( $first_time_path ) ?
9079
- $this->_get_admin_page_url() :
9080
- $first_time_path
9081
- );
9082
- }
9083
-
9084
- /**
9085
- * Handle account page updates / edits / actions.
9086
- *
9087
- * @author Vova Feldman (@svovaf)
9088
- * @since 1.0.2
9089
- *
9090
- */
9091
- private function _handle_account_edits() {
9092
- if ( ! current_user_can( 'activate_plugins' ) ) {
9093
- return;
9094
- }
9095
-
9096
- $plugin_id = fs_request_get( 'plugin_id', $this->get_id() );
9097
- $action = fs_get_action();
9098
-
9099
- switch ( $action ) {
9100
- case 'delete_account':
9101
- check_admin_referer( $action );
9102
-
9103
- if ( $plugin_id == $this->get_id() ) {
9104
- $this->delete_account_event();
9105
-
9106
- // Clear user and site.
9107
- $this->_site = null;
9108
- $this->_user = null;
9109
-
9110
- if ( fs_redirect( $this->get_activation_url() ) ) {
9111
- exit();
9112
- }
9113
- } else {
9114
- if ( $this->is_addon_activated( $plugin_id ) ) {
9115
- $fs_addon = self::get_instance_by_id( $plugin_id );
9116
- $fs_addon->delete_account_event();
9117
-
9118
- if ( fs_redirect( $this->_get_admin_page_url( 'account' ) ) ) {
9119
- exit();
9120
- }
9121
- }
9122
- }
9123
-
9124
- return;
9125
-
9126
- case 'downgrade_account':
9127
- check_admin_referer( $action );
9128
- $this->_downgrade_site();
9129
-
9130
- return;
9131
-
9132
- case 'activate_license':
9133
- check_admin_referer( $action );
9134
-
9135
- if ( $plugin_id == $this->get_id() ) {
9136
- $this->_activate_license();
9137
- } else {
9138
- if ( $this->is_addon_activated( $plugin_id ) ) {
9139
- $fs_addon = self::get_instance_by_id( $plugin_id );
9140
- $fs_addon->_activate_license();
9141
- }
9142
- }
9143
-
9144
- return;
9145
-
9146
- case 'deactivate_license':
9147
- check_admin_referer( $action );
9148
-
9149
- if ( $plugin_id == $this->get_id() ) {
9150
- $this->_deactivate_license();
9151
- } else {
9152
- if ( $this->is_addon_activated( $plugin_id ) ) {
9153
- $fs_addon = self::get_instance_by_id( $plugin_id );
9154
- $fs_addon->_deactivate_license();
9155
- }
9156
- }
9157
-
9158
- return;
9159
-
9160
- case 'check_updates':
9161
- check_admin_referer( $action );
9162
- $this->_check_updates();
9163
-
9164
- return;
9165
-
9166
- case 'change_owner':
9167
- $state = fs_request_get( 'state', 'init' );
9168
- switch ( $state ) {
9169
- case 'init':
9170
- $candidate_email = fs_request_get( 'candidate_email', '' );
9171
-
9172
- if ( $this->init_change_owner( $candidate_email ) ) {
9173
- $this->_admin_notices->add( sprintf( __fs( 'change-owner-request-sent-x', $this->_slug ), '<b>' . $this->_user->email . '</b>' ) );
9174
- }
9175
- break;
9176
- case 'owner_confirmed':
9177
- $candidate_email = fs_request_get( 'candidate_email', '' );
9178
-
9179
- $this->_admin_notices->add( sprintf( __fs( 'change-owner-request_owner-confirmed', $this->_slug ), '<b>' . $candidate_email . '</b>' ) );
9180
- break;
9181
- case 'candidate_confirmed':
9182
- if ( $this->complete_change_owner() ) {
9183
- $this->_admin_notices->add_sticky(
9184
- sprintf( __fs( 'change-owner-request_candidate-confirmed', $this->_slug ), '<b>' . $this->_user->email . '</b>' ),
9185
- 'ownership_changed',
9186
- __fs( 'congrats', $this->_slug ) . '!'
9187
- );
9188
- } else {
9189
- // @todo Handle failed ownership change message.
9190
- }
9191
- break;
9192
- }
9193
-
9194
- return;
9195
-
9196
- case 'update_email':
9197
- check_admin_referer( 'update_email' );
9198
-
9199
- $new_email = fs_request_get( 'fs_email_' . $this->_slug, '' );
9200
- $result = $this->_update_email( $new_email );
9201
-
9202
- if ( isset( $result->error ) ) {
9203
- switch ( $result->error->code ) {
9204
- case 'user_exist':
9205
- $this->_admin_notices->add(
9206
- __fs( 'user-exist-message', $this->_slug ) . ' ' .
9207
- sprintf( __fs( 'user-exist-message_ownership', $this->_slug ), '<b>' . $new_email . '</b>' ) .
9208
- sprintf(
9209
- '<a style="margin-left: 10px;" href="%s"><button class="button button-primary">%s &nbsp;&#10140;</button></a>',
9210
- $this->get_account_url( 'change_owner', array(
9211
- 'state' => 'init',
9212
- 'candidate_email' => $new_email
9213
- ) ),
9214
- __fs( 'change-ownership', $this->_slug )
9215
- ),
9216
- __fs( 'oops', $this->_slug ) . '...',
9217
- 'error'
9218
- );
9219
- break;
9220
- }
9221
- } else {
9222
- $this->_admin_notices->add( __fs( 'email-updated-message', $this->_slug ) );
9223
- }
9224
-
9225
- return;
9226
-
9227
- case 'update_user_name':
9228
- check_admin_referer( 'update_user_name' );
9229
-
9230
- $result = $this->update_user_name();
9231
-
9232
- if ( isset( $result->error ) ) {
9233
- $this->_admin_notices->add(
9234
- __fs( 'name-update-failed-message', $this->_slug ),
9235
- __fs( 'oops', $this->_slug ) . '...',
9236
- 'error'
9237
- );
9238
- } else {
9239
- $this->_admin_notices->add( __fs( 'name-updated-message', $this->_slug ) );
9240
- }
9241
-
9242
- return;
9243
-
9244
- #region Actions that might be called from external links (e.g. email)
9245
-
9246
- case 'cancel_trial':
9247
- if ( $plugin_id == $this->get_id() ) {
9248
- $this->_cancel_trial();
9249
- } else {
9250
- if ( $this->is_addon_activated( $plugin_id ) ) {
9251
- $fs_addon = self::get_instance_by_id( $plugin_id );
9252
- $fs_addon->_cancel_trial();
9253
- }
9254
- }
9255
-
9256
- return;
9257
-
9258
- case 'verify_email':
9259
- $this->verify_email();
9260
-
9261
- return;
9262
-
9263
- case 'sync_user':
9264
- $this->_handle_account_user_sync();
9265
-
9266
- return;
9267
-
9268
- case $this->_slug . '_sync_license':
9269
- $this->_sync_license();
9270
-
9271
- return;
9272
-
9273
- case 'download_latest':
9274
- $this->_download_latest_directly( $plugin_id );
9275
-
9276
- return;
9277
-
9278
- #endregion
9279
- }
9280
-
9281
- if ( WP_FS__IS_POST_REQUEST ) {
9282
- $properties = array( 'site_secret_key', 'site_id', 'site_public_key' );
9283
- foreach ( $properties as $p ) {
9284
- if ( 'update_' . $p === $action ) {
9285
- check_admin_referer( $action );
9286
-
9287
- $this->_logger->log( $action );
9288
-
9289
- $site_property = substr( $p, strlen( 'site_' ) );
9290
- $site_property_value = fs_request_get( 'fs_' . $p . '_' . $this->_slug, '' );
9291
- $this->get_site()->{$site_property} = $site_property_value;
9292
-
9293
- // Store account after modification.
9294
- $this->_store_site();
9295
-
9296
- $this->do_action( 'account_property_edit', 'site', $site_property, $site_property_value );
9297
-
9298
- $this->_admin_notices->add( sprintf(
9299
- __fs( 'x-updated', $this->_slug ),
9300
- '<b>' . str_replace( '_', ' ', $p ) . '</b>' ) );
9301
-
9302
- return;
9303
- }
9304
- }
9305
- }
9306
- }
9307
-
9308
- /**
9309
- * Account page resources load.
9310
- *
9311
- * @author Vova Feldman (@svovaf)
9312
- * @since 1.0.6
9313
- */
9314
- function _account_page_load() {
9315
- $this->_logger->entrance();
9316
-
9317
- $this->_logger->info( var_export( $_REQUEST, true ) );
9318
-
9319
- fs_enqueue_local_style( 'fs_account', '/admin/account.css' );
9320
-
9321
- if ( $this->has_addons() ) {
9322
- wp_enqueue_script( 'plugin-install' );
9323
- add_thickbox();
9324
-
9325
- function fs_addons_body_class( $classes ) {
9326
- $classes .= ' plugins-php';
9327
-
9328
- return $classes;
9329
- }
9330
-
9331
- add_filter( 'admin_body_class', 'fs_addons_body_class' );
9332
- }
9333
-
9334
- if ( $this->has_paid_plan() &&
9335
- ! $this->has_any_license() &&
9336
- ! $this->is_sync_executed()
9337
- ) {
9338
- /**
9339
- * If no licenses found and no sync job was executed during the last 24 hours,
9340
- * just execute the sync job right away (blocking execution).
9341
- *
9342
- * @since 1.1.7.3
9343
- */
9344
- $this->run_manual_sync();
9345
- }
9346
-
9347
- $this->_handle_account_edits();
9348
-
9349
- $this->do_action( 'account_page_load_before_departure' );
9350
- }
9351
-
9352
- /**
9353
- * Render account page.
9354
- *
9355
- * @author Vova Feldman (@svovaf)
9356
- * @since 1.0.0
9357
- */
9358
- function _account_page_render() {
9359
- $this->_logger->entrance();
9360
-
9361
- $vars = array( 'slug' => $this->_slug );
9362
- if ( 'billing' === fs_request_get( 'tab' ) ) {
9363
- fs_require_once_template( 'billing.php', $vars );
9364
- } else {
9365
- fs_require_once_template( 'account.php', $vars );
9366
- }
9367
- }
9368
-
9369
- /**
9370
- * Render account connect page.
9371
- *
9372
- * @author Vova Feldman (@svovaf)
9373
- * @since 1.0.7
9374
- */
9375
- function _connect_page_render() {
9376
- $this->_logger->entrance();
9377
-
9378
- $vars = array( 'slug' => $this->_slug );
9379
- fs_require_once_template( 'connect.php', $vars );
9380
- }
9381
-
9382
- /**
9383
- * Load required resources before add-ons page render.
9384
- *
9385
- * @author Vova Feldman (@svovaf)
9386
- * @since 1.0.6
9387
- */
9388
- function _addons_page_load() {
9389
- $this->_logger->entrance();
9390
-
9391
- fs_enqueue_local_style( 'fs_addons', '/admin/add-ons.css' );
9392
-
9393
- wp_enqueue_script( 'plugin-install' );
9394
- add_thickbox();
9395
-
9396
- function fs_addons_body_class( $classes ) {
9397
- $classes .= ' plugins-php';
9398
-
9399
- return $classes;
9400
- }
9401
-
9402
- add_filter( 'admin_body_class', 'fs_addons_body_class' );
9403
-
9404
- if ( ! $this->is_registered() && $this->is_org_repo_compliant() ) {
9405
- $this->_admin_notices->add(
9406
- sprintf( __fs( 'addons-info-external-message', $this->_slug ), '<b>' . $this->get_plugin_name() . '</b>' ),
9407
- __fs( 'heads-up', $this->_slug ),
9408
- 'update-nag'
9409
- );
9410
- }
9411
- }
9412
-
9413
- /**
9414
- * Render add-ons page.
9415
- *
9416
- * @author Vova Feldman (@svovaf)
9417
- * @since 1.0.6
9418
- */
9419
- function _addons_page_render() {
9420
- $this->_logger->entrance();
9421
-
9422
- $vars = array( 'slug' => $this->_slug );
9423
- fs_require_once_template( 'add-ons.php', $vars );
9424
- }
9425
-
9426
- /* Pricing & Upgrade
9427
- ------------------------------------------------------------------------------------------------------------------*/
9428
- /**
9429
- * Render pricing page.
9430
- *
9431
- * @author Vova Feldman (@svovaf)
9432
- * @since 1.0.0
9433
- */
9434
- function _pricing_page_render() {
9435
- $this->_logger->entrance();
9436
-
9437
- $vars = array( 'slug' => $this->_slug );
9438
-
9439
- if ( 'true' === fs_request_get( 'checkout', false ) ) {
9440
- fs_require_once_template( 'checkout.php', $vars );
9441
- } else {
9442
- fs_require_once_template( 'pricing.php', $vars );
9443
- }
9444
- }
9445
-
9446
- #region Contact Us ------------------------------------------------------------------
9447
-
9448
- /**
9449
- * Render contact-us page.
9450
- *
9451
- * @author Vova Feldman (@svovaf)
9452
- * @since 1.0.3
9453
- */
9454
- function _contact_page_render() {
9455
- $this->_logger->entrance();
9456
-
9457
- $vars = array( 'slug' => $this->_slug );
9458
- fs_require_once_template( 'contact.php', $vars );
9459
- }
9460
-
9461
- #endregion ------------------------------------------------------------------
9462
-
9463
- /**
9464
- * Hide all admin notices to prevent distractions.
9465
- *
9466
- * @author Vova Feldman (@svovaf)
9467
- * @since 1.0.3
9468
- *
9469
- * @uses remove_all_actions()
9470
- */
9471
- private static function _hide_admin_notices() {
9472
- remove_all_actions( 'admin_notices' );
9473
- remove_all_actions( 'network_admin_notices' );
9474
- remove_all_actions( 'all_admin_notices' );
9475
- remove_all_actions( 'user_admin_notices' );
9476
- }
9477
-
9478
- static function _clean_admin_content_section_hook() {
9479
- self::_hide_admin_notices();
9480
-
9481
- // Hide footer.
9482
- echo '<style>#wpfooter { display: none !important; }</style>';
9483
- }
9484
-
9485
- /**
9486
- * Attach to admin_head hook to hide all admin notices.
9487
- *
9488
- * @author Vova Feldman (@svovaf)
9489
- * @since 1.0.3
9490
- */
9491
- static function _clean_admin_content_section() {
9492
- add_action( 'admin_head', 'Freemius::_clean_admin_content_section_hook' );
9493
- }
9494
-
9495
- /* CSS & JavaScript
9496
- ------------------------------------------------------------------------------------------------------------------*/
9497
- /* function _enqueue_script($handle, $src) {
9498
- $url = plugins_url( substr( WP_FS__DIR_JS, strlen( $this->_plugin_dir_path ) ) . '/assets/js/' . $src );
9499
-
9500
- $this->_logger->entrance( 'script = ' . $url );
9501
-
9502
- wp_enqueue_script( $handle, $url );
9503
- }*/
9504
-
9505
- /* SDK
9506
- ------------------------------------------------------------------------------------------------------------------*/
9507
- private $_user_api;
9508
-
9509
- /**
9510
- *
9511
- * @author Vova Feldman (@svovaf)
9512
- * @since 1.0.2
9513
- *
9514
- * @param bool $flush
9515
- *
9516
- * @return FS_Api
9517
- */
9518
- function get_api_user_scope( $flush = false ) {
9519
- if ( ! isset( $this->_user_api ) || $flush ) {
9520
- $this->_user_api = FS_Api::instance(
9521
- $this->_slug,
9522
- 'user',
9523
- $this->_user->id,
9524
- $this->_user->public_key,
9525
- ! $this->is_live(),
9526
- $this->_user->secret_key
9527
- );
9528
- }
9529
-
9530
- return $this->_user_api;
9531
- }
9532
-
9533
- private $_site_api;
9534
-
9535
- /**
9536
- *
9537
- * @author Vova Feldman (@svovaf)
9538
- * @since 1.0.2
9539
- *
9540
- * @param bool $flush
9541
- *
9542
- * @return FS_Api
9543
- */
9544
- function get_api_site_scope( $flush = false ) {
9545
- if ( ! isset( $this->_site_api ) || $flush ) {
9546
- $this->_site_api = FS_Api::instance(
9547
- $this->_slug,
9548
- 'install',
9549
- $this->_site->id,
9550
- $this->_site->public_key,
9551
- ! $this->is_live(),
9552
- $this->_site->secret_key
9553
- );
9554
- }
9555
-
9556
- return $this->_site_api;
9557
- }
9558
-
9559
- private $_plugin_api;
9560
-
9561
- /**
9562
- * Get plugin public API scope.
9563
- *
9564
- * @author Vova Feldman (@svovaf)
9565
- * @since 1.0.7
9566
- *
9567
- * @return FS_Api
9568
- */
9569
- function get_api_plugin_scope() {
9570
- if ( ! isset( $this->_plugin_api ) ) {
9571
- $this->_plugin_api = FS_Api::instance(
9572
- $this->_slug,
9573
- 'plugin',
9574
- $this->_plugin->id,
9575
- $this->_plugin->public_key,
9576
- ! $this->is_live()
9577
- );
9578
- }
9579
-
9580
- return $this->_plugin_api;
9581
- }
9582
-
9583
- /**
9584
- * Get site API scope object (fallback to public plugin scope when not registered).
9585
- *
9586
- * @author Vova Feldman (@svovaf)
9587
- * @since 1.0.7
9588
- *
9589
- * @return FS_Api
9590
- */
9591
- function get_api_site_or_plugin_scope() {
9592
- return $this->is_registered() ?
9593
- $this->get_api_site_scope() :
9594
- $this->get_api_plugin_scope();
9595
- }
9596
-
9597
- /**
9598
- * Show trial promotional notice (if any trial exist).
9599
- *
9600
- * @author Vova Feldman (@svovaf)
9601
- * @since 1.0.9
9602
- *
9603
- * @param $plans
9604
- */
9605
- function _check_for_trial_plans( $plans ) {
9606
- $this->_storage->has_trial_plan = FS_Plan_Manager::instance()->has_trial_plan( $plans );
9607
- }
9608
-
9609
- /**
9610
- * Show trial promotional notice (if any trial exist).
9611
- *
9612
- * @author Vova Feldman (@svovaf)
9613
- * @since 1.0.9
9614
- */
9615
- function _add_trial_notice() {
9616
- // Check if trial already utilized.
9617
- if ( $this->_site->is_trial_utilized() ) {
9618
- return;
9619
- }
9620
-
9621
- // Check if already paying.
9622
- if ( $this->is_paying() ) {
9623
- return;
9624
- }
9625
-
9626
- // Check if trial message is already shown.
9627
- if ( $this->_admin_notices->has_sticky( 'trial_promotion' ) ) {
9628
- return;
9629
- }
9630
-
9631
- $trial_plans = FS_Plan_Manager::instance()->get_trial_plans( $this->_plans );
9632
- $trial_plans_count = count( $trial_plans );
9633
-
9634
- // Check if any of the plans contains trial.
9635
- if ( 0 === $trial_plans_count ) {
9636
- return;
9637
- }
9638
-
9639
- /**
9640
- * @var FS_Plugin_Plan $paid_plan
9641
- */
9642
- $paid_plan = $trial_plans[0];
9643
- $require_subscription = $paid_plan->is_require_subscription;
9644
- $upgrade_url = $this->get_trial_url();
9645
- $cc_string = $require_subscription ?
9646
- sprintf( __fs( 'no-commitment-for-x-days', $this->_slug ), $paid_plan->trial_period ) :
9647
- __fs( 'no-cc-required', $this->_slug ) . '!';
9648
-
9649
-
9650
- $total_paid_plans = count( $this->_plans ) - ( FS_Plan_Manager::instance()->has_free_plan( $this->_plans ) ? 1 : 0 );
9651
-
9652
- if ( $total_paid_plans === $trial_plans_count ) {
9653
- // All paid plans have trials.
9654
- $message = sprintf(
9655
- __fs( 'hey', $this->_slug ) . '! ' . __fs( 'trial-x-promotion-message', $this->_slug ),
9656
- sprintf( '<b>%s</b>', $this->get_plugin_name() ),
9657
- strtolower( __fs( 'awesome', $this->_slug ) ),
9658
- $paid_plan->trial_period
9659
- );
9660
- } else {
9661
- $plans_string = '';
9662
- for ( $i = 0; $i < $trial_plans_count; $i ++ ) {
9663
- $plans_string .= sprintf( '<a href="%s">%s</a>', $upgrade_url, $trial_plans[ $i ]->title );
9664
-
9665
- if ( $i < $trial_plans_count - 2 ) {
9666
- $plans_string .= ', ';
9667
- } else if ( $i == $trial_plans_count - 2 ) {
9668
- $plans_string .= ' and ';
9669
- }
9670
- }
9671
-
9672
- // Not all paid plans have trials.
9673
- $message = sprintf(
9674
- __fs( 'hey', $this->_slug ) . '! ' . __fs( 'trial-x-promotion-message', $this->_slug ),
9675
- sprintf( '<b>%s</b>', $this->get_plugin_name() ),
9676
- $plans_string,
9677
- $paid_plan->trial_period
9678
- );
9679
- }
9680
-
9681
- $message .= ' ' . $cc_string;
9682
-
9683
- // Add start trial button.
9684
- $message .= ' ' . sprintf(
9685
- '<a style="margin-left: 10px; vertical-align: super;" href="%s"><button class="button button-primary">%s &nbsp;&#10140;</button></a>',
9686
- $upgrade_url,
9687
- __fs( 'start-free-trial', $this->_slug )
9688
- );
9689
-
9690
- $this->_admin_notices->add_sticky(
9691
- $this->apply_filters( 'trial_promotion_message', $message ),
9692
- 'trial_promotion',
9693
- '',
9694
- 'promotion'
9695
- );
9696
-
9697
- $this->_storage->trial_promotion_shown = WP_FS__SCRIPT_START_TIME;
9698
- }
9699
-
9700
- /* Action Links
9701
- ------------------------------------------------------------------------------------------------------------------*/
9702
- private $_action_links_hooked = false;
9703
- private $_action_links = array();
9704
-
9705
- /**
9706
- * @author Vova Feldman (@svovaf)
9707
- * @since 1.0.0
9708
- *
9709
- * @return bool
9710
- */
9711
- private function is_plugin_action_links_hooked() {
9712
- $this->_logger->entrance( json_encode( $this->_action_links_hooked ) );
9713
-
9714
- return $this->_action_links_hooked;
9715
- }
9716
-
9717
- /**
9718
- * Hook to plugin action links filter.
9719
- *
9720
- * @author Vova Feldman (@svovaf)
9721
- * @since 1.0.0
9722
- */
9723
- private function hook_plugin_action_links() {
9724
- $this->_logger->entrance();
9725
-
9726
- $this->_action_links_hooked = true;
9727
-
9728
- $this->_logger->log( 'Adding action links hooks.' );
9729
-
9730
- // Add action link to settings page.
9731
- add_filter( 'plugin_action_links_' . $this->_plugin_basename, array(
9732
- &$this,
9733
- '_modify_plugin_action_links_hook'
9734
- ), WP_FS__DEFAULT_PRIORITY, 2 );
9735
- add_filter( 'network_admin_plugin_action_links_' . $this->_plugin_basename, array(
9736
- &$this,
9737
- '_modify_plugin_action_links_hook'
9738
- ), WP_FS__DEFAULT_PRIORITY, 2 );
9739
- }
9740
-
9741
- /**
9742
- * Add plugin action link.
9743
- *
9744
- * @author Vova Feldman (@svovaf)
9745
- * @since 1.0.0
9746
- *
9747
- * @param $label
9748
- * @param $url
9749
- * @param bool $external
9750
- * @param int $priority
9751
- * @param bool $key
9752
- */
9753
- function add_plugin_action_link( $label, $url, $external = false, $priority = WP_FS__DEFAULT_PRIORITY, $key = false ) {
9754
- $this->_logger->entrance();
9755
-
9756
- if ( ! isset( $this->_action_links[ $priority ] ) ) {
9757
- $this->_action_links[ $priority ] = array();
9758
- }
9759
-
9760
- if ( false === $key ) {
9761
- $key = preg_replace( "/[^A-Za-z0-9 ]/", '', strtolower( $label ) );
9762
- }
9763
-
9764
- $this->_action_links[ $priority ][] = array(
9765
- 'label' => $label,
9766
- 'href' => $url,
9767
- 'key' => $key,
9768
- 'external' => $external
9769
- );
9770
- }
9771
-
9772
- /**
9773
- * Adds Upgrade and Add-Ons links to the main Plugins page link actions collection.
9774
- *
9775
- * @author Vova Feldman (@svovaf)
9776
- * @since 1.0.0
9777
- */
9778
- function _add_upgrade_action_link() {
9779
- $this->_logger->entrance();
9780
-
9781
- if ( $this->is_registered() ) {
9782
- if ( ! $this->is_paying() && $this->has_paid_plan() ) {
9783
- $this->add_plugin_action_link(
9784
- __fs( 'upgrade', $this->_slug ),
9785
- $this->get_upgrade_url(),
9786
- false,
9787
- 7,
9788
- 'upgrade'
9789
- );
9790
- }
9791
-
9792
- if ( $this->has_addons() ) {
9793
- $this->add_plugin_action_link(
9794
- __fs( 'add-ons', $this->_slug ),
9795
- $this->_get_admin_page_url( 'addons' ),
9796
- false,
9797
- 9,
9798
- 'addons'
9799
- );
9800
- }
9801
- }
9802
- }
9803
-
9804
- /**
9805
- * Adds "Activate License" or "Change License" link to the main Plugins page link actions collection.
9806
- *
9807
- * @author Leo Fajardo (@leorw)
9808
- * @since 1.1.9
9809
- */
9810
- function _add_license_action_link() {
9811
- $this->_logger->entrance();
9812
-
9813
- if ( $this->is_free_plan() && $this->is_addon() ) {
9814
- return;
9815
- }
9816
-
9817
- $link_text = __fs(
9818
- $this->is_free_plan() ? 'activate-license' : 'change-license',
9819
- $this->_slug
9820
- );
9821
-
9822
- $this->add_plugin_action_link(
9823
- $link_text,
9824
- '#',
9825
- false,
9826
- 11,
9827
- ( 'activate-license ' . $this->_slug )
9828
- );
9829
- }
9830
-
9831
- /**
9832
- * Get the URL of the page that should be loaded right after the plugin activation.
9833
- *
9834
- * @author Vova Feldman (@svovaf)
9835
- * @since 1.1.7.4
9836
- *
9837
- * @return string
9838
- */
9839
- function get_after_plugin_activation_redirect_url() {
9840
- $url = false;
9841
- $plugin_fs = false;
9842
-
9843
- if ( ! $this->is_addon() ) {
9844
- $first_time_path = $this->_menu->get_first_time_path();
9845
- $plugin_fs = $this;
9846
- $url = $plugin_fs->is_activation_mode() ?
9847
- $plugin_fs->get_activation_url() :
9848
- ( empty( $first_time_path ) ?
9849
- $this->_get_admin_page_url() :
9850
- $first_time_path );
9851
- } else {
9852
- if ( $this->is_parent_plugin_installed() ) {
9853
- $plugin_fs = self::get_parent_instance();
9854
- }
9855
-
9856
- if ( is_object( $plugin_fs ) ) {
9857
- if ( ! $plugin_fs->is_registered() ) {
9858
- // Forward to parent plugin connect when parent not registered.
9859
- $url = $plugin_fs->get_activation_url();
9860
- } else {
9861
- // Forward to account page.
9862
- $url = $plugin_fs->_get_admin_page_url( 'account' );
9863
- }
9864
- }
9865
- }
9866
-
9867
- return $url;
9868
- }
9869
-
9870
- /**
9871
- * Forward page to activation page.
9872
- *
9873
- * @author Vova Feldman (@svovaf)
9874
- * @since 1.0.3
9875
- */
9876
- function _redirect_on_activation_hook() {
9877
- $url = $this->get_after_plugin_activation_redirect_url();
9878
-
9879
- if ( is_string( $url ) ) {
9880
- fs_redirect( $url );
9881
- exit();
9882
- }
9883
- }
9884
-
9885
- /**
9886
- * Modify plugin's page action links collection.
9887
- *
9888
- * @author Vova Feldman (@svovaf)
9889
- * @since 1.0.0
9890
- *
9891
- * @param array $links
9892
- * @param $file
9893
- *
9894
- * @return array
9895
- */
9896
- function _modify_plugin_action_links_hook( $links, $file ) {
9897
- $this->_logger->entrance();
9898
-
9899
- $passed_deactivate = false;
9900
- $deactivate_link = '';
9901
- $before_deactivate = array();
9902
- $after_deactivate = array();
9903
- foreach ( $links as $key => $link ) {
9904
- if ( 'deactivate' === $key ) {
9905
- $deactivate_link = $link;
9906
- $passed_deactivate = true;
9907
- continue;
9908
- }
9909
-
9910
- if ( ! $passed_deactivate ) {
9911
- $before_deactivate[ $key ] = $link;
9912
- } else {
9913
- $after_deactivate[ $key ] = $link;
9914
- }
9915
- }
9916
-
9917
- ksort( $this->_action_links );
9918
-
9919
- foreach ( $this->_action_links as $new_links ) {
9920
- foreach ( $new_links as $link ) {
9921
- $before_deactivate[ $link['key'] ] = '<a href="' . $link['href'] . '"' . ( $link['external'] ? ' target="_blank"' : '' ) . '>' . $link['label'] . '</a>';
9922
- }
9923
- }
9924
-
9925
- if ( ! empty( $deactivate_link ) ) {
9926
- if ( ! $this->is_paying_or_trial() || $this->is_premium() ) {
9927
- /*
9928
- * This HTML element is used to identify the correct plugin when attaching an event to its Deactivate link.
9929
- *
9930
- * If user is paying or in trial and have the free version installed,
9931
- * assume that the deactivation is for the upgrade process, so this is not needed.
9932
- */
9933
- $deactivate_link .= '<i class="fs-slug" data-slug="' . $this->_slug . '"></i>';
9934
- }
9935
-
9936
- // Append deactivation link.
9937
- $before_deactivate['deactivate'] = $deactivate_link;
9938
- }
9939
-
9940
- return array_merge( $before_deactivate, $after_deactivate );
9941
- }
9942
-
9943
- /**
9944
- * Adds admin message.
9945
- *
9946
- * @author Vova Feldman (@svovaf)
9947
- * @since 1.0.4
9948
- *
9949
- * @param string $message
9950
- * @param string $title
9951
- * @param string $type
9952
- */
9953
- function add_admin_message( $message, $title = '', $type = 'success' ) {
9954
- $this->_admin_notices->add( $message, $title, $type );
9955
- }
9956
-
9957
- /**
9958
- * Adds sticky admin message.
9959
- *
9960
- * @author Vova Feldman (@svovaf)
9961
- * @since 1.1.0
9962
- *
9963
- * @param string $message
9964
- * @param string $id
9965
- * @param string $title
9966
- * @param string $type
9967
- */
9968
- function add_sticky_admin_message( $message, $id, $title = '', $type = 'success' ) {
9969
- $this->_admin_notices->add_sticky( $message, $id, $title, $type );
9970
- }
9971
-
9972
- /* Plugin Auto-Updates (@since 1.0.4)
9973
- ------------------------------------------------------------------------------------------------------------------*/
9974
- /**
9975
- * @var string[]
9976
- */
9977
- private static $_auto_updated_plugins;
9978
-
9979
- /**
9980
- * @todo TEST IF IT WORKS!!!
9981
- *
9982
- * Include plugins for automatic updates based on stored settings.
9983
- *
9984
- * @see http://wordpress.stackexchange.com/questions/131394/how-do-i-exclude-plugins-from-getting-automatically-updated/131404#131404
9985
- *
9986
- * @author Vova Feldman (@svovaf)
9987
- * @since 1.0.4
9988
- *
9989
- * @param bool $update Whether to update (not used for plugins)
9990
- * @param object $item The plugin's info
9991
- *
9992
- * @return bool
9993
- */
9994
- static function _include_plugins_in_auto_update( $update, $item ) {
9995
- // Before version 3.8.2 the $item was the file name of the plugin,
9996
- // while in 3.8.2 statistics were added (https://core.trac.wordpress.org/changeset/27905).
9997
- $by_slug = ( (int) str_replace( '.', '', get_bloginfo( 'version' ) ) >= 382 );
9998
-
9999
- if ( ! isset( self::$_auto_updated_plugins ) ) {
10000
- $plugins = self::$_accounts->get_option( 'plugins', array() );
10001
-
10002
- $identifiers = array();
10003
- foreach ( $plugins as $p ) {
10004
- /**
10005
- * @var FS_Plugin $p
10006
- */
10007
- if ( isset( $p->auto_update ) && $p->auto_update ) {
10008
- $identifiers[] = ( $by_slug ? $p->slug : plugin_basename( $p->file ) );
10009
- }
10010
- }
10011
-
10012
- self::$_auto_updated_plugins = $identifiers;
10013
- }
10014
-
10015
- if ( in_array( $by_slug ? $item->slug : $item, self::$_auto_updated_plugins ) ) {
10016
- return true;
10017
- }
10018
-
10019
- // Pass update decision to next filters
10020
- return $update;
10021
- }
10022
-
10023
- #region Versioning ------------------------------------------------------------------
10024
-
10025
- /**
10026
- * Check if Freemius in SDK upgrade mode.
10027
- *
10028
- * @author Vova Feldman (@svovaf)
10029
- * @since 1.0.9
10030
- *
10031
- * @return bool
10032
- */
10033
- function is_sdk_upgrade_mode() {
10034
- return isset( $this->_storage->sdk_upgrade_mode ) ?
10035
- $this->_storage->sdk_upgrade_mode :
10036
- false;
10037
- }
10038
-
10039
- /**
10040
- * Turn SDK upgrade mode off.
10041
- *
10042
- * @author Vova Feldman (@svovaf)
10043
- * @since 1.0.9
10044
- *
10045
- * @return bool
10046
- */
10047
- function set_sdk_upgrade_complete() {
10048
- $this->_storage->sdk_upgrade_mode = false;
10049
- }
10050
-
10051
- /**
10052
- * Check if plugin upgrade mode.
10053
- *
10054
- * @author Vova Feldman (@svovaf)
10055
- * @since 1.0.9
10056
- *
10057
- * @return bool
10058
- */
10059
- function is_plugin_upgrade_mode() {
10060
- return isset( $this->_storage->plugin_upgrade_mode ) ?
10061
- $this->_storage->plugin_upgrade_mode :
10062
- false;
10063
- }
10064
-
10065
- /**
10066
- * Turn plugin upgrade mode off.
10067
- *
10068
- * @author Vova Feldman (@svovaf)
10069
- * @since 1.0.9
10070
- *
10071
- * @return bool
10072
- */
10073
- function set_plugin_upgrade_complete() {
10074
- $this->_storage->plugin_upgrade_mode = false;
10075
- }
10076
-
10077
- #endregion ------------------------------------------------------------------
10078
-
10079
- #region Permissions ------------------------------------------------------------------
10080
-
10081
- /**
10082
- * Check if specific permission requested.
10083
- *
10084
- * @author Vova Feldman (@svovaf)
10085
- * @since 1.1.6
10086
- *
10087
- * @param string $permission
10088
- *
10089
- * @return bool
10090
- */
10091
- function is_permission_requested( $permission ) {
10092
- return isset( $this->_permissions[ $permission ] ) && ( true === $this->_permissions[ $permission ] );
10093
- }
10094
-
10095
- #endregion Permissions ------------------------------------------------------------------
10096
-
10097
- #region Marketing ------------------------------------------------------------------
10098
-
10099
- /**
10100
- * Check if current user purchased any other plugins before.
10101
- *
10102
- * @author Vova Feldman (@svovaf)
10103
- * @since 1.0.9
10104
- *
10105
- * @return bool
10106
- */
10107
- function has_purchased_before() {
10108
- // TODO: Implement has_purchased_before() method.
10109
- }
10110
-
10111
- /**
10112
- * Check if current user classified as an agency.
10113
- *
10114
- * @author Vova Feldman (@svovaf)
10115
- * @since 1.0.9
10116
- *
10117
- * @return bool
10118
- */
10119
- function is_agency() {
10120
- // TODO: Implement is_agency() method.
10121
- }
10122
-
10123
- /**
10124
- * Check if current user classified as a developer.
10125
- *
10126
- * @author Vova Feldman (@svovaf)
10127
- * @since 1.0.9
10128
- *
10129
- * @return bool
10130
- */
10131
- function is_developer() {
10132
- // TODO: Implement is_developer() method.
10133
- }
10134
-
10135
- /**
10136
- * Check if current user classified as a business.
10137
- *
10138
- * @author Vova Feldman (@svovaf)
10139
- * @since 1.0.9
10140
- *
10141
- * @return bool
10142
- */
10143
- function is_business() {
10144
- // TODO: Implement is_business() method.
10145
- }
10146
-
10147
- #endregion ------------------------------------------------------------------
10148
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/class-fs-api.php DELETED
@@ -1,455 +0,0 @@
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 ( null !== $result && isset( $result->error ) && isset( $result->error->message ) ) {
184
- // Log API errors.
185
- $this->_logger->error( $result->error->message );
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
- } else {
247
- // If no older data version, return result without
248
- // caching the error.
249
- return $result;
250
- }
251
- }
252
-
253
- self::$_cache->set( $cache_key, $result, $expiration );
254
-
255
- $cached_result = $result;
256
- }
257
-
258
- return $cached_result;
259
- }
260
-
261
- private function get_cache_key( $path, $method = 'GET', $params = array() ) {
262
- $canonized = $this->_api->CanonizePath( $path );
263
- // $exploded = explode('/', $canonized);
264
- // return $method . '_' . array_pop($exploded) . '_' . md5($canonized . json_encode($params));
265
- return $method . ':' . $canonized . ( ! empty( $params ) ? '#' . md5( json_encode( $params ) ) : '' );
266
- }
267
-
268
- /**
269
- * Test API connectivity.
270
- *
271
- * @author Vova Feldman (@svovaf)
272
- * @since 1.0.9 If fails, try to fallback to HTTP.
273
- * @since 1.1.6 Added a 5-min caching mechanism, to prevent from overloading the server if the API if
274
- * temporary down.
275
- *
276
- * @return bool True if successful connectivity to the API.
277
- */
278
- static function test() {
279
- self::_init();
280
-
281
- $cache_key = 'ping_test';
282
-
283
- $test = self::$_cache->get_valid( $cache_key, null );
284
-
285
- if ( is_null( $test ) ) {
286
- $test = Freemius_Api::Test();
287
-
288
- if ( false === $test && Freemius_Api::IsHttps() ) {
289
- // Fallback to HTTP, since HTTPS fails.
290
- Freemius_Api::SetHttp();
291
-
292
- self::$_options->set_option( 'api_force_http', true, true );
293
-
294
- $test = Freemius_Api::Test();
295
-
296
- if ( false === $test ) {
297
- /**
298
- * API connectivity test fail also in HTTP request, therefore,
299
- * fallback to HTTPS to keep connection secure.
300
- *
301
- * @since 1.1.6
302
- */
303
- self::$_options->set_option( 'api_force_http', false, true );
304
- }
305
- }
306
-
307
- self::$_cache->set( $cache_key, $test, WP_FS__TIME_5_MIN_IN_SEC );
308
- }
309
-
310
- return $test;
311
- }
312
-
313
- /**
314
- * Check if API is temporary down.
315
- *
316
- * @author Vova Feldman (@svovaf)
317
- * @since 1.1.6
318
- *
319
- * @return bool
320
- */
321
- static function is_temporary_down() {
322
- self::_init();
323
-
324
- $test = self::$_cache->get_valid( 'ping_test', null );
325
-
326
- return ( false === $test );
327
- }
328
-
329
- /**
330
- * @author Vova Feldman (@svovaf)
331
- * @since 1.1.6
332
- *
333
- * @return object
334
- */
335
- private function get_temporary_unavailable_error() {
336
- return (object) array(
337
- 'error' => array(
338
- 'type' => 'TemporaryUnavailable',
339
- 'message' => 'API is temporary unavailable, please retry in ' . ( self::$_cache->get_record_expiration( 'ping_test' ) - WP_FS__SCRIPT_START_TIME ) . ' sec.',
340
- 'code' => 'temporary_unavailable',
341
- 'http' => 503
342
- )
343
- );
344
- }
345
-
346
- /**
347
- * Ping API for connectivity test, and return result object.
348
- *
349
- * @author Vova Feldman (@svovaf)
350
- * @since 1.0.9
351
- *
352
- * @param null|string $unique_anonymous_id
353
- * @param array $params
354
- *
355
- * @return object
356
- */
357
- function ping( $unique_anonymous_id = null, $params = array() ) {
358
- $this->_logger->entrance();
359
-
360
- if ( self::is_temporary_down() ) {
361
- return $this->get_temporary_unavailable_error();
362
- }
363
-
364
- $pong = is_null( $unique_anonymous_id ) ?
365
- Freemius_Api::Ping() :
366
- $this->_call( 'ping.json?' . http_build_query( array_merge(
367
- array( 'uid' => $unique_anonymous_id ),
368
- $params
369
- ) ) );
370
-
371
- if ( $this->is_valid_ping( $pong ) ) {
372
- return $pong;
373
- }
374
-
375
- if ( self::should_try_with_http( $pong ) ) {
376
- // Fallback to HTTP, since HTTPS fails.
377
- Freemius_Api::SetHttp();
378
-
379
- self::$_options->set_option( 'api_force_http', true, true );
380
-
381
- $pong = is_null( $unique_anonymous_id ) ?
382
- Freemius_Api::Ping() :
383
- $this->_call( 'ping.json?' . http_build_query( array_merge(
384
- array( 'uid' => $unique_anonymous_id ),
385
- $params
386
- ) ) );
387
-
388
- if ( ! $this->is_valid_ping( $pong ) ) {
389
- self::$_options->set_option( 'api_force_http', false, true );
390
- }
391
- }
392
-
393
- return $pong;
394
- }
395
-
396
- /**
397
- * Check if based on the API result we should try
398
- * to re-run the same request with HTTP instead of HTTPS.
399
- *
400
- * @author Vova Feldman (@svovaf)
401
- * @since 1.1.6
402
- *
403
- * @param $result
404
- *
405
- * @return bool
406
- */
407
- private static function should_try_with_http( $result ) {
408
- if ( ! Freemius_Api::IsHttps() ) {
409
- return false;
410
- }
411
-
412
- return ( ! is_object( $result ) ||
413
- ! isset( $result->error ) ||
414
- ! isset( $result->error->code ) ||
415
- ! in_array( $result->error->code, array(
416
- 'curl_missing',
417
- 'cloudflare_ddos_protection',
418
- 'maintenance_mode',
419
- 'squid_cache_block',
420
- 'too_many_requests',
421
- ) ) );
422
-
423
- }
424
-
425
- /**
426
- * Check if valid ping request result.
427
- *
428
- * @author Vova Feldman (@svovaf)
429
- * @since 1.1.1
430
- *
431
- * @param mixed $pong
432
- *
433
- * @return bool
434
- */
435
- function is_valid_ping( $pong ) {
436
- return Freemius_Api::Test( $pong );
437
- }
438
-
439
- function get_url( $path = '' ) {
440
- return Freemius_Api::GetUrl( $path, $this->_api->IsSandbox() );
441
- }
442
-
443
- /**
444
- * Clear API cache.
445
- *
446
- * @author Vova Feldman (@svovaf)
447
- * @since 1.0.9
448
- */
449
- static function clear_cache() {
450
- self::_init();
451
-
452
- self::$_cache = FS_Cache_Manager::get_manager( WP_FS__API_CACHE_OPTION_NAME );
453
- self::$_cache->clear( true );
454
- }
455
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/class-fs-logger.php DELETED
@@ -1,179 +0,0 @@
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_Logger {
14
- private $_id;
15
- private $_on = false;
16
- private $_echo = false;
17
- private $_file_start = 0;
18
-
19
- private static $LOGGERS = array();
20
- private static $LOG = array();
21
- private static $CNT = 0;
22
- private static $_HOOKED_FOOTER = false;
23
-
24
- private function __construct( $id, $on = false, $echo = false ) {
25
- $this->_id = $id;
26
-
27
- $bt = debug_backtrace();
28
- $caller = $bt[2];
29
-
30
- $this->_file_start = strpos( $caller['file'], 'plugins' ) + strlen( 'plugins/' );
31
-
32
- if ( $on ) {
33
- $this->on();
34
- }
35
- if ( $echo ) {
36
- $this->echo_on();
37
- }
38
- }
39
-
40
- /**
41
- * @param string $id
42
- * @param bool $on
43
- * @param bool $echo
44
- *
45
- * @return FS_Logger
46
- */
47
- public static function get_logger( $id, $on = false, $echo = false ) {
48
- $id = strtolower( $id );
49
-
50
- if ( ! isset( self::$LOGGERS[ $id ] ) ) {
51
- self::$LOGGERS[ $id ] = new FS_Logger( $id, $on, $echo );
52
- }
53
-
54
- return self::$LOGGERS[ $id ];
55
- }
56
-
57
- private static function _hook_footer() {
58
- if ( self::$_HOOKED_FOOTER ) {
59
- return;
60
- }
61
-
62
- if ( is_admin() ) {
63
- add_action( 'admin_footer', 'FS_Logger::dump', 100 );
64
- } else {
65
- add_action( 'wp_footer', 'FS_Logger::dump', 100 );
66
- }
67
- }
68
-
69
- function is_on() {
70
- return $this->_on;
71
- }
72
-
73
- function on() {
74
- $this->_on = true;
75
-
76
- self::_hook_footer();
77
- }
78
-
79
- function echo_on() {
80
- $this->on();
81
-
82
- $this->_echo = true;
83
- }
84
-
85
- function is_echo_on() {
86
- return $this->_echo;
87
- }
88
-
89
- function get_id() {
90
- return $this->_id;
91
- }
92
-
93
- function get_file() {
94
- return $this->_file_start;
95
- }
96
-
97
- private function _log( &$message, $type = 'log', $wrapper ) {
98
- if ( ! $this->is_on() ) {
99
- return;
100
- }
101
-
102
- $bt = debug_backtrace();
103
- $depth = $wrapper ? 3 : 2;
104
- while ( $depth < count( $bt ) - 1 && 'eval' === $bt[ $depth ]['function'] ) {
105
- $depth ++;
106
- }
107
-
108
- $caller = $bt[ $depth ];
109
-
110
- $log = array_merge( $caller, array(
111
- 'cnt' => self::$CNT ++,
112
- 'logger' => $this,
113
- 'timestamp' => microtime(true),
114
- 'type' => $type,
115
- 'msg' => $message,
116
- ) );
117
-
118
- self::$LOG[] = $log;
119
-
120
- if ( $this->is_echo_on() ) {
121
- echo self::format_html( $log ) . "\n";
122
- }
123
- }
124
-
125
- function log( $message, $wrapper = false ) {
126
- $this->_log( $message, 'log', $wrapper );
127
- }
128
-
129
- function info( $message, $wrapper = false ) {
130
- $this->_log( $message, 'info', $wrapper );
131
- }
132
-
133
- function warn( $message, $wrapper = false ) {
134
- $this->_log( $message, 'warn', $wrapper );
135
- }
136
-
137
- function error( $message, $wrapper = false ) {
138
- $this->_log( $message, 'error', $wrapper );
139
- }
140
-
141
- function entrance( $message = '', $wrapper = false ) {
142
- $msg = 'Entrance' . ( empty( $message ) ? '' : ' > ' ) . $message;
143
-
144
- $this->_log( $msg, 'log', $wrapper );
145
- }
146
-
147
- function departure( $message = '', $wrapper = false ) {
148
- $msg = 'Departure' . ( empty( $message ) ? '' : ' > ' ) . $message;
149
-
150
- $this->_log( $msg, 'log', $wrapper );
151
- }
152
-
153
- private static function format( $log, $show_type = true ) {
154
- return '[' . str_pad( $log['cnt'], strlen( self::$CNT ), '0', STR_PAD_LEFT ) . '] [' . $log['logger']->_id . '] ' . ( $show_type ? '[' . $log['type'] . ']' : '' ) . $log['function'] . ' >> ' . $log['msg'] . ( isset( $log['file'] ) ? ' (' . substr( $log['file'], $log['logger']->_file_start ) . ' ' . $log['line'] . ') ' : '' ) . ' [' . $log['timestamp'] . ']';
155
- }
156
-
157
- private static function format_html( $log ) {
158
- return '<div style="font-size: 11px; padding: 3px; background: #ccc; margin-bottom: 3px;">[' . $log['cnt'] . '] [' . $log['logger']->_id . '] [' . $log['type'] . '] <b><code style="color: blue;">' . $log['function'] . '</code> >> <b style="color: darkorange;">' . $log['msg'] . '</b></b>' . ( isset( $log['file'] ) ? ' (' . substr( $log['file'], $log['logger']->_file_start ) . ' ' . $log['line'] . ')' : '' ) . ' [' . $log['timestamp'] . ']</div>';
159
- }
160
-
161
- static function dump() {
162
- ?>
163
- <!-- BEGIN: Freemius PHP Console Log -->
164
- <script type="text/javascript">
165
- <?php
166
- foreach (self::$LOG as $log)
167
- {
168
- echo 'console.' . $log['type'] . '(' . json_encode(self::format($log, false)) . ')' . "\n";
169
- }
170
- ?>
171
- </script>
172
- <!-- END: Freemius PHP Console Log -->
173
- <?php
174
- }
175
-
176
- static function get_log() {
177
- return self::$LOG;
178
- }
179
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/class-fs-plugin-updater.php DELETED
@@ -1,334 +0,0 @@
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
- * @link https://github.com/easydigitaldownloads/EDD-License-handler/blob/master/EDD_SL_Plugin_Updater.php
9
- */
10
-
11
- if ( ! defined( 'ABSPATH' ) ) {
12
- exit;
13
- }
14
-
15
- // Uncomment this line for testing.
16
- // set_site_transient( 'update_plugins', null );
17
-
18
- class FS_Plugin_Updater {
19
-
20
- /**
21
- * @var Freemius
22
- * @since 1.0.4
23
- */
24
- private $_fs;
25
- /**
26
- * @var FS_Logger
27
- * @since 1.0.4
28
- */
29
- private $_logger;
30
- /**
31
- * @var object
32
- * @since 1.1.8.1
33
- */
34
- private $_update_details;
35
-
36
- function __construct( Freemius $freemius ) {
37
- $this->_fs = $freemius;
38
-
39
- $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $freemius->get_slug() . '_updater', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
40
-
41
- $this->_filters();
42
- }
43
-
44
- /**
45
- * Initiate required filters.
46
- *
47
- * @author Vova Feldman (@svovaf)
48
- * @since 1.0.4
49
- */
50
- private function _filters() {
51
- // Override request for plugin information
52
- add_filter( 'plugins_api', array( &$this, 'plugins_api_filter' ), 10, 3 );
53
-
54
- // WP 3.0+
55
- add_filter( 'pre_set_site_transient_update_plugins', array(
56
- &$this,
57
- 'pre_set_site_transient_update_plugins_filter'
58
- ) );
59
-
60
- if ( ! $this->_fs->has_active_license() ) {
61
- /**
62
- * If user has the premium plugin's code but do NOT have an active license,
63
- * encourage him to upgrade by showing that there's a new release, but instead
64
- * of showing an update link, show upgrade link to the pricing page.
65
- *
66
- * @since 1.1.6
67
- *
68
- */
69
- // WP 2.9+
70
- add_action( "after_plugin_row_{$this->_fs->get_plugin_basename()}", array(
71
- &$this,
72
- 'catch_plugin_update_row'
73
- ), 9 );
74
- add_action( "after_plugin_row_{$this->_fs->get_plugin_basename()}", array(
75
- &$this,
76
- 'edit_and_echo_plugin_update_row'
77
- ), 11, 2 );
78
- }
79
-
80
- if ( ! WP_FS__IS_PRODUCTION_MODE ) {
81
- add_filter( 'http_request_host_is_external', array(
82
- $this,
83
- 'http_request_host_is_external_filter'
84
- ), 10, 3 );
85
- }
86
- }
87
-
88
- /**
89
- * Capture plugin update row by turning output buffering.
90
- *
91
- * @author Vova Feldman (@svovaf)
92
- * @since 1.1.6
93
- */
94
- function catch_plugin_update_row() {
95
- ob_start();
96
- }
97
-
98
- /**
99
- * Overrides default update message format with "renew your license" message.
100
- *
101
- * @author Vova Feldman (@svovaf)
102
- * @since 1.1.6
103
- */
104
- function edit_and_echo_plugin_update_row( $file, $plugin_data ) {
105
- $plugin_update_row = ob_get_clean();
106
-
107
- $current = get_site_transient( 'update_plugins' );
108
- if ( ! isset( $current->response[ $file ] ) ) {
109
- echo $plugin_update_row;
110
-
111
- return false;
112
- }
113
-
114
- $r = $current->response[ $file ];
115
-
116
- $plugin_update_row = preg_replace(
117
- '/(\<div.+>)(.+)(\<a.+\<a.+)\<\/div\>/is',
118
- '$1 $2 ' . sprintf(
119
- __fs( 'renew-license-now' ),
120
- '<a href="' . $this->_fs->pricing_url() . '">', '</a>',
121
- $r->new_version ) .
122
- '$4',
123
- $plugin_update_row
124
- );
125
-
126
- echo $plugin_update_row;
127
- }
128
-
129
- /**
130
- * Since WP version 3.6, a new security feature was added that denies access to repository with a local ip.
131
- * During development mode we want to be able updating plugin versions via our localhost repository. This
132
- * filter white-list all domains including "api.freemius".
133
- *
134
- * @link http://www.emanueletessore.com/wordpress-download-failed-valid-url-provided/
135
- *
136
- * @author Vova Feldman (@svovaf)
137
- * @since 1.0.4
138
- *
139
- * @param bool $allow
140
- * @param string $host
141
- * @param string $url
142
- *
143
- * @return bool
144
- */
145
- function http_request_host_is_external_filter( $allow, $host, $url ) {
146
- return ( false !== strpos( $host, 'freemius' ) ) ? true : $allow;
147
- }
148
-
149
- /**
150
- * Check for Updates at the defined API endpoint and modify the update array.
151
- *
152
- * This function dives into the update api just when WordPress creates its update array,
153
- * then adds a custom API call and injects the custom plugin data retrieved from the API.
154
- * It is reassembled from parts of the native WordPress plugin update code.
155
- * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
156
- *
157
- * @author Vova Feldman (@svovaf)
158
- * @since 1.0.4
159
- *
160
- * @uses FS_Api
161
- *
162
- * @param stdClass $transient_data Update array build by WordPress.
163
- *
164
- * @return array Modified update array with custom plugin data.
165
- */
166
- function pre_set_site_transient_update_plugins_filter( $transient_data ) {
167
- $this->_logger->entrance();
168
-
169
- if ( empty( $transient_data ) ||
170
- defined( 'WP_FS__UNINSTALL_MODE' )
171
- ) {
172
- return $transient_data;
173
- }
174
-
175
- if ( ! isset( $this->_update_details ) ) {
176
- // Get plugin's newest update.
177
- $new_version = $this->_fs->get_update( false, false );
178
-
179
- $this->_update_details = false;
180
-
181
- if ( is_object( $new_version ) ) {
182
- $this->_logger->log( 'Found newer plugin version ' . $new_version->version );
183
-
184
- $plugin_details = new stdClass();
185
- $plugin_details->slug = $this->_fs->get_slug();
186
- $plugin_details->new_version = $new_version->version;
187
- $plugin_details->url = WP_FS__ADDRESS;
188
- $plugin_details->package = $new_version->url;
189
- $plugin_details->plugin = $this->_fs->get_plugin_basename();
190
-
191
- /**
192
- * Cache plugin details locally since set_site_transient( 'update_plugins' )
193
- * called multiple times and the non wp.org plugins are filtered after the
194
- * call to .org.
195
- *
196
- * @since 1.1.8.1
197
- */
198
- $this->_update_details = $plugin_details;
199
- }
200
- }
201
-
202
- if ( is_object( $this->_update_details ) ) {
203
- // Add plugin to transient data.
204
- $transient_data->response[ $this->_fs->get_plugin_basename() ] = $this->_update_details;
205
- }
206
-
207
- return $transient_data;
208
- }
209
-
210
- /**
211
- * Try to fetch plugin's info from .org repository.
212
- *
213
- * @author Vova Feldman (@svovaf)
214
- * @since 1.0.5
215
- *
216
- * @param string $action
217
- * @param object $args
218
- *
219
- * @return bool|mixed
220
- */
221
- static function _fetch_plugin_info_from_repository( $action, $args ) {
222
- $url = $http_url = 'http://api.wordpress.org/plugins/info/1.0/';
223
- if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) {
224
- $url = set_url_scheme( $url, 'https' );
225
- }
226
-
227
- $args = array(
228
- 'timeout' => 15,
229
- 'body' => array(
230
- 'action' => $action,
231
- 'request' => serialize( $args )
232
- )
233
- );
234
-
235
- $request = wp_remote_post( $url, $args );
236
-
237
- if ( is_wp_error( $request ) ) {
238
- return false;
239
- }
240
-
241
- $res = maybe_unserialize( wp_remote_retrieve_body( $request ) );
242
-
243
- if ( ! is_object( $res ) && ! is_array( $res ) ) {
244
- return false;
245
- }
246
-
247
- return $res;
248
- }
249
-
250
- /**
251
- * Updates information on the "View version x.x details" page with custom data.
252
- *
253
- * @author Vova Feldman (@svovaf)
254
- * @since 1.0.4
255
- *
256
- * @uses FS_Api
257
- *
258
- * @param object $data
259
- * @param string $action
260
- * @param mixed $args
261
- *
262
- * @return object
263
- */
264
- function plugins_api_filter( $data, $action = '', $args = null ) {
265
- $this->_logger->entrance();
266
-
267
- if ( ( 'plugin_information' !== $action ) ||
268
- ! isset( $args->slug )
269
- ) {
270
- return $data;
271
- }
272
-
273
- $addon = false;
274
- $is_addon = false;
275
-
276
- if ( $this->_fs->get_slug() !== $args->slug ) {
277
- $addon = $this->_fs->get_addon_by_slug( $args->slug );
278
-
279
- if ( ! is_object( $addon ) ) {
280
- return $data;
281
- }
282
-
283
- $is_addon = true;
284
- }
285
-
286
- $plugin_in_repo = false;
287
- if ( ! $is_addon ) {
288
- // Try to fetch info from .org repository.
289
- $data = self::_fetch_plugin_info_from_repository( $action, $args );
290
-
291
- $plugin_in_repo = ( false !== $data );
292
- }
293
-
294
- if ( ! $plugin_in_repo ) {
295
- $data = $args;
296
-
297
- // Fetch as much as possible info from local files.
298
- $plugin_local_data = $this->_fs->get_plugin_data();
299
- $data->name = $plugin_local_data['Name'];
300
- $data->author = $plugin_local_data['Author'];
301
- $data->sections = array(
302
- 'description' => 'Upgrade ' . $plugin_local_data['Name'] . ' to latest.',
303
- );
304
-
305
- // @todo Store extra plugin info on Freemius or parse readme.txt markup.
306
- /*$info = $this->_fs->get_api_site_scope()->call('/information.json');
307
-
308
- if ( !isset($info->error) ) {
309
- $data = $info;
310
- }*/
311
- }
312
-
313
- // Get plugin's newest update.
314
- $new_version = $this->_fs->_fetch_latest_version( $is_addon ? $addon->id : false );
315
-
316
- if ( $is_addon ) {
317
- $data->name = $addon->title . ' ' . __fs( 'addon', $this->_fs->get_slug() );
318
- $data->slug = $addon->slug;
319
- $data->url = WP_FS__ADDRESS;
320
- $data->package = $new_version->url;
321
- }
322
-
323
- if ( ! $plugin_in_repo ) {
324
- $data->last_updated = ! is_null( $new_version->updated ) ? $new_version->updated : $new_version->created;
325
- $data->requires = $new_version->requires_platform_version;
326
- $data->tested = $new_version->tested_up_to_version;
327
- }
328
-
329
- $data->version = $new_version->version;
330
- $data->download_link = $new_version->url;
331
-
332
- return $data;
333
- }
334
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/class-fs-security.php DELETED
@@ -1,61 +0,0 @@
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
- class FS_Security {
16
- /**
17
- * @var FS_Security
18
- * @since 1.0.3
19
- */
20
- private static $_instance;
21
- /**
22
- * @var FS_Logger
23
- * @since 1.0.3
24
- */
25
- private static $_logger;
26
-
27
- public static function instance() {
28
- if ( ! isset( self::$_instance ) ) {
29
- self::$_instance = new FS_Security();
30
- self::$_logger = FS_Logger::get_logger( WP_FS__SLUG, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
31
- }
32
-
33
- return self::$_instance;
34
- }
35
-
36
- private function __construct() {
37
- }
38
-
39
- function get_secure_token( FS_Scope_Entity $entity, $timestamp, $action = '' ) {
40
- return md5(
41
- $timestamp .
42
- $entity->id .
43
- $entity->secret_key .
44
- $entity->public_key .
45
- $action
46
- );
47
- }
48
-
49
- function get_context_params( FS_Scope_Entity $entity, $timestamp = false, $action = '' ) {
50
- if ( false === $timestamp ) {
51
- $timestamp = time();
52
- }
53
-
54
- return array(
55
- 's_ctx_type' => $entity->get_type(),
56
- 's_ctx_id' => $entity->id,
57
- 's_ctx_ts' => $timestamp,
58
- 's_ctx_secure' => $this->get_secure_token( $entity, $timestamp, $action ),
59
- );
60
- }
61
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/debug/class-fs-debug-bar-panel.php DELETED
@@ -1,64 +0,0 @@
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.3
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- /**
14
- * Extends Debug Bar plugin by adding a panel to show all Freemius API requests.
15
- *
16
- * @author Vova Feldman (@svovaf)
17
- * @since 1.1.7.3
18
- *
19
- * Class Freemius_Debug_Bar_Panel
20
- */
21
- class Freemius_Debug_Bar_Panel extends Debug_Bar_Panel {
22
- function init() {
23
- $this->title( 'Freemius' );
24
- }
25
-
26
- static function requests_count() {
27
- if ( class_exists( 'Freemius_Api' ) ) {
28
- $logger = Freemius_Api::GetLogger();
29
- } else {
30
- $logger = array();
31
- }
32
-
33
- return number_format( count( $logger ) );
34
- }
35
-
36
- static function total_time() {
37
- if ( class_exists( 'Freemius_Api' ) ) {
38
- $logger = Freemius_Api::GetLogger();
39
- } else {
40
- $logger = array();
41
- }
42
-
43
- $total_time = .0;
44
- foreach ( $logger as $l ) {
45
- $total_time += $l['total'];
46
- }
47
-
48
- return number_format( 100 * $total_time, 2 ) . ' ' . __fs( 'ms' );
49
- }
50
-
51
- function render() {
52
- ?>
53
- <div id='debug-bar-php'>
54
- <?php fs_require_template( '/debug/api-calls.php' ) ?>
55
- <br>
56
- <?php fs_require_template( '/debug/scheduled-crons.php' ) ?>
57
- <br>
58
- <?php fs_require_template( '/debug/plugins-themes-sync.php' ) ?>
59
- <br>
60
- <?php fs_require_template( '/debug/logger.php' ) ?>
61
- </div>
62
- <?php
63
- }
64
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/debug/debug-bar-start.php DELETED
@@ -1,52 +0,0 @@
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.3
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- if ( ! WP_FS__DEBUG_SDK ) {
14
- return;
15
- }
16
-
17
- /**
18
- * Initialize Freemius custom debug panels.
19
- *
20
- * @param array $panels Debug bar panels objects
21
- *
22
- * @return array Debug bar panels with your custom panels
23
- */
24
- function fs_custom_panels_init( $panels ) {
25
- if ( class_exists( 'Debug_Bar_Panel' ) ) {
26
- if ( FS_API__LOGGER_ON ) {
27
- require_once dirname( __FILE__ ) . '/class-fs-debug-bar-panel.php';
28
- $panels[] = new Freemius_Debug_Bar_Panel();
29
- }
30
- }
31
-
32
- return $panels;
33
- }
34
-
35
- function fs_custom_status_init( $statuses ) {
36
- if ( class_exists( 'Debug_Bar_Panel' ) ) {
37
- if ( FS_API__LOGGER_ON ) {
38
- require_once dirname( __FILE__ ) . '/class-fs-debug-bar-panel.php';
39
- $statuses[] = array(
40
- 'fs_api_requests',
41
- __fs( 'Freemius API' ),
42
- Freemius_Debug_Bar_Panel::requests_count() . ' ' . __fs( 'Requests' ) .
43
- ' (' . Freemius_Debug_Bar_Panel::total_time() . ')'
44
- );
45
- }
46
- }
47
-
48
- return $statuses;
49
- }
50
-
51
- add_filter( 'debug_bar_panels', 'fs_custom_panels_init' );
52
- add_filter( 'debug_bar_statuses', 'fs_custom_status_init' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/entities/class-fs-entity.php DELETED
@@ -1,149 +0,0 @@
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|stdClass $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 DELETED
@@ -1,94 +0,0 @@
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 DELETED
@@ -1,34 +0,0 @@
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 DELETED
@@ -1,194 +0,0 @@
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
- class FS_Plugin_License 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 $plan_id;
29
- /**
30
- * @var number
31
- */
32
- public $pricing_id;
33
- /**
34
- * @var int|null
35
- */
36
- public $quota;
37
- /**
38
- * @var int
39
- */
40
- public $activated;
41
- /**
42
- * @var int
43
- */
44
- public $activated_local;
45
- /**
46
- * @var string
47
- */
48
- public $expiration;
49
- /**
50
- * @var string
51
- */
52
- public $secret_key;
53
- /**
54
- * @var bool $is_free_localhost Defaults to true. If true, allow unlimited localhost installs with the same
55
- * license.
56
- */
57
- public $is_free_localhost;
58
- /**
59
- * @var bool $is_block_features Defaults to true. If false, don't block features after license expiry - only
60
- * block updates and support.
61
- */
62
- public $is_block_features;
63
- /**
64
- * @var bool
65
- */
66
- public $is_cancelled;
67
-
68
- #endregion Properties
69
-
70
- /**
71
- * @param stdClass|bool $license
72
- */
73
- function __construct( $license = false ) {
74
- parent::__construct( $license );
75
- }
76
-
77
- static function get_type() {
78
- return 'license';
79
- }
80
-
81
- /**
82
- * Check how many site activations left.
83
- *
84
- * @author Vova Feldman (@svovaf)
85
- * @since 1.0.5
86
- *
87
- * @return int
88
- */
89
- function left() {
90
- if ( $this->is_expired() ) {
91
- return 0;
92
- }
93
-
94
- if ( $this->is_unlimited() ) {
95
- return 999;
96
- }
97
-
98
- return ( $this->quota - $this->activated - ( $this->is_free_localhost ? 0 : $this->activated_local ) );
99
- }
100
-
101
- /**
102
- * Check if single site license.
103
- *
104
- * @author Vova Feldman (@svovaf)
105
- * @since 1.1.8.1
106
- *
107
- * @return bool
108
- */
109
- function is_single_site() {
110
- return ( is_numeric( $this->quota ) && 1 == $this->quota );
111
- }
112
-
113
- /**
114
- * @author Vova Feldman (@svovaf)
115
- * @since 1.0.5
116
- *
117
- * @return bool
118
- */
119
- function is_expired() {
120
- return ! $this->is_lifetime() && ( strtotime( $this->expiration ) < WP_FS__SCRIPT_START_TIME );
121
- }
122
-
123
- /**
124
- * @author Vova Feldman (@svovaf)
125
- * @since 1.0.6
126
- *
127
- * @return bool
128
- */
129
- function is_lifetime() {
130
- return is_null( $this->expiration );
131
- }
132
-
133
- /**
134
- * @author Vova Feldman (@svovaf)
135
- * @since 1.2.0
136
- *
137
- * @return bool
138
- */
139
- function is_unlimited() {
140
- return is_null( $this->quota );
141
- }
142
-
143
- /**
144
- * Check if license is fully utilized.
145
- *
146
- * @author Vova Feldman (@svovaf)
147
- * @since 1.0.6
148
- *
149
- * @param bool $is_localhost
150
- *
151
- * @return bool
152
- */
153
- function is_utilized( $is_localhost = null ) {
154
- if ( is_null( $is_localhost ) ) {
155
- $is_localhost = WP_FS__IS_LOCALHOST_FOR_SERVER;
156
- }
157
-
158
- if ( $this->is_unlimited() ) {
159
- return false;
160
- }
161
-
162
- return ! ( $this->is_free_localhost && $is_localhost ) &&
163
- ( $this->quota <= $this->activated + ( $this->is_free_localhost ? 0 : $this->activated_local ) );
164
- }
165
-
166
- /**
167
- * Check if license's plan features are enabled.
168
- *
169
- * - Either if plan not expired
170
- * - If expired, based on the configuration to block features or not.
171
- *
172
- * @author Vova Feldman (@svovaf)
173
- * @since 1.0.6
174
- *
175
- * @return bool
176
- */
177
- function is_features_enabled() {
178
- return ( ! $this->is_block_features || ! $this->is_expired() );
179
- }
180
-
181
- /**
182
- * Subscription considered to be new without any payments
183
- * if the license expires in less than 24 hours
184
- * from the license creation.
185
- *
186
- * @author Vova Feldman (@svovaf)
187
- * @since 1.0.9
188
- *
189
- * @return bool
190
- */
191
- function is_first_payment_pending() {
192
- return ( WP_FS__TIME_24_HOURS_IN_SEC >= strtotime( $this->expiration ) - strtotime( $this->created ) );
193
- }
194
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/entities/class-fs-plugin-plan.php DELETED
@@ -1,140 +0,0 @@
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
- class FS_Plugin_Plan extends FS_Entity {
14
-
15
- #region Properties
16
-
17
- /**
18
- * @var number
19
- */
20
- public $plugin_id;
21
- /**
22
- * @var string
23
- */
24
- public $name;
25
- /**
26
- * @var string
27
- */
28
- public $title;
29
- /**
30
- * @var string
31
- */
32
- public $description;
33
- /**
34
- * @var bool Defaults to true. If true, allow unlimited localhost installs with the same license.
35
- */
36
- public $is_free_localhost;
37
- /**
38
- * @var bool Defaults to true. If false, don't block features after license expiry - only block updates and
39
- * support.
40
- */
41
- public $is_block_features;
42
- /**
43
- * @var int
44
- */
45
- public $license_type;
46
- /**
47
- * @var bool
48
- */
49
- public $is_https_support;
50
- /**
51
- * @var int Trial days.
52
- */
53
- public $trial_period;
54
- /**
55
- * @var string If true, require payment for trial.
56
- */
57
- public $is_require_subscription;
58
- /**
59
- * @var string Knowledge Base URL.
60
- */
61
- public $support_kb;
62
- /**
63
- * @var string Support Forum URL.
64
- */
65
- public $support_forum;
66
- /**
67
- * @var string Support email address.
68
- */
69
- public $support_email;
70
- /**
71
- * @var string Support phone.
72
- */
73
- public $support_phone;
74
- /**
75
- * @var string Support skype username.
76
- */
77
- public $support_skype;
78
- /**
79
- * @var bool Is personal success manager supported with the plan.
80
- */
81
- public $is_success_manager;
82
- /**
83
- * @var bool Is featured plan.
84
- */
85
- public $is_featured;
86
-
87
- #endregion Properties
88
-
89
- /**
90
- * @param object|bool $plan
91
- */
92
- function __construct( $plan = false ) {
93
- parent::__construct( $plan );
94
-
95
- if ( is_object( $plan ) ) {
96
- $this->name = strtolower( $plan->name );
97
- }
98
- }
99
-
100
- static function get_type() {
101
- return 'plan';
102
- }
103
-
104
- /**
105
- * @author Vova Feldman (@svovaf)
106
- * @since 1.0.9
107
- *
108
- * @return bool
109
- */
110
- function is_free() {
111
- return ( 'free' === $this->name );
112
- }
113
-
114
- /**
115
- * Checks if this plan supports "Technical Support".
116
- *
117
- * @author Leo Fajardo (leorw)
118
- * @since 1.2.0
119
- *
120
- * @return bool
121
- */
122
- function has_technical_support() {
123
- return ( ! empty( $this->support_email ) ||
124
- ! empty( $this->support_skype ) ||
125
- ! empty( $this->support_phone ) ||
126
- ! empty( $this->is_success_manager )
127
- );
128
- }
129
-
130
- /**
131
- * @author Vova Feldman (@svovaf)
132
- * @since 1.0.9
133
- *
134
- * @return bool
135
- */
136
- function has_trial() {
137
- return ! $this->is_free() &&
138
- is_numeric( $this->trial_period ) && ( $this->trial_period > 0 );
139
- }
140
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/entities/class-fs-plugin-tag.php DELETED
@@ -1,24 +0,0 @@
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 DELETED
@@ -1,90 +0,0 @@
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
- #region Install Specific Properties
29
-
30
- /**
31
- * @var string
32
- */
33
- public $file;
34
- /**
35
- * @var string
36
- */
37
- public $version;
38
- /**
39
- * @var bool
40
- */
41
- public $auto_update;
42
- /**
43
- * @var FS_Plugin_Info
44
- */
45
- public $info;
46
- /**
47
- * @since 1.0.9
48
- *
49
- * @var bool
50
- */
51
- public $is_premium;
52
- /**
53
- * @since 1.0.9
54
- *
55
- * @var bool
56
- */
57
- public $is_live;
58
-
59
- #endregion Install Specific Properties
60
-
61
- /**
62
- * @param stdClass|bool $plugin
63
- */
64
- function __construct( $plugin = false ) {
65
- parent::__construct( $plugin );
66
-
67
- $this->is_premium = false;
68
- $this->is_live = true;
69
-
70
- if ( isset( $plugin->info ) && is_object( $plugin->info ) ) {
71
- $this->info = new FS_Plugin_Info( $plugin->info );
72
- }
73
- }
74
-
75
- /**
76
- * Check if plugin is an add-on (has parent).
77
- *
78
- * @author Vova Feldman (@svovaf)
79
- * @since 1.0.6
80
- *
81
- * @return bool
82
- */
83
- function is_addon() {
84
- return isset( $this->parent_plugin_id ) && is_numeric( $this->parent_plugin_id );
85
- }
86
-
87
- static function get_type() {
88
- return 'plugin';
89
- }
90
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/entities/class-fs-pricing.php DELETED
@@ -1,141 +0,0 @@
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 DELETED
@@ -1,29 +0,0 @@
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 DELETED
@@ -1,127 +0,0 @@
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
- * @var string Programming language version (e.g PHP version).
56
- */
57
- public $programming_language_version;
58
- /**
59
- * @var FS_Plugin_Plan $plan
60
- */
61
- public $plan;
62
- /**
63
- * @var number|null
64
- */
65
- public $license_id;
66
- /**
67
- * @var number|null
68
- */
69
- public $trial_plan_id;
70
- /**
71
- * @var string|null
72
- */
73
- public $trial_ends;
74
- /**
75
- * @since 1.0.9
76
- *
77
- * @var bool
78
- */
79
- public $is_premium = false;
80
-
81
- /**
82
- * @param stdClass|bool $site
83
- */
84
- function __construct( $site = false ) {
85
- $this->plan = new FS_Plugin_Plan();
86
-
87
- parent::__construct( $site );
88
-
89
- if ( is_object( $site ) ) {
90
- $this->plan->id = $site->plan_id;
91
- }
92
- }
93
-
94
- static function get_type() {
95
- return 'install';
96
- }
97
-
98
- function is_localhost() {
99
- // The server has no way to verify if localhost unless localhost appears in domain.
100
- return WP_FS__IS_LOCALHOST_FOR_SERVER;
101
- // return (substr($_SERVER['REMOTE_ADDR'], 0, 4) == '127.' || $_SERVER['REMOTE_ADDR'] == '::1');
102
- }
103
-
104
- /**
105
- * Check if site in trial.
106
- *
107
- * @author Vova Feldman (@svovaf)
108
- * @since 1.0.9
109
- *
110
- * @return bool
111
- */
112
- function is_trial() {
113
- return is_numeric( $this->trial_plan_id ) && ( strtotime( $this->trial_ends ) > WP_FS__SCRIPT_START_TIME );
114
- }
115
-
116
- /**
117
- * Check if user already utilized the trial with the current install.
118
- *
119
- * @author Vova Feldman (@svovaf)
120
- * @since 1.0.9
121
- *
122
- * @return bool
123
- */
124
- function is_trial_utilized() {
125
- return is_numeric( $this->trial_plan_id );
126
- }
127
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/entities/class-fs-subscription.php DELETED
@@ -1,125 +0,0 @@
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 DELETED
@@ -1,62 +0,0 @@
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/fs-core-functions.php DELETED
@@ -1,453 +0,0 @@
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
- global $fs_core_logger;
14
-
15
- $fs_core_logger = FS_Logger::get_logger( WP_FS__SLUG . '_core', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
16
-
17
- if ( ! function_exists( 'fs_dummy' ) ) {
18
- function fs_dummy() {
19
- }
20
- }
21
-
22
- /* Url.
23
- --------------------------------------------------------------------------------------------*/
24
- function fs_get_url_daily_cache_killer() {
25
- return date( '\YY\Mm\Dd' );
26
- }
27
-
28
- /* Templates / Views.
29
- --------------------------------------------------------------------------------------------*/
30
- if ( ! function_exists( 'fs_get_template_path' ) ) {
31
- function fs_get_template_path( $path ) {
32
- return WP_FS__DIR_TEMPLATES . '/' . trim( $path, '/' );
33
- }
34
-
35
- function fs_include_template( $path, &$params = null ) {
36
- $VARS = &$params;
37
- include( fs_get_template_path( $path ) );
38
- }
39
-
40
- function fs_include_once_template( $path, &$params = null ) {
41
- $VARS = &$params;
42
- include_once( fs_get_template_path( $path ) );
43
- }
44
-
45
- function fs_require_template( $path, &$params = null ) {
46
- $VARS = &$params;
47
- require( fs_get_template_path( $path ) );
48
- }
49
-
50
- function fs_require_once_template( $path, &$params = null ) {
51
- $VARS = &$params;
52
- require_once( fs_get_template_path( $path ) );
53
- }
54
-
55
- function fs_get_template( $path, &$params = null ) {
56
- ob_start();
57
-
58
- $VARS = &$params;
59
- require_once( fs_get_template_path( $path ) );
60
-
61
- return ob_get_clean();
62
- }
63
- }
64
-
65
- /* Scripts and styles including.
66
- --------------------------------------------------------------------------------------------*/
67
- function fs_enqueue_local_style( $handle, $path, $deps = array(), $ver = false, $media = 'all' ) {
68
- global $fs_core_logger;
69
- if ( $fs_core_logger->is_on() ) {
70
- $fs_core_logger->info( 'handle = ' . $handle . '; path = ' . $path . ';' );
71
- $fs_core_logger->info( 'plugin_basename = ' . plugins_url( WP_FS__DIR_CSS . trim( $path, '/' ) ) );
72
- $fs_core_logger->info( 'plugins_url = ' . plugins_url( plugin_basename( WP_FS__DIR_CSS . '/' . trim( $path, '/' ) ) ) );
73
- }
74
-
75
- wp_enqueue_style( $handle, plugins_url( plugin_basename( WP_FS__DIR_CSS . '/' . trim( $path, '/' ) ) ), $deps, $ver, $media );
76
- }
77
-
78
- function fs_enqueue_local_script( $handle, $path, $deps = array(), $ver = false, $in_footer = 'all' ) {
79
- global $fs_core_logger;
80
- if ( $fs_core_logger->is_on() ) {
81
- $fs_core_logger->info( 'handle = ' . $handle . '; path = ' . $path . ';' );
82
- $fs_core_logger->info( 'plugin_basename = ' . plugins_url( WP_FS__DIR_JS . trim( $path, '/' ) ) );
83
- $fs_core_logger->info( 'plugins_url = ' . plugins_url( plugin_basename( WP_FS__DIR_JS . '/' . trim( $path, '/' ) ) ) );
84
- }
85
-
86
- wp_enqueue_script( $handle, plugins_url( plugin_basename( WP_FS__DIR_JS . '/' . trim( $path, '/' ) ) ), $deps, $ver, $in_footer );
87
- }
88
-
89
- function fs_img_url( $path, $img_dir = WP_FS__DIR_IMG ) {
90
- return plugins_url( plugin_basename( $img_dir . '/' . trim( $path, '/' ) ) );
91
- }
92
-
93
- /* Request handlers.
94
- --------------------------------------------------------------------------------------------*/
95
- /**
96
- * @param string $key
97
- * @param mixed $def
98
- *
99
- * @return mixed
100
- */
101
- function fs_request_get( $key, $def = false ) {
102
- return isset( $_REQUEST[ $key ] ) ? $_REQUEST[ $key ] : $def;
103
- }
104
-
105
- function fs_request_has( $key ) {
106
- return isset( $_REQUEST[ $key ] );
107
- }
108
-
109
- function fs_request_get_bool( $key, $def = false ) {
110
- if ( ! isset( $_REQUEST[ $key ] ) ) {
111
- return $def;
112
- }
113
-
114
- if ( 1 == $_REQUEST[ $key ] || 'true' === strtolower( $_REQUEST[ $key ] ) ) {
115
- return true;
116
- }
117
-
118
- if ( 0 == $_REQUEST[ $key ] || 'false' === strtolower( $_REQUEST[ $key ] ) ) {
119
- return false;
120
- }
121
-
122
- return $def;
123
- }
124
-
125
- function fs_request_is_post() {
126
- return ( 'post' === strtolower( $_SERVER['REQUEST_METHOD'] ) );
127
- }
128
-
129
- function fs_request_is_get() {
130
- return ( 'get' === strtolower( $_SERVER['REQUEST_METHOD'] ) );
131
- }
132
-
133
- function fs_get_action( $action_key = 'action' ) {
134
- if ( ! empty( $_REQUEST[ $action_key ] ) ) {
135
- return strtolower( $_REQUEST[ $action_key ] );
136
- }
137
-
138
- if ( 'action' == $action_key ) {
139
- $action_key = 'fs_action';
140
-
141
- if ( ! empty( $_REQUEST[ $action_key ] ) ) {
142
- return strtolower( $_REQUEST[ $action_key ] );
143
- }
144
- }
145
-
146
- return false;
147
- }
148
-
149
- function fs_request_is_action( $action, $action_key = 'action' ) {
150
- return ( strtolower( $action ) === fs_get_action( $action_key ) );
151
- }
152
-
153
- function fs_is_plugin_page( $menu_slug ) {
154
- return ( is_admin() && $_REQUEST['page'] === $menu_slug );
155
- }
156
-
157
- /* Core UI.
158
- --------------------------------------------------------------------------------------------*/
159
- /**
160
- * @param string $slug
161
- * @param string $page
162
- * @param string $action
163
- * @param string $title
164
- * @param array $params
165
- * @param bool $is_primary
166
- * @param string|bool $icon_class Optional class for an icon (since 1.1.7).
167
- * @param string|bool $confirmation Optional confirmation message before submit (since 1.1.7).
168
- * @param string $method Since 1.1.7
169
- *
170
- * @uses fs_ui_get_action_button()
171
- */
172
- function fs_ui_action_button(
173
- $slug,
174
- $page,
175
- $action,
176
- $title,
177
- $params = array(),
178
- $is_primary = true,
179
- $icon_class = false,
180
- $confirmation = false,
181
- $method = 'GET'
182
- ) {
183
- echo fs_ui_get_action_button(
184
- $slug,
185
- $page,
186
- $action,
187
- $title,
188
- $params,
189
- $is_primary,
190
- $icon_class,
191
- $confirmation,
192
- $method
193
- );
194
- }
195
-
196
- /**
197
- * @author Vova Feldman (@svovaf)
198
- * @since 1.1.7
199
- *
200
- * @param string $slug
201
- * @param string $page
202
- * @param string $action
203
- * @param string $title
204
- * @param array $params
205
- * @param bool $is_primary
206
- * @param string|bool $icon_class Optional class for an icon.
207
- * @param string|bool $confirmation Optional confirmation message before submit.
208
- * @param string $method
209
- *
210
- * @return string
211
- */
212
- function fs_ui_get_action_button(
213
- $slug,
214
- $page,
215
- $action,
216
- $title,
217
- $params = array(),
218
- $is_primary = true,
219
- $icon_class = false,
220
- $confirmation = false,
221
- $method = 'GET'
222
- ) {
223
- // Prepend icon (if set).
224
- $title = ( is_string( $icon_class ) ? '<i class="' . $icon_class . '"></i> ' : '' ) . $title;
225
-
226
- if ( is_string( $confirmation ) ) {
227
- return sprintf( '<form action="%s" method="%s"><input type="hidden" name="fs_action" value="%s">%s<a href="#" class="%s" onclick="if (confirm(\'%s\')) this.parentNode.submit(); return false;">%s</a></form>',
228
- freemius( $slug )->_get_admin_page_url( $page, $params ),
229
- $method,
230
- $action,
231
- wp_nonce_field( $action, '_wpnonce', true, false ),
232
- 'button' . ( $is_primary ? ' button-primary' : '' ),
233
- $confirmation,
234
- $title
235
- );
236
- } else if ( 'GET' !== strtoupper( $method ) ) {
237
- return sprintf( '<form action="%s" method="%s"><input type="hidden" name="fs_action" value="%s">%s<a href="#" class="%s" onclick="this.parentNode.submit(); return false;">%s</a></form>',
238
- freemius( $slug )->_get_admin_page_url( $page, $params ),
239
- $method,
240
- $action,
241
- wp_nonce_field( $action, '_wpnonce', true, false ),
242
- 'button' . ( $is_primary ? ' button-primary' : '' ),
243
- $title
244
- );
245
- } else {
246
- return sprintf( '<a href="%s" class="%s">%s</a></form>',
247
- wp_nonce_url( freemius( $slug )->_get_admin_page_url( $page, array_merge( $params, array( 'fs_action' => $action ) ) ), $action ),
248
- 'button' . ( $is_primary ? ' button-primary' : '' ),
249
- $title
250
- );
251
- }
252
- }
253
-
254
- function fs_ui_action_link( $slug, $page, $action, $title, $params = array() ) {
255
- ?><a class=""
256
- href="<?php echo wp_nonce_url( freemius( $slug )->_get_admin_page_url( $page, array_merge( $params, array( 'fs_action' => $action ) ) ), $action ) ?>"><?php echo $title ?></a><?php
257
- }
258
-
259
- /*function fs_error_handler($errno, $errstr, $errfile, $errline)
260
- {
261
- if (false === strpos($errfile, 'freemius/'))
262
- {
263
- // @todo Dump Freemius errors to local log.
264
- }
265
-
266
- // switch ($errno) {
267
- // case E_USER_ERROR:
268
- // break;
269
- // case E_WARNING:
270
- // case E_USER_WARNING:
271
- // break;
272
- // case E_NOTICE:
273
- // case E_USER_NOTICE:
274
- // break;
275
- // default:
276
- // break;
277
- // }
278
- }
279
-
280
- set_error_handler('fs_error_handler');*/
281
-
282
- function fs_nonce_url( $actionurl, $action = - 1, $name = '_wpnonce' ) {
283
- // $actionurl = str_replace( '&amp;', '&', $actionurl );
284
- return add_query_arg( $name, wp_create_nonce( $action ), $actionurl );
285
- }
286
-
287
- if ( ! function_exists( 'fs_starts_with' ) ) {
288
- /**
289
- * Check if string starts with.
290
- *
291
- * @author Vova Feldman (@svovaf)
292
- * @since 1.1.3
293
- *
294
- * @param string $haystack
295
- * @param string $needle
296
- *
297
- * @return bool
298
- */
299
- function fs_starts_with( $haystack, $needle ) {
300
- $length = strlen( $needle );
301
-
302
- return ( substr( $haystack, 0, $length ) === $needle );
303
- }
304
- }
305
-
306
- #region Url Canonization ------------------------------------------------------------------
307
-
308
- if ( ! function_exists( 'fs_canonize_url' ) ) {
309
- /**
310
- * @author Vova Feldman (@svovaf)
311
- * @since 1.1.3
312
- *
313
- * @param string $url
314
- * @param bool $omit_host
315
- * @param array $ignore_params
316
- *
317
- * @return string
318
- */
319
- function fs_canonize_url( $url, $omit_host = false, $ignore_params = array() ) {
320
- $parsed_url = parse_url( strtolower( $url ) );
321
-
322
- // if ( ! isset( $parsed_url['host'] ) ) {
323
- // return $url;
324
- // }
325
-
326
- $canonical = ( ( $omit_host || ! isset( $parsed_url['host'] ) ) ? '' : $parsed_url['host'] ) . $parsed_url['path'];
327
-
328
- if ( isset( $parsed_url['query'] ) ) {
329
- parse_str( $parsed_url['query'], $queryString );
330
- $canonical .= '?' . fs_canonize_query_string( $queryString, $ignore_params );
331
- }
332
-
333
- return $canonical;
334
- }
335
- }
336
-
337
- if ( ! function_exists( 'fs_canonize_query_string' ) ) {
338
- /**
339
- * @author Vova Feldman (@svovaf)
340
- * @since 1.1.3
341
- *
342
- * @param array $params
343
- * @param array $ignore_params
344
- * @param bool $params_prefix
345
- *
346
- * @return string
347
- */
348
- function fs_canonize_query_string( array $params, array &$ignore_params, $params_prefix = false ) {
349
- if ( ! is_array( $params ) || 0 === count( $params ) ) {
350
- return '';
351
- }
352
-
353
- // Urlencode both keys and values
354
- $keys = fs_urlencode_rfc3986( array_keys( $params ) );
355
- $values = fs_urlencode_rfc3986( array_values( $params ) );
356
- $params = array_combine( $keys, $values );
357
-
358
- // Parameters are sorted by name, using lexicographical byte value ordering.
359
- // Ref: Spec: 9.1.1 (1)
360
- uksort( $params, 'strcmp' );
361
-
362
- $pairs = array();
363
- foreach ( $params as $parameter => $value ) {
364
- $lower_param = strtolower( $parameter );
365
-
366
- // Skip ignore params.
367
- if ( in_array( $lower_param, $ignore_params ) || ( false !== $params_prefix && startsWith( $lower_param, $params_prefix ) ) ) {
368
- continue;
369
- }
370
-
371
- if ( is_array( $value ) ) {
372
- // If two or more parameters share the same name, they are sorted by their value
373
- // Ref: Spec: 9.1.1 (1)
374
- natsort( $value );
375
- foreach ( $value as $duplicate_value ) {
376
- $pairs[] = $lower_param . '=' . $duplicate_value;
377
- }
378
- } else {
379
- $pairs[] = $lower_param . '=' . $value;
380
- }
381
- }
382
-
383
- if ( 0 === count( $pairs ) ) {
384
- return '';
385
- }
386
-
387
- return implode( "&", $pairs );
388
- }
389
- }
390
-
391
- if ( ! function_exists( 'fs_urlencode_rfc3986' ) ) {
392
- /**
393
- * @author Vova Feldman (@svovaf)
394
- * @since 1.1.3
395
- *
396
- * @param string|string[] $input
397
- *
398
- * @return array|mixed|string
399
- */
400
- function fs_urlencode_rfc3986( $input ) {
401
- if ( is_array( $input ) ) {
402
- return array_map( 'fs_urlencode_rfc3986', $input );
403
- } else if ( is_scalar( $input ) ) {
404
- return str_replace( '+', ' ', str_replace( '%7E', '~', rawurlencode( $input ) ) );
405
- }
406
-
407
- return '';
408
- }
409
- }
410
-
411
- #endregion Url Canonization ------------------------------------------------------------------
412
-
413
- function fs_download_image( $from, $to ) {
414
- $ch = curl_init( $from );
415
- $fp = fopen( fs_normalize_path( $to ), 'wb' );
416
- curl_setopt( $ch, CURLOPT_FILE, $fp );
417
- curl_setopt( $ch, CURLOPT_HEADER, 0 );
418
- curl_exec( $ch );
419
- curl_close( $ch );
420
- fclose( $fp );
421
- }
422
-
423
- /* General Utilities
424
- --------------------------------------------------------------------------------------------*/
425
-
426
- /**
427
- * Sorts an array by the value of the priority key.
428
- *
429
- * @author Daniel Iser (@danieliser)
430
- * @since 1.1.7
431
- *
432
- * @param $a
433
- * @param $b
434
- *
435
- * @return int
436
- */
437
- function fs_sort_by_priority( $a, $b ) {
438
-
439
- // If b has a priority and a does not, b wins.
440
- if ( ! isset( $a['priority'] ) && isset( $b['priority'] ) ) {
441
- return 1;
442
- } // If b has a priority and a does not, b wins.
443
- elseif ( isset( $a['priority'] ) && ! isset( $b['priority'] ) ) {
444
- return - 1;
445
- } // If neither has a priority or both priorities are equal its a tie.
446
- elseif ( ( ! isset( $a['priority'] ) && ! isset( $b['priority'] ) ) || $a['priority'] === $b['priority'] ) {
447
- return 0;
448
- }
449
-
450
- // If both have priority return the winner.
451
- return ( $a['priority'] < $b['priority'] ) ? - 1 : 1;
452
- }
453
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/fs-essential-functions.php DELETED
@@ -1,412 +0,0 @@
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.5
7
- */
8
-
9
- if ( ! function_exists( 'fs_normalize_path' ) ) {
10
- if ( function_exists( 'wp_normalize_path' ) ) {
11
- /**
12
- * Normalize a filesystem path.
13
- *
14
- * Replaces backslashes with forward slashes for Windows systems, and ensures
15
- * no duplicate slashes exist.
16
- *
17
- * @param string $path Path to normalize.
18
- *
19
- * @return string Normalized path.
20
- */
21
- function fs_normalize_path( $path ) {
22
- return wp_normalize_path( $path );
23
- }
24
- } else {
25
- function fs_normalize_path( $path ) {
26
- $path = str_replace( '\\', '/', $path );
27
- $path = preg_replace( '|/+|', '/', $path );
28
-
29
- return $path;
30
- }
31
- }
32
- }
33
-
34
- #region Core Redirect (copied from BuddyPress) -----------------------------------------
35
-
36
- if ( ! function_exists( 'fs_redirect' ) ) {
37
- /**
38
- * Redirects to another page, with a workaround for the IIS Set-Cookie bug.
39
- *
40
- * @link http://support.microsoft.com/kb/q176113/
41
- * @since 1.5.1
42
- * @uses apply_filters() Calls 'wp_redirect' hook on $location and $status.
43
- *
44
- * @param string $location The path to redirect to
45
- * @param int $status Status code to use
46
- *
47
- * @return bool False if $location is not set
48
- */
49
- function fs_redirect( $location, $status = 302 ) {
50
- global $is_IIS;
51
-
52
- if ( headers_sent() ) {
53
- return false;
54
- }
55
-
56
- if ( ! $location ) // allows the wp_redirect filter to cancel a redirect
57
- {
58
- return false;
59
- }
60
-
61
- $location = fs_sanitize_redirect( $location );
62
-
63
- if ( $is_IIS ) {
64
- header( "Refresh: 0;url=$location" );
65
- } else {
66
- if ( php_sapi_name() != 'cgi-fcgi' ) {
67
- status_header( $status );
68
- } // This causes problems on IIS and some FastCGI setups
69
- header( "Location: $location" );
70
- }
71
-
72
- return true;
73
- }
74
-
75
- if ( ! function_exists( 'fs_sanitize_redirect' ) ) {
76
- /**
77
- * Sanitizes a URL for use in a redirect.
78
- *
79
- * @since 2.3
80
- *
81
- * @param string $location
82
- *
83
- * @return string redirect-sanitized URL
84
- */
85
- function fs_sanitize_redirect( $location ) {
86
- $location = preg_replace( '|[^a-z0-9-~+_.?#=&;,/:%!]|i', '', $location );
87
- $location = fs_kses_no_null( $location );
88
-
89
- // remove %0d and %0a from location
90
- $strip = array( '%0d', '%0a' );
91
- $found = true;
92
- while ( $found ) {
93
- $found = false;
94
- foreach ( (array) $strip as $val ) {
95
- while ( strpos( $location, $val ) !== false ) {
96
- $found = true;
97
- $location = str_replace( $val, '', $location );
98
- }
99
- }
100
- }
101
-
102
- return $location;
103
- }
104
- }
105
-
106
- if ( ! function_exists( 'fs_kses_no_null' ) ) {
107
- /**
108
- * Removes any NULL characters in $string.
109
- *
110
- * @since 1.0.0
111
- *
112
- * @param string $string
113
- *
114
- * @return string
115
- */
116
- function fs_kses_no_null( $string ) {
117
- $string = preg_replace( '/\0+/', '', $string );
118
- $string = preg_replace( '/(\\\\0)+/', '', $string );
119
-
120
- return $string;
121
- }
122
- }
123
- }
124
-
125
- #endregion Core Redirect (copied from BuddyPress) -----------------------------------------
126
-
127
- if ( ! function_exists( '__fs' ) ) {
128
- global $fs_text_overrides;
129
-
130
- if ( ! isset( $fs_text_overrides ) ) {
131
- $fs_text_overrides = array();
132
- }
133
-
134
- /**
135
- * Retrieve a translated text by key.
136
- *
137
- * @author Vova Feldman (@svovaf)
138
- * @since 1.1.4
139
- *
140
- * @param string $key
141
- * @param string $slug
142
- *
143
- * @return string
144
- *
145
- * @global $fs_text , $fs_text_overrides
146
- */
147
- function __fs( $key, $slug = 'freemius' ) {
148
- global $fs_text, $fs_text_overrides;
149
-
150
- if ( ! isset( $fs_text ) ) {
151
- require_once( ( defined( 'WP_FS__DIR_INCLUDES' ) ? WP_FS__DIR_INCLUDES : dirname( __FILE__ ) ) . '/i18n.php' );
152
- }
153
-
154
- if ( isset( $fs_text_overrides[ $slug ] ) ) {
155
- if ( isset( $fs_text_overrides[ $slug ][ $key ] ) ) {
156
- return $fs_text_overrides[ $slug ][ $key ];
157
- }
158
-
159
- $lower_key = strtolower( $key );
160
- if ( isset( $fs_text_overrides[ $slug ][ $lower_key ] ) ) {
161
- return $fs_text_overrides[ $slug ][ $lower_key ];
162
- }
163
- }
164
-
165
- return isset( $fs_text[ $key ] ) ?
166
- $fs_text[ $key ] :
167
- $key;
168
- }
169
-
170
- /**
171
- * Display a translated text by key.
172
- *
173
- * @author Vova Feldman (@svovaf)
174
- * @since 1.1.4
175
- *
176
- * @param string $key
177
- * @param string $slug
178
- */
179
- function _efs( $key, $slug = 'freemius' ) {
180
- echo __fs( $key, $slug );
181
- }
182
-
183
- /**
184
- * Override default i18n text phrases.
185
- *
186
- * @author Vova Feldman (@svovaf)
187
- * @since 1.1.6
188
- *
189
- * @param string[] $key_value
190
- * @param string $slug
191
- *
192
- * @global $fs_text_overrides
193
- */
194
- function fs_override_i18n( array $key_value, $slug = 'freemius' ) {
195
- global $fs_text_overrides;
196
-
197
- if ( ! isset( $fs_text_overrides[ $slug ] ) ) {
198
- $fs_text_overrides[ $slug ] = array();
199
- }
200
-
201
- foreach ( $key_value as $key => $value ) {
202
- $fs_text_overrides[ $slug ][ $key ] = $value;
203
- }
204
- }
205
- }
206
-
207
- if ( ! function_exists( 'fs_get_ip' ) ) {
208
- /**
209
- * Get client IP.
210
- *
211
- * @author Vova Feldman (@svovaf)
212
- * @since 1.1.2
213
- *
214
- * @return string|null
215
- */
216
- function fs_get_ip() {
217
- $fields = array(
218
- 'HTTP_CF_CONNECTING_IP',
219
- 'HTTP_CLIENT_IP',
220
- 'HTTP_X_FORWARDED_FOR',
221
- 'HTTP_X_FORWARDED',
222
- 'HTTP_FORWARDED_FOR',
223
- 'HTTP_FORWARDED',
224
- 'REMOTE_ADDR',
225
- );
226
-
227
- foreach ( $fields as $ip_field ) {
228
- if ( ! empty( $_SERVER[ $ip_field ] ) ) {
229
- return $_SERVER[ $ip_field ];
230
- }
231
- }
232
-
233
- return null;
234
- }
235
- }
236
-
237
- /**
238
- * Leverage backtrace to find caller plugin main file path.
239
- *
240
- * @author Vova Feldman (@svovaf)
241
- * @since 1.0.6
242
- *
243
- * @return string
244
- */
245
- function fs_find_caller_plugin_file() {
246
- /**
247
- * All the code below will be executed once on activation.
248
- * If the user changes the main plugin's file name, the file_exists()
249
- * will catch it.
250
- */
251
- if ( ! function_exists( 'get_plugins' ) ) {
252
- require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
253
- }
254
-
255
- $all_plugins = get_plugins();
256
- $all_plugins_paths = array();
257
-
258
- // Get active plugin's main files real full names (might be symlinks).
259
- foreach ( $all_plugins as $relative_path => &$data ) {
260
- $all_plugins_paths[] = fs_normalize_path( realpath( WP_PLUGIN_DIR . '/' . $relative_path ) );
261
- }
262
-
263
- $plugin_file = null;
264
- for ( $i = 1, $bt = debug_backtrace(), $len = count( $bt ); $i < $len; $i ++ ) {
265
- if ( in_array( fs_normalize_path( $bt[ $i ]['file'] ), $all_plugins_paths ) ) {
266
- $plugin_file = $bt[ $i ]['file'];
267
- break;
268
- }
269
- }
270
-
271
- if ( is_null( $plugin_file ) ) {
272
- // Throw an error to the developer in case of some edge case dev environment.
273
- wp_die( __fs( 'failed-finding-main-path' ), __fs( 'error' ), array( 'back_link' => true ) );
274
- }
275
-
276
- return $plugin_file;
277
- }
278
-
279
- require_once dirname( __FILE__ ) . '/supplements/fs-essential-functions-1.1.7.1.php';
280
-
281
- /**
282
- * Update SDK newest version reference.
283
- *
284
- * @author Vova Feldman (@svovaf)
285
- * @since 1.1.6
286
- *
287
- * @param string $sdk_relative_path
288
- * @param string|bool $plugin_file
289
- *
290
- * @global $fs_active_plugins
291
- */
292
- function fs_update_sdk_newest_version( $sdk_relative_path, $plugin_file = false ) {
293
- global $fs_active_plugins;
294
-
295
- if ( ! is_string( $plugin_file ) ) {
296
- $plugin_file = plugin_basename( fs_find_caller_plugin_file() );
297
- }
298
-
299
- $fs_active_plugins->newest = (object) array(
300
- 'plugin_path' => $plugin_file,
301
- 'sdk_path' => $sdk_relative_path,
302
- 'version' => $fs_active_plugins->plugins[ $sdk_relative_path ]->version,
303
- 'in_activation' => ! is_plugin_active( $plugin_file ),
304
- 'timestamp' => time(),
305
- );
306
-
307
- // Update DB with latest SDK version and path.
308
- update_option( 'fs_active_plugins', $fs_active_plugins );
309
- }
310
-
311
- /**
312
- * Reorder the plugins load order so the plugin with the newest Freemius SDK is loaded first.
313
- *
314
- * @author Vova Feldman (@svovaf)
315
- * @since 1.1.6
316
- *
317
- * @return bool Was plugin order changed. Return false if plugin was loaded first anyways.
318
- *
319
- * @global $fs_active_plugins
320
- */
321
- function fs_newest_sdk_plugin_first() {
322
- global $fs_active_plugins;
323
-
324
- /**
325
- * @todo Multi-site network activated plugin are always loaded prior to site plugins so if there's a a plugin activated in the network mode that has an older version of the SDK of another plugin which is site activated that has new SDK version, the fs-essential-functions.php will be loaded from the older SDK. Same thing about MU plugins (loaded even before network activated plugins).
326
- *
327
- * @link https://github.com/Freemius/wordpress-sdk/issues/26
328
- */
329
- // $active_sitewide_plugins = get_site_option( 'active_sitewide_plugins' );
330
-
331
- $active_plugins = get_option( 'active_plugins' );
332
- $newest_sdk_plugin_key = array_search( $fs_active_plugins->newest->plugin_path, $active_plugins );
333
- if ( 0 == $newest_sdk_plugin_key ) {
334
- // if it's 0 it's the first plugin already, no need to continue
335
- return false;
336
- }
337
-
338
- array_splice( $active_plugins, $newest_sdk_plugin_key, 1 );
339
- array_unshift( $active_plugins, $fs_active_plugins->newest->plugin_path );
340
- update_option( 'active_plugins', $active_plugins );
341
-
342
- return true;
343
- }
344
-
345
- /**
346
- * Go over all Freemius SDKs in the system and find and "remember"
347
- * the newest SDK which is associated with an active plugin.
348
- *
349
- * @author Vova Feldman (@svovaf)
350
- * @since 1.1.6
351
- *
352
- * @global $fs_active_plugins
353
- */
354
- function fs_fallback_to_newest_active_sdk() {
355
- global $fs_active_plugins;
356
-
357
- $newest_sdk_data = null;
358
- $newest_sdk_path = null;
359
-
360
- foreach ( $fs_active_plugins->plugins as $sdk_relative_path => $data ) {
361
- if ( is_null( $newest_sdk_data ) || version_compare( $data->version, $newest_sdk_data->version, '>' )
362
- ) {
363
- // If plugin inactive or SDK starter file doesn't exist, remove SDK reference.
364
- if ( ! is_plugin_active( $data->plugin_path ) ||
365
- ! file_exists( fs_normalize_path( WP_PLUGIN_DIR . '/' . $sdk_relative_path . '/start.php' ) )
366
- ) {
367
- unset( $fs_active_plugins->plugins[ $sdk_relative_path ] );
368
-
369
- // No need to store the data since it will be stored in fs_update_sdk_newest_version()
370
- // or explicitly with update_option().
371
- } else {
372
- $newest_sdk_data = $data;
373
- $newest_sdk_path = $sdk_relative_path;
374
- }
375
- }
376
- }
377
-
378
- if ( is_null( $newest_sdk_data ) ) {
379
- // Couldn't find any SDK reference.
380
- $fs_active_plugins = new stdClass();
381
- update_option( 'fs_active_plugins', $fs_active_plugins );
382
- } else {
383
- fs_update_sdk_newest_version( $newest_sdk_path, $newest_sdk_data->plugin_path );
384
- }
385
- }
386
-
387
- #region Actions / Filters -----------------------------------------
388
-
389
- /**
390
- * Apply filter for specific plugin.
391
- *
392
- * @author Vova Feldman (@svovaf)
393
- * @since 1.0.9
394
- *
395
- * @param string $slug Plugin slug
396
- * @param string $tag The name of the filter hook.
397
- * @param mixed $value The value on which the filters hooked to `$tag` are applied on.
398
- *
399
- * @return mixed The filtered value after all hooked functions are applied to it.
400
- *
401
- * @uses apply_filters()
402
- */
403
- function fs_apply_filter( $slug, $tag, $value ) {
404
- $args = func_get_args();
405
-
406
- return call_user_func_array( 'apply_filters', array_merge(
407
- array( 'fs_' . $tag . '_' . $slug ),
408
- array_slice( $args, 2 ) )
409
- );
410
- }
411
-
412
- #endregion Actions / Filters -----------------------------------------
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/fs-plugin-info-dialog.php DELETED
@@ -1,936 +0,0 @@
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
- /**
14
- * Class FS_Plugin_Info_Dialog
15
- *
16
- * @author Vova Feldman (@svovaf)
17
- * @since 1.1.7
18
- */
19
- class FS_Plugin_Info_Dialog {
20
- /**
21
- * @since 1.1.7
22
- *
23
- * @var FS_Logger
24
- */
25
- private $_logger;
26
-
27
- /**
28
- * @since 1.1.7
29
- *
30
- * @var Freemius
31
- */
32
- private $_fs;
33
-
34
- function __construct( Freemius $fs ) {
35
- $this->_fs = $fs;
36
-
37
- $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $fs->get_slug() . '_info', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
38
-
39
- // Remove default plugin information action.
40
- remove_all_actions( 'install_plugins_pre_plugin-information' );
41
-
42
- // Override action with custom plugins function for add-ons.
43
- add_action( 'install_plugins_pre_plugin-information', array( &$this, 'install_plugin_information' ) );
44
-
45
- // Override request for plugin information for Add-ons.
46
- add_filter(
47
- 'fs_plugins_api',
48
- array( &$this, '_get_addon_info_filter' ),
49
- WP_FS__DEFAULT_PRIORITY, 3 );
50
- }
51
-
52
- /**
53
- * Generate add-on plugin information.
54
- *
55
- * @author Vova Feldman (@svovaf)
56
- * @since 1.0.6
57
- *
58
- * @param array $data
59
- * @param string $action
60
- * @param object|null $args
61
- *
62
- * @return array|null
63
- */
64
- function _get_addon_info_filter( $data, $action = '', $args = null ) {
65
- $this->_logger->entrance();
66
-
67
- $parent_plugin_id = fs_request_get( 'parent_plugin_id', false );
68
-
69
- if ( $this->_fs->get_id() != $parent_plugin_id ||
70
- ( 'plugin_information' !== $action ) ||
71
- ! isset( $args->slug )
72
- ) {
73
- return $data;
74
- }
75
-
76
- // Find add-on by slug.
77
- $addons = $this->_fs->get_addons();
78
- $selected_addon = false;
79
- foreach ( $addons as $addon ) {
80
- if ( $addon->slug == $args->slug ) {
81
- $selected_addon = $addon;
82
- break;
83
- }
84
- }
85
-
86
- if ( false === $selected_addon ) {
87
- return $data;
88
- }
89
-
90
- if ( ! isset( $selected_addon->info ) ) {
91
- // Setup some default info.
92
- $selected_addon->info = new stdClass();
93
- $selected_addon->info->selling_point_0 = 'Selling Point 1';
94
- $selected_addon->info->selling_point_1 = 'Selling Point 2';
95
- $selected_addon->info->selling_point_2 = 'Selling Point 3';
96
- $selected_addon->info->description = '<p>Tell your users all about your add-on</p>';
97
- }
98
-
99
- fs_enqueue_local_style( 'fs_addons', '/admin/add-ons.css' );
100
-
101
- $data = $args;
102
-
103
- $is_free = true;
104
-
105
- // Load add-on pricing.
106
- $has_pricing = false;
107
- $has_features = false;
108
- $plans = false;
109
- $plans_result = $this->_fs->get_api_site_or_plugin_scope()->get( "/addons/{$selected_addon->id}/plans.json" );
110
- if ( ! isset( $plans_result->error ) ) {
111
- $plans = $plans_result->plans;
112
- if ( is_array( $plans ) ) {
113
- for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
114
- $plans[ $i ] = new FS_Plugin_Plan( $plans[ $i ] );
115
- $plan = $plans[ $i ];
116
-
117
- $pricing_result = $this->_fs->get_api_site_or_plugin_scope()->get( "/addons/{$selected_addon->id}/plans/{$plan->id}/pricing.json" );
118
- if ( ! isset( $pricing_result->error ) ) {
119
- // Update plan's pricing.
120
- $plan->pricing = $pricing_result->pricing;
121
-
122
- if ( is_array( $plan->pricing ) && ! empty( $plan->pricing ) ) {
123
- $is_free = false;
124
-
125
- foreach ( $plan->pricing as &$pricing ) {
126
- $pricing = new FS_Pricing( $pricing );
127
- }
128
- }
129
-
130
- $has_pricing = true;
131
- }
132
-
133
- $features_result = $this->_fs->get_api_site_or_plugin_scope()->get( "/addons/{$selected_addon->id}/plans/{$plan->id}/features.json" );
134
- if ( ! isset( $features_result->error ) &&
135
- is_array( $features_result->features ) &&
136
- 0 < count( $features_result->features )
137
- ) {
138
- // Update plan's pricing.
139
- $plan->features = $features_result->features;
140
-
141
- $has_features = true;
142
- }
143
- }
144
- }
145
- }
146
-
147
- // Fetch latest version from Freemius.
148
- $latest = $this->_fs->_fetch_latest_version( $selected_addon->id );
149
-
150
- if ( ! $is_free ) {
151
- // If paid add-on, then it's not on wordpress.org
152
- $is_wordpress_org = false;
153
- } else {
154
- // If no versions found, then assume it's a .org plugin.
155
- $is_wordpress_org = ( false === $latest );
156
- }
157
-
158
- if ( $is_wordpress_org ) {
159
- $repo_data = FS_Plugin_Updater::_fetch_plugin_info_from_repository(
160
- 'plugin_information', (object) array(
161
- 'slug' => $selected_addon->slug,
162
- 'is_ssl' => is_ssl(),
163
- 'fields' => array(
164
- 'banners' => true,
165
- 'reviews' => true,
166
- 'downloaded' => false,
167
- 'active_installs' => true
168
- )
169
- ) );
170
-
171
- if ( ! empty( $repo_data ) ) {
172
- $data = $repo_data;
173
- $data->wp_org_missing = false;
174
- } else {
175
- // Couldn't find plugin on .org.
176
- $is_wordpress_org = false;
177
-
178
- // Plugin is missing, not on Freemius nor WP.org.
179
- $data->wp_org_missing = true;
180
- }
181
- }
182
-
183
- if ( ! $is_wordpress_org ) {
184
- $data->checkout_link = $this->_fs->checkout_url();
185
- $data->fs_missing = ( false === $latest );
186
-
187
- if ( $is_free ) {
188
- $data->download_link = $this->_fs->_get_latest_download_local_url( $selected_addon->id );
189
- }
190
- }
191
-
192
- if ( ! $is_wordpress_org ) {
193
- // Fetch as much as possible info from local files.
194
- $plugin_local_data = $this->_fs->get_plugin_data();
195
- $data->name = $selected_addon->title;
196
- $data->author = $plugin_local_data['Author'];
197
- $view_vars = array( 'plugin' => $selected_addon );
198
- $data->sections = array(
199
- 'description' => fs_get_template( '/plugin-info/description.php', $view_vars ),
200
- );
201
-
202
- if ( ! empty( $selected_addon->info->banner_url ) ) {
203
- $data->banners = array(
204
- 'low' => $selected_addon->info->banner_url,
205
- );
206
- }
207
-
208
- if ( ! empty( $selected_addon->info->screenshots ) ) {
209
- $view_vars = array(
210
- 'screenshots' => $selected_addon->info->screenshots,
211
- 'plugin' => $selected_addon,
212
- );
213
- $data->sections['screenshots'] = fs_get_template( '/plugin-info/screenshots.php', $view_vars );
214
- }
215
-
216
- if ( is_object( $latest ) ) {
217
- $data->version = $latest->version;
218
- $data->last_updated = ! is_null( $latest->updated ) ? $latest->updated : $latest->created;
219
- $data->requires = $latest->requires_platform_version;
220
- $data->tested = $latest->tested_up_to_version;
221
- } else {
222
- // Add dummy version.
223
- $data->version = '1.0.0';
224
-
225
- // Add message to developer to deploy the plugin through Freemius.
226
- }
227
- }
228
-
229
- if ( $has_pricing ) {
230
- // Add plans to data.
231
- $data->plans = $plans;
232
-
233
- if ( $has_features ) {
234
- $view_vars = array(
235
- 'plans' => $plans,
236
- 'plugin' => $selected_addon,
237
- );
238
- $data->sections['features'] = fs_get_template( '/plugin-info/features.php', $view_vars );
239
- }
240
- }
241
-
242
- $data->is_paid = ! $is_free;
243
- $data->external = ! $is_wordpress_org;
244
-
245
- return $data;
246
- }
247
-
248
- /**
249
- * @author Vova Feldman (@svovaf)
250
- * @since 1.1.7
251
- *
252
- * @param FS_Plugin_Plan $plan
253
- *
254
- * @return string
255
- */
256
- private function get_billing_cycle( FS_Plugin_Plan $plan ) {
257
- $billing_cycle = null;
258
-
259
- if ( 1 === count( $plan->pricing ) && 1 == $plan->pricing[0]->licenses ) {
260
- $pricing = $plan->pricing[0];
261
- if ( isset( $pricing->annual_price ) ) {
262
- $billing_cycle = 'annual';
263
- } else if ( isset( $pricing->monthly_price ) ) {
264
- $billing_cycle = 'monthly';
265
- } else if ( isset( $pricing->lifetime_price ) ) {
266
- $billing_cycle = 'lifetime';
267
- }
268
- } else {
269
- foreach ( $plan->pricing as $pricing ) {
270
- if ( isset( $pricing->annual_price ) ) {
271
- $billing_cycle = 'annual';
272
- } else if ( isset( $pricing->monthly_price ) ) {
273
- $billing_cycle = 'monthly';
274
- } else if ( isset( $pricing->lifetime_price ) ) {
275
- $billing_cycle = 'lifetime';
276
- }
277
-
278
- if ( ! is_null( $billing_cycle ) ) {
279
- break;
280
- }
281
- }
282
- }
283
-
284
- return $billing_cycle;
285
- }
286
-
287
- /**
288
- * @author Vova Feldman (@svovaf)
289
- * @since 1.1.7
290
- *
291
- * @param FS_Plugin_Plan $plan
292
- * @param FS_Pricing $pricing
293
- *
294
- * @return float|null|string
295
- */
296
- private function get_price_tag( FS_Plugin_Plan $plan, FS_Pricing $pricing ) {
297
- $price_tag = '';
298
- if ( isset( $pricing->annual_price ) ) {
299
- $price_tag = $pricing->annual_price . ( $plan->is_block_features ? ' / year' : '' );
300
- } else if ( isset( $pricing->monthly_price ) ) {
301
- $price_tag = $pricing->monthly_price . ' / mo';
302
- } else if ( isset( $pricing->lifetime_price ) ) {
303
- $price_tag = $pricing->lifetime_price;
304
- }
305
-
306
- return '$' . $price_tag;
307
- }
308
-
309
- /**
310
- * @author Vova Feldman (@svovaf)
311
- * @since 1.1.7
312
- *
313
- * @param object $api
314
- * @param FS_Plugin_Plan|null $plan
315
- *
316
- * @return string
317
- */
318
- private function get_plugin_cta( $api, $plan = null ) {
319
- if ( ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) ) {
320
-
321
- if ( ! empty( $api->checkout_link ) && isset( $api->plans ) && 0 < is_array( $api->plans ) ) {
322
- if ( is_null( $plan ) ) {
323
- $plan = $api->plans[0];
324
- }
325
-
326
- return ' <a class="button button-primary right" href="' . $this->_fs->addon_checkout_url(
327
- $plan->plugin_id,
328
- $plan->pricing[0]->id,
329
- $this->get_billing_cycle( $plan ),
330
- $plan->has_trial()
331
- ) . '" target="_parent">' .
332
- ( ! $plan->has_trial() ?
333
- __fs( 'purchase', $api->slug ) :
334
- sprintf( __fs( 'start-free-x', $api->slug ), $this->get_trial_period( $plan ) )
335
- ) .
336
- '</a>';
337
-
338
- // @todo Add Cart concept.
339
- // echo ' <a class="button right" href="' . $status['url'] . '" target="_parent">' . __( 'Add to Cart' ) . '</a>';
340
-
341
- } else if ( ! empty( $api->download_link ) ) {
342
- $status = install_plugin_install_status( $api );
343
-
344
-
345
- // Hosted on WordPress.org.
346
- switch ( $status['status'] ) {
347
- case 'install':
348
- if ( $api->external &&
349
- $this->_fs->is_org_repo_compliant() ||
350
- ! $this->_fs->is_premium()
351
- ) {
352
- /**
353
- * Add-on hosted on Freemius, not yet installed, and core
354
- * plugin is wordpress.org compliant. Therefore, require a download
355
- * since installing external plugins is not allowed by the wp.org guidelines.
356
- */
357
- return ' <a class="button button-primary right" href="' . esc_url( $api->download_link ) . '" target="_blank">' . __fs( 'download-latest', $api->slug ) . '</a>';
358
- } else {
359
- if ( $status['url'] ) {
360
- return '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __( 'Install Now' ) . '</a>';
361
- }
362
- }
363
- break;
364
- case 'update_available':
365
- if ( $status['url'] ) {
366
- return '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __( 'Install Update Now' ) . '</a>';
367
- }
368
- break;
369
- case 'newer_installed':
370
- return '<a class="button button-primary right disabled">' . sprintf( __( 'Newer Version (%s) Installed' ), $status['version'] ) . '</a>';
371
- break;
372
- case 'latest_installed':
373
- return '<a class="button button-primary right disabled">' . __( 'Latest Version Installed' ) . '</a>';
374
- break;
375
- }
376
-
377
- }
378
- }
379
- }
380
-
381
- /**
382
- * @author Vova Feldman (@svovaf)
383
- * @since 1.1.7
384
- *
385
- * @param FS_Plugin_Plan $plan
386
- *
387
- * @return string
388
- */
389
- private function get_trial_period( $plan ) {
390
- $trial_period = (int) $plan->trial_period;
391
-
392
- switch ( $trial_period ) {
393
- case 30:
394
- return 'month';
395
- case 60:
396
- return '2 months';
397
- default:
398
- return "{$plan->trial_period} days";
399
- }
400
- }
401
-
402
- /**
403
- * Display plugin information in dialog box form.
404
- *
405
- * Based on core install_plugin_information() function.
406
- *
407
- * @author Vova Feldman (@svovaf)
408
- * @since 1.0.6
409
- */
410
- function install_plugin_information() {
411
- global $tab;
412
-
413
- if ( empty( $_REQUEST['plugin'] ) ) {
414
- return;
415
- }
416
-
417
- $args = array(
418
- 'slug' => wp_unslash( $_REQUEST['plugin'] ),
419
- 'is_ssl' => is_ssl(),
420
- 'fields' => array(
421
- 'banners' => true,
422
- 'reviews' => true,
423
- 'downloaded' => false,
424
- 'active_installs' => true
425
- )
426
- );
427
-
428
- if ( is_array( $args ) ) {
429
- $args = (object) $args;
430
- }
431
-
432
- if ( ! isset( $args->per_page ) ) {
433
- $args->per_page = 24;
434
- }
435
-
436
- if ( ! isset( $args->locale ) ) {
437
- $args->locale = get_locale();
438
- }
439
-
440
- $api = apply_filters( 'fs_plugins_api', false, 'plugin_information', $args );
441
-
442
- if ( is_wp_error( $api ) ) {
443
- wp_die( $api );
444
- }
445
-
446
- $plugins_allowedtags = array(
447
- 'a' => array(
448
- 'href' => array(),
449
- 'title' => array(),
450
- 'target' => array(),
451
- // Add image style for screenshots.
452
- 'class' => array()
453
- ),
454
- 'style' => array(),
455
- 'abbr' => array( 'title' => array() ),
456
- 'acronym' => array( 'title' => array() ),
457
- 'code' => array(),
458
- 'pre' => array(),
459
- 'em' => array(),
460
- 'strong' => array(),
461
- 'div' => array( 'class' => array() ),
462
- 'span' => array( 'class' => array() ),
463
- 'p' => array(),
464
- 'ul' => array(),
465
- 'ol' => array(),
466
- 'li' => array( 'class' => array() ),
467
- 'i' => array( 'class' => array() ),
468
- 'h1' => array(),
469
- 'h2' => array(),
470
- 'h3' => array(),
471
- 'h4' => array(),
472
- 'h5' => array(),
473
- 'h6' => array(),
474
- 'img' => array( 'src' => array(), 'class' => array(), 'alt' => array() ),
475
- // 'table' => array(),
476
- // 'td' => array(),
477
- // 'tr' => array(),
478
- // 'th' => array(),
479
- // 'thead' => array(),
480
- // 'tbody' => array(),
481
- );
482
-
483
- $plugins_section_titles = array(
484
- 'description' => _x( 'Description', 'Plugin installer section title' ),
485
- 'installation' => _x( 'Installation', 'Plugin installer section title' ),
486
- 'faq' => _x( 'FAQ', 'Plugin installer section title' ),
487
- 'screenshots' => _x( 'Screenshots', 'Plugin installer section title' ),
488
- 'changelog' => _x( 'Changelog', 'Plugin installer section title' ),
489
- 'reviews' => _x( 'Reviews', 'Plugin installer section title' ),
490
- 'other_notes' => _x( 'Other Notes', 'Plugin installer section title' ),
491
- );
492
-
493
- // Sanitize HTML
494
- // foreach ( (array) $api->sections as $section_name => $content ) {
495
- // $api->sections[$section_name] = wp_kses( $content, $plugins_allowedtags );
496
- // }
497
-
498
- foreach ( array( 'version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug' ) as $key ) {
499
- if ( isset( $api->$key ) ) {
500
- $api->$key = wp_kses( $api->$key, $plugins_allowedtags );
501
- }
502
- }
503
-
504
- // Add after $api->slug is ready.
505
- $plugins_section_titles['features'] = __fs( 'features-and-pricing', $api->slug );
506
-
507
- $_tab = esc_attr( $tab );
508
-
509
- $section = isset( $_REQUEST['section'] ) ? wp_unslash( $_REQUEST['section'] ) : 'description'; // Default to the Description tab, Do not translate, API returns English.
510
- if ( empty( $section ) || ! isset( $api->sections[ $section ] ) ) {
511
- $section_titles = array_keys( (array) $api->sections );
512
- $section = array_shift( $section_titles );
513
- }
514
-
515
- iframe_header( __( 'Plugin Install' ) );
516
-
517
- $_with_banner = '';
518
-
519
- // var_dump($api->banners);
520
- if ( ! empty( $api->banners ) && ( ! empty( $api->banners['low'] ) || ! empty( $api->banners['high'] ) ) ) {
521
- $_with_banner = 'with-banner';
522
- $low = empty( $api->banners['low'] ) ? $api->banners['high'] : $api->banners['low'];
523
- $high = empty( $api->banners['high'] ) ? $api->banners['low'] : $api->banners['high'];
524
- ?>
525
- <style type="text/css">
526
- #plugin-information-title.with-banner
527
- {
528
- background-image: url( <?php echo esc_url( $low ); ?> );
529
- }
530
-
531
- @media only screen and ( -webkit-min-device-pixel-ratio: 1.5 )
532
- {
533
- #plugin-information-title.with-banner
534
- {
535
- background-image: url( <?php echo esc_url( $high ); ?> );
536
- }
537
- }
538
- </style>
539
- <?php
540
- }
541
-
542
- echo '<div id="plugin-information-scrollable">';
543
- echo "<div id='{$_tab}-title' class='{$_with_banner}'><div class='vignette'></div><h2>{$api->name}</h2></div>";
544
- echo "<div id='{$_tab}-tabs' class='{$_with_banner}'>\n";
545
-
546
- foreach ( (array) $api->sections as $section_name => $content ) {
547
- if ( 'reviews' === $section_name && ( empty( $api->ratings ) || 0 === array_sum( (array) $api->ratings ) ) ) {
548
- continue;
549
- }
550
-
551
- if ( isset( $plugins_section_titles[ $section_name ] ) ) {
552
- $title = $plugins_section_titles[ $section_name ];
553
- } else {
554
- $title = ucwords( str_replace( '_', ' ', $section_name ) );
555
- }
556
-
557
- $class = ( $section_name === $section ) ? ' class="current"' : '';
558
- $href = add_query_arg( array( 'tab' => $tab, 'section' => $section_name ) );
559
- $href = esc_url( $href );
560
- $san_section = esc_attr( $section_name );
561
- echo "\t<a name='$san_section' href='$href' $class>$title</a>\n";
562
- }
563
-
564
- echo "</div>\n";
565
-
566
- ?>
567
- <div id="<?php echo $_tab; ?>-content" class='<?php echo $_with_banner; ?>'>
568
- <div class="fyi">
569
- <?php if ( $api->is_paid ) : ?>
570
- <?php if ( isset( $api->plans ) ) : ?>
571
- <div class="plugin-information-pricing">
572
- <?php foreach ( $api->plans as $plan ) : ?>
573
- <?php
574
- /**
575
- * @var FS_Plugin_Plan $plan
576
- */
577
- ?>
578
- <?php $first_pricing = $plan->pricing[0] ?>
579
- <?php $is_multi_cycle = $first_pricing->is_multi_cycle() ?>
580
- <div class="fs-plan<?php if ( ! $is_multi_cycle ) {
581
- echo ' fs-single-cycle';
582
- } ?>" data-plan-id="<?php echo $plan->id ?>">
583
- <h3 data-plan="<?php echo $plan->id ?>"><?php printf( __fs( 'x-plan', $api->slug ), $plan->title ) ?></h3>
584
- <?php $has_annual = $first_pricing->has_annual() ?>
585
- <?php $has_monthly = $first_pricing->has_monthly() ?>
586
- <div class="nav-tab-wrapper">
587
- <?php $billing_cycles = array( 'monthly', 'annual', 'lifetime' ) ?>
588
- <?php $i = 0;
589
- foreach ( $billing_cycles as $cycle ) : ?>
590
- <?php $prop = "{$cycle}_price";
591
- if ( isset( $first_pricing->{$prop} ) ) : ?>
592
- <?php $is_featured = ( 'annual' === $cycle && $is_multi_cycle ) ?>
593
- <?php
594
- $prices = array();
595
- foreach ( $plan->pricing as $pricing ) {
596
- if ( isset( $pricing->{$prop} ) ) {
597
- $prices[] = array(
598
- 'id' => $pricing->id,
599
- 'licenses' => $pricing->licenses,
600
- 'price' => $pricing->{$prop}
601
- );
602
- }
603
- }
604
- ?>
605
- <a class="nav-tab" data-billing-cycle="<?php echo $cycle ?>"
606
- data-pricing="<?php esc_attr_e( json_encode( $prices ) ) ?>">
607
- <?php if ( $is_featured ) : ?>
608
- <label>&#9733; <?php _efs( 'best', $api->slug ) ?> &#9733;</label>
609
- <?php endif ?>
610
- <?php _efs( $cycle, $api->slug ) ?>
611
- </a>
612
- <?php endif ?>
613
- <?php $i ++; endforeach ?>
614
- <?php wp_enqueue_script( 'jquery' ) ?>
615
- <script type="text/javascript">
616
- (function ($, undef) {
617
- var
618
- _formatBillingFrequency = function (cycle) {
619
- switch (cycle) {
620
- case 'monthly':
621
- return '<?php printf(__fs('billed-x', $api->slug), __fs('monthly', $api->slug)) ?>';
622
- case 'annual':
623
- return '<?php printf(__fs('billed-x', $api->slug), __fs('annually', $api->slug)) ?>';
624
- case 'lifetime':
625
- return '<?php printf(__fs('billed-x', $api->slug), __fs('once', $api->slug)) ?>';
626
- }
627
- },
628
- _formatLicensesTitle = function (pricing) {
629
- switch (pricing.licenses) {
630
- case 1:
631
- return '<?php _efs( 'license-single-site', $api->slug ) ?>';
632
- case null:
633
- return '<?php _efs( 'license-unlimited', $api->slug ) ?>';
634
- default:
635
- return '<?php _efs( 'license-x-sites', $api->slug ) ?>'.replace('%s', pricing.licenses);
636
- }
637
- },
638
- _formatPrice = function (pricing, cycle, multipleLicenses) {
639
- if (undef === multipleLicenses)
640
- multipleLicenses = true;
641
-
642
- var priceCycle;
643
- switch (cycle) {
644
- case 'monthly':
645
- priceCycle = ' / <?php _efs('mo', $api->slug) ?>';
646
- break;
647
- case 'lifetime':
648
- priceCycle = '';
649
- break;
650
- case 'annual':
651
- default:
652
- priceCycle = ' / <?php _efs('year', $api->slug) ?>';
653
- break;
654
- }
655
-
656
- if (!multipleLicenses && 1 == pricing.licenses) {
657
- return '$' + pricing.price + priceCycle;
658
- }
659
-
660
- return _formatLicensesTitle(pricing) + ' - <var class="fs-price">$' + pricing.price + priceCycle + '</var>';
661
- },
662
- _checkoutUrl = function (plan, pricing, cycle) {
663
- return '<?php echo esc_url_raw(remove_query_arg('billing_cycle', add_query_arg(array('plugin_id' => $plan->plugin_id), $api->checkout_link))) ?>' +
664
- '&plan_id=' + plan +
665
- '&pricing_id=' + pricing +
666
- '&billing_cycle=' + cycle<?php if ($plan->has_trial()) { echo " + '&trial=true'"; }?>;
667
- },
668
- _updateCtaUrl = function (plan, pricing, cycle) {
669
- $('.plugin-information-pricing .button, #plugin-information-footer .button').attr('href', _checkoutUrl(plan, pricing, cycle));
670
- };
671
-
672
- $(document).ready(function () {
673
- var $plan = $('.plugin-information-pricing .fs-plan[data-plan-id=<?php echo $plan->id ?>]');
674
- $plan.find('input[type=radio]').live('click', function () {
675
- _updateCtaUrl(
676
- $plan.attr('data-plan-id'),
677
- $(this).val(),
678
- $plan.find('.nav-tab-active').attr('data-billing-cycle')
679
- );
680
-
681
- $plan.find('.fs-trial-terms .fs-price').html(
682
- $(this).parents('label').find('.fs-price').html()
683
- );
684
- });
685
-
686
- $plan.find('.nav-tab').click(function () {
687
- if ($(this).hasClass('nav-tab-active'))
688
- return;
689
-
690
- var $this = $(this),
691
- billingCycle = $this.attr('data-billing-cycle'),
692
- pricing = JSON.parse($this.attr('data-pricing')),
693
- $pricesList = $this.parents('.fs-plan').find('.fs-pricing-body .fs-licenses'),
694
- html = '';
695
-
696
- // Un-select previously selected tab.
697
- $plan.find('.nav-tab').removeClass('nav-tab-active');
698
-
699
- // Select current tab.
700
- $this.addClass('nav-tab-active');
701
-
702
- // Render licenses prices.
703
- if (1 == pricing.length) {
704
- html = '<li><label><?php _efs( 'price', $api->slug ) ?>: ' + _formatPrice(pricing[0], billingCycle, false) + '</label></li>';
705
- } else {
706
- for (var i = 0; i < pricing.length; i++) {
707
- html += '<li><label><input name="pricing-<?php echo $plan->id ?>" type="radio" value="' + pricing[i].id + '">' + _formatPrice(pricing[i], billingCycle) + '</label></li>';
708
- }
709
- }
710
- $pricesList.html(html);
711
-
712
- if (1 < pricing.length) {
713
- // Select first license option.
714
- $pricesList.find('li:first input').click();
715
- }
716
- else {
717
- _updateCtaUrl(
718
- $plan.attr('data-plan-id'),
719
- pricing[0].id,
720
- billingCycle
721
- );
722
- }
723
-
724
- // Update billing frequency.
725
- $plan.find('.fs-billing-frequency').html(_formatBillingFrequency(billingCycle));
726
-
727
- if ('annual' === billingCycle) {
728
- $plan.find('.fs-annual-discount').show();
729
- } else {
730
- $plan.find('.fs-annual-discount').hide();
731
- }
732
- });
733
-
734
- <?php if ( $has_annual ) : ?>
735
- // Select annual by default.
736
- $plan.find('.nav-tab[data-billing-cycle=annual]').click();
737
- <?php else : ?>
738
- // Select first tab.
739
- $plan.find('.nav-tab:first').click();
740
- <?php endif ?>
741
- });
742
- }(jQuery));
743
- </script>
744
- </div>
745
- <div class="fs-pricing-body">
746
- <span class="fs-billing-frequency"></span>
747
- <?php $annual_discount = ( $has_annual && $has_monthly ) ? $plan->pricing[0]->annual_discount_percentage() : 0 ?>
748
- <?php if ( $annual_discount > 0 ) : ?>
749
- <span
750
- class="fs-annual-discount"><?php printf( __fs( 'save-x', $api->slug ), $annual_discount . '%' ) ?></span>
751
- <?php endif ?>
752
- <ul class="fs-licenses">
753
- </ul>
754
- <?php echo $this->get_plugin_cta( $api, $plan ) ?>
755
- <div style="clear:both"></div>
756
- <?php if ( $plan->has_trial() ) : ?>
757
- <?php $trial_period = $this->get_trial_period( $plan ) ?>
758
- <ul class="fs-trial-terms">
759
- <li>
760
- <i class="dashicons dashicons-yes"></i><?php printf( __fs( 'no-commitment-x', $api->slug ), $trial_period ) ?>
761
- </li>
762
- <li>
763
- <i class="dashicons dashicons-yes"></i><?php printf( __fs( 'after-x-pay-as-little-y', $api->slug ), $trial_period, '<var class="fs-price">' . $this->get_price_tag( $plan, $plan->pricing[0] ) . '</var>' ) ?>
764
- </li>
765
- </ul>
766
- <?php endif ?>
767
- </div>
768
- </div>
769
- </div>
770
- <?php endforeach ?>
771
- <?php endif ?>
772
- <?php endif ?>
773
- <div>
774
- <h3><?php _efs( 'details', $api->slug ) ?></h3>
775
- <ul>
776
- <?php if ( ! empty( $api->version ) ) { ?>
777
- <li><strong><?php _e( 'Version:' ); ?></strong> <?php echo $api->version; ?></li>
778
- <?php
779
- }
780
- if ( ! empty( $api->author ) ) {
781
- ?>
782
- <li>
783
- <strong><?php _e( 'Author:' ); ?></strong> <?php echo links_add_target( $api->author, '_blank' ); ?>
784
- </li>
785
- <?php
786
- }
787
- if ( ! empty( $api->last_updated ) ) {
788
- ?>
789
- <li><strong><?php _e( 'Last Updated:' ); ?></strong> <span
790
- title="<?php echo $api->last_updated; ?>">
791
- <?php printf( __( '%s ago' ), human_time_diff( strtotime( $api->last_updated ) ) ); ?>
792
- </span></li>
793
- <?php
794
- }
795
- if ( ! empty( $api->requires ) ) {
796
- ?>
797
- <li>
798
- <strong><?php _e( 'Requires WordPress Version:' ); ?></strong> <?php printf( __( '%s or higher' ), $api->requires ); ?>
799
- </li>
800
- <?php
801
- }
802
- if ( ! empty( $api->tested ) ) {
803
- ?>
804
- <li><strong><?php _e( 'Compatible up to:' ); ?></strong> <?php echo $api->tested; ?>
805
- </li>
806
- <?php
807
- }
808
- if ( ! empty( $api->downloaded ) ) {
809
- ?>
810
- <li>
811
- <strong><?php _e( 'Downloaded:' ); ?></strong> <?php printf( _n( '%s time', '%s times', $api->downloaded ), number_format_i18n( $api->downloaded ) ); ?>
812
- </li>
813
- <?php
814
- }
815
- if ( ! empty( $api->slug ) && empty( $api->external ) ) {
816
- ?>
817
- <li><a target="_blank"
818
- href="https://wordpress.org/plugins/<?php echo $api->slug; ?>/"><?php _e( 'WordPress.org Plugin Page &#187;' ); ?></a>
819
- </li>
820
- <?php
821
- }
822
- if ( ! empty( $api->homepage ) ) {
823
- ?>
824
- <li><a target="_blank"
825
- href="<?php echo esc_url( $api->homepage ); ?>"><?php _e( 'Plugin Homepage &#187;' ); ?></a>
826
- </li>
827
- <?php
828
- }
829
- if ( ! empty( $api->donate_link ) && empty( $api->contributors ) ) {
830
- ?>
831
- <li><a target="_blank"
832
- href="<?php echo esc_url( $api->donate_link ); ?>"><?php _e( 'Donate to this plugin &#187;' ); ?></a>
833
- </li>
834
- <?php } ?>
835
- </ul>
836
- </div>
837
- <?php if ( ! empty( $api->rating ) ) { ?>
838
- <h3><?php _e( 'Average Rating' ); ?></h3>
839
- <?php wp_star_rating( array(
840
- 'rating' => $api->rating,
841
- 'type' => 'percent',
842
- 'number' => $api->num_ratings
843
- ) ); ?>
844
- <small><?php printf( _n( '(based on %s rating)', '(based on %s ratings)', $api->num_ratings ), number_format_i18n( $api->num_ratings ) ); ?></small>
845
- <?php
846
- }
847
-
848
- if ( ! empty( $api->ratings ) && array_sum( (array) $api->ratings ) > 0 ) {
849
- foreach ( $api->ratings as $key => $ratecount ) {
850
- // Avoid div-by-zero.
851
- $_rating = $api->num_ratings ? ( $ratecount / $api->num_ratings ) : 0;
852
- ?>
853
- <div class="counter-container">
854
- <span class="counter-label"><a
855
- href="https://wordpress.org/support/view/plugin-reviews/<?php echo $api->slug; ?>?filter=<?php echo $key; ?>"
856
- target="_blank"
857
- title="<?php echo esc_attr( sprintf( _n( 'Click to see reviews that provided a rating of %d star', 'Click to see reviews that provided a rating of %d stars', $key ), $key ) ); ?>"><?php printf( _n( '%d star', '%d stars', $key ), $key ); ?></a></span>
858
- <span class="counter-back">
859
- <span class="counter-bar" style="width: <?php echo 92 * $_rating; ?>px;"></span>
860
- </span>
861
- <span class="counter-count"><?php echo number_format_i18n( $ratecount ); ?></span>
862
- </div>
863
- <?php
864
- }
865
- }
866
- if ( ! empty( $api->contributors ) ) {
867
- ?>
868
- <h3><?php _e( 'Contributors' ); ?></h3>
869
- <ul class="contributors">
870
- <?php
871
- foreach ( (array) $api->contributors as $contrib_username => $contrib_profile ) {
872
- if ( empty( $contrib_username ) && empty( $contrib_profile ) ) {
873
- continue;
874
- }
875
- if ( empty( $contrib_username ) ) {
876
- $contrib_username = preg_replace( '/^.+\/(.+)\/?$/', '\1', $contrib_profile );
877
- }
878
- $contrib_username = sanitize_user( $contrib_username );
879
- if ( empty( $contrib_profile ) ) {
880
- echo "<li><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&amp;s=36' width='18' height='18' />{$contrib_username}</li>";
881
- } else {
882
- echo "<li><a href='{$contrib_profile}' target='_blank'><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&amp;s=36' width='18' height='18' />{$contrib_username}</a></li>";
883
- }
884
- }
885
- ?>
886
- </ul>
887
- <?php if ( ! empty( $api->donate_link ) ) { ?>
888
- <a target="_blank"
889
- href="<?php echo esc_url( $api->donate_link ); ?>"><?php _e( 'Donate to this plugin &#187;' ); ?></a>
890
- <?php } ?>
891
- <?php } ?>
892
- </div>
893
- <div id="section-holder" class="wrap">
894
- <?php
895
- if ( ! empty( $api->tested ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->tested ) ), $api->tested, '>' ) ) {
896
- echo '<div class="notice notice-warning"><p>' . '<strong>' . __( 'Warning:' ) . '</strong> ' . __( 'This plugin has not been tested with your current version of WordPress.' ) . '</p></div>';
897
- } else if ( ! empty( $api->requires ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->requires ) ), $api->requires, '<' ) ) {
898
- echo '<div class="notice notice-warning"><p>' . '<strong>' . __( 'Warning:' ) . '</strong> ' . __( 'This plugin has not been marked as compatible with your version of WordPress.' ) . '</p></div>';
899
- }
900
-
901
- foreach ( (array) $api->sections as $section_name => $content ) {
902
- $content = links_add_base_url( $content, 'https://wordpress.org/plugins/' . $api->slug . '/' );
903
- $content = links_add_target( $content, '_blank' );
904
-
905
- $san_section = esc_attr( $section_name );
906
-
907
- $display = ( $section_name === $section ) ? 'block' : 'none';
908
-
909
- if ( 'description' === $section_name &&
910
- ( ( ! $api->external && $api->wp_org_missing ) ||
911
- ( $api->external && $api->fs_missing ) )
912
- ) {
913
- $missing_notice = array(
914
- 'type' => 'error',
915
- 'id' => md5( microtime() ),
916
- 'message' => __fs( ( $api->is_paid ? 'paid-addon-not-deployed' : 'free-addon-not-deployed' ), $api->slug ),
917
- );
918
- fs_require_template( 'admin-notice.php', $missing_notice );
919
- }
920
- echo "\t<div id='section-{$san_section}' class='section' style='display: {$display};'>\n";
921
- echo $content;
922
- echo "\t</div>\n";
923
- }
924
- echo "</div>\n";
925
- echo "</div>\n";
926
- echo "</div>\n"; // #plugin-information-scrollable
927
- echo "<div id='$tab-footer'>\n";
928
-
929
- echo $this->get_plugin_cta( $api );
930
-
931
- echo "</div>\n";
932
-
933
- iframe_footer();
934
- exit;
935
- }
936
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/i18n.php DELETED
@@ -1,384 +0,0 @@
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
- * All strings can now be overridden.
15
- *
16
- * For example, if we want to override:
17
- * 'you-are-step-away' => 'You are just one step away - %s',
18
- *
19
- * We can use the filter:
20
- * fs_override_i18n( array(
21
- * 'opt-in-connect' => __( "Yes - I'm in!", '{your-text_domain}' ),
22
- * 'skip' => __( 'Not today', '{your-text_domain}' ),
23
- * ), '{plugin_slug}' );
24
- *
25
- * Or with the Freemius instance:
26
- *
27
- * my_freemius->override_i18n( array(
28
- * 'opt-in-connect' => __( "Yes - I'm in!", '{your-text_domain}' ),
29
- * 'skip' => __( 'Not today', '{your-text_domain}' ),
30
- * );
31
- */
32
- global $fs_text;
33
-
34
- $fs_text = array(
35
- 'account' => __( 'Account', 'freemius' ),
36
- 'addon' => __( 'Add On', 'freemius' ),
37
- 'contact-us' => __( 'Contact Us', 'freemius' ),
38
- 'contact-support' => __( 'Contact Support', 'freemius' ),
39
- 'change-ownership' => __( 'Change Ownership', 'freemius' ),
40
- 'support' => __( 'Support', 'freemius' ),
41
- 'support-forum' => __( 'Support Forum', 'freemius' ),
42
- 'add-ons' => __( 'Add Ons', 'freemius' ),
43
- 'upgrade' => _x( 'Upgrade', 'verb', 'freemius' ),
44
- 'awesome' => __( 'Awesome', 'freemius' ),
45
- 'pricing' => _x( 'Pricing', 'noun', 'freemius' ),
46
- 'price' => _x( 'Price', 'noun', 'freemius' ),
47
- 'unlimited-updates' => __( 'Unlimited Updates', 'freemius' ),
48
- 'downgrade' => _x( 'Downgrade', 'verb', 'freemius' ),
49
- 'cancel-trial' => __( 'Cancel Trial', 'freemius' ),
50
- 'free-trial' => __( 'Free Trial', 'freemius' ),
51
- 'start-free-x' => __( 'Start my free %s', 'freemius' ),
52
- 'no-commitment-x' => __( 'No commitment for %s - cancel anytime', 'freemius' ),
53
- 'after-x-pay-as-little-y' => __( 'After your free %s, pay as little as %s', 'freemius' ),
54
- 'details' => __( 'Details', 'freemius' ),
55
- 'account-details' => __( 'Account Details', 'freemius' ),
56
- 'delete' => _x( 'Delete', 'verb', 'freemius' ),
57
- 'show' => _x( 'Show', 'verb', 'freemius' ),
58
- 'hide' => _x( 'Hide', 'verb', 'freemius' ),
59
- 'edit' => _x( 'Edit', 'verb', 'freemius' ),
60
- 'date' => __( 'Date', 'freemius' ),
61
- 'amount' => __( 'Amount', 'freemius' ),
62
- 'invoice' => __( 'Invoice', 'freemius' ),
63
- 'billing' => __( 'Billing', 'freemius' ),
64
- 'payments' => __( 'Payments', 'freemius' ),
65
- 'delete-account' => __( 'Delete Account', 'freemius' ),
66
- 'dismiss' => _x( 'Dismiss', 'as close a window', 'freemius' ),
67
- 'plan' => _x( 'Plan', 'as product pricing plan', 'freemius' ),
68
- 'change-plan' => __( 'Change Plan', 'freemius' ),
69
- 'download-x-version' => _x( 'Download %s Version', 'as download professional version', 'freemius' ),
70
- 'download-x-version-now' => _x( 'Download %s version now', 'as download professional version now', 'freemius' ),
71
- 'download-latest' => _x( 'Download Latest', 'as download latest version', 'freemius' ),
72
- 'you-have-x-license' => _x( 'You have a %s license.', 'E.g. you have a professional license.', 'freemius' ),
73
- 'new' => __( 'New', 'freemius' ),
74
- 'free' => __( 'Free', 'freemius' ),
75
- 'trial' => _x( 'Trial', 'as trial plan', 'freemius' ),
76
- 'purchase' => _x( 'Purchase', 'verb', 'freemius' ),
77
- 'purchase-license' => __( 'Purchase License', 'freemius' ),
78
- 'buy' => _x( 'Buy', 'verb', 'freemius' ),
79
- 'buy-license' => __( 'Buy License', 'freemius' ),
80
- 'license-single-site' => __( 'Single Site License', 'freemius' ),
81
- 'license-unlimited' => __( 'Unlimited Licenses', 'freemius' ),
82
- 'license-x-sites' => __( 'Up to %s Sites', 'freemius' ),
83
- 'renew-license-now' => __( '%sRenew your license now%s to access version %s features and support.', 'freemius' ),
84
- 'ask-for-upgrade-email-address' => __( "Enter the email address you've used for the upgrade below and we will resend you the license key.", 'freemius' ),
85
- 'x-plan' => _x( '%s Plan', 'e.g. Professional Plan', 'freemius' ),
86
- 'you-are-step-away' => __( 'You are just one step away - %s', 'freemius' ),
87
- 'activate-x-now' => _x( 'Complete "%s" Activation Now', '%s - plugin name. As complete "Jetpack" activation now', 'freemius' ),
88
- 'few-plugin-tweaks' => __( 'We made a few tweaks to the plugin, %s', 'freemius' ),
89
- 'optin-x-now' => __( 'Opt-in to make "%s" Better!', 'freemius' ),
90
- 'error' => __( 'Error', 'freemius' ),
91
- 'failed-finding-main-path' => __( 'Freemius SDK couldn\'t find the plugin\'s main file. Please contact sdk@freemius.com with the current error.', 'freemius' ),
92
- #region Account
93
-
94
- 'expiration' => _x( 'Expiration', 'as expiration date', 'freemius' ),
95
- 'license' => _x( 'License', 'as software license', 'freemius' ),
96
- 'not-verified' => __( 'not verified', 'freemius' ),
97
- 'verify-email' => __( 'Verify Email', 'freemius' ),
98
- 'expires-in' => _x( 'Expires in %s', 'e.g. expires in 2 months', 'freemius' ),
99
- 'renews-in' => _x( 'Auto renews in %s', 'e.g. auto renews in 2 months', 'freemius' ),
100
- 'no-expiration' => __( 'No expiration', 'freemius' ),
101
- 'expired' => __( 'Expired', 'freemius' ),
102
- 'cancelled' => __( 'Cancelled', 'freemius' ),
103
- 'in-x' => _x( 'In %s', 'e.g. In 2 hours', 'freemius' ),
104
- 'x-ago' => _x( '%s ago', 'e.g. 2 min ago', 'freemius' ),
105
- 'version' => _x( 'Version', 'as plugin version', 'freemius' ),
106
- 'name' => __( 'Name', 'freemius' ),
107
- 'email' => __( 'Email', 'freemius' ),
108
- 'email-address' => __( 'Email address', 'freemius' ),
109
- 'verified' => __( 'Verified', 'freemius' ),
110
- 'plugin' => __( 'Plugin', 'freemius' ),
111
- 'plugins' => __( 'Plugins', 'freemius' ),
112
- 'themes' => __( 'Themes', 'freemius' ),
113
- 'path' => _x( 'Path', 'as file/folder path', 'freemius' ),
114
- 'title' => __( 'Title', 'freemius' ),
115
- 'free-version' => __( 'Free version', 'freemius' ),
116
- 'premium-version' => __( 'Premium version', 'freemius' ),
117
- 'slug' => _x( 'Slug', 'as WP plugin slug', 'freemius' ),
118
- 'id' => __( 'ID', 'freemius' ),
119
- 'users' => __( 'Users', 'freemius' ),
120
- 'plugin-installs' => __( 'Plugin Installs', 'freemius' ),
121
- 'sites' => _x( 'Sites', 'like websites', 'freemius' ),
122
- 'user-id' => __( 'User ID', 'freemius' ),
123
- 'site-id' => __( 'Site ID', 'freemius' ),
124
- 'public-key' => __( 'Public Key', 'freemius' ),
125
- 'secret-key' => __( 'Secret Key', 'freemius' ),
126
- 'no-secret' => _x( 'No Secret', 'as secret encryption key missing', 'freemius' ),
127
- 'no-id' => __( 'No ID', 'freemius' ),
128
- 'sync-license' => _x( 'Sync License', 'as synchronize license', 'freemius' ),
129
- 'sync' => _x( 'Sync', 'as synchronize', 'freemius' ),
130
- 'activate-license' => __( 'Activate License', 'freemius' ),
131
- 'activate-free-version' => __( 'Activate Free Version', 'freemius' ),
132
- 'activate-license-message' => __( 'Please enter the license key that you received in the email right after the purchase:', 'freemius' ),
133
- 'activating-license' => __( 'Activating license...', 'freemius' ),
134
- 'change-license' => __( 'Change License', 'freemius' ),
135
- 'update-license' => __( 'Update License', 'freemius' ),
136
- 'deactivate-license' => __( 'Deactivate License', 'freemius' ),
137
- 'activate' => __( 'Activate', 'freemius' ),
138
- 'deactivate' => __( 'Deactivate', 'freemius' ),
139
- 'skip-deactivate' => __( 'Skip & Deactivate', 'freemius' ),
140
- 'no-deactivate' => __( 'No - just deactivate', 'freemius' ),
141
- 'yes-do-your-thing' => __( 'Yes - do your thing', 'freemius' ),
142
- 'active' => _x( 'Active', 'active mode', 'freemius' ),
143
- 'is-active' => _x( 'Is Active', 'is active mode?', 'freemius' ),
144
- 'install-now' => __( 'Install Now', 'freemius' ),
145
- 'install-update-now' => __( 'Install Update Now', 'freemius' ),
146
- 'more-information-about-x' => __( 'More information about %s', 'freemius' ),
147
- 'localhost' => __( 'Localhost', 'freemius' ),
148
- 'activate-x-plan' => _x( 'Activate %s Plan', 'as activate Professional plan', 'freemius' ),
149
- 'x-left' => _x( '%s left', 'as 5 licenses left', 'freemius' ),
150
- 'last-license' => __( 'Last license', 'freemius' ),
151
- 'what-is-your-x' => __( 'What is your %s?', 'freemius' ),
152
- 'activate-this-addon' => __( 'Activate this add-on', 'freemius' ),
153
- 'deactivate-license-confirm' => __( 'Deactivating your license will block all premium features, but will enable you to activate the license on another site. Are you sure you want to proceed?', 'freemius' ),
154
- 'delete-account-x-confirm' => __( 'Deleting the account will automatically deactivate your %s plan license so you can use it on other sites. If you want to terminate the recurring payments as well, click the "Cancel" button, and first "Downgrade" your account. Are you sure you would like to continue with the deletion?', 'freemius' ),
155
- 'delete-account-confirm' => __( 'Deletion is not temporary. Only delete if you no longer want to use this plugin anymore. Are you sure you would like to continue with the deletion?', 'freemius' ),
156
- 'downgrade-x-confirm' => __( 'Downgrading your plan will immediately stop all future recurring payments and your %s plan license will expire in %s.', 'freemius' ),
157
- 'cancel-trial-confirm' => __( 'Cancelling the trial will immediately block access to all premium features. Are you sure?', 'freemius' ),
158
- 'after-downgrade-non-blocking' => __( 'You can still enjoy all %s features but you will not have access to plugin updates and support.', 'freemius' ),
159
- 'after-downgrade-blocking' => __( 'Once your license expire you can still use the Free version but you will NOT have access to the %s features.', 'freemius' ),
160
- 'proceed-confirmation' => __( 'Are you sure you want to proceed?', 'freemius' ),
161
- #endregion Account
162
-
163
- 'add-ons-for-x' => __( 'Add Ons for %s', 'freemius' ),
164
- 'add-ons-missing' => __( 'We could\'nt load the add-ons list. It\'s probably an issue on our side, please try to come back in few minutes.', 'freemius' ),
165
- #region Plugin Deactivation
166
- 'deactivation-share-reason' => __( 'If you have a moment, please let us know why you are deactivating', 'freemius' ),
167
- 'deactivation-modal-button-confirm' => __( 'Yes - Deactivate', 'freemius' ),
168
- 'deactivation-modal-button-submit' => __( 'Submit & Deactivate', 'freemius' ),
169
- 'deactivation-modal-button-cancel' => _x( 'Cancel', 'the text of the cancel button of the plugin deactivation dialog box.', 'freemius' ),
170
- 'reason-no-longer-needed' => __( 'I no longer need the plugin', 'freemius' ),
171
- 'reason-found-a-better-plugin' => __( 'I found a better plugin', 'freemius' ),
172
- 'reason-needed-for-a-short-period' => __( 'I only needed the plugin for a short period', 'freemius' ),
173
- 'reason-broke-my-site' => __( 'The plugin broke my site', 'freemius' ),
174
- 'reason-suddenly-stopped-working' => __( 'The plugin suddenly stopped working', 'freemius' ),
175
- 'reason-cant-pay-anymore' => __( "I can't pay for it anymore", 'freemius' ),
176
- 'reason-temporary-deactivation' => __( "It's a temporary deactivation. I'm just debugging an issue.", 'freemius' ),
177
- 'reason-other' => _x( 'Other', 'the text of the "other" reason for deactivating the plugin that is shown in the modal box.', 'freemius' ),
178
- 'ask-for-reason-message' => __( 'Kindly tell us the reason so we can improve.', 'freemius' ),
179
- 'placeholder-plugin-name' => __( "What's the plugin's name?", 'freemius' ),
180
- 'placeholder-comfortable-price' => __( 'What price would you feel comfortable paying?', 'freemius' ),
181
- 'reason-couldnt-make-it-work' => __( "I couldn't understand how to make it work", 'freemius' ),
182
- 'reason-great-but-need-specific-feature' => __( "The plugin is great, but I need specific feature that you don't support", 'freemius' ),
183
- 'reason-not-working' => __( 'The plugin is not working', 'freemius' ),
184
- 'reason-not-what-i-was-looking-for' => __( "It's not what I was looking for", 'freemius' ),
185
- 'reason-didnt-work-as-expected' => __( "The plugin didn't work as expected", 'freemius' ),
186
- 'placeholder-feature' => __( 'What feature?', 'freemius' ),
187
- 'placeholder-share-what-didnt-work' => __( "Kindly share what didn't work so we can fix it for future users...", 'freemius' ),
188
- 'placeholder-what-youve-been-looking-for' => __( "What you've been looking for?", 'freemius' ),
189
- 'placeholder-what-did-you-expect' => __( "What did you expect?", 'freemius' ),
190
- 'reason-didnt-work' => __( "The plugin didn't work", 'freemius' ),
191
- 'reason-dont-like-to-share-my-information' => __( "I don't like to share my information with you", 'freemius' ),
192
- 'dont-have-to-share-any-data' => __( "You might have missed it, but you don't have to share any data and can just %s the opt-in.", 'freemius' ),
193
- #endregion Plugin Deactivation
194
-
195
- #region Connect
196
- 'hey-x' => _x( 'Hey %s,', 'greeting', 'freemius' ),
197
- 'thanks-x' => _x( 'Thanks %s!', 'a greeting. E.g. Thanks John!', 'freemius' ),
198
- 'connect-message' => __( 'In order to enjoy all our features and functionality, %s needs to connect your user, %s at %s, to %s', 'freemius' ),
199
- 'connect-message_on-update' => __( 'Please help us improve %2$s! If you opt-in, some data about your usage of %2$s will be sent to %5$s. If you skip this, that\'s okay! %2$s will still work just fine.', 'freemius' ),
200
- 'pending-activation-message' => __( 'You should receive an activation email for %s to your mailbox at %s. Please make sure you click the activation button in that email to complete the install.', 'freemius' ),
201
- 'thanks-for-purchasing' => __( 'Thanks for purchasing %s! To get started, please enter your license key:', 'freemius' ),
202
- 'license-sync-disclaimer' => __( 'The plugin will be periodically sending data to %s to check for plugin updates and verify the validity of your license.', 'freemius' ),
203
- 'what-permissions' => __( 'What permissions are being granted?', 'freemius' ),
204
- 'permissions-profile' => __( 'Your Profile Overview', 'freemius' ),
205
- 'permissions-profile_desc' => __( 'Name and email address', 'freemius' ),
206
- 'permissions-site' => __( 'Your Site Overview', 'freemius' ),
207
- 'permissions-site_desc' => __( 'Site URL, WP version, PHP info, plugins & themes', 'freemius' ),
208
- 'permissions-events' => __( 'Current Plugin Events', 'freemius' ),
209
- 'permissions-events_desc' => __( 'Activation, deactivation and uninstall', 'freemius' ),
210
- 'permissions-plugins_themes' => __( 'Plugins & Themes', 'freemius' ),
211
- 'permissions-plugins_themes_desc' => __( 'Titles, versions and state.', 'freemius' ),
212
- 'permissions-newsletter' => __( 'Newsletter', 'freemius' ),
213
- 'permissions-newsletter_desc' => __( 'Updates, announcements, marketing, no spam', 'freemius' ),
214
- 'privacy-policy' => __( 'Privacy Policy', 'freemius' ),
215
- 'tos' => __( 'Terms of Service', 'freemius' ),
216
- 'activating' => _x( 'Activating', 'as activating plugin', 'freemius' ),
217
- 'sending-email' => _x( 'Sending email', 'as in the process of sending an email', 'freemius' ),
218
- 'opt-in-connect' => _x( 'Allow & Continue', 'button label', 'freemius' ),
219
- 'agree-activate-license' => _x( 'Agree & Activate License', 'button label', 'freemius' ),
220
- 'skip' => _x( 'Skip', 'verb', 'freemius' ),
221
- 'click-here-to-use-plugin-anonymously' => __( 'Click here to use the plugin anonymously', 'freemius' ),
222
- 'resend-activation-email' => __( 'Re-send activation email', 'freemius' ),
223
- 'license-key' => __( 'License key', 'freemius' ),
224
- 'send-license-key' => __( 'Send License Key', 'freemius' ),
225
- 'sending-license-key' => __( 'Sending license key', 'freemius' ),
226
- 'have-license-key' => __( 'Have a license key?', 'freemius' ),
227
- 'dont-have-license-key' => __( 'Don\'t have a license key?', 'freemius' ),
228
- 'cant-find-license-key' => __( "Can't find your license key?", 'freemius' ),
229
- 'email-not-found' => __( "We couldn't find your email address in the system, are you sure it's the right address?" ),
230
- 'no-active-licenses' => __( "We can't see any active licenses associated with that email address, are you sure it's the right address?" ),
231
- #endregion Connect
232
-
233
- #region Screenshots
234
- 'screenshots' => __( 'Screenshots', 'freemius' ),
235
- 'view-full-size-x' => __( 'Click to view full-size screenshot %d', 'freemius' ),
236
- #endregion Screenshots
237
-
238
- #region Debug
239
- 'freemius-debug' => __( 'Freemius Debug', 'freemius' ),
240
- 'on' => _x( 'On', 'as turned on', 'freemius' ),
241
- 'off' => _x( 'Off', 'as turned off', 'freemius' ),
242
- 'debugging' => _x( 'Debugging', 'as code debugging', 'freemius' ),
243
- 'freemius-state' => __( 'Freemius State', 'freemius' ),
244
- 'connected' => _x( 'Connected', 'as connection was successful', 'freemius' ),
245
- 'blocked' => _x( 'Blocked', 'as connection blocked', 'freemius' ),
246
- 'api' => _x( 'API', 'as application program interface', 'freemius' ),
247
- 'sdk' => _x( 'SDK', 'as software development kit versions', 'freemius' ),
248
- 'sdk-versions' => _x( 'SDK Versions', 'as software development kit versions', 'freemius' ),
249
- 'plugin-path' => _x( 'Plugin Path', 'as plugin folder path', 'freemius' ),
250
- 'sdk-path' => _x( 'SDK Path', 'as sdk path', 'freemius' ),
251
- 'addons-of-x' => __( 'Add Ons of Plugin %s', 'freemius' ),
252
- 'delete-all-confirm' => __( 'Are you sure you want to delete all Freemius data?', 'freemius' ),
253
- 'actions' => __( 'Actions', 'freemius' ),
254
- 'delete-all-accounts' => __( 'Delete All Accounts', 'freemius' ),
255
- 'start-fresh' => __( 'Start Fresh', 'freemius' ),
256
- 'clear-api-cache' => __( 'Clear API Cache', 'freemius' ),
257
- 'sync-data-from-server' => __( 'Sync Data From Server', 'freemius' ),
258
- 'scheduled-crons' => __( 'Scheduled Crons', 'freemius' ),
259
- 'plugins-themes-sync' => __( 'Plugins & Themes Sync', 'freemius' ),
260
- #endregion Debug
261
-
262
- #region Expressions
263
- 'congrats' => _x( 'Congrats', 'as congratulations', 'freemius' ),
264
- 'oops' => _x( 'Oops', 'exclamation', 'freemius' ),
265
- 'yee-haw' => _x( 'Yee-haw', 'interjection expressing joy or exuberance', 'freemius' ),
266
- 'woot' => _x( 'W00t', '(especially in electronic communication) used to express elation, enthusiasm, or triumph.', 'freemius' ),
267
- 'right-on' => _x( 'Right on', 'a positive response', 'freemius' ),
268
- 'hmm' => _x( 'Hmm', 'something somebody says when they are thinking about what you have just said. ', 'freemius' ),
269
- 'ok' => __( 'O.K', 'freemius' ),
270
- 'hey' => _x( 'Hey', 'exclamation', 'freemius' ),
271
- 'heads-up' => _x( 'Heads up', 'advance notice of something that will need attention.', 'freemius' ),
272
- #endregion Expressions
273
-
274
- #region Admin Notices
275
- 'you-have-latest' => __( 'Seems like you got the latest release.', 'freemius' ),
276
- 'you-are-good' => __( 'You are all good!', 'freemius' ),
277
- 'user-exist-message' => __( 'Sorry, we could not complete the email update. Another user with the same email is already registered.', 'freemius' ),
278
- 'user-exist-message_ownership' => __( 'If you would like to give up the ownership of the plugin\'s account to %s click the Change Ownership button.', 'freemius' ),
279
- 'email-updated-message' => __( 'Your email was successfully updated. You should receive an email with confirmation instructions in few moments.', 'freemius' ),
280
- 'name-updated-message' => __( 'Your name was successfully updated.', 'freemius' ),
281
- 'x-updated' => __( 'You have successfully updated your %s.', 'freemius' ),
282
- 'name-update-failed-message' => __( 'Please provide your full name.', 'freemius' ),
283
- 'verification-email-sent-message' => __( 'Verification mail was just sent to %s. If you can\'t find it after 5 min, please check your spam box.', 'freemius' ),
284
- 'addons-info-external-message' => __( 'Just letting you know that the add-ons information of %s is being pulled from an external server.', 'freemius' ),
285
- 'no-cc-required' => __( 'No credit card required', 'freemius' ),
286
- 'premium-activated-message' => __( 'Premium plugin version was successfully activated.', 'freemius' ),
287
- 'successful-version-upgrade-message' => __( 'The upgrade of %s was successfully completed.', 'freemius' ),
288
- 'activation-with-plan-x-message' => __( 'Your account was successfully activated with the %s plan.', 'freemius' ),
289
- 'download-latest-x-version' => __( 'Download the latest %s version now', 'freemius' ),
290
- 'download-latest-version' => __( 'Download the latest version now', 'freemius' ),
291
- 'addon-successfully-purchased-message' => _x( '%s Add-on was successfully purchased.', '%s - product name, e.g. Facebook add-on was successfully...', 'freemius' ),
292
- 'addon-successfully-upgraded-message' => __( 'Your %s Add-on plan was successfully upgraded.', 'freemius' ),
293
- 'email-verified-message' => __( 'Your email has been successfully verified - you are AWESOME!', 'freemius' ),
294
- 'plan-upgraded-message' => __( 'Your plan was successfully upgraded.', 'freemius' ),
295
- 'plan-changed-to-x-message' => __( 'Your plan was successfully changed to %s.', 'freemius' ),
296
- 'license-expired-blocking-message' => __( 'Your license has expired. You can still continue using the free plugin forever.', 'freemius' ),
297
- 'license-cancelled' => __( 'Your license has been cancelled. If you think it\'s a mistake, please contact support.', 'freemius' ),
298
- 'trial-started-message' => __( 'Your trial has been successfully started.', 'freemius' ),
299
- 'license-activated-message' => __( 'Your license was successfully activated.', 'freemius' ),
300
- 'no-active-license-message' => __( 'It looks like your site currently doesn\'t have an active license.', 'freemius' ),
301
- 'license-deactivation-message' => __( 'Your license was successfully deactivated, you are back to the %s plan.', 'freemius' ),
302
- 'license-deactivation-failed-message' => __( 'It looks like the license deactivation failed.', 'freemius' ),
303
- 'license-activation-failed-message' => __( 'It looks like the license could not be activated.', 'freemius' ),
304
- 'server-error-message' => __( 'Error received from the server:', 'freemius' ),
305
- 'trial-expired-message' => __( 'Your trial has expired. You can still continue using all our free features.', 'freemius' ),
306
- 'plan-x-downgraded-message' => __( 'Your plan was successfully downgraded. Your %s plan license will expire in %s.', 'freemius' ),
307
- 'plan-downgraded-failure-message' => __( 'Seems like we are having some temporary issue with your plan downgrade. Please try again in few minutes.', 'freemius' ),
308
- 'trial-cancel-no-trial-message' => __( 'It looks like you are not in trial mode anymore so there\'s nothing to cancel :)', 'freemius' ),
309
- 'trial-cancel-message' => __( 'Your %s free trial was successfully cancelled.', 'freemius' ),
310
- 'version-x-released' => _x( 'Version %s was released.', '%s - numeric version number', 'freemius' ),
311
- 'please-download-x' => __( 'Please download %s.', 'freemius' ),
312
- 'latest-x-version' => _x( 'the latest %s version here', '%s - plan name, as the latest professional version here', 'freemius' ),
313
- 'trial-x-promotion-message' => __( 'How do you like %s so far? Test all our %s premium features with a %d-day free trial.', 'freemius' ),
314
- 'start-free-trial' => _x( 'Start free trial', 'call to action', 'freemius' ),
315
- 'trial-cancel-failure-message' => __( 'Seems like we are having some temporary issue with your trial cancellation. Please try again in few minutes.', 'freemius' ),
316
- 'trial-utilized' => __( 'You already utilized a trial before.', 'freemius' ),
317
- 'in-trial-mode' => __( 'You are already running the plugin in a trial mode.', 'freemius' ),
318
- 'trial-plan-x-not-exist' => __( 'Plan %s do not exist, therefore, can\'t start a trial.', 'freemius' ),
319
- 'plan-x-no-trial' => __( 'Plan %s does not support a trial period.', 'freemius' ),
320
- 'no-trials' => __( 'None of the plugin\'s plans supports a trial period.', 'freemius' ),
321
- 'unexpected-api-error' => __( 'Unexpected API error. Please contact the plugin\'s author with the following error.', 'freemius' ),
322
- 'no-commitment-for-x-days' => __( 'No commitment for %s days - cancel anytime!', 'freemius' ),
323
- 'license-expired-non-blocking-message' => __( 'Your license has expired. You can still continue using all the %s features, but you\'ll need to renew your license to continue getting updates and support.', 'freemius' ),
324
- 'could-not-activate-x' => __( 'Couldn\'t activate %s.', 'freemius' ),
325
- 'contact-us-with-error-message' => __( 'Please contact us with the following message:', 'freemius' ),
326
- 'plan-did-not-change-message' => __( 'It looks like you are still on the %s plan. If you did upgrade or change your plan, it\'s probably an issue on our side - sorry.', 'freemius' ),
327
- 'contact-us-here' => __( 'Please contact us here', 'freemius' ),
328
- 'plan-did-not-change-email-message' => __( 'I have upgraded my account but when I try to Sync the License, the plan remains %s.', 'freemius' ),
329
- #endregion Admin Notices
330
- #region Connectivity Issues
331
- 'connectivity-test-fails-message' => __( 'From unknown reason, the API connectivity test failed.', 'freemius' ),
332
- 'connectivity-test-maybe-temporary' => __( 'It\'s probably a temporary issue on our end. Just to be sure, with your permission, would it be o.k to run another connectivity test?', 'freemius' ),
333
- 'curl-missing-message' => __( 'We use PHP cURL library for the API calls, which is a very common library and usually installed out of the box. Unfortunately, cURL is not installed on your server.', 'freemius' ),
334
- 'cloudflare-blocks-connection-message' => __( 'From unknown reason, CloudFlare, the firewall we use, blocks the connection.', 'freemius' ),
335
- 'x-requires-access-to-api' => _x( '%s requires an access to our API.', 'as pluginX requires an access to our API', 'freemius' ),
336
- 'squid-blocks-connection-message' => __( 'It looks like your server is using Squid ACL (access control lists), which blocks the connection.', 'freemius' ),
337
- 'squid-no-clue-title' => __( 'I don\'t know what is Squid or ACL, help me!', 'freemius' ),
338
- 'squid-no-clue-desc' => __( 'We\'ll make sure to contact your hosting company and resolve the issue. You will get a follow-up email to %s once we have an update.', 'freemius' ),
339
- 'sysadmin-title' => __( 'I\'m a system administrator', 'freemius' ),
340
- 'squid-sysadmin-desc' => __( 'Great, please whitelist the following domains: %s. Once you done, deactivate the plugin and activate it again.', 'freemius' ),
341
- 'curl-missing-no-clue-title' => __( 'I don\'t know what is cURL or how to install it, help me!', 'freemius' ),
342
- 'curl-missing-no-clue-desc' => __( 'We\'ll make sure to contact your hosting company and resolve the issue. You will get a follow-up email to %s once we have an update.', 'freemius' ),
343
- 'curl-missing-sysadmin-desc' => __( 'Great, please install cURL and enable it in your php.ini file. To make sure it was successfully activated, use \'phpinfo()\'. Once activated, deactivate the plugin and reactivate it back again.', 'freemius' ),
344
- 'happy-to-resolve-issue-asap' => __( 'We are sure it\'s an issue on our side and more than happy to resolve it for you ASAP if you give us a chance.', 'freemius' ),
345
- 'contact-support-before-deactivation' => __( 'Sorry for the inconvenience and we are here to help if you give us a chance.', 'freemius' ),
346
- 'fix-issue-title' => __( 'Yes - I\'m giving you a chance to fix it', 'freemius' ),
347
- 'fix-issue-desc' => __( 'We will do our best to whitelist your server and resolve this issue ASAP. You will get a follow-up email to %s once we have an update.', 'freemius' ),
348
- 'install-previous-title' => __( 'Let\'s try your previous version', 'freemius' ),
349
- 'install-previous-desc' => __( 'Uninstall this version and install the previous one.', 'freemius' ),
350
- 'deactivate-plugin-title' => __( 'That\'s exhausting, please deactivate', 'freemius' ),
351
- 'deactivate-plugin-desc' => __( 'We feel your frustration and sincerely apologize for the inconvenience. Hope to see you again in the future.', 'freemius' ),
352
- 'fix-request-sent-message' => __( 'Thank for giving us the chance to fix it! A message was just sent to our technical staff. We will get back to you as soon as we have an update to %s. Appreciate your patience.', 'freemius' ),
353
- 'server-blocking-access' => _x( 'Your server is blocking the access to Freemius\' API, which is crucial for %1s synchronization. Please contact your host to whitelist %2s', '%1s - plugin title, %2s - API domain', 'freemius' ),
354
- 'wrong-authentication-param-message' => __( 'It seems like one of the authentication parameters is wrong. Update your Public Key, Secret Key & User ID, and try again.', 'freemius' ),
355
- #endregion Connectivity Issues
356
- #region Change Owner
357
- 'change-owner-request-sent-x' => __( 'Please check your mailbox, you should receive an email via %s to confirm the ownership change. From security reasons, you must confirm the change within the next 15 min. If you cannot find the email, please check your spam folder.', 'freemius' ),
358
- 'change-owner-request_owner-confirmed' => __( 'Thanks for confirming the ownership change. An email was just sent to %s for final approval.', 'freemius' ),
359
- 'change-owner-request_candidate-confirmed' => __( '%s is the new owner of the account.', 'freemius' ),
360
- #endregion Change Owner
361
- 'addon-x-cannot-run-without-y' => _x( '%s cannot run without %s.', 'addonX cannot run without pluginY', 'freemius' ),
362
- 'addon-x-cannot-run-without-parent' => _x( '%s cannot run without the plugin.', 'addonX cannot run...', 'freemius' ),
363
- 'plugin-x-activation-message' => _x( '%s activation was successfully completed.', 'pluginX activation was successfully...', 'freemius' ),
364
- 'features-and-pricing' => _x( 'Features & Pricing', 'Plugin installer section title', 'freemius' ),
365
- 'free-addon-not-deployed' => __( 'Add-on must be deployed to WordPress.org or Freemius.', 'freemius' ),
366
- 'paid-addon-not-deployed' => __( 'Paid add-on must be deployed to Freemius.', 'freemius' ),
367
- #region Add-On Licensing
368
- 'addon-no-license-message' => __( '%s is a premium only add-on. You have to purchase a license first before activating the plugin.', 'freemius' ),
369
- 'addon-trial-cancelled-message' => __( '%s free trial was successfully cancelled. Since the add-on is premium only it was automatically deactivated. If you like to use it in the future, you\'ll have to purchase a license.', 'freemius' ),
370
- #endregion Add-On Licensing
371
- #region Billing Cycles
372
- 'monthly' => _x( 'Monthly', 'as every month', 'freemius' ),
373
- 'mo' => _x( 'mo', 'as monthly period', 'freemius' ),
374
- 'annual' => _x( 'Annual', 'as once a year', 'freemius' ),
375
- 'annually' => _x( 'Annually', 'as once a year', 'freemius' ),
376
- 'once' => _x( 'Once', 'as once a year', 'freemius' ),
377
- 'year' => _x( 'year', 'as annual period', 'freemius' ),
378
- 'lifetime' => __( 'Lifetime', 'freemius' ),
379
- 'best' => _x( 'Best', 'e.g. the best product', 'freemius' ),
380
- 'billed-x' => _x( 'Billed %s', 'e.g. billed monthly', 'freemius' ),
381
- 'save-x' => _x( 'Save %s', 'as a discount of $5 or 10%', 'freemius' ),
382
- #endregion Billing Cycles
383
- 'view-details' => __( 'View details', 'freemius' ),
384
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/managers/class-fs-admin-menu-manager.php DELETED
@@ -1,549 +0,0 @@
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.3
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- class FS_Admin_Menu_Manager {
14
-
15
- #region Properties
16
-
17
- /**
18
- * @var string
19
- */
20
- protected $_plugin_slug;
21
-
22
- /**
23
- * @since 1.0.6
24
- *
25
- * @var string
26
- */
27
- private $_menu_slug;
28
- /**
29
- * @since 1.1.3
30
- *
31
- * @var string
32
- */
33
- private $_parent_slug;
34
- /**
35
- * @since 1.1.3
36
- *
37
- * @var string
38
- */
39
- private $_parent_type;
40
- /**
41
- * @since 1.1.3
42
- *
43
- * @var string
44
- */
45
- private $_type;
46
- /**
47
- * @since 1.1.3
48
- *
49
- * @var bool
50
- */
51
- private $_is_top_level;
52
- /**
53
- * @since 1.1.3
54
- *
55
- * @var bool
56
- */
57
- private $_is_override_exact;
58
- /**
59
- * @since 1.1.3
60
- *
61
- * @var string[]bool
62
- */
63
- private $_default_submenu_items;
64
- /**
65
- * @since 1.1.3
66
- *
67
- * @var string
68
- */
69
- private $_first_time_path;
70
-
71
- #endregion Properties
72
-
73
- /**
74
- * @var FS_Logger
75
- */
76
- protected $_logger;
77
-
78
- #region Singleton
79
-
80
- /**
81
- * @var FS_Admin_Menu_Manager[]
82
- */
83
- private static $_instances = array();
84
-
85
- /**
86
- * @param string $plugin_slug
87
- *
88
- * @return FS_Admin_Notice_Manager
89
- */
90
- static function instance( $plugin_slug ) {
91
- if ( ! isset( self::$_instances[ $plugin_slug ] ) ) {
92
- self::$_instances[ $plugin_slug ] = new FS_Admin_Menu_Manager( $plugin_slug );
93
- }
94
-
95
- return self::$_instances[ $plugin_slug ];
96
- }
97
-
98
- protected function __construct( $plugin_slug ) {
99
- $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $plugin_slug . '_admin_menu', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
100
-
101
- $this->_plugin_slug = $plugin_slug;
102
- }
103
-
104
- #endregion Singleton
105
-
106
- #region Helpers
107
-
108
- private function get_option( &$options, $key, $default = false ) {
109
- return ! empty( $options[ $key ] ) ? $options[ $key ] : $default;
110
- }
111
-
112
- private function get_bool_option( &$options, $key, $default = false ) {
113
- return isset( $options[ $key ] ) && is_bool( $options[ $key ] ) ? $options[ $key ] : $default;
114
- }
115
-
116
- #endregion Helpers
117
-
118
- /**
119
- * @param array $menu
120
- * @param bool $is_addon
121
- */
122
- function init( $menu, $is_addon = false ) {
123
- $this->_menu_slug = $menu['slug'];
124
-
125
- $this->_default_submenu_items = array();
126
- // @deprecated
127
- $this->_type = 'page';
128
- $this->_is_top_level = true;
129
- $this->_is_override_exact = false;
130
- $this->_parent_slug = false;
131
- // @deprecated
132
- $this->_parent_type = 'page';
133
-
134
- if ( ! $is_addon && isset( $menu ) ) {
135
- $this->_default_submenu_items = array(
136
- 'contact' => $this->get_bool_option( $menu, 'contact', true ),
137
- 'support' => $this->get_bool_option( $menu, 'support', true ),
138
- 'account' => $this->get_bool_option( $menu, 'account', true ),
139
- 'pricing' => $this->get_bool_option( $menu, 'pricing', true ),
140
- 'addons' => $this->get_bool_option( $menu, 'addons', true ),
141
- );
142
-
143
- // @deprecated
144
- $this->_type = $this->get_option( $menu, 'type', 'page' );
145
- $this->_is_override_exact = $this->get_bool_option( $menu, 'override_exact' );
146
-
147
- if ( isset( $menu['parent'] ) ) {
148
- $this->_parent_slug = $this->get_option( $menu['parent'], 'slug' );
149
- // @deprecated
150
- $this->_parent_type = $this->get_option( $menu['parent'], 'type', 'page' );
151
-
152
- // If parent's slug is different, then it's NOT a top level menu item.
153
- $this->_is_top_level = ( $this->_parent_slug === $this->_menu_slug );
154
- } else {
155
- /**
156
- * If no parent then top level if:
157
- * - Has custom admin menu ('page')
158
- * - CPT menu type ('cpt')
159
- */
160
- // $this->_is_top_level = in_array( $this->_type, array(
161
- // 'cpt',
162
- // 'page'
163
- // ) );
164
- }
165
-
166
- $this->_first_time_path = $this->get_option( $menu, 'first-path', false );
167
- if ( ! empty( $this->_first_time_path ) && is_string( $this->_first_time_path ) ) {
168
- $this->_first_time_path = admin_url( $this->_first_time_path, 'admin' );
169
- }
170
- }
171
- }
172
-
173
- /**
174
- * Check if top level menu.
175
- *
176
- * @author Vova Feldman (@svovaf)
177
- * @since 1.1.3
178
- *
179
- * @return bool False if submenu item.
180
- */
181
- function is_top_level() {
182
- return $this->_is_top_level;
183
- }
184
-
185
- /**
186
- * Check if the page should be override on exact URL match.
187
- *
188
- * @author Vova Feldman (@svovaf)
189
- * @since 1.1.3
190
- *
191
- * @return bool False if submenu item.
192
- */
193
- function is_override_exact() {
194
- return $this->_is_override_exact;
195
- }
196
-
197
-
198
- /**
199
- * Get the path of the page the user should be forwarded to after first activation.
200
- *
201
- * @author Vova Feldman (@svovaf)
202
- * @since 1.1.3
203
- *
204
- * @return string
205
- */
206
- function get_first_time_path() {
207
- return $this->_first_time_path;
208
- }
209
-
210
- /**
211
- * Check if plugin's menu item is part of a custom top level menu.
212
- *
213
- * @author Vova Feldman (@svovaf)
214
- * @since 1.1.3
215
- *
216
- * @return bool
217
- */
218
- function has_custom_parent() {
219
- return ! $this->_is_top_level && is_string( $this->_parent_slug );
220
- }
221
-
222
- /**
223
- * @author Vova Feldman (@svovaf)
224
- * @since 1.1.3
225
- *
226
- * @return string
227
- */
228
- // function slug(){
229
- // return $this->_menu_slug;
230
- // }
231
-
232
- /**
233
- * @author Vova Feldman (@svovaf)
234
- * @since 1.1.3
235
- *
236
- * @param string $id
237
- * @param bool $default
238
- *
239
- * @return bool
240
- */
241
- function is_submenu_item_visible( $id, $default = true ) {
242
- return fs_apply_filter(
243
- $this->_plugin_slug,
244
- 'is_submenu_visible',
245
- $this->get_bool_option( $this->_default_submenu_items, $id, $default ),
246
- $id
247
- );
248
- }
249
-
250
- /**
251
- * Calculates admin settings menu slug.
252
- * If plugin's menu slug is a file (e.g. CPT), uses plugin's slug as the menu slug.
253
- *
254
- * @author Vova Feldman (@svovaf)
255
- * @since 1.1.3
256
- *
257
- * @param string $page
258
- *
259
- * @return string
260
- */
261
- function get_slug( $page = '' ) {
262
- return ( ( false === strpos( $this->_menu_slug, '.php?' ) ) ?
263
- $this->_menu_slug :
264
- $this->_plugin_slug ) . ( empty( $page ) ? '' : ( '-' . $page ) );
265
- }
266
-
267
- /**
268
- * @author Vova Feldman (@svovaf)
269
- * @since 1.1.3
270
- *
271
- * @return string
272
- */
273
- function get_parent_slug() {
274
- return $this->_parent_slug;
275
- }
276
-
277
- /**
278
- * @author Vova Feldman (@svovaf)
279
- * @since 1.1.3
280
- *
281
- * @return string
282
- */
283
- function get_type() {
284
- return $this->_type;
285
- }
286
-
287
- /**
288
- * @author Vova Feldman (@svovaf)
289
- * @since 1.1.3
290
- *
291
- * @return bool
292
- */
293
- function is_cpt() {
294
- return ( 0 === strpos( $this->_menu_slug, 'edit.php?post_type=' ) ||
295
- // Back compatibility.
296
- 'cpt' === $this->_type
297
- );
298
- }
299
-
300
- /**
301
- * @author Vova Feldman (@svovaf)
302
- * @since 1.1.3
303
- *
304
- * @return string
305
- */
306
- function get_parent_type() {
307
- return $this->_parent_type;
308
- }
309
-
310
- /**
311
- * @author Vova Feldman (@svovaf)
312
- * @since 1.1.3
313
- *
314
- * @return string
315
- */
316
- function get_raw_slug() {
317
- return $this->_menu_slug;
318
- }
319
-
320
- /**
321
- * Get plugin's original menu slug.
322
- *
323
- * @author Vova Feldman (@svovaf)
324
- * @since 1.1.3
325
- *
326
- * @return string
327
- */
328
- function get_original_menu_slug() {
329
- if ( 'cpt' === $this->_type ) {
330
- return add_query_arg( array(
331
- 'post_type' => $this->_menu_slug
332
- ), 'edit.php' );
333
- }
334
-
335
- if ( false === strpos( $this->_menu_slug, '.php?' ) ) {
336
- return $this->_menu_slug;
337
- } else {
338
- return $this->_plugin_slug;
339
- }
340
- }
341
-
342
- /**
343
- * @author Vova Feldman (@svovaf)
344
- * @since 1.1.3
345
- *
346
- * @return string
347
- */
348
- function get_top_level_menu_slug() {
349
- return $this->has_custom_parent() ?
350
- $this->get_parent_slug() :
351
- $this->get_raw_slug();
352
- }
353
-
354
- /**
355
- * Is user on plugin's admin activation page.
356
- *
357
- * @author Vova Feldman (@svovaf)
358
- * @since 1.0.8
359
- *
360
- * @return bool
361
- */
362
- function is_activation_page() {
363
- return isset( $_GET['page'] ) &&
364
- ( ( strtolower( $this->_menu_slug ) === strtolower( $_GET['page'] ) ) ||
365
- ( strtolower( $this->_plugin_slug ) === strtolower( $_GET['page'] ) ) );
366
- }
367
-
368
- #region Submenu Override
369
-
370
- /**
371
- * Override submenu's action.
372
- *
373
- * @author Vova Feldman (@svovaf)
374
- * @since 1.1.0
375
- *
376
- * @param string $parent_slug
377
- * @param string $menu_slug
378
- * @param callable $function
379
- *
380
- * @return false|string If submenu exist, will return the hook name.
381
- */
382
- function override_submenu_action( $parent_slug, $menu_slug, $function ) {
383
- global $submenu;
384
-
385
- $menu_slug = plugin_basename( $menu_slug );
386
- $parent_slug = plugin_basename( $parent_slug );
387
-
388
- if ( ! isset( $submenu[ $parent_slug ] ) ) {
389
- // Parent menu not exist.
390
- return false;
391
- }
392
-
393
- $found_submenu_item = false;
394
- foreach ( $submenu[ $parent_slug ] as $submenu_item ) {
395
- if ( $menu_slug === $submenu_item[2] ) {
396
- $found_submenu_item = $submenu_item;
397
- break;
398
- }
399
- }
400
-
401
- if ( false === $found_submenu_item ) {
402
- // Submenu item not found.
403
- return false;
404
- }
405
-
406
- // Remove current function.
407
- $hookname = get_plugin_page_hookname( $menu_slug, $parent_slug );
408
- remove_all_actions( $hookname );
409
-
410
- // Attach new action.
411
- add_action( $hookname, $function );
412
-
413
- return $hookname;
414
- }
415
-
416
- #endregion Submenu Override
417
-
418
- #region Top level menu Override
419
-
420
- /**
421
- * Find plugin's admin dashboard main menu item.
422
- *
423
- * @author Vova Feldman (@svovaf)
424
- * @since 1.0.2
425
- *
426
- * @return string[]|false
427
- */
428
- private function find_top_level_menu() {
429
- global $menu;
430
-
431
- $position = - 1;
432
- $found_menu = false;
433
-
434
- $menu_slug = $this->get_raw_slug();
435
-
436
- $hook_name = get_plugin_page_hookname( $menu_slug, '' );
437
- foreach ( $menu as $pos => $m ) {
438
- if ( $menu_slug === $m[2] ) {
439
- $position = $pos;
440
- $found_menu = $m;
441
- break;
442
- }
443
- }
444
-
445
- if ( false === $found_menu ) {
446
- return false;
447
- }
448
-
449
- return array(
450
- 'menu' => $found_menu,
451
- 'position' => $position,
452
- 'hook_name' => $hook_name
453
- );
454
- }
455
-
456
- /**
457
- * Remove all sub-menu items.
458
- *
459
- * @author Vova Feldman (@svovaf)
460
- * @since 1.0.7
461
- *
462
- * @return bool If submenu with plugin's menu slug was found.
463
- */
464
- private function remove_all_submenu_items() {
465
- global $submenu;
466
-
467
- $menu_slug = $this->get_raw_slug();
468
-
469
- if ( ! isset( $submenu[ $menu_slug ] ) ) {
470
- return false;
471
- }
472
-
473
- $submenu[ $menu_slug ] = array();
474
-
475
- return true;
476
- }
477
-
478
- /**
479
- *
480
- * @author Vova Feldman (@svovaf)
481
- * @since 1.0.9
482
- *
483
- * @return array[string]mixed
484
- */
485
- function remove_menu_item() {
486
- $this->_logger->entrance();
487
-
488
- // Find main menu item.
489
- $menu = $this->find_top_level_menu();
490
-
491
- if ( false === $menu ) {
492
- return false;
493
- }
494
-
495
- // Remove it with its actions.
496
- remove_all_actions( $menu['hook_name'] );
497
-
498
- // Remove all submenu items.
499
- $this->remove_all_submenu_items();
500
-
501
- return $menu;
502
- }
503
-
504
- /**
505
- *
506
- * @author Vova Feldman (@svovaf)
507
- * @since 1.1.4
508
- *
509
- * @param callable $function
510
- *
511
- * @return array[string]mixed
512
- */
513
- function override_menu_item( $function ) {
514
- $found_menu = $this->remove_menu_item();
515
-
516
- if ( false === $found_menu ) {
517
- return false;
518
- }
519
-
520
- if ( ! $this->is_top_level() || ! $this->is_cpt() ) {
521
- $menu_slug = plugin_basename( $this->get_slug() );
522
-
523
- $hookname = get_plugin_page_hookname( $menu_slug, '' );
524
-
525
- // Override menu action.
526
- add_action( $hookname, $function );
527
- } else {
528
- global $menu;
529
-
530
- // Remove original CPT menu.
531
- unset( $menu[ $found_menu['position'] ] );
532
-
533
- // Create new top-level menu action.
534
- $hookname = add_menu_page(
535
- $found_menu['menu'][3],
536
- $found_menu['menu'][0],
537
- 'manage_options',
538
- $this->get_slug(),
539
- $function,
540
- $found_menu['menu'][6],
541
- $found_menu['position']
542
- );
543
- }
544
-
545
- return $hookname;
546
- }
547
-
548
- #endregion Top level menu Override
549
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/managers/class-fs-admin-notice-manager.php DELETED
@@ -1,310 +0,0 @@
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
- class FS_Admin_Notice_Manager {
14
- /**
15
- * @var string
16
- */
17
- protected $_slug;
18
- /**
19
- * @var string
20
- */
21
- protected $_title;
22
- /**
23
- * @var array[]
24
- */
25
- private $_admin_messages = array();
26
- /**
27
- * @var FS_Key_Value_Storage
28
- */
29
- private $_sticky_storage;
30
- /**
31
- * @var FS_Plugin_Manager[]
32
- */
33
- private static $_instances = array();
34
- /**
35
- * @var FS_Logger
36
- */
37
- protected $_logger;
38
-
39
- /**
40
- * @param string $slug
41
- * @param string $title
42
- *
43
- * @return FS_Admin_Notice_Manager
44
- */
45
- static function instance( $slug, $title = '' ) {
46
- if ( ! isset( self::$_instances[ $slug ] ) ) {
47
- self::$_instances[ $slug ] = new FS_Admin_Notice_Manager( $slug, $title );
48
- }
49
-
50
- return self::$_instances[ $slug ];
51
- }
52
-
53
- protected function __construct( $slug, $title = '' ) {
54
- $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $slug . '_data', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
55
-
56
- $this->_slug = $slug;
57
- $this->_title = ! empty( $title ) ? $title : '';
58
- $this->_sticky_storage = FS_Key_Value_Storage::instance( 'admin_notices', $this->_slug );
59
-
60
- if ( is_admin() ) {
61
- if ( 0 < count( $this->_sticky_storage ) ) {
62
- // If there are sticky notices for the current slug, add a callback
63
- // to the AJAX action that handles message dismiss.
64
- add_action( "wp_ajax_{$slug}_dismiss_notice_action", array(
65
- &$this,
66
- 'dismiss_notice_ajax_callback'
67
- ) );
68
-
69
- foreach ( $this->_sticky_storage as $id => $msg ) {
70
- // Add admin notice.
71
- $this->add(
72
- $msg['message'],
73
- $msg['title'],
74
- $msg['type'],
75
- true,
76
- $msg['all'],
77
- $msg['id'],
78
- false
79
- );
80
- }
81
- }
82
- }
83
- }
84
-
85
- /**
86
- * Remove sticky message by ID.
87
- *
88
- * @author Vova Feldman (@svovaf)
89
- * @since 1.0.7
90
- *
91
- */
92
- function dismiss_notice_ajax_callback() {
93
- $this->_sticky_storage->remove( $_POST['message_id'] );
94
- wp_die();
95
- }
96
-
97
- /**
98
- * Rendered sticky message dismiss JavaScript.
99
- *
100
- * @author Vova Feldman (@svovaf)
101
- * @since 1.0.7
102
- */
103
- static function _add_sticky_dismiss_javascript() {
104
- $params = array();
105
- fs_require_once_template( 'sticky-admin-notice-js.php', $params );
106
- }
107
-
108
- private static $_added_sticky_javascript = false;
109
-
110
- /**
111
- * Hook to the admin_footer to add sticky message dismiss JavaScript handler.
112
- *
113
- * @author Vova Feldman (@svovaf)
114
- * @since 1.0.7
115
- */
116
- private static function has_sticky_messages() {
117
- if ( ! self::$_added_sticky_javascript ) {
118
- add_action( 'admin_footer', array( 'FS_Admin_Notice_Manager', '_add_sticky_dismiss_javascript' ) );
119
- }
120
- }
121
-
122
- /**
123
- * Handle admin_notices by printing the admin messages stacked in the queue.
124
- *
125
- * @author Vova Feldman (@svovaf)
126
- * @since 1.0.4
127
- *
128
- */
129
- function _admin_notices_hook() {
130
- $notice_type = 'admin_notices';
131
-
132
- if ( function_exists( 'current_user_can' ) &&
133
- ! current_user_can( 'manage_options' )
134
- ) {
135
- // Only show messages to admins.
136
- return;
137
- }
138
-
139
- if ( ! isset( $this->_admin_messages[ $notice_type ] ) || ! is_array( $this->_admin_messages[ $notice_type ] ) ) {
140
- return;
141
- }
142
-
143
- foreach ( $this->_admin_messages[ $notice_type ] as $id => $msg ) {
144
- fs_require_template( 'admin-notice.php', $msg );
145
-
146
- if ( $msg['sticky'] ) {
147
- self::has_sticky_messages();
148
- }
149
- }
150
- }
151
-
152
- /**
153
- * Handle all_admin_notices by printing the admin messages stacked in the queue.
154
- *
155
- * @author Vova Feldman (@svovaf)
156
- * @since 1.0.4
157
- *
158
- */
159
- function _all_admin_notices_hook() {
160
- $notice_type = 'all_admin_notices';
161
-
162
- if ( ! isset( $this->_admin_messages[ $notice_type ] ) || ! is_array( $this->_admin_messages[ $notice_type ] ) ) {
163
- return;
164
- }
165
-
166
- foreach ( $this->_admin_messages[ $notice_type ] as $id => $msg ) {
167
- fs_require_template( 'all-admin-notice.php', $msg );
168
- }
169
- }
170
-
171
- /**
172
- * Enqueue common stylesheet to style admin notice.
173
- *
174
- * @author Vova Feldman (@svovaf)
175
- * @since 1.0.7
176
- */
177
- function _enqueue_styles() {
178
- fs_enqueue_local_style( 'fs_common', '/admin/common.css' );
179
- }
180
-
181
- /**
182
- * Add admin message to admin messages queue, and hook to admin_notices / all_admin_notices if not yet hooked.
183
- *
184
- * @author Vova Feldman (@svovaf)
185
- * @since 1.0.4
186
- *
187
- * @param string $message
188
- * @param string $title
189
- * @param string $type
190
- * @param bool $is_sticky
191
- * @param bool $all_admin
192
- * @param string $id Message ID
193
- * @param bool $store_if_sticky
194
- *
195
- * @uses add_action()
196
- */
197
- function add( $message, $title = '', $type = 'success', $is_sticky = false, $all_admin = false, $id = '', $store_if_sticky = true ) {
198
- $key = ( $all_admin ? 'all_admin_notices' : 'admin_notices' );
199
-
200
- if ( ! isset( $this->_admin_messages[ $key ] ) ) {
201
- $this->_admin_messages[ $key ] = array();
202
-
203
- add_action( $key, array( &$this, "_{$key}_hook" ) );
204
- add_action( 'admin_enqueue_scripts', array( &$this, '_enqueue_styles' ) );
205
-
206
- }
207
-
208
- if ( '' === $id ) {
209
- $id = md5( $title . ' ' . $message . ' ' . $type );
210
- }
211
-
212
- $message_object = array(
213
- 'message' => $message,
214
- 'title' => $title,
215
- 'type' => $type,
216
- 'sticky' => $is_sticky,
217
- 'id' => $id,
218
- 'all' => $all_admin,
219
- 'slug' => $this->_slug,
220
- 'plugin' => $this->_title,
221
- );
222
-
223
- if ( $is_sticky && $store_if_sticky ) {
224
- $this->_sticky_storage->{$id} = $message_object;
225
- }
226
-
227
- $this->_admin_messages[ $key ][ $id ] = $message_object;
228
- }
229
-
230
- /**
231
- * @author Vova Feldman (@svovaf)
232
- * @since 1.0.7
233
- *
234
- * @param string|string[] $ids
235
- */
236
- function remove_sticky( $ids ) {
237
- if ( ! is_array( $ids ) ) {
238
- $ids = array( $ids );
239
- }
240
-
241
- foreach ( $ids as $id ) {
242
- // Remove from sticky storage.
243
- $this->_sticky_storage->remove( $id );
244
-
245
- // Remove from current admin messages.
246
- if ( isset( $this->_admin_messages['all_admin_notices'] ) && isset( $this->_admin_messages['all_admin_notices'][ $id ] ) ) {
247
- unset( $this->_admin_messages['all_admin_notices'][ $id ] );
248
- }
249
- if ( isset( $this->_admin_messages['admin_notices'] ) && isset( $this->_admin_messages['admin_notices'][ $id ] ) ) {
250
- unset( $this->_admin_messages['admin_notices'][ $id ] );
251
- }
252
- }
253
- }
254
-
255
- /**
256
- * Check if sticky message exists by id.
257
- *
258
- * @author Vova Feldman (@svovaf)
259
- * @since 1.0.9
260
- *
261
- * @param $id
262
- *
263
- * @return bool
264
- */
265
- function has_sticky( $id ) {
266
- return isset( $this->_sticky_storage[ $id ] );
267
- }
268
-
269
- /**
270
- * Adds sticky admin notification.
271
- *
272
- * @author Vova Feldman (@svovaf)
273
- * @since 1.0.7
274
- *
275
- * @param string $message
276
- * @param string $id Message ID
277
- * @param string $title
278
- * @param string $type
279
- * @param bool $all_admin
280
- */
281
- function add_sticky( $message, $id, $title = '', $type = 'success', $all_admin = false ) {
282
- $this->add( $message, $title, $type, true, $all_admin, $id );
283
- }
284
-
285
- /**
286
- * Clear all sticky messages.
287
- *
288
- * @author Vova Feldman (@svovaf)
289
- * @since 1.0.8
290
- */
291
- function clear_all_sticky() {
292
- $this->_sticky_storage->clear_all();
293
- }
294
-
295
- /**
296
- * Add admin message to all admin messages queue, and hook to all_admin_notices if not yet hooked.
297
- *
298
- * @author Vova Feldman (@svovaf)
299
- * @since 1.0.4
300
- *
301
- * @param string $message
302
- * @param string $title
303
- * @param string $type
304
- * @param bool $is_sticky
305
- * @param string $id Message ID
306
- */
307
- function add_all( $message, $title = '', $type = 'success', $is_sticky = false, $id = '' ) {
308
- $this->add( $message, $title, $type, $is_sticky, true, $id );
309
- }
310
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/managers/class-fs-cache-manager.php DELETED
@@ -1,237 +0,0 @@
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 DELETED
@@ -1,326 +0,0 @@
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 DELETED
@@ -1,101 +0,0 @@
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
- if ( ! $license->is_utilized() && $license->is_features_enabled() ) {
94
- return true;
95
- }
96
- }
97
- }
98
-
99
- return false;
100
- }
101
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/managers/class-fs-option-manager.php DELETED
@@ -1,302 +0,0 @@
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 DELETED
@@ -1,162 +0,0 @@
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 DELETED
@@ -1,154 +0,0 @@
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/sdk/Exceptions/ArgumentNotExistException.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
- if ( ! class_exists( 'Freemius_InvalidArgumentException' ) ) {
3
- exit;
4
- }
5
-
6
- class Freemius_ArgumentNotExistException extends Freemius_InvalidArgumentException { }
 
 
 
 
 
 
freemius/includes/sdk/Exceptions/EmptyArgumentException.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
- if ( ! class_exists( 'Freemius_InvalidArgumentException' ) ) {
3
- exit;
4
- }
5
-
6
- class Freemius_EmptyArgumentException extends Freemius_InvalidArgumentException { }
 
 
 
 
 
 
freemius/includes/sdk/Exceptions/Exception.php DELETED
@@ -1,75 +0,0 @@
1
- <?php
2
- /**
3
- * Thrown when an API call returns an exception.
4
- *
5
- */
6
- class Freemius_Exception extends Exception
7
- {
8
- protected $_result;
9
- protected $_type;
10
- protected $_code;
11
-
12
- /**
13
- * Make a new API Exception with the given result.
14
- *
15
- * @param array $result The result from the API server.
16
- */
17
- public function __construct($result)
18
- {
19
- $this->_result = $result;
20
-
21
- $code = 0;
22
- $message = 'Unknown error, please check GetResult().';
23
- $type = '';
24
-
25
- if (isset($result['error']) && is_array($result['error']))
26
- {
27
- if (isset($result['error']['code']))
28
- $code = $result['error']['code'];
29
- if (isset($result['error']['message']))
30
- $message = $result['error']['message'];
31
- if (isset($result['error']['type']))
32
- $type = $result['error']['type'];
33
- }
34
-
35
- $this->_type = $type;
36
- $this->_code = $code;
37
-
38
- parent::__construct($message, is_numeric($code) ? $code : 0);
39
- }
40
-
41
- /**
42
- * Return the associated result object returned by the API server.
43
- *
44
- * @return array The result from the API server
45
- */
46
- public function getResult()
47
- {
48
- return $this->_result;
49
- }
50
-
51
- public function getStringCode()
52
- {
53
- return $this->_code;
54
- }
55
-
56
- public function getType()
57
- {
58
- return $this->_type;
59
- }
60
-
61
- /**
62
- * To make debugging easier.
63
- *
64
- * @return string The string representation of the error
65
- */
66
- public function __toString()
67
- {
68
- $str = $this->getType() . ': ';
69
-
70
- if ($this->code != 0)
71
- $str .= $this->getStringCode() . ': ';
72
-
73
- return $str . $this->getMessage();
74
- }
75
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/sdk/Exceptions/InvalidArgumentException.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
- if ( ! class_exists( 'Freemius_Exception' ) ) {
3
- exit;
4
- }
5
-
6
- class Freemius_InvalidArgumentException extends Freemius_Exception { }
 
 
 
 
 
 
freemius/includes/sdk/Exceptions/OAuthException.php DELETED
@@ -1,12 +0,0 @@
1
- <?php
2
- if ( ! class_exists( 'Freemius_Exception' ) ) {
3
- exit;
4
- }
5
-
6
- class Freemius_OAuthException extends Freemius_Exception
7
- {
8
- public function __construct($pResult)
9
- {
10
- parent::__construct($pResult);
11
- }
12
- }
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/sdk/Freemius.php DELETED
@@ -1,576 +0,0 @@
1
- <?php
2
- /**
3
- * Copyright 2014 Freemius, Inc.
4
- *
5
- * Licensed under the GPL v2 (the "License"); you may
6
- * not use this file except in compliance with the License. You may obtain
7
- * a copy of the License at
8
- *
9
- * http://choosealicense.com/licenses/gpl-v2/
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
- * License for the specific language governing permissions and limitations
15
- * under the License.
16
- */
17
-
18
- require_once( dirname( __FILE__ ) . '/FreemiusBase.php' );
19
-
20
- define( 'FS_SDK__USER_AGENT', 'fs-php-' . Freemius_Api_Base::VERSION );
21
-
22
- if ( ! defined( 'FS_SDK__SIMULATE_NO_CURL' ) ) {
23
- define( 'FS_SDK__SIMULATE_NO_CURL', false );
24
- }
25
-
26
- if ( ! defined( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE' ) ) {
27
- define( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE', false );
28
- }
29
-
30
- if ( ! defined( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL' ) ) {
31
- define( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL', false );
32
- }
33
-
34
- define( 'FS_SDK__HAS_CURL', ! FS_SDK__SIMULATE_NO_CURL && function_exists( 'curl_version' ) );
35
-
36
- if ( ! FS_SDK__HAS_CURL ) {
37
- $curl_version = array( 'version' => '7.0.0' );
38
- } else {
39
- $curl_version = curl_version();
40
- }
41
-
42
- define( 'FS_API__PROTOCOL', version_compare( $curl_version['version'], '7.37', '>=' ) ? 'https' : 'http' );
43
-
44
- if ( ! defined( 'FS_API__LOGGER_ON' ) ) {
45
- define( 'FS_API__LOGGER_ON', false );
46
- }
47
-
48
- if ( ! defined( 'FS_API__ADDRESS' ) ) {
49
- define( 'FS_API__ADDRESS', '://api.freemius.com' );
50
- }
51
- if ( ! defined( 'FS_API__SANDBOX_ADDRESS' ) ) {
52
- define( 'FS_API__SANDBOX_ADDRESS', '://sandbox-api.freemius.com' );
53
- }
54
-
55
- class Freemius_Api extends Freemius_Api_Base {
56
- private static $_logger = array();
57
-
58
- /**
59
- * @param string $pScope 'app', 'developer', 'user' or 'install'.
60
- * @param number $pID Element's id.
61
- * @param string $pPublic Public key.
62
- * @param string|bool $pSecret Element's secret key.
63
- * @param bool $pSandbox Whether or not to run API in sandbox mode.
64
- */
65
- public function __construct( $pScope, $pID, $pPublic, $pSecret = false, $pSandbox = false ) {
66
- // If secret key not provided, use public key encryption.
67
- if ( is_bool( $pSecret ) ) {
68
- $pSecret = $pPublic;
69
- }
70
-
71
- parent::Init( $pScope, $pID, $pPublic, $pSecret, $pSandbox );
72
- }
73
-
74
- public static function GetUrl( $pCanonizedPath = '', $pIsSandbox = false ) {
75
- $address = ( $pIsSandbox ? FS_API__SANDBOX_ADDRESS : FS_API__ADDRESS );
76
-
77
- if ( ':' === $address[0] ) {
78
- $address = self::$_protocol . $address;
79
- }
80
-
81
- return $address . $pCanonizedPath;
82
- }
83
-
84
- #region Servers Clock Diff ------------------------------------------------------
85
-
86
- /**
87
- * @var int Clock diff in seconds between current server to API server.
88
- */
89
- private static $_clock_diff = 0;
90
-
91
- /**
92
- * Set clock diff for all API calls.
93
- *
94
- * @since 1.0.3
95
- *
96
- * @param $pSeconds
97
- */
98
- public static function SetClockDiff( $pSeconds ) {
99
- self::$_clock_diff = $pSeconds;
100
- }
101
-
102
- /**
103
- * Find clock diff between current server to API server.
104
- *
105
- * @since 1.0.2
106
- * @return int Clock diff in seconds.
107
- */
108
- public static function FindClockDiff() {
109
- $time = time();
110
- $pong = self::Ping();
111
-
112
- return ( $time - strtotime( $pong->timestamp ) );
113
- }
114
-
115
- #endregion Servers Clock Diff ------------------------------------------------------
116
-
117
- /**
118
- * @var string http or https
119
- */
120
- private static $_protocol = FS_API__PROTOCOL;
121
-
122
- /**
123
- * Set API connection protocol.
124
- *
125
- * @since 1.0.4
126
- */
127
- public static function SetHttp() {
128
- self::$_protocol = 'http';
129
- }
130
-
131
- /**
132
- * @since 1.0.4
133
- *
134
- * @return bool
135
- */
136
- public static function IsHttps() {
137
- return ( 'https' === self::$_protocol );
138
- }
139
-
140
- /**
141
- * Sign request with the following HTTP headers:
142
- * Content-MD5: MD5(HTTP Request body)
143
- * Date: Current date (i.e Sat, 14 Feb 2015 20:24:46 +0000)
144
- * Authorization: FS {scope_entity_id}:{scope_entity_public_key}:base64encode(sha256(string_to_sign,
145
- * {scope_entity_secret_key}))
146
- *
147
- * @param string $pResourceUrl
148
- * @param array $pCurlOptions
149
- *
150
- * @return array
151
- */
152
- function SignRequest( $pResourceUrl, $pCurlOptions ) {
153
- $eol = "\n";
154
- $content_md5 = '';
155
- $now = ( time() - self::$_clock_diff );
156
- $date = date( 'r', $now );
157
- $content_type = '';
158
-
159
- if ( isset( $pCurlOptions[ CURLOPT_POST ] ) && 0 < $pCurlOptions[ CURLOPT_POST ] ) {
160
- $content_md5 = md5( $pCurlOptions[ CURLOPT_POSTFIELDS ] );
161
- $pCurlOptions[ CURLOPT_HTTPHEADER ][] = 'Content-MD5: ' . $content_md5;
162
- $content_type = 'application/json';
163
- }
164
-
165
- $pCurlOptions[ CURLOPT_HTTPHEADER ][] = 'Date: ' . $date;
166
-
167
- $string_to_sign = implode( $eol, array(
168
- $pCurlOptions[ CURLOPT_CUSTOMREQUEST ],
169
- $content_md5,
170
- $content_type,
171
- $date,
172
- $pResourceUrl
173
- ) );
174
-
175
- // If secret and public keys are identical, it means that
176
- // the signature uses public key hash encoding.
177
- $auth_type = ( $this->_secret !== $this->_public ) ? 'FS' : 'FSP';
178
-
179
- // Add authorization header.
180
- $pCurlOptions[ CURLOPT_HTTPHEADER ][] = 'Authorization: ' .
181
- $auth_type . ' ' .
182
- $this->_id . ':' .
183
- $this->_public . ':' .
184
- self::Base64UrlEncode(
185
- hash_hmac( 'sha256', $string_to_sign, $this->_secret )
186
- );
187
-
188
- return $pCurlOptions;
189
- }
190
-
191
- /**
192
- * Get API request URL signed via query string.
193
- *
194
- * @param string $pPath
195
- *
196
- * @throws Freemius_Exception
197
- *
198
- * @return string
199
- */
200
- function GetSignedUrl( $pPath ) {
201
- $resource = explode( '?', $this->CanonizePath( $pPath ) );
202
- $pResourceUrl = $resource[0];
203
-
204
- $eol = "\n";
205
- $content_md5 = '';
206
- $content_type = '';
207
- $now = ( time() - self::$_clock_diff );
208
- $date = date( 'r', $now );
209
-
210
- $string_to_sign = implode( $eol, array(
211
- 'GET',
212
- $content_md5,
213
- $content_type,
214
- $date,
215
- $pResourceUrl
216
- ) );
217
-
218
- // If secret and public keys are identical, it means that
219
- // the signature uses public key hash encoding.
220
- $auth_type = ( $this->_secret !== $this->_public ) ? 'FS' : 'FSP';
221
-
222
- return Freemius_Api::GetUrl(
223
- $pResourceUrl . '?' .
224
- ( 1 < count( $resource ) && ! empty( $resource[1] ) ? $resource[1] . '&' : '' ) .
225
- http_build_query( array(
226
- 'auth_date' => $date,
227
- 'authorization' => $auth_type . ' ' . $this->_id . ':' .
228
- $this->_public . ':' .
229
- self::Base64UrlEncode( hash_hmac(
230
- 'sha256', $string_to_sign, $this->_secret
231
- ) )
232
- ) ), $this->_isSandbox );
233
- }
234
-
235
- /**
236
- * @param resource $pCurlHandler
237
- * @param array $pCurlOptions
238
- *
239
- * @return mixed
240
- */
241
- private static function ExecuteRequest( &$pCurlHandler, &$pCurlOptions ) {
242
- $start = microtime( true );
243
-
244
- $result = curl_exec( $pCurlHandler );
245
-
246
- if ( FS_API__LOGGER_ON ) {
247
- $end = microtime( true );
248
-
249
- $has_body = ( isset( $pCurlOptions[ CURLOPT_POST ] ) && 0 < $pCurlOptions[ CURLOPT_POST ] );
250
-
251
- self::$_logger[] = array(
252
- 'id' => count( self::$_logger ),
253
- 'start' => $start,
254
- 'end' => $end,
255
- 'total' => ( $end - $start ),
256
- 'method' => $pCurlOptions[ CURLOPT_CUSTOMREQUEST ],
257
- 'path' => $pCurlOptions[ CURLOPT_URL ],
258
- 'body' => $has_body ? $pCurlOptions[ CURLOPT_POSTFIELDS ] : null,
259
- 'result' => $result,
260
- 'code' => curl_getinfo( $pCurlHandler, CURLINFO_HTTP_CODE ),
261
- 'backtrace' => debug_backtrace(),
262
- );
263
- }
264
-
265
- return $result;
266
- }
267
-
268
- /**
269
- * @return array
270
- */
271
- static function GetLogger() {
272
- return self::$_logger;
273
- }
274
-
275
- /**
276
- * @param string $pCanonizedPath
277
- * @param string $pMethod
278
- * @param array $pParams
279
- * @param null|resource $pCurlHandler
280
- * @param bool $pIsSandbox
281
- * @param null|callable $pBeforeExecutionFunction
282
- *
283
- * @return object[]|object|null
284
- *
285
- * @throws \Freemius_Exception
286
- */
287
- private static function MakeStaticRequest(
288
- $pCanonizedPath,
289
- $pMethod = 'GET',
290
- $pParams = array(),
291
- $pCurlHandler = null,
292
- $pIsSandbox = false,
293
- $pBeforeExecutionFunction = null
294
- ) {
295
- if ( ! FS_SDK__HAS_CURL ) {
296
- self::ThrowNoCurlException();
297
- }
298
-
299
- // Connectivity errors simulation.
300
- if ( FS_SDK__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE ) {
301
- self::ThrowCloudFlareDDoSException();
302
- } else if ( FS_SDK__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL ) {
303
- self::ThrowSquidAclException();
304
- }
305
-
306
- if ( ! $pCurlHandler ) {
307
- $pCurlHandler = curl_init();
308
- }
309
-
310
- $opts = array(
311
- CURLOPT_CONNECTTIMEOUT => 10,
312
- CURLOPT_RETURNTRANSFER => true,
313
- CURLOPT_TIMEOUT => 60,
314
- CURLOPT_USERAGENT => FS_SDK__USER_AGENT,
315
- );
316
-
317
- if ( ! isset( $opts[ CURLOPT_HTTPHEADER ] ) || ! is_array( $opts[ CURLOPT_HTTPHEADER ] ) ) {
318
- $opts[ CURLOPT_HTTPHEADER ] = array();
319
- }
320
-
321
- if ( 'POST' === $pMethod || 'PUT' === $pMethod ) {
322
- if ( is_array( $pParams ) && 0 < count( $pParams ) ) {
323
- $opts[ CURLOPT_HTTPHEADER ][] = 'Content-Type: application/json';
324
- $opts[ CURLOPT_POST ] = count( $pParams );
325
- $opts[ CURLOPT_POSTFIELDS ] = json_encode( $pParams );
326
- }
327
-
328
- $opts[ CURLOPT_RETURNTRANSFER ] = true;
329
- }
330
-
331
- $request_url = Freemius_Api::GetUrl( $pCanonizedPath, $pIsSandbox );
332
-
333
- $opts[ CURLOPT_URL ] = $request_url;
334
- $opts[ CURLOPT_CUSTOMREQUEST ] = $pMethod;
335
-
336
- $resource = explode( '?', $pCanonizedPath );
337
-
338
- // disable the 'Expect: 100-continue' behaviour. This causes CURL to wait
339
- // for 2 seconds if the server does not support this header.
340
- $opts[ CURLOPT_HTTPHEADER ][] = 'Expect:';
341
-
342
- if ( 'https' === substr( strtolower( $request_url ), 0, 5 ) ) {
343
- $opts[ CURLOPT_SSL_VERIFYHOST ] = false;
344
- $opts[ CURLOPT_SSL_VERIFYPEER ] = false;
345
- }
346
-
347
- if ( false !== $pBeforeExecutionFunction &&
348
- is_callable( $pBeforeExecutionFunction )
349
- ) {
350
- $opts = call_user_func( $pBeforeExecutionFunction, $resource[0], $opts );
351
- }
352
-
353
- curl_setopt_array( $pCurlHandler, $opts );
354
- $result = self::ExecuteRequest( $pCurlHandler, $opts );
355
-
356
- /*if (curl_errno($ch) == 60) // CURLE_SSL_CACERT
357
- {
358
- self::errorLog('Invalid or no certificate authority found, using bundled information');
359
- curl_setopt($ch, CURLOPT_CAINFO,
360
- dirname(__FILE__) . '/fb_ca_chain_bundle.crt');
361
- $result = curl_exec($ch);
362
- }*/
363
-
364
- // With dual stacked DNS responses, it's possible for a server to
365
- // have IPv6 enabled but not have IPv6 connectivity. If this is
366
- // the case, curl will try IPv4 first and if that fails, then it will
367
- // fall back to IPv6 and the error EHOSTUNREACH is returned by the
368
- // operating system.
369
- if ( false === $result && empty( $opts[ CURLOPT_IPRESOLVE ] ) ) {
370
- $matches = array();
371
- $regex = '/Failed to connect to ([^:].*): Network is unreachable/';
372
- if ( preg_match( $regex, curl_error( $pCurlHandler ), $matches ) ) {
373
- if ( strlen( @inet_pton( $matches[1] ) ) === 16 ) {
374
- // self::errorLog('Invalid IPv6 configuration on server, Please disable or get native IPv6 on your server.');
375
- $opts[ CURLOPT_IPRESOLVE ] = CURL_IPRESOLVE_V4;
376
- curl_setopt( $pCurlHandler, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
377
- $result = self::ExecuteRequest( $pCurlHandler, $opts );
378
- }
379
- }
380
- }
381
-
382
- if ( $result === false ) {
383
- self::ThrowCurlException( $pCurlHandler );
384
- }
385
-
386
- curl_close( $pCurlHandler );
387
-
388
- if ( empty( $result ) ) {
389
- return null;
390
- }
391
-
392
- $decoded = json_decode( $result );
393
-
394
- if ( is_null( $decoded ) ) {
395
- if ( preg_match( '/Please turn JavaScript on/i', $result ) &&
396
- preg_match( '/text\/javascript/', $result )
397
- ) {
398
- self::ThrowCloudFlareDDoSException( $result );
399
- } else if ( preg_match( '/Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect./', $result ) &&
400
- preg_match( '/squid/', $result )
401
- ) {
402
- self::ThrowSquidAclException( $result );
403
- } else {
404
- $decoded = (object) array(
405
- 'error' => (object) array(
406
- 'type' => 'Unknown',
407
- 'message' => $result,
408
- 'code' => 'unknown',
409
- 'http' => 402
410
- )
411
- );
412
- }
413
- }
414
-
415
- return $decoded;
416
- }
417
-
418
-
419
- /**
420
- * Makes an HTTP request. This method can be overridden by subclasses if
421
- * developers want to do fancier things or use something other than curl to
422
- * make the request.
423
- *
424
- * @param string $pCanonizedPath The URL to make the request to
425
- * @param string $pMethod HTTP method
426
- * @param array $pParams The parameters to use for the POST body
427
- * @param null|resource $pCurlHandler Initialized curl handle
428
- *
429
- * @return object[]|object|null
430
- *
431
- * @throws Freemius_Exception
432
- */
433
- public function MakeRequest(
434
- $pCanonizedPath,
435
- $pMethod = 'GET',
436
- $pParams = array(),
437
- $pCurlHandler = null
438
- ) {
439
- $resource = explode( '?', $pCanonizedPath );
440
-
441
- // Only sign request if not ping.json connectivity test.
442
- $sign_request = ( '/v1/ping.json' !== strtolower( substr( $resource[0], - strlen( '/v1/ping.json' ) ) ) );
443
-
444
- return self::MakeStaticRequest(
445
- $pCanonizedPath,
446
- $pMethod,
447
- $pParams,
448
- $pCurlHandler,
449
- $this->_isSandbox,
450
- $sign_request ? array( &$this, 'SignRequest' ) : null
451
- );
452
- }
453
-
454
- #region Connectivity Test ------------------------------------------------------
455
-
456
- /**
457
- * If successful connectivity to the API endpoint using ping.json endpoint.
458
- *
459
- * - OR -
460
- *
461
- * Validate if ping result object is valid.
462
- *
463
- * @param mixed $pPong
464
- *
465
- * @return bool
466
- */
467
- public static function Test( $pPong = null ) {
468
- $pong = is_null( $pPong ) ?
469
- self::Ping() :
470
- $pPong;
471
-
472
- return (
473
- is_object( $pong ) &&
474
- isset( $pong->api ) &&
475
- 'pong' === $pong->api
476
- );
477
- }
478
-
479
- /**
480
- * Ping API to test connectivity.
481
- *
482
- * @return object
483
- */
484
- public static function Ping() {
485
- try {
486
- $result = self::MakeStaticRequest( '/v' . FS_API__VERSION . '/ping.json' );
487
- } catch ( Freemius_Exception $e ) {
488
- // Map to error object.
489
- $result = (object) $e->getResult();
490
- } catch ( Exception $e ) {
491
- // Map to error object.
492
- $result = (object) array(
493
- 'error' => array(
494
- 'type' => 'Unknown',
495
- 'message' => $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')',
496
- 'code' => 'unknown',
497
- 'http' => 402
498
- )
499
- );
500
- }
501
-
502
- return $result;
503
- }
504
-
505
- #endregion Connectivity Test ------------------------------------------------------
506
-
507
- #region Connectivity Exceptions ------------------------------------------------------
508
-
509
- /**
510
- * @param resource $pCurlHandler
511
- *
512
- * @throws Freemius_Exception
513
- */
514
- private static function ThrowCurlException( $pCurlHandler ) {
515
- $e = new Freemius_Exception( array(
516
- 'error' => array(
517
- 'code' => curl_errno( $pCurlHandler ),
518
- 'message' => curl_error( $pCurlHandler ),
519
- 'type' => 'CurlException',
520
- ),
521
- ) );
522
-
523
- curl_close( $pCurlHandler );
524
- throw $e;
525
- }
526
-
527
- /**
528
- * @param string $pResult
529
- *
530
- * @throws Freemius_Exception
531
- */
532
- private static function ThrowNoCurlException( $pResult = '' ) {
533
- throw new Freemius_Exception( array(
534
- 'error' => (object) array(
535
- 'type' => 'cUrlMissing',
536
- 'message' => $pResult,
537
- 'code' => 'curl_missing',
538
- 'http' => 402
539
- )
540
- ) );
541
- }
542
-
543
- /**
544
- * @param string $pResult
545
- *
546
- * @throws Freemius_Exception
547
- */
548
- private static function ThrowCloudFlareDDoSException( $pResult = '' ) {
549
- throw new Freemius_Exception( array(
550
- 'error' => (object) array(
551
- 'type' => 'CloudFlareDDoSProtection',
552
- 'message' => $pResult,
553
- 'code' => 'cloudflare_ddos_protection',
554
- 'http' => 402
555
- )
556
- ) );
557
- }
558
-
559
- /**
560
- * @param string $pResult
561
- *
562
- * @throws Freemius_Exception
563
- */
564
- private static function ThrowSquidAclException( $pResult = '' ) {
565
- throw new Freemius_Exception( array(
566
- 'error' => (object) array(
567
- 'type' => 'SquidCacheBlock',
568
- 'message' => $pResult,
569
- 'code' => 'squid_cache_block',
570
- 'http' => 402
571
- )
572
- ) );
573
- }
574
-
575
- #endregion Connectivity Exceptions ------------------------------------------------------
576
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/sdk/FreemiusBase.php DELETED
@@ -1,178 +0,0 @@
1
- <?php
2
- /**
3
- * Copyright 2014 Freemius, Inc.
4
- *
5
- * Licensed under the GPL v2 (the "License"); you may
6
- * not use this file except in compliance with the License. You may obtain
7
- * a copy of the License at
8
- *
9
- * http://choosealicense.com/licenses/gpl-v2/
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
- * License for the specific language governing permissions and limitations
15
- * under the License.
16
- */
17
-
18
- define( 'FS_API__VERSION', '1' );
19
- define( 'FS_SDK__PATH', dirname( __FILE__ ) );
20
- define( 'FS_SDK__EXCEPTIONS_PATH', FS_SDK__PATH . '/Exceptions/' );
21
-
22
- if ( ! function_exists( 'json_decode' ) ) {
23
- throw new Exception( 'Freemius needs the JSON PHP extension.' );
24
- }
25
-
26
- // Include all exception files.
27
- $exceptions = array(
28
- 'Exception',
29
- 'InvalidArgumentException',
30
- 'ArgumentNotExistException',
31
- 'EmptyArgumentException',
32
- 'OAuthException'
33
- );
34
-
35
- foreach ( $exceptions as $e ) {
36
- require_once FS_SDK__EXCEPTIONS_PATH . $e . '.php';
37
- }
38
-
39
- abstract class Freemius_Api_Base {
40
- const VERSION = '1.0.4';
41
- const FORMAT = 'json';
42
-
43
- protected $_id;
44
- protected $_public;
45
- protected $_secret;
46
- protected $_scope;
47
- protected $_isSandbox;
48
-
49
- /**
50
- * @param string $pScope 'app', 'developer', 'user' or 'install'.
51
- * @param number $pID Element's id.
52
- * @param string $pPublic Public key.
53
- * @param string $pSecret Element's secret key.
54
- * @param bool $pIsSandbox Whether or not to run API in sandbox mode.
55
- */
56
- public function Init( $pScope, $pID, $pPublic, $pSecret, $pIsSandbox = false ) {
57
- $this->_id = $pID;
58
- $this->_public = $pPublic;
59
- $this->_secret = $pSecret;
60
- $this->_scope = $pScope;
61
- $this->_isSandbox = $pIsSandbox;
62
- }
63
-
64
- public function IsSandbox() {
65
- return $this->_isSandbox;
66
- }
67
-
68
- function CanonizePath( $pPath ) {
69
- $pPath = trim( $pPath, '/' );
70
- $query_pos = strpos( $pPath, '?' );
71
- $query = '';
72
-
73
- if ( false !== $query_pos ) {
74
- $query = substr( $pPath, $query_pos );
75
- $pPath = substr( $pPath, 0, $query_pos );
76
- }
77
-
78
- // Trim '.json' suffix.
79
- $format_length = strlen( '.' . self::FORMAT );
80
- $start = $format_length * ( - 1 ); //negative
81
- if ( substr( strtolower( $pPath ), $start ) === ( '.' . self::FORMAT ) ) {
82
- $pPath = substr( $pPath, 0, strlen( $pPath ) - $format_length );
83
- }
84
-
85
- switch ( $this->_scope ) {
86
- case 'app':
87
- $base = '/apps/' . $this->_id;
88
- break;
89
- case 'developer':
90
- $base = '/developers/' . $this->_id;
91
- break;
92
- case 'user':
93
- $base = '/users/' . $this->_id;
94
- break;
95
- case 'plugin':
96
- $base = '/plugins/' . $this->_id;
97
- break;
98
- case 'install':
99
- $base = '/installs/' . $this->_id;
100
- break;
101
- default:
102
- throw new Freemius_Exception( 'Scope not implemented.' );
103
- }
104
-
105
- return '/v' . FS_API__VERSION . $base .
106
- ( ! empty( $pPath ) ? '/' : '' ) . $pPath .
107
- ( ( false === strpos( $pPath, '.' ) ) ? '.' . self::FORMAT : '' ) . $query;
108
- }
109
-
110
- abstract function MakeRequest( $pCanonizedPath, $pMethod = 'GET', $pParams = array() );
111
-
112
- /**
113
- * @param string $pPath
114
- * @param string $pMethod
115
- * @param array $pParams
116
- *
117
- * @return object[]|object|null
118
- */
119
- private function _Api( $pPath, $pMethod = 'GET', $pParams = array() ) {
120
- $pMethod = strtoupper( $pMethod );
121
-
122
- try {
123
- $result = $this->MakeRequest( $pPath, $pMethod, $pParams );
124
- } catch ( Freemius_Exception $e ) {
125
- // Map to error object.
126
- $result = (object) $e->getResult();
127
- } catch ( Exception $e ) {
128
- // Map to error object.
129
- $result = (object) array(
130
- 'error' => array(
131
- 'type' => 'Unknown',
132
- 'message' => $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')',
133
- 'code' => 'unknown',
134
- 'http' => 402
135
- )
136
- );
137
- }
138
-
139
- return $result;
140
- }
141
-
142
- public function Api( $pPath, $pMethod = 'GET', $pParams = array() ) {
143
- return $this->_Api( $this->CanonizePath( $pPath ), $pMethod, $pParams );
144
- }
145
-
146
- /**
147
- * Base64 encoding that does not need to be urlencode()ed.
148
- * Exactly the same as base64_encode except it uses
149
- * - instead of +
150
- * _ instead of /
151
- * No padded =
152
- *
153
- * @param string $input base64UrlEncoded string
154
- *
155
- * @return string
156
- */
157
- protected static function Base64UrlDecode( $input ) {
158
- return base64_decode( strtr( $input, '-_', '+/' ) );
159
- }
160
-
161
- /**
162
- * Base64 encoding that does not need to be urlencode()ed.
163
- * Exactly the same as base64_encode except it uses
164
- * - instead of +
165
- * _ instead of /
166
- *
167
- * @param string $input string
168
- *
169
- * @return string base64Url encoded string
170
- */
171
- protected static function Base64UrlEncode( $input ) {
172
- $str = strtr( base64_encode( $input ), '+/', '-_' );
173
- $str = str_replace( '=', '', $str );
174
-
175
- return $str;
176
- }
177
-
178
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/includes/sdk/LICENSE.txt DELETED
@@ -1,340 +0,0 @@
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/supplements/fs-essential-functions-1.1.7.1.php DELETED
@@ -1,45 +0,0 @@
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
- return $relative_path;
41
- }
42
- }
43
-
44
- return null;
45
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/require.php DELETED
@@ -1,43 +0,0 @@
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.1.9
7
- */
8
-
9
- // Configuration should be loaded first.
10
- require_once dirname( __FILE__ ) . '/config.php';
11
-
12
- // Logger must be loaded before any other.
13
- require_once WP_FS__DIR_INCLUDES . '/class-fs-logger.php';
14
- require_once WP_FS__DIR_INCLUDES . '/debug/debug-bar-start.php';
15
-
16
- require_once WP_FS__DIR_INCLUDES . '/fs-core-functions.php';
17
- // require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-abstract-manager.php';
18
- require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-option-manager.php';
19
- require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-cache-manager.php';
20
- require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-admin-notice-manager.php';
21
- require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-admin-menu-manager.php';
22
- require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-key-value-storage.php';
23
- require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-license-manager.php';
24
- require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-plan-manager.php';
25
- require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-plugin-manager.php';
26
- require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-entity.php';
27
- require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-scope-entity.php';
28
- require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-user.php';
29
- require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-site.php';
30
- require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-plugin.php';
31
- require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-plugin-info.php';
32
- require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-plugin-tag.php';
33
- require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-plugin-plan.php';
34
- require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-pricing.php';
35
- require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-payment.php';
36
- require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-plugin-license.php';
37
- require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-subscription.php';
38
- require_once WP_FS__DIR_INCLUDES . '/class-fs-api.php';
39
- require_once WP_FS__DIR_INCLUDES . '/class-fs-plugin-updater.php';
40
- require_once WP_FS__DIR_INCLUDES . '/class-fs-security.php';
41
- require_once WP_FS__DIR_INCLUDES . '/class-freemius-abstract.php';
42
- require_once WP_FS__DIR_INCLUDES . '/sdk/Exceptions/Exception.php';
43
- require_once WP_FS__DIR_INCLUDES . '/class-freemius.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/start.php DELETED
@@ -1,310 +0,0 @@
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
- * Freemius SDK Version.
15
- *
16
- * @var string
17
- */
18
- $this_sdk_version = '1.2.0';
19
-
20
- #region SDK Selection Logic --------------------------------------------------------------------
21
-
22
- /**
23
- * Special logic added on 1.1.6 to make sure that every Freemius powered plugin
24
- * will ALWAYS be loaded with the newest SDK from the active Freemius powered plugins.
25
- *
26
- * Since Freemius SDK is backward compatible, this will make sure that all Freemius powered
27
- * plugins will run correctly.
28
- *
29
- * @since 1.1.6
30
- */
31
-
32
- global $fs_active_plugins;
33
-
34
- $this_sdk_relative_path = plugin_basename( dirname( __FILE__ ) );
35
-
36
- if ( ! isset( $fs_active_plugins ) ) {
37
- // Require SDK essentials.
38
- require_once dirname( __FILE__ ) . '/includes/fs-essential-functions.php';
39
-
40
- // Load all Freemius powered active plugins.
41
- $fs_active_plugins = get_option( 'fs_active_plugins', new stdClass() );
42
-
43
- if ( ! isset( $fs_active_plugins->plugins ) ) {
44
- $fs_active_plugins->plugins = array();
45
- }
46
- }
47
-
48
- if ( ! function_exists( 'fs_find_direct_caller_plugin_file' ) ) {
49
- require_once dirname( __FILE__ ) . '/includes/supplements/fs-essential-functions-1.1.7.1.php';
50
- }
51
-
52
- // Update current SDK info based on the SDK path.
53
- if ( ! isset( $fs_active_plugins->plugins[ $this_sdk_relative_path ] ) ||
54
- $this_sdk_version != $fs_active_plugins->plugins[ $this_sdk_relative_path ]->version
55
- ) {
56
- $fs_active_plugins->plugins[ $this_sdk_relative_path ] = (object) array(
57
- 'version' => $this_sdk_version,
58
- 'timestamp' => time(),
59
- 'plugin_path' => plugin_basename( fs_find_direct_caller_plugin_file( __FILE__ ) ),
60
- );
61
- }
62
-
63
- $is_current_sdk_newest = isset( $fs_active_plugins->newest ) && ( $this_sdk_relative_path == $fs_active_plugins->newest->sdk_path );
64
-
65
- if ( ! isset( $fs_active_plugins->newest ) ) {
66
- /**
67
- * This will be executed only once, for the first time a Freemius powered plugin is activated.
68
- */
69
- fs_update_sdk_newest_version( $this_sdk_relative_path, $fs_active_plugins->plugins[ $this_sdk_relative_path ]->plugin_path );
70
-
71
- $is_current_sdk_newest = true;
72
- } else if ( version_compare( $fs_active_plugins->newest->version, $this_sdk_version, '<' ) ) {
73
- /**
74
- * Current SDK is newer than the newest stored SDK.
75
- */
76
- fs_update_sdk_newest_version( $this_sdk_relative_path, $fs_active_plugins->plugins[ $this_sdk_relative_path ]->plugin_path );
77
-
78
- if ( class_exists( 'Freemius' ) ) {
79
- // Older SDK version was already loaded.
80
-
81
- if ( ! $fs_active_plugins->newest->in_activation ) {
82
- // Re-order plugins to load this plugin first.
83
- fs_newest_sdk_plugin_first();
84
- }
85
-
86
- // Refresh page.
87
- if ( fs_redirect( $_SERVER['REQUEST_URI'] ) ) {
88
- exit();
89
- }
90
- }
91
- } else {
92
- if ( ! function_exists( 'get_plugins' ) ) {
93
- require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
94
- }
95
-
96
- $is_newest_sdk_plugin_activate = is_plugin_active( $fs_active_plugins->newest->plugin_path );
97
-
98
- if ( $is_current_sdk_newest &&
99
- ! $is_newest_sdk_plugin_activate &&
100
- ! $fs_active_plugins->newest->in_activation
101
- ) {
102
- // If current SDK is the newest and the plugin is NOT active, it means
103
- // that the current plugin in activation mode.
104
- $fs_active_plugins->newest->in_activation = true;
105
- update_option( 'fs_active_plugins', $fs_active_plugins );
106
- }
107
-
108
- $is_newest_sdk_path_valid = ( $is_newest_sdk_plugin_activate || $fs_active_plugins->newest->in_activation ) && file_exists( fs_normalize_path( WP_PLUGIN_DIR . '/' . $this_sdk_relative_path . '/start.php' ) );
109
-
110
- if ( ! $is_newest_sdk_path_valid && ! $is_current_sdk_newest ) {
111
- // Plugin with newest SDK is no longer active, or SDK was moved to a different location.
112
- unset( $fs_active_plugins->plugins[ $fs_active_plugins->newest->sdk_path ] );
113
- }
114
-
115
- if ( ! ( $is_newest_sdk_plugin_activate || $fs_active_plugins->newest->in_activation ) ||
116
- ! $is_newest_sdk_path_valid ||
117
- // Is newest SDK downgraded.
118
- ( $this_sdk_relative_path == $fs_active_plugins->newest->sdk_path &&
119
- version_compare( $fs_active_plugins->newest->version, $this_sdk_version, '>' ) )
120
- ) {
121
- /**
122
- * Plugin with newest SDK is no longer active.
123
- * OR
124
- * The newest SDK was in the current plugin. BUT, seems like the version of
125
- * the SDK was downgraded to a lower SDK.
126
- */
127
- // Find the active plugin with the newest SDK version and update the newest reference.
128
- fs_fallback_to_newest_active_sdk();
129
- } else {
130
- if ( $is_newest_sdk_plugin_activate &&
131
- $this_sdk_relative_path == $fs_active_plugins->newest->sdk_path &&
132
- ( $fs_active_plugins->newest->in_activation ||
133
- ( class_exists( 'Freemius' ) && ( ! defined( 'WP_FS__SDK_VERSION' ) || version_compare( WP_FS__SDK_VERSION, $this_sdk_version, '<' ) ) )
134
- )
135
-
136
- ) {
137
- if ( $fs_active_plugins->newest->in_activation ) {
138
- // Plugin no more in activation.
139
- $fs_active_plugins->newest->in_activation = false;
140
- update_option( 'fs_active_plugins', $fs_active_plugins );
141
- }
142
-
143
- // Reorder plugins to load plugin with newest SDK first.
144
- if ( fs_newest_sdk_plugin_first() ) {
145
- // Refresh page after re-order to make sure activated plugin loads newest SDK.
146
- if ( class_exists( 'Freemius' ) ) {
147
- if ( fs_redirect( $_SERVER['REQUEST_URI'] ) ) {
148
- exit();
149
- }
150
- }
151
- }
152
- }
153
- }
154
- }
155
-
156
- if ( class_exists( 'Freemius' ) ) {
157
- // SDK was already loaded.
158
- return;
159
- }
160
-
161
- if ( version_compare( $this_sdk_version, $fs_active_plugins->newest->version, '<' ) ) {
162
- $newest_sdk_starter = fs_normalize_path( WP_PLUGIN_DIR . '/' . $fs_active_plugins->newest->sdk_path . '/start.php' );
163
-
164
- if ( file_exists( $newest_sdk_starter ) ) {
165
- // Reorder plugins to load plugin with newest SDK first.
166
- fs_newest_sdk_plugin_first();
167
-
168
- // There's a newer SDK version, load it instead of the current one!
169
- require_once $newest_sdk_starter;
170
-
171
- return;
172
- }
173
- }
174
-
175
- #endregion SDK Selection Logic --------------------------------------------------------------------
176
-
177
- #region Hooks & Filters Collection --------------------------------------------------------------------
178
-
179
- /**
180
- * Freemius hooks (actions & filters) tags structure:
181
- *
182
- * fs_{filter/action_name}_{plugin_slug}
183
- *
184
- * --------------------------------------------------------
185
- *
186
- * Usage with WordPress' add_action() / add_filter():
187
- *
188
- * add_action('fs_{filter/action_name}_{plugin_slug}', $callable);
189
- *
190
- * --------------------------------------------------------
191
- *
192
- * Usage with Freemius' instance add_action() / add_filter():
193
- *
194
- * // No need to add 'fs_' prefix nor '_{plugin_slug}' suffix.
195
- * my_freemius()->add_action('{action_name}', $callable);
196
- *
197
- * --------------------------------------------------------
198
- *
199
- * Freemius filters collection:
200
- *
201
- * fs_connect_url_{plugin_slug}
202
- * fs_trial_promotion_message_{plugin_slug}
203
- * fs_is_long_term_user_{plugin_slug}
204
- * fs_uninstall_reasons_{plugin_slug}
205
- * fs_is_plugin_update_{plugin_slug}
206
- * fs_api_domains_{plugin_slug}
207
- * fs_email_template_sections_{plugin_slug}
208
- * fs_support_forum_submenu_{plugin_slug}
209
- * fs_support_forum_url_{plugin_slug}
210
- * fs_connect_message_{plugin_slug}
211
- * fs_connect_message_on_update_{plugin_slug}
212
- * fs_uninstall_confirmation_message_{plugin_slug}
213
- * fs_pending_activation_message_{plugin_slug}
214
- * fs_is_submenu_visible_{plugin_slug}
215
- * fs_plugin_icon_{plugin_slug}
216
- * fs_show_trial_{plugin_slug}
217
- *
218
- * --------------------------------------------------------
219
- *
220
- * Freemius actions collection:
221
- *
222
- * fs_after_license_loaded_{plugin_slug}
223
- * fs_after_license_change_{plugin_slug}
224
- * fs_after_plans_sync_{plugin_slug}
225
- *
226
- * fs_after_account_details_{plugin_slug}
227
- * fs_after_account_user_sync_{plugin_slug}
228
- * fs_after_account_plan_sync_{plugin_slug}
229
- * fs_before_account_load_{plugin_slug}
230
- * fs_after_account_connection_{plugin_slug}
231
- * fs_account_property_edit_{plugin_slug}
232
- * fs_account_email_verified_{plugin_slug}
233
- * fs_account_page_load_before_departure_{plugin_slug}
234
- * fs_before_account_delete_{plugin_slug}
235
- * fs_after_account_delete_{plugin_slug}
236
- *
237
- * fs_sdk_version_update_{plugin_slug}
238
- * fs_plugin_version_update_{plugin_slug}
239
- *
240
- * fs_initiated_{plugin_slug}
241
- * fs_after_init_plugin_registered_{plugin_slug}
242
- * fs_after_init_plugin_anonymous_{plugin_slug}
243
- * fs_after_init_plugin_pending_activations_{plugin_slug}
244
- * fs_after_init_addon_registered_{plugin_slug}
245
- * fs_after_init_addon_anonymous_{plugin_slug}
246
- * fs_after_init_addon_pending_activations_{plugin_slug}
247
- *
248
- * fs_after_premium_version_activation_{plugin_slug}
249
- * fs_after_free_version_reactivation_{plugin_slug}
250
- *
251
- * fs_after_uninstall_{plugin_slug}
252
- * fs_before_admin_menu_init_{plugin_slug}
253
- */
254
-
255
- #endregion Hooks & Filters Collection --------------------------------------------------------------------
256
-
257
- if ( ! class_exists( 'Freemius' ) ) {
258
-
259
- if ( ! defined( 'WP_FS__SDK_VERSION' ) ) {
260
- define( 'WP_FS__SDK_VERSION', $this_sdk_version );
261
- }
262
-
263
- // Load SDK files.
264
- require_once dirname( __FILE__ ) . '/require.php';
265
-
266
- /**
267
- * Quick shortcut to get Freemius for specified plugin.
268
- * Used by various templates.
269
- *
270
- * @param string $slug
271
- *
272
- * @return Freemius
273
- */
274
- function freemius( $slug ) {
275
- return Freemius::instance( $slug );
276
- }
277
-
278
- /**
279
- * @param string $slug
280
- * @param number $plugin_id
281
- * @param string $public_key
282
- * @param bool $is_live Is live or test plugin.
283
- * @param bool $is_premium Hints freemius if running the premium plugin or not.
284
- *
285
- * @return Freemius
286
- */
287
- function fs_init( $slug, $plugin_id, $public_key, $is_live = true, $is_premium = true ) {
288
- $fs = Freemius::instance( $slug );
289
- $fs->init( $plugin_id, $public_key, $is_live, $is_premium );
290
-
291
- return $fs;
292
- }
293
-
294
- /**
295
- * @param array [string]string $plugin
296
- *
297
- * @return Freemius
298
- * @throws Freemius_Exception
299
- */
300
- function fs_dynamic_init( $plugin ) {
301
- $fs = Freemius::instance( $plugin['slug'] );
302
- $fs->dynamic_init( $plugin );
303
-
304
- return $fs;
305
- }
306
-
307
- function fs_dump_log() {
308
- FS_Logger::dump();
309
- }
310
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/account.php DELETED
@@ -1,688 +0,0 @@
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
- $slug = $VARS['slug'];
14
- /**
15
- * @var Freemius $fs
16
- */
17
- $fs = freemius( $slug );
18
-
19
- /**
20
- * @var FS_Plugin_Tag $update
21
- */
22
- $update = $fs->get_update( false, false );
23
-
24
- $is_paying = $fs->is_paying();
25
- $user = $fs->get_user();
26
- $site = $fs->get_site();
27
- $name = $user->get_name();
28
- $license = $fs->_get_license();
29
- $subscription = $fs->_get_subscription();
30
- $plan = $fs->get_plan();
31
- $is_active_subscription = ( is_object( $subscription ) && $subscription->is_active() );
32
- $is_paid_trial = $fs->is_paid_trial();
33
- $show_upgrade = ( $fs->has_paid_plan() && ! $is_paying && ! $is_paid_trial );
34
-
35
- if ( $show_upgrade ) {
36
- $fs->_require_license_activation_dialog();
37
- }
38
- ?>
39
- <div class="wrap">
40
- <h2 class="nav-tab-wrapper">
41
- <a href="<?php echo $fs->get_account_url() ?>"
42
- class="nav-tab nav-tab-active"><?php _efs( 'account', $slug ) ?></a>
43
- <?php if ( $fs->has_addons() ) : ?>
44
- <a href="<?php echo $fs->_get_admin_page_url( 'addons' ) ?>"
45
- class="nav-tab"><?php _efs( 'add-ons', $slug ) ?></a>
46
- <?php endif ?>
47
- <?php if ( $show_upgrade ) : ?>
48
- <a href="<?php echo $fs->get_upgrade_url() ?>" class="nav-tab"><?php _efs( 'upgrade', $slug ) ?></a>
49
- <?php if ( $fs->apply_filters( 'show_trial', true ) && ! $fs->is_trial_utilized() && $fs->has_trial_plan() ) : ?>
50
- <a href="<?php echo $fs->get_trial_url() ?>" class="nav-tab"><?php _efs( 'free-trial', $slug ) ?></a>
51
- <?php endif ?>
52
- <?php endif ?>
53
- <?php if ( ! $plan->is_free() ) : ?>
54
- <a href="<?php echo $fs->get_account_tab_url( 'billing' ) ?>"
55
- class="nav-tab"><?php _efs( 'billing', $slug ) ?></a>
56
- <?php endif ?>
57
- </h2>
58
-
59
- <div id="poststuff">
60
- <div id="fs_account">
61
- <div class="has-sidebar has-right-sidebar">
62
- <div class="has-sidebar-content">
63
- <div class="postbox">
64
- <h3><?php _efs( 'account-details', $slug ) ?></h3>
65
-
66
- <div class="fs-header-actions">
67
- <ul>
68
- <li>
69
- <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
70
- <input type="hidden" name="fs_action" value="delete_account">
71
- <?php wp_nonce_field( 'delete_account' ) ?>
72
- <a href="#" onclick="if (confirm('<?php
73
- if ( $is_active_subscription ) {
74
- echo esc_attr( sprintf( __fs( 'delete-account-x-confirm', $slug ), $plan->title ) );
75
- } else {
76
- _efs( 'delete-account-confirm', $slug );
77
- }
78
- ?>')) this.parentNode.submit(); return false;"><i
79
- class="dashicons dashicons-no"></i> <?php _efs( 'delete-account', $slug ) ?></a>
80
- </form>
81
- </li>
82
- <?php if ( $is_paying ) : ?>
83
- <li>
84
- &nbsp;•&nbsp;
85
- <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
86
- <input type="hidden" name="fs_action" value="deactivate_license">
87
- <?php wp_nonce_field( 'deactivate_license' ) ?>
88
- <a href="#"
89
- onclick="if (confirm('<?php _efs( 'deactivate-license-confirm', $slug ) ?>')) this.parentNode.submit(); return false;"><i
90
- class="dashicons dashicons-admin-network"></i> <?php _efs( 'deactivate-license', $slug ) ?>
91
- </a>
92
- </form>
93
- </li>
94
- <?php if ( ! $license->is_lifetime() &&
95
- $is_active_subscription
96
- ) : ?>
97
- <li>
98
- &nbsp;•&nbsp;
99
- <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
100
- <input type="hidden" name="fs_action" value="downgrade_account">
101
- <?php wp_nonce_field( 'downgrade_account' ) ?>
102
- <a href="#"
103
- onclick="if (confirm('<?php printf( __fs( 'downgrade-x-confirm', $slug ), $plan->title, human_time_diff( time(), strtotime( $license->expiration ) ) ) ?> <?php if ( ! $license->is_block_features ) {
104
- printf( __fs( 'after-downgrade-non-blocking', $slug ), $plan->title );
105
- } else {
106
- printf( __fs( 'after-downgrade-blocking', $slug ), $plan->title );
107
- }?> <?php _efs( 'proceed-confirmation', $slug ) ?>')) this.parentNode.submit(); return false;"><i
108
- class="dashicons dashicons-download"></i> <?php _efs( 'downgrade', $slug ) ?></a>
109
- </form>
110
- </li>
111
- <?php endif ?>
112
- <li>
113
- &nbsp;•&nbsp;
114
- <a href="<?php echo $fs->get_upgrade_url() ?>"><i
115
- class="dashicons dashicons-grid-view"></i> <?php _efs( 'change-plan', $slug ) ?></a>
116
- </li>
117
- <?php elseif ( $is_paid_trial ) : ?>
118
- <li>
119
- &nbsp;•&nbsp;
120
- <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
121
- <input type="hidden" name="fs_action" value="cancel_trial">
122
- <?php wp_nonce_field( 'cancel_trial' ) ?>
123
- <a href="#"
124
- onclick="if (confirm('<?php _efs( 'cancel-trial-confirm' ) ?>')) this.parentNode.submit(); return false;"><i
125
- class="dashicons dashicons-download"></i> <?php _efs( 'cancel-trial', $slug ) ?></a>
126
- </form>
127
- </li>
128
- <?php endif ?>
129
- <li>
130
- &nbsp;•&nbsp;
131
- <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
132
- <input type="hidden" name="fs_action" value="<?php echo $slug ?>_sync_license">
133
- <?php wp_nonce_field( $slug . '_sync_license' ) ?>
134
- <a href="#" onclick="this.parentNode.submit(); return false;"><i
135
- class="dashicons dashicons-image-rotate"></i> <?php _efs( 'sync', $slug ) ?></a>
136
- </form>
137
- </li>
138
-
139
- </ul>
140
- </div>
141
- <div class="inside">
142
- <table id="fs_account_details" cellspacing="0" class="fs-key-value-table">
143
- <?php
144
- $profile = array();
145
- $profile[] = array(
146
- 'id' => 'user_name',
147
- 'title' => __fs( 'name', $slug ),
148
- 'value' => $name
149
- );
150
- // if (isset($user->email) && false !== strpos($user->email, '@'))
151
- $profile[] = array(
152
- 'id' => 'email',
153
- 'title' => __fs( 'email', $slug ),
154
- 'value' => $user->email
155
- );
156
-
157
- if ( is_numeric( $user->id ) ) {
158
- $profile[] = array(
159
- 'id' => 'user_id',
160
- 'title' => __fs( 'user-id', $slug ),
161
- 'value' => $user->id
162
- );
163
- }
164
-
165
- $profile[] = array(
166
- 'id' => 'site_id',
167
- 'title' => __fs( 'site-id', $slug ),
168
- 'value' => is_string( $site->id ) ?
169
- $site->id :
170
- __fs( 'no-id', $slug )
171
- );
172
-
173
- $profile[] = array(
174
- 'id' => 'site_public_key',
175
- 'title' => __fs( 'public-key', $slug ),
176
- 'value' => $site->public_key
177
- );
178
-
179
- $profile[] = array(
180
- 'id' => 'site_secret_key',
181
- 'title' => __fs( 'secret-key', $slug ),
182
- 'value' => ( ( is_string( $site->secret_key ) ) ?
183
- $site->secret_key :
184
- __fs( 'no-secret', $slug )
185
- )
186
- );
187
-
188
- $profile[] = array(
189
- 'id' => 'version',
190
- 'title' => __fs( 'version', $slug ),
191
- 'value' => $fs->get_plugin_version()
192
- );
193
-
194
- if ( $fs->has_paid_plan() ) {
195
- if ( $fs->is_trial() ) {
196
- $trial_plan = $fs->get_trial_plan();
197
-
198
- $profile[] = array(
199
- 'id' => 'plan',
200
- 'title' => __fs( 'plan', $slug ),
201
- 'value' => ( is_string( $trial_plan->name ) ?
202
- strtoupper( $trial_plan->title ) :
203
- __fs( 'trial', $slug ) )
204
- );
205
- } else {
206
- $profile[] = array(
207
- 'id' => 'plan',
208
- 'title' => __fs( 'plan', $slug ),
209
- 'value' => is_string( $site->plan->name ) ?
210
- strtoupper( $site->plan->title ) :
211
- strtoupper( __fs( 'free', $slug ) )
212
- );
213
-
214
- if ( is_object( $license ) ) {
215
- $profile[] = array(
216
- 'id' => 'license_key',
217
- 'title' => __fs( 'License Key', $slug ),
218
- 'value' => $license->secret_key,
219
- );
220
- }
221
- }
222
- }
223
- ?>
224
- <?php $odd = true;
225
- foreach ( $profile as $p ) : ?>
226
- <?php
227
- if ( 'plan' === $p['id'] && ! $fs->has_paid_plan() ) {
228
- // If plugin don't have any paid plans, there's no reason
229
- // to show current plan.
230
- continue;
231
- }
232
- ?>
233
- <tr class="fs-field-<?php echo $p['id'] ?><?php if ( $odd ) : ?> alternate<?php endif ?>">
234
- <td>
235
- <nobr><?php echo $p['title'] ?>:</nobr>
236
- </td>
237
- <td<?php if ( 'plan' === $p['id'] ) { echo ' colspan="2"'; }?>>
238
- <?php if ( in_array( $p['id'], array( 'license_key', 'site_secret_key' ) ) ) : ?>
239
- <code><?php echo htmlspecialchars( substr( $p['value'], 0, 6 ) ) . str_pad( '', 23 * 6, '&bull;' ) . htmlspecialchars( substr( $p['value'], - 3 ) ) ?></code>
240
- <input type="text" value="<?php echo htmlspecialchars( $p['value'] ) ?>" style="display: none"
241
- readonly/>
242
- <?php else : ?>
243
- <code><?php echo htmlspecialchars( $p['value'] ) ?></code>
244
- <?php endif ?>
245
- <?php if ( 'email' === $p['id'] && ! $user->is_verified() ) : ?>
246
- <label class="fs-tag fs-warn"><?php _efs( 'not-verified', $slug ) ?></label>
247
- <?php endif ?>
248
- <?php if ( 'plan' === $p['id'] ) : ?>
249
- <?php if ( $fs->is_trial() ) : ?>
250
- <label class="fs-tag fs-success"><?php _efs( 'trial', $slug ) ?></label>
251
- <?php endif ?>
252
- <?php if ( is_object( $license ) && ! $license->is_lifetime() ) : ?>
253
- <?php if ( ! $is_active_subscription && ! $license->is_first_payment_pending() ) : ?>
254
- <label
255
- class="fs-tag fs-warn"><?php printf( __fs( 'expires-in', $slug ), human_time_diff( time(), strtotime( $license->expiration ) ) ) ?></label>
256
- <?php elseif ( $is_active_subscription && ! $subscription->is_first_payment_pending() ) : ?>
257
- <label
258
- class="fs-tag fs-success"><?php printf( __fs( 'renews-in', $slug ), human_time_diff( time(), strtotime( $subscription->next_payment ) ) ) ?></label>
259
- <?php endif ?>
260
- <?php elseif ( $fs->is_trial() ) : ?>
261
- <label
262
- class="fs-tag fs-warn"><?php printf( __fs( 'expires-in', $slug ), human_time_diff( time(), strtotime( $site->trial_ends ) ) ) ?></label>
263
- <?php endif ?>
264
- <div class="button-group">
265
- <?php $available_license = $fs->is_free_plan() ? $fs->_get_available_premium_license() : false ?>
266
- <?php if ( false !== $available_license && ( $available_license->left() > 0 || ( $site->is_localhost() && $available_license->is_free_localhost ) ) ) : ?>
267
- <?php $premium_plan = $fs->_get_plan_by_id( $available_license->plan_id ) ?>
268
- <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>"
269
- method="POST">
270
- <input type="hidden" name="fs_action" value="activate_license">
271
- <input type="hidden" name="license_id" value="<?php echo $available_license->id ?>">
272
- <?php wp_nonce_field( 'activate_license' ) ?>
273
- <input type="submit" class="button button-primary"
274
- value="<?php printf(
275
- __fs( 'activate-x-plan', $slug ) . '%s',
276
- $premium_plan->title,
277
- ( $site->is_localhost() && $available_license->is_free_localhost ) ?
278
- ' [' . __fs( 'localhost', $slug ) . ']' :
279
- ( $available_license->is_single_site() ?
280
- '' :
281
- ' [' . ( 1 < $available_license->left() ?
282
- sprintf( __fs( 'x-left', $slug ), $available_license->left() ) :
283
- strtolower( __fs( 'last-license', $slug ) ) ) . ']'
284
- )
285
- ) ?> ">
286
- </form>
287
- <?php else : ?>
288
- <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>"
289
- method="POST" class="button-group">
290
- <?php if ($show_upgrade) : ?>
291
- <a class="button activate-license-trigger <?php echo $slug ?>" href="#!"><?php _efs( 'activate-license', $slug ) ?></a>
292
- <?php endif ?>
293
- <input type="submit" class="button"
294
- value="<?php _efs( 'sync-license', $slug ) ?>">
295
- <input type="hidden" name="fs_action"
296
- value="<?php echo $slug ?>_sync_license">
297
- <?php wp_nonce_field( $slug . '_sync_license' ) ?>
298
- <a href="<?php echo $fs->get_upgrade_url() ?>"
299
- class="button<?php if ( $show_upgrade ) {
300
- echo ' button-primary';
301
- } ?> button-upgrade"><i
302
- class="dashicons dashicons-cart"></i> <?php ( $show_upgrade ) ?
303
- _efs( 'upgrade', $slug ) :
304
- _efs( 'change-plan', $slug )
305
- ?></a>
306
- </form>
307
- <?php endif ?>
308
- </div>
309
- <?php elseif ( 'version' === $p['id'] && $fs->has_paid_plan() ) : ?>
310
- <?php if ( $fs->is_premium() ) : ?>
311
- <label
312
- class="fs-tag fs-<?php echo $fs->can_use_premium_code() ? 'success' : 'warn' ?>"><?php _efs( 'premium-version' ) ?></label>
313
- <?php elseif ( $fs->can_use_premium_code() ) : ?>
314
- <label class="fs-tag fs-warn"><?php _efs( 'free-version' ) ?></label>
315
- <?php endif ?>
316
- <?php endif ?>
317
- </td>
318
- <?php if ( 'plan' !== $p['id'] ) : ?>
319
- <td class="fs-right">
320
- <?php if ( 'email' === $p['id'] && ! $user->is_verified() ) : ?>
321
- <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
322
- <input type="hidden" name="fs_action" value="verify_email">
323
- <?php wp_nonce_field( 'verify_email' ) ?>
324
- <input type="submit" class="button button-small"
325
- value="<?php _efs( 'verify-email', $slug ) ?>">
326
- </form>
327
- <?php endif ?>
328
- <?php if ( 'version' === $p['id'] ) : ?>
329
- <div class="button-group">
330
- <?php if ( $is_paying || $fs->is_trial() ) : ?>
331
- <?php if ( ! $fs->is_allowed_to_install() ) : ?>
332
- <a target="_blank" class="button button-primary"
333
- href="<?php echo $fs->_get_latest_download_local_url() ?>"><?php echo sprintf( __fs( 'download-x-version', $slug ), ( $fs->is_trial() ? $trial_plan->title : $site->plan->title ) ) . ( is_object( $update ) ? ' [' . $update->version . ']' : '' ) ?></a>
334
- <?php elseif ( is_object( $update ) ) : ?>
335
- <a class="button button-primary"
336
- href="<?php echo wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' . $fs->get_plugin_basename() ), 'upgrade-plugin_' . $fs->get_plugin_basename() ) ?>"><?php echo __fs( 'install-update-now', $slug ) . ' [' . $update->version . ']' ?></a>
337
- <?php endif ?>
338
- <?php endif; ?>
339
- </div>
340
- <?php
341
- elseif ( in_array( $p['id'], array( 'license_key', 'site_secret_key' ) ) ) : ?>
342
- <button class="button button-small"><?php _efs( 'show', $slug ) ?></button>
343
- <?php
344
- elseif (/*in_array($p['id'], array('site_secret_key', 'site_id', 'site_public_key')) ||*/
345
- ( is_string( $user->secret_key ) && in_array( $p['id'], array(
346
- 'email',
347
- 'user_name'
348
- ) ) )
349
- ) : ?>
350
- <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST"
351
- onsubmit="var val = prompt('<?php printf( __fs( 'what-is-your-x', $slug ), $p['title'] ) ?>', '<?php echo $p['value'] ?>'); if (null == val || '' === val) return false; jQuery('input[name=fs_<?php echo $p['id'] ?>_<?php echo $slug ?>]').val(val); return true;">
352
- <input type="hidden" name="fs_action" value="update_<?php echo $p['id'] ?>">
353
- <input type="hidden" name="fs_<?php echo $p['id'] ?>_<?php echo $slug ?>"
354
- value="">
355
- <?php wp_nonce_field( 'update_' . $p['id'] ) ?>
356
- <input type="submit" class="button button-small"
357
- value="<?php _efs( 'edit', $slug ) ?>">
358
- </form>
359
- <?php endif ?>
360
- </td>
361
- <?php endif ?>
362
- </tr>
363
- <?php $odd = ! $odd;
364
- endforeach ?>
365
- </table>
366
- </div>
367
- </div>
368
- <script type="text/javascript">
369
- (function ($) {
370
- $('.fs-field-license_key button, .fs-field-site_secret_key button').click(function () {
371
- var
372
- $this = $(this),
373
- $parent = $this.closest('tr'),
374
- $input = $parent.find('input');
375
-
376
- $parent.find('code').toggle();
377
- $input.toggle();
378
-
379
- if ($input.is(':visible')) {
380
- $this.html('<?php _efs( 'hide', $slug ) ?>');
381
- setTimeout(function () {
382
- $input.select().focus();
383
- }, 100);
384
- }
385
- else {
386
- $this.html('<?php _efs( 'show', $slug ) ?>');
387
- }
388
- });
389
- }(jQuery));
390
-
391
- </script>
392
-
393
- <?php
394
- $account_addons = $fs->get_account_addons();
395
- if ( ! is_array( $account_addons ) ) {
396
- $account_addons = array();
397
- }
398
-
399
- $installed_addons = $fs->get_installed_addons();
400
- $installed_addons_ids = array();
401
- foreach ( $installed_addons as $fs_addon ) {
402
- $installed_addons_ids[] = $fs_addon->get_id();
403
- }
404
-
405
- $addons_to_show = array_unique( array_merge( $installed_addons_ids, $account_addons ) );
406
- ?>
407
- <?php if ( 0 < count( $addons_to_show ) ) : ?>
408
- <!-- Add-Ons -->
409
- <div class="postbox">
410
- <div class="">
411
- <!-- <div class="inside">-->
412
- <table id="fs_addons" class="widefat">
413
- <thead>
414
- <tr>
415
- <th><h3><?php _efs( 'add-ons', $slug ) ?></h3></th>
416
- <th><?php _efs( 'id', $slug ) ?></th>
417
- <th><?php _efs( 'version', $slug ) ?></th>
418
- <th><?php _efs( 'plan', $slug ) ?></th>
419
- <th><?php _efs( 'license', $slug ) ?></th>
420
- <th></th>
421
- <?php if ( defined( 'WP_FS__DEV_MODE' ) && WP_FS__DEV_MODE ) : ?>
422
- <th></th>
423
- <?php endif ?>
424
- </tr>
425
- </thead>
426
- <tbody>
427
- <?php $odd = true;
428
- foreach ( $addons_to_show as $addon_id ) : ?>
429
- <?php
430
- $addon = $fs->get_addon( $addon_id );
431
- $is_addon_activated = $fs->is_addon_activated( $addon->slug );
432
- $is_addon_connected = $fs->is_addon_connected( $addon->slug );
433
-
434
- $fs_addon = $is_addon_connected ? freemius( $addon->slug ) : false;
435
- if ( is_object( $fs_addon ) ) {
436
- $is_paying = $fs_addon->is_paying();
437
- $user = $fs_addon->get_user();
438
- $site = $fs_addon->get_site();
439
- $license = $fs_addon->_get_license();
440
- $subscription = $fs_addon->_get_subscription();
441
- $plan = $fs_addon->get_plan();
442
- $is_active_subscription = ( is_object( $subscription ) && $subscription->is_active() );
443
- $is_paid_trial = $fs_addon->is_paid_trial();
444
- $show_upgrade = ( ! $is_paying && ! $is_paid_trial && ! $fs_addon->_has_premium_license() );
445
- $is_current_license_expired = is_object( $license ) && $license->is_expired();
446
- }
447
-
448
- // var_dump( $is_paid_trial, $license, $site, $subscription );
449
-
450
- ?>
451
- <tr<?php if ( $odd ) {
452
- echo ' class="alternate"';
453
- } ?>>
454
- <td>
455
- <!-- Title -->
456
- <?php echo $addon->title ?>
457
- </td>
458
- <?php if ( $is_addon_connected ) : ?>
459
- <?php // Add-on Installed ?>
460
- <?php $addon_site = $fs_addon->get_site(); ?>
461
- <td>
462
- <!-- ID -->
463
- <?php echo $addon_site->id ?>
464
- </td>
465
- <td>
466
- <!-- Version -->
467
- <?php echo $fs_addon->get_plugin_version() ?>
468
- </td>
469
- <td>
470
- <!-- Plan Title -->
471
- <?php echo is_string( $addon_site->plan->name ) ? strtoupper( $addon_site->plan->title ) : 'FREE' ?>
472
- </td>
473
- <td>
474
- <!-- Expiration -->
475
- <?php
476
- $tags = array();
477
-
478
- if ( $fs_addon->is_trial() ) {
479
- $tags[] = array( 'label' => __fs( 'trial', $slug ), 'type' => 'success' );
480
-
481
- $tags[] = array(
482
- 'label' => sprintf( __fs( ( $is_paid_trial ? 'renews-in' : 'expires-in' ), $slug ), human_time_diff( time(), strtotime( $site->trial_ends ) ) ),
483
- 'type' => ( $is_paid_trial ? 'success' : 'warn' )
484
- );
485
- } else {
486
- if ( is_object( $license ) ) {
487
- if ( $license->is_cancelled ) {
488
- $tags[] = array(
489
- 'label' => __fs( 'cancelled', $slug ),
490
- 'type' => 'error'
491
- );
492
- } else if ( $license->is_expired() ) {
493
- $tags[] = array(
494
- 'label' => __fs( 'expired', $slug ),
495
- 'type' => 'error'
496
- );
497
- } else if ( $license->is_lifetime() ) {
498
- $tags[] = array(
499
- 'label' => __fs( 'no-expiration', $slug ),
500
- 'type' => 'success'
501
- );
502
- } else if ( ! $is_active_subscription && ! $license->is_first_payment_pending() ) {
503
- $tags[] = array(
504
- 'label' => sprintf( __fs( 'expires-in', $slug ), human_time_diff( time(), strtotime( $license->expiration ) ) ),
505
- 'type' => 'warn'
506
- );
507
- } else if ( $is_active_subscription && ! $subscription->is_first_payment_pending() ) {
508
- $tags[] = array(
509
- 'label' => sprintf( __fs( 'renews-in', $slug ), human_time_diff( time(), strtotime( $subscription->next_payment ) ) ),
510
- 'type' => 'success'
511
- );
512
- }
513
- }
514
- }
515
-
516
- foreach ( $tags as $t ) {
517
- printf( '<label class="fs-tag fs-%s">%s</label>' . "\n", $t['type'], $t['label'] );
518
- }
519
- ?>
520
- </td>
521
- <?php
522
- $buttons = array();
523
- if ( $is_addon_activated ) {
524
- if ( $is_paying ) {
525
- $buttons[] = fs_ui_get_action_button(
526
- $slug,
527
- 'account',
528
- 'deactivate_license',
529
- __fs( 'deactivate-license', $slug ),
530
- array( 'plugin_id' => $addon_id ),
531
- false
532
- );
533
- } else if ( $is_paid_trial ) {
534
- $buttons[] = fs_ui_get_action_button(
535
- $slug,
536
- 'account',
537
- 'cancel_trial',
538
- __fs( 'cancel-trial', $slug ),
539
- array( 'plugin_id' => $addon_id ),
540
- false,
541
- 'dashicons dashicons-download',
542
- __fs( 'cancel-trial-confirm', $slug ),
543
- 'POST'
544
- );
545
- } else {
546
- $premium_license = $fs_addon->_get_available_premium_license();
547
-
548
- if ( is_object( $premium_license ) ) {
549
- $site = $fs_addon->get_site();
550
-
551
- $buttons[] = fs_ui_get_action_button(
552
- $slug,
553
- 'account',
554
- 'activate_license',
555
- sprintf( __fs( 'activate-x-plan', $slug ), $fs_addon->get_plan_title(), ( $site->is_localhost() && $premium_license->is_free_localhost ) ? '[localhost]' : ( 1 < $premium_license->left() ? $premium_license->left() . ' left' : '' ) ),
556
- array(
557
- 'plugin_id' => $addon_id,
558
- 'license_id' => $premium_license->id,
559
- )
560
- );
561
- }
562
- }
563
-
564
- if ( 0 == count( $buttons ) ) {
565
- // Add sync license only if non of the other CTAs are visible.
566
- $buttons[] = fs_ui_get_action_button(
567
- $slug,
568
- 'account',
569
- $slug . '_sync_license',
570
- __fs( 'sync-license', $slug ),
571
- array( 'plugin_id' => $addon_id ),
572
- false
573
- );
574
-
575
- }
576
- } else if ( ! $show_upgrade ) {
577
- if ( $fs->is_addon_installed( $addon->slug ) ) {
578
- $addon_file = $fs->get_addon_basename( $addon->slug );
579
- $buttons[] = sprintf(
580
- '<a class="button button-primary" href="%s" title="%s" class="edit">%s</a>',
581
- wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $addon_file, 'activate-plugin_' . $addon_file ),
582
- esc_attr( __fs( 'activate-this-addon', $slug ) ),
583
- __fs( 'activate', $slug )
584
- );
585
- } else {
586
- if ( $fs->is_allowed_to_install() ) {
587
- $buttons[] = sprintf(
588
- '<a class="button button-primary" href="%s" class="edit">%s</a>',
589
- wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $addon->slug ), 'install-plugin_' . $addon->slug ),
590
- __fs( 'install-now', $slug )
591
- );
592
- } else {
593
- $buttons[] = sprintf(
594
- '<a target="_blank" class="button button-primary" href="%s" class="edit">%s</a>',
595
- $fs->_get_latest_download_local_url( $addon_id ),
596
- __fs( 'download-latest', $slug )
597
- );
598
- }
599
- }
600
- }
601
-
602
- if ( $show_upgrade ) {
603
- $buttons[] = sprintf( '<a href="%s" class="thickbox button button-primary" aria-label="%s" data-title="%s"><i class="dashicons dashicons-cart"></i> %s</a>',
604
- esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&parent_plugin_id=' . $fs->get_id() . '&plugin=' . $addon->slug .
605
- '&TB_iframe=true&width=600&height=550' ) ),
606
- esc_attr( sprintf( __fs( 'more-information-about-x', $slug ), $addon->title ) ),
607
- esc_attr( $addon->title ),
608
- __fs( ( $fs_addon->has_free_plan() ? 'upgrade' : 'purchase' ), $slug )
609
- );
610
- }
611
-
612
- $buttons_count = count( $buttons );
613
- ?>
614
-
615
- <td>
616
- <!-- Actions -->
617
- <?php if ($buttons_count > 1) : ?>
618
- <div class="button-group">
619
- <?php endif ?>
620
- <?php foreach ( $buttons as $button ) : ?>
621
- <?php echo $button ?>
622
- <?php endforeach ?>
623
- <?php if ($buttons_count > 1) : ?>
624
- </div>
625
- <?php endif ?>
626
- </td>
627
- <?php else : ?>
628
- <?php // Add-on NOT Installed or was never connected.
629
- ?>
630
- <td colspan="4">
631
- <!-- Action -->
632
- <?php if ( $fs->is_addon_installed( $addon->slug ) ) : ?>
633
- <?php $addon_file = $fs->get_addon_basename( $addon->slug ) ?>
634
- <a class="button button-primary"
635
- href="<?php echo wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $addon_file, 'activate-plugin_' . $addon_file ) ?>"
636
- title="<?php esc_attr( __fs( 'activate-this-addon', $slug ) ) ?>"
637
- class="edit"><?php _efs( 'activate', $slug ) ?></a>
638
- <?php else : ?>
639
- <?php if ( $fs->is_allowed_to_install() ) : ?>
640
- <a class="button button-primary"
641
- href="<?php echo wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $addon->slug ), 'install-plugin_' . $addon->slug ) ?>"><?php _efs( 'install-now', $slug ) ?></a>
642
- <?php else : ?>
643
- <a target="_blank" class="button button-primary"
644
- href="<?php echo $fs->_get_latest_download_local_url( $addon_id ) ?>"><?php _efs( 'download-latest', $slug ) ?></a>
645
- <?php endif ?>
646
- <?php endif ?>
647
- </td>
648
- <?php endif ?>
649
- <?php if ( defined( 'WP_FS__DEV_MODE' ) && WP_FS__DEV_MODE ) : ?>
650
- <td>
651
- <!-- Optional Delete Action -->
652
- <?php
653
- if ( $is_addon_activated ) {
654
- fs_ui_action_button(
655
- $slug, 'account',
656
- 'delete_account',
657
- __fs( 'delete', $slug ),
658
- array( 'plugin_id' => $addon_id ),
659
- false
660
- );
661
- }
662
- ?>
663
- </td>
664
- <?php endif ?>
665
- </tr>
666
- <?php $odd = ! $odd;
667
- endforeach ?>
668
- </tbody>
669
- </table>
670
- </div>
671
- </div>
672
- <?php endif ?>
673
-
674
- <?php $fs->do_action( 'after_account_details' ) ?>
675
- </div>
676
- </div>
677
- </div>
678
- </div>
679
- </div>
680
- <?php
681
- $params = array(
682
- 'page' => 'account',
683
- 'module_id' => $fs->get_id(),
684
- 'module_slug' => $slug,
685
- 'module_version' => $fs->get_plugin_version(),
686
- );
687
- fs_require_template( 'powered-by.php', $params );
688
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/add-ons.php DELETED
@@ -1,152 +0,0 @@
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
- $slug = $VARS['slug'];
14
- /**
15
- * @var Freemius
16
- */
17
- $fs = freemius( $slug );
18
-
19
- $open_addon_slug = fs_request_get( 'slug' );
20
-
21
- $open_addon = false;
22
-
23
- /**
24
- * @var FS_Plugin[]
25
- */
26
- $addons = $fs->get_addons();
27
-
28
- $has_addons = ( is_array( $addons ) && 0 < count( $addons ) );
29
- ?>
30
- <div id="fs_addons" class="wrap">
31
- <h2><?php printf( __fs( 'add-ons-for-x', $slug ), $fs->get_plugin_name() ) ?></h2>
32
-
33
- <div id="poststuff">
34
- <?php if ( ! $has_addons ) : ?>
35
- <h3><?php printf(
36
- '%s... %s',
37
- __fs( 'oops', $slug ),
38
- __fs( 'add-ons-missing', $slug )
39
- ) ?></h3>
40
- <?php endif ?>
41
- <ul class="fs-cards-list">
42
- <?php if ( $has_addons ) : ?>
43
- <?php foreach ( $addons as $addon ) : ?>
44
- <?php
45
- $open_addon = ( $open_addon || ( $open_addon_slug === $addon->slug ) );
46
-
47
- $price = 0;
48
- $plan = null;
49
- $plans_result = $fs->get_api_site_or_plugin_scope()->get( "/addons/{$addon->id}/plans.json" );
50
- if ( ! isset( $plans_result->error ) ) {
51
- $plans = $plans_result->plans;
52
- if ( is_array( $plans ) && 0 < count( $plans ) ) {
53
- $plan = new FS_Plugin_Plan( $plans[0] );
54
- $pricing_result = $fs->get_api_site_or_plugin_scope()->get( "/addons/{$addon->id}/plans/{$plan->id}/pricing.json" );
55
- if ( ! isset( $pricing_result->error ) ) {
56
- // Update plan's pricing.
57
- $plan->pricing = $pricing_result->pricing;
58
-
59
- if ( is_array( $plan->pricing ) && 0 < count( $plan->pricing ) ) {
60
- $min_price = 999999;
61
- foreach ( $plan->pricing as $pricing ) {
62
- if ( ! is_null( $pricing->annual_price ) && $pricing->annual_price > 0 ) {
63
- $min_price = min( $min_price, $pricing->annual_price );
64
- } else if ( ! is_null( $pricing->monthly_price ) && $pricing->monthly_price > 0 ) {
65
- $min_price = min( $min_price, 12 * $pricing->monthly_price );
66
- }
67
- }
68
-
69
- if ( $min_price < 999999 ) {
70
- $price = $min_price;
71
- }
72
- }
73
- }
74
- }
75
- }
76
- ?>
77
- <li class="fs-card fs-addon" data-slug="<?php echo $addon->slug ?>">
78
- <?php
79
- echo sprintf( '<a href="%s" class="thickbox fs-overlay" aria-label="%s" data-title="%s"></a>',
80
- esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&parent_plugin_id=' . $fs->get_id() . '&plugin=' . $addon->slug .
81
- '&TB_iframe=true&width=600&height=550' ) ),
82
- esc_attr( sprintf( __fs( 'more-information-about-x', $slug ), $addon->title ) ),
83
- esc_attr( $addon->title )
84
- );
85
- ?>
86
- <?php
87
- if ( is_null( $addon->info ) ) {
88
- $addon->info = new stdClass();
89
- }
90
- if ( ! isset( $addon->info->card_banner_url ) ) {
91
- $addon->info->card_banner_url = '//dashboard.freemius.com/assets/img/marketing/blueprint-300x100.jpg';
92
- }
93
- if ( ! isset( $addon->info->short_description ) ) {
94
- $addon->info->short_description = 'What\'s the one thing your add-on does really, really well?';
95
- }
96
- ?>
97
- <div class="fs-inner">
98
- <ul>
99
- <li class="fs-card-banner"
100
- style="background-image: url('<?php echo $addon->info->card_banner_url ?>');"></li>
101
- <!-- <li class="fs-tag"></li>-->
102
- <li class="fs-title"><?php echo $addon->title ?></li>
103
- <li class="fs-offer">
104
- <span
105
- class="fs-price"><?php echo ( 0 == $price ) ? __fs( 'free', $slug ) : ('$' . number_format( $price, 2 ) . ($plan->has_trial() ? ' - ' . __fs('trial', $slug) : '')) ?></span>
106
- </li>
107
- <li class="fs-description"><?php echo ! empty( $addon->info->short_description ) ? $addon->info->short_description : 'SHORT DESCRIPTION' ?></li>
108
- <li class="fs-cta"><a class="button"><?php _efs( 'view-details', $slug ) ?></a></li>
109
- </ul>
110
- </div>
111
- </li>
112
- <?php endforeach ?>
113
- <?php endif ?>
114
- </ul>
115
- </div>
116
- </div>
117
- <script type="text/javascript">
118
- (function ($) {
119
- <?php if ( $open_addon ) : ?>
120
-
121
- var interval = setInterval(function () {
122
- // Open add-on information page.
123
- $('.fs-card[data-slug=<?php echo $open_addon_slug ?>] a').click();
124
- if ($('#TB_iframeContent').length > 0) {
125
- clearInterval(interval);
126
- interval = null;
127
- }
128
- }, 200);
129
-
130
- <?php else : ?>
131
-
132
-
133
- $('.fs-card.fs-addon').mouseover(function(){
134
- $(this).find('.fs-cta .button').addClass('button-primary');
135
- });
136
-
137
- $('.fs-card.fs-addon').mouseout(function(){
138
- $(this).find('.fs-cta .button').removeClass('button-primary');
139
- });
140
-
141
- <?php endif ?>
142
- })(jQuery);
143
- </script>
144
- <?php
145
- $params = array(
146
- 'page' => 'addons',
147
- 'module_id' => $fs->get_id(),
148
- 'module_slug' => $slug,
149
- 'module_version' => $fs->get_plugin_version(),
150
- );
151
- fs_require_template( 'powered-by.php', $params );
152
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/admin-notice.php DELETED
@@ -1,46 +0,0 @@
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
- <div<?php if ( ! empty( $VARS['id'] ) ) : ?> data-id="<?php echo $VARS['id'] ?>"<?php endif ?><?php if ( ! empty( $VARS['slug'] ) ) : ?> data-slug="<?php echo $VARS['slug'] ?>"<?php endif ?>
14
- class="<?php
15
- switch ( $VARS['type'] ) {
16
- case 'error':
17
- echo 'error form-invalid';
18
- break;
19
- case 'promotion':
20
- echo 'updated promotion';
21
- break;
22
- case 'update':
23
- // echo 'update-nag update';
24
- // break;
25
- case 'success':
26
- default:
27
- echo 'updated success';
28
- break;
29
- }
30
- ?> fs-notice<?php if ( ! empty( $VARS['sticky'] ) ) {
31
- echo ' fs-sticky';
32
- } ?><?php if ( ! empty( $VARS['plugin'] ) ) {
33
- echo ' fs-has-title';
34
- } ?>"><?php if ( ! empty( $VARS['plugin'] ) ) : ?>
35
- <label class="fs-plugin-title"><?php echo $VARS['plugin'] ?></label>
36
- <?php endif ?>
37
- <?php if ( ! empty( $VARS['sticky'] ) ) : ?>
38
- <div class="fs-close"><i class="dashicons dashicons-no"
39
- title="<?php _efs( 'dismiss' ) ?>"></i> <span><?php _efs( 'dismiss' ) ?></span>
40
- </div>
41
- <?php endif ?>
42
- <div class="fs-notice-body">
43
- <?php if ( ! empty( $VARS['title'] ) ) : ?><b><?php echo $VARS['title'] ?></b> <?php endif ?>
44
- <?php echo $VARS['message'] ?>
45
- </div>
46
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/all-admin-notice.php DELETED
@@ -1,35 +0,0 @@
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
- <div class="<?php
14
- switch ($VARS['type']) {
15
- case 'error':
16
- echo 'error form-invalid';
17
- break;
18
- case 'update-nag':
19
- echo 'update-nag ';
20
- break;
21
- case 'update':
22
- case 'success':
23
- default:
24
- echo 'updated success';
25
- break;
26
- }
27
- ?> fs-notice">
28
- <?php if ('update-nag' !== $VARS['type']) : ?><p><?php endif ?>
29
- <?php if (!empty($VARS['title'])) : ?>
30
- <b><?php echo $VARS['title'] ?></b>
31
- <?php endif ?>
32
- <?php echo $VARS['message'] ?>
33
- <?php if ('update-nag' !== $VARS['type']) : ?></p><?php endif ?>
34
- <?php if ($VARS['sticky']) : ?><i class="dashicons dashicons-no"></i><?php endif ?>
35
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/billing.php DELETED
@@ -1,106 +0,0 @@
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.2.0
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- $slug = $VARS['slug'];
14
- /**
15
- * @var Freemius $fs
16
- */
17
- $fs = freemius( $slug );
18
-
19
- /**
20
- * @var FS_Plugin_Tag $update
21
- */
22
- $update = $fs->get_update( false, false );
23
-
24
- $is_paying = $fs->is_paying();
25
- $user = $fs->get_user();
26
- $site = $fs->get_site();
27
- $name = $user->get_name();
28
- $license = $fs->_get_license();
29
- $subscription = $fs->_get_subscription();
30
- $plan = $fs->get_plan();
31
- $is_active_subscription = ( is_object( $subscription ) && $subscription->is_active() );
32
- $is_paid_trial = $fs->is_paid_trial();
33
- $show_upgrade = ( ! $is_paying && ! $is_paid_trial );
34
- ?>
35
-
36
- <div id="fs_account" class="wrap">
37
- <h2 class="nav-tab-wrapper">
38
- <a href="<?php echo $fs->get_account_url() ?>" class="nav-tab"><?php _efs( 'account', $slug ) ?></a>
39
- <?php if ( $fs->has_addons() ) : ?>
40
- <a href="<?php echo $fs->_get_admin_page_url( 'addons' ) ?>"
41
- class="nav-tab"><?php _efs( 'add-ons', $slug ) ?></a>
42
- <?php endif ?>
43
- <?php if ( $fs->is_not_paying() && $fs->has_paid_plan() ) : ?>
44
- <a href="<?php echo $fs->get_upgrade_url() ?>" class="nav-tab"><?php _efs( 'upgrade', $slug ) ?></a>
45
- <?php if ( $fs->apply_filters( 'show_trial', true ) && ! $fs->is_trial_utilized() && $fs->has_trial_plan() ) : ?>
46
- <a href="<?php echo $fs->get_trial_url() ?>"
47
- class="nav-tab"><?php _efs( 'free-trial', $slug ) ?></a>
48
- <?php endif ?>
49
- <?php endif ?>
50
- <?php if ( ! $plan->is_free() ) : ?>
51
- <a href="<?php echo $fs->get_account_tab_url( 'billing' ) ?>"
52
- class="nav-tab nav-tab-active"><?php _efs( 'billing', $slug ) ?></a>
53
- <?php endif ?>
54
- </h2>
55
-
56
- <div id="poststuff">
57
- <div>
58
- <div class="has-sidebar has-right-sidebar">
59
- <div class="has-sidebar-content">
60
- <div class="postbox">
61
- <h3><?php _efs( 'payments', $slug ) ?></h3>
62
-
63
- <?php
64
- $payments = $fs->_fetch_payments();
65
- ?>
66
-
67
- <div class="inside">
68
- <table class="widefat">
69
- <thead>
70
- <tr>
71
- <th><?php _efs( 'id', $slug ) ?></th>
72
- <th><?php _efs( 'date', $slug ) ?></th>
73
- <!-- <th>--><?php //_efs( 'transaction' ) ?><!--</th>-->
74
- <th><?php _efs( 'amount', $slug ) ?></th>
75
- <th><?php _efs( 'invoice', $slug ) ?></th>
76
- </tr>
77
- </thead>
78
- <tbody>
79
- <?php $odd = true ?>
80
- <?php foreach ( $payments as $payment ) : ?>
81
- <tr<?php echo $odd ? ' class="alternate"' : '' ?>>
82
- <td><?php echo $payment->id ?></td>
83
- <td><?php echo date( 'M j, Y', strtotime( $payment->created ) ) ?></td>
84
- <td>$<?php echo $payment->gross ?></td>
85
- <td><a href="<?php echo $fs->_get_invoice_api_url($payment->id) ?>" class="button button-small"
86
- target="_blank"><?php _efs( 'invoice', $slug ) ?></a></td>
87
- </tr>
88
- <?php $odd = ! $odd; endforeach ?>
89
- </tbody>
90
- </table>
91
- </div>
92
- </div>
93
- </div>
94
- </div>
95
- </div>
96
- </div>
97
- </div>
98
- <?php
99
- $params = array(
100
- 'page' => 'account',
101
- 'module_id' => $fs->get_id(),
102
- 'module_slug' => $slug,
103
- 'module_version' => $fs->get_plugin_version(),
104
- );
105
- fs_require_template( 'powered-by.php', $params );
106
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/checkout.php DELETED
@@ -1,262 +0,0 @@
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
- $slug = $VARS['slug'];
20
- $fs = freemius( $slug );
21
-
22
- $timestamp = time();
23
-
24
- $context_params = array(
25
- 'plugin_id' => $fs->get_id(),
26
- 'plugin_public_key' => $fs->get_public_key(),
27
- 'plugin_version' => $fs->get_plugin_version(),
28
- );
29
-
30
- // Get site context secure params.
31
- if ( $fs->is_registered() ) {
32
- $site = $fs->get_site();
33
- $plugin_id = fs_request_get( 'plugin_id', $fs->get_id() );
34
-
35
- if ($plugin_id != $fs->get_id()) {
36
- if ( $fs->is_addon_activated( $plugin_id ) ) {
37
- $fs_addon = Freemius::get_instance_by_id( $plugin_id );
38
- $site = $fs_addon->get_site();
39
- }
40
- }
41
-
42
- $context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
43
- $site,
44
- $timestamp,
45
- 'checkout'
46
- ) );
47
- } else {
48
- $current_user = Freemius::_get_current_wp_user();
49
-
50
- // Add site and user info to the request, this information
51
- // is NOT being stored unless the user complete the purchase
52
- // and agrees to the TOS.
53
- $context_params = array_merge( $context_params, array(
54
- 'user_firstname' => $current_user->user_firstname,
55
- 'user_lastname' => $current_user->user_lastname,
56
- 'user_email' => $current_user->user_email,
57
- // 'user_nickname' => $current_user->user_nicename,
58
- // 'plugin_slug' => $slug,
59
- // 'site_url' => get_site_url(),
60
- // 'site_name' => get_bloginfo( 'name' ),
61
- // 'platform_version' => get_bloginfo( 'version' ),
62
- // 'language' => get_bloginfo( 'language' ),
63
- // 'charset' => get_bloginfo( 'charset' ),
64
- // 'account_url' => fs_nonce_url( $fs->_get_admin_page_url(
65
- // 'account',
66
- // array( 'fs_action' => 'sync_user' )
67
- // ), 'sync_user' ),
68
- ) );
69
-
70
- $fs_user = Freemius::_get_user_by_email( $current_user->user_email );
71
-
72
- if ( is_object( $fs_user ) ) {
73
- $context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
74
- $fs_user,
75
- $timestamp,
76
- 'checkout'
77
- ) );
78
- }
79
- }
80
-
81
- if ( $fs->is_payments_sandbox() )
82
- {
83
- // Append plugin secure token for sandbox mode authentication.
84
- $context_params['sandbox'] = FS_Security::instance()->get_secure_token(
85
- $fs->get_plugin(),
86
- $timestamp,
87
- 'checkout'
88
- );
89
-
90
- /**
91
- * @since 1.1.7.3 Add security timestamp for sandbox even for anonymous user.
92
- */
93
- if ( empty( $context_params['s_ctx_ts'] ) ) {
94
- $context_params['s_ctx_ts'] = $timestamp;
95
- }
96
- }
97
-
98
- $return_url = $fs->_get_sync_license_url( isset( $_GET['plugin_id'] ) ? $_GET['plugin_id'] : $fs->get_id() );
99
-
100
- $query_params = array_merge( $context_params, $_GET, array(
101
- // Current plugin version.
102
- 'plugin_version' => $fs->get_plugin_version(),
103
- 'return_url' => $return_url,
104
- // Admin CSS URL for style/design competability.
105
- // 'wp_admin_css' => get_bloginfo('wpurl') . "/wp-admin/load-styles.php?c=1&load=buttons,wp-admin,dashicons",
106
- ) );
107
- ?>
108
- <div class="fs-secure-notice">
109
- <i class="dashicons dashicons-lock"></i>
110
- <span><b>Secure HTTPS Checkout</b> - PCI compliant, running via iframe from external domain</span>
111
- </div>
112
- <div id="fs_contact" class="wrap" style="margin: 40px 0 -65px -20px;">
113
- <div id="iframe"></div>
114
- <script type="text/javascript">
115
- // http://stackoverflow.com/questions/4583703/jquery-post-request-not-ajax
116
- jQuery(function ($) {
117
- $.extend({
118
- form: function (url, data, method) {
119
- if (method == null) method = 'POST';
120
- if (data == null) data = {};
121
-
122
- var form = $('<form>').attr({
123
- method: method,
124
- action: url
125
- }).css({
126
- display: 'none'
127
- });
128
-
129
- var addData = function (name, data) {
130
- if ($.isArray(data)) {
131
- for (var i = 0; i < data.length; i++) {
132
- var value = data[i];
133
- addData(name + '[]', value);
134
- }
135
- } else if (typeof data === 'object') {
136
- for (var key in data) {
137
- if (data.hasOwnProperty(key)) {
138
- addData(name + '[' + key + ']', data[key]);
139
- }
140
- }
141
- } else if (data != null) {
142
- form.append($('<input>').attr({
143
- type : 'hidden',
144
- name : String(name),
145
- value: String(data)
146
- }));
147
- }
148
- };
149
-
150
- for (var key in data) {
151
- if (data.hasOwnProperty(key)) {
152
- addData(key, data[key]);
153
- }
154
- }
155
-
156
- return form.appendTo('body');
157
- }
158
- });
159
- });
160
-
161
- (function ($) {
162
- $(function () {
163
-
164
- var
165
- // Keep track of the iframe height.
166
- iframe_height = 800,
167
- base_url = '<?php echo WP_FS__ADDRESS ?>',
168
- // Pass the parent page URL into the Iframe in a meaningful way (this URL could be
169
- // passed via query string or hard coded into the child page, it depends on your needs).
170
- src = base_url + '/checkout/?<?php echo (isset($_REQUEST['XDEBUG_SESSION']) ? 'XDEBUG_SESSION=' . $_REQUEST['XDEBUG_SESSION'] . '&' : '') . http_build_query($query_params) ?>#' + encodeURIComponent(document.location.href),
171
-
172
- // Append the Iframe into the DOM.
173
- iframe = $('<iframe " src="' + src + '" width="100%" height="' + iframe_height + 'px" scrolling="no" frameborder="0" style="background: transparent;"><\/iframe>')
174
- .appendTo('#iframe');
175
-
176
- FS.PostMessage.init(base_url);
177
- FS.PostMessage.receiveOnce('height', function (data) {
178
- var h = data.height;
179
- if (!isNaN(h) && h > 0 && h != iframe_height) {
180
- iframe_height = h;
181
- $("#iframe iframe").height(iframe_height + 'px');
182
- }
183
- });
184
-
185
- FS.PostMessage.receiveOnce('install', function (data) {
186
- // Post data to activation URL.
187
- $.form('<?php echo fs_nonce_url($fs->_get_admin_page_url('account', array(
188
- 'fs_action' => $slug . '_activate_new',
189
- 'plugin_id' => isset($_GET['plugin_id']) ? $_GET['plugin_id'] : $fs->get_id()
190
- )), $slug . '_activate_new') ?>', {
191
- user_id : data.user.id,
192
- user_secret_key : data.user.secret_key,
193
- user_public_key : data.user.public_key,
194
- install_id : data.install.id,
195
- install_secret_key: data.install.secret_key,
196
- install_public_key: data.install.public_key
197
- }).submit();
198
- });
199
-
200
- FS.PostMessage.receiveOnce('pending_activation', function (data) {
201
- $.form('<?php echo fs_nonce_url($fs->_get_admin_page_url('account', array(
202
- 'fs_action' => $slug . '_activate_new',
203
- 'plugin_id' => fs_request_get('plugin_id', $fs->get_id()),
204
- 'pending_activation' => true,
205
- )), $slug . '_activate_new') ?>', {
206
- user_email: data.user_email
207
- }).submit();
208
- });
209
-
210
- FS.PostMessage.receiveOnce('get_context', function () {
211
- console.debug('receiveOnce', 'get_context');
212
-
213
- // If the user didn't connect his account with Freemius,
214
- // once he accepts the Terms of Service and Privacy Policy,
215
- // and then click the purchase button, the context information
216
- // of the user will be shared with Freemius in order to complete the
217
- // purchase workflow and activate the license for the right user.
218
- FS.PostMessage.post('context', {
219
- plugin_id : '<?php echo $fs->get_id() ?>',
220
- plugin_public_key: '<?php echo $fs->get_public_key() ?>',
221
- plugin_version : '<?php echo $fs->get_plugin_version() ?>',
222
- plugin_slug : '<?php echo $slug ?>',
223
- site_name : '<?php echo get_bloginfo('name') ?>',
224
- platform_version : '<?php echo get_bloginfo('version') ?>',
225
- language : '<?php echo get_bloginfo('language') ?>',
226
- charset : '<?php echo get_bloginfo('charset') ?>',
227
- return_url : '<?php echo $return_url ?>',
228
- account_url : '<?php echo fs_nonce_url($fs->_get_admin_page_url(
229
- 'account',
230
- array('fs_action' => 'sync_user')
231
- ), 'sync_user') ?>',
232
- activation_url : '<?php echo fs_nonce_url($fs->_get_admin_page_url('',
233
- array(
234
- 'fs_action' => $slug . '_activate_new',
235
- 'plugin_id' => fs_request_get('plugin_id', $fs->get_id()),
236
-
237
- )),
238
- $slug . '_activate_new') ?>'
239
- }, iframe[0]);
240
- });
241
-
242
- FS.PostMessage.receiveOnce('get_dimensions', function (data) {
243
- console.debug('receiveOnce', 'get_dimensions');
244
-
245
- FS.PostMessage.post('dimensions', {
246
- height : $(document.body).height(),
247
- scrollTop: $(document).scrollTop()
248
- }, iframe[0]);
249
- });
250
- });
251
- })(jQuery);
252
- </script>
253
- </div>
254
- <?php
255
- $params = array(
256
- 'page' => 'checkout',
257
- 'module_id' => $fs->get_id(),
258
- 'module_slug' => $slug,
259
- 'module_version' => $fs->get_plugin_version(),
260
- );
261
- fs_require_template( 'powered-by.php', $params );
262
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/connect.php DELETED
@@ -1,346 +0,0 @@
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
- $slug = $VARS['slug'];
14
- $fs = freemius( $slug );
15
- $is_pending_activation = $fs->is_pending_activation();
16
- $is_premium_only = $fs->is_only_premium();
17
- $has_paid_plans = $fs->has_paid_plan();
18
- $is_premium_code = $fs->is_premium();
19
- $is_freemium = $fs->is_freemium();
20
-
21
- $fs->_enqueue_connect_essentials();
22
-
23
- $current_user = Freemius::_get_current_wp_user();
24
-
25
- $first_name = $current_user->user_firstname;
26
- if ( empty( $first_name ) ) {
27
- $first_name = $current_user->nickname;
28
- }
29
-
30
- $site_url = get_site_url();
31
- $protocol_pos = strpos( $site_url, '://' );
32
- if ( false !== $protocol_pos ) {
33
- $site_url = substr( $site_url, $protocol_pos + 3 );
34
- }
35
-
36
- $freemius_site_url = $fs->has_paid_plan() ?
37
- 'https://freemius.com/wordpress/' :
38
- // Insights platform information.
39
- 'https://freemius.com/wordpress/usage-tracking/';
40
-
41
- $freemius_site_url .= '?' . http_build_query( array(
42
- 'id' => $fs->get_id(),
43
- 'slug' => $slug,
44
- ) );
45
-
46
- $freemius_link = '<a href="' . $freemius_site_url . '" target="_blank" tabindex="1">freemius.com</a>';
47
-
48
- $error = fs_request_get( 'error' );
49
-
50
- $require_license_key = $is_premium_only ||
51
- ( $is_freemium && $is_premium_code && fs_request_get_bool( 'require_license', true ) );
52
-
53
- if ( $is_pending_activation ) {
54
- $require_license_key = false;
55
- }
56
-
57
- if ( $require_license_key ) {
58
- $fs->_require_license_activation_dialog();
59
- }
60
- ?>
61
- <div id="fs_connect"
62
- class="wrap<?php if ( ! $fs->is_enable_anonymous() || $is_pending_activation || $require_license_key ) {
63
- echo ' fs-anonymous-disabled';
64
- } ?>">
65
- <div class="fs-visual">
66
- <b class="fs-site-icon"><i class="dashicons dashicons-wordpress"></i></b>
67
- <i class="dashicons dashicons-plus fs-first"></i>
68
- <?php
69
- $vars = array( 'slug' => $slug );
70
- fs_require_once_template( 'plugin-icon.php', $vars );
71
- ?>
72
- <i class="dashicons dashicons-plus fs-second"></i>
73
- <img class="fs-connect-logo" width="80" height="80" src="//img.freemius.com/connect-logo.png"/>
74
- </div>
75
- <div class="fs-content">
76
- <?php if ( ! empty( $error ) ) : ?>
77
- <p class="fs-error"><?php echo $error ?></p>
78
- <?php endif ?>
79
- <p><?php
80
- $button_label = 'opt-in-connect';
81
-
82
- if ( $is_pending_activation ) {
83
- $button_label = 'resend-activation-email';
84
-
85
- echo $fs->apply_filters( 'pending_activation_message', sprintf(
86
- __fs( 'thanks-x', $slug ) . '<br>' .
87
- __fs( 'pending-activation-message', $slug ),
88
- $first_name,
89
- '<b>' . $fs->get_plugin_name() . '</b>',
90
- '<b>' . $current_user->user_email . '</b>'
91
- ) );
92
- } else if ( $require_license_key ) {
93
- $button_label = 'agree-activate-license';
94
-
95
- echo $fs->apply_filters( 'connect-message_on-premium',
96
- sprintf( __fs( 'hey-x', $slug ), $first_name ) . '<br>' .
97
- sprintf( __fs( 'thanks-for-purchasing', $slug ), '<b>' . $fs->get_plugin_name() . '</b>' ),
98
- $first_name,
99
- $fs->get_plugin_name()
100
- );
101
- } else {
102
- $filter = 'connect_message';
103
- $default_optin_message = 'connect-message';
104
-
105
- if ( $fs->is_plugin_update() ) {
106
- // If Freemius was added on a plugin update, set different
107
- // opt-in message.
108
- $default_optin_message = 'connect-message_on-update';
109
-
110
- // If user customized the opt-in message on update, use
111
- // that message. Otherwise, fallback to regular opt-in
112
- // custom message if exist.
113
- if ( $fs->has_filter( 'connect_message_on_update' ) ) {
114
- $filter = 'connect_message_on_update';
115
- }
116
- }
117
-
118
- echo $fs->apply_filters( $filter,
119
- sprintf(
120
- __fs( 'hey-x', $slug ) . '<br>' .
121
- __fs( $default_optin_message, $slug ),
122
- $first_name,
123
- '<b>' . $fs->get_plugin_name() . '</b>',
124
- '<b>' . $current_user->user_login . '</b>',
125
- '<a href="' . $site_url . '" target="_blank">' . $site_url . '</a>',
126
- $freemius_link
127
- ),
128
- $first_name,
129
- $fs->get_plugin_name(),
130
- $current_user->user_login,
131
- '<a href="' . $site_url . '" target="_blank">' . $site_url . '</a>',
132
- $freemius_link
133
- );
134
- }
135
- ?></p>
136
- <?php if ( $require_license_key ) : ?>
137
- <div class="fs-license-key-container">
138
- <input id="fs_license_key" name="fs_key" type="text" required maxlength="32"
139
- placeholder="<?php _efs( 'license-key', $slug ) ?>" tabindex="1"/>
140
- <i class="dashicons dashicons-admin-network"></i>
141
- <a class="show-license-resend-modal show-license-resend-modal-<?php echo $slug; ?>"
142
- href="#"><?php _efs( 'cant-find-license-key' ); ?></a>
143
- </div>
144
- <?php endif ?>
145
- </div>
146
- <div class="fs-actions">
147
- <?php if ( $fs->is_enable_anonymous() && ! $is_pending_activation && ! $require_license_key ) : ?>
148
- <a href="<?php echo wp_nonce_url( $fs->_get_admin_page_url( '', array( 'fs_action' => $slug . '_skip_activation' ) ), $slug . '_skip_activation' ) ?>"
149
- class="button button-secondary" tabindex="2"><?php _efs( 'skip', $slug ) ?></a>
150
- <?php endif ?>
151
-
152
- <?php $fs_user = Freemius::_get_user_by_email( $current_user->user_email ) ?>
153
- <?php if ( is_object( $fs_user ) && ! $is_pending_activation ) : ?>
154
- <form action="" method="POST">
155
- <input type="hidden" name="fs_action" value="<?php echo $slug ?>_activate_existing">
156
- <?php wp_nonce_field( 'activate_existing_' . $fs->get_public_key() ) ?>
157
- <button class="button button-primary" tabindex="1"
158
- type="submit"<?php if ( $require_license_key ) {
159
- echo ' disabled="disabled"';
160
- } ?>><?php _efs( $button_label, $slug ) ?></button>
161
- </form>
162
- <?php else : ?>
163
- <form method="post" action="<?php echo WP_FS__ADDRESS ?>/action/service/user/install/">
164
- <?php $params = $fs->get_opt_in_params() ?>
165
- <?php foreach ( $params as $name => $value ) : ?>
166
- <input type="hidden" name="<?php echo $name ?>" value="<?php echo esc_attr( $value ) ?>">
167
- <?php endforeach ?>
168
- <button class="button button-primary" tabindex="1"
169
- type="submit"<?php if ( $require_license_key ) {
170
- echo ' disabled="disabled"';
171
- } ?>><?php _efs( $button_label, $slug ) ?></button>
172
- </form>
173
- <?php endif ?>
174
- </div><?php
175
-
176
- // Set core permission list items.
177
- $permissions = array(
178
- 'profile' => array(
179
- 'icon-class' => 'dashicons dashicons-admin-users',
180
- 'label' => __fs( 'permissions-profile' ),
181
- 'desc' => __fs( 'permissions-profile_desc' ),
182
- 'priority' => 5,
183
- ),
184
- 'site' => array(
185
- 'icon-class' => 'dashicons dashicons-admin-settings',
186
- 'label' => __fs( 'permissions-site' ),
187
- 'desc' => __fs( 'permissions-site_desc' ),
188
- 'priority' => 10,
189
- ),
190
- 'events' => array(
191
- 'icon-class' => 'dashicons dashicons-admin-plugins',
192
- 'label' => __fs( 'permissions-events' ),
193
- 'desc' => __fs( 'permissions-events_desc' ),
194
- 'priority' => 20,
195
- ),
196
- // 'plugins_themes' => array(
197
- // 'icon-class' => 'dashicons dashicons-admin-settings',
198
- // 'label' => __fs( 'permissions-plugins_themes' ),
199
- // 'desc' => __fs( 'permissions-plugins_themes_desc' ),
200
- // 'priority' => 30,
201
- // ),
202
- );
203
-
204
- // Add newsletter permissions if enabled.
205
- if ( $fs->is_permission_requested( 'newsletter' ) ) {
206
- $permissions['newsletter'] = array(
207
- 'icon-class' => 'dashicons dashicons-email-alt',
208
- 'label' => __fs( 'permissions-newsletter' ),
209
- 'desc' => __fs( 'permissions-newsletter_desc' ),
210
- 'priority' => 15,
211
- );
212
- }
213
-
214
- // Allow filtering of the permissions list.
215
- $permissions = $fs->apply_filters( 'permission_list', $permissions );
216
-
217
- // Sort by priority.
218
- uasort( $permissions, 'fs_sort_by_priority' );
219
-
220
- if ( ! empty( $permissions ) ) : ?>
221
- <div class="fs-permissions">
222
- <?php if ( $require_license_key ) : ?>
223
- <p class="fs-license-sync-disclaimer"><?php printf( __fs( 'license-sync-disclaimer', $slug ), $freemius_link ) ?></p>
224
- <?php endif ?>
225
- <a class="fs-trigger" href="#" tabindex="1"><?php _efs( 'what-permissions', $slug ) ?></a>
226
- <ul><?php
227
- foreach ( $permissions as $id => $permission ) : ?>
228
- <li id="fs-permission-<?php esc_attr_e( $id ); ?>"
229
- class="fs-permission fs-<?php esc_attr_e( $id ); ?>">
230
- <i class="<?php esc_attr_e( $permission['icon-class'] ); ?>"></i>
231
-
232
- <div>
233
- <span><?php esc_html_e( $permission['label'] ); ?></span>
234
-
235
- <p><?php esc_html_e( $permission['desc'] ); ?></p>
236
- </div>
237
- </li>
238
- <?php endforeach; ?>
239
- </ul>
240
- </div>
241
- <?php endif ?>
242
- <?php if ( $is_premium_code && $is_freemium ) : ?>
243
- <div class="fs-freemium-licensing">
244
- <p>
245
- <?php if ( $require_license_key ) : ?>
246
- <?php _efs( 'dont-have-license-key', $slug ) ?>
247
- <a data-require-license="false" tabindex="1"><?php _efs( 'activate-free-version', $slug ) ?></a>
248
- <?php else : ?>
249
- <?php _efs( 'have-license-key', $slug ) ?>
250
- <a data-require-license="true" tabindex="1"><?php _efs( 'activate-license', $slug ) ?></a>
251
- <?php endif ?>
252
- </p>
253
- </div>
254
- <?php endif ?>
255
- <div class="fs-terms">
256
- <a href="https://freemius.com/privacy/" target="_blank"
257
- tabindex="1"><?php _efs( 'privacy-policy', $slug ) ?></a>
258
- &nbsp;&nbsp;-&nbsp;&nbsp;
259
- <a href="https://freemius.com/terms/" target="_blank" tabindex="1"><?php _efs( 'tos', $slug ) ?></a>
260
- </div>
261
- </div>
262
- <script type="text/javascript">
263
- (function ($) {
264
- var $primaryCta = $('.fs-actions .button.button-primary'),
265
- $form = $('.fs-actions form'),
266
- requireLicenseKey = <?php echo $require_license_key ? 'true' : 'false' ?>,
267
- $licenseSecret,
268
- $licenseKeyInput = $('#fs_license_key');
269
-
270
- $('.fs-actions .button').on('click', function () {
271
- // Set loading mode.
272
- $(document.body).css({'cursor': 'wait'});
273
- });
274
-
275
- $form.on('submit', function () {
276
- /**
277
- * @author Vova Feldman (@svovaf)
278
- * @since 1.1.9
279
- */
280
- if (requireLicenseKey) {
281
- if (null == $licenseSecret) {
282
- $licenseSecret = $('<input type="hidden" name="license_secret_key" value="" />');
283
- $form.append($licenseSecret);
284
- }
285
-
286
- // Update secret key if premium only plugin.
287
- $licenseSecret.val($licenseKeyInput.val());
288
- }
289
-
290
- return true;
291
- });
292
-
293
- $primaryCta.on('click', function () {
294
- $(this).addClass('fs-loading');
295
- $(this).html('<?php _efs( $is_pending_activation ? 'sending-email' : 'activating' , $slug ) ?>...').css({'cursor': 'wait'});
296
- });
297
-
298
- $('.fs-permissions .fs-trigger').on('click', function () {
299
- $('.fs-permissions').toggleClass('fs-open');
300
- });
301
-
302
- if (requireLicenseKey) {
303
- /**
304
- * Submit license key on enter.
305
- *
306
- * @author Vova Feldman (@svovaf)
307
- * @since 1.1.9
308
- */
309
- $licenseKeyInput.keypress(function (e) {
310
- if (e.which == 13) {
311
- if ('' !== $(this).val()) {
312
- $primaryCta.click();
313
- return false;
314
- }
315
- }
316
- });
317
-
318
- /**
319
- * Disable activation button when empty license key.
320
- *
321
- * @author Vova Feldman (@svovaf)
322
- * @since 1.1.9
323
- */
324
- $licenseKeyInput.on('keyup paste delete cut', function () {
325
- setTimeout(function () {
326
- if ('' === $licenseKeyInput.val()) {
327
- $primaryCta.attr('disabled', 'disabled');
328
- } else {
329
- $primaryCta.prop('disabled', false);
330
- }
331
- }, 100);
332
- }).focus();
333
- }
334
-
335
- /**
336
- * Set license mode trigger URL.
337
- *
338
- * @author Vova Feldman (@svovaf)
339
- * @since 1.1.9
340
- */
341
- var $connectLicenseModeTrigger = $('#fs_connect .fs-freemium-licensing a');
342
- if ($connectLicenseModeTrigger.length > 0) {
343
- $connectLicenseModeTrigger.attr('href', window.location.href + '&require_license=' + $connectLicenseModeTrigger.attr('data-require-license'))
344
- }
345
- })(jQuery);
346
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/contact.php DELETED
@@ -1,85 +0,0 @@
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
- $slug = $VARS['slug'];
20
- $fs = freemius( $slug );
21
-
22
- $context_params = array(
23
- 'plugin_id' => $fs->get_id(),
24
- 'plugin_public_key' => $fs->get_public_key(),
25
- 'plugin_version' => $fs->get_plugin_version(),
26
- );
27
-
28
-
29
- // Get site context secure params.
30
- if ( $fs->is_registered() ) {
31
- $context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
32
- $fs->get_site(),
33
- time(),
34
- 'contact'
35
- ) );
36
- }
37
-
38
- $query_params = array_merge( $_GET, array_merge( $context_params, array(
39
- 'plugin_version' => $fs->get_plugin_version(),
40
- 'wp_login_url' => wp_login_url(),
41
- 'site_url' => get_site_url(),
42
- // 'wp_admin_css' => get_bloginfo('wpurl') . "/wp-admin/load-styles.php?c=1&load=buttons,wp-admin,dashicons",
43
- ) ) );
44
- ?>
45
- <div class="fs-secure-notice">
46
- <i class="dashicons dashicons-lock"></i>
47
- <span><b>Secure HTTPS contact page</b>, running via iframe from external domain</span>
48
- </div>
49
- <div id="fs_contact" class="wrap" style="margin: 40px 0 -65px -20px;">
50
- <div id="iframe"></div>
51
- <script type="text/javascript">
52
- (function ($) {
53
- $(function () {
54
-
55
- var
56
- // Keep track of the iframe height.
57
- iframe_height = 800,
58
- base_url = '<?php echo WP_FS__ADDRESS ?>',
59
- src = base_url + '/contact/?<?php echo http_build_query($query_params) ?>#' + encodeURIComponent(document.location.href),
60
-
61
- // Append the Iframe into the DOM.
62
- iframe = $('<iframe " src="' + src + '" width="100%" height="' + iframe_height + 'px" scrolling="no" frameborder="0" style="background: transparent;"><\/iframe>')
63
- .appendTo('#iframe');
64
-
65
- FS.PostMessage.init(base_url);
66
- FS.PostMessage.receive('height', function (data) {
67
- var h = data.height;
68
- if (!isNaN(h) && h > 0 && h != iframe_height) {
69
- iframe_height = h;
70
- $("#iframe iframe").height(iframe_height + 'px');
71
- }
72
- });
73
- });
74
- })(jQuery);
75
- </script>
76
- </div>
77
- <?php
78
- $params = array(
79
- 'page' => 'contact',
80
- 'module_id' => $fs->get_id(),
81
- 'module_slug' => $slug,
82
- 'module_version' => $fs->get_plugin_version(),
83
- );
84
- fs_require_template( 'powered-by.php', $params );
85
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/debug.php DELETED
@@ -1,295 +0,0 @@
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
- global $fs_active_plugins;
14
-
15
- $fs_options = FS_Option_Manager::get_manager( WP_FS__ACCOUNTS_OPTION_NAME, true );
16
- ?>
17
- <h1><?php echo __fs( 'Freemius Debug' ) . ' - ' . __fs( 'SDK' ) . ' v.' . $fs_active_plugins->newest->version ?></h1>
18
- <div>
19
- <!-- Debugging Switch -->
20
- <?php //$debug_mode = get_option( 'fs_debug_mode', null ) ?>
21
- <span class="switch-label"><?php _efs( 'debugging' ) ?></span>
22
-
23
- <div class="switch <?php echo WP_FS__DEBUG_SDK ? 'off' : 'on' ?>">
24
- <div class="toggle"></div>
25
- <span class="on"><?php _efs( 'on' ) ?></span>
26
- <span class="off"><?php _efs( 'off' ) ?></span>
27
- </div>
28
- <script type="text/javascript">
29
- (function ($) {
30
- $(document).ready(function () {
31
- // Switch toggle
32
- $('.switch').click(function () {
33
- $(this)
34
- .toggleClass('on')
35
- .toggleClass('off');
36
-
37
- $.post(ajaxurl, {
38
- action: 'fs_toggle_debug_mode',
39
- is_on : ($(this).hasClass('off') ? 1 : 0)
40
- }, function (response) {
41
- if (1 == response) {
42
- // Refresh page on success.
43
- location.reload();
44
- }
45
- });
46
- });
47
- });
48
- }(jQuery));
49
- </script>
50
- </div>
51
- <h2><?php _efs( 'actions' ) ?></h2>
52
- <table>
53
- <tbody>
54
- <tr>
55
- <td>
56
- <!-- Delete All Accounts -->
57
- <form action="" method="POST">
58
- <input type="hidden" name="fs_action" value="restart_freemius">
59
- <?php wp_nonce_field( 'restart_freemius' ) ?>
60
- <button class="button button-primary"
61
- onclick="if (confirm('<?php _efs( 'delete-all-confirm' ) ?>')) this.parentNode.submit(); return false;"><?php _efs( 'delete-all-accounts' ) ?></button>
62
- </form>
63
- </td>
64
- <td>
65
- <!-- Clear API Cache -->
66
- <form action="" method="POST">
67
- <input type="hidden" name="fs_clear_api_cache" value="true">
68
- <button class="button button-primary"><?php _efs( 'clear-api-cache' ) ?></button>
69
- </form>
70
- </td>
71
- <td>
72
- <!-- Sync Data with Server -->
73
- <form action="" method="POST">
74
- <input type="hidden" name="background_sync" value="true">
75
- <button class="button button-primary"><?php _efs( 'sync-data-from-server' ) ?></button>
76
- </form>
77
- </td>
78
- </tr>
79
- </tbody>
80
- </table>
81
- <h2><?php _efs( 'sdk-versions' ) ?></h2>
82
- <table id="fs_sdks" class="widefat">
83
- <thead>
84
- <tr>
85
- <th><?php _efs( 'version' ) ?></th>
86
- <th><?php _efs( 'sdk-path' ) ?></th>
87
- <th><?php _efs( 'plugin-path' ) ?></th>
88
- <th><?php _efs( 'is-active' ) ?></th>
89
- </tr>
90
- </thead>
91
- <tbody>
92
- <?php foreach ( $fs_active_plugins->plugins as $sdk_path => &$data ) : ?>
93
- <?php $is_active = ( WP_FS__SDK_VERSION == $data->version ) ?>
94
- <tr<?php if ( $is_active ) {
95
- echo ' style="background: #E6FFE6; font-weight: bold"';
96
- } ?>>
97
- <td><?php echo $data->version ?></td>
98
- <td><?php echo $sdk_path ?></td>
99
- <td><?php echo $data->plugin_path ?></td>
100
- <td><?php echo ( $is_active ) ? 'Active' : 'Inactive' ?></td>
101
- </tr>
102
- <?php endforeach ?>
103
- </tbody>
104
- </table>
105
- <?php $plugins = $fs_options->get_option( 'plugins' ) ?>
106
- <?php if ( is_array( $plugins ) && 0 < count( $plugins ) ) : ?>
107
- <h2><?php _efs( 'plugins' ) ?></h2>
108
- <table id="fs_plugins" class="widefat">
109
- <thead>
110
- <tr>
111
- <th><?php _efs( 'id' ) ?></th>
112
- <th><?php _efs( 'slug' ) ?></th>
113
- <th><?php _efs( 'version' ) ?></th>
114
- <th><?php _efs( 'title' ) ?></th>
115
- <th><?php _efs( 'api' ) ?></th>
116
- <th><?php _efs( 'freemius-state' ) ?></th>
117
- <th><?php _efs( 'plugin-path' ) ?></th>
118
- <th><?php _efs( 'public-key' ) ?></th>
119
- </tr>
120
- </thead>
121
- <tbody>
122
- <?php foreach ( $plugins as $slug => $data ) : ?>
123
- <?php $is_active = is_plugin_active( $data->file ) ?>
124
- <?php $fs = $is_active ? freemius( $slug ) : null ?>
125
- <tr<?php if ( $is_active ) {
126
- echo ' style="background: #E6FFE6; font-weight: bold"';
127
- } ?>>
128
- <td><?php echo $data->id ?></td>
129
- <td><?php echo $slug ?></td>
130
- <td><?php echo $data->version ?></td>
131
- <td><?php echo $data->title ?></td>
132
- <td><?php if ( $is_active ) {
133
- echo $fs->has_api_connectivity() ?
134
- __fs( 'connected' ) :
135
- __fs( 'blocked' );
136
- } ?></td>
137
- <td><?php if ( $is_active ) {
138
- echo $fs->is_on() ?
139
- __fs( 'on' ) :
140
- __fs( 'off' );
141
- } ?></td>
142
- <td><?php echo $data->file ?></td>
143
- <td><?php echo $data->public_key ?></td>
144
- </tr>
145
- <?php endforeach ?>
146
- </tbody>
147
- </table>
148
- <?php endif ?>
149
- <?php
150
- /**
151
- * @var FS_Site[] $sites
152
- */
153
- $sites = $VARS['sites'];
154
- ?>
155
- <?php if ( is_array( $sites ) && 0 < count( $sites ) ) : ?>
156
- <h2><?php _efs( 'plugin-installs' ) ?> / <?php _efs( 'sites' ) ?></h2>
157
- <table id="fs_installs" class="widefat">
158
- <thead>
159
- <tr>
160
- <th><?php _efs( 'id' ) ?></th>
161
- <th><?php _efs( 'slug' ) ?></th>
162
- <th><?php _efs( 'plan' ) ?></th>
163
- <th><?php _efs( 'public-key' ) ?></th>
164
- <th><?php _efs( 'secret-key' ) ?></th>
165
- </tr>
166
- </thead>
167
- <tbody>
168
- <?php foreach ( $sites as $slug => $site ) : ?>
169
- <tr>
170
- <td><?php echo $site->id ?></td>
171
- <td><?php echo $slug ?></td>
172
- <td><?php
173
- echo is_object( $site->plan ) ?
174
- base64_decode( $site->plan->name ) :
175
- ''
176
- ?></td>
177
- <td><?php echo $site->public_key ?></td>
178
- <td><?php echo $site->secret_key ?></td>
179
- </tr>
180
- <?php endforeach ?>
181
- </tbody>
182
- </table>
183
- <?php endif ?>
184
- <?php
185
- $addons = $VARS['addons'];
186
- ?>
187
- <?php foreach ( $addons as $plugin_id => $plugin_addons ) : ?>
188
- <h2><?php printf( __fs( 'addons-of-x' ), $plugin_id ) ?></h2>
189
- <table id="fs_addons" class="widefat">
190
- <thead>
191
- <tr>
192
- <th><?php _efs( 'id' ) ?></th>
193
- <th><?php _efs( 'title' ) ?></th>
194
- <th><?php _efs( 'slug' ) ?></th>
195
- <th><?php _efs( 'version' ) ?></th>
196
- <th><?php _efs( 'public-key' ) ?></th>
197
- <th><?php _efs( 'secret-key' ) ?></th>
198
- </tr>
199
- </thead>
200
- <tbody>
201
- <?php
202
- /**
203
- * @var FS_Plugin[] $plugin_addons
204
- */
205
- foreach ( $plugin_addons as $addon ) : ?>
206
- <tr>
207
- <td><?php echo $addon->id ?></td>
208
- <td><?php echo $addon->title ?></td>
209
- <td><?php echo $addon->slug ?></td>
210
- <td><?php echo $addon->version ?></td>
211
- <td><?php echo $addon->public_key ?></td>
212
- <td><?php echo $addon->secret_key ?></td>
213
- </tr>
214
- <?php endforeach ?>
215
- </tbody>
216
- </table>
217
- <?php endforeach ?>
218
- <?php
219
- /**
220
- * @var FS_User[] $users
221
- */
222
- $users = $VARS['users'];
223
- ?>
224
- <?php if ( is_array( $users ) && 0 < count( $users ) ) : ?>
225
- <h2><?php _efs( 'users' ) ?></h2>
226
- <table id="fs_users" class="widefat">
227
- <thead>
228
- <tr>
229
- <th><?php _efs( 'id' ) ?></th>
230
- <th><?php _efs( 'name' ) ?></th>
231
- <th><?php _efs( 'email' ) ?></th>
232
- <th><?php _efs( 'verified' ) ?></th>
233
- <th><?php _efs( 'public-key' ) ?></th>
234
- <th><?php _efs( 'secret-key' ) ?></th>
235
- </tr>
236
- </thead>
237
- <tbody>
238
- <?php foreach ( $users as $user_id => $user ) : ?>
239
- <tr>
240
- <td><?php echo $user->id ?></td>
241
- <td><?php echo $user->get_name() ?></td>
242
- <td><a href="mailto:<?php esc_attr_e( $user->email ) ?>"><?php echo $user->email ?></a></td>
243
- <td><?php echo json_encode( $user->is_verified ) ?></td>
244
- <td><?php echo $user->public_key ?></td>
245
- <td><?php echo $user->secret_key ?></td>
246
- </tr>
247
- <?php endforeach ?>
248
- </tbody>
249
- </table>
250
- <?php endif ?>
251
- <?php
252
- /**
253
- * @var FS_Plugin_License[] $licenses
254
- */
255
- $licenses = $VARS['licenses'];
256
- ?>
257
- <?php if ( is_array( $licenses ) && 0 < count( $licenses ) ) : ?>
258
- <h2><?php _efs( 'licenses' ) ?></h2>
259
- <table id="fs_users" class="widefat">
260
- <thead>
261
- <tr>
262
- <th><?php _efs( 'id' ) ?></th>
263
- <th><?php _efs( 'plugin-id' ) ?></th>
264
- <th><?php _efs( 'user-id' ) ?></th>
265
- <th><?php _efs( 'plan-id' ) ?></th>
266
- <th><?php _efs( 'quota' ) ?></th>
267
- <th><?php _efs( 'activated' ) ?></th>
268
- <th><?php _efs( 'blocking' ) ?></th>
269
- <th><?php _efs( 'license-key' ) ?></th>
270
- <th><?php _efs( 'expiration' ) ?></th>
271
- </tr>
272
- </thead>
273
- <tbody>
274
- <?php foreach ( $licenses as $slug => $module_licenses ) : ?>
275
- <?php foreach ( $module_licenses as $id => $licenses ) : ?>
276
- <?php if ( is_array( $licenses ) && 0 < count( $licenses ) ) : ?>
277
- <?php foreach ( $licenses as $license ) : ?>
278
- <tr>
279
- <td><?php echo $license->id ?></td>
280
- <td><?php echo $license->plugin_id ?></td>
281
- <td><?php echo $license->user_id ?></td>
282
- <td><?php echo $license->plan_id ?></td>
283
- <td><?php echo $license->is_unlimited() ? 'Unlimited' : ( $license->is_single_site() ? 'Single Site' : $license->quota ) ?></td>
284
- <td><?php echo $license->activated ?></td>
285
- <td><?php echo $license->is_block_features ? 'Blocking' : 'Flexible' ?></td>
286
- <td><?php echo htmlentities( $license->secret_key ) ?></td>
287
- <td><?php echo $license->expiration ?></td>
288
- </tr>
289
- <?php endforeach ?>
290
- <?php endif ?>
291
- <?php endforeach ?>
292
- <?php endforeach ?>
293
- </tbody>
294
- </table>
295
- <?php endif ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/debug/api-calls.php DELETED
@@ -1,138 +0,0 @@
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.3
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- if ( class_exists( 'Freemius_Api' ) ) {
14
- $logger = Freemius_Api::GetLogger();
15
- } else {
16
- $logger = array();
17
- }
18
-
19
- $counters = array(
20
- 'GET' => 0,
21
- 'POST' => 0,
22
- 'PUT' => 0,
23
- 'DELETE' => 0
24
- );
25
-
26
- $show_body = false;
27
- foreach ( $logger as $log ) {
28
- $counters[ $log['method'] ] ++;
29
-
30
- if ( ! is_null( $log['body'] ) ) {
31
- $show_body = true;
32
- }
33
- }
34
-
35
- $pretty_print = $show_body && defined( 'JSON_PRETTY_PRINT' ) && version_compare( phpversion(), '5.3', '>=' );
36
-
37
- $root_path_len = strlen( ABSPATH );
38
- ?>
39
- <h1><?php _efs( 'API' ) ?></h1>
40
-
41
- <h2><span>Total Time:</span><?php echo Freemius_Debug_Bar_Panel::total_time() ?></h2>
42
-
43
- <h2><span>Total Requests:</span><?php echo Freemius_Debug_Bar_Panel::requests_count() ?></h2>
44
- <?php foreach ( $counters as $method => $count ) : ?>
45
- <h2><span><?php echo $method ?>:</span><?php echo number_format( $count ) ?></h2>
46
- <?php endforeach ?>
47
- <table class="widefat">
48
- <thead>
49
- <tr>
50
- <th>#</th>
51
- <th><?php _efs( 'Method' ) ?></th>
52
- <th><?php _efs( 'Code' ) ?></th>
53
- <th><?php _efs( 'Length' ) ?></th>
54
- <th><?php _efs( 'Path' ) ?></th>
55
- <?php if ( $show_body ) : ?>
56
- <th><?php _efs( 'Body' ) ?></th>
57
- <?php endif ?>
58
- <th><?php _efs( 'Result' ) ?></th>
59
- <th><?php _efs( 'Start' ) ?></th>
60
- <th><?php _efs( 'End' ) ?></th>
61
- </tr>
62
- </thead>
63
- <tbody>
64
- <?php foreach ( $logger as $log ) : ?>
65
- <tr>
66
- <td><?php echo $log['id'] ?>.</td>
67
- <td><?php echo $log['method'] ?></td>
68
- <td><?php echo $log['code'] ?></td>
69
- <td><?php echo number_format( 100 * $log['total'], 2 ) . ' ' . __fs( 'ms' ) ?></td>
70
- <td>
71
- <?php
72
- printf( '<a href="#" onclick="jQuery(this).parent().find(\'table\').toggle(); return false;">%s</a>',
73
- $log['path']
74
- );
75
- ?>
76
- <table class="widefat" style="display: none">
77
- <tbody>
78
- <?php for ( $i = 0, $bt = $log['backtrace'], $len = count( $bt ); $i < $len; $i ++ ) : ?>
79
- <tr>
80
- <td><?php echo( $len - $i ) ?></td>
81
- <td><?php if ( isset( $bt[ $i ]['function'] ) ) {
82
- echo ( isset( $bt[ $i ]['class'] ) ? $bt[ $i ]['class'] . $bt[ $i ]['type'] : '' ) . $bt[ $i ]['function'];
83
- } ?></td>
84
- <td><?php if ( isset( $bt[ $i ]['file'] ) ) {
85
- echo substr( $bt[ $i ]['file'], $root_path_len ) . ':' . $bt[ $i ]['line'];
86
- } ?></td>
87
- </tr>
88
- <?php endfor ?>
89
- </tbody>
90
- </table>
91
- </td>
92
- <?php if ( $show_body ) : ?>
93
- <td>
94
- <?php if ( 'GET' !== $log['method'] ) : ?>
95
- <?php
96
- $body = $log['body'];
97
- printf(
98
- '<a href="#" onclick="jQuery(this).parent().find(\'pre\').toggle(); return false;">%s</a>',
99
- substr( $body, 0, 32 ) . ( 32 < strlen( $body ) ? '...' : '' )
100
- );
101
- if ( $pretty_print ) {
102
- $body = json_encode( json_decode( $log['body'] ), JSON_PRETTY_PRINT );
103
- }
104
- ?>
105
- <pre style="display: none"><code><?php echo esc_html( $body ) ?></code></pre>
106
- <?php endif ?>
107
- </td>
108
- <?php endif ?>
109
- <td>
110
- <?php
111
- $result = $log['result'];
112
-
113
- $is_not_empty_result = ( is_string( $result ) && ! empty( $result ) );
114
-
115
- if ( $is_not_empty_result ) {
116
- printf(
117
- '<a href="#" onclick="jQuery(this).parent().find(\'pre\').toggle(); return false;">%s</a>',
118
- substr( $result, 0, 32 ) . ( 32 < strlen( $result ) ? '...' : '' )
119
- );
120
- }
121
-
122
- if ( $is_not_empty_result && $pretty_print ) {
123
- $decoded = json_decode( $result );
124
- if ( ! is_null( $decoded ) ) {
125
- $result = json_encode( $decoded, JSON_PRETTY_PRINT );
126
- }
127
- } else {
128
- $result = is_string( $result ) ? $result : json_encode( $result );
129
- }
130
- ?>
131
- <pre<?php if ( $is_not_empty_result ) : ?> style="display: none"<?php endif ?>><code><?php echo esc_html( $result ) ?></code></pre>
132
- </td>
133
- <td><?php echo number_format( 100 * ( $log['start'] - WP_FS__SCRIPT_START_TIME ), 2 ) . ' ' . __fs( 'ms' ) ?></td>
134
- <td><?php echo number_format( 100 * ( $log['end'] - WP_FS__SCRIPT_START_TIME ), 2 ) . ' ' . __fs( 'ms' ) ?></td>
135
- </tr>
136
- <?php endforeach ?>
137
- </tbody>
138
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/debug/logger.php DELETED
@@ -1,60 +0,0 @@
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.3
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- $log_book = FS_Logger::get_log();
14
- ?>
15
- <h1><?php _efs( 'Log' ) ?></h1>
16
-
17
- <table class="widefat" style="font-size: 11px;">
18
- <thead>
19
- <tr>
20
- <th>#</th>
21
- <th><?php _efs( 'id' ) ?></th>
22
- <th><?php _efs( 'type' ) ?></th>
23
- <th><?php _efs( 'function' ) ?></th>
24
- <th><?php _efs( 'message' ) ?></th>
25
- <th><?php _efs( 'file' ) ?></th>
26
- <th><?php _efs( 'timestamp' ) ?></th>
27
- </tr>
28
- </thead>
29
- <tbody>
30
-
31
- <?php $i = 0;
32
- foreach ( $log_book as $log ) : ?>
33
- <tr<?php if ( $i % 2 ) {
34
- echo ' class="alternate"';
35
- } ?>>
36
- <td><?php echo $log['cnt'] ?>.</td>
37
- <td><?php echo $log['logger']->get_id() ?></td>
38
- <td><?php echo $log['type'] ?></td>
39
- <td><b><code style="color: blue;"><?php echo $log['function'] ?></code></b></td>
40
- <td>
41
- <?php
42
- printf(
43
- '<a href="#" style="color: darkorange !important;" onclick="jQuery(this).parent().find(\'div\').toggle(); return false;"><nobr>%s</nobr></a>',
44
- substr( $log['msg'], 0, 32 ) . ( 32 < strlen( $log['msg'] ) ? '...' : '' )
45
- );
46
- ?>
47
- <div style="display: none;">
48
- <b style="color: darkorange;"><?php echo $log['msg'] ?></b>
49
- </div>
50
- </td>
51
- <td><?php
52
- if ( isset( $log['file'] ) ) {
53
- echo substr( $log['file'], $log['logger']->get_file() ) . ':' . $log['line'] . ')';
54
- }
55
- ?></td>
56
- <td><?php echo number_format( 100 * ( $log['timestamp'] - WP_FS__SCRIPT_START_TIME ), 2 ) . ' ' . __fs( 'ms' ) ?></td>
57
- </tr>
58
- <?php $i ++; endforeach ?>
59
- </tbody>
60
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/debug/plugins-themes-sync.php DELETED
@@ -1,68 +0,0 @@
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.3
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- $fs_options = FS_Option_Manager::get_manager( WP_FS__ACCOUNTS_OPTION_NAME, true );
14
- $all_plugins = $fs_options->get_option( 'all_plugins' );
15
- $all_themes = $fs_options->get_option( 'all_themes' );
16
- ?>
17
- <h1><?php _efs( 'plugins-themes-sync' ) ?></h1>
18
- <table class="widefat">
19
- <thead>
20
- <tr>
21
- <th></th>
22
- <th><?php _efs( 'total' ) ?></th>
23
- <th><?php _efs( 'Last' ) ?></th>
24
- </tr>
25
- </thead>
26
- <tbody>
27
- <?php if ( is_object( $all_plugins ) ) : ?>
28
- <tr>
29
- <td><?php _efs( 'plugins' ) ?></td>
30
- <td><?php echo count( $all_plugins->plugins ) ?></td>
31
- <td><?php
32
- if ( isset( $all_plugins->timestamp ) && is_numeric( $all_plugins->timestamp ) ) {
33
- $diff = abs( WP_FS__SCRIPT_START_TIME - $all_plugins->timestamp );
34
- $human_diff = ( $diff < MINUTE_IN_SECONDS ) ?
35
- $diff . ' ' . __fs( 'sec' ) :
36
- human_time_diff( WP_FS__SCRIPT_START_TIME, $all_plugins->timestamp );
37
-
38
- if ( WP_FS__SCRIPT_START_TIME < $all_plugins->timestamp ) {
39
- printf( __fs( 'in-x' ), $human_diff );
40
- } else {
41
- printf( __fs( 'x-ago' ), $human_diff );
42
- }
43
- }
44
- ?></td>
45
- </tr>
46
- <?php endif ?>
47
- <?php if ( is_object( $all_themes ) ) : ?>
48
- <tr>
49
- <td><?php _efs( 'themes' ) ?></td>
50
- <td><?php echo count( $all_themes->themes ) ?></td>
51
- <td><?php
52
- if ( isset( $all_themes->timestamp ) && is_numeric( $all_themes->timestamp ) ) {
53
- $diff = abs( WP_FS__SCRIPT_START_TIME - $all_themes->timestamp );
54
- $human_diff = ( $diff < MINUTE_IN_SECONDS ) ?
55
- $diff . ' ' . __fs( 'sec' ) :
56
- human_time_diff( WP_FS__SCRIPT_START_TIME, $all_themes->timestamp );
57
-
58
- if ( WP_FS__SCRIPT_START_TIME < $all_themes->timestamp ) {
59
- printf( __fs( 'in-x' ), $human_diff );
60
- } else {
61
- printf( __fs( 'x-ago' ), $human_diff );
62
- }
63
- }
64
- ?></td>
65
- </tr>
66
- <?php endif ?>
67
- </tbody>
68
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/debug/scheduled-crons.php DELETED
@@ -1,100 +0,0 @@
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.3
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- $fs_options = FS_Option_Manager::get_manager( WP_FS__ACCOUNTS_OPTION_NAME, true );
14
- $plugins = $fs_options->get_option( 'plugins' );
15
- $scheduled_crons = array();
16
- if ( is_array( $plugins ) && 0 < count( $plugins ) ) {
17
- foreach ( $plugins as $slug => $data ) {
18
- $fs = freemius( $slug );
19
-
20
- $next_execution = $fs->next_sync_cron();
21
- $last_execution = $fs->last_sync_cron();
22
-
23
- if ( false !== $next_execution ) {
24
- $scheduled_crons[ $slug ][] = array(
25
- 'name' => $fs->get_plugin_name(),
26
- 'slug' => $slug,
27
- 'type' => 'sync_cron',
28
- 'last' => $last_execution,
29
- 'next' => $next_execution,
30
- );
31
- }
32
-
33
- $next_install_execution = $fs->next_install_sync();
34
- $last_install_execution = $fs->last_install_sync();
35
-
36
- if ( false !== $next_install_execution || false !== $last_install_execution ) {
37
- $scheduled_crons[ $slug ][] = array(
38
- 'name' => $fs->get_plugin_name(),
39
- 'slug' => $slug,
40
- 'type' => 'install_sync',
41
- 'last' => $last_install_execution,
42
- 'next' => $next_install_execution,
43
- );
44
- }
45
- }
46
- }
47
- ?>
48
- <h1><?php _efs( 'scheduled-crons' ) ?></h1>
49
- <table class="widefat">
50
- <thead>
51
- <tr>
52
- <th><?php _efs( 'slug' ) ?></th>
53
- <th><?php _efs( 'plugin' ) ?></th>
54
- <th><?php _efs( 'type' ) ?></th>
55
- <th><?php _efs( 'Last' ) ?></th>
56
- <th><?php _efs( 'Next' ) ?></th>
57
- </tr>
58
- </thead>
59
- <tbody>
60
- <?php foreach ( $scheduled_crons as $slug => $crons ) : ?>
61
- <?php foreach ( $crons as $cron ) : ?>
62
- <tr>
63
- <td><?php echo $slug ?></td>
64
- <td><?php echo $cron['name'] ?></td>
65
- <td><?php echo $cron['type'] ?></td>
66
- <td><?php
67
- if (is_numeric($cron['last'])) {
68
- $diff = abs( WP_FS__SCRIPT_START_TIME - $cron['last'] );
69
- $human_diff = ( $diff < MINUTE_IN_SECONDS ) ?
70
- $diff . ' ' . __fs( 'sec' ) :
71
- human_time_diff( WP_FS__SCRIPT_START_TIME, $cron['last'] );
72
-
73
- if ( WP_FS__SCRIPT_START_TIME < $cron['last'] ) {
74
- printf( __fs( 'in-x' ), $human_diff );
75
- } else {
76
- printf( __fs( 'x-ago' ), $human_diff );
77
- }
78
-
79
- // echo ' ' . $cron['last'];
80
- }
81
- ?></td>
82
- <td><?php
83
- if (is_numeric($cron['next'])) {
84
- $diff = abs( WP_FS__SCRIPT_START_TIME - $cron['next'] );
85
- $human_diff = ( $diff < MINUTE_IN_SECONDS ) ?
86
- $diff . ' ' . __fs( 'sec' ) :
87
- human_time_diff( WP_FS__SCRIPT_START_TIME, $cron['next'] );
88
-
89
- if ( WP_FS__SCRIPT_START_TIME < $cron['next'] ) {
90
- printf( __fs( 'in-x' ), $human_diff );
91
- } else {
92
- printf( __fs( 'x-ago' ), $human_diff );
93
- }
94
- }
95
- ?></td>
96
- </tr>
97
- <?php endforeach ?>
98
- <?php endforeach ?>
99
- </tbody>
100
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/email.php DELETED
@@ -1,46 +0,0 @@
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
- $sections = $VARS['sections'];
14
- ?>
15
- <table>
16
- <?php
17
- foreach ( $sections as $section_id => $section ) {
18
- ?>
19
- <thead>
20
- <tr><th colspan="2" style="text-align: left; background: #333; color: #fff; padding: 5px;"><?php echo $section['title']; ?></th></tr>
21
- </thead>
22
- <tbody>
23
- <?php
24
- foreach ( $section['rows'] as $row_id => $row ) {
25
- $col_count = count( $row );
26
- ?>
27
- <tr>
28
- <?php
29
- if ( 1 === $col_count ) { ?>
30
- <td style="vertical-align: top;" colspan="2"><?php echo $row[0]; ?></td>
31
- <?php
32
- } else { ?>
33
- <td style="vertical-align: top;"><b><?php echo $row[0]; ?>:</b></td>
34
- <td><?php echo $row[1]; ?></td>
35
- <?php
36
- }
37
- ?>
38
- </tr>
39
- <?php
40
- }
41
- ?>
42
- </tbody>
43
- <?php
44
- }
45
- ?>
46
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/firewall-issues-js.php DELETED
@@ -1,60 +0,0 @@
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 : slug + '_resolve_firewall_issues',
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 = slug + '_retry_connectivity_test';
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/contact.php DELETED
@@ -1,20 +0,0 @@
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.0
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- $slug = $VARS['slug'];
14
- $fs = freemius( $slug );
15
-
16
- echo __fs( 'contact-support-before-deactivation', $slug )
17
- . sprintf(" <a href='%s' class='button button-small button-primary'>%s</a>",
18
- $fs->contact_url( 'technical_support' ),
19
- __fs( 'contact-support', $slug )
20
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/forms/deactivation/form.php DELETED
@@ -1,311 +0,0 @@
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.2
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- $slug = $VARS['slug'];
14
- $fs = freemius( $slug );
15
-
16
- $confirmation_message = $fs->apply_filters( 'uninstall_confirmation_message', '' );
17
-
18
- $reasons = $VARS['reasons'];
19
-
20
- $reasons_list_items_html = '';
21
-
22
- foreach ( $reasons as $reason ) {
23
- $list_item_classes = 'reason' . ( ! empty( $reason['input_type'] ) ? ' has-input' : '' );
24
-
25
- if ( isset( $reason['internal_message'] ) && ! empty( $reason['internal_message'] ) ) {
26
- $list_item_classes .= ' has-internal-message';
27
- $reason_internal_message = $reason['internal_message'];
28
- } else {
29
- $reason_internal_message = '';
30
- }
31
-
32
- $reason_list_item_html = <<< HTML
33
- <li class="{$list_item_classes}"
34
- data-input-type="{$reason['input_type']}"
35
- data-input-placeholder="{$reason['input_placeholder']}">
36
- <label>
37
- <span>
38
- <input type="radio" name="selected-reason" value="{$reason['id']}"/>
39
- </span>
40
- <span>{$reason['text']}</span>
41
- </label>
42
- <div class="internal-message">{$reason_internal_message}</div>
43
- </li>
44
- HTML;
45
-
46
- $reasons_list_items_html .= $reason_list_item_html;
47
- }
48
-
49
- fs_enqueue_local_style( 'dialog-boxes', '/admin/dialog-boxes.css' );
50
- ?>
51
- <script type="text/javascript">
52
- (function ($) {
53
- var reasonsHtml = <?php echo json_encode( $reasons_list_items_html ); ?>,
54
- modalHtml =
55
- '<div class="fs-modal fs-modal-deactivation-feedback<?php echo empty( $confirmation_message ) ? ' no-confirmation-message' : ''; ?>">'
56
- + ' <div class="fs-modal-dialog">'
57
- + ' <div class="fs-modal-body">'
58
- + ' <div class="fs-modal-panel" data-panel-id="confirm"><p><?php echo $confirmation_message; ?></p></div>'
59
- + ' <div class="fs-modal-panel active" data-panel-id="reasons"><h3><strong><?php printf( __fs( 'deactivation-share-reason' , $slug ) ); ?>:</strong></h3><ul id="reasons-list">' + reasonsHtml + '</ul></div>'
60
- + ' </div>'
61
- + ' <div class="fs-modal-footer">'
62
- + ' <a href="#" class="button button-secondary button-deactivate"></a>'
63
- + ' <a href="#" class="button button-primary button-close"><?php printf( __fs( 'deactivation-modal-button-cancel' , $slug ) ); ?></a>'
64
- + ' </div>'
65
- + ' </div>'
66
- + '</div>',
67
- $modal = $(modalHtml),
68
- $deactivateLink = $('#the-list .deactivate > [data-slug=<?php echo $VARS['slug']; ?>].fs-slug').prev(),
69
- selectedReasonID = false;
70
-
71
- $modal.appendTo($('body'));
72
-
73
- registerEventHandlers();
74
-
75
- function registerEventHandlers() {
76
- $deactivateLink.click(function (evt) {
77
- evt.preventDefault();
78
-
79
- showModal();
80
- });
81
-
82
- $modal.on('input propertychange', '.reason-input input', function () {
83
- if (!isOtherReasonSelected()) {
84
- return;
85
- }
86
-
87
- var reason = $(this).val().trim();
88
-
89
- /**
90
- * If reason is not empty, remove the error-message class of the message container
91
- * to change the message color back to default.
92
- */
93
- if (reason.length > 0) {
94
- $('.message').removeClass('error-message');
95
- enableDeactivateButton();
96
- }
97
- });
98
-
99
- $modal.on('blur', '.reason-input input', function () {
100
- var $userReason = $(this);
101
-
102
- setTimeout(function () {
103
- if (!isOtherReasonSelected()) {
104
- return;
105
- }
106
-
107
- /**
108
- * If reason is empty, add the error-message class to the message container
109
- * to change the message color to red.
110
- */
111
- if (0 === $userReason.val().trim().length) {
112
- $('.message').addClass('error-message');
113
- disableDeactivateButton();
114
- }
115
- }, 150);
116
- });
117
-
118
- $modal.on('click', '.fs-modal-footer .button', function (evt) {
119
- evt.preventDefault();
120
-
121
- if ($(this).hasClass('disabled')) {
122
- return;
123
- }
124
-
125
- var _parent = $(this).parents('.fs-modal:first');
126
- var _this = $(this);
127
-
128
- if (_this.hasClass('allow-deactivate')) {
129
- var $radio = $('input[type="radio"]:checked');
130
-
131
- if (0 === $radio.length) {
132
- // If no selected reason, just deactivate the plugin.
133
- window.location.href = $deactivateLink.attr('href');
134
- return;
135
- }
136
-
137
- var $selected_reason = $radio.parents('li:first'),
138
- $input = $selected_reason.find('textarea, input[type="text"]'),
139
- userReason = ( 0 !== $input.length ) ? $input.val().trim() : '';
140
-
141
- if (isOtherReasonSelected() && ( '' === userReason )) {
142
- return;
143
- }
144
-
145
- $.ajax({
146
- url : ajaxurl,
147
- method : 'POST',
148
- data : {
149
- 'action' : 'submit-uninstall-reason',
150
- 'reason_id' : $radio.val(),
151
- 'reason_info': userReason
152
- },
153
- beforeSend: function () {
154
- _parent.find('.fs-modal-footer .button').addClass('disabled');
155
- _parent.find('.fs-modal-footer .button-secondary').text('Processing...');
156
- },
157
- complete : function () {
158
- // Do not show the dialog box, deactivate the plugin.
159
- window.location.href = $deactivateLink.attr('href');
160
- }
161
- });
162
- } else if (_this.hasClass('button-deactivate')) {
163
- // Change the Deactivate button's text and show the reasons panel.
164
- _parent.find('.button-deactivate').addClass('allow-deactivate');
165
-
166
- showPanel('reasons');
167
- }
168
- });
169
-
170
- $modal.on('click', 'input[type="radio"]', function () {
171
- var $selectedReasonOption = $(this);
172
-
173
- // If the selection has not changed, do not proceed.
174
- if (selectedReasonID === $selectedReasonOption.val())
175
- return;
176
-
177
- selectedReasonID = $selectedReasonOption.val();
178
-
179
- var _parent = $(this).parents('li:first');
180
-
181
- $modal.find('.reason-input').remove();
182
- $modal.find( '.internal-message' ).hide();
183
- $modal.find('.button-deactivate').text('<?php printf( __fs( 'deactivation-modal-button-submit' , $slug ) ); ?>');
184
-
185
- enableDeactivateButton();
186
-
187
- if ( _parent.hasClass( 'has-internal-message' ) ) {
188
- _parent.find( '.internal-message' ).show();
189
- }
190
-
191
- if (_parent.hasClass('has-input')) {
192
- var inputType = _parent.data('input-type'),
193
- inputPlaceholder = _parent.data('input-placeholder'),
194
- reasonInputHtml = '<div class="reason-input"><span class="message"></span>' + ( ( 'textfield' === inputType ) ? '<input type="text" />' : '<textarea rows="5"></textarea>' ) + '</div>';
195
-
196
- _parent.append($(reasonInputHtml));
197
- _parent.find('input, textarea').attr('placeholder', inputPlaceholder).focus();
198
-
199
- if (isOtherReasonSelected()) {
200
- showMessage('<?php printf( __fs( 'ask-for-reason-message' , $slug ) ); ?>');
201
- disableDeactivateButton();
202
- }
203
- }
204
- });
205
-
206
- // If the user has clicked outside the window, cancel it.
207
- $modal.on('click', function (evt) {
208
- var $target = $(evt.target);
209
-
210
- // If the user has clicked anywhere in the modal dialog, just return.
211
- if ($target.hasClass('fs-modal-body') || $target.hasClass('fs-modal-footer')) {
212
- return;
213
- }
214
-
215
- // If the user has not clicked the close button and the clicked element is inside the modal dialog, just return.
216
- if (!$target.hasClass('button-close') && ( $target.parents('.fs-modal-body').length > 0 || $target.parents('.fs-modal-footer').length > 0 )) {
217
- return;
218
- }
219
-
220
- closeModal();
221
- });
222
- }
223
-
224
- function isOtherReasonSelected() {
225
- // Get the selected radio input element.
226
- var $selectedReasonOption = $modal.find('input[type="radio"]:checked'),
227
- selectedReason = $selectedReasonOption.parent().next().text().trim();
228
-
229
- return ( 'Other' === selectedReason );
230
- }
231
-
232
- function showModal() {
233
- resetModal();
234
-
235
- // Display the dialog box.
236
- $modal.addClass('active');
237
-
238
- $('body').addClass('has-fs-modal');
239
- }
240
-
241
- function closeModal() {
242
- $modal.removeClass('active');
243
-
244
- $('body').removeClass('has-fs-modal');
245
- }
246
-
247
- function resetModal() {
248
- selectedReasonID = false;
249
-
250
- enableDeactivateButton();
251
-
252
- // Uncheck all radio buttons.
253
- $modal.find('input[type="radio"]').prop('checked', false);
254
-
255
- // Remove all input fields ( textfield, textarea ).
256
- $modal.find('.reason-input').remove();
257
-
258
- $modal.find('.message').hide();
259
-
260
- var $deactivateButton = $modal.find('.button-deactivate');
261
-
262
- /*
263
- * If the modal dialog has no confirmation message, that is, it has only one panel, then ensure
264
- * that clicking the deactivate button will actually deactivate the plugin.
265
- */
266
- if ($modal.hasClass('no-confirmation-message')) {
267
- $deactivateButton.addClass('allow-deactivate');
268
-
269
- showPanel('reasons');
270
- } else {
271
- $deactivateButton.removeClass('allow-deactivate');
272
-
273
- showPanel('confirm');
274
- }
275
- }
276
-
277
- function showMessage(message) {
278
- $modal.find('.message').text(message).show();
279
- }
280
-
281
- function enableDeactivateButton() {
282
- $modal.find('.button-deactivate').removeClass('disabled');
283
- }
284
-
285
- function disableDeactivateButton() {
286
- $modal.find('.button-deactivate').addClass('disabled');
287
- }
288
-
289
- function showPanel(panelType) {
290
- $modal.find('.fs-modal-panel').removeClass('active ');
291
- $modal.find('[data-panel-id="' + panelType + '"]').addClass('active');
292
-
293
- updateButtonLabels();
294
- }
295
-
296
- function updateButtonLabels() {
297
- var $deactivateButton = $modal.find('.button-deactivate');
298
-
299
- // Reset the deactivate button's text.
300
- if ('confirm' === getCurrentPanel()) {
301
- $deactivateButton.text('<?php printf( __fs( 'deactivation-modal-button-confirm' , $slug ) ); ?>');
302
- } else {
303
- $deactivateButton.text('<?php printf( __fs( 'skip-deactivate' , $slug ) ); ?>');
304
- }
305
- }
306
-
307
- function getCurrentPanel() {
308
- return $modal.find('.fs-modal-panel.active').attr('data-panel-id');
309
- }
310
- })(jQuery);
311
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/forms/deactivation/retry-skip.php DELETED
@@ -1,21 +0,0 @@
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.0
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- $slug = $VARS['slug'];
14
- $fs = freemius( $slug );
15
-
16
- $skip_url = wp_nonce_url( $fs->_get_admin_page_url( '', array( 'fs_action' => $slug . '_skip_activation' ) ), $slug . '_skip_activation' );
17
- $skip_text = strtolower( __fs( 'skip', $slug ) );
18
- $use_plugin_anonymously_text = __fs( 'click-here-to-use-plugin-anonymously', $slug );
19
-
20
- echo sprintf( __fs( 'dont-have-to-share-any-data', $slug ), "<a href='{$skip_url}'>{$skip_text}</a>" )
21
- . " <a href='{$skip_url}' class='button button-small button-secondary'>{$use_plugin_anonymously_text}</a>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/forms/license-activation.php DELETED
@@ -1,211 +0,0 @@
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.9
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- $slug = $VARS['slug'];
14
- $fs = freemius( $slug );
15
-
16
- // The URL to redirect to after successfully activating the license from the "Plugins" page.
17
- $sync_license_url = $VARS['sync-license-url'];
18
-
19
- $cant_find_license_key_text = __fs( 'cant-find-license-key', $slug );
20
- $message_above_input_field = __fs( 'activate-license-message', $slug );
21
- $message_below_input_field = '';
22
-
23
- if ( $fs->is_registered() ) {
24
- $activate_button_text = __fs( $fs->is_free_plan() ? 'activate-license' : 'update-license', $slug );
25
- } else {
26
- $freemius_site_url = $fs->has_paid_plan() ?
27
- 'https://freemius.com/wordpress/' :
28
- // Insights platform information.
29
- 'https://freemius.com/wordpress/usage-tracking/';
30
-
31
- $freemius_link = '<a href="' . $freemius_site_url . '" target="_blank">freemius.com</a>';
32
-
33
- $message_below_input_field = sprintf( __fs( 'license-sync-disclaimer', $slug ), $freemius_link );
34
-
35
- $activate_button_text = __fs( 'agree-activate-license', $slug );
36
- }
37
-
38
- $license_key_text = __fs( 'license-key' , $slug );
39
-
40
- $modal_content_html = <<< HTML
41
- <div class="notice notice-error inline license-activation-message"><p></p></div>
42
- <p>{$message_above_input_field}</p>
43
- <input class="license_key" type="text" placeholder="{$license_key_text}" />
44
- <a class="show-license-resend-modal show-license-resend-modal-{$slug}" href="#">{$cant_find_license_key_text}</a>
45
- <p>{$message_below_input_field}</p>
46
- HTML;
47
-
48
- fs_enqueue_local_style( 'dialog-boxes', '/admin/dialog-boxes.css' );
49
- ?>
50
- <script type="text/javascript">
51
- (function( $ ) {
52
- $( document ).ready(function() {
53
- var modalContentHtml = <?php echo json_encode($modal_content_html); ?>,
54
- modalHtml =
55
- '<div class="fs-modal fs-modal-license-activation">'
56
- + ' <div class="fs-modal-dialog">'
57
- + ' <div class="fs-modal-body">'
58
- + ' <div class="fs-modal-panel active">' + modalContentHtml + '</div>'
59
- + ' </div>'
60
- + ' <div class="fs-modal-footer">'
61
- + ' <a href="#" class="button button-secondary button-close"><?php _efs('deactivation-modal-button-cancel', $slug); ?></a>'
62
- + ' <a href="#" class="button button-primary button-activate-license"><?php echo $activate_button_text; ?></a>'
63
- + ' </div>'
64
- + ' </div>'
65
- + '</div>',
66
- $modal = $(modalHtml),
67
- $activateLicenseLink = $('span.activate-license.<?php echo $VARS['slug'] ?> a, .activate-license-trigger.<?php echo $VARS['slug'] ?>'),
68
- $activateLicenseButton = $modal.find('.button-activate-license'),
69
- $licenseKeyInput = $modal.find('input.license_key'),
70
- $licenseActivationMessage = $modal.find( '.license-activation-message' ),
71
- pluginSlug = '<?php echo $slug; ?>',
72
- syncLicenseUrl = '<?php echo $sync_license_url; ?>';
73
-
74
- $modal.appendTo($('body'));
75
-
76
- registerEventHandlers();
77
-
78
- function registerEventHandlers() {
79
- $activateLicenseLink.click(function (evt) {
80
- evt.preventDefault();
81
-
82
- showModal();
83
- });
84
-
85
- $modal.on('input propertychange', 'input.license_key', function () {
86
-
87
- var licenseKey = $(this).val().trim();
88
-
89
- /**
90
- * If license key is not empty, enable the license activation button.
91
- */
92
- if (licenseKey.length > 0) {
93
- enableActivateLicenseButton();
94
- }
95
- });
96
-
97
- $modal.on('blur', 'input.license_key', function () {
98
- var licenseKey = $(this).val().trim();
99
-
100
- /**
101
- * If license key is empty, disable the license activation button.
102
- */
103
- if (0 === licenseKey.length) {
104
- disableActivateLicenseButton();
105
- }
106
- });
107
-
108
- $modal.on('click', '.button', function (evt) {
109
- evt.preventDefault();
110
-
111
- if ($(this).hasClass('disabled')) {
112
- return;
113
- }
114
-
115
- var licenseKey = $licenseKeyInput.val().trim();
116
-
117
- disableActivateLicenseButton();
118
-
119
- if (0 === licenseKey.length) {
120
- return;
121
- }
122
-
123
- $.ajax({
124
- url: ajaxurl,
125
- method: 'POST',
126
- data: {
127
- action : 'activate_license',
128
- slug : pluginSlug,
129
- license_key: licenseKey
130
- },
131
- beforeSend: function () {
132
- $activateLicenseButton.text( '<?php _efs( 'activating-license', $slug ); ?>' );
133
- },
134
- success: function( result ) {
135
- var resultObj = $.parseJSON( result );
136
- if ( resultObj.success ) {
137
- closeModal();
138
-
139
- // Redirect to the "Account" page and sync the license.
140
- window.location.href = syncLicenseUrl;
141
- } else {
142
- showError( resultObj.error );
143
- resetActivateLicenseButton();
144
- }
145
- }
146
- });
147
- });
148
-
149
- // If the user has clicked outside the window, close the modal.
150
- $modal.on('click', function (evt) {
151
- var $target = $(evt.target);
152
-
153
- // If the user has clicked anywhere in the modal dialog, just return.
154
- if ($target.hasClass('fs-modal-body') || $target.hasClass('fs-modal-footer')) {
155
- return;
156
- }
157
-
158
- // If the user has not clicked the close button and the clicked element is inside the modal dialog, just return.
159
- if (( !$target.hasClass('button-close') ) && ( $target.parents('.fs-modal-body').length > 0 || $target.parents('.fs-modal-footer').length > 0 )) {
160
- return;
161
- }
162
-
163
- closeModal();
164
- });
165
- }
166
-
167
- function showModal() {
168
- resetModal();
169
-
170
- // Display the dialog box.
171
- $modal.addClass('active');
172
- $('body').addClass('has-fs-modal');
173
-
174
- $licenseKeyInput.focus();
175
- }
176
-
177
- function closeModal() {
178
- $modal.removeClass('active');
179
- $('body').removeClass('has-fs-modal');
180
- }
181
-
182
- function resetActivateLicenseButton() {
183
- enableActivateLicenseButton();
184
- $activateLicenseButton.text( '<?php echo $activate_button_text; ?>' );
185
- }
186
-
187
- function resetModal() {
188
- hideError();
189
- resetActivateLicenseButton();
190
- $licenseKeyInput.val( '' );
191
- }
192
-
193
- function enableActivateLicenseButton() {
194
- $activateLicenseButton.removeClass( 'disabled' );
195
- }
196
-
197
- function disableActivateLicenseButton() {
198
- $activateLicenseButton.addClass( 'disabled' );
199
- }
200
-
201
- function hideError() {
202
- $licenseActivationMessage.hide();
203
- }
204
-
205
- function showError( msg ) {
206
- $licenseActivationMessage.find( ' > p' ).html( msg );
207
- $licenseActivationMessage.show();
208
- }
209
- });
210
- })( jQuery );
211
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/forms/resend-key.php DELETED
@@ -1,203 +0,0 @@
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.0
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- $slug = $VARS['slug'];
14
- $fs = freemius( $slug );
15
-
16
- $message_above_input_field = __fs( 'ask-for-upgrade-email-address', $slug );
17
- $send_button_text = __fs( 'send-license-key', $slug );
18
- $cancel_button_text = __fs( 'deactivation-modal-button-cancel', $slug );
19
- $email_address_placeholder = __fs( 'email-address', $slug );
20
-
21
- $modal_content_html = <<< HTML
22
- <div class="notice notice-error inline license-resend-message"><p></p></div>
23
- <p>{$message_above_input_field}</p>
24
- <div class="input-container">
25
- <div class="button-container">
26
- <a href="#" class="button button-primary button-send-license-key disabled">{$send_button_text}</a>
27
- </div>
28
- <div class="email-address-container">
29
- <input class="email-address" type="text" placeholder="{$email_address_placeholder}">
30
- </div>
31
- </div>
32
- HTML;
33
-
34
- fs_enqueue_local_style( 'dialog-boxes', '/admin/dialog-boxes.css' );
35
- ?>
36
- <script type="text/javascript">
37
- (function ($) {
38
- $(document).ready(function () {
39
- var modalContentHtml = <?php echo json_encode( $modal_content_html ); ?>,
40
- modalHtml =
41
- '<div class="fs-modal fs-modal-license-key-resend">'
42
- + ' <div class="fs-modal-dialog">'
43
- + ' <a class="button-close">✖</a>'
44
- + ' <div class="fs-modal-body">'
45
- + ' <div class="fs-modal-panel active">' + modalContentHtml + '</div>'
46
- + ' </div>'
47
- + ' </div>'
48
- + '</div>',
49
- $modal = $(modalHtml),
50
- $sendLicenseKeyButton = $modal.find('.button-send-license-key'),
51
- $emailAddressInput = $modal.find('input.email-address'),
52
- $licenseResendMessage = $modal.find('.license-resend-message'),
53
- moduleSlug = '<?php echo $slug; ?>',
54
- isChild = false;
55
-
56
- $modal.appendTo($('body'));
57
-
58
- registerEventHandlers();
59
-
60
- function registerEventHandlers() {
61
- $('a.show-license-resend-modal-' + moduleSlug).click(function (evt) {
62
- evt.preventDefault();
63
-
64
- showModal();
65
- });
66
-
67
- $modal.on('input propertychange', 'input.email-address', function () {
68
-
69
- var emailAddress = $(this).val().trim();
70
-
71
- /**
72
- * If email address is not empty, enable the send license key button.
73
- */
74
- if (emailAddress.length > 0) {
75
- enableSendLicenseKeyButton();
76
- }
77
- });
78
-
79
- $modal.on('blur', 'input.email-address', function () {
80
- var emailAddress = $(this).val().trim();
81
-
82
- /**
83
- * If email address is empty, disable the send license key button.
84
- */
85
- if (0 === emailAddress.length) {
86
- disableSendLicenseKeyButton();
87
- }
88
- });
89
-
90
- $modal.on('click', '.button', function (evt) {
91
- evt.preventDefault();
92
-
93
- if ($(this).hasClass('disabled')) {
94
- return;
95
- }
96
-
97
- if ($(this).hasClass('button-close')) {
98
- closeModal();
99
- return;
100
- }
101
-
102
- var emailAddress = $emailAddressInput.val().trim();
103
-
104
- disableSendLicenseKeyButton();
105
-
106
- if (0 === emailAddress.length) {
107
- return;
108
- }
109
-
110
- $.ajax({
111
- url : ajaxurl,
112
- method : 'POST',
113
- data : {
114
- action: 'resend_license_key',
115
- slug : moduleSlug,
116
- email : emailAddress
117
- },
118
- beforeSend: function () {
119
- $sendLicenseKeyButton.text('<?php _efs( 'sending-license-key', $slug ) ?>...');
120
- },
121
- success : function (result) {
122
- var resultObj = $.parseJSON(result);
123
- if (resultObj.success) {
124
- closeModal();
125
- } else {
126
- showError(resultObj.error);
127
- resetSendLicenseKeyButton();
128
- }
129
- }
130
- });
131
- });
132
-
133
- // If the user has clicked outside the window, close the modal.
134
- $modal.on('click', function (evt) {
135
- var $target = $(evt.target);
136
-
137
- // If the user has clicked anywhere in the modal dialog, just return.
138
- if ($target.hasClass('fs-modal-body') || $target.parents('.fs-modal-body').length > 0) {
139
- return;
140
- }
141
-
142
- closeModal();
143
- });
144
- }
145
-
146
- function showModal() {
147
- resetModal();
148
-
149
- // Display the dialog box.
150
- $modal.addClass('active');
151
- $emailAddressInput.focus();
152
-
153
- var $body = $('body');
154
-
155
- isChild = $body.hasClass('has-fs-modal');
156
- if (isChild) {
157
- return;
158
- }
159
-
160
- $body.addClass('has-fs-modal');
161
- }
162
-
163
- function closeModal() {
164
- $modal.removeClass('active');
165
-
166
- // If child modal, do not remove the "has-fs-modal" class of the <body> element to keep its scrollbars hidden.
167
- if (isChild) {
168
- return;
169
- }
170
-
171
- $('body').removeClass('has-fs-modal');
172
- }
173
-
174
- function resetSendLicenseKeyButton() {
175
- enableSendLicenseKeyButton();
176
- $sendLicenseKeyButton.text('<?php echo $send_button_text; ?>');
177
- }
178
-
179
- function resetModal() {
180
- hideError();
181
- resetSendLicenseKeyButton();
182
- $emailAddressInput.val('');
183
- }
184
-
185
- function enableSendLicenseKeyButton() {
186
- $sendLicenseKeyButton.removeClass('disabled');
187
- }
188
-
189
- function disableSendLicenseKeyButton() {
190
- $sendLicenseKeyButton.addClass('disabled');
191
- }
192
-
193
- function hideError() {
194
- $licenseResendMessage.hide();
195
- }
196
-
197
- function showError(msg) {
198
- $licenseResendMessage.find(' > p').html(msg);
199
- $licenseResendMessage.show();
200
- }
201
- });
202
- })(jQuery);
203
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/plugin-icon.php DELETED
@@ -1,93 +0,0 @@
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
- $slug = $VARS['slug'];
14
- $fs = freemius( $slug );
15
-
16
- /**
17
- * @since 1.1.7.5
18
- */
19
- $local_path = $fs->apply_filters( 'plugin_icon', false );
20
-
21
- if ( is_string( $local_path ) ) {
22
- $icons = array( $local_path );
23
- } else {
24
- global $fs_active_plugins;
25
-
26
- $img_dir = WP_FS__DIR_IMG;
27
-
28
- if ( 1 < count( $fs_active_plugins->plugins ) ) {
29
- foreach ( $fs_active_plugins->plugins as $sdk_path => &$data ) {
30
- if ( $data->plugin_path == $fs->get_plugin_basename() ) {
31
- $img_dir = WP_PLUGIN_DIR . '/' . $sdk_path . '/assets/img';
32
- break;
33
- }
34
- }
35
- }
36
-
37
- $icons = glob( fs_normalize_path( $img_dir . '/' . $slug . '.*' ) );
38
- if ( ! is_array( $icons ) || 0 === count( $icons ) ) {
39
- $icon_found = false;
40
- $local_path = fs_normalize_path( $img_dir . '/' . $slug . '.png' );
41
- $have_write_permissions = is_writable( fs_normalize_path( $img_dir ) );
42
-
43
- if ( WP_FS__IS_LOCALHOST && $fs->is_org_repo_compliant() && $have_write_permissions ) {
44
- /**
45
- * IMPORTANT: THIS CODE WILL NEVER RUN AFTER THE PLUGIN IS IN THE REPO.
46
- *
47
- * This code will only be executed once during the testing
48
- * of the plugin in a local environment. The plugin icon file WILL
49
- * already exist in the assets folder when the plugin is deployed to
50
- * the repository.
51
- */
52
- $suffixes = array(
53
- '-128x128.png',
54
- '-128x128.jpg',
55
- '-256x256.png',
56
- '-256x256.jpg',
57
- '.svg',
58
- );
59
-
60
- $base_url = 'https://plugins.svn.wordpress.org/' . $slug . '/assets/icon';
61
-
62
- foreach ( $suffixes as $s ) {
63
- $headers = get_headers( $base_url . $s );
64
- if ( strpos( $headers[0], '200' ) ) {
65
- $local_path = fs_normalize_path( $img_dir . '/' . $slug . '.' . substr( $s, strpos( $s, '.' ) + 1 ) );
66
- fs_download_image( $base_url . $s, $local_path );
67
- $icon_found = true;
68
- break;
69
- }
70
- }
71
- }
72
-
73
- if ( ! $icon_found ) {
74
- // No icons found, fallback to default icon.
75
- if ( $have_write_permissions ) {
76
- // If have write permissions, copy default icon.
77
- copy( fs_normalize_path( $img_dir . '/plugin-icon.png' ), $local_path );
78
- } else {
79
- // If doesn't have write permissions, use default icon path.
80
- $local_path = fs_normalize_path( $img_dir . '/plugin-icon.png' );
81
- }
82
- }
83
-
84
- $icons = array( $local_path );
85
- }
86
- }
87
-
88
- $icon_dir = dirname( $icons[0] );
89
- $relative_url = fs_img_url( substr( $icons[0], strlen( $icon_dir ) ), $icon_dir );
90
- ?>
91
- <div class="fs-plugin-icon">
92
- <img src="<?php echo $relative_url ?>" width="80" height="80" />
93
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/plugin-info/description.php DELETED
@@ -1,75 +0,0 @@
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
- /**
14
- * @var FS_Plugin $plugin
15
- */
16
- $plugin = $VARS['plugin'];
17
-
18
- if ( ! empty( $plugin->info->selling_point_0 ) ||
19
- ! empty( $plugin->info->selling_point_1 ) ||
20
- ! empty( $plugin->info->selling_point_2 )
21
- ) : ?>
22
- <div class="fs-selling-points">
23
- <ul>
24
- <?php for ( $i = 0; $i < 3; $i ++ ) : ?>
25
- <?php if ( ! empty( $plugin->info->{'selling_point_' . $i} ) ) : ?>
26
- <li><i class="dashicons dashicons-yes"></i>
27
-
28
- <h3><?php echo $plugin->info->{'selling_point_' . $i} ?></h3></li>
29
- <?php endif ?>
30
- <?php endfor ?>
31
- </ul>
32
- </div>
33
- <?php endif ?>
34
- <div>
35
- <?php
36
- echo wp_kses( $plugin->info->description, array(
37
- 'a' => array( 'href' => array(), 'title' => array(), 'target' => array() ),
38
- 'b' => array(),
39
- 'i' => array(),
40
- 'p' => array(),
41
- 'blockquote' => array(),
42
- 'h2' => array(),
43
- 'h3' => array(),
44
- 'ul' => array(),
45
- 'ol' => array(),
46
- 'li' => array()
47
- ) );
48
- ?>
49
- </div>
50
- <?php if ( ! empty( $plugin->info->screenshots ) ) : ?>
51
- <?php $screenshots = $plugin->info->screenshots ?>
52
- <div class="fs-screenshots clearfix">
53
- <h2><?php _efs( 'screenshots', $plugin->slug ) ?></h2>
54
- <ul>
55
- <?php $i = 0;
56
- foreach ( $screenshots as $s => $url ) : ?>
57
- <?php
58
- // Relative URLs are replaced with WordPress.org base URL
59
- // therefore we need to set absolute URLs.
60
- $url = 'http' . ( WP_FS__IS_HTTPS ? 's' : '' ) . ':' . $url; ?>
61
- <li class="<?php echo ( 0 === $i % 2 ) ? 'odd' : 'even' ?>">
62
- <style>
63
- #section-description .fs-screenshots <?php echo ".fs-screenshot-{$i}" ?>
64
- {
65
- background-image: url('<?php echo $url ?>');
66
- }
67
- </style>
68
- <a href="<?php echo $url ?>"
69
- title="<?php printf( __fs( 'view-full-size-x', $plugin->slug ), $i ) ?>"
70
- class="fs-screenshot-<?php echo $i ?>"></a>
71
- </li>
72
- <?php $i ++; endforeach ?>
73
- </ul>
74
- </div>
75
- <?php endif ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/plugin-info/features.php DELETED
@@ -1,97 +0,0 @@
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
- /**
14
- * @var FS_Plugin $plugin
15
- */
16
- $plugin = $VARS['plugin'];
17
-
18
- $plans = $VARS['plans'];
19
-
20
- $features_plan_map = array();
21
- foreach ( $plans as $plan ) {
22
- foreach ( $plan->features as $feature ) {
23
- if ( ! isset( $features_plan_map[ $feature->id ] ) ) {
24
- $features_plan_map[ $feature->id ] = array( 'feature' => $feature, 'plans' => array() );
25
- }
26
-
27
- $features_plan_map[ $feature->id ]['plans'][ $plan->id ] = $feature;
28
- }
29
-
30
- // Add support as a feature.
31
- if ( ! empty( $plan->support_email ) ||
32
- ! empty( $plan->support_skype ) ||
33
- ! empty( $plan->support_phone ) ||
34
- true === $plan->is_success_manager
35
- ) {
36
- if ( ! isset( $features_plan_map['support'] ) ) {
37
- $support_feature = new stdClass();
38
- $support_feature->id = 'support';
39
- $support_feature->title = __fs( 'Support', $plugin->slug );
40
- $features_plan_map[ $support_feature->id ] = array( 'feature' => $support_feature, 'plans' => array() );
41
- } else {
42
- $support_feature = $features_plan_map['support'];
43
- }
44
-
45
- $features_plan_map[ $support_feature->id ]['plans'][ $plan->id ] = $support_feature;
46
- }
47
- }
48
-
49
- // Add updates as a feature for all plans.
50
- $updates_feature = new stdClass();
51
- $updates_feature->id = 'updates';
52
- $updates_feature->title = __fs( 'unlimited-updates', $plugin->slug );
53
- $features_plan_map[ $updates_feature->id ] = array( 'feature' => $updates_feature, 'plans' => array() );
54
- foreach ( $plans as $plan ) {
55
- $features_plan_map[ $updates_feature->id ]['plans'][ $plan->id ] = $updates_feature;
56
- }
57
- ?>
58
- <div class="fs-features">
59
- <table>
60
- <thead>
61
- <tr>
62
- <th></th>
63
- <?php foreach ( $plans as $plan ) : ?>
64
- <th>
65
- <?php echo $plan->title ?>
66
- <span class="fs-price">
67
- <?php foreach ( $plan->pricing as $pricing ) : ?>
68
- <?php if ( 1 == $pricing->licenses ) : ?>
69
- $<?php echo $pricing->annual_price ?> / year
70
- <?php endif ?>
71
- <?php endforeach ?>
72
- </span>
73
- </th>
74
- <?php endforeach ?>
75
- </tr>
76
- </thead>
77
- <tbody>
78
- <?php $odd = true;
79
- foreach ( $features_plan_map as $feature_id => $data ) : ?>
80
- <tr class="fs-<?php echo $odd ? 'odd' : 'even' ?>">
81
- <td><?php echo ucfirst( $data['feature']->title ) ?></td>
82
- <?php foreach ( $plans as $plan ) : ?>
83
- <td>
84
- <?php if ( isset( $data['plans'][ $plan->id ] ) ) : ?>
85
- <?php if ( ! empty( $data['plans'][ $plan->id ]->value ) ) : ?>
86
- <b><?php echo $data['plans'][ $plan->id ]->value ?></b>
87
- <?php else : ?>
88
- <i class="dashicons dashicons-yes"></i>
89
- <?php endif ?>
90
- <?php endif ?>
91
- </td>
92
- <?php endforeach ?>
93
- </tr>
94
- <?php $odd = ! $odd; endforeach ?>
95
- </tbody>
96
- </table>
97
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/plugin-info/screenshots.php DELETED
@@ -1,33 +0,0 @@
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
- /**
14
- * @var FS_Plugin $plugin
15
- */
16
- $plugin = $VARS['plugin'];
17
-
18
- $screenshots = $VARS['screenshots'];
19
- ?>
20
- <ol>
21
- <?php $i = 0;
22
- foreach ( $screenshots as $s => $url ) : ?>
23
- <?php
24
- // Relative URLs are replaced with WordPress.org base URL
25
- // therefore we need to set absolute URLs.
26
- $url = 'http' . ( WP_FS__IS_HTTPS ? 's' : '' ) . ':' . $url; ?>
27
- <li>
28
- <a href="<?php echo $url ?>"
29
- title="<?php printf( __fs( 'view-full-size-x', $plugin->slug ), $i ) ?>"><img
30
- src="<?php echo $url ?>"></a>
31
- </li>
32
- <?php $i ++; endforeach ?>
33
- </ol>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/powered-by.php DELETED
@@ -1,39 +0,0 @@
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 DELETED
@@ -1,108 +0,0 @@
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
- $slug = $VARS['slug'];
19
- $fs = freemius( $slug );
20
- $timestamp = time();
21
-
22
- $context_params = array(
23
- 'plugin_id' => $fs->get_id(),
24
- 'plugin_public_key' => $fs->get_public_key(),
25
- 'plugin_version' => $fs->get_plugin_version(),
26
- );
27
-
28
- // Get site context secure params.
29
- if ( $fs->is_registered() ) {
30
- $context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
31
- $fs->get_site(),
32
- $timestamp,
33
- 'upgrade'
34
- ) );
35
- }
36
-
37
- if ( $fs->is_payments_sandbox() ) // Append plugin secure token for sandbox mode authentication.)
38
- {
39
- $context_params['sandbox'] = FS_Security::instance()->get_secure_token(
40
- $fs->get_plugin(),
41
- $timestamp,
42
- 'checkout'
43
- );
44
- }
45
-
46
- $query_params = array_merge( $context_params, $_GET, array(
47
- 'next' => $fs->_get_sync_license_url( false, false ),
48
- 'plugin_version' => $fs->get_plugin_version(),
49
- // Billing cycle.
50
- 'billing_cycle' => fs_request_get( 'billing_cycle', WP_FS__PERIOD_ANNUALLY ),
51
- ) );
52
- ?>
53
-
54
- <div id="fs_pricing" class="wrap" style="margin: 0 0 -65px -20px;">
55
- <div id="iframe"></div>
56
- <form action="" method="POST">
57
- <input type="hidden" name="user_id"/>
58
- <input type="hidden" name="user_email"/>
59
- <input type="hidden" name="site_id"/>
60
- <input type="hidden" name="public_key"/>
61
- <input type="hidden" name="secret_key"/>
62
- <input type="hidden" name="action" value="account"/>
63
- </form>
64
-
65
- <script type="text/javascript">
66
- (function ($, undef) {
67
- $(function () {
68
- var
69
- // Keep track of the iframe height.
70
- iframe_height = 800,
71
- base_url = '<?php echo WP_FS__ADDRESS ?>',
72
- // Pass the parent page URL into the Iframe in a meaningful way (this URL could be
73
- // passed via query string or hard coded into the child page, it depends on your needs).
74
- src = base_url + '/pricing/?<?php echo http_build_query($query_params) ?>#' + encodeURIComponent(document.location.href),
75
-
76
- // Append the Iframe into the DOM.
77
- iframe = $('<iframe " src="' + src + '" width="100%" height="' + iframe_height + 'px" scrolling="no" frameborder="0" style="background: transparent;"><\/iframe>')
78
- .appendTo('#iframe');
79
-
80
- FS.PostMessage.init(base_url);
81
-
82
- FS.PostMessage.receive('height', function (data) {
83
- var h = data.height;
84
- if (!isNaN(h) && h > 0 && h != iframe_height) {
85
- iframe_height = h;
86
- $("#iframe iframe").height(iframe_height + 'px');
87
- }
88
- });
89
-
90
- FS.PostMessage.receive('get_dimensions', function (data) {
91
- FS.PostMessage.post('dimensions', {
92
- height : $(document.body).height(),
93
- scrollTop: $(document).scrollTop()
94
- }, iframe[0]);
95
- });
96
- });
97
- })(jQuery);
98
- </script>
99
- </div>
100
- <?php
101
- $params = array(
102
- 'page' => 'pricing',
103
- 'module_id' => $fs->get_id(),
104
- 'module_slug' => $slug,
105
- 'module_version' => $fs->get_plugin_version(),
106
- );
107
- fs_require_template( 'powered-by.php', $params );
108
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
freemius/templates/sticky-admin-notice-js.php DELETED
@@ -1,40 +0,0 @@
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: slug + '_dismiss_notice_action',
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>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/enqueue.php CHANGED
@@ -5,6 +5,7 @@ if ( ! function_exists ( 'wpinked_so_admin_style' ) ) :
5
  function wpinked_so_admin_style() {
6
 
7
  wp_enqueue_style( 'iw-admin-style', plugin_dir_url( __FILE__ ) . '../css/admin.css', array(), INKED_SO_VER );
 
8
 
9
  }
10
  endif;
5
  function wpinked_so_admin_style() {
6
 
7
  wp_enqueue_style( 'iw-admin-style', plugin_dir_url( __FILE__ ) . '../css/admin.css', array(), INKED_SO_VER );
8
+ wp_enqueue_style( 'iw-admin-page-style', plugin_dir_url( __FILE__ ) . '../admin/admin.css', array(), INKED_SO_VER );
9
 
10
  }
11
  endif;
inc/functions.php CHANGED
@@ -107,7 +107,7 @@ function wpinked_so_blog_navigation( $query, $navigation, $type, $attr, $previou
107
  endif;
108
 
109
  if ( ! function_exists ( 'wpinked_so_blog_navigation_ajax' ) ) :
110
- function wpinked_so_blog_navigation_ajax( $navigation, $type, $id ) {
111
 
112
  if ( $navigation && $type == 'ajax' ): ?>
113
 
@@ -115,7 +115,7 @@ function wpinked_so_blog_navigation_ajax( $navigation, $type, $id ) {
115
  jQuery(document).ready(function(){
116
  // AJAX pagination
117
  jQuery(function($) {
118
- $( '#<?php echo $id; ?>' ).parent( '.iw-so-blog' ).on( 'click', '#iw-so-blog-pagination.iw-so-navi-ajax a', function(e){
119
  e.preventDefault();
120
  var link = $(this).attr( 'href' );
121
  $( '#<?php echo $id; ?>' ).parent().fadeOut(300, function(){
@@ -195,3 +195,43 @@ function wpinked_so_unique_id() {
195
  return mt_rand(1111, 9999) . '-' . mt_rand(1111, 9999) . '-' . mt_rand(1111, 9999);
196
  }
197
  endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  endif;
108
 
109
  if ( ! function_exists ( 'wpinked_so_blog_navigation_ajax' ) ) :
110
+ function wpinked_so_blog_navigation_ajax( $navigation, $type, $id, $parent_class = 'iw-so-blog' ) {
111
 
112
  if ( $navigation && $type == 'ajax' ): ?>
113
 
115
  jQuery(document).ready(function(){
116
  // AJAX pagination
117
  jQuery(function($) {
118
+ $( '#<?php echo $id; ?>' ).parent( '.<?php echo $parent_class; ?>' ).on( 'click', '#iw-so-blog-pagination.iw-so-navi-ajax a', function(e){
119
  e.preventDefault();
120
  var link = $(this).attr( 'href' );
121
  $( '#<?php echo $id; ?>' ).parent().fadeOut(300, function(){
195
  return mt_rand(1111, 9999) . '-' . mt_rand(1111, 9999) . '-' . mt_rand(1111, 9999);
196
  }
197
  endif;
198
+
199
+ /* Convert hexdec color string to rgb(a) string */
200
+
201
+ function wpinked_hex2rgba($color, $opacity = false) {
202
+
203
+ $default = 'rgb(0,0,0)';
204
+
205
+ //Return default if no color provided
206
+ if(empty($color))
207
+ return $default;
208
+
209
+ //Sanitize $color if "#" is provided
210
+ if ($color[0] == '#' ) {
211
+ $color = substr( $color, 1 );
212
+ }
213
+
214
+ //Check if color has 6 or 3 characters and get values
215
+ if (strlen($color) == 6) {
216
+ $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );
217
+ } elseif ( strlen( $color ) == 3 ) {
218
+ $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
219
+ } else {
220
+ return $default;
221
+ }
222
+
223
+ //Convert hexadec to rgb
224
+ $rgb = array_map('hexdec', $hex);
225
+
226
+ //Check if opacity is set(rgba or rgb)
227
+ if($opacity){
228
+ if(abs($opacity) > 1)
229
+ $opacity = 1.0;
230
+ $output = 'rgba('.implode(",",$rgb).','.$opacity.')';
231
+ } else {
232
+ $output = 'rgb('.implode(",",$rgb).')';
233
+ }
234
+
235
+ //Return rgb(a) color string
236
+ return $output;
237
+ }
inc/template-functions.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Display the testimonial template
5
+ */
6
+ if ( ! function_exists ( 'wpinked_so_testimonial_template' ) ) :
7
+ function wpinked_so_testimonial_template( $name, $testimonial, $styling ) {
8
+
9
+ if ( in_array( $styling['design'], array( 'by-above', 'by-below' ), true ) ) : ?>
10
+
11
+ <div class="iw-so-testimonial <?php echo 'iw-so-testimonial-' . $styling['design']; ?>">
12
+
13
+ <?php if ( ( $styling['design'] == 'by-above' ) ) : ?>
14
+ <div class="iw-so-testimonial-byline iw-so-testi-<?php echo $styling['text'] ?>">
15
+ <div class="iw-so-testimonial-byline-wrapper<?php echo ( $testimonial['image'] ? ' iw-so-testimonial-has-image' : '' ) ?>">
16
+ <?php echo wp_get_attachment_image( $testimonial['image'], array( '50', '50' ) ); ?>
17
+ <?php wpinked_so_testimonial_name( $name, $testimonial['company'], $testimonial['link'], $testimonial['target'], 'iw-text-left' ); ?>
18
+ </div>
19
+ </div>
20
+ <?php endif; ?>
21
+
22
+ <div class="iw-so-testimonial-content">
23
+ <?php if ( $testimonial['content'] ) : ?>
24
+ <div class="iw-so-testimonial-message <?php echo $testimonial['text']; ?>"><?php echo do_shortcode( $testimonial['content'] ); ?></div>
25
+ <?php endif; ?>
26
+ </div>
27
+
28
+ <?php if ( ( $styling['design'] == 'by-below' ) ) : ?>
29
+ <div class="iw-so-testimonial-byline iw-so-testi-<?php echo $styling['text'] ?>">
30
+ <div class="iw-so-testimonial-byline-wrapper<?php echo ( $testimonial['image'] ? ' iw-so-testimonial-has-image' : '' ) ?>">
31
+ <?php echo wp_get_attachment_image( $testimonial['image'], array( '50', '50' ) ); ?>
32
+ <?php wpinked_so_testimonial_name( $name, $testimonial['company'], $testimonial['link'], $testimonial['target'], 'iw-text-left' ); ?>
33
+ </div>
34
+ </div>
35
+ <?php endif; ?>
36
+
37
+ </div>
38
+
39
+ <?php else : ?>
40
+
41
+ <div class="iw-so-testimonial <?php echo 'iw-so-testimonial-' . $styling['design']; ?>">
42
+
43
+ <?php if ( $testimonial['image'] && ( $styling['design'] == 'above' || $styling['design'] == 'left' || $styling['design'] == 'right' ) ) : ?>
44
+ <div class="iw-so-testimonial-img">
45
+ <?php echo wp_get_attachment_image( $testimonial['image'], 'full' ); ?>
46
+ </div>
47
+ <?php endif; ?>
48
+
49
+ <div class="iw-so-testimonial-content">
50
+ <?php if ( $testimonial['content'] ) : ?>
51
+ <div class="iw-so-testimonial-message <?php echo $testimonial['text']; ?>"><?php echo do_shortcode( $testimonial['content'] ); ?></div>
52
+ <?php endif; ?>
53
+ <?php if ( $testimonial['image'] && ( $styling['design'] == 'between' ) ) : ?>
54
+ <div class="iw-so-testimonial-img">
55
+ <?php echo wp_get_attachment_image( $testimonial['image'], 'full' ); ?>
56
+ </div>
57
+ <?php endif; ?>
58
+ <?php wpinked_so_testimonial_name( $name, $testimonial['company'], $testimonial['link'], $testimonial['target'], $styling['text'] ); ?>
59
+ </div>
60
+
61
+ <?php if ( $testimonial['image'] && ( $styling['design'] == 'below' ) ) : ?>
62
+ <div class="iw-so-testimonial-img">
63
+ <?php echo wp_get_attachment_image( $testimonial['image'], 'full' ); ?>
64
+ </div>
65
+ <?php endif; ?>
66
+
67
+ </div>
68
+
69
+ <?php endif;
70
+
71
+ }
72
+ endif;
73
+
74
+ /*
75
+ * Display the person template
76
+ */
77
+ if ( ! function_exists ( 'wpinked_so_person_template' ) ) :
78
+ function wpinked_so_person_template( $name, $person, $social, $styling ) { ?>
79
+
80
+ <div class="iw-so-person <?php echo ( $styling['img-width'] == false ? 'iw-so-person-fit' : '' ) ?> iw-so-person-<?php echo $styling['layout'] ?>">
81
+
82
+ <div class="iw-so-person-img">
83
+ <?php echo wp_get_attachment_image( $person['image'], 'full' ); ?>
84
+ <div class="iw-so-person-ol">
85
+ <?php if( $styling['design'] == 'about' ) : ?>
86
+ <p class="iw-so-person-about <?php echo esc_attr( $styling['align'] );?>"><?php echo wp_kses_post( $person['about'] ); ?></p>
87
+ <?php endif; ?>
88
+ <?php if( $styling['design'] == 'icons' ) : ?>
89
+ <?php wpinked_so_person_social( $social['profiles'], $styling['align'], $social['target'] ); ?>
90
+ <?php endif; ?>
91
+ </div>
92
+ </div>
93
+
94
+ <div class="iw-so-person-content">
95
+ <h4 class="iw-so-person-name <?php echo esc_attr( $styling['align'] );?>"><?php echo esc_html( $name ); ?></h4>
96
+ <p class="iw-so-person-desig <?php echo esc_attr( $styling['align'] );?>"><?php echo esc_html( $person['designation'] ); ?></p>
97
+ <?php if( $styling['design'] != 'about' ) : ?>
98
+ <p class="iw-so-person-about <?php echo esc_attr( $styling['align'] );?>"><?php echo wp_kses_post( $person['about'] ); ?></p>
99
+ <?php endif; ?>
100
+ <?php if( $styling['design'] != 'icons' ) : ?>
101
+ <?php wpinked_so_person_social( $social['profiles'], $styling['align'], $social['target'] ); ?>
102
+ <?php endif; ?>
103
+ </div>
104
+
105
+ </div>
106
+
107
+ <?php }
108
+ endif;
readme.txt CHANGED
@@ -2,42 +2,53 @@
2
  Contributors: iamadi
3
  Tags: bundle, widget, button, alert, accordion, audio, video, blog, divider, person, portfolio, tabs, testimonial, siteorigin
4
  Requires at least: 3.9
5
- Tested up to: 4.5.3
6
- Stable tag: 1.2.4
7
  License: GPLv3 or later
8
 
9
  A collection of highly customizable and thoughtfully crafted widgets. Built on top of the SiteOrigin Widgets Bundle.
10
 
11
  == Description ==
12
 
13
- Widgets for SiteOrigin is a bundle of customizable, lightweight and responsive building blocks that can be used either with [SiteOrigin Page Builder](https://wordpress.org/plugins/siteorigin-panels/) or any other widgetized area.
14
 
15
  Included widgets
16
 
17
- * Blog Widget to display blog posts.
18
- * Portfolio Widget to show off your work.
19
- * Tabs Widget to organize and navigate content.
20
- * Accordion Widget to breakup your content into logical sections.
21
- * Filter Accordion to create animated sections of collapsable content.
22
- * Audio Widget to play self or externally hosted audios.
23
- * Video Widget to play self or externally hosted videos.
24
- * Media Box to highlight important bits of info.
25
- * Testimonial Widget to highlight what your customers think of you.
26
- * Person Widget to get to know you better.
27
- * Pricing table Widget to add eye catching pricing lists.
28
- * Slider Widget to leave an impression.
29
- * Alert Widget to communicate success, warnings, failure or just information.
30
- * Number Counter Widget to display your stats.
31
- * Circle Counter Widget to display your stats with animated circles.
32
- * Bar Counter Widget to display your stats with animated bars.
33
- * Divider Widget to draw separators or create gaps in your page.
34
- * Button Widget to harness the power of click.
35
 
36
  Additional Feature:
37
 
38
- * Visibility to show/hide widgets and rows based on screen width and orientation.
39
 
40
- Check out <a target="_blank" href="http://widgets.wpinked.com/">demos and docs</a>.
 
 
 
 
 
 
 
 
 
 
 
41
 
42
  == Installation ==
43
 
@@ -47,13 +58,24 @@ Upload and install these plugins.
47
  1. Widgets for SiteOrigin
48
  2. [Jetpack by WordPress.com](https://wordpress.org/plugins/jetpack/). **Optional** The portfolio widget is built using the **Custom Content Types** module. Activate if you are using the Portfolio Widget
49
 
 
 
50
  == Screenshots ==
51
 
52
  1. Manage which widgets you want enabled or disabled.
53
- 2. Control the visibility of your widgets and rows.
54
 
55
  == Changelog ==
56
 
 
 
 
 
 
 
 
 
 
 
57
  = 1.2.4 - August 23 2016 =
58
  * Compatibility with WP 4.6
59
  * Added image slider widget
2
  Contributors: iamadi
3
  Tags: bundle, widget, button, alert, accordion, audio, video, blog, divider, person, portfolio, tabs, testimonial, siteorigin
4
  Requires at least: 3.9
5
+ Tested up to: 4.6.1
6
+ Stable tag: 1.3.0
7
  License: GPLv3 or later
8
 
9
  A collection of highly customizable and thoughtfully crafted widgets. Built on top of the SiteOrigin Widgets Bundle.
10
 
11
  == Description ==
12
 
13
+ Widgets for SiteOrigin is a bundle of customizable, lightweight and responsive building blocks that can be used to create exciting digital experiences. The widgets can be use with either the [SiteOrigin Page Builder](https://wordpress.org/plugins/siteorigin-panels/) or any other widgetized area.
14
 
15
  Included widgets
16
 
17
+ * Blog Widget can be placed anywhere on your site and can use any of our five highly customizable design layouts. You can combine the variations of the available settings to create appealing magazine or news pages. You can create custom archives using the handy navigation feature.
18
+ * Portfolio Widget allows you to show off your work in a neat grid. The widget makes use of an optional customizable project type filter. When a project type is selected, only the projects from that category are listed. The projects can be displayed with either the default or gallery designs.
19
+ * Tabs Widget looks great inside any sized column. On smaller screens the tabs buttons stack up and are easy to use. Further customization is possible with the use of icons for each tab.
20
+ * Accordion widget allows you to compartmentalize information and improve user experience on your site. Logically very similar to the tabs widget, the accordion stacks items in a vertical list. This widget also doubles up as a toggle widget by checking the option to open multiple toggles at once.
21
+ * Filter Accordion Widget extends on the accordion widget with the use of filters. The already compartmentalized accordion items can be further categorized and sorted using the filter bar above it.
22
+ * Audio Widget allows you to easily add audio to your site. The widget lets you upload a audio file which will then be wrapped in a custom player. The widget will probably be handy for musicians or podcasters.
23
+ * Video Widget makes it easy to add videos to your site. The widget allows you to either use self-hosted videos with a cover image and control themes, or use oEmbed to add videos from sites such as YouTube, Vimeo etc..
24
+ * Media Box Widget is a simple and elegant combination of text and media. This widget is a fantastic way to highlight small bits of information, such as skills, features or services you offer. Choose to use icons, images or an oEmbed link. In addition you can easily link to other webpages using a highly customizable button.
25
+ * Testimonial Widget is the best way to showcase quotes from your customers. The widget combines a quote, it's author, his/her image and a link back to their website. This is can be used on your Sales, Pricing or Home pages to encourage trust.
26
+ * Person Widget is a great way to highlight your personnel. This widget combines text, imagery and social media links to create a personal profile block. It can be a great addition to your Team, About Me or Home pages. You can increase the interactivity of the profile by choosing to place the social icons or the about me text over the profile image.
27
+ * Pricing Table Widget allows you to easily create pricing elements for your products or services. Create as many plans as you want, and control the title, features and pricing for each. You can also choose to make one or more plans featured. The widget is responsive and highly customizable.
28
+ * Slider Widget lets you choose from a number of slider settings and styling options to create simple image slider.
29
+ * Alert widgets are useful elements that can be dropped into a form or inline on a page. It can communicate success, warnings, failure or just information. Choose between 6 beautiful designs and an option to add a close button.
30
+ * Number Counter Widget is an engaging way to display numerical statistics to your visitors. This widget is commonly used as a marketing tool to impress visitors.
31
+ * Circle Counter Widget is a great way to display a single animated statistic. With the animation turned on, the circle will gracefully fill up, till it reaches its preset value. Using three to four of these circles side by side, lets your visitors learn a lot about you a single glance.
32
+ * Bar Counter Widget is a beautiful way to display useful stats to your visitors. With the animation turned on, the bars start filling up as they enter the viewport. The repeater field in this module lets you have as many bars as you need.
33
+ * The divider widget is useful as a separator between different sections of your content. It is also a simple way to add horizontal spacing between different elements on your page.
34
+ * Button Widget can easily add buttons anywhere on your site. Choose between 6 beautiful and animated button designs with customizable settings such as colors, shape, size, alignment, icons, button hover effect and button click effect.
35
 
36
  Additional Feature:
37
 
38
+ * Visibility is a wonderful way to display specific widgets or rows for different screen sizes or screen orientations.
39
 
40
+ <a href="https://wpinked.com/downloads/widgets-for-siteorigin-pro/" target="_blank">Widgets for SiteOrigin Pro</a> is a premium plugin contain 6 premium addons.
41
+
42
+ * Enhanced Blog Widget Extends on the blog widget, and comes with a set of predesigned article templates. The widget also comes equipped with the default and AJAX powered navigation.
43
+ * Blog Slider Widget lets you easily add eye catching post sliders anywhere on your website. This widget is typically used at the top of pages and goes great in conjunction with the Blog Widget.
44
+ * Person Slider Widget is the best way to showcase your personnel on About Me or Team Member pages, where you would like to highlight their bio. This widget brings together text, imagery, social media links and a smooth slider in a cohesive manner. Use the many settings provided to create unique designs.
45
+ * Testimonial Slider Widget is a great way to encourage trust from your visitors by displaying quotes from your customers. This widget will snuggly fit in your Sales, Pricing or Home pages. Use the many settings provided to create unique designs.
46
+ * Chart Widget allows you to visualize your data in a number of different ways. Choose from 6 chart types, each of them animated, fully customizable and engaging.
47
+ * Animation feature lets you an easily animate widgets. Choose from 18 different animation effects.
48
+
49
+ Check out <a target="_blank" href="http://widgets.wpinked.com/">DEMO</a> and <a target="_blank" href="http://widgets-docs.wpinked.com/">DOCS</a>.
50
+
51
+ The plugin now come with email support. Email us at team@wpinked.com. Purchasing the Pro plugin gives you prioritized support and help with minor customizations.
52
 
53
  == Installation ==
54
 
58
  1. Widgets for SiteOrigin
59
  2. [Jetpack by WordPress.com](https://wordpress.org/plugins/jetpack/). **Optional** The portfolio widget is built using the **Custom Content Types** module. Activate if you are using the Portfolio Widget
60
 
61
+ Once installed, you can choose to Active/Deactivate widget from Plugins -> SiteOrigin Widgets.
62
+
63
  == Screenshots ==
64
 
65
  1. Manage which widgets you want enabled or disabled.
 
66
 
67
  == Changelog ==
68
 
69
+ = 1.3.0 - October 30 2016 =
70
+ * Added new template design options to Person Widget.
71
+ * Added new template design options to Testimonial Widget.
72
+ * Added option to choose from all available image sizes for Blog Widget.
73
+ * Major update to Slider Widget.
74
+ * Fixed bug in Circle Counter Widget.
75
+ * Removed freemius from plugin.
76
+ * Changed help link to new docs.
77
+ * Other minor bug fixes.
78
+
79
  = 1.2.4 - August 23 2016 =
80
  * Compatibility with WP 4.6
81
  * Added image slider widget
widgets-for-siteorigin.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Widgets for SiteOrigin
5
  * Plugin URI: http://widgets.wpinked.com/
6
  * Description: A collection of highly customizable and thoughtfully crafted widgets. Built on top of the SiteOrigin Widgets Bundle.
7
- * Version: 1.2.4
8
  * Author: wpinked
9
  * Author URI: widgets.wpinked.com
10
  * License: GPL-2.0+
@@ -18,19 +18,23 @@
18
  *
19
  */
20
 
21
- define( 'INKED_SO_VER', '1.2.4' );
22
 
23
  // Allow JS suffix to be pre-set
24
  if( !defined( 'INKED_JS_SUFFIX' ) ) {
25
  define('INKED_JS_SUFFIX', '.min');
26
  }
27
 
 
 
28
  require_once ( 'inc/visibility.php' );
29
 
30
  require_once ( 'inc/enqueue.php' );
31
 
32
  require_once ( 'inc/functions.php' );
33
 
 
 
34
  // Widgets.... Come out and play!
35
  function wpinked_so_widgets($folders){
36
  $folders[] = plugin_dir_path(__FILE__) . '/widgets/';
@@ -76,33 +80,4 @@ $wpinked_widget_count = 0;
76
 
77
  require_once ( 'inc/activate.php' );
78
 
79
- // Create a helper function for easy SDK access.
80
- function wpinkedwidgets() {
81
- global $wpinkedwidgets;
82
-
83
- if ( ! isset( $wpinkedwidgets ) ) {
84
- // Include Freemius SDK.
85
- require_once dirname(__FILE__) . '/freemius/start.php';
86
-
87
- $wpinkedwidgets = fs_dynamic_init( array(
88
- 'id' => '341',
89
- 'slug' => 'wpinked-widgets',
90
- 'public_key' => 'pk_7ebc491e750cd32db6fb5681d1bcf',
91
- 'is_premium' => false,
92
- 'has_addons' => false,
93
- 'has_paid_plans' => false,
94
- 'menu' => array(
95
- 'slug' => 'wpinked-widgets',
96
- 'first-path' => 'plugins.php',
97
- 'account' => false,
98
- 'contact' => false,
99
- 'support' => false,
100
- ),
101
- ) );
102
- }
103
-
104
- return $wpinkedwidgets;
105
- }
106
-
107
- // Init Freemius.
108
- wpinkedwidgets();
4
  * Plugin Name: Widgets for SiteOrigin
5
  * Plugin URI: http://widgets.wpinked.com/
6
  * Description: A collection of highly customizable and thoughtfully crafted widgets. Built on top of the SiteOrigin Widgets Bundle.
7
+ * Version: 1.3.0
8
  * Author: wpinked
9
  * Author URI: widgets.wpinked.com
10
  * License: GPL-2.0+
18
  *
19
  */
20
 
21
+ define( 'INKED_SO_VER', '1.3.0' );
22
 
23
  // Allow JS suffix to be pre-set
24
  if( !defined( 'INKED_JS_SUFFIX' ) ) {
25
  define('INKED_JS_SUFFIX', '.min');
26
  }
27
 
28
+ define( 'INKED_PLUGIN_PATH', plugin_dir_url( __FILE__ ) );
29
+
30
  require_once ( 'inc/visibility.php' );
31
 
32
  require_once ( 'inc/enqueue.php' );
33
 
34
  require_once ( 'inc/functions.php' );
35
 
36
+ require_once ( 'inc/template-functions.php' );
37
+
38
  // Widgets.... Come out and play!
39
  function wpinked_so_widgets($folders){
40
  $folders[] = plugin_dir_path(__FILE__) . '/widgets/';
80
 
81
  require_once ( 'inc/activate.php' );
82
 
83
+ require_once ( 'admin/admin.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
widgets/ink-alrt-widget/assets/banner.svg CHANGED
@@ -1,20 +1,20 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <svg width="300px" height="300px" viewBox="0 0 300 300" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Alert</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
- <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-1">
8
- <feGaussianBlur stdDeviation="0" in="SourceGraphic" result="blur"></feGaussianBlur>
9
- </filter>
 
10
  </defs>
11
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
12
- <g id="Alert" transform="translate(30.000000, 30.000000)">
13
- <rect id="BG" stroke="#C0392B" stroke-width="30" fill="#E74C3C" filter="url(#filter-1)" x="0" y="0" width="240" height="240"></rect>
14
- <g id="Group" transform="translate(6.000000, 6.000000)" stroke="#F7EBE8" stroke-width="4">
15
- <polygon id="Polygon" transform="translate(114.500000, 114.500000) rotate(-22.500000) translate(-114.500000, -114.500000) " points="114.5 27 176.371843 52.6281566 202 114.5 176.371843 176.371843 114.5 202 52.6281566 176.371843 27 114.5 52.6281566 52.6281566 "></polygon>
16
- <path d="M116,67 L116,122" id="Line" stroke-linecap="square"></path>
17
- <path d="M116,145 L116,136" id="dot" stroke-linecap="square"></path>
18
  </g>
19
  </g>
20
  </g>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="240px" height="240px" viewBox="0 0 240 240" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Alert</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
+ <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="50%" id="radialGradient-1">
8
+ <stop stop-color="#F5515F" offset="0%"></stop>
9
+ <stop stop-color="#9F031B" offset="100%"></stop>
10
+ </radialGradient>
11
  </defs>
12
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
13
+ <g id="Widget-Icons" transform="translate(-625.000000, -24.000000)">
14
+ <g id="Alert" transform="translate(625.000000, 24.000000)">
15
+ <rect id="Rectangle" fill="url(#radialGradient-1)" x="0" y="0" width="240" height="240"></rect>
16
+ <path d="M106.669084,24.2909651 C114.031546,20.5008641 125.974511,20.5039819 133.330916,24.2909651 L206.669084,62.0445158 C214.031546,65.8346168 220,75.6227107 220,83.9055336 L220,156.866109 C220,165.149515 214.025489,174.940144 206.669084,178.727127 L133.330916,216.480678 C125.968454,220.270779 114.025489,220.267661 106.669084,216.480678 L33.330916,178.727127 C25.9684544,174.937026 20,165.148932 20,156.866109 L20,83.9055336 C20,75.6221279 25.974511,65.831499 33.330916,62.0445158 L106.669084,24.2909651 Z" id="Polygon" stroke="#FFFFFF" stroke-width="5"></path>
17
+ <path d="M139,57 L129.826158,154.242188 L111.173842,154.242188 L102,57 L139,57 Z M111,166 L129,166 L129,183 L111,183 L111,166 Z" id="Combined-Shape" stroke="#FFFFFF" stroke-width="5"></path>
 
18
  </g>
19
  </g>
20
  </g>
widgets/ink-alrt-widget/ink-alrt-widget.php CHANGED
@@ -19,7 +19,7 @@ class Inked_Alert_SO_Widget extends SiteOrigin_Widget {
19
 
20
  array(
21
  'description' => __( 'Communicate success, warnings, failure or just information.', 'wpinked-widgets' ),
22
- 'help' => 'http://widgets.wpinked.com/documentation/alert-widget/'
23
  ),
24
 
25
  array(
19
 
20
  array(
21
  'description' => __( 'Communicate success, warnings, failure or just information.', 'wpinked-widgets' ),
22
+ 'help' => 'http://widgets-docs.wpinked.com/article/31-alert-widget'
23
  ),
24
 
25
  array(
widgets/ink-ardn-widget/assets/banner.svg CHANGED
@@ -1,20 +1,20 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <svg width="300px" height="300px" viewBox="0 0 300 300" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Accordion</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
- <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-1">
8
- <feGaussianBlur stdDeviation="0" in="SourceGraphic" result="blur"></feGaussianBlur>
9
- </filter>
 
10
  </defs>
11
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
12
- <g id="Accordion" transform="translate(30.000000, 30.000000)">
13
- <rect id="BG" stroke="#C0392B" stroke-width="30" fill="#E74C3C" filter="url(#filter-1)" x="0" y="0" width="240" height="240"></rect>
14
- <g id="Group" transform="translate(35.000000, 59.000000)" stroke="#F7EBE8" stroke-width="4">
15
- <rect id="Rectangle" x="0" y="22" width="170" height="115"></rect>
16
- <path d="M10,12 L160,12" id="Line" stroke-linecap="square"></path>
17
- <path d="M20,1 L150,1" id="Line-2" stroke-linecap="square"></path>
18
  </g>
19
  </g>
20
  </g>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="240px" height="240px" viewBox="0 0 240 240" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Accordion</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
+ <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="50%" id="radialGradient-1">
8
+ <stop stop-color="#F5515F" offset="0%"></stop>
9
+ <stop stop-color="#9F031B" offset="100%"></stop>
10
+ </radialGradient>
11
  </defs>
12
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
13
+ <g id="Widget-Icons" transform="translate(-335.000000, -24.000000)">
14
+ <g id="Accordion" transform="translate(335.000000, 24.000000)">
15
+ <rect id="Rectangle" fill="url(#radialGradient-1)" x="0" y="0" width="240" height="240"></rect>
16
+ <path d="M106.669084,24.2909651 C114.031546,20.5008641 125.974511,20.5039819 133.330916,24.2909651 L206.669084,62.0445158 C214.031546,65.8346168 220,75.6227107 220,83.9055336 L220,156.866109 C220,165.149515 214.025489,174.940144 206.669084,178.727127 L133.330916,216.480678 C125.968454,220.270779 114.025489,220.267661 106.669084,216.480678 L33.330916,178.727127 C25.9684544,174.937026 20,165.148932 20,156.866109 L20,83.9055336 C20,75.6221279 25.974511,65.831499 33.330916,62.0445158 L106.669084,24.2909651 Z" id="Polygon" stroke="#FFFFFF" stroke-width="5"></path>
17
+ <path d="M57,93.9595822 L182,93.9595822 L182,163.333333 L57,163.333333 L57,93.9595822 Z M64.3529412,88.2184142 L174.647059,88.2184142 L174.647059,85.6357501 L64.3529412,85.6357501 L64.3529412,88.2184142 Z M71.7058824,79.5826641 L167.294118,79.5826641 L167.294118,77 L71.7058824,77 L71.7058824,79.5826641 Z" id="Combined-Shape" stroke="#FFFFFF" stroke-width="4"></path>
 
18
  </g>
19
  </g>
20
  </g>
widgets/ink-ardn-widget/ink-ardn-widget.php CHANGED
@@ -19,7 +19,7 @@ class Inked_Accordion_SO_Widget extends SiteOrigin_Widget {
19
 
20
  array(
21
  'description' => __( 'Expand and collapse content that is broken into logical sections.', 'wpinked-widgets' ),
22
- 'help' => 'http://widgets.wpinked.com/documentation/accordion-widget/'
23
  ),
24
 
25
  array(
19
 
20
  array(
21
  'description' => __( 'Expand and collapse content that is broken into logical sections.', 'wpinked-widgets' ),
22
+ 'help' => 'http://widgets-docs.wpinked.com/article/28-accordion-widget'
23
  ),
24
 
25
  array(
widgets/ink-ardn-widget/js/accordion.js CHANGED
@@ -1,11 +1,11 @@
1
  (
2
  function ( $ ) {
3
 
4
- $.fn.iwInitAccordion = function(){
5
  "use strict";
6
 
7
- if( $( '.iw-so-accordion' ).length ) {
8
- $( '.iw-so-accordion' ).each( function() {
9
 
10
  $(this).find( '.iw-so-acc-item .iw-so-acc-content' ).hide();
11
  $(this).find( '.iw-so-acc-item.iw-so-acc-item-active .iw-so-acc-content' ).show();
@@ -34,16 +34,32 @@
34
  }
35
  }
36
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  }
38
  )( jQuery );
39
 
40
  jQuery( function ( $ ) {
 
41
  $(document).iwInitAccordion();
42
 
 
 
43
  if (window.location.hash) {
44
  var $target = $('body').find(window.location.hash);
45
  if ($target.hasClass('iw-so-acc-item')) {
46
  $(window.location.hash).children('.iw-so-acc-title').trigger("click");
47
  }
48
  }
 
49
  } );
1
  (
2
  function ( $ ) {
3
 
4
+ $.fn.iwInitAccordion = function() {
5
  "use strict";
6
 
7
+ if( $( '.iw-so-accordion-plain.iw-so-accordion' ).length ) {
8
+ $( '.iw-so-accordion-plain.iw-so-accordion' ).each( function() {
9
 
10
  $(this).find( '.iw-so-acc-item .iw-so-acc-content' ).hide();
11
  $(this).find( '.iw-so-acc-item.iw-so-acc-item-active .iw-so-acc-content' ).show();
34
  }
35
  }
36
 
37
+ $.fn.iwAccordionRemoteLink = function () {
38
+ $( 'a[href*="#"]:not([href="#"])' ).click( function ( e ) {
39
+ var $a = $( this );
40
+ var $target = $( '[name=' + this.hash.slice( 1 ) + ']' ).length ? $( '[name=' + this.hash.slice( 1 ) + ']' ) : $( $a.get( 0 ).hash );
41
+
42
+ if ( $target.length && $target.hasClass( 'iw-so-acc-item' ) ) {
43
+ $target.children( '.iw-so-acc-title' ).trigger( 'click' );
44
+ $(window).scrollTop( $target.offset().top );
45
+ }
46
+ } );
47
+ }
48
+
49
  }
50
  )( jQuery );
51
 
52
  jQuery( function ( $ ) {
53
+
54
  $(document).iwInitAccordion();
55
 
56
+ $(document).iwAccordionRemoteLink();
57
+
58
  if (window.location.hash) {
59
  var $target = $('body').find(window.location.hash);
60
  if ($target.hasClass('iw-so-acc-item')) {
61
  $(window.location.hash).children('.iw-so-acc-title').trigger("click");
62
  }
63
  }
64
+
65
  } );
widgets/ink-ardn-widget/js/accordion.min.js CHANGED
@@ -1 +1 @@
1
- !function(i){i.fn.iwInitAccordion=function(){"use strict";i(".iw-so-accordion").length&&i(".iw-so-accordion").each(function(){i(this).find(".iw-so-acc-item .iw-so-acc-content").hide(),i(this).find(".iw-so-acc-item.iw-so-acc-item-active .iw-so-acc-content").show(),i(this).find(".iw-so-acc-item").children(".iw-so-acc-title").click(function(c){(!i(this).parent().parent().hasClass("iw-so-acc-toggle")||!i(this).parent().siblings().hasClass("iw-so-acc-item-active")&&i(this).parent().parent().children().hasClass("iw-so-acc-item-active"))&&i(this).parent().parent().hasClass("iw-so-acc-toggle")?c.preventDefault():(c.preventDefault(),i(this).parent().toggleClass("iw-so-acc-item-active"),i(this).siblings(".iw-so-acc-content").slideToggle("300ms")),i(this).parent().parent().hasClass("iw-so-acc-singleExpand")&&i(this).parent().siblings(".iw-so-acc-item.iw-so-acc-item-active").removeClass("iw-so-acc-item-active").children(".iw-so-acc-content").slideUp("300ms")})})}}(jQuery),jQuery(function(i){if(i(document).iwInitAccordion(),window.location.hash){var c=i("body").find(window.location.hash);c.hasClass("iw-so-acc-item")&&i(window.location.hash).children(".iw-so-acc-title").trigger("click")}});
1
+ !function(i){i.fn.iwInitAccordion=function(){"use strict";i(".iw-so-accordion-plain.iw-so-accordion").length&&i(".iw-so-accordion-plain.iw-so-accordion").each(function(){i(this).find(".iw-so-acc-item .iw-so-acc-content").hide(),i(this).find(".iw-so-acc-item.iw-so-acc-item-active .iw-so-acc-content").show(),i(this).find(".iw-so-acc-item").children(".iw-so-acc-title").click(function(c){(!i(this).parent().parent().hasClass("iw-so-acc-toggle")||!i(this).parent().siblings().hasClass("iw-so-acc-item-active")&&i(this).parent().parent().children().hasClass("iw-so-acc-item-active"))&&i(this).parent().parent().hasClass("iw-so-acc-toggle")?c.preventDefault():(c.preventDefault(),i(this).parent().toggleClass("iw-so-acc-item-active"),i(this).siblings(".iw-so-acc-content").slideToggle("300ms")),i(this).parent().parent().hasClass("iw-so-acc-singleExpand")&&i(this).parent().siblings(".iw-so-acc-item.iw-so-acc-item-active").removeClass("iw-so-acc-item-active").children(".iw-so-acc-content").slideUp("300ms")})})},i.fn.iwAccordionRemoteLink=function(){i('a[href*="#"]:not([href="#"])').click(function(c){var t=i(this),s=i(i("[name="+this.hash.slice(1)+"]").length?"[name="+this.hash.slice(1)+"]":t.get(0).hash);s.length&&s.hasClass("iw-so-acc-item")&&(s.children(".iw-so-acc-title").trigger("click"),i(window).scrollTop(s.offset().top))})}}(jQuery),jQuery(function(i){if(i(document).iwInitAccordion(),i(document).iwAccordionRemoteLink(),window.location.hash){var c=i("body").find(window.location.hash);c.hasClass("iw-so-acc-item")&&i(window.location.hash).children(".iw-so-acc-title").trigger("click")}});
widgets/ink-ardn-widget/tpl/accordion.php CHANGED
@@ -17,7 +17,7 @@ else :
17
  endif;
18
  ?>
19
 
20
- <div class="iw-so-accordion<?php echo $expand . $toggle; ?>">
21
 
22
  <?php foreach( $instance['toggles'] as $i => $toggle ) { ?>
23
 
17
  endif;
18
  ?>
19
 
20
+ <div class="iw-so-accordion-plain iw-so-accordion<?php echo $expand . $toggle; ?>">
21
 
22
  <?php foreach( $instance['toggles'] as $i => $toggle ) { ?>
23
 
widgets/ink-auds-widget/assets/banner.svg CHANGED
@@ -1,24 +1,24 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <svg width="300px" height="300px" viewBox="0 0 300 300" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Audio</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
- <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-1">
8
- <feGaussianBlur stdDeviation="0" in="SourceGraphic" result="blur"></feGaussianBlur>
9
- </filter>
 
10
  </defs>
11
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
12
- <g id="Audio" transform="translate(30.000000, 30.000000)">
13
- <rect id="BG" stroke="#C0392B" stroke-width="30" fill="#E74C3C" filter="url(#filter-1)" x="0" y="0" width="240" height="240"></rect>
14
- <g id="Group" transform="translate(35.000000, 52.000000)" stroke="#F7EBE8" stroke-width="4">
15
- <path d="M28.4553425,127.5 C35.3134932,127.5 46.422642,127.492636 51.2382026,123.337891 C57.0832475,118.294931 55.9456115,108.327252 55.9456115,100 C55.9456115,92.1796887 56.4767266,82.6869204 51.2382026,77.6796875 C46.3029864,72.9623708 35.8202548,72.5 28.4553425,72.5 C13.2728862,72.5 0.965073625,84.8121694 0.965073625,100 C0.965073625,115.187831 13.2728862,127.5 28.4553425,127.5 Z" id="Oval-4"></path>
16
- <path d="M141.455343,127.5 C148.313493,127.5 159.422642,127.492636 164.238203,123.337891 C170.083247,118.294931 168.945611,108.327252 168.945611,100 C168.945611,92.1796887 169.476727,82.6869204 164.238203,77.6796875 C159.302986,72.9623708 148.820255,72.5 141.455343,72.5 C126.272886,72.5 113.965074,84.8121694 113.965074,100 C113.965074,115.187831 126.272886,127.5 141.455343,127.5 Z" id="Oval-4-Copy" transform="translate(141.500000, 100.000000) scale(-1, 1) translate(-141.500000, -100.000000) "></path>
17
- <path d="M141.5,72.5 C141.5,72.5 140.851277,40.0060231 131.181282,24.6243591 C128.178279,19.8476059 115.05329,2.90014584 110.213285,2.02739906 C104.614446,1.01781949 86.5,1.5 86.5,1.5" id="Line" stroke-linecap="square"></path>
18
- <path d="M83.5,72.5 C83.5,72.5 82.8512774,40.0060231 73.181282,24.6243591 C70.1782792,19.8476059 57.0532896,2.90014584 52.2132854,2.02739906 C46.6144458,1.01781949 28.5,1.5 28.5,1.5" id="Line-Copy" stroke-linecap="square" transform="translate(56.000000, 36.942457) scale(-1, 1) translate(-56.000000, -36.942457) "></path>
19
- <path d="M45,77 C45,77 40.8919272,93.176455 40.8919272,101 C40.8919272,109.176455 45,125 45,125" id="Line" stroke-linecap="square"></path>
20
- <path d="M129.108073,77 C129.108073,77 125,93.176455 125,101 C125,109.176455 129.108073,125 129.108073,125" id="Line-Copy-2" stroke-linecap="square" transform="translate(127.054036, 101.000000) scale(-1, 1) translate(-127.054036, -101.000000) "></path>
21
- <path d="M77.21875,1.37617183 L94.0027351,1.37617183" id="Line" stroke-linecap="square"></path>
22
  </g>
23
  </g>
24
  </g>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="240px" height="240px" viewBox="0 0 240 240" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Audio</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
+ <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="50%" id="radialGradient-1">
8
+ <stop stop-color="#F5515F" offset="0%"></stop>
9
+ <stop stop-color="#9F031B" offset="100%"></stop>
10
+ </radialGradient>
11
  </defs>
12
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
13
+ <g id="Widget-Icons" transform="translate(-915.000000, -24.000000)">
14
+ <g id="Audio" transform="translate(915.000000, 24.000000)">
15
+ <rect id="Rectangle" fill="url(#radialGradient-1)" x="0" y="0" width="240" height="240"></rect>
16
+ <path d="M106.669084,24.2909651 C114.031546,20.5008641 125.974511,20.5039819 133.330916,24.2909651 L206.669084,62.0445158 C214.031546,65.8346168 220,75.6227107 220,83.9055336 L220,156.866109 C220,165.149515 214.025489,174.940144 206.669084,178.727127 L133.330916,216.480678 C125.968454,220.270779 114.025489,220.267661 106.669084,216.480678 L33.330916,178.727127 C25.9684544,174.937026 20,165.148932 20,156.866109 L20,83.9055336 C20,75.6221279 25.974511,65.831499 33.330916,62.0445158 L106.669084,24.2909651 Z" id="Polygon" stroke="#FFFFFF" stroke-width="5"></path>
17
+ <g id="Group" transform="translate(52.000000, 57.000000)" stroke="#FFFFFF" stroke-width="4">
18
+ <path d="M122.62,53.4130435 C122.62,23.9138341 98.0807271,0 67.81,0 C37.5392729,0 13,23.9138341 13,53.4130435" id="Oval-46"></path>
19
+ <rect id="Rectangle-101" x="0" y="57" width="20" height="45" rx="2.2"></rect>
20
+ <rect id="Rectangle-101" x="116" y="57" width="20" height="45" rx="2.2"></rect>
21
+ </g>
 
22
  </g>
23
  </g>
24
  </g>
widgets/ink-auds-widget/ink-auds-widget.php CHANGED
@@ -19,7 +19,7 @@ class Inked_Audio_SO_Widget extends SiteOrigin_Widget {
19
 
20
  array(
21
  'description' => __( 'Play self or externally hosted audios.', 'wpinked-widgets' ),
22
- 'help' => 'http://widgets.wpinked.com/documentation/audio-widget/'
23
  ),
24
 
25
  array(
19
 
20
  array(
21
  'description' => __( 'Play self or externally hosted audios.', 'wpinked-widgets' ),
22
+ 'help' => 'http://widgets-docs.wpinked.com/article/33-audio-widget'
23
  ),
24
 
25
  array(
widgets/ink-barc-widget/assets/banner.svg CHANGED
@@ -1,22 +1,26 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <svg width="300px" height="300px" viewBox="0 0 300 300" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Bar Counter</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
- <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-1">
8
- <feGaussianBlur stdDeviation="0" in="SourceGraphic" result="blur"></feGaussianBlur>
9
- </filter>
 
10
  </defs>
11
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
12
- <g id="Bar-Counter" transform="translate(30.000000, 30.000000)">
13
- <rect id="BG" stroke="#C0392B" stroke-width="30" fill="#E74C3C" filter="url(#filter-1)" x="0" y="0" width="240" height="240"></rect>
14
- <g id="Group" transform="translate(33.000000, 67.000000)" stroke="#F7EBE8" stroke-width="4" stroke-linecap="square">
15
- <path d="M0,1 L92,1" id="Line-Copy-4"></path>
16
- <path d="M0,29 L135,29" id="Line-Copy-5"></path>
17
- <path d="M0,59 L53,59" id="Line-Copy-9"></path>
18
- <path d="M1,87 L98,87" id="Line-Copy-10"></path>
19
- <path d="M1,115 L161,115" id="Line-Copy-11"></path>
 
 
 
20
  </g>
21
  </g>
22
  </g>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="240px" height="240px" viewBox="0 0 240 240" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Bar Counter</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
+ <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="50%" id="radialGradient-1">
8
+ <stop stop-color="#F5515F" offset="0%"></stop>
9
+ <stop stop-color="#9F031B" offset="100%"></stop>
10
+ </radialGradient>
11
  </defs>
12
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
13
+ <g id="Widget-Icons" transform="translate(-335.000000, -314.000000)">
14
+ <g id="Bar-Counter" transform="translate(335.000000, 314.000000)">
15
+ <rect id="Rectangle" fill="url(#radialGradient-1)" x="0" y="0" width="240" height="240"></rect>
16
+ <path d="M106.669084,24.2909651 C114.031546,20.5008641 125.974511,20.5039819 133.330916,24.2909651 L206.669084,62.0445158 C214.031546,65.8346168 220,75.6227107 220,83.9055336 L220,156.866109 C220,165.149515 214.025489,174.940144 206.669084,178.727127 L133.330916,216.480678 C125.968454,220.270779 114.025489,220.267661 106.669084,216.480678 L33.330916,178.727127 C25.9684544,174.937026 20,165.148932 20,156.866109 L20,83.9055336 C20,75.6221279 25.974511,65.831499 33.330916,62.0445158 L106.669084,24.2909651 Z" id="Polygon" stroke="#FFFFFF" stroke-width="5"></path>
17
+ <g id="Group" transform="translate(50.000000, 91.000000)" stroke="#F7EBE8" stroke-width="4" stroke-linecap="square">
18
+ <path d="M0,0.5 L80,0.5" id="Line-Copy-4"></path>
19
+ <path d="M0,14.5 L117.391304,14.5" id="Line-Copy-5"></path>
20
+ <path d="M0,29.5 L46.0869565,29.5" id="Line-Copy-9"></path>
21
+ <path d="M0.869565217,43.5 L85.2173913,43.5" id="Line-Copy-10"></path>
22
+ <path d="M0.869565217,57.5 L140,57.5" id="Line-Copy-11"></path>
23
+ </g>
24
  </g>
25
  </g>
26
  </g>
widgets/ink-barc-widget/ink-barc-widget.php CHANGED
@@ -19,7 +19,7 @@ class Inked_Bar_Counter_SO_Widget extends SiteOrigin_Widget {
19
 
20
  array(
21
  'description' => __( 'Animated bars to display your stats.', 'wpinked-widgets' ),
22
- 'help' => 'http://widgets.wpinked.com/documentation/bar-counter-widget/'
23
  ),
24
 
25
  array(
@@ -75,10 +75,9 @@ class Inked_Bar_Counter_SO_Widget extends SiteOrigin_Widget {
75
  ),
76
 
77
  'height' => array(
78
- 'type' => 'text',
79
  'label' => __( 'Height', 'wpinked-widgets' ),
80
  'default' => '15px',
81
- 'description' => __( 'Please specify units, eg: px, em, rem, ...', 'wpinked-widgets' ),
82
  ),
83
 
84
  'percent-show' => array(
19
 
20
  array(
21
  'description' => __( 'Animated bars to display your stats.', 'wpinked-widgets' ),
22
+ 'help' => 'http://widgets-docs.wpinked.com/article/25-bar-counter-widget'
23
  ),
24
 
25
  array(
75
  ),
76
 
77
  'height' => array(
78
+ 'type' => 'measurement',
79
  'label' => __( 'Height', 'wpinked-widgets' ),
80
  'default' => '15px',
 
81
  ),
82
 
83
  'percent-show' => array(
widgets/ink-blgs-widget/assets/banner.svg CHANGED
@@ -1,26 +1,30 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <svg width="300px" height="300px" viewBox="0 0 300 300" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Blog</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
- <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-1">
8
- <feGaussianBlur stdDeviation="0" in="SourceGraphic" result="blur"></feGaussianBlur>
9
- </filter>
 
10
  </defs>
11
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
12
- <g id="Blog" transform="translate(30.000000, 30.000000)">
13
- <rect id="BG" stroke="#C0392B" stroke-width="30" fill="#E74C3C" filter="url(#filter-1)" x="0" y="0" width="240" height="240"></rect>
14
- <g id="Group" transform="translate(29.000000, 24.000000)" stroke="#F7EBE8" stroke-width="4">
15
- <rect id="Rectangle-17" x="0" y="0" width="182" height="193"></rect>
16
- <rect id="Rectangle-18" transform="translate(91.500000, 28.500000) scale(1, -1) translate(-91.500000, -28.500000) " x="12" y="21" width="159" height="15"></rect>
17
- <rect id="Rectangle-19" x="16" y="49" width="67" height="48"></rect>
18
- <path d="M100,52 L167,52" id="Line" stroke-linecap="square"></path>
19
- <path d="M100,74 L167,74" id="Line-Copy-4" stroke-linecap="square"></path>
20
- <path d="M99,96 L167,96" id="Line-Copy-5" stroke-linecap="square"></path>
21
- <path d="M18,118 L167,118" id="Line-Copy-6" stroke-linecap="square"></path>
22
- <path d="M18,140 L167,140" id="Line-Copy-7" stroke-linecap="square"></path>
23
- <path d="M18,162 L167,162" id="Line-Copy-8" stroke-linecap="square"></path>
 
 
 
24
  </g>
25
  </g>
26
  </g>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="240px" height="240px" viewBox="0 0 240 240" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Blog</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
+ <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="50%" id="radialGradient-1">
8
+ <stop stop-color="#F5515F" offset="0%"></stop>
9
+ <stop stop-color="#9F031B" offset="100%"></stop>
10
+ </radialGradient>
11
  </defs>
12
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
13
+ <g id="Widget-Icons" transform="translate(-625.000000, -314.000000)">
14
+ <g id="Blog" transform="translate(625.000000, 314.000000)">
15
+ <rect id="Rectangle" fill="url(#radialGradient-1)" x="0" y="0" width="240" height="240"></rect>
16
+ <path d="M106.669084,24.2909651 C114.031546,20.5008641 125.974511,20.5039819 133.330916,24.2909651 L206.669084,62.0445158 C214.031546,65.8346168 220,75.6227107 220,83.9055336 L220,156.866109 C220,165.149515 214.025489,174.940144 206.669084,178.727127 L133.330916,216.480678 C125.968454,220.270779 114.025489,220.267661 106.669084,216.480678 L33.330916,178.727127 C25.9684544,174.937026 20,165.148932 20,156.866109 L20,83.9055336 C20,75.6221279 25.974511,65.831499 33.330916,62.0445158 L106.669084,24.2909651 Z" id="Polygon" stroke="#FFFFFF" stroke-width="5"></path>
17
+ <g id="Group" transform="translate(70.000000, 77.000000)" stroke-width="4">
18
+ <rect id="Rectangle-17" stroke="#FFFFFF" x="0" y="0" width="101" height="86"></rect>
19
+ <rect id="Rectangle-18" stroke="#F7EBE8" transform="translate(50.777473, 12.699482) scale(1, -1) translate(-50.777473, -12.699482) " x="6.65934066" y="9.35751295" width="88.2362637" height="6.68393782"></rect>
20
+ <rect id="Rectangle-19" stroke="#F7EBE8" x="8.87912088" y="21.8341969" width="37.1813187" height="21.388601"></rect>
21
+ <path d="M55.4945055,23.1709845 L92.6758242,23.1709845" id="Line" stroke="#F7EBE8" stroke-linecap="square"></path>
22
+ <path d="M55.4945055,32.9740933 L92.6758242,32.9740933" id="Line-Copy-4" stroke="#F7EBE8" stroke-linecap="square"></path>
23
+ <path d="M54.9395604,42.7772021 L92.6758242,42.7772021" id="Line-Copy-5" stroke="#F7EBE8" stroke-linecap="square"></path>
24
+ <path d="M9.98901099,52.5803109 L92.6758242,52.5803109" id="Line-Copy-6" stroke="#F7EBE8" stroke-linecap="square"></path>
25
+ <path d="M9.98901099,62.3834197 L92.6758242,62.3834197" id="Line-Copy-7" stroke="#F7EBE8" stroke-linecap="square"></path>
26
+ <path d="M9.98901099,72.1865285 L92.6758242,72.1865285" id="Line-Copy-8" stroke="#F7EBE8" stroke-linecap="square"></path>
27
+ </g>
28
  </g>
29
  </g>
30
  </g>
widgets/ink-blgs-widget/css/blog.css CHANGED
@@ -258,4 +258,7 @@
258
  .iw-so-blog-pagination li {
259
  display: inline-block; }
260
  .iw-so-blog-pagination .iw-so-nav-links {
261
- position: relative; }
 
 
 
258
  .iw-so-blog-pagination li {
259
  display: inline-block; }
260
  .iw-so-blog-pagination .iw-so-nav-links {
261
+ position: relative;
262
+ padding: 1px; }
263
+ .iw-so-blog-pagination .iw-so-nav-links .page-numbers {
264
+ display: inline-block; }
widgets/ink-blgs-widget/ink-blgs-widget.php CHANGED
@@ -19,7 +19,7 @@ class Inked_Blog_SO_Widget extends SiteOrigin_Widget {
19
 
20
  array(
21
  'description' => __( 'A widget to display Blog posts.', 'wpinked-widgets' ),
22
- 'help' => 'http://widgets.wpinked.com/documentation/blog-widget/'
23
  ),
24
 
25
  array(
@@ -32,15 +32,23 @@ class Inked_Blog_SO_Widget extends SiteOrigin_Widget {
32
  'default' => ''
33
  ),
34
 
35
- 'posts' => array(
36
- 'type' => 'posts',
37
- 'label' => __( 'Select Posts', 'wpinked-widgets' ),
38
- ),
 
39
 
40
- 'current' => array(
41
- 'type' => 'checkbox',
42
- 'label' => __( 'Exclude current post from query ?', 'wpinked-widgets' ),
43
- 'default' => false,
 
 
 
 
 
 
 
44
  ),
45
 
46
  'icons' => array(
@@ -102,10 +110,9 @@ class Inked_Blog_SO_Widget extends SiteOrigin_Widget {
102
  ),
103
 
104
  'size' => array(
105
- 'type' => 'text',
106
  'label' => __( 'Icon Size', 'wpinked-widgets' ),
107
  'default' => '',
108
- 'description' => __( 'Please specify units, eg: px, em, rem, ...', 'wpinked-widgets' ),
109
  ),
110
 
111
  'bg' => array(
@@ -134,8 +141,6 @@ class Inked_Blog_SO_Widget extends SiteOrigin_Widget {
134
  'hover' => __( 'On Hover', 'wpinked-widgets' )
135
  )
136
  ),
137
-
138
-
139
  )
140
  ),
141
 
@@ -163,15 +168,8 @@ class Inked_Blog_SO_Widget extends SiteOrigin_Widget {
163
  ),
164
 
165
  'img-size' => array(
166
- 'type' => 'select',
167
  'label' => __( 'Image Size', 'wpinked-widgets' ),
168
- 'default' => 'thumb-above',
169
- 'options' => array(
170
- 'thumbnail' => __( 'Thumbnail', 'wpinked-widgets' ),
171
- 'medium' => __( 'Medium', 'wpinked-widgets' ),
172
- 'large' => __( 'Large', 'wpinked-widgets' ),
173
- 'full' => __( 'Full', 'wpinked-widgets' ),
174
- ),
175
  'state_handler' => array(
176
  'blg_lyt[thumb-above]' => array( 'show' ),
177
  'blg_lyt[thumb-left]' => array( 'show' ),
@@ -375,7 +373,7 @@ class Inked_Blog_SO_Widget extends SiteOrigin_Widget {
375
  ),
376
 
377
  'none-left' => array(
378
- 'type' => 'text',
379
  'label' => __( 'Text distance from the left', 'wpinked-widgets' ),
380
  'default' => '60px',
381
  'state_handler' => array(
@@ -385,7 +383,6 @@ class Inked_Blog_SO_Widget extends SiteOrigin_Widget {
385
  'blg_lyt[thumb-behind]' => array( 'hide' ),
386
  'blg_lyt[thumb-none]' => array( 'show' ),
387
  ),
388
- 'description' => __( 'Please specify units, eg: px, em, rem, ...', 'wpinked-widgets' ),
389
  ),
390
 
391
  'gap-bw' => array(
@@ -402,10 +399,9 @@ class Inked_Blog_SO_Widget extends SiteOrigin_Widget {
402
  ),
403
 
404
  'gap' => array(
405
- 'type' => 'text',
406
  'label' => __( 'Gap Below Posts', 'wpinked-widgets' ),
407
  'default' => '1em',
408
- 'description' => __( 'Please specify units, eg: px, em, rem, ...', 'wpinked-widgets' ),
409
  ),
410
 
411
  'content-bg' => array(
@@ -422,10 +418,9 @@ class Inked_Blog_SO_Widget extends SiteOrigin_Widget {
422
  ),
423
 
424
  'title-size' => array(
425
- 'type' => 'text',
426
  'label' => __( 'Title Font Size', 'wpinked-widgets' ),
427
  'default' => '',
428
- 'description' => __( 'Please specify units, eg: px, em, rem, ...', 'wpinked-widgets' ),
429
  ),
430
 
431
  'title-color' => array(
@@ -435,10 +430,9 @@ class Inked_Blog_SO_Widget extends SiteOrigin_Widget {
435
  ),
436
 
437
  'excerpt-size' => array(
438
- 'type' => 'text',
439
  'label' => __( 'Excerpt Font Size', 'wpinked-widgets' ),
440
  'default' => '',
441
- 'description' => __( 'Please specify units, eg: px, em, rem, ...', 'wpinked-widgets' ),
442
  ),
443
 
444
  'excerpt-color' => array(
@@ -448,10 +442,9 @@ class Inked_Blog_SO_Widget extends SiteOrigin_Widget {
448
  ),
449
 
450
  'meta-size' => array(
451
- 'type' => 'text',
452
  'label' => __( 'Byline Font Size', 'wpinked-widgets' ),
453
  'default' => '',
454
- 'description' => __( 'Please specify units, eg: px, em, rem, ...', 'wpinked-widgets' ),
455
  ),
456
 
457
  'meta-color' => array(
@@ -468,10 +461,16 @@ class Inked_Blog_SO_Widget extends SiteOrigin_Widget {
468
 
469
  'hl-color' => array(
470
  'type' => 'color',
471
- 'label' => __( 'Highlight Color', 'wpinked-widgets' ),
472
  'default' => ''
473
  ),
474
 
 
 
 
 
 
 
475
  'btn-theme' => array(
476
  'type' => 'select',
477
  'label' => __( 'Button Theme', 'wpinked-widgets' ),
@@ -741,6 +740,19 @@ class Inked_Blog_SO_Widget extends SiteOrigin_Widget {
741
 
742
  }
743
 
 
 
 
 
 
 
 
 
 
 
 
 
 
744
  function get_less_variables($instance) {
745
  if( empty( $instance ) ) return array();
746
 
@@ -758,6 +770,7 @@ class Inked_Blog_SO_Widget extends SiteOrigin_Widget {
758
  'm-clr' => $instance['styling']['meta-color'],
759
  'm-link' => $instance['styling']['meta-link'],
760
  'hl-clr' => $instance['styling']['hl-color'],
 
761
  'gap' => $instance['styling']['gap'],
762
  'img-ol' => $instance['styling']['img-ol'],
763
  'img-ol-o' => $instance['styling']['img-ol-o'],
19
 
20
  array(
21
  'description' => __( 'A widget to display Blog posts.', 'wpinked-widgets' ),
22
+ 'help' => 'http://widgets-docs.wpinked.com/article/13-blog-widget'
23
  ),
24
 
25
  array(
32
  'default' => ''
33
  ),
34
 
35
+ 'loop' => array(
36
+ 'type' => 'section',
37
+ 'label' => __( 'Blog Post Loop' , 'wpinked-widgets' ),
38
+ 'hide' => true,
39
+ 'fields' => array(
40
 
41
+ 'posts' => array(
42
+ 'type' => 'posts',
43
+ 'label' => __( 'Select Posts', 'wpinked-widgets' ),
44
+ ),
45
+
46
+ 'current' => array(
47
+ 'type' => 'checkbox',
48
+ 'label' => __( 'Exclude current post from query ?', 'wpinked-widgets' ),
49
+ 'default' => false,
50
+ ),
51
+ )
52
  ),
53
 
54
  'icons' => array(
110
  ),
111
 
112
  'size' => array(
113
+ 'type' => 'measurement',
114
  'label' => __( 'Icon Size', 'wpinked-widgets' ),
115
  'default' => '',
 
116
  ),
117
 
118
  'bg' => array(
141
  'hover' => __( 'On Hover', 'wpinked-widgets' )
142
  )
143
  ),
 
 
144
  )
145
  ),
146
 
168
  ),
169
 
170
  'img-size' => array(
171
+ 'type' => 'image-size',
172
  'label' => __( 'Image Size', 'wpinked-widgets' ),
 
 
 
 
 
 
 
173
  'state_handler' => array(
174
  'blg_lyt[thumb-above]' => array( 'show' ),
175
  'blg_lyt[thumb-left]' => array( 'show' ),
373
  ),
374
 
375
  'none-left' => array(
376
+ 'type' => 'measurement',
377
  'label' => __( 'Text distance from the left', 'wpinked-widgets' ),
378
  'default' => '60px',
379
  'state_handler' => array(
383
  'blg_lyt[thumb-behind]' => array( 'hide' ),
384
  'blg_lyt[thumb-none]' => array( 'show' ),
385
  ),
 
386
  ),
387
 
388
  'gap-bw' => array(
399
  ),
400
 
401
  'gap' => array(
402
+ 'type' => 'measurement',
403
  'label' => __( 'Gap Below Posts', 'wpinked-widgets' ),
404
  'default' => '1em',
 
405
  ),
406
 
407
  'content-bg' => array(
418
  ),
419
 
420
  'title-size' => array(
421
+ 'type' => 'measurement',
422
  'label' => __( 'Title Font Size', 'wpinked-widgets' ),
423
  'default' => '',
 
424
  ),
425
 
426
  'title-color' => array(
430
  ),
431
 
432
  'excerpt-size' => array(
433
+ 'type' => 'measurement',
434
  'label' => __( 'Excerpt Font Size', 'wpinked-widgets' ),
435
  'default' => '',
 
436
  ),
437
 
438
  'excerpt-color' => array(
442
  ),
443
 
444
  'meta-size' => array(
445
+ 'type' => 'measurement',
446
  'label' => __( 'Byline Font Size', 'wpinked-widgets' ),
447
  'default' => '',
 
448
  ),
449
 
450
  'meta-color' => array(
461
 
462
  'hl-color' => array(
463
  'type' => 'color',
464
+ 'label' => __( 'Byline Link Highlight Color', 'wpinked-widgets' ),
465
  'default' => ''
466
  ),
467
 
468
+ 'meta-link-bold' => array(
469
+ 'type' => 'checkbox',
470
+ 'label' => __( 'Make links in Byline bold ?', 'wpinked-widgets' ),
471
+ 'default' => false
472
+ ),
473
+
474
  'btn-theme' => array(
475
  'type' => 'select',
476
  'label' => __( 'Button Theme', 'wpinked-widgets' ),
740
 
741
  }
742
 
743
+ function modify_instance( $instance ) {
744
+ // Only apply the transformation if the instance does not already have the new structure.
745
+ if( empty( $instance['loop'] ) ) {
746
+ $instance['loop'] = array();
747
+ if( isset( $instance['posts'] ) ) $instance['loop']['posts'] = $instance['posts'];
748
+ if( isset( $instance['current'] ) ) $instance['loop']['current'] = $instance['current'];
749
+
750
+ unset( $instance['posts'] );
751
+ unset( $instance['current'] );
752
+ }
753
+ return $instance;
754
+ }
755
+
756
  function get_less_variables($instance) {
757
  if( empty( $instance ) ) return array();
758
 
770
  'm-clr' => $instance['styling']['meta-color'],
771
  'm-link' => $instance['styling']['meta-link'],
772
  'hl-clr' => $instance['styling']['hl-color'],
773
+ 'meta-link-bold' => $instance['styling']['meta-link-bold'],
774
  'gap' => $instance['styling']['gap'],
775
  'img-ol' => $instance['styling']['img-ol'],
776
  'img-ol-o' => $instance['styling']['img-ol-o'],
widgets/ink-blgs-widget/styles/thumb-above.less CHANGED
@@ -11,6 +11,7 @@
11
  @m-link: #666;
12
  @m-clr: #999;
13
  @hl-clr: #666;
 
14
  @img-ol: transparent;
15
  @img-ol-o: 1;
16
  @img-e: '';
@@ -123,6 +124,10 @@
123
  a {
124
  text-decoration: none;
125
  color: @m-link;
 
 
 
 
126
  &:hover,
127
  &:focus {
128
  color: @hl-clr;
11
  @m-link: #666;
12
  @m-clr: #999;
13
  @hl-clr: #666;
14
+ @meta-link-bold: '';
15
  @img-ol: transparent;
16
  @img-ol-o: 1;
17
  @img-e: '';
124
  a {
125
  text-decoration: none;
126
  color: @m-link;
127
+ .meta-link-bold() when ( @meta-link-bold = 1 ) {
128
+ font-weight: bold;
129
+ }
130
+ .meta-link-bold();
131
  &:hover,
132
  &:focus {
133
  color: @hl-clr;
widgets/ink-blgs-widget/styles/thumb-behind.less CHANGED
@@ -11,6 +11,7 @@
11
  @m-link: #666;
12
  @m-clr: #999;
13
  @hl-clr: #666;
 
14
  @img-ol: transparent;
15
  @img-ol-o: 1;
16
  @img-e: '';
@@ -104,6 +105,10 @@
104
  a {
105
  text-decoration: none;
106
  color: @m-link;
 
 
 
 
107
  &:hover,
108
  &:focus {
109
  color: @hl-clr;
11
  @m-link: #666;
12
  @m-clr: #999;
13
  @hl-clr: #666;
14
+ @meta-link-bold: '';
15
  @img-ol: transparent;
16
  @img-ol-o: 1;
17
  @img-e: '';
105
  a {
106
  text-decoration: none;
107
  color: @m-link;
108
+ .meta-link-bold() when ( @meta-link-bold = 1 ) {
109
+ font-weight: bold;
110
+ }
111
+ .meta-link-bold();
112
  &:hover,
113
  &:focus {
114
  color: @hl-clr;
widgets/ink-blgs-widget/styles/thumb-left.less CHANGED
@@ -11,6 +11,7 @@
11
  @m-link: #666;
12
  @m-clr: #999;
13
  @hl-clr: #666;
 
14
  @img-ol: transparent;
15
  @img-ol-o: 1;
16
  @img-e: '';
@@ -125,6 +126,10 @@
125
  a {
126
  text-decoration: none;
127
  color: @m-link;
 
 
 
 
128
  &:hover,
129
  &:focus {
130
  color: @hl-clr;
11
  @m-link: #666;
12
  @m-clr: #999;
13
  @hl-clr: #666;
14
+ @meta-link-bold: '';
15
  @img-ol: transparent;
16
  @img-ol-o: 1;
17
  @img-e: '';
126
  a {
127
  text-decoration: none;
128
  color: @m-link;
129
+ .meta-link-bold() when ( @meta-link-bold = 1 ) {
130
+ font-weight: bold;
131
+ }
132
+ .meta-link-bold();
133
  &:hover,
134
  &:focus {
135
  color: @hl-clr;
widgets/ink-blgs-widget/styles/thumb-none.less CHANGED
@@ -11,6 +11,7 @@
11
  @m-link: #666;
12
  @m-clr: #999;
13
  @hl-clr: #666;
 
14
  @img-ol: transparent;
15
  @img-ol-o: 1;
16
  @img-e: '';
@@ -86,6 +87,10 @@
86
  a {
87
  text-decoration: none;
88
  color: @m-link;
 
 
 
 
89
  &:hover,
90
  &:focus {
91
  color: @hl-clr;
11
  @m-link: #666;
12
  @m-clr: #999;
13
  @hl-clr: #666;
14
+ @meta-link-bold: '';
15
  @img-ol: transparent;
16
  @img-ol-o: 1;
17
  @img-e: '';
87
  a {
88
  text-decoration: none;
89
  color: @m-link;
90
+ .meta-link-bold() when ( @meta-link-bold = 1 ) {
91
+ font-weight: bold;
92
+ }
93
+ .meta-link-bold();
94
  &:hover,
95
  &:focus {
96
  color: @hl-clr;
widgets/ink-blgs-widget/styles/thumb-right.less CHANGED
@@ -11,6 +11,7 @@
11
  @m-link: #666;
12
  @m-clr: #999;
13
  @hl-clr: #666;
 
14
  @img-ol: transparent;
15
  @img-ol-o: 1;
16
  @img-e: '';
@@ -126,6 +127,10 @@
126
  a {
127
  text-decoration: none;
128
  color: @m-link;
 
 
 
 
129
  &:hover,
130
  &:focus {
131
  color: @hl-clr;
11
  @m-link: #666;
12
  @m-clr: #999;
13
  @hl-clr: #666;
14
+ @meta-link-bold: '';
15
  @img-ol: transparent;
16
  @img-ol-o: 1;
17
  @img-e: '';
127
  a {
128
  text-decoration: none;
129
  color: @m-link;
130
+ .meta-link-bold() when ( @meta-link-bold = 1 ) {
131
+ font-weight: bold;
132
+ }
133
+ .meta-link-bold();
134
  &:hover,
135
  &:focus {
136
  color: @hl-clr;
widgets/ink-blgs-widget/tpl/thumb-above.php CHANGED
@@ -48,14 +48,14 @@ $this_post = get_the_ID();
48
  $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
49
 
50
  // Setting up query
51
- $post_selector_pseudo_query = $instance['posts'];
52
  $processed_query = siteorigin_widget_post_selector_process_query( $post_selector_pseudo_query );
53
  // Adding pagination
54
  if ( $instance['pagination']['activate'] ):
55
  $processed_query['paged'] = $paged;
56
  endif;
57
  // Excluding current post
58
- if( $instance['current'] ):
59
  $processed_query['post__not_in'] = array( $this_post );
60
  endif;
61
  $query_result = new WP_Query( $processed_query );
48
  $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
49
 
50
  // Setting up query
51
+ $post_selector_pseudo_query = $instance['loop']['posts'];
52
  $processed_query = siteorigin_widget_post_selector_process_query( $post_selector_pseudo_query );
53
  // Adding pagination
54
  if ( $instance['pagination']['activate'] ):
55
  $processed_query['paged'] = $paged;
56
  endif;
57
  // Excluding current post
58
+ if( $instance['loop']['current'] ):
59
  $processed_query['post__not_in'] = array( $this_post );
60
  endif;
61
  $query_result = new WP_Query( $processed_query );
widgets/ink-blgs-widget/tpl/thumb-behind.php CHANGED
@@ -52,14 +52,14 @@ $this_post = get_the_ID();
52
  $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
53
 
54
  // Setting up query
55
- $post_selector_pseudo_query = $instance['posts'];
56
  $processed_query = siteorigin_widget_post_selector_process_query( $post_selector_pseudo_query );
57
  // Adding pagination
58
  if ( $instance['pagination']['activate'] ):
59
  $processed_query['paged'] = $paged;
60
  endif;
61
  // Excluding current post
62
- if( $instance['current'] ):
63
  $processed_query['post__not_in'] = array( $this_post );
64
  endif;
65
  $query_result = new WP_Query( $processed_query );
52
  $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
53
 
54
  // Setting up query
55
+ $post_selector_pseudo_query = $instance['loop']['posts'];
56
  $processed_query = siteorigin_widget_post_selector_process_query( $post_selector_pseudo_query );
57
  // Adding pagination
58
  if ( $instance['pagination']['activate'] ):
59
  $processed_query['paged'] = $paged;
60
  endif;
61
  // Excluding current post
62
+ if( $instance['loop']['current'] ):
63
  $processed_query['post__not_in'] = array( $this_post );
64
  endif;
65
  $query_result = new WP_Query( $processed_query );
widgets/ink-blgs-widget/tpl/thumb-left.php CHANGED
@@ -55,14 +55,14 @@ $this_post = get_the_ID();
55
  $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
56
 
57
  // Setting up query
58
- $post_selector_pseudo_query = $instance['posts'];
59
  $processed_query = siteorigin_widget_post_selector_process_query( $post_selector_pseudo_query );
60
  // Adding pagination
61
  if ( $instance['pagination']['activate'] ):
62
  $processed_query['paged'] = $paged;
63
  endif;
64
  // Excluding current post
65
- if( $instance['current'] ):
66
  $processed_query['post__not_in'] = array( $this_post );
67
  endif;
68
  $query_result = new WP_Query( $processed_query );
55
  $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
56
 
57
  // Setting up query
58
+ $post_selector_pseudo_query = $instance['loop']['posts'];
59
  $processed_query = siteorigin_widget_post_selector_process_query( $post_selector_pseudo_query );
60
  // Adding pagination
61
  if ( $instance['pagination']['activate'] ):
62
  $processed_query['paged'] = $paged;
63
  endif;
64
  // Excluding current post
65
+ if( $instance['loop']['current'] ):
66
  $processed_query['post__not_in'] = array( $this_post );
67
  endif;
68
  $query_result = new WP_Query( $processed_query );
widgets/ink-blgs-widget/tpl/thumb-none.php CHANGED
@@ -48,14 +48,14 @@ $this_post = get_the_ID();
48
  $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
49
 
50
  // Setting up query
51
- $post_selector_pseudo_query = $instance['posts'];
52
  $processed_query = siteorigin_widget_post_selector_process_query( $post_selector_pseudo_query );
53
  // Adding pagination
54
  if ( $instance['pagination']['activate'] ):
55
  $processed_query['paged'] = $paged;
56
  endif;
57
  // Excluding current post
58
- if( $instance['current'] ):
59
  $processed_query['post__not_in'] = array( $this_post );
60
  endif;
61
  $query_result = new WP_Query( $processed_query );
48
  $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
49
 
50
  // Setting up query
51
+ $post_selector_pseudo_query = $instance['loop']['posts'];
52
  $processed_query = siteorigin_widget_post_selector_process_query( $post_selector_pseudo_query );
53
  // Adding pagination
54
  if ( $instance['pagination']['activate'] ):
55
  $processed_query['paged'] = $paged;
56
  endif;
57
  // Excluding current post
58
+ if( $instance['loop']['current'] ):
59
  $processed_query['post__not_in'] = array( $this_post );
60
  endif;
61
  $query_result = new WP_Query( $processed_query );
widgets/ink-blgs-widget/tpl/thumb-right.php CHANGED
@@ -55,14 +55,14 @@ $this_post = get_the_ID();
55
  $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
56
 
57
  // Setting up query
58
- $post_selector_pseudo_query = $instance['posts'];
59
  $processed_query = siteorigin_widget_post_selector_process_query( $post_selector_pseudo_query );
60
  // Adding pagination
61
  if ( $instance['pagination']['activate'] ):
62
  $processed_query['paged'] = $paged;
63
  endif;
64
  // Excluding current post
65
- if( $instance['current'] ):
66
  $processed_query['post__not_in'] = array( $this_post );
67
  endif;
68
  $query_result = new WP_Query( $processed_query );
55
  $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
56
 
57
  // Setting up query
58
+ $post_selector_pseudo_query = $instance['loop']['posts'];
59
  $processed_query = siteorigin_widget_post_selector_process_query( $post_selector_pseudo_query );
60
  // Adding pagination
61
  if ( $instance['pagination']['activate'] ):
62
  $processed_query['paged'] = $paged;
63
  endif;
64
  // Excluding current post
65
+ if( $instance['loop']['current'] ):
66
  $processed_query['post__not_in'] = array( $this_post );
67
  endif;
68
  $query_result = new WP_Query( $processed_query );
widgets/ink-btns-widget/assets/banner.svg CHANGED
@@ -1,23 +1,27 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <svg width="300px" height="300px" viewBox="0 0 300 300" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Button</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
- <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-1">
8
- <feGaussianBlur stdDeviation="0" in="SourceGraphic" result="blur"></feGaussianBlur>
9
- </filter>
 
10
  </defs>
11
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
12
- <g id="Button" transform="translate(30.000000, 30.000000)">
13
- <rect id="BG" stroke="#C0392B" stroke-width="30" fill="#E74C3C" filter="url(#filter-1)" x="0" y="0" width="240" height="240"></rect>
14
- <g id="Group" transform="translate(45.000000, 80.000000)">
15
- <rect id="Rectangle" stroke="#F7EBE8" stroke-width="4" x="0" y="0" width="150" height="75" rx="6"></rect>
16
- <circle id="Oval-1" stroke="#F7EBE8" stroke-width="4" cx="71.5" cy="45.5" r="10.5"></circle>
17
- <circle id="Oval-2" stroke="#F7EBE8" stroke-width="4" cx="72" cy="46" r="21"></circle>
18
- <path d="M73.9791847,47.9791847 L112.162951,57.8786797 L83.8786797,86.1629509 L73.9791847,47.9791847 Z M98.1464466,72.8535534 L125.146447,99.8535534 L125.853553,99.1464466 L98.8535534,72.1464466 L98.1464466,72.8535534 Z" id="Arrow" stroke="#F7EBE8" stroke-width="4" fill="#E74C3C"></path>
19
- <path d="M80.2734375,46.0056152 C82.494291,46.7762875 86.7765733,47.6750645 89.0220947,48.2659912 C90.7434651,48.7189834 93.6390547,49.6496965 95.6479492,50" id="Line-1" stroke="#E74C3C" stroke-width="3" stroke-linecap="square"></path>
20
- <path d="M75.8234584,69.3001508 C75.6394947,67.6651469 74.6144962,63.0589277 73.3338293,58.9634886 C71.738905,53.8630872 72.2571323,55.3586748 71.9416609,54.0179214" id="Line-2" stroke="#E74C3C" stroke-width="3" stroke-linecap="square"></path>
 
 
 
21
  </g>
22
  </g>
23
  </g>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="240px" height="240px" viewBox="0 0 240 240" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Button</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
+ <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="50%" id="radialGradient-1">
8
+ <stop stop-color="#F5515F" offset="0%"></stop>
9
+ <stop stop-color="#9F031B" offset="100%"></stop>
10
+ </radialGradient>
11
  </defs>
12
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
13
+ <g id="Widget-Icons" transform="translate(-45.000000, -604.000000)">
14
+ <g id="Button" transform="translate(45.000000, 604.000000)">
15
+ <rect id="Rectangle" fill="url(#radialGradient-1)" x="0" y="0" width="240" height="240"></rect>
16
+ <path d="M106.669084,24.2909651 C114.031546,20.5008641 125.974511,20.5039819 133.330916,24.2909651 L206.669084,62.0445158 C214.031546,65.8346168 220,75.6227107 220,83.9055336 L220,156.866109 C220,165.149515 214.025489,174.940144 206.669084,178.727127 L133.330916,216.480678 C125.968454,220.270779 114.025489,220.267661 106.669084,216.480678 L33.330916,178.727127 C25.9684544,174.937026 20,165.148932 20,156.866109 L20,83.9055336 C20,75.6221279 25.974511,65.831499 33.330916,62.0445158 L106.669084,24.2909651 Z" id="Polygon" stroke="#FFFFFF" stroke-width="5"></path>
17
+ <g id="Group" transform="translate(61.000000, 89.000000)">
18
+ <rect id="Rectangle" stroke="#F7EBE8" stroke-width="4" x="0" y="0" width="118" height="47.25" rx="6"></rect>
19
+ <ellipse id="Oval-1" stroke="#F7EBE8" stroke-width="4" cx="56.2466667" cy="28.665" rx="8.26" ry="6.615"></ellipse>
20
+ <ellipse id="Oval-2" stroke="#F7EBE8" stroke-width="4" cx="56.64" cy="28.98" rx="16.52" ry="13.23"></ellipse>
21
+ <path d="M60.0802197,30.2268864 L86.3515937,34.2479669 L64.1013003,56.4982603 L60.0802197,30.2268864 Z M77.208538,45.8977386 L98.448538,62.9077386 L99.0047953,62.4622614 L77.7647953,45.4522614 L77.208538,45.8977386 Z" id="Arrow" stroke="#F7EBE8" stroke-width="4" fill="#E74C3C"></path>
22
+ <path d="M63.1484375,28.9835376 C64.8955089,29.4690611 68.2642376,30.0352906 70.0307145,30.4075745 C71.3848592,30.6929595 73.662723,31.2793088 75.2430534,31.5" id="Line-1" stroke="#E74C3C" stroke-width="3" stroke-linecap="square"></path>
23
+ <path d="M59.6477873,43.659095 C59.5030692,42.6290425 58.696737,39.7271245 57.689279,37.1469978 C56.4346052,33.9337449 56.8422774,34.8759651 56.5941066,34.0312905" id="Line-2" stroke="#E74C3C" stroke-width="3" stroke-linecap="square"></path>
24
+ </g>
25
  </g>
26
  </g>
27
  </g>
widgets/ink-btns-widget/ink-btns-widget.php CHANGED
@@ -19,7 +19,7 @@ class Inked_Buttons_SO_Widget extends SiteOrigin_Widget {
19
 
20
  array(
21
  'description' => __( 'The power of click!', 'wpinked-widgets' ),
22
- 'help' => 'http://widgets.wpinked.com/documentation/button-widget/'
23
  ),
24
 
25
  array(
19
 
20
  array(
21
  'description' => __( 'The power of click!', 'wpinked-widgets' ),
22
+ 'help' => 'http://widgets-docs.wpinked.com/article/30-button-widget'
23
  ),
24
 
25
  array(
widgets/ink-crlc-widget/assets/banner.svg CHANGED
@@ -1,24 +1,25 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <svg width="300px" height="300px" viewBox="0 0 300 300" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Circle Counter</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
- <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-1">
8
- <feGaussianBlur stdDeviation="0" in="SourceGraphic" result="blur"></feGaussianBlur>
9
- </filter>
 
10
  </defs>
11
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
12
- <g id="Circle-Counter" transform="translate(30.000000, 30.000000)">
13
- <rect id="BG" stroke="#C0392B" stroke-width="30" fill="#E74C3C" filter="url(#filter-1)" x="0" y="0" width="240" height="240"></rect>
14
- <g id="Group" transform="translate(55.000000, 55.000000)">
15
- <circle id="Oval-3" stroke="#F7EBE8" stroke-width="4" cx="65.5" cy="65.5" r="62.5"></circle>
16
- <text id="%" font-family="OpenSans-Light, Open Sans" font-size="32" font-weight="300" fill="#F7EBE8">
17
- <tspan x="53" y="74">%</tspan>
18
- </text>
19
- <path d="M65.5,0.5 L65.5,5.5" id="Line" stroke="#E74C3C" stroke-linecap="square"></path>
20
- <path d="M5.5,66.5 L0.5,66.5" id="Line" stroke="#E74C3C" stroke-linecap="square"></path>
21
- <path d="M61.2013043,1.7311079 C61.2013043,1.7311079 52.675262,2.03734556 40.3242199,7.36391627 C34.9339633,9.68854464 29.6969495,13.4963704 24.7557117,17.4498838 C19.8735469,21.3561326 16.0196961,27.6205295 12.419824,33.7225593 C8.81995187,39.8245891 8.12861187,41.4628315 7.02782689,45.141745 C5.38892125,50.6191016 4.85169531,65.682974 4.85169531,65.682974" id="curve" stroke="#E74C3C" stroke-width="7" stroke-linecap="square" transform="translate(33.026500, 33.707041) rotate(3.000000) translate(-33.026500, -33.707041) "></path>
22
  </g>
23
  </g>
24
  </g>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="240px" height="240px" viewBox="0 0 240 240" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Circle Counter</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
+ <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="50%" id="radialGradient-1">
8
+ <stop stop-color="#F5515F" offset="0%"></stop>
9
+ <stop stop-color="#9F031B" offset="100%"></stop>
10
+ </radialGradient>
11
  </defs>
12
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
13
+ <g id="Widget-Icons" transform="translate(-335.000000, -604.000000)">
14
+ <g id="Circle-Counter" transform="translate(335.000000, 604.000000)">
15
+ <rect id="Rectangle" fill="url(#radialGradient-1)" x="0" y="0" width="240" height="240"></rect>
16
+ <path d="M106.669084,24.2909651 C114.031546,20.5008641 125.974511,20.5039819 133.330916,24.2909651 L206.669084,62.0445158 C214.031546,65.8346168 220,75.6227107 220,83.9055336 L220,156.866109 C220,165.149515 214.025489,174.940144 206.669084,178.727127 L133.330916,216.480678 C125.968454,220.270779 114.025489,220.267661 106.669084,216.480678 L33.330916,178.727127 C25.9684544,174.937026 20,165.148932 20,156.866109 L20,83.9055336 C20,75.6221279 25.974511,65.831499 33.330916,62.0445158 L106.669084,24.2909651 Z" id="Polygon" stroke="#FFFFFF" stroke-width="5"></path>
17
+ <g id="Group" transform="translate(70.000000, 70.000000)">
18
+ <circle id="Oval-3" stroke="#F7EBE8" stroke-width="4" cx="50" cy="50" r="50"></circle>
19
+ <text id="%" font-family="OpenSans-Light, Open Sans" font-size="32" font-weight="300" fill="#F7EBE8">
20
+ <tspan x="40" y="63.6">%</tspan>
21
+ </text>
22
+ </g>
23
  </g>
24
  </g>
25
  </g>
widgets/ink-crlc-widget/ink-crlc-widget.php CHANGED
@@ -19,7 +19,7 @@ class Inked_Circle_Counter_SO_Widget extends SiteOrigin_Widget {
19
 
20
  array(
21
  'description' => __( 'Animated circles to display your stats.', 'wpinked-widgets' ),
22
- 'help' => 'http://widgets.wpinked.com/documentation/circle-counter-widget/'
23
  ),
24
 
25
  array(
@@ -116,10 +116,9 @@ class Inked_Circle_Counter_SO_Widget extends SiteOrigin_Widget {
116
  ),
117
 
118
  'percent-size' => array(
119
- 'type' => 'text',
120
  'label' => __( 'Percentage Size', 'wpinked-widgets' ),
121
  'default' => '',
122
- 'description' => __( 'Please specify units, eg: px, em, rem, ...', 'wpinked-widgets' ),
123
  ),
124
 
125
  'bar' => array(
19
 
20
  array(
21
  'description' => __( 'Animated circles to display your stats.', 'wpinked-widgets' ),
22
+ 'help' => 'http://widgets-docs.wpinked.com/article/24-circle-counter-widget'
23
  ),
24
 
25
  array(
116
  ),
117
 
118
  'percent-size' => array(
119
+ 'type' => 'measurement',
120
  'label' => __( 'Percentage Size', 'wpinked-widgets' ),
121
  'default' => '',
 
122
  ),
123
 
124
  'bar' => array(
widgets/ink-crlc-widget/js/circle-counter.js CHANGED
@@ -10,6 +10,7 @@
10
  $(this.element).easyPieChart();
11
  $(this.element).css( 'min-height', 'auto' )
12
  $(this.element).find( '.iw-so-circle-timer.iw-so-circle-timer-active' ).countTo();
 
13
  }
14
  } );
15
 
10
  $(this.element).easyPieChart();
11
  $(this.element).css( 'min-height', 'auto' )
12
  $(this.element).find( '.iw-so-circle-timer.iw-so-circle-timer-active' ).countTo();
13
+ this.destroy()
14
  }
15
  } );
16
 
widgets/ink-crlc-widget/js/circle-counter.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){e(document).ready(function(){e(".iw-so-circle-chart").waypoint({offset:function(){return Waypoint.viewportHeight()-100},handler:function(){e(this.element).easyPieChart(),e(this.element).css("min-height","auto"),e(this.element).find(".iw-so-circle-timer.iw-so-circle-timer-active").countTo()}})})}(jQuery);
1
+ !function(e){e(document).ready(function(){e(".iw-so-circle-chart").waypoint({offset:function(){return Waypoint.viewportHeight()-100},handler:function(){e(this.element).easyPieChart(),e(this.element).css("min-height","auto"),e(this.element).find(".iw-so-circle-timer.iw-so-circle-timer-active").countTo(),this.destroy()}})})}(jQuery);
widgets/ink-dvdr-widget/assets/banner.svg CHANGED
@@ -1,22 +1,26 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <svg width="300px" height="300px" viewBox="0 0 300 300" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Divider</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
- <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-1">
8
- <feGaussianBlur stdDeviation="0" in="SourceGraphic" result="blur"></feGaussianBlur>
9
- </filter>
 
10
  </defs>
11
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
12
- <g id="Divider" transform="translate(30.000000, 30.000000)">
13
- <rect id="BG" stroke="#C0392B" stroke-width="30" fill="#E74C3C" filter="url(#filter-1)" x="0" y="0" width="240" height="240"></rect>
14
- <g id="Group" transform="translate(35.000000, 57.000000)" stroke="#F7EBE8" stroke-width="4" stroke-linecap="square">
15
- <path d="M0,63 L170,63" id="Line"></path>
16
- <path d="M82,49.5 L82,0" id="arrow-up" fill="#F7EBE8"></path>
17
- <path id="arrow-up-decoration-1" d="M82,0 L79,10.8 L85,10.8 L82,0 Z" fill="#F7EBE8"></path>
18
- <path d="M83,81.5 L83,131" id="arrow-down"></path>
19
- <path id="arrow-down-decoration-1" d="M83,131 L86,120.2 L80,120.2 L83,131 Z"></path>
 
 
 
20
  </g>
21
  </g>
22
  </g>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="240px" height="240px" viewBox="0 0 240 240" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Divider</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
+ <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="50%" id="radialGradient-1">
8
+ <stop stop-color="#F5515F" offset="0%"></stop>
9
+ <stop stop-color="#9F031B" offset="100%"></stop>
10
+ </radialGradient>
11
  </defs>
12
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
13
+ <g id="Widget-Icons" transform="translate(-625.000000, -604.000000)">
14
+ <g id="Divider" transform="translate(625.000000, 604.000000)">
15
+ <rect id="Rectangle" fill="url(#radialGradient-1)" x="0" y="0" width="240" height="240"></rect>
16
+ <path d="M106.669084,24.2909651 C114.031546,20.5008641 125.974511,20.5039819 133.330916,24.2909651 L206.669084,62.0445158 C214.031546,65.8346168 220,75.6227107 220,83.9055336 L220,156.866109 C220,165.149515 214.025489,174.940144 206.669084,178.727127 L133.330916,216.480678 C125.968454,220.270779 114.025489,220.267661 106.669084,216.480678 L33.330916,178.727127 C25.9684544,174.937026 20,165.148932 20,156.866109 L20,83.9055336 C20,75.6221279 25.974511,65.831499 33.330916,62.0445158 L106.669084,24.2909651 Z" id="Polygon" stroke="#FFFFFF" stroke-width="5"></path>
17
+ <g id="Group" transform="translate(71.000000, 78.000000)" stroke="#F7EBE8" stroke-width="4" stroke-linecap="square">
18
+ <path d="M0,40.8778626 L98,40.8778626" id="Line"></path>
19
+ <path d="M47.2705882,32.1183206 L47.2705882,0" id="arrow-up" fill="#F7EBE8"></path>
20
+ <path id="arrow-up-decoration-1" d="M47.2705882,0 L44.2705882,10.8 L50.2705882,10.8 L47.2705882,0 Z" fill="#F7EBE8"></path>
21
+ <path d="M47.8470588,52.8816794 L47.8470588,85" id="arrow-down"></path>
22
+ <path id="arrow-down-decoration-1" d="M47.8470588,85 L50.8470588,74.2 L44.8470588,74.2 L47.8470588,85 Z"></path>
23
+ </g>
24
  </g>
25
  </g>
26
  </g>
widgets/ink-dvdr-widget/ink-dvdr-widget.php CHANGED
@@ -19,7 +19,7 @@ class Inked_Divider_SO_Widget extends SiteOrigin_Widget {
19
 
20
  array(
21
  'description' => __( 'Draw seperators or create gaps in your page.', 'wpinked-widgets' ),
22
- 'help' => 'http://widgets.wpinked.com/documentation/divider-widget/'
23
  ),
24
 
25
  array(
@@ -54,30 +54,26 @@ class Inked_Divider_SO_Widget extends SiteOrigin_Widget {
54
  ),
55
 
56
  'size' => array(
57
- 'type' => 'text',
58
  'label' => __( 'Thickness', 'wpinked-widgets' ),
59
- 'description' => __( 'Please specify units, eg: px, em, rem, ...', 'wpinked-widgets' ),
60
  'default' => '3px'
61
  ),
62
 
63
  'width' => array(
64
- 'type' => 'text',
65
  'label' => __( 'Width', 'wpinked-widgets' ),
66
- 'description' => __( 'Please specify units, eg: px, em, rem, %, ...', 'wpinked-widgets' ),
67
  'default' => '100%'
68
  ),
69
 
70
  'margin-top' => array(
71
- 'type' => 'text',
72
  'label' => __( 'Margin Top', 'wpinked-widgets' ),
73
- 'description' => __( 'Spacing above the divider. Please specify units, eg: px, em, rem, ...', 'wpinked-widgets' ),
74
  'default' => '0'
75
  ),
76
 
77
  'margin-bottom' => array(
78
- 'type' => 'text',
79
  'label' => __( 'Margin Bottom', 'wpinked-widgets' ),
80
- 'description' => __( 'Spacing below the divider. Please specify units, eg: px, em, rem, ...', 'wpinked-widgets' ),
81
  'default' => '0'
82
  )
83
 
19
 
20
  array(
21
  'description' => __( 'Draw seperators or create gaps in your page.', 'wpinked-widgets' ),
22
+ 'help' => 'http://widgets-docs.wpinked.com/article/40-divider-widget'
23
  ),
24
 
25
  array(
54
  ),
55
 
56
  'size' => array(
57
+ 'type' => 'measurement',
58
  'label' => __( 'Thickness', 'wpinked-widgets' ),
 
59
  'default' => '3px'
60
  ),
61
 
62
  'width' => array(
63
+ 'type' => 'measurement',
64
  'label' => __( 'Width', 'wpinked-widgets' ),
 
65
  'default' => '100%'
66
  ),
67
 
68
  'margin-top' => array(
69
+ 'type' => 'measurement',
70
  'label' => __( 'Margin Top', 'wpinked-widgets' ),
 
71
  'default' => '0'
72
  ),
73
 
74
  'margin-bottom' => array(
75
+ 'type' => 'measurement',
76
  'label' => __( 'Margin Bottom', 'wpinked-widgets' ),
 
77
  'default' => '0'
78
  )
79
 
widgets/ink-fard-widget/assets/banner.svg CHANGED
@@ -1,26 +1,30 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <svg width="300px" height="300px" viewBox="0 0 300 300" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Filter Accordion</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
- <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-1">
8
- <feGaussianBlur stdDeviation="0" in="SourceGraphic" result="blur"></feGaussianBlur>
9
- </filter>
 
10
  </defs>
11
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
12
- <g id="Filter-Accordion" transform="translate(30.000000, 30.000000)">
13
- <rect id="BG" stroke="#C0392B" stroke-width="30" fill="#E74C3C" filter="url(#filter-1)" x="0" y="0" width="240" height="240"></rect>
14
- <g id="Group" transform="translate(35.000000, 34.000000)" stroke="#F7EBE8">
15
- <rect id="Rectangle" stroke-width="4" x="0" y="31" width="170" height="115"></rect>
16
- <path d="M9,159 L159,159" id="Line" stroke-width="4" stroke-linecap="square"></path>
17
- <path d="M18.9863014,172 L148.986301,172" id="Line-2" stroke-width="4" stroke-linecap="square"></path>
18
- <path d="M20.4452055,1 L35.5821918,1" id="Line-Copy-20" stroke-width="3" stroke-linecap="square"></path>
19
- <path d="M48.9383562,1 L64.0753425,1" id="Line-Copy-15" stroke-width="3" stroke-linecap="square"></path>
20
- <path d="M77.4315068,1 L92.5684932,1" id="Line-Copy-16" stroke-width="3" stroke-linecap="square"></path>
21
- <path d="M77.4315068,1 L92.5684932,1" id="Line-Copy-17" stroke-width="3" stroke-linecap="square"></path>
22
- <path d="M105.924658,1 L121.061644,1" id="Line-Copy-18" stroke-width="3" stroke-linecap="square"></path>
23
- <path d="M134.417808,1 L149.554795,1" id="Line-Copy-19" stroke-width="3" stroke-linecap="square"></path>
 
 
 
24
  </g>
25
  </g>
26
  </g>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="240px" height="240px" viewBox="0 0 240 240" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Filter Accordion</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
+ <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="50%" id="radialGradient-1">
8
+ <stop stop-color="#F5515F" offset="0%"></stop>
9
+ <stop stop-color="#9F031B" offset="100%"></stop>
10
+ </radialGradient>
11
  </defs>
12
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
13
+ <g id="Widget-Icons" transform="translate(-915.000000, -604.000000)">
14
+ <g id="Filter-Accordion" transform="translate(915.000000, 604.000000)">
15
+ <rect id="Rectangle" fill="url(#radialGradient-1)" x="0" y="0" width="240" height="240"></rect>
16
+ <path d="M106.669084,24.2909651 C114.031546,20.5008641 125.974511,20.5039819 133.330916,24.2909651 L206.669084,62.0445158 C214.031546,65.8346168 220,75.6227107 220,83.9055336 L220,156.866109 C220,165.149515 214.025489,174.940144 206.669084,178.727127 L133.330916,216.480678 C125.968454,220.270779 114.025489,220.267661 106.669084,216.480678 L33.330916,178.727127 C25.9684544,174.937026 20,165.148932 20,156.866109 L20,83.9055336 C20,75.6221279 25.974511,65.831499 33.330916,62.0445158 L106.669084,24.2909651 Z" id="Polygon" stroke="#FFFFFF" stroke-width="5"></path>
17
+ <g id="Group" transform="translate(63.000000, 75.000000)" stroke="#F7EBE8">
18
+ <rect id="Rectangle" stroke-width="4" x="0" y="16.0344828" width="115" height="59.4827586"></rect>
19
+ <path d="M6.08823529,81.2413793 L107.558824,81.2413793" id="Line" stroke-width="4" stroke-linecap="square"></path>
20
+ <path d="M12.8436745,88.9655172 L100.784851,88.9655172" id="Line-2" stroke-width="4" stroke-linecap="square"></path>
21
+ <path d="M13.8305802,0.517241379 L24.0703062,0.517241379" id="Line-Copy-20" stroke-width="3" stroke-linecap="square"></path>
22
+ <path d="M33.1053586,0.517241379 L43.3450846,0.517241379" id="Line-Copy-15" stroke-width="3" stroke-linecap="square"></path>
23
+ <path d="M52.380137,0.517241379 L62.619863,0.517241379" id="Line-Copy-16" stroke-width="3" stroke-linecap="square"></path>
24
+ <path d="M52.380137,0.517241379 L62.619863,0.517241379" id="Line-Copy-17" stroke-width="3" stroke-linecap="square"></path>
25
+ <path d="M71.6549154,0.517241379 L81.8946414,0.517241379" id="Line-Copy-18" stroke-width="3" stroke-linecap="square"></path>
26
+ <path d="M90.9296938,0.517241379 L101.16942,0.517241379" id="Line-Copy-19" stroke-width="3" stroke-linecap="square"></path>
27
+ </g>
28
  </g>
29
  </g>
30
  </g>
widgets/ink-fard-widget/css/filter-accordion.css CHANGED
@@ -22,18 +22,18 @@
22
  .iw-so-filter-acrdn-terms .iw-so-acrdn-terms > li > * {
23
  display: block; }
24
 
25
- .iw-so-accordion {
26
  margin-bottom: 0;
27
  margin-left: 0; }
28
- .iw-so-accordion .mix {
29
  display: none;
30
  width: 100%; }
31
- .iw-so-accordion .iw-so-acc-item {
32
  margin-bottom: 0;
33
  margin-top: 0 !important;
34
  margin-right: 0 !important;
35
  margin-left: 0 !important; }
36
- .iw-so-accordion .iw-so-acc-item .iw-so-acc-title {
37
  display: block;
38
  font-family: inherit;
39
  font-size: 1.1em;
@@ -44,24 +44,24 @@
44
  -webkit-transition: all 300ms ease-in-out;
45
  -moz-transition: all 300ms ease-in-out;
46
  transition: all 300ms ease-in-out; }
47
- .iw-so-accordion .iw-so-acc-item .iw-so-acc-title span {
48
  position: absolute;
49
  -webkit-transition: all 300ms ease;
50
  -moz-transition: all 300ms ease;
51
  transition: all 300ms ease; }
52
- .iw-so-accordion .iw-so-acc-item .iw-so-acc-title .iw-so-tgl-open {
53
  opacity: 1;
54
  visibility: visible; }
55
- .iw-so-accordion .iw-so-acc-item .iw-so-acc-title .iw-so-tgl-close {
56
  opacity: 0;
57
  visibility: hidden; }
58
- .iw-so-accordion .iw-so-acc-item .iw-so-acc-content {
59
  padding: 0.9375rem; }
60
- .iw-so-accordion .iw-so-acc-item .iw-so-acc-content li {
61
  display: list-item; }
62
- .iw-so-accordion .iw-so-acc-item.iw-so-acc-item-active .iw-so-acc-title .iw-so-tgl-open {
63
  opacity: 0;
64
  visibility: hidden; }
65
- .iw-so-accordion .iw-so-acc-item.iw-so-acc-item-active .iw-so-acc-title .iw-so-tgl-close {
66
  opacity: 1;
67
  visibility: visible; }
22
  .iw-so-filter-acrdn-terms .iw-so-acrdn-terms > li > * {
23
  display: block; }
24
 
25
+ .iw-so-filter-accordion.iw-so-accordion {
26
  margin-bottom: 0;
27
  margin-left: 0; }
28
+ .iw-so-filter-accordion.iw-so-accordion .mix {
29
  display: none;
30
  width: 100%; }
31
+ .iw-so-filter-accordion.iw-so-accordion .iw-so-acc-item {
32
  margin-bottom: 0;
33
  margin-top: 0 !important;
34
  margin-right: 0 !important;
35
  margin-left: 0 !important; }
36
+ .iw-so-filter-accordion.iw-so-accordion .iw-so-acc-item .iw-so-acc-title {
37
  display: block;
38
  font-family: inherit;
39
  font-size: 1.1em;
44
  -webkit-transition: all 300ms ease-in-out;
45
  -moz-transition: all 300ms ease-in-out;
46
  transition: all 300ms ease-in-out; }
47
+ .iw-so-filter-accordion.iw-so-accordion .iw-so-acc-item .iw-so-acc-title span {
48
  position: absolute;
49
  -webkit-transition: all 300ms ease;
50
  -moz-transition: all 300ms ease;
51
  transition: all 300ms ease; }
52
+ .iw-so-filter-accordion.iw-so-accordion .iw-so-acc-item .iw-so-acc-title .iw-so-tgl-open {
53
  opacity: 1;
54
  visibility: visible; }
55
+ .iw-so-filter-accordion.iw-so-accordion .iw-so-acc-item .iw-so-acc-title .iw-so-tgl-close {
56
  opacity: 0;
57
  visibility: hidden; }
58
+ .iw-so-filter-accordion.iw-so-accordion .iw-so-acc-item .iw-so-acc-content {
59
  padding: 0.9375rem; }
60
+ .iw-so-filter-accordion.iw-so-accordion .iw-so-acc-item .iw-so-acc-content li {
61
  display: list-item; }
62
+ .iw-so-filter-accordion.iw-so-accordion .iw-so-acc-item.iw-so-acc-item-active .iw-so-acc-title .iw-so-tgl-open {
63
  opacity: 0;
64
  visibility: hidden; }
65
+ .iw-so-filter-accordion.iw-so-accordion .iw-so-acc-item.iw-so-acc-item-active .iw-so-acc-title .iw-so-tgl-close {
66
  opacity: 1;
67
  visibility: visible; }
widgets/ink-fard-widget/ink-fard-widget.php CHANGED
@@ -19,7 +19,7 @@ class Inked_Filter_Accordion_SO_Widget extends SiteOrigin_Widget {
19
 
20
  array(
21
  'description' => __( 'Expand and collapse content that is broken into logical sections.', 'wpinked-widgets' ),
22
- 'help' => 'http://widgets.wpinked.com/documentation/filter-accordion/'
23
  ),
24
 
25
  array(
@@ -280,13 +280,13 @@ class Inked_Filter_Accordion_SO_Widget extends SiteOrigin_Widget {
280
 
281
  $this->register_frontend_scripts(
282
  array(
283
- array( 'iw-accordion-js', plugin_dir_url(__FILE__) . 'js/filter-accordion' . INKED_JS_SUFFIX . '.js', array( 'jquery', 'iw-mixitup-js' ), INKED_SO_VER, true )
284
  )
285
  );
286
 
287
  $this->register_frontend_styles(
288
  array(
289
- array( 'iw-accordion-css', plugin_dir_url(__FILE__) . 'css/filter-accordion.css', array(), INKED_SO_VER )
290
  )
291
  );
292
 
19
 
20
  array(
21
  'description' => __( 'Expand and collapse content that is broken into logical sections.', 'wpinked-widgets' ),
22
+ 'help' => 'http://widgets-docs.wpinked.com/article/29-filter-accordion-widget'
23
  ),
24
 
25
  array(
280
 
281
  $this->register_frontend_scripts(
282
  array(
283
+ array( 'iw-filter-accordion-js', plugin_dir_url(__FILE__) . 'js/filter-accordion' . INKED_JS_SUFFIX . '.js', array( 'jquery', 'iw-mixitup-js' ), INKED_SO_VER, true )
284
  )
285
  );
286
 
287
  $this->register_frontend_styles(
288
  array(
289
+ array( 'iw-filter-accordion-css', plugin_dir_url(__FILE__) . 'css/filter-accordion.css', array(), INKED_SO_VER )
290
  )
291
  );
292
 
widgets/ink-fard-widget/js/filter-accordion.js CHANGED
@@ -4,8 +4,8 @@
4
  $.fn.iwInitFtrAccordion = function(){
5
  "use strict";
6
 
7
- if( $( '.iw-so-accordion' ).length ) {
8
- $( '.iw-so-accordion' ).each( function() {
9
 
10
  $(this).find( '.iw-so-acc-item .iw-so-acc-content' ).hide();
11
  $(this).find( '.iw-so-acc-item.iw-so-acc-item-active .iw-so-acc-content' ).show();
4
  $.fn.iwInitFtrAccordion = function(){
5
  "use strict";
6
 
7
+ if( $( '.iw-so-filter-accordion.iw-so-accordion' ).length ) {
8
+ $( '.iw-so-filter-accordion.iw-so-accordion' ).each( function() {
9
 
10
  $(this).find( '.iw-so-acc-item .iw-so-acc-content' ).hide();
11
  $(this).find( '.iw-so-acc-item.iw-so-acc-item-active .iw-so-acc-content' ).show();
widgets/ink-fard-widget/js/filter-accordion.min.js CHANGED
@@ -1 +1 @@
1
- !function(i){i.fn.iwInitFtrAccordion=function(){"use strict";i(".iw-so-accordion").length&&i(".iw-so-accordion").each(function(){i(this).find(".iw-so-acc-item .iw-so-acc-content").hide(),i(this).find(".iw-so-acc-item.iw-so-acc-item-active .iw-so-acc-content").show(),i(this).find(".iw-so-acc-item").children(".iw-so-acc-title").click(function(c){(!i(this).parent().parent().hasClass("iw-so-acc-toggle")||!i(this).parent().siblings().hasClass("iw-so-acc-item-active")&&i(this).parent().parent().children().hasClass("iw-so-acc-item-active"))&&i(this).parent().parent().hasClass("iw-so-acc-toggle")?c.preventDefault():(c.preventDefault(),i(this).parent().toggleClass("iw-so-acc-item-active"),i(this).siblings(".iw-so-acc-content").slideToggle("300ms")),i(this).parent().parent().hasClass("iw-so-acc-singleExpand")&&i(this).parent().siblings(".iw-so-acc-item.iw-so-acc-item-active").removeClass("iw-so-acc-item-active").children(".iw-so-acc-content").slideUp("300ms")})})}}(jQuery),jQuery(function(i){if(i(document).iwInitFtrAccordion(),window.location.hash){var c=i("body").find(window.location.hash);c.hasClass("iw-so-acc-title")&&i(window.location.hash).trigger("click")}});
1
+ !function(i){i.fn.iwInitFtrAccordion=function(){"use strict";i(".iw-so-filter-accordion.iw-so-accordion").length&&i(".iw-so-filter-accordion.iw-so-accordion").each(function(){i(this).find(".iw-so-acc-item .iw-so-acc-content").hide(),i(this).find(".iw-so-acc-item.iw-so-acc-item-active .iw-so-acc-content").show(),i(this).find(".iw-so-acc-item").children(".iw-so-acc-title").click(function(c){(!i(this).parent().parent().hasClass("iw-so-acc-toggle")||!i(this).parent().siblings().hasClass("iw-so-acc-item-active")&&i(this).parent().parent().children().hasClass("iw-so-acc-item-active"))&&i(this).parent().parent().hasClass("iw-so-acc-toggle")?c.preventDefault():(c.preventDefault(),i(this).parent().toggleClass("iw-so-acc-item-active"),i(this).siblings(".iw-so-acc-content").slideToggle("300ms")),i(this).parent().parent().hasClass("iw-so-acc-singleExpand")&&i(this).parent().siblings(".iw-so-acc-item.iw-so-acc-item-active").removeClass("iw-so-acc-item-active").children(".iw-so-acc-content").slideUp("300ms")})})}}(jQuery),jQuery(function(i){if(i(document).iwInitFtrAccordion(),window.location.hash){var c=i("body").find(window.location.hash);c.hasClass("iw-so-acc-title")&&i(window.location.hash).trigger("click")}});
widgets/ink-fard-widget/styles/filter-accordion.less CHANGED
@@ -12,7 +12,7 @@
12
  @type-hl: #2c3e50;
13
  @type-pos: 'center';
14
 
15
- .iw-so-acrdn-terms {
16
 
17
  .type-pos() when (@type-pos = left) {
18
  float: left;
@@ -59,7 +59,7 @@
59
  }
60
  }
61
 
62
- .iw-so-accordion .iw-so-acc-item {
63
  .gap() when (@gap = 1) { margin-bottom: 12px; }
64
  .gap();
65
  .iw-so-acc-title {
12
  @type-hl: #2c3e50;
13
  @type-pos: 'center';
14
 
15
+ .iw-so-filter-acrdn-terms .iw-so-acrdn-terms {
16
 
17
  .type-pos() when (@type-pos = left) {
18
  float: left;
59
  }
60
  }
61
 
62
+ .iw-so-filter-accordion.iw-so-accordion .iw-so-acc-item {
63
  .gap() when (@gap = 1) { margin-bottom: 12px; }
64
  .gap();
65
  .iw-so-acc-title {
widgets/ink-fard-widget/tpl/filter-accordion.php CHANGED
@@ -34,7 +34,7 @@ $unique = ( $instance['id'] ) ? $instance['id'] : 'fard-' . ++$wpinked_widget_co
34
  </ul>
35
  </div>
36
 
37
- <div class="iw-so-accordion<?php echo $expand . $toggle; ?>" id="<?php echo $unique . '-fard-container'; ?>">
38
 
39
  <?php foreach( $instance['toggles'] as $i => $toggle ) { ?>
40
 
34
  </ul>
35
  </div>
36
 
37
+ <div class="iw-so-filter-accordion iw-so-accordion<?php echo $expand . $toggle; ?>" id="<?php echo $unique . '-fard-container'; ?>">
38
 
39
  <?php foreach( $instance['toggles'] as $i => $toggle ) { ?>
40
 
widgets/ink-mbox-widget/assets/banner.svg CHANGED
@@ -1,23 +1,27 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <svg width="300px" height="300px" viewBox="0 0 300 300" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Media Box</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
- <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-1">
8
- <feGaussianBlur stdDeviation="0" in="SourceGraphic" result="blur"></feGaussianBlur>
9
- </filter>
 
10
  </defs>
11
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
12
- <g id="Media-Box" transform="translate(30.000000, 30.000000)">
13
- <rect id="BG" stroke="#C0392B" stroke-width="30" fill="#E74C3C" filter="url(#filter-1)" x="0" y="0" width="240" height="240"></rect>
14
- <g id="Group" transform="translate(30.000000, 26.000000)" stroke="#F7EBE8" stroke-width="4">
15
- <rect id="Rectangle-19" x="0" y="0" width="179" height="58"></rect>
16
- <rect id="Rectangle-19-Copy" x="61" y="155" width="60" height="21"></rect>
17
- <path d="M56,76 L124,76" id="Line-Copy-5" stroke-linecap="square"></path>
18
- <path d="M17,96 L166,96" id="Line-Copy-6" stroke-linecap="square"></path>
19
- <path d="M17,111 L166,111" id="Line-Copy-7" stroke-linecap="square"></path>
20
- <path d="M17,126 L166,126" id="Line-Copy-8" stroke-linecap="square"></path>
 
 
 
21
  </g>
22
  </g>
23
  </g>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="240px" height="240px" viewBox="0 0 240 240" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Media Box</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
+ <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="50%" id="radialGradient-1">
8
+ <stop stop-color="#F5515F" offset="0%"></stop>
9
+ <stop stop-color="#9F031B" offset="100%"></stop>
10
+ </radialGradient>
11
  </defs>
12
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
13
+ <g id="Widget-Icons" transform="translate(-1205.000000, -604.000000)">
14
+ <g id="Media-Box" transform="translate(1205.000000, 604.000000)">
15
+ <rect id="Rectangle" fill="url(#radialGradient-1)" x="0" y="0" width="240" height="240"></rect>
16
+ <path d="M106.669084,24.2909651 C114.031546,20.5008641 125.974511,20.5039819 133.330916,24.2909651 L206.669084,62.0445158 C214.031546,65.8346168 220,75.6227107 220,83.9055336 L220,156.866109 C220,165.149515 214.025489,174.940144 206.669084,178.727127 L133.330916,216.480678 C125.968454,220.270779 114.025489,220.267661 106.669084,216.480678 L33.330916,178.727127 C25.9684544,174.937026 20,165.148932 20,156.866109 L20,83.9055336 C20,75.6221279 25.974511,65.831499 33.330916,62.0445158 L106.669084,24.2909651 Z" id="Polygon" stroke="#FFFFFF" stroke-width="5"></path>
17
+ <g id="Group" transform="translate(78.000000, 66.000000)" stroke="#F7EBE8" stroke-width="4">
18
+ <rect id="Rectangle-19" x="0" y="0" width="83" height="37.5681818"></rect>
19
+ <rect id="Rectangle-19-Copy" x="28" y="93.9204545" width="27.8212291" height="13.6022727"></rect>
20
+ <path d="M25.9664804,49.2272727 L57.4972067,49.2272727" id="Line-Copy-5" stroke-linecap="square"></path>
21
+ <path d="M7.88268156,62.1818182 L76.972067,62.1818182" id="Line-Copy-6" stroke-linecap="square"></path>
22
+ <path d="M7.88268156,71.8977273 L76.972067,71.8977273" id="Line-Copy-7" stroke-linecap="square"></path>
23
+ <path d="M7.88268156,81.6136364 L76.972067,81.6136364" id="Line-Copy-8" stroke-linecap="square"></path>
24
+ </g>
25
  </g>
26
  </g>
27
  </g>
widgets/ink-mbox-widget/ink-mbox-widget.php CHANGED
@@ -19,7 +19,7 @@ class Inked_Media_Box_SO_Widget extends SiteOrigin_Widget {
19
 
20
  array(
21
  'description' => __( 'Highlight important bits of information.', 'wpinked-widgets' ),
22
- 'help' => 'http://widgets.wpinked.com/documentation/media-box-widget/'
23
  ),
24
 
25
  array(
@@ -145,17 +145,15 @@ class Inked_Media_Box_SO_Widget extends SiteOrigin_Widget {
145
  'fields' => array(
146
 
147
  'padding-top' => array(
148
- 'type' => 'text',
149
  'label' => __( 'Padding Top', 'wpinked-widgets' ),
150
  'default' => '30px',
151
- 'description' => __( 'Please specify units, eg: px, em, rem, ...', 'wpinked-widgets' )
152
  ),
153
 
154
  'padding-bottom' => array(
155
- 'type' => 'text',
156
  'label' => __( 'Padding Bottom', 'wpinked-widgets' ),
157
  'default' => '30px',
158
- 'description' => __( 'Please specify units, eg: px, em, rem, ...', 'wpinked-widgets' )
159
  ),
160
 
161
  'img-shape' => array(
@@ -186,10 +184,9 @@ class Inked_Media_Box_SO_Widget extends SiteOrigin_Widget {
186
  ),
187
 
188
  'icon-size' => array(
189
- 'type' => 'text',
190
  'label' => __( 'Icon Size', 'wpinked-widgets' ),
191
  'default' => '',
192
- 'description' => __( 'Please specify units, eg: px, em, rem, ...', 'wpinked-widgets' ),
193
  'state_handler' => array(
194
  'media_type[image]' => array( 'hide' ),
195
  'media_type[icon]' => array( 'show' ),
19
 
20
  array(
21
  'description' => __( 'Highlight important bits of information.', 'wpinked-widgets' ),
22
+ 'help' => 'http://widgets-docs.wpinked.com/article/36-media-box-widget'
23
  ),
24
 
25
  array(
145
  'fields' => array(
146
 
147
  'padding-top' => array(
148
+ 'type' => 'measurement',
149
  'label' => __( 'Padding Top', 'wpinked-widgets' ),
150
  'default' => '30px',
 
151
  ),
152
 
153
  'padding-bottom' => array(
154
+ 'type' => 'measurement',
155
  'label' => __( 'Padding Bottom', 'wpinked-widgets' ),
156
  'default' => '30px',
 
157
  ),
158
 
159
  'img-shape' => array(
184
  ),
185
 
186
  'icon-size' => array(
187
+ 'type' => 'measurement',
188
  'label' => __( 'Icon Size', 'wpinked-widgets' ),
189
  'default' => '',
 
190
  'state_handler' => array(
191
  'media_type[image]' => array( 'hide' ),
192
  'media_type[icon]' => array( 'show' ),
widgets/ink-numc-widget/assets/banner.svg CHANGED
@@ -1,20 +1,24 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <svg width="300px" height="300px" viewBox="0 0 300 300" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Number Counter</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
- <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-1">
8
- <feGaussianBlur stdDeviation="0" in="SourceGraphic" result="blur"></feGaussianBlur>
9
- </filter>
 
10
  </defs>
11
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
12
- <g id="Number-Counter" transform="translate(30.000000, 30.000000)">
13
- <rect id="BG" stroke="#C0392B" stroke-width="30" fill="#E74C3C" filter="url(#filter-1)" x="0" y="0" width="240" height="240"></rect>
14
- <g id="Group" transform="translate(52.000000, 88.000000)" font-size="48" font-family="OpenSans-Light, Open Sans" fill="#F7EBE8" font-weight="300">
15
- <text id="123">
16
- <tspan x="0" y="51">12345</tspan>
17
- </text>
 
 
 
18
  </g>
19
  </g>
20
  </g>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="240px" height="240px" viewBox="0 0 240 240" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Number Counter</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
+ <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="50%" id="radialGradient-1">
8
+ <stop stop-color="#F5515F" offset="0%"></stop>
9
+ <stop stop-color="#9F031B" offset="100%"></stop>
10
+ </radialGradient>
11
  </defs>
12
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
13
+ <g id="Widget-Icons" transform="translate(-1205.000000, -885.000000)">
14
+ <g id="Number-Counter" transform="translate(1205.000000, 885.000000)">
15
+ <rect id="Rectangle" fill="url(#radialGradient-1)" x="0" y="0" width="240" height="240"></rect>
16
+ <path d="M106.669084,24.2909651 C114.031546,20.5008641 125.974511,20.5039819 133.330916,24.2909651 L206.669084,62.0445158 C214.031546,65.8346168 220,75.6227107 220,83.9055336 L220,156.866109 C220,165.149515 214.025489,174.940144 206.669084,178.727127 L133.330916,216.480678 C125.968454,220.270779 114.025489,220.267661 106.669084,216.480678 L33.330916,178.727127 C25.9684544,174.937026 20,165.148932 20,156.866109 L20,83.9055336 C20,75.6221279 25.974511,65.831499 33.330916,62.0445158 L106.669084,24.2909651 Z" id="Polygon" stroke="#FFFFFF" stroke-width="5"></path>
17
+ <g id="Group" transform="translate(65.000000, 94.000000)" font-size="38" font-family="OpenSans-Light, Open Sans" fill="#F7EBE8" font-weight="300">
18
+ <text id="123">
19
+ <tspan x="0" y="41">12345</tspan>
20
+ </text>
21
+ </g>
22
  </g>
23
  </g>
24
  </g>
widgets/ink-numc-widget/ink-numc-widget.php CHANGED
@@ -19,7 +19,7 @@ class Inked_Number_Counter_SO_Widget extends SiteOrigin_Widget {
19
 
20
  array(
21
  'description' => __( 'Animated numbers to display your stats.', 'wpinked-widgets' ),
22
- 'help' => 'http://widgets.wpinked.com/documentation/number-counter-widget/'
23
  ),
24
 
25
  array(
@@ -109,10 +109,9 @@ class Inked_Number_Counter_SO_Widget extends SiteOrigin_Widget {
109
  ),
110
 
111
  'number-size' => array(
112
- 'type' => 'text',
113
  'label' => __( 'Number Size', 'wpinked-widgets' ),
114
  'default' => '',
115
- 'description' => __( 'Please specify units, eg: px, em, rem, ...', 'wpinked-widgets' ),
116
  ),
117
 
118
  )
19
 
20
  array(
21
  'description' => __( 'Animated numbers to display your stats.', 'wpinked-widgets' ),
22
+ 'help' => 'http://widgets-docs.wpinked.com/article/26-number-counter-widget'
23
  ),
24
 
25
  array(
109
  ),
110
 
111
  'number-size' => array(
112
+ 'type' => 'measurement',
113
  'label' => __( 'Number Size', 'wpinked-widgets' ),
114
  'default' => '',
 
115
  ),
116
 
117
  )
widgets/ink-prit-widget/assets/banner.svg CHANGED
@@ -1,20 +1,24 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <svg width="300px" height="300px" viewBox="0 0 300 300" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Pricing Table</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
- <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-1">
8
- <feGaussianBlur stdDeviation="0" in="SourceGraphic" result="blur"></feGaussianBlur>
9
- </filter>
 
10
  </defs>
11
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
12
- <g id="Pricing-Table" transform="translate(30.000000, 30.000000)">
13
- <rect id="BG" stroke="#C0392B" stroke-width="30" fill="#E74C3C" filter="url(#filter-1)" x="0" y="0" width="240" height="240"></rect>
14
- <g id="Group" transform="translate(24.000000, 54.000000)" stroke="#F7EBE8" stroke-width="4">
15
- <rect id="Rectangle-Copy-11" x="0" y="8" width="54.1121495" height="115"></rect>
16
- <rect id="Rectangle-Copy-12" x="138.88785" y="8" width="54.1121495" height="115"></rect>
17
- <rect id="Rectangle-Copy-13" x="61.3271028" y="0" width="69.4439252" height="133"></rect>
 
 
 
18
  </g>
19
  </g>
20
  </g>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="240px" height="240px" viewBox="0 0 240 240" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Pricing Table</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
+ <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="50%" id="radialGradient-1">
8
+ <stop stop-color="#F5515F" offset="0%"></stop>
9
+ <stop stop-color="#9F031B" offset="100%"></stop>
10
+ </radialGradient>
11
  </defs>
12
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
13
+ <g id="Widget-Icons" transform="translate(-45.000000, -885.000000)">
14
+ <g id="Pricing-Table" transform="translate(45.000000, 885.000000)">
15
+ <rect id="Rectangle" fill="url(#radialGradient-1)" x="0" y="0" width="240" height="240"></rect>
16
+ <path d="M106.669084,24.2909651 C114.031546,20.5008641 125.974511,20.5039819 133.330916,24.2909651 L206.669084,62.0445158 C214.031546,65.8346168 220,75.6227107 220,83.9055336 L220,156.866109 C220,165.149515 214.025489,174.940144 206.669084,178.727127 L133.330916,216.480678 C125.968454,220.270779 114.025489,220.267661 106.669084,216.480678 L33.330916,178.727127 C25.9684544,174.937026 20,165.148932 20,156.866109 L20,83.9055336 C20,75.6221279 25.974511,65.831499 33.330916,62.0445158 L106.669084,24.2909651 Z" id="Polygon" stroke="#FFFFFF" stroke-width="5"></path>
17
+ <g id="Group" transform="translate(63.000000, 84.000000)" stroke="#F7EBE8" stroke-width="4">
18
+ <rect id="Rectangle-Copy-11" x="0" y="4.33082707" width="31.9626168" height="62.2556391"></rect>
19
+ <rect id="Rectangle-Copy-12" x="82.0373832" y="4.33082707" width="31.9626168" height="62.2556391"></rect>
20
+ <rect id="Rectangle-Copy-13" x="36.2242991" y="0" width="41.0186916" height="72"></rect>
21
+ </g>
22
  </g>
23
  </g>
24
  </g>
widgets/ink-prit-widget/ink-prit-widget.php CHANGED
@@ -19,7 +19,7 @@ class Inked_Pricing_Table_SO_Widget extends SiteOrigin_Widget {
19
 
20
  array(
21
  'description' => __( 'Simple responsive pricing tables.', 'wpinked-widgets' ),
22
- 'help' => 'http://widgets.wpinked.com/documentation/pricing-table-widget/'
23
  ),
24
 
25
  array(
19
 
20
  array(
21
  'description' => __( 'Simple responsive pricing tables.', 'wpinked-widgets' ),
22
+ 'help' => 'http://widgets-docs.wpinked.com/article/18-pricing-table-widget'
23
  ),
24
 
25
  array(
widgets/ink-prsn-widget/assets/banner.svg CHANGED
@@ -1,21 +1,25 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <svg width="300px" height="300px" viewBox="0 0 300 300" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Person</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
- <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-1">
8
- <feGaussianBlur stdDeviation="0" in="SourceGraphic" result="blur"></feGaussianBlur>
9
- </filter>
 
10
  </defs>
11
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
12
- <g id="Person" transform="translate(30.000000, 30.000000)">
13
- <rect id="BG" stroke="#C0392B" stroke-width="30" fill="#E74C3C" filter="url(#filter-1)" x="0" y="0" width="240" height="240"></rect>
14
- <g id="Group" transform="translate(52.000000, 39.000000)" stroke="#F7EBE8" stroke-width="4">
15
- <path d="M68,103.289949 C87.882251,103.289949 104,68.2506268 104,36.4890449 C104,4.72746301 87.882251,0 68,0 C48.117749,0 32,4.72746301 32,36.4890449 C32,68.2506268 48.117749,103.289949 68,103.289949 Z" id="Oval-6"></path>
16
- <path d="M44.5,86.5 C44.5,86.5 13.949161,100.675673 6.18273306,111.972296 C-0.717505687,122.009007 0.5,150.5 0.5,150.5" id="Line" stroke-linecap="square"></path>
17
- <path d="M135.5,86.5 C135.5,86.5 104.949161,100.675673 97.1827331,111.972296 C90.2824943,122.009007 91.5,150.5 91.5,150.5" id="Line-Copy-3" stroke-linecap="square" transform="translate(113.458582, 118.500000) scale(-1, 1) translate(-113.458582, -118.500000) "></path>
18
- <path d="M0.5,152 L135,152" id="Line" stroke-linecap="square"></path>
 
 
 
19
  </g>
20
  </g>
21
  </g>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="240px" height="240px" viewBox="0 0 240 240" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Person</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
+ <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="50%" id="radialGradient-1">
8
+ <stop stop-color="#F5515F" offset="0%"></stop>
9
+ <stop stop-color="#9F031B" offset="100%"></stop>
10
+ </radialGradient>
11
  </defs>
12
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
13
+ <g id="Widget-Icons" transform="translate(-625.000000, -885.000000)">
14
+ <g id="Person" transform="translate(625.000000, 885.000000)">
15
+ <rect id="Rectangle" fill="url(#radialGradient-1)" x="0" y="0" width="240" height="240"></rect>
16
+ <path d="M106.669084,24.2909651 C114.031546,20.5008641 125.974511,20.5039819 133.330916,24.2909651 L206.669084,62.0445158 C214.031546,65.8346168 220,75.6227107 220,83.9055336 L220,156.866109 C220,165.149515 214.025489,174.940144 206.669084,178.727127 L133.330916,216.480678 C125.968454,220.270779 114.025489,220.267661 106.669084,216.480678 L33.330916,178.727127 C25.9684544,174.937026 20,165.148932 20,156.866109 L20,83.9055336 C20,75.6221279 25.974511,65.831499 33.330916,62.0445158 L106.669084,24.2909651 Z" id="Polygon" stroke="#FFFFFF" stroke-width="5"></path>
17
+ <g id="Group" transform="translate(83.000000, 75.000000)" stroke="#F7EBE8" stroke-width="4">
18
+ <path d="M37,60.7587938 C47.8182836,60.7587938 56.5882353,40.1474275 56.5882353,21.4641441 C56.5882353,2.78086059 47.8182836,0 37,0 C26.1817164,0 17.4117647,2.78086059 17.4117647,21.4641441 C17.4117647,40.1474275 26.1817164,60.7587938 37,60.7587938 Z" id="Oval-6"></path>
19
+ <path d="M24.2132353,50.8823529 C24.2132353,50.8823529 7.58998465,59.2209843 3.36413416,65.8660563 C-0.390407506,71.7700039 0.272058824,88.5294118 0.272058824,88.5294118" id="Line" stroke-linecap="square"></path>
20
+ <path d="M73.7279412,50.8823529 C73.7279412,50.8823529 57.1046905,59.2209843 52.87884,65.8660563 C49.1242984,71.7700039 49.7867647,88.5294118 49.7867647,88.5294118" id="Line-Copy-3" stroke-linecap="square" transform="translate(61.734817, 69.705882) scale(-1, 1) translate(-61.734817, -69.705882) "></path>
21
+ <path d="M0.272058824,89.4117647 L73.4558824,89.4117647" id="Line" stroke-linecap="square"></path>
22
+ </g>
23
  </g>
24
  </g>
25
  </g>
widgets/ink-prsn-widget/css/person.css CHANGED
@@ -1,52 +1,86 @@
1
- .iw-so-person.iw-so-person-fit {
2
- text-align: center; }
3
- .iw-so-person.iw-so-person-fit .iw-so-person-img {
4
- display: inline-block; }
5
- .iw-so-person.iw-so-person-fit .iw-so-person-img img {
6
- width: auto; }
7
-
8
- .iw-so-person .iw-so-person-img {
9
  position: relative;
10
- margin-bottom: 1em; }
11
- .iw-so-person .iw-so-person-img img {
12
- vertical-align: top;
13
- width: 100%; }
14
- .iw-so-person .iw-so-person-img .iw-so-person-ol {
15
- border-radius: inherit;
16
- opacity: 0;
17
- position: absolute;
18
- top: 0;
19
- width: 100%;
20
- height: 100%;
21
- box-sizing: border-box; }
22
- .iw-so-person .iw-so-person-img .iw-so-person-ol p {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  position: absolute;
24
- top: 50%;
25
- -webkit-transform: translateY(-50%);
26
- -moz-transform: translateY(-50%);
27
- -ms-transform: translateY(-50%);
28
- -o-transform: translateY(-50%);
29
- transform: translateY(-50%);
30
  width: 100%;
31
- padding: 0 15px;
32
- opacity: 0;
33
- margin: 0 !important;
34
  box-sizing: border-box; }
35
- .iw-so-person .iw-so-person-img .iw-so-person-ol:hover, .iw-so-person .iw-so-person-img .iw-so-person-ol:focus,
36
- .iw-so-person .iw-so-person-img .iw-so-person-ol:hover p,
37
- .iw-so-person .iw-so-person-img .iw-so-person-ol:focus p {
38
- opacity: 1; }
39
-
40
- .iw-so-person .iw-so-person-profiles [class^="sow-icon-"] {
41
- font-size: 2em; }
42
-
43
- .iw-so-person .iw-so-person-name {
44
- margin-top: 0.7em;
45
- margin-bottom: 0 !important; }
46
-
47
- .iw-so-person .iw-so-person-desig {
48
- margin-top: 0;
49
- margin-bottom: 0.3em; }
50
-
51
- .iw-so-person .iw-so-person-about {
52
- margin-bottom: 0; }
 
 
 
 
 
 
 
 
 
1
+ .iw-so-person {
 
 
 
 
 
 
 
2
  position: relative;
3
+ max-width: 1200px;
4
+ margin-left: auto;
5
+ margin-right: auto; }
6
+ .iw-so-person::after {
7
+ clear: both;
8
+ content: "";
9
+ display: table; }
10
+ .iw-so-person.iw-so-person-fit {
11
+ text-align: center; }
12
+ .iw-so-person.iw-so-person-fit .iw-so-person-img {
13
+ display: inline-block; }
14
+ .iw-so-person.iw-so-person-fit .iw-so-person-img img {
15
+ width: auto; }
16
+ .iw-so-person.iw-so-person-left .iw-so-person-img {
17
+ float: left;
18
+ display: block;
19
+ margin-right: 2.35765%;
20
+ width: 31.76157%; }
21
+ .iw-so-person.iw-so-person-left .iw-so-person-content {
22
+ float: left;
23
+ display: block;
24
+ width: 65.88078%; }
25
+ .iw-so-person.iw-so-person-left .iw-so-person-content .iw-so-person-name {
26
+ margin-top: 0; }
27
+ .iw-so-person.iw-so-person-right .iw-so-person-img {
28
+ float: right;
29
+ display: block;
30
+ margin-left: 2.35765%;
31
+ width: 31.76157%; }
32
+ .iw-so-person.iw-so-person-right .iw-so-person-content {
33
+ float: right;
34
+ display: block;
35
+ width: 65.88078%; }
36
+ .iw-so-person.iw-so-person-right .iw-so-person-content .iw-so-person-name {
37
+ margin-top: 0; }
38
+ @media only screen and (max-width: 640px) {
39
+ .iw-so-person.iw-so-person-left .iw-so-person-img, .iw-so-person.iw-so-person-right .iw-so-person-img {
40
+ float: none;
41
+ margin: 0;
42
+ width: 100%; }
43
+ .iw-so-person.iw-so-person-left .iw-so-person-content, .iw-so-person.iw-so-person-right .iw-so-person-content {
44
+ float: none;
45
+ margin: 0;
46
+ width: 100%; } }
47
+ .iw-so-person .iw-so-person-img {
48
+ position: relative; }
49
+ .iw-so-person .iw-so-person-img img {
50
+ vertical-align: top;
51
+ width: 100%; }
52
+ .iw-so-person .iw-so-person-img .iw-so-person-ol {
53
+ border-radius: inherit;
54
+ opacity: 0;
55
  position: absolute;
56
+ top: 0;
 
 
 
 
 
57
  width: 100%;
58
+ height: 100%;
 
 
59
  box-sizing: border-box; }
60
+ .iw-so-person .iw-so-person-img .iw-so-person-ol p {
61
+ position: absolute;
62
+ top: 50%;
63
+ -webkit-transform: translateY(-50%);
64
+ -moz-transform: translateY(-50%);
65
+ -ms-transform: translateY(-50%);
66
+ -o-transform: translateY(-50%);
67
+ transform: translateY(-50%);
68
+ width: 100%;
69
+ padding: 0 15px;
70
+ opacity: 0;
71
+ margin: 0 !important;
72
+ box-sizing: border-box; }
73
+ .iw-so-person .iw-so-person-img .iw-so-person-ol:hover, .iw-so-person .iw-so-person-img .iw-so-person-ol:focus,
74
+ .iw-so-person .iw-so-person-img .iw-so-person-ol:hover p,
75
+ .iw-so-person .iw-so-person-img .iw-so-person-ol:focus p {
76
+ opacity: 1; }
77
+ .iw-so-person .iw-so-person-profiles [class^="sow-icon-"] {
78
+ font-size: 2em; }
79
+ .iw-so-person .iw-so-person-name {
80
+ margin-top: 0.7em;
81
+ margin-bottom: 0 !important; }
82
+ .iw-so-person .iw-so-person-desig {
83
+ margin-top: 0;
84
+ margin-bottom: 0.3em; }
85
+ .iw-so-person .iw-so-person-about {
86
+ margin-bottom: 0; }
widgets/ink-prsn-widget/ink-prsn-widget.php CHANGED
@@ -19,7 +19,7 @@ class Inked_Person_SO_Widget extends SiteOrigin_Widget {
19
 
20
  array(
21
  'description' => __( 'Getting to know you better.', 'wpinked-widgets' ),
22
- 'help' => 'http://widgets.wpinked.com/documentation/person-widget/'
23
  ),
24
 
25
  array(
@@ -113,6 +113,17 @@ class Inked_Person_SO_Widget extends SiteOrigin_Widget {
113
  'hide' => true,
114
  'fields' => array(
115
 
 
 
 
 
 
 
 
 
 
 
 
116
  'design' => array(
117
  'type' => 'select',
118
  'label' => __( 'Design', 'wpinked-widgets' ),
@@ -175,6 +186,12 @@ class Inked_Person_SO_Widget extends SiteOrigin_Widget {
175
  'default' => ''
176
  ),
177
 
 
 
 
 
 
 
178
  'name' => array(
179
  'type' => 'color',
180
  'label' => __( 'Name Color', 'wpinked-widgets' ),
@@ -241,6 +258,7 @@ class Inked_Person_SO_Widget extends SiteOrigin_Widget {
241
  'icon-h' => $instance['styling']['icon-hover'],
242
  'icon' => $instance['styling']['icon'],
243
  'content' => $instance['styling']['content'],
 
244
  'name' => $instance['styling']['name'],
245
  'designation' => $instance['styling']['designation'],
246
  'about' => $instance['styling']['about'],
19
 
20
  array(
21
  'description' => __( 'Getting to know you better.', 'wpinked-widgets' ),
22
+ 'help' => 'http://widgets-docs.wpinked.com/article/37-person-widget'
23
  ),
24
 
25
  array(
113
  'hide' => true,
114
  'fields' => array(
115
 
116
+ 'layout' => array(
117
+ 'type' => 'select',
118
+ 'label' => __( 'Layout', 'wpinked-widgets' ),
119
+ 'default' => 'above',
120
+ 'options' => array(
121
+ 'above' => __( 'Image Above', 'wpinked-widgets' ),
122
+ 'left' => __( 'Image to the left', 'wpinked-widgets' ),
123
+ 'right' => __( 'Image to the right', 'wpinked-widgets' )
124
+ )
125
+ ),
126
+
127
  'design' => array(
128
  'type' => 'select',
129
  'label' => __( 'Design', 'wpinked-widgets' ),
186
  'default' => ''
187
  ),
188
 
189
+ 'content-padding' => array(
190
+ 'type' => 'measurement',
191
+ 'label' => __( 'Padding above content section', 'wpinked-widgets' ),
192
+ 'default' => '0px',
193
+ ),
194
+
195
  'name' => array(
196
  'type' => 'color',
197
  'label' => __( 'Name Color', 'wpinked-widgets' ),
258
  'icon-h' => $instance['styling']['icon-hover'],
259
  'icon' => $instance['styling']['icon'],
260
  'content' => $instance['styling']['content'],
261
+ 'content-pad' => $instance['styling']['content-padding'],
262
  'name' => $instance['styling']['name'],
263
  'designation' => $instance['styling']['designation'],
264
  'about' => $instance['styling']['about'],
widgets/ink-prsn-widget/styles/person.less CHANGED
@@ -6,6 +6,7 @@
6
  @icon-h: #333;
7
  @icon: #ccc;
8
  @content: transparent;
 
9
  @name: #666;
10
  @designation: #aaa;
11
  @about: #333;
@@ -31,10 +32,12 @@
31
 
32
  .iw-so-person-content {
33
  background: @content;
 
34
 
35
  .iw-so-person-name {
36
  font-size: 1.25em;
37
  font-weight: bold;
 
38
  }
39
 
40
  .iw-so-person-desig {
@@ -42,6 +45,11 @@
42
  font-weight: lighter;
43
  font-style: italic;
44
  letter-spacing: 2px;
 
 
 
 
 
45
  }
46
 
47
  }
6
  @icon-h: #333;
7
  @icon: #ccc;
8
  @content: transparent;
9
+ @content-pad: 0px;
10
  @name: #666;
11
  @designation: #aaa;
12
  @about: #333;
32
 
33
  .iw-so-person-content {
34
  background: @content;
35
+ padding-top: @content-pad;
36
 
37
  .iw-so-person-name {
38
  font-size: 1.25em;
39
  font-weight: bold;
40
+ color: @name;
41
  }
42
 
43
  .iw-so-person-desig {
45
  font-weight: lighter;
46
  font-style: italic;
47
  letter-spacing: 2px;
48
+ color: @designation;
49
+ }
50
+
51
+ .iw-so-person-about {
52
+ color: @about;
53
  }
54
 
55
  }
widgets/ink-prsn-widget/tpl/person.php CHANGED
@@ -1,45 +1 @@
1
- <div class="iw-so-person <?php echo ( $instance['styling']['img-width'] == false ? 'iw-so-person-fit' : '' ) ?>">
2
-
3
- <div class="iw-so-person-img">
4
-
5
- <?php echo wp_get_attachment_image( $instance['person']['image'], 'full' ); ?>
6
-
7
- <div class="iw-so-person-ol">
8
-
9
- <?php if( $instance['styling']['design'] == 'about' ) : ?>
10
-
11
- <p class="iw-so-person-about <?php echo esc_attr ( $instance['styling']['align'] );?>"><?php echo wp_kses_post( $instance['person']['about'] ); ?></p>
12
-
13
- <?php endif; ?>
14
-
15
- <?php if( $instance['styling']['design'] == 'icons' ) : ?>
16
-
17
- <?php wpinked_so_person_social( $instance['social']['profiles'], $instance['styling']['align'], $instance['social']['target'] ); ?>
18
-
19
- <?php endif; ?>
20
-
21
- </div>
22
-
23
- </div>
24
-
25
- <div class="iw-so-person-content">
26
-
27
- <h4 class="iw-so-person-name <?php echo esc_attr ( $instance['styling']['align'] );?>"><?php echo esc_html( $instance['name'] ); ?></h4>
28
-
29
- <p class="iw-so-person-desig <?php echo esc_attr ( $instance['styling']['align'] );?>"><?php echo esc_html( $instance['person']['designation'] ); ?></p>
30
-
31
- <?php if( $instance['styling']['design'] != 'about' ) : ?>
32
-
33
- <p class="iw-so-person-about <?php echo esc_attr ( $instance['styling']['align'] );?>"><?php echo wp_kses_post( $instance['person']['about'] ); ?></p>
34
-
35
- <?php endif; ?>
36
-
37
- <?php if( $instance['styling']['design'] != 'icons' ) : ?>
38
-
39
- <?php wpinked_so_person_social( $instance['social']['profiles'], $instance['styling']['align'], $instance['social']['target'] ); ?>
40
-
41
- <?php endif; ?>
42
-
43
- </div>
44
-
45
- </div>
1
+ <?php wpinked_so_person_template( $instance['name'], $instance['person'], $instance['social'], $instance['styling'] ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
widgets/ink-ptfl-widget/assets/banner.svg CHANGED
@@ -1,26 +1,35 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <svg width="300px" height="300px" viewBox="0 0 300 300" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Portfolio</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
- <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-1">
8
- <feGaussianBlur stdDeviation="0" in="SourceGraphic" result="blur"></feGaussianBlur>
9
- </filter>
 
10
  </defs>
11
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
12
- <g id="Portfolio" transform="translate(30.000000, 30.000000)">
13
- <rect id="BG" stroke="#C0392B" stroke-width="30" fill="#E74C3C" filter="url(#filter-1)" x="0" y="0" width="240" height="240"></rect>
14
- <g id="Group" transform="translate(29.000000, 30.000000)" stroke="#F7EBE8">
15
- <rect id="Rectangle-17" stroke-width="4" x="0" y="0" width="182" height="181"></rect>
16
- <path d="M5,6 L175,6" id="Line" stroke-width="10" stroke-linecap="square"></path>
17
- <path d="M4,38 L179,38" id="Line-Copy-4" stroke-width="4" stroke-linecap="square"></path>
18
- <path d="M4,66 L178,66" id="Line-Copy-5" stroke-width="4" stroke-linecap="square"></path>
19
- <path d="M4,96 L178,96" id="Line-Copy-9" stroke-width="4" stroke-linecap="square"></path>
20
- <path d="M5,124 L179,124" id="Line-Copy-10" stroke-width="4" stroke-linecap="square"></path>
21
- <path d="M5,152 L179,152" id="Line-Copy-11" stroke-width="4" stroke-linecap="square"></path>
22
- <path d="M62,7.5 L62,179.5" id="Line-Copy-12" stroke-width="4" stroke-linecap="square"></path>
23
- <path d="M124,7.5 L124,179.5" id="Line-Copy-13" stroke-width="4" stroke-linecap="square"></path>
 
 
 
 
 
 
 
 
24
  </g>
25
  </g>
26
  </g>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="240px" height="240px" viewBox="0 0 240 240" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Portfolio</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
+ <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="50%" id="radialGradient-1">
8
+ <stop stop-color="#F5515F" offset="0%"></stop>
9
+ <stop stop-color="#9F031B" offset="100%"></stop>
10
+ </radialGradient>
11
  </defs>
12
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
13
+ <g id="Widget-Icons" transform="translate(-625.000000, -1166.000000)">
14
+ <g id="Portfolio" transform="translate(625.000000, 1166.000000)">
15
+ <rect id="Rectangle" fill="url(#radialGradient-1)" x="0" y="0" width="240" height="240"></rect>
16
+ <path d="M106.669084,24.2909651 C114.031546,20.5008641 125.974511,20.5039819 133.330916,24.2909651 L206.669084,62.0445158 C214.031546,65.8346168 220,75.6227107 220,83.9055336 L220,156.866109 C220,165.149515 214.025489,174.940144 206.669084,178.727127 L133.330916,216.480678 C125.968454,220.270779 114.025489,220.267661 106.669084,216.480678 L33.330916,178.727127 C25.9684544,174.937026 20,165.148932 20,156.866109 L20,83.9055336 C20,75.6221279 25.974511,65.831499 33.330916,62.0445158 L106.669084,24.2909651 Z" id="Polygon" stroke="#FFFFFF" stroke-width="5"></path>
17
+ <g id="Group-Copy-6" transform="translate(49.000000, 75.000000)" stroke="#F7EBE8">
18
+ <rect id="Rectangle" stroke-width="4" x="0" y="17" width="32.8041902" height="29.9655172"></rect>
19
+ <rect id="Rectangle-Copy" stroke-width="4" x="38" y="17" width="32.8041902" height="29.9655172"></rect>
20
+ <rect id="Rectangle-Copy-2" stroke-width="4" x="77" y="17" width="32.8041902" height="29.9655172"></rect>
21
+ <rect id="Rectangle-Copy-3" stroke-width="4" x="115" y="17" width="32.8041902" height="29.9655172"></rect>
22
+ <rect id="Rectangle-Copy-7" stroke-width="4" x="0" y="53" width="32.8041902" height="29.9655172"></rect>
23
+ <rect id="Rectangle-Copy-6" stroke-width="4" x="38" y="53" width="32.8041902" height="29.9655172"></rect>
24
+ <rect id="Rectangle-Copy-5" stroke-width="4" x="77" y="53" width="32.8041902" height="29.9655172"></rect>
25
+ <rect id="Rectangle-Copy-4" stroke-width="4" x="115" y="53" width="32.8041902" height="29.9655172"></rect>
26
+ <path d="M32.8305802,0.517241379 L43.0703062,0.517241379" id="Line-Copy-20" stroke-width="3" stroke-linecap="square"></path>
27
+ <path d="M52.1053586,0.517241379 L62.3450846,0.517241379" id="Line-Copy-15" stroke-width="3" stroke-linecap="square"></path>
28
+ <path d="M71.380137,0.517241379 L81.619863,0.517241379" id="Line-Copy-16" stroke-width="3" stroke-linecap="square"></path>
29
+ <path d="M71.380137,0.517241379 L81.619863,0.517241379" id="Line-Copy-17" stroke-width="3" stroke-linecap="square"></path>
30
+ <path d="M90.6549154,0.517241379 L100.894641,0.517241379" id="Line-Copy-18" stroke-width="3" stroke-linecap="square"></path>
31
+ <path d="M109.929694,0.517241379 L120.16942,0.517241379" id="Line-Copy-19" stroke-width="3" stroke-linecap="square"></path>
32
+ </g>
33
  </g>
34
  </g>
35
  </g>
widgets/ink-ptfl-widget/ink-ptfl-widget.php CHANGED
@@ -19,7 +19,7 @@ class Inked_Folio_SO_Widget extends SiteOrigin_Widget {
19
 
20
  array(
21
  'description' => __( 'Show off your work.', 'wpinked-widgets' ),
22
- 'help' => 'http://widgets.wpinked.com/documentation/portfolio-widget/'
23
  ),
24
 
25
  array(
19
 
20
  array(
21
  'description' => __( 'Show off your work.', 'wpinked-widgets' ),
22
+ 'help' => 'http://widgets-docs.wpinked.com/article/14-portfolio-widget'
23
  ),
24
 
25
  array(
widgets/ink-ptfl-widget/js/portfolio.js CHANGED
@@ -3,12 +3,16 @@
3
  $(document).ready( function() {
4
 
5
  $(function() {
6
- $( '#folio-grid .iw-so-project-article' ).matchHeight({
7
- byRow: false,
8
- property: 'height',
9
- target: null,
10
- remove: false
11
- });
 
 
 
 
12
  });
13
 
14
  });
3
  $(document).ready( function() {
4
 
5
  $(function() {
6
+ if( $( '.iw-so-folio-grid' ).length ) {
7
+ $( '.iw-so-folio-grid' ).each( function() {
8
+ $(this).find( '.iw-so-project-article' ).matchHeight({
9
+ byRow: false,
10
+ property: 'height',
11
+ target: null,
12
+ remove: false
13
+ });
14
+ } );
15
+ }
16
  });
17
 
18
  });
widgets/ink-ptfl-widget/js/portfolio.min.js CHANGED
@@ -1 +1 @@
1
- !function(t){t(document).ready(function(){t(function(){t("#folio-grid .iw-so-project-article").matchHeight({byRow:!1,property:"height",target:null,remove:!1})})})}(jQuery);
1
+ !function(i){i(document).ready(function(){i(function(){i(".iw-so-folio-grid").length&&i(".iw-so-folio-grid").each(function(){i(this).find(".iw-so-project-article").matchHeight({byRow:!1,property:"height",target:null,remove:!1})})})})}(jQuery);
widgets/ink-sldr-widget/assets/banner.svg ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="240px" height="240px" viewBox="0 0 240 240" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
+ <title>Slider</title>
5
+ <desc>Created with Sketch.</desc>
6
+ <defs>
7
+ <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="50%" id="radialGradient-1">
8
+ <stop stop-color="#F5515F" offset="0%"></stop>
9
+ <stop stop-color="#9F031B" offset="100%"></stop>
10
+ </radialGradient>
11
+ </defs>
12
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
13
+ <g id="Widget-Icons" transform="translate(-1205.000000, -24.000000)">
14
+ <g id="Slider" transform="translate(1205.000000, 24.000000)">
15
+ <rect id="Rectangle" fill="url(#radialGradient-1)" x="0" y="0" width="240" height="240"></rect>
16
+ <path d="M106.669084,24.2909651 C114.031546,20.5008641 125.974511,20.5039819 133.330916,24.2909651 L206.669084,62.0445158 C214.031546,65.8346168 220,75.6227107 220,83.9055336 L220,156.866109 C220,165.149515 214.025489,174.940144 206.669084,178.727127 L133.330916,216.480678 C125.968454,220.270779 114.025489,220.267661 106.669084,216.480678 L33.330916,178.727127 C25.9684544,174.937026 20,165.148932 20,156.866109 L20,83.9055336 C20,75.6221279 25.974511,65.831499 33.330916,62.0445158 L106.669084,24.2909651 Z" id="Polygon" stroke="#FFFFFF" stroke-width="5"></path>
17
+ <g id="Group" transform="translate(54.000000, 76.000000)" stroke="#FFFFFF">
18
+ <rect id="Mask" stroke-width="4" x="8" y="0" width="116" height="77"></rect>
19
+ <path d="M99.1428571,77 L16.2857143,77 L57.7142857,31.5 L57.7142857,31.5 C57.7142857,31.5 75.8240452,51.3895117 84.8789249,61.3342675" id="Triangle-1" stroke-width="4"></path>
20
+ <ellipse id="Oval-7" stroke-width="4" cx="97.0714286" cy="26.25" rx="10.3571429" ry="8.75"></ellipse>
21
+ <path d="M107.428571,75.25 C107.428571,66.5515152 99.08188,59.5 88.7857143,59.5 C78.4895486,59.5 70.1428571,66.5515152 70.1428571,75.25" id="Oval-8" stroke-width="4"></path>
22
+ <rect id="Rectangle-72" stroke-width="3" x="121" y="6" width="11" height="65" rx="3"></rect>
23
+ <rect id="Rectangle-72-Copy" stroke-width="3" x="0" y="6" width="11" height="65" rx="3"></rect>
24
+ </g>
25
+ </g>
26
+ </g>
27
+ </g>
28
+ </svg>
widgets/ink-sldr-widget/css/slider.css CHANGED
@@ -113,3 +113,26 @@
113
  .iw-so-slider.slick-dotted .slick-dots li.slick-active button:before {
114
  color: #333;
115
  opacity: 0.9; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  .iw-so-slider.slick-dotted .slick-dots li.slick-active button:before {
114
  color: #333;
115
  opacity: 0.9; }
116
+
117
+ .iw-so-slider .iw-so-slider-slide {
118
+ position: relative; }
119
+ .iw-so-slider .iw-so-slider-slide .iw-so-slide-caption {
120
+ position: absolute;
121
+ padding: 0 25px;
122
+ width: 100%; }
123
+ .iw-so-slider .iw-so-slider-slide .iw-so-slide-caption [class^="sow-icon-"] {
124
+ position: absolute;
125
+ font-size: 30px;
126
+ bottom: 0;
127
+ top: 50%;
128
+ -webkit-transform: translateY(-50%);
129
+ -moz-transform: translateY(-50%);
130
+ -ms-transform: translateY(-50%);
131
+ -o-transform: translateY(-50%);
132
+ transform: translateY(-50%); }
133
+ .iw-so-slider .iw-so-slider-slide .iw-so-slide-caption .caption {
134
+ margin-left: 40px;
135
+ font-size: 18px;
136
+ font-style: italic;
137
+ line-height: 1.3;
138
+ padding: 10px; }
widgets/ink-sldr-widget/ink-sldr-widget.php CHANGED
@@ -19,7 +19,7 @@ class Inked_Slider_SO_Widget extends SiteOrigin_Widget {
19
 
20
  array(
21
  'description' => __( 'A most basic image slider to leave a great impression.', 'wpinked-widgets' ),
22
- 'help' => 'http://widgets.wpinked.com/documentation/slider-widget/'
23
  ),
24
 
25
  array(
@@ -27,174 +27,233 @@ class Inked_Slider_SO_Widget extends SiteOrigin_Widget {
27
 
28
  array(
29
 
30
- 'admin' => array(
31
- 'type' => 'text',
32
- 'label' => __( 'Admin Label', 'wpinked-widgets' )
33
  ),
34
 
35
- 'slides' => array(
36
- 'type' => 'repeater',
37
- 'label' => __( 'Slides' , 'wpinked-widgets' ),
38
- 'item_name' => __( 'Slide', 'wpinked-widgets' ),
39
- 'item_label' => array(
40
- 'selector' => "[id*='title']",
41
- 'update_event' => 'change',
42
- 'value_method' => 'val'
43
  ),
44
- 'fields' => array(
45
 
46
- 'name' => array(
47
- 'type' => 'text',
48
- 'label' => __( 'Name', 'wpinked-widgets' ),
49
- 'default' => ''
50
  ),
51
 
52
- 'image' => array(
53
- 'type' => 'media',
54
- 'fallback' => true,
55
- 'label' => __( 'Image', 'wpinked-widgets' ),
56
- 'default' => '',
57
- 'library' => 'image',
58
  ),
59
 
60
  )
61
  ),
62
 
63
- 'settings' => array(
64
- 'type' => 'section',
65
- 'label' => __( 'Settings' , 'wpinked-widgets' ),
66
- 'hide' => true,
67
- 'fields' => array(
68
 
69
- 'adaptive' => array(
70
- 'type' => 'checkbox',
71
- 'default' => false,
72
- 'label' => __( 'Enable Adaptive Height', 'wpinked-widgets' ),
73
  ),
74
 
75
- 'autoplay' => array(
76
- 'type' => 'checkbox',
77
- 'default' => false,
78
- 'label' => __( 'Enable Autoplay', 'wpinked-widgets' ),
79
  ),
80
 
81
- 'autoplay-speed' => array(
82
- 'type' => 'number',
83
- 'label' => __( 'Autoplay Speed', 'wpinked-widgets' ),
84
- 'default' => '3000',
85
- 'description' => __( 'Value in milliseconds.', 'wpinked-widgets' ),
86
  ),
87
 
88
- 'autoplay-focus' => array(
89
- 'type' => 'checkbox',
90
- 'default' => true,
91
- 'label' => __( 'Pause Autoplay on Focus', 'wpinked-widgets' ),
92
  ),
93
 
94
- 'autoplay-hover' => array(
95
- 'type' => 'checkbox',
96
- 'default' => true,
97
- 'label' => __( 'Pause Autoplay on Hover', 'wpinked-widgets' ),
98
  ),
99
 
100
- 'arrows' => array(
101
- 'type' => 'checkbox',
102
- 'default' => true,
103
- 'label' => __( 'Enable Arrow Navigation', 'wpinked-widgets' ),
104
  ),
105
 
106
- 'arrows-hover' => array(
107
- 'type' => 'checkbox',
108
- 'default' => false,
109
- 'label' => __( 'Show arrows only on hover', 'wpinked-widgets' ),
110
  ),
111
 
112
  'prev-arrow' => array(
113
- 'type' => 'icon',
114
- 'label' => __( 'Previous Arrow', 'wpinked-widgets' ),
115
  ),
116
 
117
  'next-arrow' => array(
118
- 'type' => 'icon',
119
- 'label' => __( 'Next Arrow', 'wpinked-widgets' ),
120
  ),
121
 
122
  'dots' => array(
123
- 'type' => 'checkbox',
124
- 'default' => false,
125
- 'label' => __( 'Enable Dots Navigation', 'wpinked-widgets' ),
126
  ),
127
 
128
- 'dots-hover' => array(
129
- 'type' => 'checkbox',
130
- 'default' => false,
131
- 'label' => __( 'Pause Autoplay on Dots Hover', 'wpinked-widgets' ),
132
  ),
133
 
134
  'fade' => array(
135
- 'type' => 'checkbox',
136
- 'default' => false,
137
- 'label' => __( 'Enable Fade Transitions', 'wpinked-widgets' ),
138
  ),
139
 
140
- 'infinite' => array(
141
- 'type' => 'checkbox',
142
- 'default' => true,
143
- 'label' => __( 'Enable Infinite Loop', 'wpinked-widgets' ),
 
 
 
 
 
 
 
 
 
 
 
144
  ),
145
 
146
  )
147
  ),
148
 
149
- 'styling' => array(
150
- 'type' => 'section',
151
- 'label' => __( 'Styling' , 'wpinked-widgets' ),
152
- 'hide' => true,
153
- 'fields' => array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
 
155
- 'icon-color' => array(
156
- 'type' => 'color',
157
- 'label' => __( 'Icon Color', 'wpinked-widgets' ),
158
- 'default' => '#fff'
159
  ),
160
 
161
- 'icon-size' => array(
162
- 'type' => 'measurement',
163
- 'label' => __( 'Icon Size', 'wpinked-widgets'),
164
- 'default' => '25px'
165
  ),
166
 
167
- 'icon-bg' => array(
168
- 'type' => 'color',
169
- 'label' => __( 'Icon Background', 'wpinked-widgets' ),
170
- 'default' => '#333'
 
 
 
 
171
  ),
172
 
173
- 'icon-hover' => array(
174
- 'type' => 'checkbox',
175
- 'default' => false,
176
- 'label' => __( 'Display icons only on slider hover', 'wpinked-widgets' ),
177
  ),
178
 
179
- 'dot-color' => array(
180
- 'type' => 'color',
181
- 'label' => __( 'Dot Color', 'wpinked-widgets' ),
182
- 'default' => '#333'
183
  ),
184
 
185
- 'dot-size' => array(
186
- 'type' => 'measurement',
187
- 'label' => __( 'Dot Size', 'wpinked-widgets'),
188
- 'default' => '18px'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
  ),
190
 
191
- 'dot-position' => array(
192
- 'type' => 'select',
193
- 'label' => __( 'Dot position', 'wpinked-widgets' ),
194
- 'default' => 'below',
195
- 'options' => array(
196
- 'below' => __( 'Below Slider', 'wpinked-widgets' ),
197
- 'bottom' => __( 'Bottom of Slider', 'wpinked-widgets' ),
198
  ),
199
  ),
200
 
@@ -237,13 +296,19 @@ class Inked_Slider_SO_Widget extends SiteOrigin_Widget {
237
  if( empty( $instance ) ) return array();
238
 
239
  return array(
240
- 'icon-color' => $instance['styling']['icon-color'],
241
- 'icon-size' => $instance['styling']['icon-size'],
242
- 'icon-bg' => $instance['styling']['icon-bg'],
243
- 'icon-hover' => $instance['styling']['icon-hover'],
244
- 'dot-color' => $instance['styling']['dot-color'],
245
- 'dot-size' => $instance['styling']['dot-size'],
246
- 'dot-position' => $instance['styling']['dot-position'],
 
 
 
 
 
 
247
  );
248
 
249
  }
19
 
20
  array(
21
  'description' => __( 'A most basic image slider to leave a great impression.', 'wpinked-widgets' ),
22
+ 'help' => 'http://widgets-docs.wpinked.com/article/35-slider-widget'
23
  ),
24
 
25
  array(
27
 
28
  array(
29
 
30
+ 'admin' => array(
31
+ 'type' => 'text',
32
+ 'label' => __( 'Admin Label', 'wpinked-widgets' )
33
  ),
34
 
35
+ 'slides' => array(
36
+ 'type' => 'repeater',
37
+ 'label' => __( 'Slides' , 'wpinked-widgets' ),
38
+ 'item_name' => __( 'Slide', 'wpinked-widgets' ),
39
+ 'item_label' => array(
40
+ 'selector' => "[id*='name']",
41
+ 'update_event' => 'change',
42
+ 'value_method' => 'val'
43
  ),
44
+ 'fields' => array(
45
 
46
+ 'name' => array(
47
+ 'type' => 'text',
48
+ 'label' => __( 'Name', 'wpinked-widgets' ),
49
+ 'default' => ''
50
  ),
51
 
52
+ 'image' => array(
53
+ 'type' => 'media',
54
+ 'fallback' => true,
55
+ 'label' => __( 'Image', 'wpinked-widgets' ),
56
+ 'default' => '',
57
+ 'library' => 'image',
58
  ),
59
 
60
  )
61
  ),
62
 
63
+ 'settings' => array(
64
+ 'type' => 'section',
65
+ 'label' => __( 'Settings' , 'wpinked-widgets' ),
66
+ 'hide' => true,
67
+ 'fields' => array(
68
 
69
+ 'adaptive' => array(
70
+ 'type' => 'checkbox',
71
+ 'default' => false,
72
+ 'label' => __( 'Enable Adaptive Height', 'wpinked-widgets' ),
73
  ),
74
 
75
+ 'autoplay' => array(
76
+ 'type' => 'checkbox',
77
+ 'default' => false,
78
+ 'label' => __( 'Enable Autoplay', 'wpinked-widgets' ),
79
  ),
80
 
81
+ 'autoplay-speed' => array(
82
+ 'type' => 'number',
83
+ 'label' => __( 'Autoplay Speed', 'wpinked-widgets' ),
84
+ 'default' => '3000',
85
+ 'description' => __( 'Value in milliseconds.', 'wpinked-widgets' ),
86
  ),
87
 
88
+ 'autoplay-focus' => array(
89
+ 'type' => 'checkbox',
90
+ 'default' => true,
91
+ 'label' => __( 'Pause Autoplay on Focus', 'wpinked-widgets' ),
92
  ),
93
 
94
+ 'autoplay-hover' => array(
95
+ 'type' => 'checkbox',
96
+ 'default' => true,
97
+ 'label' => __( 'Pause Autoplay on Hover', 'wpinked-widgets' ),
98
  ),
99
 
100
+ 'arrows' => array(
101
+ 'type' => 'checkbox',
102
+ 'default' => true,
103
+ 'label' => __( 'Enable Arrow Navigation', 'wpinked-widgets' ),
104
  ),
105
 
106
+ 'arrows-hover' => array(
107
+ 'type' => 'checkbox',
108
+ 'default' => false,
109
+ 'label' => __( 'Show arrows only on hover', 'wpinked-widgets' ),
110
  ),
111
 
112
  'prev-arrow' => array(
113
+ 'type' => 'icon',
114
+ 'label' => __( 'Previous Arrow', 'wpinked-widgets' ),
115
  ),
116
 
117
  'next-arrow' => array(
118
+ 'type' => 'icon',
119
+ 'label' => __( 'Next Arrow', 'wpinked-widgets' ),
120
  ),
121
 
122
  'dots' => array(
123
+ 'type' => 'checkbox',
124
+ 'default' => false,
125
+ 'label' => __( 'Enable Dots Navigation', 'wpinked-widgets' ),
126
  ),
127
 
128
+ 'dots-hover' => array(
129
+ 'type' => 'checkbox',
130
+ 'default' => false,
131
+ 'label' => __( 'Pause Autoplay on Dots Hover', 'wpinked-widgets' ),
132
  ),
133
 
134
  'fade' => array(
135
+ 'type' => 'checkbox',
136
+ 'default' => false,
137
+ 'label' => __( 'Enable Fade Transitions', 'wpinked-widgets' ),
138
  ),
139
 
140
+ 'infinite' => array(
141
+ 'type' => 'checkbox',
142
+ 'default' => true,
143
+ 'label' => __( 'Enable Infinite Loop', 'wpinked-widgets' ),
144
+ ),
145
+
146
+ 'caption' => array(
147
+ 'type' => 'checkbox',
148
+ 'default' => true,
149
+ 'label' => __( 'Show Caption', 'wpinked-widgets' ),
150
+ ),
151
+
152
+ 'caption-icon' => array(
153
+ 'type' => 'icon',
154
+ 'label' => __( 'Caption Icon', 'wpinked-widgets' ),
155
  ),
156
 
157
  )
158
  ),
159
 
160
+ 'styling' => array(
161
+ 'type' => 'section',
162
+ 'label' => __( 'Styling' , 'wpinked-widgets' ),
163
+ 'hide' => true,
164
+ 'fields' => array(
165
+
166
+ 'icon-color' => array(
167
+ 'type' => 'color',
168
+ 'label' => __( 'Icon Color', 'wpinked-widgets' ),
169
+ 'default' => '#fff'
170
+ ),
171
+
172
+ 'icon-size' => array(
173
+ 'type' => 'measurement',
174
+ 'label' => __( 'Icon Size', 'wpinked-widgets'),
175
+ 'default' => '25px'
176
+ ),
177
+
178
+ 'icon-bg' => array(
179
+ 'type' => 'color',
180
+ 'label' => __( 'Icon Background', 'wpinked-widgets' ),
181
+ 'default' => '#333'
182
+ ),
183
+
184
+ 'icon-border' => array(
185
+ 'type' => 'color',
186
+ 'label' => __( 'Icon Border', 'wpinked-widgets-pro' ),
187
+ 'default' => '#333'
188
+ ),
189
+
190
+ 'icon-border-width' => array(
191
+ 'type' => 'measurement',
192
+ 'label' => __( 'Icon Border Width', 'wpinked-widgets-pro'),
193
+ 'default' => '0px'
194
+ ),
195
 
196
+ 'icon-padding' => array(
197
+ 'type' => 'measurement',
198
+ 'label' => __( 'Icon Padding', 'wpinked-widgets-pro'),
199
+ 'default' => '10px'
200
  ),
201
 
202
+ 'icon-margin' => array(
203
+ 'type' => 'measurement',
204
+ 'label' => __( 'Icon Margin', 'wpinked-widgets-pro'),
205
+ 'default' => '0px'
206
  ),
207
 
208
+ 'icon-shape' => array(
209
+ 'type' => 'select',
210
+ 'label' => __( 'Icon Border Radius', 'wpinked-widgets-pro' ),
211
+ 'default' => '0',
212
+ 'options' => array(
213
+ '0' => __( 'Sharp', 'wpinked-widgets-pro' ),
214
+ '10em' => __( 'Curved', 'wpinked-widgets-pro' )
215
+ )
216
  ),
217
 
218
+ 'dot-color' => array(
219
+ 'type' => 'color',
220
+ 'label' => __( 'Dot Color', 'wpinked-widgets' ),
221
+ 'default' => '#333'
222
  ),
223
 
224
+ 'dot-size' => array(
225
+ 'type' => 'measurement',
226
+ 'label' => __( 'Dot Size', 'wpinked-widgets'),
227
+ 'default' => '18px'
228
  ),
229
 
230
+ 'dot-position' => array(
231
+ 'type' => 'select',
232
+ 'label' => __( 'Dot position', 'wpinked-widgets' ),
233
+ 'default' => 'below',
234
+ 'options' => array(
235
+ 'below' => __( 'Below Slider', 'wpinked-widgets' ),
236
+ 'bottom' => __( 'Bottom of Slider', 'wpinked-widgets' ),
237
+ ),
238
+ ),
239
+
240
+ 'caption-position' => array(
241
+ 'type' => 'select',
242
+ 'label' => __( 'Caption position', 'wpinked-widgets' ),
243
+ 'default' => 'bottom',
244
+ 'options' => array(
245
+ 'top' => __( 'Top', 'wpinked-widgets' ),
246
+ 'bottom' => __( 'Bottom', 'wpinked-widgets' ),
247
+ ),
248
  ),
249
 
250
+ 'caption-theme' => array(
251
+ 'type' => 'select',
252
+ 'label' => __( 'Caption theme', 'wpinked-widgets' ),
253
+ 'default' => 'dark',
254
+ 'options' => array(
255
+ 'light' => __( 'Light', 'wpinked-widgets' ),
256
+ 'dark' => __( 'Dark', 'wpinked-widgets' ),
257
  ),
258
  ),
259
 
296
  if( empty( $instance ) ) return array();
297
 
298
  return array(
299
+ 'icon-color' => $instance['styling']['icon-color'],
300
+ 'icon-size' => $instance['styling']['icon-size'],
301
+ 'icon-bg' => $instance['styling']['icon-bg'],
302
+ 'icon-border' => $instance['styling']['icon-border'],
303
+ 'icon-border-width' => $instance['styling']['icon-border-width'],
304
+ 'icon-padding' => $instance['styling']['icon-padding'],
305
+ 'icon-margin' => $instance['styling']['icon-margin'],
306
+ 'icon-shape' => $instance['styling']['icon-shape'],
307
+ 'dot-color' => $instance['styling']['dot-color'],
308
+ 'dot-size' => $instance['styling']['dot-size'],
309
+ 'dot-position' => $instance['styling']['dot-position'],
310
+ 'caption-position' => $instance['styling']['caption-position'],
311
+ 'caption-theme' => $instance['styling']['caption-theme'],
312
  );
313
 
314
  }
widgets/ink-sldr-widget/styles/slider.less CHANGED
@@ -1,25 +1,32 @@
1
  @icon-color: #fff;
2
  @icon-size: 25px;
3
  @icon-bg: #333;
4
- @icon-hover: '';
 
 
 
 
5
  @dot-color: #333;
6
  @dot-size: 18px;
7
  @dot-position: below;
 
 
8
 
9
  .iw-so-slider {
10
  .slick-arrow {
11
  font-size: @icon-size;
12
  color: @icon-color;
13
  background-color: @icon-bg;
 
 
 
 
 
 
14
 
15
  &:hover {
16
  opacity: 1;
17
  }
18
-
19
- .arrow-hide() when ( @icon-hover = 1 ) {
20
- visibility: hidden;
21
- }
22
- .arrow-hide();
23
  }
24
 
25
  &:hover {
@@ -45,8 +52,43 @@
45
 
46
  .dot-pos() when ( @dot-position = bottom ) {
47
  position: relative;
48
- bottom: 47px;
49
  }
50
  .dot-pos();
51
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  }
1
  @icon-color: #fff;
2
  @icon-size: 25px;
3
  @icon-bg: #333;
4
+ @icon-border: #333;
5
+ @icon-border-width: 0px;
6
+ @icon-padding: 10px;
7
+ @icon-margin: 0px;
8
+ @icon-shape: 0;
9
  @dot-color: #333;
10
  @dot-size: 18px;
11
  @dot-position: below;
12
+ @caption-position: bottom;
13
+ @caption-theme: dark;
14
 
15
  .iw-so-slider {
16
  .slick-arrow {
17
  font-size: @icon-size;
18
  color: @icon-color;
19
  background-color: @icon-bg;
20
+ border-color: @icon-border;
21
+ border-width: @icon-border-width;
22
+ border-style: solid;
23
+ border-radius: @icon-shape;
24
+ padding: @icon-padding;
25
+ margin: @icon-margin;
26
 
27
  &:hover {
28
  opacity: 1;
29
  }
 
 
 
 
 
30
  }
31
 
32
  &:hover {
52
 
53
  .dot-pos() when ( @dot-position = bottom ) {
54
  position: relative;
55
+ bottom: 30px;
56
  }
57
  .dot-pos();
58
  }
59
+
60
+ .iw-so-slider-slide {
61
+
62
+ .iw-so-slide-caption {
63
+ .caption-pos() when ( @caption-position = bottom ) {
64
+ bottom: 20px;
65
+ }
66
+ .caption-pos() when ( @caption-position = top ) {
67
+ top: 20px;
68
+ }
69
+ .caption-pos();
70
+
71
+ [class^="sow-icon-"] {
72
+ .caption-icon-clr() when ( @caption-theme = light ) {
73
+ color: rgba( 255,255,255,0.8 );
74
+ }
75
+ .caption-icon-clr() when ( @caption-theme = dark ) {
76
+ color: rgba( 0,0,0,0.8 );
77
+ }
78
+ .caption-icon-clr();
79
+ }
80
+
81
+ .caption {
82
+ .caption-clr() when ( @caption-theme = light ) {
83
+ background: rgba( 255,255,255,0.8 );
84
+ color: rgba( 0,0,0,0.8 );
85
+ }
86
+ .caption-clr() when ( @caption-theme = dark ) {
87
+ background: rgba( 0,0,0,0.8 );
88
+ color: rgba( 255,255,255,0.8 );
89
+ }
90
+ .caption-clr();
91
+ }
92
+ }
93
+ }
94
  }
widgets/ink-sldr-widget/tpl/slider.php CHANGED
@@ -34,6 +34,12 @@ if ( $instance['settings']['arrows-hover'] ) $arrow_hover = ' iw-so-slider-arrow
34
 
35
  <div class="iw-so-slider-slide">
36
  <center><?php echo wp_get_attachment_image( $slide['image'], 'full' ); ?></center>
 
 
 
 
 
 
37
  </div>
38
 
39
  <?php } ?>
34
 
35
  <div class="iw-so-slider-slide">
36
  <center><?php echo wp_get_attachment_image( $slide['image'], 'full' ); ?></center>
37
+ <?php if ( $instance['settings']['caption'] && get_post( $slide['image'] )->post_excerpt != null ) : ?>
38
+ <div class="iw-so-slide-caption">
39
+ <?php echo ( $instance['settings']['caption-icon'] ? str_replace( '"', "'", siteorigin_widget_get_icon( $instance['settings']['caption-icon'], $icon_styles ) ) : '' ); ?>
40
+ <?php echo '<div class="caption">' . get_post( $slide['image'] )->post_excerpt . '</div>'; ?>
41
+ </div>
42
+ <?php endif; ?>
43
  </div>
44
 
45
  <?php } ?>
widgets/ink-tabb-widget/assets/banner.svg CHANGED
@@ -1,17 +1,25 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <svg width="300px" height="300px" viewBox="0 0 300 300" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Tabs</title>
5
  <desc>Created with Sketch.</desc>
6
- <defs></defs>
 
 
 
 
 
7
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
8
- <g id="Tabs" transform="translate(30.000000, 30.000000)">
9
- <rect id="BG" stroke="#C0392B" stroke-width="30" fill="#E74C3C" x="0" y="0" width="240" height="240"></rect>
10
- <g id="Group" transform="translate(35.000000, 54.000000)" stroke="#F7EBE8" stroke-width="4">
11
- <path d="M48,16.2608696 L170,16.2608696 L170,118 L0,118 L0,17.9565217 L0,1 L48,1 L48,16.2608696 Z" id="Rectangle"></path>
12
- <path d="M47.5,1 L122.5,1" id="Line" stroke-linecap="square"></path>
13
- <path d="M123,1 L123,16" id="Line" stroke-linecap="square"></path>
14
- <path d="M88,3 L88,15" id="Line-Copy-14" stroke-linecap="square"></path>
 
 
 
15
  </g>
16
  </g>
17
  </g>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="240px" height="240px" viewBox="0 0 240 240" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Tabs</title>
5
  <desc>Created with Sketch.</desc>
6
+ <defs>
7
+ <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="50%" id="radialGradient-1">
8
+ <stop stop-color="#F5515F" offset="0%"></stop>
9
+ <stop stop-color="#9F031B" offset="100%"></stop>
10
+ </radialGradient>
11
+ </defs>
12
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
13
+ <g id="Widget-Icons" transform="translate(-45.000000, -314.000000)">
14
+ <g id="Tabs" transform="translate(45.000000, 314.000000)">
15
+ <rect id="Rectangle" fill="url(#radialGradient-1)" x="0" y="0" width="240" height="240"></rect>
16
+ <path d="M106.669084,24.2909651 C114.031546,20.5008641 125.974511,20.5039819 133.330916,24.2909651 L206.669084,62.0445158 C214.031546,65.8346168 220,75.6227107 220,83.9055336 L220,156.866109 C220,165.149515 214.025489,174.940144 206.669084,178.727127 L133.330916,216.480678 C125.968454,220.270779 114.025489,220.267661 106.669084,216.480678 L33.330916,178.727127 C25.9684544,174.937026 20,165.148932 20,156.866109 L20,83.9055336 C20,75.6221279 25.974511,65.831499 33.330916,62.0445158 L106.669084,24.2909651 Z" id="Polygon" stroke="#FFFFFF" stroke-width="5"></path>
17
+ <g id="Group" transform="translate(65.000000, 71.000000)" stroke="#F7EBE8" stroke-width="4">
18
+ <path d="M31.0588235,13.50479 L110,13.50479 L110,98 L0,98 L0,14.9130435 L0,0.830508475 L31.0588235,0.830508475 L31.0588235,13.50479 Z" id="Rectangle"></path>
19
+ <path d="M30.7352941,0.830508475 L79.2647059,0.830508475" id="Line" stroke-linecap="square"></path>
20
+ <path d="M79.5882353,0.830508475 L79.5882353,13.2881356" id="Line" stroke-linecap="square"></path>
21
+ <path d="M56.9411765,2.49152542 L56.9411765,12.4576271" id="Line-Copy-14" stroke-linecap="square"></path>
22
+ </g>
23
  </g>
24
  </g>
25
  </g>
widgets/ink-tabb-widget/ink-tabb-widget.php CHANGED
@@ -19,7 +19,7 @@ class Inked_Tabs_SO_Widget extends SiteOrigin_Widget {
19
 
20
  array(
21
  'description' => __( 'Organize and navigate multiple documents in a single container.', 'wpinked-widgets' ),
22
- 'help' => 'http://widgets.wpinked.com/documentation/tabs-widget/'
23
  ),
24
 
25
  array(
19
 
20
  array(
21
  'description' => __( 'Organize and navigate multiple documents in a single container.', 'wpinked-widgets' ),
22
+ 'help' => 'http://widgets-docs.wpinked.com/article/27-tabs-widget'
23
  ),
24
 
25
  array(
widgets/ink-tsml-widget/assets/banner.svg CHANGED
@@ -1,25 +1,29 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <svg width="300px" height="300px" viewBox="0 0 300 300" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Testimonial</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
- <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-1">
8
- <feGaussianBlur stdDeviation="0" in="SourceGraphic" result="blur"></feGaussianBlur>
9
- </filter>
 
10
  </defs>
11
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
12
- <g id="Testimonial" transform="translate(30.000000, 30.000000)">
13
- <rect id="BG" stroke="#C0392B" stroke-width="30" fill="#E74C3C" filter="url(#filter-1)" x="0" y="0" width="240" height="240"></rect>
14
- <g id="Group" transform="translate(29.666667, 21.000000)" stroke="#F7EBE8" stroke-width="4">
15
- <path d="M90.3333333,156.632328 C100.079535,156.632328 107.980392,139.45619 107.980392,123.886787 C107.980392,108.317384 100.079535,106 90.3333333,106 C80.5871319,106 72.6862745,108.317384 72.6862745,123.886787 C72.6862745,139.45619 80.5871319,156.632328 90.3333333,156.632328 Z" id="Oval-6"></path>
16
- <path d="M78.8137255,148.401961 C78.8137255,148.401961 63.837824,155.35082 60.0307515,160.88838 C56.6482815,165.808337 57.245098,179.77451 57.245098,179.77451" id="Line" stroke-linecap="square"></path>
17
- <path d="M123.421569,148.401961 C123.421569,148.401961 108.445667,155.35082 104.638595,160.88838 C101.256125,165.808337 101.852941,179.77451 101.852941,179.77451" id="Line-Copy-3" stroke-linecap="square" transform="translate(112.616952, 164.088235) scale(-1, 1) translate(-112.616952, -164.088235) "></path>
18
- <path d="M57.245098,180.509804 L123.176471,180.509804" id="Line" stroke-linecap="square"></path>
19
- <path d="M108.968995,77.1629039 C149.732203,73.4437041 180.333333,57.7704287 180.333333,39 C180.333333,17.4608948 140.038961,0 90.3333333,0 C40.6277059,0 0.333333333,17.4608948 0.333333333,39 C0.333333333,57.7704287 30.9344633,73.4437041 71.6976718,77.1629039 L90.3333333,89 L108.968995,77.1629039 Z" id="Oval-8"></path>
20
- <polygon id="Star-1" points="50.0882353 45.25 42.7409196 48.8036954 44.1441321 41.2768477 38.2000288 35.9463046 46.4145775 34.8481523 50.0882353 28 53.7618931 34.8481523 61.9764417 35.9463046 56.0323385 41.2768477 57.4355509 48.8036954 "></polygon>
21
- <polygon id="Star-2" points="90.0882353 45.25 82.7409196 48.8036954 84.1441321 41.2768477 78.2000288 35.9463046 86.4145775 34.8481523 90.0882353 28 93.7618931 34.8481523 101.976442 35.9463046 96.0323385 41.2768477 97.4355509 48.8036954 "></polygon>
22
- <polygon id="Star-3" points="130.088235 45.25 122.74092 48.8036954 124.144132 41.2768477 118.200029 35.9463046 126.414577 34.8481523 130.088235 28 133.761893 34.8481523 141.976442 35.9463046 136.032339 41.2768477 137.435551 48.8036954 "></polygon>
 
 
 
23
  </g>
24
  </g>
25
  </g>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="240px" height="240px" viewBox="0 0 240 240" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Testimonial</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
+ <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="50%" id="radialGradient-1">
8
+ <stop stop-color="#F5515F" offset="0%"></stop>
9
+ <stop stop-color="#9F031B" offset="100%"></stop>
10
+ </radialGradient>
11
  </defs>
12
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
13
+ <g id="Widget-Icons" transform="translate(-45.000000, -1166.000000)">
14
+ <g id="Testimonial" transform="translate(45.000000, 1166.000000)">
15
+ <rect id="Rectangle" fill="url(#radialGradient-1)" x="0" y="0" width="240" height="240"></rect>
16
+ <path d="M106.669084,24.2909651 C114.031546,20.5008641 125.974511,20.5039819 133.330916,24.2909651 L206.669084,62.0445158 C214.031546,65.8346168 220,75.6227107 220,83.9055336 L220,156.866109 C220,165.149515 214.025489,174.940144 206.669084,178.727127 L133.330916,216.480678 C125.968454,220.270779 114.025489,220.267661 106.669084,216.480678 L33.330916,178.727127 C25.9684544,174.937026 20,165.148932 20,156.866109 L20,83.9055336 C20,75.6221279 25.974511,65.831499 33.330916,62.0445158 L106.669084,24.2909651 Z" id="Polygon" stroke="#FFFFFF" stroke-width="5"></path>
17
+ <g id="Group" transform="translate(67.000000, 67.000000)" stroke="#F7EBE8" stroke-width="4">
18
+ <path d="M52.4033149,91.2254219 C58.0571887,91.2254219 62.640559,81.2217368 62.640559,72.1538428 C62.640559,63.0859488 58.0571887,61.7362637 52.4033149,61.7362637 C46.7494411,61.7362637 42.1660708,63.0859488 42.1660708,72.1538428 C42.1660708,81.2217368 46.7494411,91.2254219 52.4033149,91.2254219 Z" id="Oval-6"></path>
19
+ <path d="M45.7206695,86.4319112 C45.7206695,86.4319112 37.0329918,90.4790492 34.8244691,93.7042215 C32.8622628,96.5696905 33.2084823,104.703835 33.2084823,104.703835" id="Line" stroke-linecap="square"></path>
20
+ <path d="M71.5981475,86.4319112 C71.5981475,86.4319112 62.9104699,90.4790492 60.7019472,93.7042215 C58.7397408,96.5696905 59.0859604,104.703835 59.0859604,104.703835" id="Line-Copy-3" stroke-linecap="square" transform="translate(65.330276, 95.567873) scale(-1, 1) translate(-65.330276, -95.567873) "></path>
21
+ <path d="M33.2084823,105.132084 L71.4559636,105.132084" id="Line" stroke-linecap="square"></path>
22
+ <path d="M63.2140578,44.9410319 C86.861223,42.7749046 104.61326,33.6465134 104.61326,22.7142857 C104.61326,10.1695321 81.2380712,0 52.4033149,0 C23.5685586,0 0.193370166,10.1695321 0.193370166,22.7142857 C0.193370166,33.6465134 17.9454069,42.7749046 41.5925721,44.9410319 L52.4033149,51.8351648 L63.2140578,44.9410319 Z" id="Oval-8"></path>
23
+ <polygon id="Star-1" points="29.0567111 26.3543956 24.7944561 28.4241303 25.6084744 24.0403619 22.1602377 20.9357598 26.9255836 20.2961766 29.0567111 16.3076923 31.1878386 20.2961766 35.9531844 20.9357598 32.5049478 24.0403619 33.318966 28.4241303 "></polygon>
24
+ <polygon id="Star-2" points="52.261131 26.3543956 47.998876 28.4241303 48.8128943 24.0403619 45.3646576 20.9357598 50.1300035 20.2961766 52.261131 16.3076923 54.3922584 20.2961766 59.1576043 20.9357598 55.7093677 24.0403619 56.5233859 28.4241303 "></polygon>
25
+ <polygon id="Star-3" points="75.4655509 26.3543956 71.2032959 28.4241303 72.0173142 24.0403619 68.5690775 20.9357598 73.3344234 20.2961766 75.4655509 16.3076923 77.5966783 20.2961766 82.3620242 20.9357598 78.9137875 24.0403619 79.7278058 28.4241303 "></polygon>
26
+ </g>
27
  </g>
28
  </g>
29
  </g>
widgets/ink-tsml-widget/css/testimonial.css CHANGED
@@ -1,5 +1,9 @@
1
  .iw-so-testimonial {
2
  padding: 25px; }
 
 
 
 
3
  .iw-so-testimonial .iw-so-testimonial-content {
4
  padding: 0 10px; }
5
  .iw-so-testimonial-left.iw-so-testimonial .iw-so-testimonial-content {
@@ -12,6 +16,39 @@
12
  .iw-so-testimonial .iw-so-testimonial-content {
13
  width: 100% !important;
14
  margin: 0 !important; } }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  .iw-so-testimonial .iw-so-testimonial-img img {
16
  display: block;
17
  vertical-align: top;
1
  .iw-so-testimonial {
2
  padding: 25px; }
3
+ .iw-so-testimonial::after {
4
+ clear: both;
5
+ content: "";
6
+ display: table; }
7
  .iw-so-testimonial .iw-so-testimonial-content {
8
  padding: 0 10px; }
9
  .iw-so-testimonial-left.iw-so-testimonial .iw-so-testimonial-content {
16
  .iw-so-testimonial .iw-so-testimonial-content {
17
  width: 100% !important;
18
  margin: 0 !important; } }
19
+ .iw-so-testimonial.iw-so-testimonial-between .iw-so-testimonial-img {
20
+ margin-top: 20px;
21
+ margin-bottom: 20px; }
22
+ .iw-so-testimonial.iw-so-testimonial-by-above .iw-so-testimonial-byline {
23
+ margin-bottom: 20px; }
24
+ .iw-so-testimonial.iw-so-testimonial-by-below .iw-so-testimonial-byline {
25
+ margin-top: 20px; }
26
+ .iw-so-testimonial.iw-so-testimonial-by-above .iw-so-testimonial-byline, .iw-so-testimonial.iw-so-testimonial-by-below .iw-so-testimonial-byline {
27
+ position: relative;
28
+ text-align: center; }
29
+ .iw-so-testimonial.iw-so-testimonial-by-above .iw-so-testimonial-byline::after, .iw-so-testimonial.iw-so-testimonial-by-below .iw-so-testimonial-byline::after {
30
+ clear: both;
31
+ content: "";
32
+ display: table; }
33
+ .iw-so-testimonial.iw-so-testimonial-by-above .iw-so-testimonial-byline .iw-so-testimonial-message p, .iw-so-testimonial.iw-so-testimonial-by-below .iw-so-testimonial-byline .iw-so-testimonial-message p {
34
+ margin-bottom: 0; }
35
+ .iw-so-testimonial.iw-so-testimonial-by-above .iw-so-testimonial-byline .iw-so-testimonial-byline-wrapper, .iw-so-testimonial.iw-so-testimonial-by-below .iw-so-testimonial-byline .iw-so-testimonial-byline-wrapper {
36
+ display: inline-block;
37
+ position: relative;
38
+ padding-bottom: 15px; }
39
+ .iw-so-testimonial.iw-so-testimonial-by-above .iw-so-testimonial-byline .iw-so-testimonial-byline-wrapper img, .iw-so-testimonial.iw-so-testimonial-by-below .iw-so-testimonial-byline .iw-so-testimonial-byline-wrapper img {
40
+ position: absolute;
41
+ left: 0; }
42
+ .iw-so-testimonial.iw-so-testimonial-by-above .iw-so-testimonial-byline .iw-so-testimonial-byline-wrapper.iw-so-testimonial-has-image .iw-so-testimonial-name,
43
+ .iw-so-testimonial.iw-so-testimonial-by-above .iw-so-testimonial-byline .iw-so-testimonial-byline-wrapper.iw-so-testimonial-has-image .iw-so-testimonial-company, .iw-so-testimonial.iw-so-testimonial-by-below .iw-so-testimonial-byline .iw-so-testimonial-byline-wrapper.iw-so-testimonial-has-image .iw-so-testimonial-name,
44
+ .iw-so-testimonial.iw-so-testimonial-by-below .iw-so-testimonial-byline .iw-so-testimonial-byline-wrapper.iw-so-testimonial-has-image .iw-so-testimonial-company {
45
+ margin-left: 70px; }
46
+ .iw-so-testimonial.iw-so-testimonial-by-above .iw-so-testimonial-byline.iw-so-testi-iw-text-left .iw-so-testimonial-byline-wrapper, .iw-so-testimonial.iw-so-testimonial-by-below .iw-so-testimonial-byline.iw-so-testi-iw-text-left .iw-so-testimonial-byline-wrapper {
47
+ float: left; }
48
+ .iw-so-testimonial.iw-so-testimonial-by-above .iw-so-testimonial-byline.iw-so-testi-iw-text-right .iw-so-testimonial-byline-wrapper, .iw-so-testimonial.iw-so-testimonial-by-below .iw-so-testimonial-byline.iw-so-testi-iw-text-right .iw-so-testimonial-byline-wrapper {
49
+ float: right; }
50
+ .iw-so-testimonial.iw-so-testimonial-by-above .iw-so-testimonial-byline.iw-so-testi-iw-text-center .iw-so-testimonial-byline-wrapper, .iw-so-testimonial.iw-so-testimonial-by-below .iw-so-testimonial-byline.iw-so-testi-iw-text-center .iw-so-testimonial-byline-wrapper {
51
+ margin: 0 auto; }
52
  .iw-so-testimonial .iw-so-testimonial-img img {
53
  display: block;
54
  vertical-align: top;
widgets/ink-tsml-widget/ink-tsml-widget.php CHANGED
@@ -19,7 +19,7 @@ class Inked_Testimonial_SO_Widget extends SiteOrigin_Widget {
19
 
20
  array(
21
  'description' => __( 'Highlight what your customers think of you.', 'wpinked-widgets' ),
22
- 'help' => 'http://widgets.wpinked.com/documentation/testimonial-widget/'
23
  ),
24
 
25
  array(
@@ -27,125 +27,140 @@ class Inked_Testimonial_SO_Widget extends SiteOrigin_Widget {
27
 
28
  array(
29
 
30
- 'name' => array(
31
- 'type' => 'text',
32
- 'label' => __( 'Name', 'wpinked-widgets' ),
33
- 'default' => '',
34
- 'description' => __( 'Name of the testimonial author.', 'wpinked-widgets' ),
35
  ),
36
 
37
- 'testimonial' => array(
38
- 'type' => 'section',
39
- 'label' => __( 'Testimonial' , 'wpinked-widgets' ),
40
- 'hide' => true,
41
- 'fields' => array(
42
-
43
- 'image' => array(
44
- 'type' => 'media',
45
- 'label' => __( 'Image', 'wpinked-widgets' ),
46
- 'choose' => __( 'Choose image', 'wpinked-widgets' ),
47
- 'update' => __( 'Set image', 'wpinked-widgets' ),
48
- 'library' => 'image',
49
- 'fallback' => false
50
  ),
51
 
52
- 'company' => array(
53
- 'type' => 'text',
54
- 'label' => __( 'Company', 'wpinked-widgets' ),
55
- 'default' => ''
56
  ),
57
 
58
- 'link' => array(
59
- 'type' => 'link',
60
- 'label' => __( 'Company Link', 'wpinked-widgets' ),
61
- 'default' => ''
62
  ),
63
 
64
- 'target' => array(
65
- 'type' => 'select',
66
- 'label' => __( 'Open link in', 'wpinked-widgets' ),
67
- 'default' => '_blank',
68
- 'options' => array(
69
- '_self' => __( 'Same Window', 'wpinked-widgets' ),
70
- '_blank' => __( 'New Window', 'wpinked-widgets' )
71
  )
72
  ),
73
 
74
- 'content' => array(
75
- 'type' => 'tinymce',
76
- 'label' => __( 'Content', 'wpinked-widgets' ),
77
- 'default' => '',
78
- 'rows' => 5,
79
- 'default_editor' => 'tinymce',
80
- 'button_filters' => array(
81
- 'mce_buttons' => array( $this, 'filter_mce_buttons' ),
82
- 'mce_buttons_2' => array( $this, 'filter_mce_buttons_2' ),
83
- 'mce_buttons_3' => array( $this, 'filter_mce_buttons_3' ),
84
- 'mce_buttons_4' => array( $this, 'filter_mce_buttons_5' ),
85
  'quicktags_settings' => array( $this, 'filter_quicktags_settings' ),
86
  ),
87
- 'description' => __( 'Change the color of the text in the editor.', 'wpinked-widgets' ),
88
  )
89
 
90
  )
91
  ),
92
 
93
- 'styling' => array(
94
- 'type' => 'section',
95
- 'label' => __( 'Styling' , 'wpinked-widgets' ),
96
- 'hide' => true,
97
- 'fields' => array(
98
-
99
- 'design' => array(
100
- 'type' => 'select',
101
- 'label' => __( 'Design', 'wpinked-widgets' ),
102
- 'default' => 'above',
103
- 'options' => array(
104
- 'above' => __( 'Image Above', 'wpinked-widgets' ),
105
- 'below' => __( 'Image Below', 'wpinked-widgets' ),
106
- 'left' => __( 'Image Left', 'wpinked-widgets' ),
107
- 'right' => __( 'Image Right', 'wpinked-widgets' )
 
 
 
108
  )
109
  ),
110
 
111
- 'img-radius' => array(
112
- 'type' => 'select',
113
- 'label' => __( 'Image Shape', 'wpinked-widgets' ),
114
- 'default' => '0',
115
- 'options' => array(
116
- '0' => __( 'Square', 'wpinked-widgets' ),
117
- '5%' => __( 'Curved', 'wpinked-widgets' ),
118
- '50%' => __( 'Round', 'wpinked-widgets' )
119
  )
120
  ),
121
 
122
- 'text' => array(
123
- 'type' => 'select',
124
- 'label' => __( 'Text Alignment', 'wpinked-widgets' ),
125
- 'default' => 'iw-text-left',
126
- 'options' => array(
127
- 'iw-text-left' => __( 'Left', 'wpinked-widgets' ),
128
- 'iw-text-center' => __( 'Center', 'wpinked-widgets' ),
129
- 'iw-text-right' => __( 'Right', 'wpinked-widgets' ),
 
 
 
 
 
 
130
  )
131
  ),
132
 
133
- 'background' => array(
134
- 'type' => 'color',
135
- 'label' => __( 'Background Color', 'wpinked-widgets' ),
136
- 'default' => ''
 
 
 
 
 
 
137
  ),
138
 
139
- 'name' => array(
140
- 'type' => 'color',
141
- 'label' => __( 'Name Color', 'wpinked-widgets' ),
142
- 'default' => ''
143
  ),
144
 
145
- 'company' => array(
146
- 'type' => 'color',
147
- 'label' => __( 'Company Color', 'wpinked-widgets' ),
148
- 'default' => ''
149
  )
150
 
151
  )
@@ -178,11 +193,13 @@ class Inked_Testimonial_SO_Widget extends SiteOrigin_Widget {
178
  if( empty( $instance ) ) return array();
179
 
180
  return array(
181
- 'design' => $instance['styling']['design'],
182
- 'bg' => $instance['styling']['background'],
183
- 'img-r' => $instance['styling']['img-radius'],
184
- 'name' => $instance['styling']['name'],
 
185
  'company' => $instance['styling']['company'],
 
186
  );
187
  }
188
 
19
 
20
  array(
21
  'description' => __( 'Highlight what your customers think of you.', 'wpinked-widgets' ),
22
+ 'help' => 'http://widgets-docs.wpinked.com/article/38-testimonial-widget'
23
  ),
24
 
25
  array(
27
 
28
  array(
29
 
30
+ 'name' => array(
31
+ 'type' => 'text',
32
+ 'label' => __( 'Name', 'wpinked-widgets' ),
33
+ 'default' => '',
34
+ 'description' => __( 'Name of the testimonial author.', 'wpinked-widgets' ),
35
  ),
36
 
37
+ 'testimonial' => array(
38
+ 'type' => 'section',
39
+ 'label' => __( 'Testimonial' , 'wpinked-widgets' ),
40
+ 'hide' => true,
41
+ 'fields' => array(
42
+
43
+ 'image' => array(
44
+ 'type' => 'media',
45
+ 'label' => __( 'Image', 'wpinked-widgets' ),
46
+ 'choose' => __( 'Choose image', 'wpinked-widgets' ),
47
+ 'update' => __( 'Set image', 'wpinked-widgets' ),
48
+ 'library' => 'image',
49
+ 'fallback' => false
50
  ),
51
 
52
+ 'company' => array(
53
+ 'type' => 'text',
54
+ 'label' => __( 'Company', 'wpinked-widgets' ),
55
+ 'default' => ''
56
  ),
57
 
58
+ 'link' => array(
59
+ 'type' => 'link',
60
+ 'label' => __( 'Company Link', 'wpinked-widgets' ),
61
+ 'default' => ''
62
  ),
63
 
64
+ 'target' => array(
65
+ 'type' => 'select',
66
+ 'label' => __( 'Open link in', 'wpinked-widgets' ),
67
+ 'default' => '_blank',
68
+ 'options' => array(
69
+ '_self' => __( 'Same Window', 'wpinked-widgets' ),
70
+ '_blank' => __( 'New Window', 'wpinked-widgets' )
71
  )
72
  ),
73
 
74
+ 'content' => array(
75
+ 'type' => 'tinymce',
76
+ 'label' => __( 'Content', 'wpinked-widgets' ),
77
+ 'default' => '',
78
+ 'rows' => 5,
79
+ 'default_editor' => 'tinymce',
80
+ 'button_filters' => array(
81
+ 'mce_buttons' => array( $this, 'filter_mce_buttons' ),
82
+ 'mce_buttons_2' => array( $this, 'filter_mce_buttons_2' ),
83
+ 'mce_buttons_3' => array( $this, 'filter_mce_buttons_3' ),
84
+ 'mce_buttons_4' => array( $this, 'filter_mce_buttons_5' ),
85
  'quicktags_settings' => array( $this, 'filter_quicktags_settings' ),
86
  ),
87
+ 'description' => __( 'Change the color of the text in the editor.', 'wpinked-widgets' ),
88
  )
89
 
90
  )
91
  ),
92
 
93
+ 'styling' => array(
94
+ 'type' => 'section',
95
+ 'label' => __( 'Styling' , 'wpinked-widgets' ),
96
+ 'hide' => true,
97
+ 'fields' => array(
98
+
99
+ 'design' => array(
100
+ 'type' => 'select',
101
+ 'label' => __( 'Design', 'wpinked-widgets' ),
102
+ 'default' => 'above',
103
+ 'options' => array(
104
+ 'above' => __( 'Image above', 'wpinked-widgets' ),
105
+ 'below' => __( 'Image below', 'wpinked-widgets' ),
106
+ 'between' => __( 'Image in-between', 'wpinked-widgets' ),
107
+ 'left' => __( 'Image to the left', 'wpinked-widgets' ),
108
+ 'right' => __( 'Image to the right', 'wpinked-widgets' ),
109
+ 'by-above' => __( 'Byline above', 'wpinked-widgets' ),
110
+ 'by-below' => __( 'Byline below', 'wpinked-widgets' ),
111
  )
112
  ),
113
 
114
+ 'img-radius' => array(
115
+ 'type' => 'select',
116
+ 'label' => __( 'Image Shape', 'wpinked-widgets' ),
117
+ 'default' => '0',
118
+ 'options' => array(
119
+ '0' => __( 'Square', 'wpinked-widgets' ),
120
+ '5%' => __( 'Curved', 'wpinked-widgets' ),
121
+ '50%' => __( 'Round', 'wpinked-widgets' )
122
  )
123
  ),
124
 
125
+ 'img-width' => array(
126
+ 'type' => 'measurement',
127
+ 'label' => __( 'Image Width', 'wpinked-widgets' ),
128
+ 'default' => '100%',
129
+ ),
130
+
131
+ 'text' => array(
132
+ 'type' => 'select',
133
+ 'label' => __( 'Text Alignment', 'wpinked-widgets' ),
134
+ 'default' => 'iw-text-left',
135
+ 'options' => array(
136
+ 'iw-text-left' => __( 'Left', 'wpinked-widgets' ),
137
+ 'iw-text-center' => __( 'Center', 'wpinked-widgets' ),
138
+ 'iw-text-right' => __( 'Right', 'wpinked-widgets' ),
139
  )
140
  ),
141
 
142
+ 'background' => array(
143
+ 'type' => 'color',
144
+ 'label' => __( 'Background Color', 'wpinked-widgets' ),
145
+ 'default' => ''
146
+ ),
147
+
148
+ 'name' => array(
149
+ 'type' => 'color',
150
+ 'label' => __( 'Name Color', 'wpinked-widgets' ),
151
+ 'default' => ''
152
  ),
153
 
154
+ 'company' => array(
155
+ 'type' => 'color',
156
+ 'label' => __( 'Company Color', 'wpinked-widgets' ),
157
+ 'default' => ''
158
  ),
159
 
160
+ 'padding' => array(
161
+ 'type' => 'checkbox',
162
+ 'label' => __( 'Remove testimonial padding', 'wpinked-widgets' ),
163
+ 'default' => false
164
  )
165
 
166
  )
193
  if( empty( $instance ) ) return array();
194
 
195
  return array(
196
+ 'design' => $instance['styling']['design'],
197
+ 'bg' => $instance['styling']['background'],
198
+ 'img-r' => $instance['styling']['img-radius'],
199
+ 'img-w' => $instance['styling']['img-width'],
200
+ 'name' => $instance['styling']['name'],
201
  'company' => $instance['styling']['company'],
202
+ 'padding' => $instance['styling']['padding']
203
  );
204
  }
205
 
widgets/ink-tsml-widget/styles/testimonial.less CHANGED
@@ -2,15 +2,21 @@
2
 
3
  @bg: transparent;
4
  @img-r: 0;
 
5
  @name: '';
6
  @company: '';
7
  @design: 'above';
 
8
 
9
  .iw-so-testimonial {
10
  background: @bg;
 
 
11
 
 
12
  .iw-so-testimonial-img img {
13
  border-radius: @img-r;
 
14
  .img-design() when (@design = above) { margin-bottom: 25px; }
15
  .img-design() when (@design = below) { margin-top: 25px; }
16
  .img-design();
2
 
3
  @bg: transparent;
4
  @img-r: 0;
5
+ @img-w: 100%;
6
  @name: '';
7
  @company: '';
8
  @design: 'above';
9
+ @padding: 0;
10
 
11
  .iw-so-testimonial {
12
  background: @bg;
13
+ .padding() when (@padding = 1) { padding: 0; }
14
+ .padding();
15
 
16
+ .iw-so-testimonial-has-image img,
17
  .iw-so-testimonial-img img {
18
  border-radius: @img-r;
19
+ max-width: @img-w;
20
  .img-design() when (@design = above) { margin-bottom: 25px; }
21
  .img-design() when (@design = below) { margin-top: 25px; }
22
  .img-design();
widgets/ink-tsml-widget/tpl/testimonial.php CHANGED
@@ -1,35 +1 @@
1
- <div class="iw-so-testimonial <?php echo 'iw-so-testimonial-' . $instance['styling']['design']; ?>">
2
-
3
- <?php if ( $instance['testimonial']['image'] && ($instance['styling']['design'] != 'below' ) ) : ?>
4
-
5
- <div class="iw-so-testimonial-img">
6
-
7
- <?php echo wp_get_attachment_image( $instance['testimonial']['image'], 'full' ); ?>
8
-
9
- </div>
10
-
11
- <?php endif; ?>
12
-
13
- <div class="iw-so-testimonial-content">
14
-
15
- <?php if ( $instance['testimonial']['content'] ) : ?>
16
-
17
- <div class="iw-so-testimonial-message <?php echo $instance['testimonial']['text']; ?>"><?php echo do_shortcode( $instance['testimonial']['content'] ); ?></div>
18
-
19
- <?php endif; ?>
20
-
21
- <?php wpinked_so_testimonial_name( $instance['name'], $instance['testimonial']['company'], $instance['testimonial']['link'], $instance['testimonial']['target'], $instance['styling']['text'] ); ?>
22
-
23
- </div>
24
-
25
- <?php if ( $instance['testimonial']['image'] && ($instance['styling']['design'] == 'below' ) ) : ?>
26
-
27
- <div class="iw-so-testimonial-img">
28
-
29
- <?php echo wp_get_attachment_image( $instance['testimonial']['image'], 'full' ); ?>
30
-
31
- </div>
32
-
33
- <?php endif; ?>
34
-
35
- </div>
1
+ <?php wpinked_so_testimonial_template( $instance['name'], $instance['testimonial'], $instance['styling'] ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
widgets/ink-vids-widget/assets/banner.svg CHANGED
@@ -1,19 +1,23 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <svg width="300px" height="300px" viewBox="0 0 300 300" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Video</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
- <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-1">
8
- <feGaussianBlur stdDeviation="0" in="SourceGraphic" result="blur"></feGaussianBlur>
9
- </filter>
 
10
  </defs>
11
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
12
- <g id="Video" transform="translate(30.000000, 30.000000)">
13
- <rect id="BG" stroke="#C0392B" stroke-width="30" fill="#E74C3C" filter="url(#filter-1)" x="0" y="0" width="240" height="240"></rect>
14
- <g id="Group" transform="translate(58.000000, 58.000000)" stroke="#F7EBE8" stroke-width="4">
15
- <polygon id="Triangle-2" transform="translate(75.000000, 62.500000) scale(-1, 1) rotate(-90.000000) translate(-75.000000, -62.500000) " points="75 27 118 98 32 98 "></polygon>
16
- <circle id="Oval-3" cx="62.5" cy="62.5" r="62.5"></circle>
 
 
 
17
  </g>
18
  </g>
19
  </g>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="240px" height="240px" viewBox="0 0 240 240" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
  <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
4
  <title>Video</title>
5
  <desc>Created with Sketch.</desc>
6
  <defs>
7
+ <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="50%" id="radialGradient-1">
8
+ <stop stop-color="#F5515F" offset="0%"></stop>
9
+ <stop stop-color="#9F031B" offset="100%"></stop>
10
+ </radialGradient>
11
  </defs>
12
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
13
+ <g id="Widget-Icons" transform="translate(-915.000000, -885.000000)">
14
+ <g id="Video" transform="translate(915.000000, 885.000000)">
15
+ <rect id="Rectangle" fill="url(#radialGradient-1)" x="0" y="0" width="240" height="240"></rect>
16
+ <path d="M106.669084,24.2909651 C114.031546,20.5008641 125.974511,20.5039819 133.330916,24.2909651 L206.669084,62.0445158 C214.031546,65.8346168 220,75.6227107 220,83.9055336 L220,156.866109 C220,165.149515 214.025489,174.940144 206.669084,178.727127 L133.330916,216.480678 C125.968454,220.270779 114.025489,220.267661 106.669084,216.480678 L33.330916,178.727127 C25.9684544,174.937026 20,165.148932 20,156.866109 L20,83.9055336 C20,75.6221279 25.974511,65.831499 33.330916,62.0445158 L106.669084,24.2909651 Z" id="Polygon" stroke="#FFFFFF" stroke-width="5"></path>
17
+ <g id="Group" transform="translate(75.000000, 74.000000)" stroke="#F7EBE8" stroke-width="4">
18
+ <polygon id="Triangle-2" transform="translate(47.000000, 46.083000) scale(-1, 1) rotate(-90.000000) translate(-47.000000, -46.083000) " points="47 35.083 62.083 57.083 31.917 57.083 "></polygon>
19
+ <ellipse id="Oval-3" cx="45" cy="46.5" rx="45" ry="46.5"></ellipse>
20
+ </g>
21
  </g>
22
  </g>
23
  </g>
widgets/ink-vids-widget/ink-vids-widget.php CHANGED
@@ -19,7 +19,7 @@ class Inked_Video_SO_Widget extends SiteOrigin_Widget {
19
 
20
  array(
21
  'description' => __( 'Play self or externally hosted videos.', 'wpinked-widgets' ),
22
- 'help' => 'http://widgets.wpinked.com/documentation/video-widget/'
23
  ),
24
 
25
  array(
19
 
20
  array(
21
  'description' => __( 'Play self or externally hosted videos.', 'wpinked-widgets' ),
22
+ 'help' => 'http://widgets-docs.wpinked.com/article/34-video-widget'
23
  ),
24
 
25
  array(