Yasr – Yet Another Stars Rating - Version 1.6.4

Version Description

Updated freemius sdk to be gdpr compilant

Download this release

Release Info

Developer Dudo
Plugin Icon 128x128 Yasr – Yet Another Stars Rating
Version 1.6.4
Comparing to
See all releases

Code changes from version 1.6.3 to 1.6.4

Files changed (72) hide show
  1. freemius/assets/css/admin/connect.css +1 -1
  2. freemius/assets/css/admin/gdpr-optin-notice.css +1 -0
  3. freemius/assets/scss/_load.scss +4 -4
  4. freemius/assets/scss/_start.scss +3 -3
  5. freemius/assets/scss/_vars.scss +5 -5
  6. freemius/assets/scss/admin/_gdpr-consent.scss +81 -0
  7. freemius/assets/scss/admin/common.scss +217 -217
  8. freemius/assets/scss/admin/connect.scss +548 -547
  9. freemius/assets/scss/admin/gdpr-optin-notice.scss +17 -0
  10. freemius/composer.json +10 -0
  11. freemius/config.php +12 -2
  12. freemius/includes/class-freemius-abstract.php +1 -1
  13. freemius/includes/class-freemius.php +20763 -19910
  14. freemius/includes/class-fs-admin-notices.php +29 -10
  15. freemius/includes/class-fs-api.php +614 -614
  16. freemius/includes/class-fs-options.php +430 -430
  17. freemius/includes/class-fs-plugin-updater.php +934 -858
  18. freemius/includes/class-fs-storage.php +523 -521
  19. freemius/includes/class-fs-user-lock.php +126 -0
  20. freemius/includes/entities/class-fs-payment.php +101 -85
  21. freemius/includes/entities/class-fs-site.php +3 -1
  22. freemius/includes/fs-core-functions.php +1297 -1297
  23. freemius/includes/fs-essential-functions.php +476 -476
  24. freemius/includes/fs-plugin-info-dialog.php +1109 -1109
  25. freemius/includes/i18n.php +602 -602
  26. freemius/includes/managers/class-fs-admin-notice-manager.php +397 -342
  27. freemius/includes/managers/class-fs-gdpr-manager.php +202 -0
  28. freemius/includes/managers/class-fs-plugin-manager.php +219 -219
  29. freemius/includes/sdk/Exceptions/ArgumentNotExistException.php +8 -8
  30. freemius/includes/sdk/Exceptions/EmptyArgumentException.php +8 -8
  31. freemius/includes/sdk/Exceptions/Exception.php +73 -73
  32. freemius/includes/sdk/Exceptions/InvalidArgumentException.php +7 -7
  33. freemius/includes/sdk/Exceptions/OAuthException.php +11 -11
  34. freemius/includes/sdk/FreemiusBase.php +215 -215
  35. freemius/includes/sdk/FreemiusWordPress.php +703 -701
  36. freemius/languages/freemius-da_DK.mo +0 -0
  37. freemius/languages/freemius-da_DK.po +1874 -1401
  38. freemius/languages/freemius-en.mo +0 -0
  39. freemius/languages/freemius-en.po +486 -372
  40. freemius/languages/freemius-es_ES.mo +0 -0
  41. freemius/languages/freemius-es_ES.po +648 -516
  42. freemius/languages/freemius-fr_FR.mo +0 -0
  43. freemius/languages/freemius-fr_FR.po +2299 -0
  44. freemius/languages/freemius-he_IL.mo +0 -0
  45. freemius/languages/freemius-he_IL.po +545 -413
  46. freemius/languages/freemius-it_IT.mo +0 -0
  47. freemius/languages/freemius-it_IT.po +632 -500
  48. freemius/languages/freemius-ja_JP.mo +0 -0
  49. freemius/languages/freemius-ja_JP.po +748 -614
  50. freemius/languages/freemius-nl_NL.mo +0 -0
  51. freemius/languages/freemius-nl_NL.po +2299 -0
  52. freemius/languages/freemius-ru_RU.mo +0 -0
  53. freemius/languages/freemius-ru_RU.po +544 -412
  54. freemius/languages/freemius.pot +342 -249
  55. freemius/require.php +1 -0
  56. freemius/start.php +500 -500
  57. freemius/templates/account.php +734 -734
  58. freemius/templates/account/partials/addon.php +15 -13
  59. freemius/templates/account/partials/site.php +330 -330
  60. freemius/templates/account/payments.php +2 -2
  61. freemius/templates/connect.php +915 -736
  62. freemius/templates/debug.php +35 -28
  63. freemius/templates/forms/deactivation/form.php +24 -3
  64. freemius/templates/forms/premium-versions-upgrade-handler.php +183 -0
  65. freemius/templates/forms/premium-versions-upgrade-metadata.php +29 -0
  66. freemius/templates/gdpr-optin-js.php +66 -0
  67. freemius/templates/js/jquery.content-change.php +11 -0
  68. freemius/templates/partials/network-activation.php +1 -1
  69. freemius/templates/pricing.php +170 -168
  70. freemius/templates/tabs.php +181 -177
  71. readme.txt +4 -1
  72. yet-another-stars-rating.php +2 -2
freemius/assets/css/admin/connect.css CHANGED
@@ -1 +1 @@
1
- #fs_connect{width:480px;-moz-box-shadow:0px 1px 2px rgba(0,0,0,0.3);-webkit-box-shadow:0px 1px 2px rgba(0,0,0,0.3);box-shadow:0px 1px 2px rgba(0,0,0,0.3);margin:20px 0}@media screen and (max-width: 479px){#fs_connect{-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;width:auto;margin:0 0 0 -10px}}#fs_connect .fs-content{background:#fff;padding:15px 20px}#fs_connect .fs-content .fs-error{background:snow;color:#d3135a;border:1px solid #d3135a;-moz-box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);text-align:center;padding:5px;margin-bottom:10px}#fs_connect .fs-content p{margin:0;padding:0;font-size:1.2em}#fs_connect .fs-license-key-container{position:relative;width:280px;margin:10px auto 0 auto}#fs_connect .fs-license-key-container input{width:100%}#fs_connect .fs-license-key-container .dashicons{position:absolute;top:5px;right:5px}#fs_connect.require-license-key #sites_list_container td{cursor:pointer}#fs_connect #delegate_to_site_admins{margin-right:15px;float:right;height:26px;vertical-align:middle;line-height:37px;font-weight:bold;border-bottom:1px dashed;text-decoration:none}#fs_connect #delegate_to_site_admins.rtl{margin-left:15px;margin-right:0}#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}#multisite_options_container{margin-top:10px;border:1px solid #ccc;padding:5px}#multisite_options_container a{text-decoration:none}#multisite_options_container a:focus{box-shadow:none}#multisite_options_container a.selected{font-weight:bold}#multisite_options_container.apply-on-all-sites{border:0 none;padding:0}#multisite_options_container.apply-on-all-sites #all_sites_options{border-spacing:0}#multisite_options_container.apply-on-all-sites #all_sites_options td:not(:first-child){display:none}#multisite_options_container #sites_list_container{display:none;overflow:auto}#multisite_options_container #sites_list_container table td{border-top:1px solid #ccc;padding:4px 2px}.fs-tooltip-trigger{position:relative}.fs-tooltip-trigger:not(a){cursor:help}.fs-tooltip-trigger .fs-tooltip{opacity:0;visibility:hidden;-moz-transition:opacity 0.3s ease-in-out;-o-transition:opacity 0.3s ease-in-out;-ms-transition:opacity 0.3s ease-in-out;-webkit-transition:opacity 0.3s ease-in-out;transition:opacity 0.3s ease-in-out;position:absolute;background:rgba(0,0,0,0.8);color:#fff;font-family:'arial', serif;font-size:12px;padding:10px;z-index:999999;bottom:100%;margin-bottom:5px;left:0;right:0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;-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);line-height:1.3em;font-weight:bold;text-align:left}.rtl .fs-tooltip-trigger .fs-tooltip{text-align:right}.fs-tooltip-trigger .fs-tooltip::after{content:' ';display:block;width:0;height:0;border-style:solid;border-width:5px 5px 0 5px;border-color:rgba(0,0,0,0.8) transparent transparent transparent;position:absolute;top:100%;left:21px}.rtl .fs-tooltip-trigger .fs-tooltip::after{right:21px;left:auto}.fs-tooltip-trigger:hover .fs-tooltip{visibility:visible;opacity:1}.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}#fs_theme_connect_wrapper{position:fixed;top:0;height:100%;width:100%;z-index:99990;background:rgba(0,0,0,0.75);text-align:center;overflow-y:auto}#fs_theme_connect_wrapper:before{content:"";display:inline-block;vertical-align:middle;height:100%}#fs_theme_connect_wrapper>button.close{color:white;cursor:pointer;height:40px;width:40px;position:absolute;right:0;border:0;background-color:transparent;top:32px}#fs_theme_connect_wrapper #fs_connect{top:0;text-align:left;display:inline-block;vertical-align:middle;margin-top:52px;margin-bottom:20px}#fs_theme_connect_wrapper #fs_connect .fs-terms{background:rgba(140,140,140,0.64)}#fs_theme_connect_wrapper #fs_connect .fs-terms,#fs_theme_connect_wrapper #fs_connect .fs-terms a{color:#c5c5c5}.wp-pointer-content #fs_connect{margin:0;-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none}.fs-opt-in-pointer .wp-pointer-content{padding:0}.fs-opt-in-pointer.wp-pointer-top .wp-pointer-arrow{border-bottom-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-top .wp-pointer-arrow-inner{border-bottom-color:#fafafa}.fs-opt-in-pointer.wp-pointer-bottom .wp-pointer-arrow{border-top-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-bottom .wp-pointer-arrow-inner{border-top-color:#fafafa}.fs-opt-in-pointer.wp-pointer-left .wp-pointer-arrow{border-right-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-left .wp-pointer-arrow-inner{border-right-color:#fafafa}.fs-opt-in-pointer.wp-pointer-right .wp-pointer-arrow{border-left-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-right .wp-pointer-arrow-inner{border-left-color:#fafafa}
1
+ #fs_connect{width:480px;-moz-box-shadow:0px 1px 2px rgba(0,0,0,0.3);-webkit-box-shadow:0px 1px 2px rgba(0,0,0,0.3);box-shadow:0px 1px 2px rgba(0,0,0,0.3);margin:20px 0}@media screen and (max-width: 479px){#fs_connect{-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;width:auto;margin:0 0 0 -10px}}#fs_connect .fs-content{background:#fff;padding:15px 20px}#fs_connect .fs-content .fs-error{background:snow;color:#d3135a;border:1px solid #d3135a;-moz-box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);text-align:center;padding:5px;margin-bottom:10px}#fs_connect .fs-content p{margin:0;padding:0;font-size:1.2em}#fs_connect .fs-license-key-container{position:relative;width:280px;margin:10px auto 0 auto}#fs_connect .fs-license-key-container input{width:100%}#fs_connect .fs-license-key-container .dashicons{position:absolute;top:5px;right:5px}#fs_connect.require-license-key #sites_list_container td{cursor:pointer}#fs_connect #delegate_to_site_admins{margin-right:15px;float:right;height:26px;vertical-align:middle;line-height:37px;font-weight:bold;border-bottom:1px dashed;text-decoration:none}#fs_connect #delegate_to_site_admins.rtl{margin-left:15px;margin-right:0}#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}#multisite_options_container{margin-top:10px;border:1px solid #ccc;padding:5px}#multisite_options_container a{text-decoration:none}#multisite_options_container a:focus{box-shadow:none}#multisite_options_container a.selected{font-weight:bold}#multisite_options_container.apply-on-all-sites{border:0 none;padding:0}#multisite_options_container.apply-on-all-sites #all_sites_options{border-spacing:0}#multisite_options_container.apply-on-all-sites #all_sites_options td:not(:first-child){display:none}#multisite_options_container #sites_list_container{display:none;overflow:auto}#multisite_options_container #sites_list_container table td{border-top:1px solid #ccc;padding:4px 2px}.fs-tooltip-trigger{position:relative}.fs-tooltip-trigger:not(a){cursor:help}.fs-tooltip-trigger .fs-tooltip{opacity:0;visibility:hidden;-moz-transition:opacity 0.3s ease-in-out;-o-transition:opacity 0.3s ease-in-out;-ms-transition:opacity 0.3s ease-in-out;-webkit-transition:opacity 0.3s ease-in-out;transition:opacity 0.3s ease-in-out;position:absolute;background:rgba(0,0,0,0.8);color:#fff;font-family:'arial', serif;font-size:12px;padding:10px;z-index:999999;bottom:100%;margin-bottom:5px;left:0;right:0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;-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);line-height:1.3em;font-weight:bold;text-align:left}.rtl .fs-tooltip-trigger .fs-tooltip{text-align:right}.fs-tooltip-trigger .fs-tooltip::after{content:' ';display:block;width:0;height:0;border-style:solid;border-width:5px 5px 0 5px;border-color:rgba(0,0,0,0.8) transparent transparent transparent;position:absolute;top:100%;left:21px}.rtl .fs-tooltip-trigger .fs-tooltip::after{right:21px;left:auto}.fs-tooltip-trigger:hover .fs-tooltip{visibility:visible;opacity:1}#fs_marketing_optin{display:none;margin-top:10px;border:1px solid #ccc;padding:10px;line-height:1.5em}#fs_marketing_optin .fs-message{display:block;margin-bottom:5px;font-size:1.05em;font-weight:600}#fs_marketing_optin.error{border:1px solid #d3135a;background:#fee}#fs_marketing_optin.error .fs-message{color:#d3135a}#fs_marketing_optin .fs-input-container{margin-top:5px}#fs_marketing_optin .fs-input-container label{margin-top:5px;display:block}#fs_marketing_optin .fs-input-container label input{float:left;margin:1px 0 0 0}#fs_marketing_optin .fs-input-container label:first-child{display:block;margin-bottom:2px}#fs_marketing_optin .fs-input-label{display:block;margin-left:20px}#fs_marketing_optin .fs-input-label .underlined{text-decoration:underline}.rtl #fs_marketing_optin .fs-input-container label input{float:right}.rtl #fs_marketing_optin .fs-input-label{margin-left:0;margin-right:20px}.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}#fs_theme_connect_wrapper{position:fixed;top:0;height:100%;width:100%;z-index:99990;background:rgba(0,0,0,0.75);text-align:center;overflow-y:auto}#fs_theme_connect_wrapper:before{content:"";display:inline-block;vertical-align:middle;height:100%}#fs_theme_connect_wrapper>button.close{color:white;cursor:pointer;height:40px;width:40px;position:absolute;right:0;border:0;background-color:transparent;top:32px}#fs_theme_connect_wrapper #fs_connect{top:0;text-align:left;display:inline-block;vertical-align:middle;margin-top:52px;margin-bottom:20px}#fs_theme_connect_wrapper #fs_connect .fs-terms{background:rgba(140,140,140,0.64)}#fs_theme_connect_wrapper #fs_connect .fs-terms,#fs_theme_connect_wrapper #fs_connect .fs-terms a{color:#c5c5c5}.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/gdpr-optin-notice.css ADDED
@@ -0,0 +1 @@
1
+ .fs-notice[data-id^="gdpr_optin_actions"] .underlined{text-decoration:underline}.fs-notice[data-id^="gdpr_optin_actions"] ul .button,.fs-notice[data-id^="gdpr_optin_actions"] ul .action-description{vertical-align:middle}.fs-notice[data-id^="gdpr_optin_actions"] ul .action-description{display:inline-block;margin-left:3px}
freemius/assets/scss/_load.scss CHANGED
@@ -1,4 +1,4 @@
1
- @import 'mixins';
2
- @import "vars";
3
- @import "functions";
4
- @import "colors";
1
+ @import 'mixins';
2
+ @import "vars";
3
+ @import "functions";
4
+ @import "colors";
freemius/assets/scss/_start.scss CHANGED
@@ -1,4 +1,4 @@
1
- @import "vars";
2
- @import "colors";
3
- @import "mixins";
4
@import "functions";
1
+ @import "vars";
2
+ @import "colors";
3
+ @import "mixins";
4
@import "functions";
freemius/assets/scss/_vars.scss CHANGED
@@ -1,6 +1,6 @@
1
- $is_production: true;
2
-
3
- $img_common: if($is_production == true, '//img.freemius.com', 'http://img.freemius:8080');
4
-
5
- $layout_width: 960px;
6
$admin_mobile_max_width: 782px;
1
+ $is_production: true;
2
+
3
+ $img_common: if($is_production == true, '//img.freemius.com', 'http://img.freemius:8080');
4
+
5
+ $layout_width: 960px;
6
$admin_mobile_max_width: 782px;
freemius/assets/scss/admin/_gdpr-consent.scss ADDED
@@ -0,0 +1,81 @@
1
+ #fs_marketing_optin
2
+ {
3
+ display: none;
4
+ margin-top: 10px;
5
+ border: 1px solid #ccc;
6
+ padding: 10px;
7
+ line-height: 1.5em;
8
+
9
+ .fs-message
10
+ {
11
+ display: block;
12
+ margin-bottom: 5px;
13
+ font-size: 1.05em;
14
+ font-weight: 600;
15
+ }
16
+
17
+ &.error
18
+ {
19
+ border: 1px solid $fs-logo-magenta-color;
20
+ background: #fee;
21
+
22
+ .fs-message
23
+ {
24
+ color: $fs-logo-magenta-color;
25
+ }
26
+ }
27
+
28
+ .fs-input-container
29
+ {
30
+ margin-top: 5px;
31
+
32
+ label
33
+ {
34
+ margin-top: 5px;
35
+ display: block;
36
+
37
+ input
38
+ {
39
+ float: left;
40
+ margin: 1px 0 0 0;
41
+ }
42
+
43
+ &:first-child
44
+ {
45
+ display: block;
46
+ margin-bottom: 2px;
47
+ }
48
+ }
49
+ }
50
+
51
+ .fs-input-label
52
+ {
53
+ display: block;
54
+ margin-left: 20px;
55
+
56
+ .underlined
57
+ {
58
+ text-decoration: underline;
59
+ }
60
+ }
61
+ }
62
+
63
+ .rtl
64
+ {
65
+ #fs_marketing_optin
66
+ {
67
+ .fs-input-container
68
+ {
69
+ label input
70
+ {
71
+ float: right;
72
+ }
73
+ }
74
+
75
+ .fs-input-label
76
+ {
77
+ margin-left: 0;
78
+ margin-right: 20px;
79
+ }
80
+ }
81
+ }
freemius/assets/scss/admin/common.scss CHANGED
@@ -1,218 +1,218 @@
1
- @import "../start";
2
- @import "themes";
3
-
4
- #iframe
5
- {
6
- line-height: 0;
7
- font-size: 0;
8
- }
9
-
10
- .fs-full-size-wrapper
11
- {
12
- margin: 40px 0 -65px -20px;
13
-
14
- @media (max-width: 600px) {
15
- margin: 0 0 -65px -10px;
16
- }
17
- }
18
-
19
- .fs-notice
20
- {
21
- position: relative;
22
-
23
- &.fs-has-title
24
- {
25
- margin-bottom: 30px !important;
26
- }
27
-
28
- &.success
29
- {
30
- color: green;
31
- // font-weight: normal;
32
- }
33
-
34
- &.promotion
35
- {
36
- border-color: $fs-notice-promotion-border-color !important;
37
- background-color: $fs-notice-promotion-bkg !important;
38
- }
39
-
40
- .fs-notice-body
41
- {
42
- margin: .5em 0;
43
- padding: 2px;
44
- }
45
-
46
- .fs-close
47
- {
48
- // position: absolute;
49
- // top: 2px;
50
- // bottom: 2px;
51
- // right: 2px;
52
- // min-width: 100px;
53
- // text-align: center;
54
- // padding-right: 2px;
55
- cursor: pointer;
56
- color: #aaa;
57
- float: right;
58
-
59
- &:hover
60
- {
61
- color: #666;
62
- // background: #A9A9A9;
63
- }
64
-
65
- > *
66
- {
67
- margin-top: 7px;
68
- display: inline-block;
69
- }
70
- }
71
-
72
- label.fs-plugin-title
73
- {
74
- background: rgba(0, 0, 0, 0.3);
75
- color: #fff;
76
- padding: 2px 10px;
77
- position: absolute;
78
- top: 100%;
79
- bottom: auto;
80
- right: auto;
81
- @include border-radius(0 0 3px 3px);
82
- left: 10px;
83
- font-size: 12px;
84
- font-weight: bold;
85
- cursor: auto;
86
- }
87
- }
88
-
89
- div.fs-notice
90
- {
91
- &.updated,
92
- &.success,
93
- &.promotion
94
- {
95
- display: block !important;
96
- }
97
- }
98
-
99
- .rtl .fs-notice
100
- {
101
- .fs-close
102
- {
103
- // left: 2px;
104
- // right: auto;
105
- // padding-right: 0;
106
- // padding-left: 2px;
107
- float: left;
108
- }
109
- }
110
-
111
- .fs-secure-notice
112
- {
113
- position: fixed;
114
- top: 32px;
115
- left: 160px;
116
- right: 0;
117
- background: rgb(235, 253, 235);
118
- padding: 10px 20px;
119
- color: green;
120
- z-index: 9999;
121
- @include box-shadow(0 2px 2px rgba(6, 113, 6, 0.3));
122
- @include opacity(0.95);
123
-
124
- &:hover
125
- {
126
- @include opacity(1);
127
- }
128
-
129
- a.fs-security-proof
130
- {
131
- color: green;
132
- text-decoration: none;
133
- }
134
- }
135
-
136
- @media screen and (max-width: 960px) {
137
- .fs-secure-notice
138
- {
139
- left: 36px;
140
- }
141
- }
142
-
143
- @media screen and (max-width: 600px) {
144
- .fs-secure-notice
145
- {
146
- display: none;
147
- }
148
- }
149
-
150
- @media screen and (max-width: 500px) {
151
- #fs_promo_tab
152
- {
153
- display: none;
154
- }
155
- }
156
-
157
- @media screen and (max-width: 782px) {
158
- .fs-secure-notice
159
- {
160
- left: 0;
161
- top: 46px;
162
- text-align: center;
163
- }
164
- }
165
-
166
- span.fs-submenu-item.fs-sub:before
167
- {
168
- // Add small arrow.
169
- content: '\21B3';
170
- padding: 0 5px;
171
- }
172
-
173
- .rtl
174
- {
175
- span.fs-submenu-item.fs-sub:before
176
- {
177
- // Add small RTL arrow.
178
- content: '\21B2';
179
- }
180
- }
181
-
182
- .fs-submenu-item
183
- {
184
- &.pricing
185
- {
186
- &.upgrade-mode
187
- {
188
- color: greenyellow;
189
- }
190
-
191
- &.trial-mode
192
- {
193
- color: #83e2ff;
194
- }
195
- }
196
- }
197
-
198
- #adminmenu .update-plugins.fs-trial
199
- {
200
- background-color: #00b9eb;
201
- }
202
- .fs-ajax-spinner
203
- {
204
- border: 0;
205
- width: 20px;
206
- height: 20px;
207
- margin-right: 5px;
208
- vertical-align: sub;
209
- display: inline-block;
210
- background: url('../../../../../../../wp-admin/images/wpspin_light-2x.gif');
211
- background-size: contain;
212
- }
213
-
214
- .wrap.fs-section {
215
- h2 {
216
- text-align: left;
217
- }
218
}
1
+ @import "../start";
2
+ @import "themes";
3
+
4
+ #iframe
5
+ {
6
+ line-height: 0;
7
+ font-size: 0;
8
+ }
9
+
10
+ .fs-full-size-wrapper
11
+ {
12
+ margin: 40px 0 -65px -20px;
13
+
14
+ @media (max-width: 600px) {
15
+ margin: 0 0 -65px -10px;
16
+ }
17
+ }
18
+
19
+ .fs-notice
20
+ {
21
+ position: relative;
22
+
23
+ &.fs-has-title
24
+ {
25
+ margin-bottom: 30px !important;
26
+ }
27
+
28
+ &.success
29
+ {
30
+ color: green;
31
+ // font-weight: normal;
32
+ }
33
+
34
+ &.promotion
35
+ {
36
+ border-color: $fs-notice-promotion-border-color !important;
37
+ background-color: $fs-notice-promotion-bkg !important;
38
+ }
39
+
40
+ .fs-notice-body
41
+ {
42
+ margin: .5em 0;
43
+ padding: 2px;
44
+ }
45
+
46
+ .fs-close
47
+ {
48
+ // position: absolute;
49
+ // top: 2px;
50
+ // bottom: 2px;
51
+ // right: 2px;
52
+ // min-width: 100px;
53
+ // text-align: center;
54
+ // padding-right: 2px;
55
+ cursor: pointer;
56
+ color: #aaa;
57
+ float: right;
58
+
59
+ &:hover
60
+ {
61
+ color: #666;
62
+ // background: #A9A9A9;
63
+ }
64
+
65
+ > *
66
+ {
67
+ margin-top: 7px;
68
+ display: inline-block;
69
+ }
70
+ }
71
+
72
+ label.fs-plugin-title
73
+ {
74
+ background: rgba(0, 0, 0, 0.3);
75
+ color: #fff;
76
+ padding: 2px 10px;
77
+ position: absolute;
78
+ top: 100%;
79
+ bottom: auto;
80
+ right: auto;
81
+ @include border-radius(0 0 3px 3px);
82
+ left: 10px;
83
+ font-size: 12px;
84
+ font-weight: bold;
85
+ cursor: auto;
86
+ }
87
+ }
88
+
89
+ div.fs-notice
90
+ {
91
+ &.updated,
92
+ &.success,
93
+ &.promotion
94
+ {
95
+ display: block !important;
96
+ }
97
+ }
98
+
99
+ .rtl .fs-notice
100
+ {
101
+ .fs-close
102
+ {
103
+ // left: 2px;
104
+ // right: auto;
105
+ // padding-right: 0;
106
+ // padding-left: 2px;
107
+ float: left;
108
+ }
109
+ }
110
+
111
+ .fs-secure-notice
112
+ {
113
+ position: fixed;
114
+ top: 32px;
115
+ left: 160px;
116
+ right: 0;
117
+ background: rgb(235, 253, 235);
118
+ padding: 10px 20px;
119
+ color: green;
120
+ z-index: 9999;
121
+ @include box-shadow(0 2px 2px rgba(6, 113, 6, 0.3));
122
+ @include opacity(0.95);
123
+
124
+ &:hover
125
+ {
126
+ @include opacity(1);
127
+ }
128
+
129
+ a.fs-security-proof
130
+ {
131
+ color: green;
132
+ text-decoration: none;
133
+ }
134
+ }
135
+
136
+ @media screen and (max-width: 960px) {
137
+ .fs-secure-notice
138
+ {
139
+ left: 36px;
140
+ }
141
+ }
142
+
143
+ @media screen and (max-width: 600px) {
144
+ .fs-secure-notice
145
+ {
146
+ display: none;
147
+ }
148
+ }
149
+
150
+ @media screen and (max-width: 500px) {
151
+ #fs_promo_tab
152
+ {
153
+ display: none;
154
+ }
155
+ }
156
+
157
+ @media screen and (max-width: 782px) {
158
+ .fs-secure-notice
159
+ {
160
+ left: 0;
161
+ top: 46px;
162
+ text-align: center;
163
+ }
164
+ }
165
+
166
+ span.fs-submenu-item.fs-sub:before
167
+ {
168
+ // Add small arrow.
169
+ content: '\21B3';
170
+ padding: 0 5px;
171
+ }
172
+
173
+ .rtl
174
+ {
175
+ span.fs-submenu-item.fs-sub:before
176
+ {
177
+ // Add small RTL arrow.
178
+ content: '\21B2';
179
+ }
180
+ }
181
+
182
+ .fs-submenu-item
183
+ {
184
+ &.pricing
185
+ {
186
+ &.upgrade-mode
187
+ {
188
+ color: greenyellow;
189
+ }
190
+
191
+ &.trial-mode
192
+ {
193
+ color: #83e2ff;
194
+ }
195
+ }
196
+ }
197
+
198
+ #adminmenu .update-plugins.fs-trial
199
+ {
200
+ background-color: #00b9eb;
201
+ }
202
+ .fs-ajax-spinner
203
+ {
204
+ border: 0;
205
+ width: 20px;
206
+ height: 20px;
207
+ margin-right: 5px;
208
+ vertical-align: sub;
209
+ display: inline-block;
210
+ background: url('../../../../../../../wp-admin/images/wpspin_light-2x.gif');
211
+ background-size: contain;
212
+ }
213
+
214
+ .wrap.fs-section {
215
+ h2 {
216
+ text-align: left;
217
+ }
218
}
freemius/assets/scss/admin/connect.scss CHANGED
@@ -1,547 +1,548 @@
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
- &.require-license-key {
57
- #sites_list_container {
58
- td {
59
- cursor: pointer;
60
- }
61
- }
62
- }
63
-
64
- #delegate_to_site_admins {
65
- margin-right: 15px;
66
- float: right;
67
- height: 26px;
68
- vertical-align: middle;
69
- line-height: 37px;
70
- font-weight: bold;
71
- border-bottom: 1px dashed;
72
- text-decoration: none;
73
-
74
- &.rtl {
75
- margin-left: 15px;
76
- margin-right: 0;
77
- }
78
- }
79
-
80
- .fs-actions
81
- {
82
- padding: 10px 20px;
83
- background: #C0C7CA;
84
-
85
- .button
86
- {
87
- padding: 0 10px 1px;
88
- line-height: 35px;
89
- height: 37px;
90
- font-size: 16px;
91
- margin-bottom: 0;
92
-
93
- .dashicons
94
- {
95
- font-size: 37px;
96
- margin-left: -8px;
97
- margin-right: 12px;
98
- }
99
-
100
- &.button-primary
101
- {
102
- padding-right: 15px;
103
- padding-left: 15px;
104
-
105
- &:after
106
- {
107
- content: ' \279C';
108
- }
109
-
110
- &.fs-loading
111
- {
112
- &:after
113
- {
114
- content: '';
115
- }
116
- }
117
- }
118
-
119
- &.button-secondary
120
- {
121
- float: right;
122
- }
123
- }
124
-
125
- // .fs-skip
126
- // {
127
- // line-height: 38px;
128
- // vertical-align: middle;
129
- // text-decoration: none;
130
- // margin-left: 10px;
131
- // }
132
- }
133
-
134
- &.fs-anonymous-disabled
135
- {
136
- .fs-actions
137
- {
138
- .button.button-primary
139
- {
140
- width: 100%;
141
- }
142
- }
143
- }
144
-
145
- .fs-permissions
146
- {
147
- padding: 10px 20px;
148
- background: #FEFEFE;
149
- // background: #F1F1F1;
150
- @include transition(background 0.5s ease);
151
-
152
- .fs-license-sync-disclaimer {
153
- text-align: center;
154
- margin-top: 0;
155
- }
156
-
157
- .fs-trigger
158
- {
159
- font-size: 0.9em;
160
- text-decoration: none;
161
- text-align: center;
162
- display: block;
163
- }
164
-
165
- ul
166
- {
167
- height: 0;
168
- overflow: hidden;
169
- margin: 0;
170
-
171
- li
172
- {
173
- margin-bottom: 12px;
174
-
175
- &:last-child
176
- {
177
- margin-bottom: 0;
178
- }
179
-
180
- i.dashicons
181
- {
182
- float: left;
183
- font-size: 40px;
184
- width: 40px;
185
- height: 40px;
186
- }
187
-
188
- div
189
- {
190
- margin-left: 55px;
191
-
192
- span
193
- {
194
- font-weight: bold;
195
- text-transform: uppercase;
196
- color: #23282d;
197
- }
198
-
199
- p
200
- {
201
- margin: 2px 0 0 0;
202
- }
203
- }
204
- }
205
- }
206
-
207
- &.fs-open
208
- {
209
- background: #fff;
210
-
211
- ul
212
- {
213
- height: auto;
214
- margin: 20px 20px 10px 20px;
215
- }
216
- }
217
-
218
- @media screen and (max-width: ($form_width - 1)) {
219
- background: #fff;
220
-
221
- .fs-trigger
222
- {
223
- display: none;
224
- }
225
-
226
- ul
227
- {
228
- height: auto;
229
- margin: 20px;
230
- }
231
- }
232
- }
233
-
234
- .fs-freemium-licensing {
235
- padding: 8px;
236
- // background: #0085BA;
237
- background: #777;
238
- color: #fff;
239
-
240
- p {
241
- text-align: center;
242
- display: block;
243
- margin: 0;
244
- padding: 0;
245
- }
246
-
247
- a {
248
- color: #C2EEFF;
249
- text-decoration: underline;
250
- }
251
- }
252
-
253
- $icon_size: 80px;
254
- $wp_logo_padding: $icon_size / 10;
255
- $icons_top: 10px;
256
-
257
- .fs-visual
258
- {
259
- padding: 12px;
260
- line-height: 0;
261
- background: #fafafa;
262
- height: $icon_size;
263
- position: relative;
264
-
265
- .fs-site-icon
266
- {
267
- position: absolute;
268
- left: 20px;
269
- top: $icons_top;
270
- }
271
-
272
- .fs-connect-logo
273
- {
274
- position: absolute;
275
- right: 20px;
276
- top: $icons_top;
277
- }
278
-
279
- .fs-plugin-icon
280
- {
281
- position: absolute;
282
- top: $icons_top;
283
- left: 50%;
284
- margin-left: - ($icon_size / 2);
285
- }
286
-
287
- .fs-plugin-icon,
288
- .fs-site-icon,
289
- img,
290
- object
291
- {
292
- width: $icon_size;
293
- height: $icon_size;
294
- }
295
-
296
- .dashicons-wordpress
297
- {
298
- font-size: $icon_size - ($wp_logo_padding * 2);
299
- background: $wordpress_color;
300
- color: #fff;
301
- width: $icon_size - ($wp_logo_padding * 2);
302
- height: $icon_size - ($wp_logo_padding * 2);
303
- padding: $wp_logo_padding;
304
- }
305
-
306
- .dashicons-plus
307
- {
308
- position: absolute;
309
- top: 50%;
310
- font-size: 30px;
311
- margin-top: -10px;
312
- color: #bbb;
313
-
314
- &.fs-first
315
- {
316
- left: 28%;
317
- }
318
- &.fs-second
319
- {
320
- left: 65%;
321
- }
322
- }
323
-
324
- .fs-plugin-icon,
325
- .fs-connect-logo,
326
- .fs-site-icon
327
- {
328
- border: 1px solid #ccc;
329
- padding: 1px;
330
- background: #fff;
331
- }
332
- }
333
-
334
- .fs-terms
335
- {
336
- text-align: center;
337
- font-size: 0.85em;
338
- padding: 5px;
339
- background: rgba(0, 0, 0, 0.05);
340
-
341
- &, a
342
- {
343
- color: #999;
344
- }
345
-
346
- a
347
- {
348
- text-decoration: none;
349
- }
350
- }
351
- }
352
-
353
- @import "multisite-options";
354
- @import "tooltip";
355
-
356
- .rtl
357
- {
358
- #fs_connect
359
- {
360
- .fs-actions
361
- {
362
- padding: 10px 20px;
363
- background: #C0C7CA;
364
-
365
- .button
366
- {
367
- .dashicons
368
- {
369
- font-size: 37px;
370
- margin-left: -8px;
371
- margin-right: 12px;
372
- }
373
-
374
- &.button-primary
375
- {
376
- &:after
377
- {
378
- content: ' \000bb';
379
- }
380
-
381
- &.fs-loading
382
- {
383
- &:after
384
- {
385
- content: '';
386
- }
387
- }
388
- }
389
-
390
- &.button-secondary
391
- {
392
- float: left;
393
- }
394
- }
395
- }
396
-
397
- .fs-permissions
398
- {
399
- ul
400
- {
401
- li
402
- {
403
- div
404
- {
405
- margin-right: 55px;
406
- margin-left: 0;
407
- }
408
-
409
- i.dashicons
410
- {
411
- float: right;
412
- }
413
-
414
- }
415
- }
416
- }
417
-
418
- .fs-visual
419
- {
420
- .fs-site-icon
421
- {
422
- right: 20px;
423
- left: auto;
424
- }
425
-
426
- .fs-connect-logo
427
- {
428
- right: auto;
429
- left: 20px;
430
- }
431
- }
432
- }
433
- }
434
-
435
- #fs_theme_connect_wrapper {
436
- position: fixed;
437
- top: 0;
438
- height: 100%;
439
- width: 100%;
440
- z-index: 99990;
441
- background: rgba(0, 0, 0, 0.75);
442
- text-align: center;
443
- overflow-y: auto;
444
-
445
- &:before {
446
- content: "";
447
- display: inline-block;
448
- vertical-align: middle;
449
- height: 100%;
450
- }
451
-
452
- > button.close {
453
- color: white;
454
- cursor: pointer;
455
- height: 40px;
456
- width: 40px;
457
- position: absolute;
458
- right: 0;
459
- border: 0;
460
- background-color: transparent;
461
- top: 32px;
462
- }
463
-
464
- #fs_connect {
465
- top: 0;
466
- text-align: left;
467
- display: inline-block;
468
- vertical-align: middle;
469
- margin-top: 52px;
470
- margin-bottom: 20px;
471
-
472
- .fs-terms
473
- {
474
- background: rgba(140, 140, 140, 0.64);
475
-
476
- &, a
477
- {
478
- color: #c5c5c5;
479
- }
480
- }
481
- }
482
- }
483
-
484
- .wp-pointer-content
485
- {
486
- #fs_connect
487
- {
488
- margin: 0;
489
- @include box-shadow(none);
490
- }
491
- }
492
-
493
- .fs-opt-in-pointer
494
- {
495
- .wp-pointer-content
496
- {
497
- padding: 0;
498
- }
499
-
500
- &.wp-pointer-top
501
- {
502
- .wp-pointer-arrow
503
- {
504
- border-bottom-color: #dfdfdf;
505
- }
506
- .wp-pointer-arrow-inner
507
- {
508
- border-bottom-color: #fafafa;
509
- }
510
- }
511
-
512
- &.wp-pointer-bottom
513
- {
514
- .wp-pointer-arrow
515
- {
516
- border-top-color: #dfdfdf;
517
- }
518
- .wp-pointer-arrow-inner
519
- {
520
- border-top-color: #fafafa;
521
- }
522
- }
523
-
524
- &.wp-pointer-left
525
- {
526
- .wp-pointer-arrow
527
- {
528
- border-right-color: #dfdfdf;
529
- }
530
- .wp-pointer-arrow-inner
531
- {
532
- border-right-color: #fafafa;
533
- }
534
- }
535
-
536
- &.wp-pointer-right
537
- {
538
- .wp-pointer-arrow
539
- {
540
- border-left-color: #dfdfdf;
541
- }
542
- .wp-pointer-arrow-inner
543
- {
544
- border-left-color: #fafafa;
545
- }
546
- }
547
- }
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
+ &.require-license-key {
57
+ #sites_list_container {
58
+ td {
59
+ cursor: pointer;
60
+ }
61
+ }
62
+ }
63
+
64
+ #delegate_to_site_admins {
65
+ margin-right: 15px;
66
+ float: right;
67
+ height: 26px;
68
+ vertical-align: middle;
69
+ line-height: 37px;
70
+ font-weight: bold;
71
+ border-bottom: 1px dashed;
72
+ text-decoration: none;
73
+
74
+ &.rtl {
75
+ margin-left: 15px;
76
+ margin-right: 0;
77
+ }
78
+ }
79
+
80
+ .fs-actions
81
+ {
82
+ padding: 10px 20px;
83
+ background: #C0C7CA;
84
+
85
+ .button
86
+ {
87
+ padding: 0 10px 1px;
88
+ line-height: 35px;
89
+ height: 37px;
90
+ font-size: 16px;
91
+ margin-bottom: 0;
92
+
93
+ .dashicons
94
+ {
95
+ font-size: 37px;
96
+ margin-left: -8px;
97
+ margin-right: 12px;
98
+ }
99
+
100
+ &.button-primary
101
+ {
102
+ padding-right: 15px;
103
+ padding-left: 15px;
104
+
105
+ &:after
106
+ {
107
+ content: ' \279C';
108
+ }
109
+
110
+ &.fs-loading
111
+ {
112
+ &:after
113
+ {
114
+ content: '';
115
+ }
116
+ }
117
+ }
118
+
119
+ &.button-secondary
120
+ {
121
+ float: right;
122
+ }
123
+ }
124
+
125
+ // .fs-skip
126
+ // {
127
+ // line-height: 38px;
128
+ // vertical-align: middle;
129
+ // text-decoration: none;
130
+ // margin-left: 10px;
131
+ // }
132
+ }
133
+
134
+ &.fs-anonymous-disabled
135
+ {
136
+ .fs-actions
137
+ {
138
+ .button.button-primary
139
+ {
140
+ width: 100%;
141
+ }
142
+ }
143
+ }
144
+
145
+ .fs-permissions
146
+ {
147
+ padding: 10px 20px;
148
+ background: #FEFEFE;
149
+ // background: #F1F1F1;
150
+ @include transition(background 0.5s ease);
151
+
152
+ .fs-license-sync-disclaimer {
153
+ text-align: center;
154
+ margin-top: 0;
155
+ }
156
+
157
+ .fs-trigger
158
+ {
159
+ font-size: 0.9em;
160
+ text-decoration: none;
161
+ text-align: center;
162
+ display: block;
163
+ }
164
+
165
+ ul
166
+ {
167
+ height: 0;
168
+ overflow: hidden;
169
+ margin: 0;
170
+
171
+ li
172
+ {
173
+ margin-bottom: 12px;
174
+
175
+ &:last-child
176
+ {
177
+ margin-bottom: 0;
178
+ }
179
+
180
+ i.dashicons
181
+ {
182
+ float: left;
183
+ font-size: 40px;
184
+ width: 40px;
185
+ height: 40px;
186
+ }
187
+
188
+ div
189
+ {
190
+ margin-left: 55px;
191
+
192
+ span
193
+ {
194
+ font-weight: bold;
195
+ text-transform: uppercase;
196
+ color: #23282d;
197
+ }
198
+
199
+ p
200
+ {
201
+ margin: 2px 0 0 0;
202
+ }
203
+ }
204
+ }
205
+ }
206
+
207
+ &.fs-open
208
+ {
209
+ background: #fff;
210
+
211
+ ul
212
+ {
213
+ height: auto;
214
+ margin: 20px 20px 10px 20px;
215
+ }
216
+ }
217
+
218
+ @media screen and (max-width: ($form_width - 1)) {
219
+ background: #fff;
220
+
221
+ .fs-trigger
222
+ {
223
+ display: none;
224
+ }
225
+
226
+ ul
227
+ {
228
+ height: auto;
229
+ margin: 20px;
230
+ }
231
+ }
232
+ }
233
+
234
+ .fs-freemium-licensing {
235
+ padding: 8px;
236
+ // background: #0085BA;
237
+ background: #777;
238
+ color: #fff;
239
+
240
+ p {
241
+ text-align: center;
242
+ display: block;
243
+ margin: 0;
244
+ padding: 0;
245
+ }
246
+
247
+ a {
248
+ color: #C2EEFF;
249
+ text-decoration: underline;
250
+ }
251
+ }
252
+
253
+ $icon_size: 80px;
254
+ $wp_logo_padding: $icon_size / 10;
255
+ $icons_top: 10px;
256
+
257
+ .fs-visual
258
+ {
259
+ padding: 12px;
260
+ line-height: 0;
261
+ background: #fafafa;
262
+ height: $icon_size;
263
+ position: relative;
264
+
265
+ .fs-site-icon
266
+ {
267
+ position: absolute;
268
+ left: 20px;
269
+ top: $icons_top;
270
+ }
271
+
272
+ .fs-connect-logo
273
+ {
274
+ position: absolute;
275
+ right: 20px;
276
+ top: $icons_top;
277
+ }
278
+
279
+ .fs-plugin-icon
280
+ {
281
+ position: absolute;
282
+ top: $icons_top;
283
+ left: 50%;
284
+ margin-left: - ($icon_size / 2);
285
+ }
286
+
287
+ .fs-plugin-icon,
288
+ .fs-site-icon,
289
+ img,
290
+ object
291
+ {
292
+ width: $icon_size;
293
+ height: $icon_size;
294
+ }
295
+
296
+ .dashicons-wordpress
297
+ {
298
+ font-size: $icon_size - ($wp_logo_padding * 2);
299
+ background: $wordpress_color;
300
+ color: #fff;
301
+ width: $icon_size - ($wp_logo_padding * 2);
302
+ height: $icon_size - ($wp_logo_padding * 2);
303
+ padding: $wp_logo_padding;
304
+ }
305
+
306
+ .dashicons-plus
307
+ {
308
+ position: absolute;
309
+ top: 50%;
310
+ font-size: 30px;
311
+ margin-top: -10px;
312
+ color: #bbb;
313
+
314
+ &.fs-first
315
+ {
316
+ left: 28%;
317
+ }
318
+ &.fs-second
319
+ {
320
+ left: 65%;
321
+ }
322
+ }
323
+
324
+ .fs-plugin-icon,
325
+ .fs-connect-logo,
326
+ .fs-site-icon
327
+ {
328
+ border: 1px solid #ccc;
329
+ padding: 1px;
330
+ background: #fff;
331
+ }
332
+ }
333
+
334
+ .fs-terms
335
+ {
336
+ text-align: center;
337
+ font-size: 0.85em;
338
+ padding: 5px;
339
+ background: rgba(0, 0, 0, 0.05);
340
+
341
+ &, a
342
+ {
343
+ color: #999;
344
+ }
345
+
346
+ a
347
+ {
348
+ text-decoration: none;
349
+ }
350
+ }
351
+ }
352
+
353
+ @import "multisite-options";
354
+ @import "tooltip";
355
+ @import "gdpr-consent";
356
+
357
+ .rtl
358
+ {
359
+ #fs_connect
360
+ {
361
+ .fs-actions
362
+ {
363
+ padding: 10px 20px;
364
+ background: #C0C7CA;
365
+
366
+ .button
367
+ {
368
+ .dashicons
369
+ {
370
+ font-size: 37px;
371
+ margin-left: -8px;
372
+ margin-right: 12px;
373
+ }
374
+
375
+ &.button-primary
376
+ {
377
+ &:after
378
+ {
379
+ content: ' \000bb';
380
+ }
381
+
382
+ &.fs-loading
383
+ {
384
+ &:after
385
+ {
386
+ content: '';
387
+ }
388
+ }
389
+ }
390
+
391
+ &.button-secondary
392
+ {
393
+ float: left;
394
+ }
395
+ }
396
+ }
397
+
398
+ .fs-permissions
399
+ {
400
+ ul
401
+ {
402
+ li
403
+ {
404
+ div
405
+ {
406
+ margin-right: 55px;
407
+ margin-left: 0;
408
+ }
409
+
410
+ i.dashicons
411
+ {
412
+ float: right;
413
+ }
414
+
415
+ }
416
+ }
417
+ }
418
+
419
+ .fs-visual
420
+ {
421
+ .fs-site-icon
422
+ {
423
+ right: 20px;
424
+ left: auto;
425
+ }
426
+
427
+ .fs-connect-logo
428
+ {
429
+ right: auto;
430
+ left: 20px;
431
+ }
432
+ }
433
+ }
434
+ }
435
+
436
+ #fs_theme_connect_wrapper {
437
+ position: fixed;
438
+ top: 0;
439
+ height: 100%;
440
+ width: 100%;
441
+ z-index: 99990;
442
+ background: rgba(0, 0, 0, 0.75);
443
+ text-align: center;
444
+ overflow-y: auto;
445
+
446
+ &:before {
447
+ content: "";
448
+ display: inline-block;
449
+ vertical-align: middle;
450
+ height: 100%;
451
+ }
452
+
453
+ > button.close {
454
+ color: white;
455
+ cursor: pointer;
456
+ height: 40px;
457
+ width: 40px;
458
+ position: absolute;
459
+ right: 0;
460
+ border: 0;
461
+ background-color: transparent;
462
+ top: 32px;
463
+ }
464
+
465
+ #fs_connect {
466
+ top: 0;
467
+ text-align: left;
468
+ display: inline-block;
469
+ vertical-align: middle;
470
+ margin-top: 52px;
471
+ margin-bottom: 20px;
472
+
473
+ .fs-terms
474
+ {
475
+ background: rgba(140, 140, 140, 0.64);
476
+
477
+ &, a
478
+ {
479
+ color: #c5c5c5;
480
+ }
481
+ }
482
+ }
483
+ }
484
+
485
+ .wp-pointer-content
486
+ {
487
+ #fs_connect
488
+ {
489
+ margin: 0;
490
+ @include box-shadow(none);
491
+ }
492
+ }
493
+
494
+ .fs-opt-in-pointer
495
+ {
496
+ .wp-pointer-content
497
+ {
498
+ padding: 0;
499
+ }
500
+
501
+ &.wp-pointer-top
502
+ {
503
+ .wp-pointer-arrow
504
+ {
505
+ border-bottom-color: #dfdfdf;
506
+ }
507
+ .wp-pointer-arrow-inner
508
+ {
509
+ border-bottom-color: #fafafa;
510
+ }
511
+ }
512
+
513
+ &.wp-pointer-bottom
514
+ {
515
+ .wp-pointer-arrow
516
+ {
517
+ border-top-color: #dfdfdf;
518
+ }
519
+ .wp-pointer-arrow-inner
520
+ {
521
+ border-top-color: #fafafa;
522
+ }
523
+ }
524
+
525
+ &.wp-pointer-left
526
+ {
527
+ .wp-pointer-arrow
528
+ {
529
+ border-right-color: #dfdfdf;
530
+ }
531
+ .wp-pointer-arrow-inner
532
+ {
533
+ border-right-color: #fafafa;
534
+ }
535
+ }
536
+
537
+ &.wp-pointer-right
538
+ {
539
+ .wp-pointer-arrow
540
+ {
541
+ border-left-color: #dfdfdf;
542
+ }
543
+ .wp-pointer-arrow-inner
544
+ {
545
+ border-left-color: #fafafa;
546
+ }
547
+ }
548
+ }
freemius/assets/scss/admin/gdpr-optin-notice.scss ADDED
@@ -0,0 +1,17 @@
1
+ .fs-notice[data-id^="gdpr_optin_actions"]
2
+ {
3
+ .underlined {
4
+ text-decoration: underline;
5
+ }
6
+
7
+ ul {
8
+ .button, .action-description {
9
+ vertical-align: middle;
10
+ }
11
+
12
+ .action-description {
13
+ display: inline-block;
14
+ margin-left: 3px;
15
+ }
16
+ }
17
+ }
freemius/composer.json ADDED
@@ -0,0 +1,10 @@
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-3.0-only",
7
+ "require": {
8
+ "php": ">=5.2"
9
+ }
10
+ }
freemius/config.php CHANGED
@@ -248,6 +248,9 @@
248
if ( ! defined( 'WP_FS__API_CACHE_OPTION_NAME' ) ) {
249
define( 'WP_FS__API_CACHE_OPTION_NAME', WP_FS___OPTION_PREFIX . 'api_cache' );
250
}
251
define( 'WP_FS__OPTIONS_OPTION_NAME', WP_FS___OPTION_PREFIX . 'options' );
252
253
/**
@@ -282,8 +285,11 @@
282
define( 'WP_FS__TIME_10_MIN_IN_SEC', 600 );
283
}
284
// define( 'WP_FS__TIME_15_MIN_IN_SEC', 900 );
285
if ( ! defined( 'WP_FS__TIME_24_HOURS_IN_SEC' ) ) {
286
- define( 'WP_FS__TIME_24_HOURS_IN_SEC', 86400 );
287
}
288
if ( ! defined( 'WP_FS__TIME_WEEK_IN_SEC' ) ) {
289
define( 'WP_FS__TIME_WEEK_IN_SEC', 7 * WP_FS__TIME_24_HOURS_IN_SEC );
@@ -375,4 +381,8 @@
375
define( 'WP_FS__SHOW_NETWORK_EVEN_WHEN_DELEGATED', false );
376
}
377
378
- #endregion
248
if ( ! defined( 'WP_FS__API_CACHE_OPTION_NAME' ) ) {
249
define( 'WP_FS__API_CACHE_OPTION_NAME', WP_FS___OPTION_PREFIX . 'api_cache' );
250
}
251
+ if ( ! defined( 'WP_FS__GDPR_OPTION_NAME' ) ) {
252
+ define( 'WP_FS__GDPR_OPTION_NAME', WP_FS___OPTION_PREFIX . 'gdpr' );
253
+ }
254
define( 'WP_FS__OPTIONS_OPTION_NAME', WP_FS___OPTION_PREFIX . 'options' );
255
256
/**
285
define( 'WP_FS__TIME_10_MIN_IN_SEC', 600 );
286
}
287
// define( 'WP_FS__TIME_15_MIN_IN_SEC', 900 );
288
+ if ( ! defined( 'WP_FS__TIME_12_HOURS_IN_SEC' ) ) {
289
+ define( 'WP_FS__TIME_12_HOURS_IN_SEC', 43200 );
290
+ }
291
if ( ! defined( 'WP_FS__TIME_24_HOURS_IN_SEC' ) ) {
292
+ define( 'WP_FS__TIME_24_HOURS_IN_SEC', WP_FS__TIME_12_HOURS_IN_SEC * 2 );
293
}
294
if ( ! defined( 'WP_FS__TIME_WEEK_IN_SEC' ) ) {
295
define( 'WP_FS__TIME_WEEK_IN_SEC', 7 * WP_FS__TIME_24_HOURS_IN_SEC );
381
define( 'WP_FS__SHOW_NETWORK_EVEN_WHEN_DELEGATED', false );
382
}
383
384
+ #endregion
385
+
386
+ if ( ! defined( 'WP_FS__DEMO_MODE' ) ) {
387
+ define( 'WP_FS__DEMO_MODE', false );
388
+ }
freemius/includes/class-freemius-abstract.php CHANGED
@@ -359,7 +359,7 @@
359
#----------------------------------------------------------------------------------
360
361
/**
362
- * Check if plugin using the free plan.
363
*
364
* @since 1.0.4
365
*
359
#----------------------------------------------------------------------------------
360
361
/**
362
+ * Check if the user is on the free plan of the product.
363
*
364
* @since 1.0.4
365
*
freemius/includes/class-freemius.php CHANGED
@@ -1,19910 +1,20763 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
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
- * @since 1.2.2
72
- *
73
- * @var string
74
- */
75
- private $_module_type;
76
-
77
- #endregion Plugin Info
78
-
79
- /**
80
- * @since 1.0.9
81
- *
82
- * @var bool If false, don't turn Freemius on.
83
- */
84
- private $_is_on;
85
-
86
- /**
87
- * @since 1.1.3
88
- *
89
- * @var bool If false, don't turn Freemius on.
90
- */
91
- private $_is_anonymous;
92
-
93
- /**
94
- * @since 1.0.9
95
- * @var bool If false, issues with connectivity to Freemius API.
96
- */
97
- private $_has_api_connection;
98
-
99
- /**
100
- * @since 1.0.9
101
- * @since 2.0.0 Default to true since we need the property during the instance construction, prior to the dynamic_init() execution.
102
- * @var bool Hints the SDK if plugin can support anonymous mode (if skip connect is visible).
103
- */
104
- private $_enable_anonymous = true;
105
-
106
- /**
107
- * @since 1.1.7.5
108
- * @var bool Hints the SDK if plugin should run in anonymous mode (only adds feedback form).
109
- */
110
- private $_anonymous_mode;
111
-
112
- /**
113
- * @since 1.1.9
114
- * @var bool Hints the SDK if plugin have any free plans.
115
- */
116
- private $_is_premium_only;
117
-
118
- /**
119
- * @since 1.2.1.6
120
- * @var bool Hints the SDK if plugin have premium code version at all.
121
- */
122
- private $_has_premium_version;
123
-
124
- /**
125
- * @since 1.2.1.6
126
- * @var bool Hints the SDK if plugin should ignore pending mode by simulating a skip.
127
- */
128
- private $_ignore_pending_mode;
129
-
130
- /**
131
- * @since 1.0.8
132
- * @var bool Hints the SDK if the plugin has any paid plans.
133
- */
134
- private $_has_paid_plans;
135
-
136
- /**
137
- * @since 1.2.1.5
138
- * @var int Hints the SDK if the plugin offers a trial period. If negative, no trial, if zero - has a trial but
139
- * without a specified period, if positive - the number of trial days.
140
- */
141
- private $_trial_days = - 1;
142
-
143
- /**
144
- * @since 1.2.1.5
145
- * @var bool Hints the SDK if the trial requires a payment method or not.
146
- */
147
- private $_is_trial_require_payment = false;
148
-
149
- /**
150
- * @since 1.0.7
151
- * @var bool Hints the SDK if the plugin is WordPress.org compliant.
152
- */
153
- private $_is_org_compliant;
154
-
155
- /**
156
- * @since 1.0.7
157
- * @var bool Hints the SDK if the plugin is has add-ons.
158
- */
159
- private $_has_addons;
160
-
161
- /**
162
- * @since 1.1.6
163
- * @var string[]bool.
164
- */
165
- private $_permissions;
166
-
167
- /**
168
- * @var FS_Storage
169
- */
170
- private $_storage;
171
-
172
- /**
173
- * @since 1.2.2.7
174
- * @var FS_Cache_Manager
175
- */
176
- private $_cache;
177
-
178
- /**
179
- * @since 1.0.0
180
- *
181
- * @var FS_Logger
182
- */
183
- private $_logger;
184
- /**
185
- * @since 1.0.4
186
- *
187
- * @var FS_Plugin
188
- */
189
- private $_plugin = false;
190
- /**
191
- * @since 1.0.4
192
- *
193
- * @var FS_Plugin|false
194
- */
195
- private $_parent_plugin = false;
196
- /**
197
- * @since 1.1.1
198
- *
199
- * @var Freemius
200
- */
201
- private $_parent = false;
202
- /**
203
- * @since 1.0.1
204
- *
205
- * @var FS_User
206
- */
207
- private $_user = false;
208
- /**
209
- * @since 1.0.1
210
- *
211
- * @var FS_Site
212
- */
213
- private $_site = false;
214
- /**
215
- * @since 1.0.1
216
- *
217
- * @var FS_Plugin_License
218
- */
219
- private $_license;
220
- /**
221
- * @since 1.0.2
222
- *
223
- * @var FS_Plugin_Plan[]
224
- */
225
- private $_plans = false;
226
- /**
227
- * @var FS_Plugin_License[]
228
- * @since 1.0.5
229
- */
230
- private $_licenses = false;
231
-
232
- /**
233
- * @since 1.0.1
234
- *
235
- * @var FS_Admin_Menu_Manager
236
- */
237
- private $_menu;
238
-
239
- /**
240
- * @var FS_Admin_Notices
241
- */
242
- private $_admin_notices;
243
-
244
- /**
245
- * @since 1.1.6
246
- *
247
- * @var FS_Admin_Notices
248
- */
249
- private static $_global_admin_notices;
250
-
251
- /**
252
- * @var FS_Logger
253
- * @since 1.0.0
254
- */
255
- private static $_static_logger;
256
-
257
- /**
258
- * @var FS_Options
259
- * @since 1.0.2
260
- */
261
- private static $_accounts;
262
-
263
- /**
264
- * @since 1.2.2
265
- *
266
- * @var number
267
- */
268
- private $_module_id;
269
-
270
- /**
271
- * @var Freemius[]
272
- */
273
- private static $_instances = array();
274
-
275
- /**
276
- * @since 1.2.3
277
- *
278
- * @var FS_Affiliate
279
- */
280
- private $affiliate = null;
281
-
282
- /**
283
- * @since 1.2.3
284
- *
285
- * @var FS_AffiliateTerms
286
- */
287
- private $plugin_affiliate_terms = null;
288
-
289
- /**
290
- * @since 1.2.3
291
- *
292
- * @var FS_AffiliateTerms
293
- */
294
- private $custom_affiliate_terms = null;
295
-
296
- /**
297
- * @since 2.0.0
298
- *
299
- * @var bool
300
- */
301
- private $_is_multisite_integrated;
302
-
303
- /**
304
- * @since 2.0.0
305
- *
306
- * @var bool True if the current request is for a network admin screen and the plugin is network active.
307
- */
308
- private $_is_network_active;
309
-
310
- /**
311
- * @since 2.0.0
312
- *
313
- * @var int|null The original blog ID the plugin was loaded with.
314
- */
315
- private $_blog_id = null;
316
-
317
- /**
318
- * @since 2.0.0
319
- *
320
- * @var int|null The current execution context. When true, run on network context. When int, run on the specified blog context.
321
- */
322
- private $_context_is_network_or_blog_id = null;
323
-
324
- /**
325
- * @since 2.0.0
326
- *
327
- * @var string
328
- */
329
- private $_dynamically_added_top_level_page_hook_name = '';
330
-
331
- #region Uninstall Reasons IDs
332
-
333
- const REASON_NO_LONGER_NEEDED = 1;
334
- const REASON_FOUND_A_BETTER_PLUGIN = 2;
335
- const REASON_NEEDED_FOR_A_SHORT_PERIOD = 3;
336
- const REASON_BROKE_MY_SITE = 4;
337
- const REASON_SUDDENLY_STOPPED_WORKING = 5;
338
- const REASON_CANT_PAY_ANYMORE = 6;
339
- const REASON_OTHER = 7;
340
- const REASON_DIDNT_WORK = 8;
341
- const REASON_DONT_LIKE_TO_SHARE_MY_INFORMATION = 9;
342
- const REASON_COULDNT_MAKE_IT_WORK = 10;
343
- const REASON_GREAT_BUT_NEED_SPECIFIC_FEATURE = 11;
344
- const REASON_NOT_WORKING = 12;
345
- const REASON_NOT_WHAT_I_WAS_LOOKING_FOR = 13;
346
- const REASON_DIDNT_WORK_AS_EXPECTED = 14;
347
- const REASON_TEMPORARY_DEACTIVATION = 15;
348
-
349
- #endregion
350
-
351
- /* Ctor
352
- ------------------------------------------------------------------------------------------------------------------*/
353
-
354
- /**
355
- * Main singleton instance.
356
- *
357
- * @author Vova Feldman (@svovaf)
358
- * @since 1.0.0
359
- *
360
- * @param number $module_id
361
- * @param string|bool $slug
362
- * @param bool $is_init Since 1.2.1 Is initiation sequence.
363
- */
364
- private function __construct( $module_id, $slug = false, $is_init = false ) {
365
- if ( $is_init && is_numeric( $module_id ) && is_string( $slug ) ) {
366
- $this->store_id_slug_type_path_map( $module_id, $slug );
367
- }
368
-
369
- $this->_module_id = $module_id;
370
- $this->_slug = $this->get_slug();
371
- $this->_module_type = $this->get_module_type();
372
-
373
- $this->_blog_id = is_multisite() ? get_current_blog_id() : null;
374
-
375
- $this->_storage = FS_Storage::instance( $this->_module_type, $this->_slug );
376
-
377
- $this->_cache = FS_Cache_Manager::get_manager( WP_FS___OPTION_PREFIX . "cache_{$module_id}" );
378
-
379
- $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $this->get_unique_affix(), WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
380
-
381
- $this->_plugin_main_file_path = $this->_find_caller_plugin_file( $is_init );
382
- $this->_plugin_dir_path = plugin_dir_path( $this->_plugin_main_file_path );
383
- $this->_plugin_basename = $this->get_plugin_basename();
384
- $this->_free_plugin_basename = str_replace( '-premium/', '/', $this->_plugin_basename );
385
-
386
- $this->_is_multisite_integrated = (
387
- defined( "WP_FS__PRODUCT_{$module_id}_MULTISITE" ) &&
388
- ( true === constant( "WP_FS__PRODUCT_{$module_id}_MULTISITE" ) )
389
- );
390
-
391
- $this->_is_network_active = (
392
- is_multisite() &&
393
- $this->_is_multisite_integrated &&
394
- // Themes are always network activated, but the ACTUAL activation is per site.
395
- $this->is_plugin() &&
396
- ( is_plugin_active_for_network( $this->_plugin_basename ) ||
397
- // Plugin network level activation or uninstall.
398
- is_plugin_inactive( $this->_plugin_basename ) )
399
- );
400
-
401
- $this->_storage->set_network_active(
402
- $this->_is_network_active,
403
- $this->is_delegated_connection()
404
- );
405
-
406
- #region Migration
407
-
408
- if ( is_multisite() ) {
409
- /**
410
- * If the install_timestamp exists on the site level but doesn't exist on the
411
- * network level storage, it means that we need to process the storage with migration.
412
- *
413
- * The code in this `if` scope will only be executed once and only for the first site that will execute it because once we migrate the storage data, install_timestamp will be already set in the network level storage.
414
- *
415
- * @author Vova Feldman (@svovaf)
416
- * @since 2.0.0
417
- */
418
- if ( false === $this->_storage->get( 'install_timestamp', false, true ) &&
419
- false !== $this->_storage->get( 'install_timestamp', false, false )
420
- ) {
421
- // Initiate storage migration.
422
- $this->_storage->migrate_to_network();
423
-
424
- // Migrate module cache to network level storage.
425
- $this->_cache->migrate_to_network();
426
- }
427
- }
428
-
429
- #endregion
430
-
431
- $base_name_split = explode( '/', $this->_plugin_basename );
432
- $this->_plugin_dir_name = $base_name_split[0];
433
-
434
- if ( $this->_logger->is_on() ) {
435
- $this->_logger->info( 'plugin_main_file_path = ' . $this->_plugin_main_file_path );
436
- $this->_logger->info( 'plugin_dir_path = ' . $this->_plugin_dir_path );
437
- $this->_logger->info( 'plugin_basename = ' . $this->_plugin_basename );
438
- $this->_logger->info( 'free_plugin_basename = ' . $this->_free_plugin_basename );
439
- $this->_logger->info( 'plugin_dir_name = ' . $this->_plugin_dir_name );
440
- }
441
-
442
- // Remember link between file to slug.
443
- $this->store_file_slug_map();
444
-
445
- // Store plugin's initial install timestamp.
446
- if ( ! isset( $this->_storage->install_timestamp ) ) {
447
- $this->_storage->install_timestamp = WP_FS__SCRIPT_START_TIME;
448
- }
449
-
450
- if ( ! is_object( $this->_plugin ) ) {
451
- $this->_plugin = FS_Plugin_Manager::instance( $this->_module_id )->get();
452
- }
453
-
454
- $this->_admin_notices = FS_Admin_Notices::instance(
455
- $this->_slug . ( $this->is_theme() ? ':theme' : '' ),
456
- /**
457
- * Ensure that the admin notice will always have a title by using the stored plugin title if available and
458
- * retrieving the title via the "get_plugin_name" method if there is no stored plugin title available.
459
- *
460
- * @author Leo Fajardo (@leorw)
461
- * @since 1.2.2
462
- */
463
- ( is_object( $this->_plugin ) ? $this->_plugin->title : $this->get_plugin_name() ),
464
- $this->get_unique_affix()
465
- );
466
-
467
- if ( 'true' === fs_request_get( 'fs_clear_api_cache' ) ||
468
- 'true' === fs_request_is_action( 'restart_freemius' )
469
- ) {
470
- FS_Api::clear_cache();
471
- $this->_cache->clear();
472
- }
473
-
474
- $this->_register_hooks();
475
-
476
- /**
477
- * Starting from version 2.0.0, `FS_Site` entities no longer have the `plan` property and have `plan_id`
478
- * instead. This should be called before calling `_load_account()`, otherwise, `$this->_site` will not be
479
- * loaded in `_load_account` for versions of SDK starting from 2.0.0.
480
- *
481
- * @author Leo Fajardo (@leorw)
482
- */
483
- self::migrate_install_plan_to_plan_id( $this->_storage );
484
-
485
- $this->_load_account();
486
-
487
- $this->_version_updates_handler();
488
- }
489
-
490
- /**
491
- * Checks whether this module has a settings menu.
492
- *
493
- * @author Leo Fajardo (@leorw)
494
- * @since 1.2.2
495
- *
496
- * @return bool
497
- */
498
- function has_settings_menu() {
499
- return ( $this->_is_network_active && fs_is_network_admin() ) ?
500
- $this->_menu->has_network_menu() :
501
- $this->_menu->has_menu();
502
- }
503
-
504
- /**
505
- * Check if the context module is free wp.org theme.
506
- *
507
- * This method is helpful because:
508
- * 1. wp.org themes are limited to a single submenu item,
509
- * and sub-submenu items are most likely not allowed (never verified).
510
- * 2. wp.org themes are not allowed to redirect the user
511
- * after the theme activation, therefore, the agreed UX
512
- * is showing the opt-in as a modal dialog box after
513
- * activation (approved by @otto42, @emiluzelac, @greenshady, @grapplerulrich).
514
- *
515
- * @author Vova Feldman (@svovaf)
516
- * @since 1.2.2.7
517
- *
518
- * @return bool
519
- */
520
- function is_free_wp_org_theme() {
521
- return (
522
- $this->is_theme() &&
523
- $this->is_org_repo_compliant() &&
524
- ! $this->is_premium()
525
- );
526
- }
527
-
528
- /**
529
- * Checks whether this a submenu item is visible.
530
- *
531
- * @author Vova Feldman (@svovaf)
532
- * @since 1.2.2.6
533
- * @since 1.2.2.7 Even if the menu item was specified to be hidden, when it is the context page, then show the submenu item so the user will have the right context page.
534
- *
535
- * @param string $slug
536
- *
537
- * @return bool
538
- */
539
- function is_submenu_item_visible( $slug ) {
540
- if ( $this->is_admin_page( $slug ) ) {
541
- /**
542
- * It is the current context page, so show the submenu item
543
- * so the user will have the right context page, even if it
544
- * was set to hidden.
545
- */
546
- return true;
547
- }
548
-
549
- if ( ! $this->has_settings_menu() ) {
550
- // No menu settings at all.
551
- return false;
552
- }
553
-
554
- if ( $this->is_free_wp_org_theme() ) {
555
- /**
556
- * wp.org themes are limited to a single submenu item, and
557
- * sub-submenu items are most likely not allowed (never verified).
558
- */
559
- return false;
560
- }
561
-
562
- return $this->_menu->is_submenu_item_visible( $slug );
563
- }
564
-
565
- /**
566
- * Check if a Freemius page should be accessible via the UI.
567
- *
568
- * @author Vova Feldman (@svovaf)
569
- * @since 1.2.2.7
570
- *
571
- * @param string $slug
572
- *
573
- * @return bool
574
- */
575
- function is_page_visible( $slug ) {
576
- if ( $this->is_admin_page( $slug ) ) {
577
- return true;
578
- }
579
-
580
- return $this->_menu->is_submenu_item_visible( $slug, true, true );
581
- }
582
-
583
- /**
584
- * @author Vova Feldman (@svovaf)
585
- * @since 1.0.9
586
- */
587
- private function _version_updates_handler() {
588
- if ( ! isset( $this->_storage->sdk_version ) || $this->_storage->sdk_version != $this->version ) {
589
- // Freemius version upgrade mode.
590
- $this->_storage->sdk_last_version = $this->_storage->sdk_version;
591
- $this->_storage->sdk_version = $this->version;
592
-
593
- if ( empty( $this->_storage->sdk_last_version ) ||
594
- version_compare( $this->_storage->sdk_last_version, $this->version, '<' )
595
- ) {
596
- $this->_storage->sdk_upgrade_mode = true;
597
- $this->_storage->sdk_downgrade_mode = false;
598
- } else {
599
- $this->_storage->sdk_downgrade_mode = true;
600
- $this->_storage->sdk_upgrade_mode = false;
601
-
602
- }
603
-
604
- $this->do_action( 'sdk_version_update', $this->_storage->sdk_last_version, $this->version );
605
- }
606
-
607
- $plugin_version = $this->get_plugin_version();
608
- if ( ! isset( $this->_storage->plugin_version ) || $this->_storage->plugin_version != $plugin_version ) {
609
- // Plugin version upgrade mode.
610
- $this->_storage->plugin_last_version = $this->_storage->plugin_version;
611
- $this->_storage->plugin_version = $plugin_version;
612
-
613
- if ( empty( $this->_storage->plugin_last_version ) ||
614
- version_compare( $this->_storage->plugin_last_version, $plugin_version, '<' )
615
- ) {
616
- $this->_storage->plugin_upgrade_mode = true;
617
- $this->_storage->plugin_downgrade_mode = false;
618
- } else {
619
- $this->_storage->plugin_downgrade_mode = true;
620
- $this->_storage->plugin_upgrade_mode = false;
621
- }
622
-
623
- if ( ! empty( $this->_storage->plugin_last_version ) ) {
624
- // Different version of the plugin was installed before, therefore it's an update.
625
- $this->_storage->is_plugin_new_install = false;
626
- }
627
-
628
- $this->do_action( 'plugin_version_update', $this->_storage->plugin_last_version, $plugin_version );
629
- }
630
- }
631
-
632
- #--------------------------------------------------------------------------------
633
- #region Data Migration on SDK Update
634
- #--------------------------------------------------------------------------------
635
-
636
- /**
637
- * @author Vova Feldman (@svovaf)
638
- * @since 1.1.5
639
- *
640
- * @param string $sdk_prev_version
641
- * @param string $sdk_version
642
- */
643
- function _data_migration( $sdk_prev_version, $sdk_version ) {
644
- /**
645
- * @since 1.1.7.3 Fixed unwanted connectivity test cleanup.
646
- */
647
- if ( empty( $sdk_prev_version ) ) {
648
- return;
649
- }
650
-
651
- if ( version_compare( $sdk_prev_version, '2.0.0', '<' ) &&
652
- version_compare( $sdk_version, '2.0.0', '>=' )
653
- ) {
654
- $this->migrate_to_subscriptions_collection();
655
-
656
- $this->consolidate_licenses();
657
-
658
- // Clear trial_plan since it's now loaded from the plans collection when needed.
659
- $this->_storage->remove( 'trial_plan', true, false );
660
- }
661
-
662
- if ( version_compare( $sdk_prev_version, '1.2.3', '<' ) &&
663
- version_compare( $sdk_version, '1.2.3', '>=' )
664
- ) {
665
- /**
666
- * Starting from version 1.2.3, paths are stored as relative paths and not absolute paths; so when upgrading to 1.2.3, make paths relative.
667
- *
668
- * @author Leo Fajardo (@leorw)
669
- */
670
- $this->make_paths_relative();
671
- }
672
-
673
- if ( version_compare( $sdk_prev_version, '1.1.5', '<' ) &&
674
- version_compare( $sdk_version, '1.1.5', '>=' )
675
- ) {
676
- // On version 1.1.5 merged connectivity and is_on data.
677
- if ( isset( $this->_storage->connectivity_test ) ) {
678
- if ( ! isset( $this->_storage->is_on ) ) {
679
- unset( $this->_storage->connectivity_test );
680
- } else {
681
- $connectivity_data = $this->_storage->connectivity_test;
682
- $connectivity_data['is_active'] = $this->_storage->is_on['is_active'];
683
- $connectivity_data['timestamp'] = $this->_storage->is_on['timestamp'];
684
-
685
- // Override.
686
- $this->_storage->connectivity_test = $connectivity_data;
687
-
688
- // Remove previous structure.
689
- unset( $this->_storage->is_on );
690
- }
691
-
692
- }
693
- }
694
- }
695
-
696
- /**
697
- * @author Leo Fajardo (@leorw)
698
- * @since 2.0.0
699
- *
700
- * @param \FS_Storage $storage
701
- * @param bool|int|null $blog_id
702
- */
703
- private static function migrate_install_plan_to_plan_id( FS_Storage $storage, $blog_id = null ) {
704
- if ( empty( $storage->sdk_version ) ) {
705
- // New installation of the plugin, no need to upgrade.
706
- return;
707
- }
708
-
709
- if ( ! version_compare( $storage->sdk_version, '2.0.0', '<' ) ) {
710
- // Previous version is >= 2.0.0, so no need to migrate.
711
- return;
712
- }
713
-
714
- // Alias.
715
- $module_type = $storage->get_module_type();
716
- $module_slug = $storage->get_module_slug();
717
-
718
- $installs = self::get_all_sites( $module_type, $blog_id );
719
- $install = isset( $installs[ $module_slug ] ) ? $installs[ $module_slug ] : null;
720
-
721
- if ( ! is_object( $install ) ) {
722
- return;
723
- }
724
-
725
- if ( isset( $install->plan ) && is_object( $install->plan ) ) {
726
- if ( isset( $install->plan->id ) && ! empty( $install->plan->id ) ) {
727
- $install->plan_id = self::_decrypt( $install->plan->id );
728
- }
729
-
730
- unset( $install->plan );
731
-
732
- $installs[ $module_slug ] = clone $install;
733
-
734
- self::set_account_option_by_module(
735
- $module_type,
736
- 'sites',
737
- $installs,
738
- true,
739
- $blog_id
740
- );
741
- }
742
- }
743
-
744
- /**
745
- * @author Leo Fajardo (@leorw)
746
- * @since 2.0.0
747
- */
748
- private function migrate_to_subscriptions_collection() {
749
- if ( ! is_object( $this->_site ) ) {
750
- return;
751
- }
752
-
753
- if ( isset( $this->_storage->subscription ) && is_object( $this->_storage->subscription ) ) {
754
- $this->_storage->subscriptions = array( $this->_storage->subscription );
755
- }
756
- }
757
-
758
- /**
759
- * @author Leo Fajardo (@leorw)
760
- * @since 2.0.0
761
- */
762
- private function consolidate_licenses() {
763
- $plugin_licenses = self::get_account_option( 'licenses', WP_FS__MODULE_TYPE_PLUGIN );
764
- if ( isset( $plugin_licenses[ $this->_slug ] ) ) {
765
- $plugin_licenses = $plugin_licenses[ $this->_slug ];
766
- } else {
767
- $plugin_licenses = array();
768
- }
769
-
770
- $theme_licenses = self::get_account_option( 'licenses', WP_FS__MODULE_TYPE_THEME );
771
- if ( isset( $theme_licenses[ $this->_slug ] ) ) {
772
- $theme_licenses = $theme_licenses[ $this->_slug ];
773
- } else {
774
- $theme_licenses = array();
775
- }
776
-
777
- if ( empty( $plugin_licenses ) && empty( $theme_licenses ) ) {
778
- return;
779
- }
780
-
781
- $all_licenses = array();
782
- $user_id_license_ids_map = array();
783
-
784
- foreach ( $plugin_licenses as $user_id => $user_licenses ) {
785
- if ( is_array( $user_licenses ) ) {
786
- if ( ! isset( $user_license_ids[ $user_id ] ) ) {
787
- $user_id_license_ids_map[ $user_id ] = array();
788
- }
789
-
790
- foreach ( $user_licenses as $user_license ) {
791
- $all_licenses[] = $user_license;
792
- $user_id_license_ids_map[ $user_id ][] = $user_license->id;
793
- }
794
- }
795
- }
796
-
797
- foreach ( $theme_licenses as $user_id => $user_licenses ) {
798
- if ( is_array( $user_licenses ) ) {
799
- if ( ! isset( $user_license_ids[ $user_id ] ) ) {
800
- $user_id_license_ids_map[ $user_id ] = array();
801
- }
802
-
803
- foreach ( $user_licenses as $user_license ) {
804
- $all_licenses[] = $user_license;
805
- $user_id_license_ids_map[ $user_id ][] = $user_license->id;
806
- }
807
- }
808
- }
809
-
810
- self::store_user_id_license_ids_map(
811
- $user_id_license_ids_map,
812
- $this->_module_id
813
- );
814
-
815
- $this->_store_licenses( true, $this->_module_id, $all_licenses );
816
- }
817
-
818
- /**
819
- * Makes paths relative.
820
- *
821
- * @author Leo Fajardo (@leorw)
822
- * @since 1.2.3
823
- */
824
- private function make_paths_relative() {
825
- $id_slug_type_path_map = self::$_accounts->get_option( 'id_slug_type_path_map', array() );
826
-
827
- if ( isset( $id_slug_type_path_map[ $this->_module_id ]['path'] ) ) {
828
- $id_slug_type_path_map[ $this->_module_id ]['path'] = $this->get_relative_path( $id_slug_type_path_map[ $this->_module_id ]['path'] );
829
-
830
- self::$_accounts->set_option( 'id_slug_type_path_map', $id_slug_type_path_map, true );
831
- }
832
-
833
- if ( isset( $this->_storage->plugin_main_file ) ) {
834
- $plugin_main_file = $this->_storage->plugin_main_file;
835
-
836
- if ( isset( $plugin_main_file->path ) ) {
837
- $this->_storage->plugin_main_file->path = $this->get_relative_path( $this->_storage->plugin_main_file->path );
838
- } else if ( isset( $plugin_main_file->prev_path ) ) {
839
- $this->_storage->plugin_main_file->prev_path = $this->get_relative_path( $this->_storage->plugin_main_file->prev_path );
840
- }
841
- }
842
-
843
- // Remove invalid path that is still associated with the current slug if there's any.
844
- $file_slug_map = self::$_accounts->get_option( 'file_slug_map', array() );
845
- foreach ( $file_slug_map as $plugin_basename => $slug ) {
846
- if ( $slug === $this->_slug &&
847
- $plugin_basename !== $this->_plugin_basename &&
848
- ! file_exists( $this->get_absolute_path( $plugin_basename ) )
849
- ) {
850
- unset( $file_slug_map[ $plugin_basename ] );
851
- self::$_accounts->set_option( 'file_slug_map', $file_slug_map, true );
852
-
853
- break;
854
- }
855
- }
856
- }
857
-
858
- /**
859
- * @author Vova Feldman (@svovaf)
860
- * @since 1.2.2.7
861
- *
862
- * @param string $plugin_prev_version
863
- * @param string $plugin_version
864
- */
865
- function _after_version_update( $plugin_prev_version, $plugin_version ) {
866
- if ( $this->is_theme() ) {
867
- // Expire the cache of the previous tabs since the theme may
868
- // have setting updates.
869
- $this->_cache->expire( 'tabs' );
870
- $this->_cache->expire( 'tabs_stylesheets' );
871
- }
872
- }
873
-
874
- /**
875
- * A special migration logic for the $_accounts, executed for all the plugins in the system:
876
- * - Moves some data to the network level storage.
877
- * - If the plugin's connection was skipped for all sites, set the plugin as if it was network skipped.
878
- * - If the plugin's connection was ignored for all sites, don't do anything in terms of the network connection.
879
- * - If the plugin was connected to all sites by the same super-admin, set the plugin as if was network opted-in for all sites.
880
- * - If there's at least one site that was connected by a super-admin, find the "main super-admin" (the one that installed the majority of the plugin installs) and set the plugin as if was network activated with the main super-admin, set all the sites that were skipped or opted-in with a different user to delegated mode. Then, prompt the currently logged super-admin to choose what to do with the ignored sites.
881
- * - If there are any sites in the network which the connection decision was not yet taken for, set this plugin into network activation mode so a super-admin can choose what to do with the rest of the sites.
882
- *
883
- * @author Vova Feldman (@svovaf)
884
- * @since 2.0.0
885
- */
886
- private static function migrate_accounts_to_network() {
887
- $sites = self::get_sites();
888
- $sites_count = count( $sites );
889
- $connection_status = array();
890
- $plugin_slugs = array();
891
- foreach ( $sites as $site ) {
892
- $blog_id = self::get_site_blog_id( $site );
893
-
894
- self::$_accounts->migrate_to_network( $blog_id );
895
-
896
- /**
897
- * Build a list of all Freemius powered plugins slugs.
898
- */
899
- $id_slug_type_path_map = self::$_accounts->get_option( 'id_slug_type_path_map', array(), $blog_id );
900
- foreach ( $id_slug_type_path_map as $module_id => $data ) {
901
- if ( WP_FS__MODULE_TYPE_PLUGIN === $data['type'] ) {
902
- $plugin_slugs[ $data['slug'] ] = true;
903
- }
904
- }
905
-
906
- $installs = self::get_account_option( 'sites', WP_FS__MODULE_TYPE_PLUGIN, $blog_id );
907
-
908
- if ( is_array( $installs ) ) {
909
- foreach ( $installs as $slug => $install ) {
910
- if ( ! isset( $connection_status[ $slug ] ) ) {
911
- $connection_status[ $slug ] = array();
912
- }
913
-
914
- if ( is_object( $install ) &&
915
- FS_Site::is_valid_id( $install->id ) &&
916
- FS_User::is_valid_id( $install->user_id )
917
- ) {
918
- $connection_status[ $slug ][ $blog_id ] = $install->user_id;
919
- }
920
- }
921
- }
922
- }
923
-
924
- foreach ( $plugin_slugs as $slug => $true ) {
925
- if ( ! isset( $connection_status[ $slug ] ) ) {
926
- $connection_status[ $slug ] = array();
927
- }
928
-
929
- foreach ( $sites as $site ) {
930
- $blog_id = self::get_site_blog_id( $site );
931
-
932
- if ( isset( $connection_status[ $slug ][ $blog_id ] ) ) {
933
- continue;
934
- }
935
-
936
- $storage = FS_Storage::instance( WP_FS__MODULE_TYPE_PLUGIN, $slug );
937
-
938
- $is_anonymous = $storage->get( 'is_anonymous', null, $blog_id );
939
-
940
- if ( ! is_null( $is_anonymous ) ) {
941
- // Since 1.1.3 is_anonymous is an array.
942
- if ( is_array( $is_anonymous ) && isset( $is_anonymous['is'] ) ) {
943
- $is_anonymous = $is_anonymous['is'];
944
- }
945
-
946
- if ( is_bool( $is_anonymous ) && true === $is_anonymous ) {
947
- $connection_status[ $slug ][ $blog_id ] = 'skipped';
948
- }
949
- }
950
-
951
- if ( ! isset( $connection_status[ $slug ][ $blog_id ] ) ) {
952
- $connection_status[ $slug ][ $blog_id ] = 'ignored';
953
- }
954
- }
955
- }
956
-
957
- $super_admins = array();
958
-
959
- foreach ( $connection_status as $slug => $blogs_status ) {
960
- $skips = 0;
961
- $ignores = 0;
962
- $connections = 0;
963
- $opted_in_users = array();
964
- $opted_in_super_admins = array();
965
-
966
- $storage = FS_Storage::instance( WP_FS__MODULE_TYPE_PLUGIN, $slug );
967
-
968
- foreach ( $blogs_status as $blog_id => $status_or_user_id ) {
969
- if ( 'skipped' === $status_or_user_id ) {
970
- $skips ++;
971
- } else if ( 'ignored' === $status_or_user_id ) {
972
- $ignores ++;
973
- } else if ( FS_User::is_valid_id( $status_or_user_id ) ) {
974
- $connections ++;
975
-
976
- if ( ! isset( $opted_in_users[ $status_or_user_id ] ) ) {
977
- $opted_in_users[ $status_or_user_id ] = array();
978
- }
979
-
980
- $opted_in_users[ $status_or_user_id ][] = $blog_id;
981
-
982
- if ( isset( $super_admins[ $status_or_user_id ] ) ||
983
- self::is_super_admin( $status_or_user_id )
984
- ) {
985
- // Cache super-admin data.
986
- $super_admins[ $status_or_user_id ] = true;
987
-
988
- // Remember opted-in super-admins for the plugin.
989
- $opted_in_super_admins[ $status_or_user_id ] = true;
990
- }
991
- }
992
- }
993
-
994
- $main_super_admin_user_id = null;
995
- $all_migrated = false;
996
- if ( $sites_count == $skips ) {
997
- // All sites were skipped -> network skip by copying the anonymous mode from any of the sites.
998
- $storage->is_anonymous_ms = $storage->is_anonymous;
999
-
1000
- $all_migrated = true;
1001
- } else if ( $sites_count == $ignores ) {
1002
- // Don't do anything, still in activation mode.
1003
-
1004
- $all_migrated = true;
1005
- } else if ( 0 < count( $opted_in_super_admins ) ) {
1006
- // Find the super-admin with the majority of installs.
1007
- $max_installs_by_super_admin = 0;
1008
- foreach ( $opted_in_super_admins as $user_id => $true ) {
1009
- $installs_count = count( $opted_in_users[ $user_id ] );
1010
-
1011
- if ( $installs_count > $max_installs_by_super_admin ) {
1012
- $max_installs_by_super_admin = $installs_count;
1013
- $main_super_admin_user_id = $user_id;
1014
- }
1015
- }
1016
-
1017
- if ( $sites_count == $connections && 1 == count( $opted_in_super_admins ) ) {
1018
- // Super-admin opted-in for all sites in the network.
1019
- $storage->is_network_connected = true;
1020
-
1021
- $all_migrated = true;
1022
- }
1023
-
1024
- // Store network user.
1025
- $storage->network_user_id = $main_super_admin_user_id;
1026
-
1027
- $storage->network_install_blog_id = ( $sites_count == $connections ) ?
1028
- // Since all sites are opted-in, associating with the main site.
1029
- get_current_blog_id() :
1030
- // Associating with the 1st found opted-in site.
1031
- $opted_in_users[ $main_super_admin_user_id ][0];
1032
-
1033
- /**
1034
- * Make sure we migrate the plan ID of the network install, otherwise, if after the migration
1035
- * the 1st page that will be loaded is the network level WP Admin and $storage->network_install_blog_id
1036
- * is different than the main site of the network, the $this->_site will not be set since the plan_id
1037
- * will be empty.
1038
- */
1039
- $storage->migrate_to_network();
1040
- self::migrate_install_plan_to_plan_id( $storage, $storage->network_install_blog_id );
1041
- } else {
1042
- // At least one opt-in. All the opt-in were created by a non-super-admin.
1043
- if ( 0 == $ignores ) {
1044
- // All sites were opted-in or skipped, all by non-super-admin. So delegate all.
1045
- $storage->store( 'is_delegated_connection', true, true );
1046
-
1047
- $all_migrated = true;
1048
- }
1049
- }
1050
-
1051
- if ( ! $all_migrated ) {
1052
- /**
1053
- * Delegate all sites that were:
1054
- * 1) Opted-in by a user that is NOT the main-super-admin.
1055
- * 2) Skipped and non of the sites was opted-in by a super-admin. If any site was opted-in by a super-admin, there will be a main-super-admin, and we consider the skip as if it was done by that user.
1056
- */
1057
- foreach ( $blogs_status as $blog_id => $status_or_user_id ) {
1058
- if ( $status_or_user_id == $main_super_admin_user_id ) {
1059
- continue;
1060
- }
1061
-
1062
- if ( FS_User::is_valid_id( $status_or_user_id ) ||
1063
- ( 'skipped' === $status_or_user_id && is_null( $main_super_admin_user_id ) )
1064
- ) {
1065
- $storage->store( 'is_delegated_connection', true, $blog_id );
1066
- }
1067
- }
1068
- }
1069
-
1070
-
1071
- if ( ( $connections + $skips > 0 ) ) {
1072
- if ( $ignores > 0 ) {
1073
- /**
1074
- * If admin already opted-in or skipped in any of the network sites, and also
1075
- * have sites which the connection decision was not yet taken, set this plugin
1076
- * into network activation mode so the super-admin can choose what to do with
1077
- * the rest of the sites.
1078
- */
1079
- self::set_network_upgrade_mode( $storage );
1080
- }
1081
- }
1082
- }
1083
- }
1084
-
1085
- /**
1086
- * Set a module into network upgrade mode.
1087
- *
1088
- * @author Vova Feldman (@svovaf)
1089
- * @since 2.0.0
1090
- *
1091
- * @param \FS_Storage $storage
1092
- *
1093
- * @return bool
1094
- */
1095
- private static function set_network_upgrade_mode( FS_Storage $storage ) {
1096
- return $storage->is_network_activation = true;
1097
- }
1098
-