From deb261c74ed8e9434f9cf76f03f2dcc43a114674 Mon Sep 17 00:00:00 2001 From: Mutafaf Wahhaj Date: Fri, 15 Feb 2019 22:54:24 +0500 Subject: [PATCH] Plugin source files --- LICENSE | 675 +++ all-in-one-wp-migration.php | 77 + changelog.txt | 320 ++ constants.php | 910 ++++ deprecated.php | 26 + exceptions.php | 44 + functions.php | 1418 ++++++ .../class-ai1wm-backups-controller.php | 80 + .../class-ai1wm-export-controller.php | 147 + .../class-ai1wm-feedback-controller.php | 80 + .../class-ai1wm-import-controller.php | 160 + .../class-ai1wm-main-controller.php | 938 ++++ .../class-ai1wm-report-controller.php | 74 + .../class-ai1wm-status-controller.php | 51 + .../class-ai1wm-updater-controller.php | 82 + lib/model/class-ai1wm-backups.php | 105 + lib/model/class-ai1wm-compatibility.php | 72 + lib/model/class-ai1wm-deprecated.php | 28 + lib/model/class-ai1wm-extensions.php | 233 + lib/model/class-ai1wm-feedback.php | 70 + lib/model/class-ai1wm-handler.php | 56 + lib/model/class-ai1wm-log.php | 84 + lib/model/class-ai1wm-message.php | 59 + lib/model/class-ai1wm-notification.php | 81 + lib/model/class-ai1wm-report.php | 66 + lib/model/class-ai1wm-status.php | 61 + lib/model/class-ai1wm-template.php | 54 + lib/model/class-ai1wm-updater.php | 191 + .../export/class-ai1wm-export-archive.php | 42 + lib/model/export/class-ai1wm-export-clean.php | 32 + .../class-ai1wm-export-compatibility.php | 47 + .../export/class-ai1wm-export-config-file.php | 115 + .../export/class-ai1wm-export-config.php | 108 + .../export/class-ai1wm-export-content.php | 189 + .../class-ai1wm-export-database-file.php | 120 + .../export/class-ai1wm-export-database.php | 179 + .../export/class-ai1wm-export-download.php | 75 + .../export/class-ai1wm-export-enumerate.php | 146 + lib/model/export/class-ai1wm-export-init.php | 51 + lib/model/import/class-ai1wm-import-blogs.php | 128 + lib/model/import/class-ai1wm-import-clean.php | 32 + .../class-ai1wm-import-compatibility.php | 47 + .../import/class-ai1wm-import-confirm.php | 64 + .../import/class-ai1wm-import-content.php | 229 + .../import/class-ai1wm-import-database.php | 833 ++++ lib/model/import/class-ai1wm-import-done.php | 208 + .../import/class-ai1wm-import-enumerate.php | 50 + .../import/class-ai1wm-import-mu-plugins.php | 54 + .../import/class-ai1wm-import-upload.php | 110 + .../import/class-ai1wm-import-validate.php | 172 + lib/vendor/bandar/bandar/LICENSE | 20 + lib/vendor/bandar/bandar/lib/Bandar.php | 229 + .../TemplateDoesNotExistException.php | 50 + lib/vendor/math/BigInteger.php | 3811 +++++++++++++++++ .../archiver/class-ai1wm-archiver.php | 243 ++ .../archiver/class-ai1wm-compressor.php | 215 + .../archiver/class-ai1wm-extractor.php | 575 +++ .../command/class-ai1wm-wp-cli-command.php | 278 ++ lib/vendor/servmask/cron/class-ai1wm-cron.php | 72 + .../database/class-ai1wm-database-mysql.php | 114 + .../database/class-ai1wm-database-mysqli.php | 114 + .../database/class-ai1wm-database-utility.php | 149 + .../database/class-ai1wm-database.php | 1407 ++++++ .../filesystem/class-ai1wm-directory.php | 62 + .../filesystem/class-ai1wm-file-htaccess.php | 61 + .../filesystem/class-ai1wm-file-index.php | 37 + .../filesystem/class-ai1wm-file-webconfig.php | 51 + .../servmask/filesystem/class-ai1wm-file.php | 71 + .../class-ai1wm-recursive-exclude-filter.php | 44 + ...class-ai1wm-recursive-extension-filter.php | 50 + .../class-ai1wm-recursive-newline-filter.php | 32 + ...ass-ai1wm-recursive-directory-iterator.php | 66 + ...lass-ai1wm-recursive-iterator-iterator.php | 28 + lib/view/assets/css/backups.min.css | 1 + lib/view/assets/css/backups.min.rtl.css | 1 + lib/view/assets/css/common.min.css | 1 + lib/view/assets/css/export.min.css | 1 + lib/view/assets/css/export.min.rtl.css | 1 + lib/view/assets/css/import.min.css | 1 + lib/view/assets/css/import.min.rtl.css | 1 + lib/view/assets/css/servmask.min.css | 1 + lib/view/assets/css/servmask.min.rtl.css | 1 + lib/view/assets/css/updater.min.css | 1 + lib/view/assets/css/updater.min.rtl.css | 1 + lib/view/assets/font/servmask.eot | Bin 0 -> 5968 bytes lib/view/assets/font/servmask.svg | 37 + lib/view/assets/font/servmask.ttf | Bin 0 -> 5804 bytes lib/view/assets/font/servmask.woff | Bin 0 -> 5880 bytes lib/view/assets/img/ajax-loader.gif | Bin 0 -> 2608 bytes lib/view/assets/img/logo-128x128.png | Bin 0 -> 5404 bytes lib/view/assets/img/logo-20x20.png | Bin 0 -> 876 bytes lib/view/assets/img/logo-32x32.png | Bin 0 -> 1423 bytes lib/view/assets/img/logo.svg | 28 + lib/view/assets/javascript/backups.min.js | 1185 +++++ lib/view/assets/javascript/export.min.js | 1029 +++++ lib/view/assets/javascript/feedback.min.js | 263 ++ lib/view/assets/javascript/import.min.js | 3510 +++++++++++++++ lib/view/assets/javascript/report.min.js | 235 + lib/view/assets/javascript/updater.min.js | 158 + lib/view/assets/javascript/util.min.js | 215 + lib/view/backups/index.php | 141 + lib/view/common/http-authentication.php | 24 + lib/view/common/leave-feedback.php | 77 + lib/view/common/maintenance-mode.php | 24 + lib/view/common/report-problem.php | 57 + lib/view/common/share-buttons.php | 76 + lib/view/export/advanced-settings.php | 117 + lib/view/export/button-azure-storage.php | 27 + lib/view/export/button-b2.php | 27 + lib/view/export/button-box.php | 27 + lib/view/export/button-digitalocean.php | 27 + lib/view/export/button-dropbox.php | 27 + lib/view/export/button-file.php | 27 + lib/view/export/button-ftp.php | 27 + lib/view/export/button-gcloud-storage.php | 27 + lib/view/export/button-gdrive.php | 27 + lib/view/export/button-glacier.php | 27 + lib/view/export/button-mega.php | 27 + lib/view/export/button-onedrive.php | 27 + lib/view/export/button-s3.php | 27 + lib/view/export/export-buttons.php | 47 + lib/view/export/find-replace.php | 49 + lib/view/export/help-section.php | 49 + lib/view/export/index.php | 72 + lib/view/import/button-azure-storage.php | 27 + lib/view/import/button-b2.php | 27 + lib/view/import/button-box.php | 27 + lib/view/import/button-digitalocean.php | 27 + lib/view/import/button-dropbox.php | 27 + lib/view/import/button-file.php | 30 + lib/view/import/button-ftp.php | 27 + lib/view/import/button-gcloud-storage.php | 27 + lib/view/import/button-gdrive.php | 27 + lib/view/import/button-glacier.php | 27 + lib/view/import/button-mega.php | 27 + lib/view/import/button-onedrive.php | 27 + lib/view/import/button-s3.php | 27 + lib/view/import/button-url.php | 27 + lib/view/import/import-buttons.php | 87 + lib/view/import/index.php | 70 + lib/view/main/admin-head.php | 119 + lib/view/main/backups-htaccess-notice.php | 41 + lib/view/main/backups-index-notice.php | 41 + lib/view/main/backups-path-notice.php | 41 + lib/view/main/backups-webconfig-notice.php | 41 + lib/view/main/get-support.php | 27 + lib/view/main/multisite-notice.php | 41 + lib/view/main/storage-index-notice.php | 41 + lib/view/main/storage-path-notice.php | 41 + lib/view/main/wordpress-htaccess-notice.php | 41 + lib/view/updater/check.php | 27 + lib/view/updater/modal.php | 53 + loader.php | 368 ++ readme.txt | 472 ++ storage/index.php | 1 + uninstall.php | 42 + 156 files changed, 26782 insertions(+) create mode 100644 LICENSE create mode 100644 all-in-one-wp-migration.php create mode 100644 changelog.txt create mode 100644 constants.php create mode 100644 deprecated.php create mode 100644 exceptions.php create mode 100644 functions.php create mode 100644 lib/controller/class-ai1wm-backups-controller.php create mode 100644 lib/controller/class-ai1wm-export-controller.php create mode 100644 lib/controller/class-ai1wm-feedback-controller.php create mode 100644 lib/controller/class-ai1wm-import-controller.php create mode 100644 lib/controller/class-ai1wm-main-controller.php create mode 100644 lib/controller/class-ai1wm-report-controller.php create mode 100644 lib/controller/class-ai1wm-status-controller.php create mode 100644 lib/controller/class-ai1wm-updater-controller.php create mode 100644 lib/model/class-ai1wm-backups.php create mode 100644 lib/model/class-ai1wm-compatibility.php create mode 100644 lib/model/class-ai1wm-deprecated.php create mode 100644 lib/model/class-ai1wm-extensions.php create mode 100644 lib/model/class-ai1wm-feedback.php create mode 100644 lib/model/class-ai1wm-handler.php create mode 100644 lib/model/class-ai1wm-log.php create mode 100644 lib/model/class-ai1wm-message.php create mode 100644 lib/model/class-ai1wm-notification.php create mode 100644 lib/model/class-ai1wm-report.php create mode 100644 lib/model/class-ai1wm-status.php create mode 100644 lib/model/class-ai1wm-template.php create mode 100644 lib/model/class-ai1wm-updater.php create mode 100644 lib/model/export/class-ai1wm-export-archive.php create mode 100644 lib/model/export/class-ai1wm-export-clean.php create mode 100644 lib/model/export/class-ai1wm-export-compatibility.php create mode 100644 lib/model/export/class-ai1wm-export-config-file.php create mode 100644 lib/model/export/class-ai1wm-export-config.php create mode 100644 lib/model/export/class-ai1wm-export-content.php create mode 100644 lib/model/export/class-ai1wm-export-database-file.php create mode 100644 lib/model/export/class-ai1wm-export-database.php create mode 100644 lib/model/export/class-ai1wm-export-download.php create mode 100644 lib/model/export/class-ai1wm-export-enumerate.php create mode 100644 lib/model/export/class-ai1wm-export-init.php create mode 100644 lib/model/import/class-ai1wm-import-blogs.php create mode 100644 lib/model/import/class-ai1wm-import-clean.php create mode 100644 lib/model/import/class-ai1wm-import-compatibility.php create mode 100644 lib/model/import/class-ai1wm-import-confirm.php create mode 100644 lib/model/import/class-ai1wm-import-content.php create mode 100644 lib/model/import/class-ai1wm-import-database.php create mode 100644 lib/model/import/class-ai1wm-import-done.php create mode 100644 lib/model/import/class-ai1wm-import-enumerate.php create mode 100644 lib/model/import/class-ai1wm-import-mu-plugins.php create mode 100644 lib/model/import/class-ai1wm-import-upload.php create mode 100644 lib/model/import/class-ai1wm-import-validate.php create mode 100644 lib/vendor/bandar/bandar/LICENSE create mode 100644 lib/vendor/bandar/bandar/lib/Bandar.php create mode 100644 lib/vendor/bandar/bandar/lib/Exceptions/TemplateDoesNotExistException.php create mode 100644 lib/vendor/math/BigInteger.php create mode 100644 lib/vendor/servmask/archiver/class-ai1wm-archiver.php create mode 100644 lib/vendor/servmask/archiver/class-ai1wm-compressor.php create mode 100644 lib/vendor/servmask/archiver/class-ai1wm-extractor.php create mode 100644 lib/vendor/servmask/command/class-ai1wm-wp-cli-command.php create mode 100644 lib/vendor/servmask/cron/class-ai1wm-cron.php create mode 100644 lib/vendor/servmask/database/class-ai1wm-database-mysql.php create mode 100644 lib/vendor/servmask/database/class-ai1wm-database-mysqli.php create mode 100644 lib/vendor/servmask/database/class-ai1wm-database-utility.php create mode 100644 lib/vendor/servmask/database/class-ai1wm-database.php create mode 100644 lib/vendor/servmask/filesystem/class-ai1wm-directory.php create mode 100644 lib/vendor/servmask/filesystem/class-ai1wm-file-htaccess.php create mode 100644 lib/vendor/servmask/filesystem/class-ai1wm-file-index.php create mode 100644 lib/vendor/servmask/filesystem/class-ai1wm-file-webconfig.php create mode 100644 lib/vendor/servmask/filesystem/class-ai1wm-file.php create mode 100644 lib/vendor/servmask/filter/class-ai1wm-recursive-exclude-filter.php create mode 100644 lib/vendor/servmask/filter/class-ai1wm-recursive-extension-filter.php create mode 100644 lib/vendor/servmask/filter/class-ai1wm-recursive-newline-filter.php create mode 100644 lib/vendor/servmask/iterator/class-ai1wm-recursive-directory-iterator.php create mode 100644 lib/vendor/servmask/iterator/class-ai1wm-recursive-iterator-iterator.php create mode 100644 lib/view/assets/css/backups.min.css create mode 100644 lib/view/assets/css/backups.min.rtl.css create mode 100644 lib/view/assets/css/common.min.css create mode 100644 lib/view/assets/css/export.min.css create mode 100644 lib/view/assets/css/export.min.rtl.css create mode 100644 lib/view/assets/css/import.min.css create mode 100644 lib/view/assets/css/import.min.rtl.css create mode 100644 lib/view/assets/css/servmask.min.css create mode 100644 lib/view/assets/css/servmask.min.rtl.css create mode 100644 lib/view/assets/css/updater.min.css create mode 100644 lib/view/assets/css/updater.min.rtl.css create mode 100644 lib/view/assets/font/servmask.eot create mode 100644 lib/view/assets/font/servmask.svg create mode 100644 lib/view/assets/font/servmask.ttf create mode 100644 lib/view/assets/font/servmask.woff create mode 100644 lib/view/assets/img/ajax-loader.gif create mode 100644 lib/view/assets/img/logo-128x128.png create mode 100644 lib/view/assets/img/logo-20x20.png create mode 100644 lib/view/assets/img/logo-32x32.png create mode 100644 lib/view/assets/img/logo.svg create mode 100644 lib/view/assets/javascript/backups.min.js create mode 100644 lib/view/assets/javascript/export.min.js create mode 100644 lib/view/assets/javascript/feedback.min.js create mode 100644 lib/view/assets/javascript/import.min.js create mode 100644 lib/view/assets/javascript/report.min.js create mode 100644 lib/view/assets/javascript/updater.min.js create mode 100644 lib/view/assets/javascript/util.min.js create mode 100644 lib/view/backups/index.php create mode 100644 lib/view/common/http-authentication.php create mode 100644 lib/view/common/leave-feedback.php create mode 100644 lib/view/common/maintenance-mode.php create mode 100644 lib/view/common/report-problem.php create mode 100644 lib/view/common/share-buttons.php create mode 100644 lib/view/export/advanced-settings.php create mode 100644 lib/view/export/button-azure-storage.php create mode 100644 lib/view/export/button-b2.php create mode 100644 lib/view/export/button-box.php create mode 100644 lib/view/export/button-digitalocean.php create mode 100644 lib/view/export/button-dropbox.php create mode 100644 lib/view/export/button-file.php create mode 100644 lib/view/export/button-ftp.php create mode 100644 lib/view/export/button-gcloud-storage.php create mode 100644 lib/view/export/button-gdrive.php create mode 100644 lib/view/export/button-glacier.php create mode 100644 lib/view/export/button-mega.php create mode 100644 lib/view/export/button-onedrive.php create mode 100644 lib/view/export/button-s3.php create mode 100644 lib/view/export/export-buttons.php create mode 100644 lib/view/export/find-replace.php create mode 100644 lib/view/export/help-section.php create mode 100644 lib/view/export/index.php create mode 100644 lib/view/import/button-azure-storage.php create mode 100644 lib/view/import/button-b2.php create mode 100644 lib/view/import/button-box.php create mode 100644 lib/view/import/button-digitalocean.php create mode 100644 lib/view/import/button-dropbox.php create mode 100644 lib/view/import/button-file.php create mode 100644 lib/view/import/button-ftp.php create mode 100644 lib/view/import/button-gcloud-storage.php create mode 100644 lib/view/import/button-gdrive.php create mode 100644 lib/view/import/button-glacier.php create mode 100644 lib/view/import/button-mega.php create mode 100644 lib/view/import/button-onedrive.php create mode 100644 lib/view/import/button-s3.php create mode 100644 lib/view/import/button-url.php create mode 100644 lib/view/import/import-buttons.php create mode 100644 lib/view/import/index.php create mode 100644 lib/view/main/admin-head.php create mode 100644 lib/view/main/backups-htaccess-notice.php create mode 100644 lib/view/main/backups-index-notice.php create mode 100644 lib/view/main/backups-path-notice.php create mode 100644 lib/view/main/backups-webconfig-notice.php create mode 100644 lib/view/main/get-support.php create mode 100644 lib/view/main/multisite-notice.php create mode 100644 lib/view/main/storage-index-notice.php create mode 100644 lib/view/main/storage-path-notice.php create mode 100644 lib/view/main/wordpress-htaccess-notice.php create mode 100644 lib/view/updater/check.php create mode 100644 lib/view/updater/modal.php create mode 100644 loader.php create mode 100644 readme.txt create mode 100644 storage/index.php create mode 100644 uninstall.php diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..dcbe5e6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,675 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + + Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. \ No newline at end of file diff --git a/all-in-one-wp-migration.php b/all-in-one-wp-migration.php new file mode 100644 index 0000000..36a56e2 --- /dev/null +++ b/all-in-one-wp-migration.php @@ -0,0 +1,77 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +// Check SSL Mode +if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && ( $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ) ) { + $_SERVER['HTTPS'] = 'on'; +} + +// Plugin Basename +define( 'AI1WM_PLUGIN_BASENAME', basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ) ); + +// Plugin Path +define( 'AI1WM_PATH', dirname( __FILE__ ) ); + +// Plugin Url +define( 'AI1WM_URL', plugins_url( '', AI1WM_PLUGIN_BASENAME ) ); + +// Plugin Storage Url +define( 'AI1WM_STORAGE_URL', plugins_url( 'storage', AI1WM_PLUGIN_BASENAME ) ); + +// Plugin Backups Url +define( 'AI1WM_BACKUPS_URL', content_url( 'ai1wm-backups', AI1WM_PLUGIN_BASENAME ) ); + +// Themes Absolute Path +define( 'AI1WM_THEMES_PATH', get_theme_root() ); + +// Include constants +require_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'constants.php'; + +// Include deprecated +require_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'deprecated.php'; + +// Include functions +require_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'functions.php'; + +// Include exceptions +require_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'exceptions.php'; + +// Include loader +require_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'loader.php'; + +// ========================================================================= +// = All app initialization is done in Ai1wm_Main_Controller __constructor = +// ========================================================================= +$main_controller = new Ai1wm_Main_Controller(); diff --git a/changelog.txt b/changelog.txt new file mode 100644 index 0000000..f530726 --- /dev/null +++ b/changelog.txt @@ -0,0 +1,320 @@ += 5.56 = +* Fix an issue with WP_Hook class introcuded in WP 4.7 + += 5.55 = +* Fix an issue with resolving URL on export/import when using non-blocking streams client + += 5.54 = +* Fix an issue with resolving URL on export/import + += 5.53 = +* Send HTTP basic authorization header on upload (fetch method) +* Add Accept-Encoding, Accept-Charset and Accept-Language on export/import +* Do not replace already replaced values on database import/export +* Set silent mode when activating sidewide plugins +* Replace old media style URLs with the new media style URLs on database import +* Replace user_level and capabilities user meta keys if tables have empty prefix on export +* Create separate action for extracting must-use plugins +* Add option "Do not export must-use plugins" in advanced settings +* Fix an issue with SSL that produces "Unable to resolve URL..." + += 5.52 = +* Simplify the text on import page +* Fix an issue with special characters on export and import +* Fix an issue with export and import of large files + += 5.51 = +* Add support for utf8mb4_unicode_520_ci database collation + += 5.50 = +* Improve database export process +* Simplify export and import cron +* Fix an issue with export and import progress status + += 5.49 = +* Test plugin up to WordPress 4.6 + += 5.48 = +* Improve support for large databases on export +* Add support for Box cloud storage +* Fix an issue with status on export/import +* Fix an issue with asynchronous requests on export/import + += 5.47 = +* Fix an issue with incorrect file size on export + += 5.46 = +* Add "Restore from Backups" video in readme file +* Display message if backups are inaccessible + += 5.45 = +* Fix an issue with blogs.dir path replacement + += 5.44 = +* Add "Do not replace email domain" option in advanced settings +* Add "ai1wm_exclude_content_from_export" WordPress hook on export +* Add HTML5 uploader + += 5.43 = +* Fix an issue when archiving dynamic files on export +* Support custom upload path for multisites +* Add support for various cache plugins + += 5.42 = +* Catch E_PARSE error on mu-plugins import +* Fix an issue with stop export that doesn't clean up the storage directory +* Initialize new cache instead of flushing the existing one on import/export + += 5.41 = +* Fix an issue when replacing serialized values on import +* List files in chunks +* Convert svg images to png +* Check if backups are readable before displaying them on "Backups" page +* Display version incompatibility notification on export/import/restore screen +* Fix double port issue on Bitnami +* Fix an issue on multisite export with cloud extensions + += 5.40 = +* Test plugin up to WordPress 4.5 + += 5.39 = +* Fix a bug in uploads path replacement + += 5.38 = +* Deactivate mu-plugins if fatal error appears on import + += 5.37 = +* Validate the archive before import + += 5.36 = +* Add OneDrive to readme.txt +* Fix a typo on import + += 5.35 = +* Add OneDrive to export/import pages +* Fix a bug when WordPress was used without a db prefix +* Fix a problem when downloading wpress files +* Improve the log system + += 4.19 = +* Fixed an issue with options cache + += 4.18 = +* Fixed an issue with large media files +* Fixed an issue with status file being cached + += 4.17 = +* Set "Tested up to" WordPress 4.4 + += 4.16 = +* Fix an issue with the transport layer on export/import + += 4.15 = +* Fix an issue with resovling mechanism on export/import + += 4.14 = +* Fix an issue with database import + += 4.13 = +* Add new mechanism for resolving HTTP requests + += 4.12 = +* Fix an issue with Google Drive extension + += 4.11 = +* Fix content filters on export + += 4.10 = +* Add HTTPS URL replacement +* Fix an issue when PDO is not available + += 4.6 = +* Fix an issue when the plugin was getting stuck on "Done creating an empty archive" +* Fix an issue when the plugin was getting stuck during import + += 4.3 = +* Add URL extension support +* Filter "mu-plugins" directory if "Do not export plugins (files)" is checked +* Fix utf8mb4 issue +* Fix translation issue + += 4.2 = +* Fix .wpress.bin format + += 4.1 = +* Add port to the host header on export/import +* Rename .wpress file to .wpress.bin file + += 4.0 = +* Fix file permission checks + += 3.9 = +* Fix could not resolve domain name on export/import + += 3.8 = +* Fix undefined method on Backups page if PHP version is < 5.3.6 + += 3.7 = +* Add IPv6 support on export/import + += 3.6 = +* Fixed undefined constant warnings + += 3.5 = +* Exclude core plugin and extensions on export if they have custom names + += 3.4 = +* Made export/import processes more reliable +* Allow the plugin to work with non-default name +* Preserve backups during plugin updates +* Improved find & replace functionality on the serialized data +* Removed backup file name restrictions + += 3.3 = +* Fixed a bug when retrieving export/import status progress +* Fixed a bug when database encoding utf8mb4_unicode_ci is not available + += 3.2.2 = +* Fixed plugin incompatibility during export/import that was reporting that the process could not be started + += 3.2.1 = +* Added username/password settings for WordPress sites behind HTTP basic authentication +* Fixed a bug when exporting/importing without public DNS record +* Fixed a bug when exporting/importing media files + += 3.2.0 = +* Added advanced settings on export page + += 3.1.1 = +* Fixed secret key issue on upgrade of the plugin + += 3.0.0 = +* Added export to File, [Dropbox](https://servmask.com/products/dropbox-extension), [Amazon S3](https://servmask.com/products/amazon-s3-extension), [Google Drive](https://servmask.com/products/google-drive-extension) +* Added import from File, [Dropbox](https://servmask.com/products/dropbox-extension), [Amazon S3](https://servmask.com/products/amazon-s3-extension), [Google Drive](https://servmask.com/products/google-drive-extension) +* Implemented our own archiving format that reduces export and import by a factor of 10 +* One-click export with the new simplified export page +* Improved upload functionality with auto-recognizing chunk size on import +* New **Backups** page for storing all WordPress site exports +* Easy restore WordPress site from **Backups** page +* Monitoring availability of the disk space on the server +* Both export and import happen in time chunks of 3 seconds +* Plugin works behind HTTP basic authentication + += 2.0.4 = +* Updated readme to reflect that the plugin is not multisite compatible + += 2.0.3 = +* Fixed a security issue while importing site using regular users + += 2.0.2 = +* Added support for WordPress v4.0 + += 2.0.1 = +* Fixed a bug when all user permissions are lost on import + += 2.0.0 = +* Added support for migration of WordPress in Network Mode (Multi Site) +* New improved UI and UX +* New improved language translations on the menu items and help texts +* Better error handling and notifications +* Fixed a bug while exporting comments and associated comments meta data +* Fixed a bug while using find/replace functionality +* Fixed a bug with storage directory permissions and search indexation + += 1.9.2 = +* Added PHP <= v5.2.7 compatibility + += 1.9.1 = +* Fixed an issue with earlier versions of PHP + += 1.9.0 = +* New improved design on the export/import page +* Added an option for gathering user experience statistics +* Added a message box with important notifications about the plugin +* Fixed a bug while exporting database with multiple WordPress sites +* Fixed a bug while exporting database with table constraints +* Fixed a bug with auto recognizing zip archiver + += 1.8.1 = +* Added "Get Support" link in the plugin list page +* Removed "All in One WP Migration Beta" link from the readme file + += 1.8.0 = +* Added support for dynamically recognizing Site URL and Home URL on the import page +* Fixed a bug when maximum uploaded size is exceeded +* Fixed a bug while exporting big database tables + += 1.7.2 = +* Added support for automatically switching database adapters for better performance and optimization +* Fixed a bug while using host:port syntax with MySQL PDO +* Fixed a bug while using find/replace functionality + += 1.7.1 = +* Fixed a bug while exporting WordPress plugins directory + += 1.7.0 = +* Added storage layer to avoid permission issues with OS's directory used for temporary storage +* Added additional checks to verify the consistency of the imported archive +* Fixed a bug that caused the database to be exported without data +* Removed unused variables from package.json file + += 1.6.0 = +* Added additional check for directory's permissions +* Added additional check for output buffering when exporting a file +* Fixed a bug when the archive was exported or imported with old version of Zlib library +* Fixed a bug with permalinks and flushing the rules + += 1.5.0 = +* Added support for additional errors and exceptions handling +* Added support for reporting a problem in better and easier way +* Improved support process in ZenDesk system for faster response time +* Fixed typos on the import page. Thanks to Terry Heenan + += 1.4.0 = +* Added a Twitter and Facebook share buttons to the sidebar on import and export pages + += 1.3.1 = +* Fixed a bug when the user was unable to import site archive +* Optimized and speeded up import process + += 1.3.0 = +* Added support for mysql connection to happen over sockets or TCP +* Added support for Windows OS and fully tested the plugin on IIS +* Added support for limited memory_limit - 1MB - The plugin now requires only 1MB to operate properly +* Added support for multisite +* Used mysql_unbuffered_query instead of mysql_query to overcome any memory problems +* Fixed a deprecated warning for mysql_pconnect when php 5.5 and above is used +* Fixed memory_limit problem with PCLZIP library +* Fixed a bug when the archive is exported with zero size when using PCLZIP +* Fixed a bug when the archive was exported broken on some servers +* Fixed a deprecated usage of preg_replace \e in php v5.5 and above + += 1.2.1 = +* Fixed an issue when HTTP Error was shown on some hosts after import, credit to Michael Simon +* Fixed an issue when exporting databases with different prefix than wp_, credit to najtrox +* Fixed an issue when PDO is avalable but mysql driver for PDO is not, credit to Jaydesain69 +* Deleted a plugin specific option when uninstalling the plugin (clean after itself) +* Support is done via Zendesk +* Included WP Version and Plugin version in the feedback form + += 1.2.0 = +* Increased upload limit of files from 128MB to 512MB +* Used ZipArchive with fallback to PclZip (a few users notified us that they don't have ZipArchive enabled on their servers) +* Used PDO with fallback to mysql (a few users notified us that they dont have PDO enabled on their servers, mysql is deprecated as of PHP v5.5 but we are supporting PHP v5.2.17) +* Supported PHP v5.2.17 and WordPress v3.3 and above +* Fixed a bug during export that causes plugins to not be exported on some hosts (the problem that you are experiencing) + += 1.1.0 = +* Importing files using chunks to overcome any webserver upload size restriction +* Fixed a bug where HTTP code error was shown to some users + += 1.0.0 = +* Export database as SQL file +* Export media files +* Export themes files +* Export installed plugins +* Unlimited find/replace actions +* Option to exclude spam comments +* Option to apply find/replace to GUIDs +* Option to exclude post revisions +* Option to exclude tables data diff --git a/constants.php b/constants.php new file mode 100644 index 0000000..4c3381a --- /dev/null +++ b/constants.php @@ -0,0 +1,910 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +// ================ +// = Plugin Debug = +// ================ +define( 'AI1WM_DEBUG', false ); + +// ================== +// = Plugin Version = +// ================== +define( 'AI1WM_VERSION', '6.76' ); + +// =============== +// = Plugin Name = +// =============== +define( 'AI1WM_PLUGIN_NAME', 'all-in-one-wp-migration' ); + +// ============================ +// = Directory index.php File = +// ============================ +define( 'AI1WM_DIRECTORY_INDEX', 'index.php' ); + +// ================ +// = Storage Path = +// ================ +define( 'AI1WM_STORAGE_PATH', AI1WM_PATH . DIRECTORY_SEPARATOR . 'storage' ); + +// ================== +// = Error Log Path = +// ================== +define( 'AI1WM_ERROR_FILE', AI1WM_STORAGE_PATH . DIRECTORY_SEPARATOR . 'error.log' ); + +// =============== +// = Status Path = +// =============== +define( 'AI1WM_STATUS_FILE', AI1WM_STORAGE_PATH . DIRECTORY_SEPARATOR . 'status.js' ); + +// ============ +// = Lib Path = +// ============ +define( 'AI1WM_LIB_PATH', AI1WM_PATH . DIRECTORY_SEPARATOR . 'lib' ); + +// =================== +// = Controller Path = +// =================== +define( 'AI1WM_CONTROLLER_PATH', AI1WM_LIB_PATH . DIRECTORY_SEPARATOR . 'controller' ); + +// ============== +// = Model Path = +// ============== +define( 'AI1WM_MODEL_PATH', AI1WM_LIB_PATH . DIRECTORY_SEPARATOR . 'model' ); + +// =============== +// = Export Path = +// =============== +define( 'AI1WM_EXPORT_PATH', AI1WM_MODEL_PATH . DIRECTORY_SEPARATOR . 'export' ); + +// =============== +// = Import Path = +// =============== +define( 'AI1WM_IMPORT_PATH', AI1WM_MODEL_PATH . DIRECTORY_SEPARATOR . 'import' ); + +// ============= +// = View Path = +// ============= +define( 'AI1WM_TEMPLATES_PATH', AI1WM_LIB_PATH . DIRECTORY_SEPARATOR . 'view' ); + +// =================== +// = Set Bandar Path = +// =================== +define( 'BANDAR_TEMPLATES_PATH', AI1WM_TEMPLATES_PATH ); + +// =============== +// = Vendor Path = +// =============== +define( 'AI1WM_VENDOR_PATH', AI1WM_LIB_PATH . DIRECTORY_SEPARATOR . 'vendor' ); + +// ========================= +// = ServMask Feedback Url = +// ========================= +define( 'AI1WM_FEEDBACK_URL', 'https://servmask.com/ai1wm/feedback/create' ); + +// ======================= +// = ServMask Report Url = +// ======================= +define( 'AI1WM_REPORT_URL', 'https://servmask.com/ai1wm/report/create' ); + +// ============================== +// = ServMask Archive Tools Url = +// ============================== +define( 'AI1WM_ARCHIVE_TOOLS_URL', 'https://servmask.com/archive/tools' ); + +// ========================= +// = ServMask Table Prefix = +// ========================= +define( 'AI1WM_TABLE_PREFIX', 'SERVMASK_PREFIX_' ); + +// ======================== +// = Archive Backups Name = +// ======================== +define( 'AI1WM_BACKUPS_NAME', 'ai1wm-backups' ); + +// ========================= +// = Archive Database Name = +// ========================= +define( 'AI1WM_DATABASE_NAME', 'database.sql' ); + +// ======================== +// = Archive Package Name = +// ======================== +define( 'AI1WM_PACKAGE_NAME', 'package.json' ); + +// ========================== +// = Archive Multisite Name = +// ========================== +define( 'AI1WM_MULTISITE_NAME', 'multisite.json' ); + +// ====================== +// = Archive Blogs Name = +// ====================== +define( 'AI1WM_BLOGS_NAME', 'blogs.json' ); + +// ========================= +// = Archive Settings Name = +// ========================= +define( 'AI1WM_SETTINGS_NAME', 'settings.json' ); + +// ========================== +// = Archive Multipart Name = +// ========================== +define( 'AI1WM_MULTIPART_NAME', 'multipart.list' ); + +// ======================== +// = Archive Filemap Name = +// ======================== +define( 'AI1WM_FILEMAP_NAME', 'filemap.list' ); + +// ================================= +// = Archive Must-Use Plugins Name = +// ================================= +define( 'AI1WM_MUPLUGINS_NAME', 'mu-plugins' ); + +// ============================= +// = Endurance Page Cache Name = +// ============================= +define( 'AI1WM_ENDURANCE_PAGE_CACHE_NAME', 'endurance-page-cache.php' ); + +// =========================== +// = Endurance PHP Edge Name = +// =========================== +define( 'AI1WM_ENDURANCE_PHP_EDGE_NAME', 'endurance-php-edge.php' ); + +// ================================ +// = Endurance Browser Cache Name = +// ================================ +define( 'AI1WM_ENDURANCE_BROWSER_CACHE_NAME', 'endurance-browser-cache.php' ); + +// ========================= +// = GD System Plugin Name = +// ========================= +define( 'AI1WM_GD_SYSTEM_PLUGIN_NAME', 'gd-system-plugin.php' ); + +// =================== +// = Export Log Name = +// =================== +define( 'AI1WM_EXPORT_NAME', 'export.log' ); + +// =================== +// = Import Log Name = +// =================== +define( 'AI1WM_IMPORT_NAME', 'import.log' ); + +// ================== +// = Error Log Name = +// ================== +define( 'AI1WM_ERROR_NAME', 'error.log' ); + +// ============== +// = Secret Key = +// ============== +define( 'AI1WM_SECRET_KEY', 'ai1wm_secret_key' ); + +// ============= +// = Auth User = +// ============= +define( 'AI1WM_AUTH_USER', 'ai1wm_auth_user' ); + +// ================= +// = Auth Password = +// ================= +define( 'AI1WM_AUTH_PASSWORD', 'ai1wm_auth_password' ); + +// ============ +// = Site URL = +// ============ +define( 'AI1WM_SITE_URL', 'siteurl' ); + +// ============ +// = Home URL = +// ============ +define( 'AI1WM_HOME_URL', 'home' ); + +// ================== +// = Active Plugins = +// ================== +define( 'AI1WM_ACTIVE_PLUGINS', 'active_plugins' ); + +// =========================== +// = Active Sitewide Plugins = +// =========================== +define( 'AI1WM_ACTIVE_SITEWIDE_PLUGINS', 'active_sitewide_plugins' ); + +// ========================== +// = Jetpack Active Modules = +// ========================== +define( 'AI1WM_JETPACK_ACTIVE_MODULES', 'jetpack_active_modules' ); + +// ====================== +// = MS Files Rewriting = +// ====================== +define( 'AI1WM_MS_FILES_REWRITING', 'ms_files_rewriting' ); + +// =================== +// = Active Template = +// =================== +define( 'AI1WM_ACTIVE_TEMPLATE', 'template' ); + +// ===================== +// = Active Stylesheet = +// ===================== +define( 'AI1WM_ACTIVE_STYLESHEET', 'stylesheet' ); + +// ============ +// = Cron Key = +// ============ +define( 'AI1WM_CRON', 'cron' ); + +// =============== +// = Updater Key = +// =============== +define( 'AI1WM_UPDATER', 'ai1wm_updater' ); + +// ============== +// = Status Key = +// ============== +define( 'AI1WM_STATUS', 'ai1wm_status' ); + +// ================ +// = Messages Key = +// ================ +define( 'AI1WM_MESSAGES', 'ai1wm_messages' ); + +// ================= +// = Support Email = +// ================= +define( 'AI1WM_SUPPORT_EMAIL', 'support@servmask.com' ); + +// ================= +// = Max File Size = +// ================= +define( 'AI1WM_MAX_FILE_SIZE', 2 << 28 ); + +// ================== +// = Max Chunk Size = +// ================== +define( 'AI1WM_MAX_CHUNK_SIZE', 5 * 1024 * 1024 ); + +// ===================== +// = Max Chunk Retries = +// ===================== +define( 'AI1WM_MAX_CHUNK_RETRIES', 10 ); + +// =========================== +// = WP_CONTENT_DIR Constant = +// =========================== +if ( ! defined( 'WP_CONTENT_DIR' ) ) { + define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); +} + +// ================ +// = Uploads Path = +// ================ +define( 'AI1WM_UPLOADS_PATH', 'uploads' ); + +// ============== +// = Blogs Path = +// ============== +define( 'AI1WM_BLOGSDIR_PATH', 'blogs.dir' ); + +// ============== +// = Sites Path = +// ============== +define( 'AI1WM_SITES_PATH', AI1WM_UPLOADS_PATH . DIRECTORY_SEPARATOR . 'sites' ); + +// ================ +// = Backups Path = +// ================ +define( 'AI1WM_BACKUPS_PATH', WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'ai1wm-backups' ); + +// ========================== +// = Storage index.php File = +// ========================== +define( 'AI1WM_STORAGE_INDEX', AI1WM_STORAGE_PATH . DIRECTORY_SEPARATOR . 'index.php' ); + +// ========================== +// = Backups index.php File = +// ========================== +define( 'AI1WM_BACKUPS_INDEX', AI1WM_BACKUPS_PATH . DIRECTORY_SEPARATOR . 'index.php' ); + +// ========================== +// = Backups .htaccess File = +// ========================== +define( 'AI1WM_BACKUPS_HTACCESS', AI1WM_BACKUPS_PATH . DIRECTORY_SEPARATOR . '.htaccess' ); + +// =========================== +// = Backups web.config File = +// =========================== +define( 'AI1WM_BACKUPS_WEBCONFIG', AI1WM_BACKUPS_PATH . DIRECTORY_SEPARATOR . 'web.config' ); + +// ============================ +// = WordPress .htaccess File = +// ============================ +define( 'AI1WM_WORDPRESS_HTACCESS', ABSPATH . DIRECTORY_SEPARATOR . '.htaccess' ); + +// ================================ +// = WP Migration Plugin Base Dir = +// ================================ +if ( defined( 'AI1WM_PLUGIN_BASENAME' ) ) { + define( 'AI1WM_PLUGIN_BASEDIR', dirname( AI1WM_PLUGIN_BASENAME ) ); +} else { + define( 'AI1WM_PLUGIN_BASEDIR', 'all-in-one-wp-migration' ); +} + +// ====================================== +// = Microsoft Azure Extension Base Dir = +// ====================================== +if ( defined( 'AI1WMZE_PLUGIN_BASENAME' ) ) { + define( 'AI1WMZE_PLUGIN_BASEDIR', dirname( AI1WMZE_PLUGIN_BASENAME ) ); +} else { + define( 'AI1WMZE_PLUGIN_BASEDIR', 'all-in-one-wp-migration-azure-storage-extension' ); +} + +// =================================== +// = Microsoft Azure Extension Title = +// =================================== +if ( ! defined( 'AI1WMZE_PLUGIN_TITLE' ) ) { + define( 'AI1WMZE_PLUGIN_TITLE', 'Microsoft Azure Storage Extension' ); +} + +// =================================== +// = Microsoft Azure Extension About = +// =================================== +if ( ! defined( 'AI1WMZE_PLUGIN_ABOUT' ) ) { + define( 'AI1WMZE_PLUGIN_ABOUT', 'https://servmask.com/products/microsoft-azure-storage-extension/about' ); +} + +// ================================= +// = Microsoft Azure Extension Key = +// ================================= +if ( ! defined( 'AI1WMZE_PLUGIN_KEY' ) ) { + define( 'AI1WMZE_PLUGIN_KEY', 'ai1wmze_plugin_key' ); +} + +// =================================== +// = Microsoft Azure Extension Short = +// =================================== +if ( ! defined( 'AI1WMZE_PLUGIN_SHORT' ) ) { + define( 'AI1WMZE_PLUGIN_SHORT', 'azure-storage' ); +} + +// =================================== +// = Backblaze B2 Extension Base Dir = +// =================================== +if ( defined( 'AI1WMAE_PLUGIN_BASENAME' ) ) { + define( 'AI1WMAE_PLUGIN_BASEDIR', dirname( AI1WMAE_PLUGIN_BASENAME ) ); +} else { + define( 'AI1WMAE_PLUGIN_BASEDIR', 'all-in-one-wp-migration-b2-extension' ); +} + +// ================================ +// = Backblaze B2 Extension Title = +// ================================ +if ( ! defined( 'AI1WMAE_PLUGIN_TITLE' ) ) { + define( 'AI1WMAE_PLUGIN_TITLE', 'Backblaze B2 Extension' ); +} + +// ================================ +// = Backblaze B2 Extension About = +// ================================ +if ( ! defined( 'AI1WMAE_PLUGIN_ABOUT' ) ) { + define( 'AI1WMAE_PLUGIN_ABOUT', 'https://servmask.com/products/backblaze-b2-extension/about' ); +} + +// ============================== +// = Backblaze B2 Extension Key = +// ============================== +if ( ! defined( 'AI1WMAE_PLUGIN_KEY' ) ) { + define( 'AI1WMAE_PLUGIN_KEY', 'ai1wmae_plugin_key' ); +} + +// ================================ +// = Backblaze B2 Extension Short = +// ================================ +if ( ! defined( 'AI1WMAE_PLUGIN_SHORT' ) ) { + define( 'AI1WMAE_PLUGIN_SHORT', 'b2' ); +} + +// ========================== +// = Box Extension Base Dir = +// ========================== +if ( defined( 'AI1WMBE_PLUGIN_BASENAME' ) ) { + define( 'AI1WMBE_PLUGIN_BASEDIR', dirname( AI1WMBE_PLUGIN_BASENAME ) ); +} else { + define( 'AI1WMBE_PLUGIN_BASEDIR', 'all-in-one-wp-migration-box-extension' ); +} + +// ======================= +// = Box Extension Title = +// ======================= +if ( ! defined( 'AI1WMBE_PLUGIN_TITLE' ) ) { + define( 'AI1WMBE_PLUGIN_TITLE', 'Box Extension' ); +} + +// ======================= +// = Box Extension About = +// ======================= +if ( ! defined( 'AI1WMBE_PLUGIN_ABOUT' ) ) { + define( 'AI1WMBE_PLUGIN_ABOUT', 'https://servmask.com/products/box-extension/about' ); +} + +// ===================== +// = Box Extension Key = +// ===================== +if ( ! defined( 'AI1WMBE_PLUGIN_KEY' ) ) { + define( 'AI1WMBE_PLUGIN_KEY', 'ai1wmbe_plugin_key' ); +} + +// ======================= +// = Box Extension Short = +// ======================= +if ( ! defined( 'AI1WMBE_PLUGIN_SHORT' ) ) { + define( 'AI1WMBE_PLUGIN_SHORT', 'box' ); +} + +// =================================== +// = DigitalOcean Extension Base Dir = +// =================================== +if ( defined( 'AI1WMIE_PLUGIN_BASENAME' ) ) { + define( 'AI1WMIE_PLUGIN_BASEDIR', dirname( AI1WMIE_PLUGIN_BASENAME ) ); +} else { + define( 'AI1WMIE_PLUGIN_BASEDIR', 'all-in-one-wp-migration-digitalocean-extension' ); +} + +// ================================ +// = DigitalOcean Extension Title = +// ================================ +if ( ! defined( 'AI1WMIE_PLUGIN_TITLE' ) ) { + define( 'AI1WMIE_PLUGIN_TITLE', 'DigitalOcean Spaces Extension' ); +} + +// ================================ +// = DigitalOcean Extension About = +// ================================ +if ( ! defined( 'AI1WMIE_PLUGIN_ABOUT' ) ) { + define( 'AI1WMIE_PLUGIN_ABOUT', 'https://servmask.com/products/digitalocean-spaces-extension/about' ); +} + +// ============================== +// = DigitalOcean Extension Key = +// ============================== +if ( ! defined( 'AI1WMIE_PLUGIN_KEY' ) ) { + define( 'AI1WMIE_PLUGIN_KEY', 'ai1wmie_plugin_key' ); +} + +// ================================ +// = DigitalOcean Extension Short = +// ================================ +if ( ! defined( 'AI1WMIE_PLUGIN_SHORT' ) ) { + define( 'AI1WMIE_PLUGIN_SHORT', 'digitalocean' ); +} + +// ============================== +// = Dropbox Extension Base Dir = +// ============================== +if ( defined( 'AI1WMDE_PLUGIN_BASENAME' ) ) { + define( 'AI1WMDE_PLUGIN_BASEDIR', dirname( AI1WMDE_PLUGIN_BASENAME ) ); +} else { + define( 'AI1WMDE_PLUGIN_BASEDIR', 'all-in-one-wp-migration-dropbox-extension' ); +} + +// =========================== +// = Dropbox Extension Title = +// =========================== +if ( ! defined( 'AI1WMDE_PLUGIN_TITLE' ) ) { + define( 'AI1WMDE_PLUGIN_TITLE', 'Dropbox Extension' ); +} + +// =========================== +// = Dropbox Extension About = +// =========================== +if ( ! defined( 'AI1WMDE_PLUGIN_ABOUT' ) ) { + define( 'AI1WMDE_PLUGIN_ABOUT', 'https://servmask.com/products/dropbox-extension/about' ); +} + +// ========================= +// = Dropbox Extension Key = +// ========================= +if ( ! defined( 'AI1WMDE_PLUGIN_KEY' ) ) { + define( 'AI1WMDE_PLUGIN_KEY', 'ai1wmde_plugin_key' ); +} + +// =========================== +// = Dropbox Extension Short = +// =========================== +if ( ! defined( 'AI1WMDE_PLUGIN_SHORT' ) ) { + define( 'AI1WMDE_PLUGIN_SHORT', 'dropbox' ); +} + +// ========================== +// = FTP Extension Base Dir = +// ========================== +if ( defined( 'AI1WMFE_PLUGIN_BASENAME' ) ) { + define( 'AI1WMFE_PLUGIN_BASEDIR', dirname( AI1WMFE_PLUGIN_BASENAME ) ); +} else { + define( 'AI1WMFE_PLUGIN_BASEDIR', 'all-in-one-wp-migration-ftp-extension' ); +} + +// ======================= +// = FTP Extension Title = +// ======================= +if ( ! defined( 'AI1WMFE_PLUGIN_TITLE' ) ) { + define( 'AI1WMFE_PLUGIN_TITLE', 'FTP Extension' ); +} + +// ======================= +// = FTP Extension About = +// ======================= +if ( ! defined( 'AI1WMFE_PLUGIN_ABOUT' ) ) { + define( 'AI1WMFE_PLUGIN_ABOUT', 'https://servmask.com/products/ftp-extension/about' ); +} + +// ===================== +// = FTP Extension Key = +// ===================== +if ( ! defined( 'AI1WMFE_PLUGIN_KEY' ) ) { + define( 'AI1WMFE_PLUGIN_KEY', 'ai1wmfe_plugin_key' ); +} + +// ======================= +// = FTP Extension Short = +// ======================= +if ( ! defined( 'AI1WMFE_PLUGIN_SHORT' ) ) { + define( 'AI1WMFE_PLUGIN_SHORT', 'ftp' ); +} + +// =========================================== +// = Google Cloud Storage Extension Base Dir = +// =========================================== +if ( defined( 'AI1WMCE_PLUGIN_BASENAME' ) ) { + define( 'AI1WMCE_PLUGIN_BASEDIR', dirname( AI1WMCE_PLUGIN_BASENAME ) ); +} else { + define( 'AI1WMCE_PLUGIN_BASEDIR', 'all-in-one-wp-migration-gcloud-storage-extension' ); +} + +// ======================================== +// = Google Cloud Storage Extension Title = +// ======================================== +if ( ! defined( 'AI1WMCE_PLUGIN_TITLE' ) ) { + define( 'AI1WMCE_PLUGIN_TITLE', 'Google Cloud Storage Extension' ); +} + +// ======================================== +// = Google Cloud Storage Extension About = +// ======================================== +if ( ! defined( 'AI1WMCE_PLUGIN_ABOUT' ) ) { + define( 'AI1WMCE_PLUGIN_ABOUT', 'https://servmask.com/products/google-cloud-storage-extension/about' ); +} + +// ====================================== +// = Google Cloud Storage Extension Key = +// ====================================== +if ( ! defined( 'AI1WMCE_PLUGIN_KEY' ) ) { + define( 'AI1WMCE_PLUGIN_KEY', 'ai1wmce_plugin_key' ); +} + +// ======================================== +// = Google Cloud Storage Extension Short = +// ======================================== +if ( ! defined( 'AI1WMCE_PLUGIN_SHORT' ) ) { + define( 'AI1WMCE_PLUGIN_SHORT', 'gcloud-storage' ); +} + +// =================================== +// = Google Drive Extension Base Dir = +// =================================== +if ( defined( 'AI1WMGE_PLUGIN_BASENAME' ) ) { + define( 'AI1WMGE_PLUGIN_BASEDIR', dirname( AI1WMGE_PLUGIN_BASENAME ) ); +} else { + define( 'AI1WMGE_PLUGIN_BASEDIR', 'all-in-one-wp-migration-gdrive-extension' ); +} + +// ================================ +// = Google Drive Extension Title = +// ================================ +if ( ! defined( 'AI1WMGE_PLUGIN_TITLE' ) ) { + define( 'AI1WMGE_PLUGIN_TITLE', 'Google Drive Extension' ); +} + +// ================================ +// = Google Drive Extension About = +// ================================ +if ( ! defined( 'AI1WMGE_PLUGIN_ABOUT' ) ) { + define( 'AI1WMGE_PLUGIN_ABOUT', 'https://servmask.com/products/google-drive-extension/about' ); +} + +// ============================== +// = Google Drive Extension Key = +// ============================== +if ( ! defined( 'AI1WMGE_PLUGIN_KEY' ) ) { + define( 'AI1WMGE_PLUGIN_KEY', 'ai1wmge_plugin_key' ); +} + +// ================================ +// = Google Drive Extension Short = +// ================================ +if ( ! defined( 'AI1WMGE_PLUGIN_SHORT' ) ) { + define( 'AI1WMGE_PLUGIN_SHORT', 'gdrive' ); +} + +// ===================================== +// = Amazon Glacier Extension Base Dir = +// ===================================== +if ( defined( 'AI1WMRE_PLUGIN_BASENAME' ) ) { + define( 'AI1WMRE_PLUGIN_BASEDIR', dirname( AI1WMRE_PLUGIN_BASENAME ) ); +} else { + define( 'AI1WMRE_PLUGIN_BASEDIR', 'all-in-one-wp-migration-glacier-extension' ); +} + +// ================================== +// = Amazon Glacier Extension Title = +// ================================== +if ( ! defined( 'AI1WMRE_PLUGIN_TITLE' ) ) { + define( 'AI1WMRE_PLUGIN_TITLE', 'Amazon Glacier Extension' ); +} + +// ================================== +// = Amazon Glacier Extension About = +// ================================== +if ( ! defined( 'AI1WMRE_PLUGIN_ABOUT' ) ) { + define( 'AI1WMRE_PLUGIN_ABOUT', 'https://servmask.com/products/amazon-glacier-extension/about' ); +} + +// ================================ +// = Amazon Glacier Extension Key = +// ================================ +if ( ! defined( 'AI1WMRE_PLUGIN_KEY' ) ) { + define( 'AI1WMRE_PLUGIN_KEY', 'ai1wmre_plugin_key' ); +} + +// ================================== +// = Amazon Glacier Extension Short = +// ================================== +if ( ! defined( 'AI1WMRE_PLUGIN_SHORT' ) ) { + define( 'AI1WMRE_PLUGIN_SHORT', 'glacier' ); +} + +// =========================== +// = Mega Extension Base Dir = +// =========================== +if ( defined( 'AI1WMEE_PLUGIN_BASENAME' ) ) { + define( 'AI1WMEE_PLUGIN_BASEDIR', dirname( AI1WMEE_PLUGIN_BASENAME ) ); +} else { + define( 'AI1WMEE_PLUGIN_BASEDIR', 'all-in-one-wp-migration-mega-extension' ); +} + +// ======================== +// = Mega Extension Title = +// ======================== +if ( ! defined( 'AI1WMEE_PLUGIN_TITLE' ) ) { + define( 'AI1WMEE_PLUGIN_TITLE', 'Mega Extension' ); +} + +// ======================== +// = Mega Extension About = +// ======================== +if ( ! defined( 'AI1WMEE_PLUGIN_ABOUT' ) ) { + define( 'AI1WMEE_PLUGIN_ABOUT', 'https://servmask.com/products/mega-extension/about' ); +} + +// ====================== +// = Mega Extension Key = +// ====================== +if ( ! defined( 'AI1WMEE_PLUGIN_KEY' ) ) { + define( 'AI1WMEE_PLUGIN_KEY', 'ai1wmee_plugin_key' ); +} + +// ======================== +// = Mega Extension Short = +// ======================== +if ( ! defined( 'AI1WMEE_PLUGIN_SHORT' ) ) { + define( 'AI1WMEE_PLUGIN_SHORT', 'mega' ); +} + +// ================================ +// = Multisite Extension Base Dir = +// ================================ +if ( defined( 'AI1WMME_PLUGIN_BASENAME' ) ) { + define( 'AI1WMME_PLUGIN_BASEDIR', dirname( AI1WMME_PLUGIN_BASENAME ) ); +} else { + define( 'AI1WMME_PLUGIN_BASEDIR', 'all-in-one-wp-migration-multisite-extension' ); +} + +// ============================= +// = Multisite Extension Title = +// ============================= +if ( ! defined( 'AI1WMME_PLUGIN_TITLE' ) ) { + define( 'AI1WMME_PLUGIN_TITLE', 'Multisite Extension' ); +} + +// ============================= +// = Multisite Extension About = +// ============================= +if ( ! defined( 'AI1WMME_PLUGIN_ABOUT' ) ) { + define( 'AI1WMME_PLUGIN_ABOUT', 'https://servmask.com/products/multisite-extension/about' ); +} + +// =========================== +// = Multisite Extension Key = +// =========================== +if ( ! defined( 'AI1WMME_PLUGIN_KEY' ) ) { + define( 'AI1WMME_PLUGIN_KEY', 'ai1wmme_plugin_key' ); +} + +// ============================= +// = Multisite Extension Short = +// ============================= +if ( ! defined( 'AI1WMME_PLUGIN_SHORT' ) ) { + define( 'AI1WMME_PLUGIN_SHORT', 'multisite' ); +} + +// =============================== +// = OneDrive Extension Base Dir = +// =============================== +if ( defined( 'AI1WMOE_PLUGIN_BASENAME' ) ) { + define( 'AI1WMOE_PLUGIN_BASEDIR', dirname( AI1WMOE_PLUGIN_BASENAME ) ); +} else { + define( 'AI1WMOE_PLUGIN_BASEDIR', 'all-in-one-wp-migration-onedrive-extension' ); +} + +// ============================ +// = OneDrive Extension Title = +// ============================ +if ( ! defined( 'AI1WMOE_PLUGIN_TITLE' ) ) { + define( 'AI1WMOE_PLUGIN_TITLE', 'OneDrive Extension' ); +} + +// ============================ +// = OneDrive Extension About = +// ============================ +if ( ! defined( 'AI1WMOE_PLUGIN_ABOUT' ) ) { + define( 'AI1WMOE_PLUGIN_ABOUT', 'https://servmask.com/products/onedrive-extension/about' ); +} + +// ========================== +// = OneDrive Extension Key = +// ========================== +if ( ! defined( 'AI1WMOE_PLUGIN_KEY' ) ) { + define( 'AI1WMOE_PLUGIN_KEY', 'ai1wmoe_plugin_key' ); +} + +// ============================ +// = OneDrive Extension Short = +// ============================ +if ( ! defined( 'AI1WMOE_PLUGIN_SHORT' ) ) { + define( 'AI1WMOE_PLUGIN_SHORT', 'onedrive' ); +} + +// ================================ +// = Amazon S3 Extension Base Dir = +// ================================ +if ( defined( 'AI1WMSE_PLUGIN_BASENAME' ) ) { + define( 'AI1WMSE_PLUGIN_BASEDIR', dirname( AI1WMSE_PLUGIN_BASENAME ) ); +} else { + define( 'AI1WMSE_PLUGIN_BASEDIR', 'all-in-one-wp-migration-s3-extension' ); +} + +// ============================= +// = Amazon S3 Extension Title = +// ============================= +if ( ! defined( 'AI1WMSE_PLUGIN_TITLE' ) ) { + define( 'AI1WMSE_PLUGIN_TITLE', 'Amazon S3 Extension' ); +} + +// ============================= +// = Amazon S3 Extension About = +// ============================= +if ( ! defined( 'AI1WMSE_PLUGIN_ABOUT' ) ) { + define( 'AI1WMSE_PLUGIN_ABOUT', 'https://servmask.com/products/amazon-s3-extension/about' ); +} + +// =========================== +// = Amazon S3 Extension Key = +// =========================== +if ( ! defined( 'AI1WMSE_PLUGIN_KEY' ) ) { + define( 'AI1WMSE_PLUGIN_KEY', 'ai1wmse_plugin_key' ); +} + +// ============================= +// = Amazon S3 Extension Short = +// ============================= +if ( ! defined( 'AI1WMSE_PLUGIN_SHORT' ) ) { + define( 'AI1WMSE_PLUGIN_SHORT', 's3' ); +} + +// ================================ +// = Unlimited Extension Base Dir = +// ================================ +if ( defined( 'AI1WMUE_PLUGIN_BASENAME' ) ) { + define( 'AI1WMUE_PLUGIN_BASEDIR', dirname( AI1WMUE_PLUGIN_BASENAME ) ); +} else { + define( 'AI1WMUE_PLUGIN_BASEDIR', 'all-in-one-wp-migration-unlimited-extension' ); +} + +// ============================= +// = Unlimited Extension Title = +// ============================= +if ( ! defined( 'AI1WMUE_PLUGIN_TITLE' ) ) { + define( 'AI1WMUE_PLUGIN_TITLE', 'Unlimited Extension' ); +} + +// ============================= +// = Unlimited Extension About = +// ============================= +if ( ! defined( 'AI1WMUE_PLUGIN_ABOUT' ) ) { + define( 'AI1WMUE_PLUGIN_ABOUT', 'https://servmask.com/products/unlimited-extension/about' ); +} + +// =========================== +// = Unlimited Extension Key = +// =========================== +if ( ! defined( 'AI1WMUE_PLUGIN_KEY' ) ) { + define( 'AI1WMUE_PLUGIN_KEY', 'ai1wmue_plugin_key' ); +} + +// ============================= +// = Unlimited Extension Short = +// ============================= +if ( ! defined( 'AI1WMUE_PLUGIN_SHORT' ) ) { + define( 'AI1WMUE_PLUGIN_SHORT', 'unlimited' ); +} + +// ========================== +// = URL Extension Base Dir = +// ========================== +if ( defined( 'AI1WMLE_PLUGIN_BASENAME' ) ) { + define( 'AI1WMLE_PLUGIN_BASEDIR', dirname( AI1WMLE_PLUGIN_BASENAME ) ); +} else { + define( 'AI1WMLE_PLUGIN_BASEDIR', 'all-in-one-wp-migration-url-extension' ); +} + +// ======================= +// = URL Extension Title = +// ======================= +if ( ! defined( 'AI1WMLE_PLUGIN_TITLE' ) ) { + define( 'AI1WMLE_PLUGIN_TITLE', 'URL Extension' ); +} + +// ======================= +// = URL Extension About = +// ======================= +if ( ! defined( 'AI1WMLE_PLUGIN_ABOUT' ) ) { + define( 'AI1WMLE_PLUGIN_ABOUT', 'https://servmask.com/products/url-extension/about' ); +} + +// ===================== +// = URL Extension Key = +// ===================== +if ( ! defined( 'AI1WMLE_PLUGIN_KEY' ) ) { + define( 'AI1WMLE_PLUGIN_KEY', 'ai1wmle_plugin_key' ); +} + +// ======================= +// = URL Extension Short = +// ======================= +if ( ! defined( 'AI1WMLE_PLUGIN_SHORT' ) ) { + define( 'AI1WMLE_PLUGIN_SHORT', 'url' ); +} diff --git a/deprecated.php b/deprecated.php new file mode 100644 index 0000000..d143f73 --- /dev/null +++ b/deprecated.php @@ -0,0 +1,26 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +function ai1wm_progress_path( $params ) {} diff --git a/exceptions.php b/exceptions.php new file mode 100644 index 0000000..042e702 --- /dev/null +++ b/exceptions.php @@ -0,0 +1,44 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Archive_Exception extends Exception {} +class Ai1wm_Backups_Exception extends Exception {} +class Ai1wm_Export_Exception extends Exception {} +class Ai1wm_Http_Exception extends Exception {} +class Ai1wm_Import_Exception extends Exception {} +class Ai1wm_Import_Retry_Exception extends Exception {} +class Ai1wm_Not_Accessible_Exception extends Exception {} +class Ai1wm_Not_Seekable_Exception extends Exception {} +class Ai1wm_Not_Tellable_Exception extends Exception {} +class Ai1wm_Not_Readable_Exception extends Exception {} +class Ai1wm_Not_Writable_Exception extends Exception {} +class Ai1wm_Not_Truncatable_Exception extends Exception {} +class Ai1wm_Not_Closable_Exception extends Exception {} +class Ai1wm_Not_Found_Exception extends Exception {} +class Ai1wm_Not_Directory_Exception extends Exception {} +class Ai1wm_Not_Valid_Secret_Key_Exception extends Exception {} +class Ai1wm_Quota_Exceeded_Exception extends Exception {} +class Ai1wm_Storage_Exception extends Exception {} +class Ai1wm_Compatibility_Exception extends Exception {} diff --git a/functions.php b/functions.php new file mode 100644 index 0000000..dde036a --- /dev/null +++ b/functions.php @@ -0,0 +1,1418 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +/** + * Get storage absolute path + * + * @param array $params Request parameters + * @return string + */ +function ai1wm_storage_path( $params ) { + if ( empty( $params['storage'] ) ) { + throw new Ai1wm_Storage_Exception( __( 'Unable to locate storage path. Technical details', AI1WM_PLUGIN_NAME ) ); + } + + // Get storage path + $storage = AI1WM_STORAGE_PATH . DIRECTORY_SEPARATOR . basename( $params['storage'] ); + if ( ! is_dir( $storage ) ) { + mkdir( $storage ); + } + + return $storage; +} + +/** + * Get backup absolute path + * + * @param array $params Request parameters + * @return string + */ +function ai1wm_backup_path( $params ) { + if ( empty( $params['archive'] ) ) { + throw new Ai1wm_Archive_Exception( __( 'Unable to locate archive path. Technical details', AI1WM_PLUGIN_NAME ) ); + } + + // Validate archive path + if ( validate_file( $params['archive'] ) !== 0 ) { + throw new Ai1wm_Archive_Exception( __( 'Invalid archive path. Technical details', AI1WM_PLUGIN_NAME ) ); + } + + return AI1WM_BACKUPS_PATH . DIRECTORY_SEPARATOR . $params['archive']; +} + +/** + * Get archive absolute path + * + * @param array $params Request parameters + * @return string + */ +function ai1wm_archive_path( $params ) { + if ( empty( $params['archive'] ) ) { + throw new Ai1wm_Archive_Exception( __( 'Unable to locate archive path. Technical details', AI1WM_PLUGIN_NAME ) ); + } + + // Validate archive path + if ( validate_file( $params['archive'] ) !== 0 ) { + throw new Ai1wm_Archive_Exception( __( 'Invalid archive path. Technical details', AI1WM_PLUGIN_NAME ) ); + } + + // Get archive path + if ( empty( $params['ai1wm_manual_restore'] ) ) { + return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . $params['archive']; + } + + return ai1wm_backup_path( $params ); +} + +/** + * Get export log absolute path + * + * @param array $params Request parameters + * @return string + */ +function ai1wm_export_path( $params ) { + return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_EXPORT_NAME; +} + +/** + * Get import log absolute path + * + * @param array $params Request parameters + * @return string + */ +function ai1wm_import_path( $params ) { + return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_IMPORT_NAME; +} + +/** + * Get multipart.list absolute path + * + * @param array $params Request parameters + * @return string + */ +function ai1wm_multipart_path( $params ) { + return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_MULTIPART_NAME; +} + +/** + * Get filemap.list absolute path + * + * @param array $params Request parameters + * @return string + */ +function ai1wm_filemap_path( $params ) { + return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_FILEMAP_NAME; +} + +/** + * Get package.json absolute path + * + * @param array $params Request parameters + * @return string + */ +function ai1wm_package_path( $params ) { + return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_PACKAGE_NAME; +} + +/** + * Get multisite.json absolute path + * + * @param array $params Request parameters + * @return string + */ +function ai1wm_multisite_path( $params ) { + return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_MULTISITE_NAME; +} + +/** + * Get blogs.json absolute path + * + * @param array $params Request parameters + * @return string + */ +function ai1wm_blogs_path( $params ) { + return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_BLOGS_NAME; +} + +/** + * Get settings.json absolute path + * + * @param array $params Request parameters + * @return string + */ +function ai1wm_settings_path( $params ) { + return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_SETTINGS_NAME; +} + +/** + * Get database.sql absolute path + * + * @param array $params Request parameters + * @return string + */ +function ai1wm_database_path( $params ) { + return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_DATABASE_NAME; +} + +/** + * Get error log absolute path + * + * @return string + */ +function ai1wm_error_path() { + return AI1WM_STORAGE_PATH . DIRECTORY_SEPARATOR . AI1WM_ERROR_NAME; +} + +/** + * Get WordPress content directory + * + * @param string $path Relative path + * @return string + */ +function ai1wm_content_path( $path = null ) { + if ( empty( $path ) ) { + return WP_CONTENT_DIR; + } + + return WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $path; +} + +/** + * Get archive name + * + * @param array $params Request parameters + * @return string + */ +function ai1wm_archive_name( $params ) { + return basename( $params['archive'] ); +} + +/** + * Get backup URL address + * + * @param array $params Request parameters + * @return string + */ +function ai1wm_backup_url( $params ) { + return AI1WM_BACKUPS_URL . '/' . str_replace( DIRECTORY_SEPARATOR, '/', $params['archive'] ); +} + +/** + * Get archive size in bytes + * + * @param array $params Request parameters + * @return integer + */ +function ai1wm_archive_bytes( $params ) { + return filesize( ai1wm_archive_path( $params ) ); +} + +/** + * Get backup size in bytes + * + * @param array $params Request parameters + * @return integer + */ +function ai1wm_backup_bytes( $params ) { + return filesize( ai1wm_backup_path( $params ) ); +} + +/** + * Get database size in bytes + * + * @param array $params Request parameters + * @return integer + */ +function ai1wm_database_bytes( $params ) { + return filesize( ai1wm_database_path( $params ) ); +} + +/** + * Get package size in bytes + * + * @param array $params Request parameters + * @return integer + */ +function ai1wm_package_bytes( $params ) { + return filesize( ai1wm_package_path( $params ) ); +} + +/** + * Get multisite size in bytes + * + * @param array $params Request parameters + * @return integer + */ +function ai1wm_multisite_bytes( $params ) { + return filesize( ai1wm_multisite_path( $params ) ); +} + +/** + * Get archive size as text + * + * @param array $params Request parameters + * @return string + */ +function ai1wm_archive_size( $params ) { + return size_format( filesize( ai1wm_archive_path( $params ) ) ); +} + +/** + * Get backup size as text + * + * @param array $params Request parameters + * @return string + */ +function ai1wm_backup_size( $params ) { + return size_format( filesize( ai1wm_backup_path( $params ) ) ); +} + +/** + * Parse file size + * + * @param string $size File size + * @param string $default Default size + * @return string + */ +function ai1wm_parse_size( $size, $default = null ) { + $suffixes = array( + '' => 1, + 'k' => 1000, + 'm' => 1000000, + 'g' => 1000000000, + ); + + // Parse size format + if ( preg_match( '/([0-9]+)\s*(k|m|g)?(b?(ytes?)?)/i', $size, $match ) ) { + return $match[1] * $suffixes[ strtolower( $match[2] ) ]; + } + + return $default; +} + +/** + * Get current site name + * + * @param integer $blog_id Blog ID + * @return string + */ +function ai1wm_site_name( $blog_id = null ) { + return parse_url( get_site_url( $blog_id ), PHP_URL_HOST ); +} + +/** + * Get archive file name + * + * @param integer $blog_id Blog ID + * @return string + */ +function ai1wm_archive_file( $blog_id = null ) { + $name = array(); + + // Add domain + $name[] = parse_url( get_site_url( $blog_id ), PHP_URL_HOST ); + + // Add path + if ( ( $path = explode( '/', parse_url( get_site_url( $blog_id ), PHP_URL_PATH ) ) ) ) { + foreach ( $path as $directory ) { + if ( $directory ) { + $name[] = $directory; + } + } + } + + // Add year, month and day + $name[] = date( 'Ymd' ); + + // Add hours, minutes and seconds + $name[] = date( 'His' ); + + // Add unique identifier + $name[] = rand( 100, 999 ); + + return sprintf( '%s.wpress', strtolower( implode( '-', $name ) ) ); +} + +/** + * Get archive folder name + * + * @param integer $blog_id Blog ID + * @return string + */ +function ai1wm_archive_folder( $blog_id = null ) { + $name = array(); + + // Add domain + $name[] = parse_url( get_site_url( $blog_id ), PHP_URL_HOST ); + + // Add path + if ( ( $path = explode( '/', parse_url( get_site_url( $blog_id ), PHP_URL_PATH ) ) ) ) { + foreach ( $path as $directory ) { + if ( $directory ) { + $name[] = $directory; + } + } + } + + return strtolower( implode( '-', $name ) ); +} + +/** + * Get archive bucket name + * + * @param integer $blog_id Blog ID + * @return string + */ +function ai1wm_archive_bucket( $blog_id = null ) { + $name = array(); + + // Add domain + if ( ( $domain = explode( '.', parse_url( get_site_url( $blog_id ), PHP_URL_HOST ) ) ) ) { + foreach ( $domain as $subdomain ) { + if ( $subdomain ) { + $name[] = $subdomain; + } + } + } + + // Add path + if ( ( $path = explode( '/', parse_url( get_site_url( $blog_id ), PHP_URL_PATH ) ) ) ) { + foreach ( $path as $directory ) { + if ( $directory ) { + $name[] = $directory; + } + } + } + + return strtolower( implode( '-', $name ) ); +} + +/** + * Get archive vault name + * + * @param integer $blog_id Blog ID + * @return string + */ +function ai1wm_archive_vault( $blog_id = null ) { + $name = array(); + + // Add domain + if ( ( $domain = explode( '.', parse_url( get_site_url( $blog_id ), PHP_URL_HOST ) ) ) ) { + foreach ( $domain as $subdomain ) { + if ( $subdomain ) { + $name[] = $subdomain; + } + } + } + + // Add path + if ( ( $path = explode( '/', parse_url( get_site_url( $blog_id ), PHP_URL_PATH ) ) ) ) { + foreach ( $path as $directory ) { + if ( $directory ) { + $name[] = $directory; + } + } + } + + return strtolower( implode( '-', $name ) ); +} + +/** + * Get archive project name + * + * @param integer $blog_id Blog ID + * @return string + */ +function ai1wm_archive_project( $blog_id = null ) { + $name = array(); + + // Add domain + if ( ( $domain = explode( '.', parse_url( get_site_url( $blog_id ), PHP_URL_HOST ) ) ) ) { + foreach ( $domain as $subdomain ) { + if ( $subdomain ) { + $name[] = $subdomain; + } + } + } + + // Add path + if ( ( $path = explode( '/', parse_url( get_site_url( $blog_id ), PHP_URL_PATH ) ) ) ) { + foreach ( $path as $directory ) { + if ( $directory ) { + $name[] = $directory; + } + } + } + + return strtolower( implode( '-', $name ) ); +} + +/** + * Get archive share name + * + * @param integer $blog_id Blog ID + * @return string + */ +function ai1wm_archive_share( $blog_id = null ) { + $name = array(); + + // Add domain + if ( ( $domain = explode( '.', parse_url( get_site_url( $blog_id ), PHP_URL_HOST ) ) ) ) { + foreach ( $domain as $subdomain ) { + if ( $subdomain ) { + $name[] = $subdomain; + } + } + } + + // Add path + if ( ( $path = explode( '/', parse_url( get_site_url( $blog_id ), PHP_URL_PATH ) ) ) ) { + foreach ( $path as $directory ) { + if ( $directory ) { + $name[] = $directory; + } + } + } + + return strtolower( implode( '-', $name ) ); +} + +/** + * Get storage folder name + * + * @return string + */ +function ai1wm_storage_folder() { + return uniqid(); +} + +/** + * Check whether blog ID is main site + * + * @param integer $blog_id Blog ID + * @return boolean + */ +function ai1wm_main_site( $blog_id = null ) { + return $blog_id === null || $blog_id === 0 || $blog_id === 1; +} + +/** + * Get sites absolute path by blog ID + * + * @param integer $blog_id Blog ID + * @return string + */ +function ai1wm_sites_path( $blog_id = null ) { + if ( ai1wm_main_site( $blog_id ) ) { + return AI1WM_UPLOADS_PATH; + } + + return AI1WM_SITES_PATH . DIRECTORY_SEPARATOR . $blog_id; +} + +/** + * Get files absolute path by blog ID + * + * @param integer $blog_id Blog ID + * @return string + */ +function ai1wm_files_path( $blog_id = null ) { + if ( ai1wm_main_site( $blog_id ) ) { + return AI1WM_UPLOADS_PATH; + } + + return AI1WM_BLOGSDIR_PATH . DIRECTORY_SEPARATOR . $blog_id . DIRECTORY_SEPARATOR . 'files'; +} + +/** + * Get blogs.dir absolute path by blog ID + * + * @param integer $blog_id Blog ID + * @return string + */ +function ai1wm_blogsdir_path( $blog_id = null ) { + if ( ai1wm_main_site( $blog_id ) ) { + return '/wp-content/uploads/'; + } + + return "/wp-content/blogs.dir/{$blog_id}/files/"; +} + +/** + * Get blogs.dir URL by blog ID + * + * @param integer $blog_id Blog ID + * @return string + */ +function ai1wm_blogsdir_url( $blog_id = null ) { + if ( ai1wm_main_site( $blog_id ) ) { + return get_site_url( $blog_id, '/wp-content/uploads/' ); + } + + return get_site_url( $blog_id, "/wp-content/blogs.dir/{$blog_id}/files/" ); +} + +/** + * Get uploads absolute path by blog ID + * + * @param integer $blog_id Blog ID + * @return string + */ +function ai1wm_uploads_path( $blog_id = null ) { + if ( ai1wm_main_site( $blog_id ) ) { + return '/wp-content/uploads/'; + } + + return "/wp-content/uploads/sites/{$blog_id}/"; +} + +/** + * Get uploads URL by blog ID + * + * @param integer $blog_id Blog ID + * @return string + */ +function ai1wm_uploads_url( $blog_id = null ) { + if ( ai1wm_main_site( $blog_id ) ) { + return get_site_url( $blog_id, '/wp-content/uploads/' ); + } + + return get_site_url( $blog_id, "/wp-content/uploads/sites/{$blog_id}/" ); +} + +/** + * Get ServMask table prefix by blog ID + * + * @param integer $blog_id Blog ID + * @return string + */ +function ai1wm_servmask_prefix( $blog_id = null ) { + // Set base table prefix + if ( ai1wm_main_site( $blog_id ) ) { + return AI1WM_TABLE_PREFIX; + } + + return AI1WM_TABLE_PREFIX . $blog_id . '_'; +} + +/** + * Get WordPress table prefix by blog ID + * + * @param integer $blog_id Blog ID + * @return string + */ +function ai1wm_table_prefix( $blog_id = null ) { + global $wpdb; + + // Set base table prefix + if ( ai1wm_main_site( $blog_id ) ) { + return $wpdb->base_prefix; + } + + return $wpdb->base_prefix . $blog_id . '_'; +} + +/** + * Get default content filters + * + * @param array $filters List of files and directories + * @return array + */ +function ai1wm_content_filters( $filters = array() ) { + return array_merge( $filters, array( + AI1WM_BACKUPS_NAME, + AI1WM_PACKAGE_NAME, + AI1WM_MULTISITE_NAME, + AI1WM_DATABASE_NAME, + ) ); +} + +/** + * Get default plugin filters + * + * @param array $filters List of plugins + * @return array + */ +function ai1wm_plugin_filters( $filters = array() ) { + // WP Migration Plugin + if ( defined( 'AI1WM_PLUGIN_BASENAME' ) ) { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WM_PLUGIN_BASENAME ); + } else { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration'; + } + + // Microsoft Azure Extension + if ( defined( 'AI1WMZE_PLUGIN_BASENAME' ) ) { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMZE_PLUGIN_BASENAME ); + } else { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-azure-storage-extension'; + } + + // Backblaze B2 Extension + if ( defined( 'AI1WMAE_PLUGIN_BASENAME' ) ) { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMAE_PLUGIN_BASENAME ); + } else { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-b2-extension'; + } + + // Box Extension + if ( defined( 'AI1WMBE_PLUGIN_BASENAME' ) ) { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMBE_PLUGIN_BASENAME ); + } else { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-box-extension'; + } + + // DigitalOcean Extension + if ( defined( 'AI1WMIE_PLUGIN_BASENAME' ) ) { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMIE_PLUGIN_BASENAME ); + } else { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-digitalocean-extension'; + } + + // Dropbox Extension + if ( defined( 'AI1WMDE_PLUGIN_BASENAME' ) ) { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMDE_PLUGIN_BASENAME ); + } else { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-dropbox-extension'; + } + + // FTP Extension + if ( defined( 'AI1WMFE_PLUGIN_BASENAME' ) ) { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMFE_PLUGIN_BASENAME ); + } else { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-ftp-extension'; + } + + // Google Cloud Storage Extension + if ( defined( 'AI1WMCE_PLUGIN_BASENAME' ) ) { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMCE_PLUGIN_BASENAME ); + } else { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-gcloud-storage-extension'; + } + + // Google Drive Extension + if ( defined( 'AI1WMGE_PLUGIN_BASENAME' ) ) { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMGE_PLUGIN_BASENAME ); + } else { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-gdrive-extension'; + } + + // Amazon Glacier Extension + if ( defined( 'AI1WMRE_PLUGIN_BASENAME' ) ) { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMRE_PLUGIN_BASENAME ); + } else { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-glacier-extension'; + } + + // Mega Extension + if ( defined( 'AI1WMEE_PLUGIN_BASENAME' ) ) { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMEE_PLUGIN_BASENAME ); + } else { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-mega-extension'; + } + + // Multisite Extension + if ( defined( 'AI1WMME_PLUGIN_BASENAME' ) ) { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMME_PLUGIN_BASENAME ); + } else { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-multisite-extension'; + } + + // OneDrive Extension + if ( defined( 'AI1WMOE_PLUGIN_BASENAME' ) ) { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMOE_PLUGIN_BASENAME ); + } else { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-onedrive-extension'; + } + + // Amazon S3 Extension + if ( defined( 'AI1WMSE_PLUGIN_BASENAME' ) ) { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMSE_PLUGIN_BASENAME ); + } else { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-s3-extension'; + } + + // Unlimited Extension + if ( defined( 'AI1WMUE_PLUGIN_BASENAME' ) ) { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMUE_PLUGIN_BASENAME ); + } else { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-unlimited-extension'; + } + + // URL Extension + if ( defined( 'AI1WMLE_PLUGIN_BASENAME' ) ) { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMLE_PLUGIN_BASENAME ); + } else { + $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-url-extension'; + } + + return $filters; +} + +/** + * Get active ServMask plugins + * + * @return array + */ +function ai1wm_active_servmask_plugins( $plugins = array() ) { + // WP Migration Plugin + if ( defined( 'AI1WM_PLUGIN_BASENAME' ) ) { + $plugins[] = AI1WM_PLUGIN_BASENAME; + } + + // Microsoft Azure Extension + if ( defined( 'AI1WMZE_PLUGIN_BASENAME' ) ) { + $plugins[] = AI1WMZE_PLUGIN_BASENAME; + } + + // Backblaze B2 Extension + if ( defined( 'AI1WMAE_PLUGIN_BASENAME' ) ) { + $plugins[] = AI1WMAE_PLUGIN_BASENAME; + } + + // Box Extension + if ( defined( 'AI1WMBE_PLUGIN_BASENAME' ) ) { + $plugins[] = AI1WMBE_PLUGIN_BASENAME; + } + + // DigitalOcean Extension + if ( defined( 'AI1WMIE_PLUGIN_BASENAME' ) ) { + $plugins[] = AI1WMIE_PLUGIN_BASENAME; + } + + // Dropbox Extension + if ( defined( 'AI1WMDE_PLUGIN_BASENAME' ) ) { + $plugins[] = AI1WMDE_PLUGIN_BASENAME; + } + + // FTP Extension + if ( defined( 'AI1WMFE_PLUGIN_BASENAME' ) ) { + $plugins[] = AI1WMFE_PLUGIN_BASENAME; + } + + // Google Cloud Storage Extension + if ( defined( 'AI1WMCE_PLUGIN_BASENAME' ) ) { + $plugins[] = AI1WMCE_PLUGIN_BASENAME; + } + + // Google Drive Extension + if ( defined( 'AI1WMGE_PLUGIN_BASENAME' ) ) { + $plugins[] = AI1WMGE_PLUGIN_BASENAME; + } + + // Amazon Glacier Extension + if ( defined( 'AI1WMRE_PLUGIN_BASENAME' ) ) { + $plugins[] = AI1WMRE_PLUGIN_BASENAME; + } + + // Mega Extension + if ( defined( 'AI1WMEE_PLUGIN_BASENAME' ) ) { + $plugins[] = AI1WMEE_PLUGIN_BASENAME; + } + + // Multisite Extension + if ( defined( 'AI1WMME_PLUGIN_BASENAME' ) ) { + $plugins[] = AI1WMME_PLUGIN_BASENAME; + } + + // OneDrive Extension + if ( defined( 'AI1WMOE_PLUGIN_BASENAME' ) ) { + $plugins[] = AI1WMOE_PLUGIN_BASENAME; + } + + // Amazon S3 Extension + if ( defined( 'AI1WMSE_PLUGIN_BASENAME' ) ) { + $plugins[] = AI1WMSE_PLUGIN_BASENAME; + } + + // Unlimited Extension + if ( defined( 'AI1WMUE_PLUGIN_BASENAME' ) ) { + $plugins[] = AI1WMUE_PLUGIN_BASENAME; + } + + // URL Extension + if ( defined( 'AI1WMLE_PLUGIN_BASENAME' ) ) { + $plugins[] = AI1WMLE_PLUGIN_BASENAME; + } + + return $plugins; +} + +/** + * Get active sitewide plugins + * + * @return array + */ +function ai1wm_active_sitewide_plugins() { + return array_keys( get_site_option( AI1WM_ACTIVE_SITEWIDE_PLUGINS, array() ) ); +} + +/** + * Get active plugins + * + * @return array + */ +function ai1wm_active_plugins() { + return array_values( get_option( AI1WM_ACTIVE_PLUGINS, array() ) ); +} + +/** + * Set active sitewide plugins (inspired by WordPress activate_plugins() function) + * + * @param array $plugins List of plugins + * @return boolean + */ +function ai1wm_activate_sitewide_plugins( $plugins ) { + $current = get_site_option( AI1WM_ACTIVE_SITEWIDE_PLUGINS, array() ); + + // Add plugins + foreach ( $plugins as $plugin ) { + if ( ! isset( $current[ $plugin ] ) && ! is_wp_error( validate_plugin( $plugin ) ) ) { + $current[ $plugin ] = time(); + } + } + + return update_site_option( AI1WM_ACTIVE_SITEWIDE_PLUGINS, $current ); +} + +/** + * Set active plugins (inspired by WordPress activate_plugins() function) + * + * @param array $plugins List of plugins + * @return boolean + */ +function ai1wm_activate_plugins( $plugins ) { + $current = get_option( AI1WM_ACTIVE_PLUGINS, array() ); + + // Add plugins + foreach ( $plugins as $plugin ) { + if ( ! in_array( $plugin, $current ) && ! is_wp_error( validate_plugin( $plugin ) ) ) { + $current[] = $plugin; + } + } + + sort( $current ); + + return update_option( AI1WM_ACTIVE_PLUGINS, $current ); +} + +/** + * Get active template + * + * @return string + */ +function ai1wm_active_template() { + return get_option( AI1WM_ACTIVE_TEMPLATE ); +} + +/** + * Get active stylesheet + * + * @return string + */ +function ai1wm_active_stylesheet() { + return get_option( AI1WM_ACTIVE_STYLESHEET ); +} + +/** + * Set active template + * + * @param string $template Template name + * @return boolean + */ +function ai1wm_activate_template( $template ) { + return update_option( AI1WM_ACTIVE_TEMPLATE, $template ); +} + +/** + * Set active stylesheet + * + * @param string $stylesheet Stylesheet name + * @return boolean + */ +function ai1wm_activate_stylesheet( $stylesheet ) { + return update_option( AI1WM_ACTIVE_STYLESHEET, $stylesheet ); +} + +/** + * Set inactive sitewide plugins (inspired by WordPress deactivate_plugins() function) + * + * @param array $plugins List of plugins + * @return boolean + */ +function ai1wm_deactivate_sitewide_plugins( $plugins ) { + $current = get_site_option( AI1WM_ACTIVE_SITEWIDE_PLUGINS, array() ); + + // Add plugins + foreach ( $plugins as $plugin ) { + if ( isset( $current[ $plugin ] ) ) { + unset( $current[ $plugin ] ); + } + } + + return update_site_option( AI1WM_ACTIVE_SITEWIDE_PLUGINS, $current ); +} + + +/** + * Set inactive plugins (inspired by WordPress deactivate_plugins() function) + * + * @param array $plugins List of plugins + * @return boolean + */ +function ai1wm_deactivate_plugins( $plugins ) { + $current = get_option( AI1WM_ACTIVE_PLUGINS, array() ); + + // Remove plugins + foreach ( $plugins as $plugin ) { + if ( ( $key = array_search( $plugin, $current ) ) !== false ) { + unset( $current[ $key ] ); + } + } + + sort( $current ); + + return update_option( AI1WM_ACTIVE_PLUGINS, $current ); +} + +/** + * Deactivate Jetpack modules + * + * @param array $modules List of modules + * @return boolean + */ +function ai1wm_deactivate_jetpack_modules( $modules ) { + $current = get_option( AI1WM_JETPACK_ACTIVE_MODULES, array() ); + + // Remove modules + foreach ( $modules as $module ) { + if ( ( $key = array_search( $module, $current ) ) !== false ) { + unset( $current[ $key ] ); + } + } + + sort( $current ); + + return update_option( AI1WM_JETPACK_ACTIVE_MODULES, $current ); +} + +/** + * Discover plugin basename + * + * @param string $basename Plugin basename + * @return string + */ +function ai1wm_discover_plugin_basename( $basename ) { + if ( ( $plugins = get_plugins() ) ) { + foreach ( $plugins as $plugin => $info ) { + if ( strpos( dirname( $plugin ), dirname( $basename ) ) !== false ) { + if ( basename( $plugin ) === basename( $basename ) ) { + return $plugin; + } + } + } + } + + return $basename; +} + +/** + * Validate plugin basename + * + * @param string $basename Plugin basename + * @return boolean + */ +function ai1wm_validate_plugin_basename( $basename ) { + if ( ( $plugins = get_plugins() ) ) { + foreach ( $plugins as $plugin => $info ) { + if ( $plugin === $basename ) { + return true; + } + } + } + + return false; +} + +/** + * Validate theme basename + * + * @param string $basename Theme basename + * @return boolean + */ +function ai1wm_validate_theme_basename( $basename ) { + if ( ( $themes = search_theme_directories() ) ) { + foreach ( $themes as $theme => $info ) { + if ( $info['theme_file'] === $basename ) { + return true; + } + } + } + + return false; +} + +/** + * Flush WP options cache + * + * @return void + */ +function ai1wm_cache_flush() { + // Initialize WP cache + wp_cache_init(); + + // Flush WP cache + wp_cache_flush(); + + // Set WP cache + wp_cache_set( 'alloptions', array(), 'options' ); + wp_cache_set( 'notoptions', array(), 'options' ); + + // Delete WP cache + wp_cache_delete( 'alloptions', 'options' ); + wp_cache_delete( 'notoptions', 'options' ); +} + +/** + * Set URL scheme + * + * @param string $url URL value + * @param string $scheme URL scheme + * @return string + */ +function ai1wm_url_scheme( $url, $scheme = '' ) { + if ( empty( $scheme ) ) { + return preg_replace( '#^\w+://#', '//', $url ); + } + + return preg_replace( '#^\w+://#', $scheme . '://', $url ); +} + +/** + * Opens a file in specified mode + * + * @param string $file Path to the file to open + * @param string $mode Mode in which to open the file + * @return resource + * @throws Ai1wm_Not_Accessible_Exception + */ +function ai1wm_open( $file, $mode ) { + $file_handle = @fopen( $file, $mode ); + if ( false === $file_handle ) { + throw new Ai1wm_Not_Accessible_Exception( sprintf( __( 'Unable to open %s with mode %s. Technical details', AI1WM_PLUGIN_NAME ), $file, $mode ) ); + } + + return $file_handle; +} + +/** + * Write contents to a file + * + * @param resource $handle File handle to write to + * @param string $content Contents to write to the file + * @return integer + * @throws Ai1wm_Not_Writable_Exception + * @throws Ai1wm_Quota_Exceeded_Exception + */ +function ai1wm_write( $handle, $content ) { + $write_result = @fwrite( $handle, $content ); + if ( false === $write_result ) { + if ( ( $meta = stream_get_meta_data( $handle ) ) ) { + throw new Ai1wm_Not_Writable_Exception( sprintf( __( 'Unable to write to: %s. Technical details', AI1WM_PLUGIN_NAME ), $meta['uri'] ) ); + } + } elseif ( strlen( $content ) !== $write_result ) { + if ( ( $meta = stream_get_meta_data( $handle ) ) ) { + throw new Ai1wm_Quota_Exceeded_Exception( sprintf( __( 'Out of disk space. Unable to write to: %s. Technical details', AI1WM_PLUGIN_NAME ), $meta['uri'] ) ); + } + } + + return $write_result; +} + +/** + * Read contents from a file + * + * @param resource $handle File handle to read from + * @param string $filesize File size + * @return integer + * @throws Ai1wm_Not_Readable_Exception + */ +function ai1wm_read( $handle, $filesize ) { + $read_result = @fread( $handle, $filesize ); + if ( false === $read_result ) { + if ( ( $meta = stream_get_meta_data( $handle ) ) ) { + throw new Ai1wm_Not_Readable_Exception( sprintf( __( 'Unable to read file: %s. Technical details', AI1WM_PLUGIN_NAME ), $meta['uri'] ) ); + } + } + + return $read_result; +} + +/** + * Seeks on a file pointer + * + * @param string $handle File handle to seeks + * @return integer + */ +function ai1wm_seek( $handle, $offset, $mode = SEEK_SET ) { + $seek_result = @fseek( $handle, $offset, $mode ); + if ( -1 === $seek_result ) { + if ( ( $meta = stream_get_meta_data( $handle ) ) ) { + throw new Ai1wm_Not_Seekable_Exception( sprintf( __( 'Unable to seek to offset %d on %s. Technical details', AI1WM_PLUGIN_NAME ), $offset, $meta['uri'] ) ); + } + } + + return $seek_result; +} + +/** + * Tells on a file pointer + * + * @param string $handle File handle to tells + * @return integer + */ +function ai1wm_tell( $handle ) { + $tell_result = @ftell( $handle ); + if ( false === $tell_result ) { + if ( ( $meta = stream_get_meta_data( $handle ) ) ) { + throw new Ai1wm_Not_Tellable_Exception( sprintf( __( 'Unable to get current pointer position of %s. Technical details', AI1WM_PLUGIN_NAME ), $meta['uri'] ) ); + } + } + + return $tell_result; +} + +/** + * Closes a file handle + * + * @param resource $handle File handle to close + * @return boolean + */ +function ai1wm_close( $handle ) { + return @fclose( $handle ); +} + +/** + * Deletes a file + * + * @param string $file Path to file to delete + * @return boolean + */ +function ai1wm_unlink( $file ) { + return @unlink( $file ); +} + +/** + * Sets modification time of a file + * + * @param string $file Path to file to change modification time + * @param integer $time File modification time + * @return boolean + */ +function ai1wm_touch( $file, $mtime ) { + return @touch( $file, $mtime ); +} + +/** + * Changes file mode + * + * @param string $file Path to file to change mode + * @param integer $time File mode + * @return boolean + */ +function ai1wm_chmod( $file, $mode ) { + return @chmod( $file, $mode ); +} + +/** + * Copies one file's contents to another + * + * @param string $source_file File to copy the contents from + * @param string $destination_file File to copy the contents to + */ +function ai1wm_copy( $source_file, $destination_file ) { + $source_handle = ai1wm_open( $source_file, 'rb' ); + $destination_handle = ai1wm_open( $destination_file, 'ab' ); + while ( $buffer = ai1wm_read( $source_handle, 4096 ) ) { + ai1wm_write( $destination_handle, $buffer ); + } + ai1wm_close( $source_handle ); + ai1wm_close( $destination_handle ); +} + +/** + * Get the size of file in bytes + * + * This method supports files > 2GB on PHP x86 + * + * @param string $file_path Path to the file + * @param boolean $as_string Return the filesize as string instead of BigInteger + * + * @return mixed Math_BigInteger|string|null + */ +function ai1wm_filesize( $file_path, $as_string = true ) { + $chunk_size = 2000000; // 2MB + $file_size = new Math_BigInteger( 0 ); + + try { + $file_handle = ai1wm_open( $file_path, 'rb' ); + + while ( ! feof( $file_handle ) ) { + $bytes = ai1wm_read( $file_handle, $chunk_size ); + $file_size = $file_size->add( new Math_BigInteger( strlen( $bytes ) ) ); + } + + ai1wm_close( $file_handle ); + + return $as_string ? $file_size->toString() : $file_size; + } catch ( Exception $e ) { + return null; + } +} + +/** + * Return the smaller of two numbers + * + * @param Math_BigInteger $a First number + * @param Math_BigInteger $b Second number + * + * @return Math_BigInteger + */ +function ai1wm_find_smaller_number( Math_BigInteger $a, Math_BigInteger $b ) { + if ( $a->compare( $b ) === -1 ) { + return $a; + } + + return $b; +} + +/** + * Check whether file size is supported by current PHP version + * + * @param string $file Path to file + * @param integer $php_int_size Size of PHP integer + * @return boolean $php_int_max Max value of PHP integer + */ +function ai1wm_is_filesize_supported( $file, $php_int_size = PHP_INT_SIZE, $php_int_max = PHP_INT_MAX ) { + $size_result = true; + + // Check whether file size is less than 2GB in PHP 32bits + if ( $php_int_size === 4 ) { + if ( ( $file_handle = @fopen( $file, 'r' ) ) ) { + if ( @fseek( $file_handle, $php_int_max, SEEK_SET ) !== -1 ) { + if ( @fgetc( $file_handle ) !== false ) { + $size_result = false; + } + } + + @fclose( $file_handle ); + } + } + + return $size_result; +} + +/** + * Wrapper around fseek + * + * This function works with offsets that are > PHP_INT_MAX + * + * @param resource $file_handle Handle to the file + * @param Math_BigInteger $offset Offset of the file + */ +function ai1wm_fseek( $file_handle, Math_BigInteger $offset ) { + $chunk_size = ai1wm_find_smaller_number( new Math_BigInteger( 2000000 ), $offset ); + while ( ! feof( $file_handle ) && $offset->toString() != '0' ) { + $bytes = ai1wm_read( $file_handle, $chunk_size->toInteger() ); + $offset = $offset->subtract( new Math_BigInteger( strlen( $bytes ) ) ); + $chunk_size = ai1wm_find_smaller_number( $chunk_size, $offset ); + } +} + +/** + * Verify secret key + * + * @param string $secret_key Secret key + * @return boolean + * @throws Ai1wm_Not_Valid_Secret_Key_Exception + */ +function ai1wm_verify_secret_key( $secret_key ) { + if ( $secret_key !== get_option( AI1WM_SECRET_KEY ) ) { + throw new Ai1wm_Not_Valid_Secret_Key_Exception( __( 'Unable to authenticate the secret key. Technical details', AI1WM_PLUGIN_NAME ) ); + } + + return true; +} + +/** + * Is scheduled backup? + * + * @return boolean + */ +function ai1wm_is_scheduled_backup() { + if ( isset( $_GET['ai1wm_manual_export'] ) || isset( $_POST['ai1wm_manual_export'] ) ) { + return false; + } + + if ( isset( $_GET['ai1wm_manual_import'] ) || isset( $_POST['ai1wm_manual_import'] ) ) { + return false; + } + + if ( isset( $_GET['ai1wm_manual_restore'] ) || isset( $_POST['ai1wm_manual_restore'] ) ) { + return false; + } + + return true; +} + +/** + * PHP setup environment + * + * @return void + */ +function ai1wm_setup_environment() { + // Set whether a client disconnect should abort script execution + @ignore_user_abort( true ); + + // Set maximum execution time + @set_time_limit( 0 ); + + // Set maximum time in seconds a script is allowed to parse input data + @ini_set( 'max_input_time', '-1' ); + + // Set maximum backtracking steps + @ini_set( 'pcre.backtrack_limit', PHP_INT_MAX ); + + // Set binary safe encoding + if ( @function_exists( 'mb_internal_encoding' ) && ( @ini_get( 'mbstring.func_overload' ) & 2 ) ) { + @mb_internal_encoding( 'ISO-8859-1' ); + } + + // Set error handler + @set_error_handler( 'Ai1wm_Handler::error' ); + + // Set shutdown handler + @register_shutdown_function( 'Ai1wm_Handler::shutdown' ); +} diff --git a/lib/controller/class-ai1wm-backups-controller.php b/lib/controller/class-ai1wm-backups-controller.php new file mode 100644 index 0000000..e8ea449 --- /dev/null +++ b/lib/controller/class-ai1wm-backups-controller.php @@ -0,0 +1,80 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Backups_Controller { + + public static function index() { + $model = new Ai1wm_Backups; + + Ai1wm_Template::render( + 'backups/index', + array( + 'backups' => $model->get_files(), + 'username' => get_option( AI1WM_AUTH_USER ), + 'password' => get_option( AI1WM_AUTH_PASSWORD ), + ) + ); + } + + public static function delete( $params = array() ) { + $errors = array(); + + // Set params + if ( empty( $params ) ) { + $params = stripslashes_deep( $_POST ); + } + + // Set secret key + $secret_key = null; + if ( isset( $params['secret_key'] ) ) { + $secret_key = trim( $params['secret_key'] ); + } + + // Set archive + $archive = null; + if ( isset( $params['archive'] ) ) { + $archive = trim( $params['archive'] ); + } + + try { + // Ensure that unauthorized people cannot access delete action + ai1wm_verify_secret_key( $secret_key ); + } catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) { + exit; + } + + $model = new Ai1wm_Backups; + + try { + // Delete file + $model->delete_file( $archive ); + } catch ( Exception $e ) { + $errors[] = $e->getMessage(); + } + + echo json_encode( array( 'errors' => $errors ) ); + exit; + } +} diff --git a/lib/controller/class-ai1wm-export-controller.php b/lib/controller/class-ai1wm-export-controller.php new file mode 100644 index 0000000..7d5327f --- /dev/null +++ b/lib/controller/class-ai1wm-export-controller.php @@ -0,0 +1,147 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Export_Controller { + + public static function index() { + Ai1wm_Template::render( 'export/index' ); + } + + public static function export( $params = array() ) { + global $wp_filter; + + ai1wm_setup_environment(); + + // Set params + if ( empty( $params ) ) { + $params = stripslashes_deep( array_merge( $_GET, $_POST ) ); + } + + // Set priority + $priority = 5; + if ( isset( $params['priority'] ) ) { + $priority = (int) $params['priority']; + } + + // Set secret key + $secret_key = null; + if ( isset( $params['secret_key'] ) ) { + $secret_key = trim( $params['secret_key'] ); + } + + try { + // Ensure that unauthorized people cannot access export action + ai1wm_verify_secret_key( $secret_key ); + } catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) { + exit; + } + + // Get hook + if ( isset( $wp_filter['ai1wm_export'] ) && ( $filters = $wp_filter['ai1wm_export'] ) ) { + // WordPress 4.7 introduces new class for working with filters/actions called WP_Hook + // which adds another level of abstraction and we need to address it. + if ( isset( $filters->callbacks ) ) { + $filters = $filters->callbacks; + } + + ksort( $filters ); + + // Loop over filters + while ( $hooks = current( $filters ) ) { + if ( $priority === key( $filters ) ) { + foreach ( $hooks as $hook ) { + try { + + // Run function hook + $params = call_user_func_array( $hook['function'], array( $params ) ); + + // Log request + Ai1wm_Log::export( $params ); + + } catch ( Exception $e ) { + Ai1wm_Status::error( __( 'Unable to export', AI1WM_PLUGIN_NAME ), $e->getMessage() ); + Ai1wm_Notification::error( __( 'Unable to export', AI1WM_PLUGIN_NAME ), $e->getMessage() ); + Ai1wm_Directory::delete( ai1wm_storage_path( $params ) ); + exit; + } + } + + // Set completed + $completed = true; + if ( isset( $params['completed'] ) ) { + $completed = (bool) $params['completed']; + } + + // Do request + if ( $completed === false || ( $next = next( $filters ) ) && ( $params['priority'] = key( $filters ) ) ) { + if ( isset( $params['ai1wm_manual_export'] ) ) { + echo json_encode( $params ); + exit; + } + + wp_remote_post( apply_filters( 'ai1wm_http_export_url', admin_url( 'admin-ajax.php?action=ai1wm_export' ) ), array( + 'timeout' => apply_filters( 'ai1wm_http_export_timeout', 5 ), + 'blocking' => apply_filters( 'ai1wm_http_export_blocking', false ), + 'sslverify' => apply_filters( 'ai1wm_http_export_sslverify', false ), + 'headers' => apply_filters( 'ai1wm_http_export_headers', array() ), + 'body' => apply_filters( 'ai1wm_http_export_body', $params ), + ) ); + exit; + } + } + + next( $filters ); + } + } + } + + public static function buttons() { + return array( + apply_filters( 'ai1wm_export_file', Ai1wm_Template::get_content( 'export/button-file' ) ), + apply_filters( 'ai1wm_export_ftp', Ai1wm_Template::get_content( 'export/button-ftp' ) ), + apply_filters( 'ai1wm_export_dropbox', Ai1wm_Template::get_content( 'export/button-dropbox' ) ), + apply_filters( 'ai1wm_export_gdrive', Ai1wm_Template::get_content( 'export/button-gdrive' ) ), + apply_filters( 'ai1wm_export_s3', Ai1wm_Template::get_content( 'export/button-s3' ) ), + apply_filters( 'ai1wm_export_b2', Ai1wm_Template::get_content( 'export/button-b2' ) ), + apply_filters( 'ai1wm_export_onedrive', Ai1wm_Template::get_content( 'export/button-onedrive' ) ), + apply_filters( 'ai1wm_export_box', Ai1wm_Template::get_content( 'export/button-box' ) ), + apply_filters( 'ai1wm_export_mega', Ai1wm_Template::get_content( 'export/button-mega' ) ), + apply_filters( 'ai1wm_export_digitalocean', Ai1wm_Template::get_content( 'export/button-digitalocean' ) ), + apply_filters( 'ai1wm_export_gcloud_storage', Ai1wm_Template::get_content( 'export/button-gcloud-storage' ) ), + apply_filters( 'ai1wm_export_azure_storage', Ai1wm_Template::get_content( 'export/button-azure-storage' ) ), + apply_filters( 'ai1wm_export_glacier', Ai1wm_Template::get_content( 'export/button-glacier' ) ), + ); + } + + public static function http_export_headers( $headers = array() ) { + if ( ( $user = get_option( AI1WM_AUTH_USER ) ) && ( $password = get_option( AI1WM_AUTH_PASSWORD ) ) ) { + if ( ( $hash = base64_encode( sprintf( '%s:%s', $user, $password ) ) ) ) { + $headers['Authorization'] = sprintf( 'Basic %s', $hash ); + } + } + + return $headers; + } +} diff --git a/lib/controller/class-ai1wm-feedback-controller.php b/lib/controller/class-ai1wm-feedback-controller.php new file mode 100644 index 0000000..4b4a931 --- /dev/null +++ b/lib/controller/class-ai1wm-feedback-controller.php @@ -0,0 +1,80 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Feedback_Controller { + + public static function feedback( $params = array() ) { + + // Set params + if ( empty( $params ) ) { + $params = stripslashes_deep( $_POST ); + } + + // Set secret key + $secret_key = null; + if ( isset( $params['secret_key'] ) ) { + $secret_key = trim( $params['secret_key'] ); + } + + // Set type + $type = null; + if ( isset( $params['ai1wm_type'] ) ) { + $type = trim( $params['ai1wm_type'] ); + } + + // Set e-mail + $email = null; + if ( isset( $params['ai1wm_email'] ) ) { + $email = trim( $params['ai1wm_email'] ); + } + + // Set message + $message = null; + if ( isset( $params['ai1wm_message'] ) ) { + $message = trim( $params['ai1wm_message'] ); + } + + // Set terms + $terms = false; + if ( isset( $params['ai1wm_terms'] ) ) { + $terms = (bool) $params['ai1wm_terms']; + } + + try { + // Ensure that unauthorized people cannot access feedback action + ai1wm_verify_secret_key( $secret_key ); + } catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) { + exit; + } + + $model = new Ai1wm_Feedback; + + // Send feedback + $errors = $model->add( $type, $email, $message, $terms ); + + echo json_encode( array( 'errors' => $errors ) ); + exit; + } +} diff --git a/lib/controller/class-ai1wm-import-controller.php b/lib/controller/class-ai1wm-import-controller.php new file mode 100644 index 0000000..8bc5956 --- /dev/null +++ b/lib/controller/class-ai1wm-import-controller.php @@ -0,0 +1,160 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Import_Controller { + + public static function index() { + Ai1wm_Template::render( 'import/index' ); + } + + public static function import( $params = array() ) { + global $wp_filter; + + ai1wm_setup_environment(); + + // Set params + if ( empty( $params ) ) { + $params = stripslashes_deep( array_merge( $_GET, $_POST ) ); + } + + // Set priority + $priority = 10; + if ( isset( $params['priority'] ) ) { + $priority = (int) $params['priority']; + } + + // Set secret key + $secret_key = null; + if ( isset( $params['secret_key'] ) ) { + $secret_key = trim( $params['secret_key'] ); + } + + try { + // Ensure that unauthorized people cannot access import action + ai1wm_verify_secret_key( $secret_key ); + } catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) { + exit; + } + + // Get hook + if ( isset( $wp_filter['ai1wm_import'] ) && ( $filters = $wp_filter['ai1wm_import'] ) ) { + // WordPress 4.7 introduces new class for working with filters/actions called WP_Hook + // which adds another level of abstraction and we need to address it. + if ( isset( $filters->callbacks ) ) { + $filters = $filters->callbacks; + } + + ksort( $filters ); + + // Loop over filters + while ( $hooks = current( $filters ) ) { + if ( $priority === key( $filters ) ) { + foreach ( $hooks as $hook ) { + try { + + // Run function hook + $params = call_user_func_array( $hook['function'], array( $params ) ); + + // Log request + Ai1wm_Log::import( $params ); + + } catch ( Ai1wm_Import_Retry_Exception $e ) { + status_header( $e->getCode() ); + echo json_encode( array( 'errors' => array( array( 'code' => $e->getCode(), 'message' => $e->getMessage() ) ) ) ); + exit; + } catch ( Exception $e ) { + Ai1wm_Status::error( __( 'Unable to import', AI1WM_PLUGIN_NAME ), $e->getMessage() ); + Ai1wm_Notification::error( __( 'Unable to import', AI1WM_PLUGIN_NAME ), $e->getMessage() ); + Ai1wm_Directory::delete( ai1wm_storage_path( $params ) ); + exit; + } + } + + // Set completed + $completed = true; + if ( isset( $params['completed'] ) ) { + $completed = (bool) $params['completed']; + } + + // Do request + if ( $completed === false || ( $next = next( $filters ) ) && ( $params['priority'] = key( $filters ) ) ) { + if ( isset( $params['ai1wm_manual_import'] ) || isset( $params['ai1wm_manual_restore'] ) ) { + echo json_encode( $params ); + exit; + } + + wp_remote_post( apply_filters( 'ai1wm_http_import_url', admin_url( 'admin-ajax.php?action=ai1wm_import' ) ), array( + 'timeout' => apply_filters( 'ai1wm_http_import_timeout', 5 ), + 'blocking' => apply_filters( 'ai1wm_http_import_blocking', false ), + 'sslverify' => apply_filters( 'ai1wm_http_import_sslverify', false ), + 'headers' => apply_filters( 'ai1wm_http_import_headers', array() ), + 'body' => apply_filters( 'ai1wm_http_import_body', $params ), + ) ); + exit; + } + } + + next( $filters ); + } + } + } + + public static function buttons() { + return array( + apply_filters( 'ai1wm_import_file', Ai1wm_Template::get_content( 'import/button-file' ) ), + apply_filters( 'ai1wm_import_url', Ai1wm_Template::get_content( 'import/button-url' ) ), + apply_filters( 'ai1wm_import_ftp', Ai1wm_Template::get_content( 'import/button-ftp' ) ), + apply_filters( 'ai1wm_import_dropbox', Ai1wm_Template::get_content( 'import/button-dropbox' ) ), + apply_filters( 'ai1wm_import_gdrive', Ai1wm_Template::get_content( 'import/button-gdrive' ) ), + apply_filters( 'ai1wm_import_s3', Ai1wm_Template::get_content( 'import/button-s3' ) ), + apply_filters( 'ai1wm_import_b2', Ai1wm_Template::get_content( 'import/button-b2' ) ), + apply_filters( 'ai1wm_import_onedrive', Ai1wm_Template::get_content( 'import/button-onedrive' ) ), + apply_filters( 'ai1wm_import_box', Ai1wm_Template::get_content( 'import/button-box' ) ), + apply_filters( 'ai1wm_import_mega', Ai1wm_Template::get_content( 'import/button-mega' ) ), + apply_filters( 'ai1wm_import_digitalocean', Ai1wm_Template::get_content( 'import/button-digitalocean' ) ), + apply_filters( 'ai1wm_import_gcloud_storage', Ai1wm_Template::get_content( 'import/button-gcloud-storage' ) ), + apply_filters( 'ai1wm_import_azure_storage', Ai1wm_Template::get_content( 'import/button-azure-storage' ) ), + apply_filters( 'ai1wm_import_glacier', Ai1wm_Template::get_content( 'import/button-glacier' ) ), + ); + } + + public static function http_import_headers( $headers = array() ) { + if ( ( $user = get_option( AI1WM_AUTH_USER ) ) && ( $password = get_option( AI1WM_AUTH_PASSWORD ) ) ) { + if ( ( $hash = base64_encode( sprintf( '%s:%s', $user, $password ) ) ) ) { + $headers['Authorization'] = sprintf( 'Basic %s', $hash ); + } + } + + return $headers; + } + + public static function max_chunk_size() { + return min( + ai1wm_parse_size( ini_get( 'post_max_size' ), AI1WM_MAX_CHUNK_SIZE ), + ai1wm_parse_size( ini_get( 'upload_max_filesize' ), AI1WM_MAX_CHUNK_SIZE ), + ai1wm_parse_size( AI1WM_MAX_CHUNK_SIZE ) + ); + } +} diff --git a/lib/controller/class-ai1wm-main-controller.php b/lib/controller/class-ai1wm-main-controller.php new file mode 100644 index 0000000..ee18186 --- /dev/null +++ b/lib/controller/class-ai1wm-main-controller.php @@ -0,0 +1,938 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Main_Controller { + + /** + * Main Application Controller + * + * @return Ai1wm_Main_Controller + */ + public function __construct() { + register_activation_hook( AI1WM_PLUGIN_BASENAME, array( $this, 'activation_hook' ) ); + + // Activate hooks + $this->activate_actions(); + $this->activate_filters(); + $this->activate_textdomain(); + } + + /** + * Activation hook callback + * + * @return void + */ + public function activation_hook() { + if ( is_dir( AI1WM_BACKUPS_PATH ) ) { + $this->create_backups_htaccess( AI1WM_BACKUPS_HTACCESS ); + $this->create_backups_webconfig( AI1WM_BACKUPS_WEBCONFIG ); + $this->create_backups_index( AI1WM_BACKUPS_INDEX ); + } + + if ( extension_loaded( 'litespeed' ) ) { + $this->create_litespeed_htaccess( AI1WM_WORDPRESS_HTACCESS ); + } + } + + /** + * Initializes language domain for the plugin + * + * @return void + */ + private function activate_textdomain() { + load_plugin_textdomain( AI1WM_PLUGIN_NAME, false, false ); + } + + /** + * Register listeners for actions + * + * @return void + */ + private function activate_actions() { + // Init + add_action( 'admin_init', array( $this, 'init' ) ); + + // Router + add_action( 'admin_init', array( $this, 'router' ) ); + + // Setup folders + add_action( 'admin_init', array( $this, 'setup_folders' ) ); + + // Admin header + add_action( 'admin_head', array( $this, 'admin_head' ) ); + + // All in One WP Migration + add_action( 'plugins_loaded', array( $this, 'ai1wm_loaded' ), 10 ); + + // Export and import commands + add_action( 'plugins_loaded', array( $this, 'ai1wm_commands' ), 10 ); + + // Export and import buttons + add_action( 'plugins_loaded', array( $this, 'ai1wm_buttons' ), 10 ); + + // Register scripts and styles + add_action( 'admin_enqueue_scripts', array( $this, 'register_scripts_and_styles' ), 5 ); + + // Enqueue export scripts and styles + add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_export_scripts_and_styles' ), 5 ); + + // Enqueue import scripts and styles + add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_import_scripts_and_styles' ), 5 ); + + // Enqueue backups scripts and styles + add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_backups_scripts_and_styles' ), 5 ); + + // Enqueue updater scripts and styles + add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_updater_scripts_and_styles' ), 5 ); + } + + /** + * Register listeners for filters + * + * @return void + */ + private function activate_filters() { + // Add links to plugin list page + add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 ); + + // Add custom schedules + add_filter( 'cron_schedules', array( $this, 'add_cron_schedules' ), 9999 ); + } + + /** + * Export and import commands + * + * @return void + */ + public function ai1wm_commands() { + // Add export commands + add_filter( 'ai1wm_export', 'Ai1wm_Export_Init::execute', 5 ); + add_filter( 'ai1wm_export', 'Ai1wm_Export_Compatibility::execute', 5 ); + add_filter( 'ai1wm_export', 'Ai1wm_Export_Archive::execute', 10 ); + add_filter( 'ai1wm_export', 'Ai1wm_Export_Config::execute', 50 ); + add_filter( 'ai1wm_export', 'Ai1wm_Export_Config_File::execute', 60 ); + add_filter( 'ai1wm_export', 'Ai1wm_Export_Enumerate::execute', 100 ); + add_filter( 'ai1wm_export', 'Ai1wm_Export_Content::execute', 150 ); + add_filter( 'ai1wm_export', 'Ai1wm_Export_Database::execute', 200 ); + add_filter( 'ai1wm_export', 'Ai1wm_Export_Database_File::execute', 220 ); + add_filter( 'ai1wm_export', 'Ai1wm_Export_Download::execute', 250 ); + add_filter( 'ai1wm_export', 'Ai1wm_Export_Clean::execute', 300 ); + + // Add import commands + add_filter( 'ai1wm_import', 'Ai1wm_Import_Upload::execute', 5 ); + add_filter( 'ai1wm_import', 'Ai1wm_Import_Compatibility::execute', 10 ); + add_filter( 'ai1wm_import', 'Ai1wm_Import_Validate::execute', 50 ); + add_filter( 'ai1wm_import', 'Ai1wm_Import_Confirm::execute', 100 ); + add_filter( 'ai1wm_import', 'Ai1wm_Import_Blogs::execute', 150 ); + add_filter( 'ai1wm_import', 'Ai1wm_Import_Enumerate::execute', 200 ); + add_filter( 'ai1wm_import', 'Ai1wm_Import_Content::execute', 250 ); + add_filter( 'ai1wm_import', 'Ai1wm_Import_Mu_Plugins::execute', 270 ); + add_filter( 'ai1wm_import', 'Ai1wm_Import_Database::execute', 300 ); + add_filter( 'ai1wm_import', 'Ai1wm_Import_Done::execute', 350 ); + add_filter( 'ai1wm_import', 'Ai1wm_Import_Clean::execute', 400 ); + } + + /** + * Export and import buttons + * + * @return void + */ + public function ai1wm_buttons() { + // Add export buttons + add_filter( 'ai1wm_export_buttons', 'Ai1wm_Export_Controller::buttons' ); + + // Add import buttons + add_filter( 'ai1wm_import_buttons', 'Ai1wm_Import_Controller::buttons' ); + } + + /** + * All in One WP Migration loaded + * + * @return void + */ + public function ai1wm_loaded() { + if ( ! defined( 'AI1WMME_PLUGIN_NAME' ) ) { + if ( is_multisite() ) { + add_action( 'network_admin_notices', array( $this, 'multisite_notice' ) ); + } else { + add_action( 'admin_menu', array( $this, 'admin_menu' ) ); + } + } else { + if ( is_multisite() ) { + add_action( 'network_admin_menu', array( $this, 'admin_menu' ) ); + } else { + add_action( 'admin_menu', array( $this, 'admin_menu' ) ); + } + } + + // Add automatic plugins update + add_action( 'wp_maybe_auto_update', 'Ai1wm_Updater_Controller::check_for_updates' ); + + // Add HTTP export headers + add_filter( 'ai1wm_http_export_headers', 'Ai1wm_Export_Controller::http_export_headers' ); + + // Add HTTP import headers + add_filter( 'ai1wm_http_import_headers', 'Ai1wm_Import_Controller::http_import_headers' ); + + // Add chunk size limit + add_filter( 'ai1wm_max_chunk_size', 'Ai1wm_Import_Controller::max_chunk_size' ); + + // Add plugins api + add_filter( 'plugins_api', 'Ai1wm_Updater_Controller::plugins_api', 20, 3 ); + + // Add plugins updates + add_filter( 'pre_set_site_transient_update_plugins', 'Ai1wm_Updater_Controller::pre_update_plugins' ); + + // Add plugins metadata + add_filter( 'site_transient_update_plugins', 'Ai1wm_Updater_Controller::update_plugins' ); + + // Add "Check for updates" link to plugin list page + add_filter( 'plugin_row_meta', 'Ai1wm_Updater_Controller::plugin_row_meta', 10, 2 ); + } + + /** + * Create folders and files needed for plugin operation, if they don't exist + * + * @return void + */ + public function setup_folders() { + // Check if storage folder is created + if ( ! is_dir( AI1WM_STORAGE_PATH ) ) { + $this->create_storage_folder( AI1WM_STORAGE_PATH ); + } + + // Check if backups folder is created + if ( ! is_dir( AI1WM_BACKUPS_PATH ) ) { + $this->create_backups_folder( AI1WM_BACKUPS_PATH ); + } + + // Check if index.php is created in storage folder + if ( ! is_file( AI1WM_STORAGE_INDEX ) ) { + $this->create_storage_index( AI1WM_STORAGE_INDEX ); + } + + // Check if index.php is created in backups folder + if ( ! is_file( AI1WM_BACKUPS_INDEX ) ) { + $this->create_backups_index( AI1WM_BACKUPS_INDEX ); + } + + // Check if .htaccess is created in backups folder + if ( ! is_file( AI1WM_BACKUPS_HTACCESS ) ) { + $this->create_backups_htaccess( AI1WM_BACKUPS_HTACCESS ); + } + + // Check if web.config is created in backups folder + if ( ! is_file( AI1WM_BACKUPS_WEBCONFIG ) ) { + $this->create_backups_webconfig( AI1WM_BACKUPS_WEBCONFIG ); + } + } + + /** + * Create storage folder + * + * @param string Path to folder + * @return void + */ + public function create_storage_folder( $path ) { + if ( ! Ai1wm_Directory::create( $path ) ) { + if ( is_multisite() ) { + return add_action( 'network_admin_notices', array( $this, 'storage_path_notice' ) ); + } else { + return add_action( 'admin_notices', array( $this, 'storage_path_notice' ) ); + } + } + } + + /** + * Create backups folder + * + * @param string Path to folder + * @return void + */ + public function create_backups_folder( $path ) { + if ( ! Ai1wm_Directory::create( $path ) ) { + if ( is_multisite() ) { + return add_action( 'network_admin_notices', array( $this, 'backups_path_notice' ) ); + } else { + return add_action( 'admin_notices', array( $this, 'backups_path_notice' ) ); + } + } + } + + /** + * Create storage index.php file + * + * @param string Path to file + * @return void + */ + public function create_storage_index( $path ) { + if ( ! Ai1wm_File_Index::create( $path ) ) { + if ( is_multisite() ) { + return add_action( 'network_admin_notices', array( $this, 'storage_index_notice' ) ); + } else { + return add_action( 'admin_notices', array( $this, 'storage_index_notice' ) ); + } + } + } + + /** + * Create backups .htaccess file + * + * @param string Path to file + * @return void + */ + public function create_backups_htaccess( $path ) { + if ( ! Ai1wm_File_Htaccess::create( $path ) ) { + if ( is_multisite() ) { + return add_action( 'network_admin_notices', array( $this, 'backups_htaccess_notice' ) ); + } else { + return add_action( 'admin_notices', array( $this, 'backups_htaccess_notice' ) ); + } + } + } + + /** + * Create backups web.config file + * + * @param string Path to file + * @return void + */ + public function create_backups_webconfig( $path ) { + if ( ! Ai1wm_File_Webconfig::create( $path ) ) { + if ( is_multisite() ) { + return add_action( 'network_admin_notices', array( $this, 'backups_webconfig_notice' ) ); + } else { + return add_action( 'admin_notices', array( $this, 'backups_webconfig_notice' ) ); + } + } + } + + /** + * Create backups index.php file + * + * @param string Path to file + * @return void + */ + public function create_backups_index( $path ) { + if ( ! Ai1wm_File_Index::create( $path ) ) { + if ( is_multisite() ) { + return add_action( 'network_admin_notices', array( $this, 'backups_index_notice' ) ); + } else { + return add_action( 'admin_notices', array( $this, 'backups_index_notice' ) ); + } + } + } + + /** + * If the "noabort" environment variable has been set, + * the script will continue to run even though the connection has been broken + * + * @return void + */ + public function create_litespeed_htaccess( $path ) { + if ( ! Ai1wm_File_Htaccess::litespeed( $path ) ) { + if ( is_multisite() ) { + return add_action( 'network_admin_notices', array( $this, 'wordpress_htaccess_notice' ) ); + } else { + return add_action( 'admin_notices', array( $this, 'wordpress_htaccess_notice' ) ); + } + } + } + + /** + * Display multisite notice + * + * @return void + */ + public function multisite_notice() { + Ai1wm_Template::render( 'main/multisite-notice' ); + } + + /** + * Display notice for storage directory + * + * @return void + */ + public function storage_path_notice() { + Ai1wm_Template::render( 'main/storage-path-notice' ); + } + + /** + * Display notice for index file in storage directory + * + * @return void + */ + public function storage_index_notice() { + Ai1wm_Template::render( 'main/storage-index-notice' ); + } + + /** + * Display notice for backups directory + * + * @return void + */ + public function backups_path_notice() { + Ai1wm_Template::render( 'main/backups-path-notice' ); + } + + /** + * Display notice for .htaccess file in backups directory + * + * @return void + */ + public function backups_htaccess_notice() { + Ai1wm_Template::render( 'main/backups-htaccess-notice' ); + } + + /** + * Display notice for web.config file in backups directory + * + * @return void + */ + public function backups_webconfig_notice() { + Ai1wm_Template::render( 'main/backups-webconfig-notice' ); + } + + /** + * Display notice for index file in backups directory + * + * @return void + */ + public function backups_index_notice() { + Ai1wm_Template::render( 'main/backups-index-notice' ); + } + + /** + * Display notice for .htaccess file in WordPress directory + * + * @return void + */ + public function wordpress_htaccess_notice() { + Ai1wm_Template::render( 'main/wordpress-htaccess-notice' ); + } + + /** + * Add links to plugin list page + * + * @return array + */ + public function plugin_row_meta( $links, $file ) { + if ( $file == AI1WM_PLUGIN_BASENAME ) { + $links[] = Ai1wm_Template::get_content( 'main/get-support' ); + } + + return $links; + } + + /** + * Register plugin menus + * + * @return void + */ + public function admin_menu() { + // Top-level WP Migration menu + add_menu_page( + 'All-in-One WP Migration', + 'All-in-One WP Migration', + 'export', + 'ai1wm_export', + 'Ai1wm_Export_Controller::index', + '', + '76.295' + ); + + // Sub-level Export menu + add_submenu_page( + 'ai1wm_export', + __( 'Export', AI1WM_PLUGIN_NAME ), + __( 'Export', AI1WM_PLUGIN_NAME ), + 'export', + 'ai1wm_export', + 'Ai1wm_Export_Controller::index' + ); + + // Sub-level Import menu + add_submenu_page( + 'ai1wm_export', + __( 'Import', AI1WM_PLUGIN_NAME ), + __( 'Import', AI1WM_PLUGIN_NAME ), + 'import', + 'ai1wm_import', + 'Ai1wm_Import_Controller::index' + ); + + // Sub-level Backups menu + add_submenu_page( + 'ai1wm_export', + __( 'Backups', AI1WM_PLUGIN_NAME ), + __( 'Backups', AI1WM_PLUGIN_NAME ), + 'import', + 'ai1wm_backups', + 'Ai1wm_Backups_Controller::index' + ); + } + + /** + * Register scripts and styles + * + * @return void + */ + public function register_scripts_and_styles() { + if ( is_rtl() ) { + wp_register_style( + 'ai1wm_servmask', + Ai1wm_Template::asset_link( 'css/servmask.min.rtl.css' ) + ); + } else { + wp_register_style( + 'ai1wm_servmask', + Ai1wm_Template::asset_link( 'css/servmask.min.css' ) + ); + } + + wp_register_script( + 'ai1wm_util', + Ai1wm_Template::asset_link( 'javascript/util.min.js' ), + array( 'jquery' ) + ); + + wp_register_script( + 'ai1wm_feedback', + Ai1wm_Template::asset_link( 'javascript/feedback.min.js' ), + array( 'ai1wm_util' ) + ); + + wp_register_script( + 'ai1wm_report', + Ai1wm_Template::asset_link( 'javascript/report.min.js' ), + array( 'ai1wm_util' ) + ); + } + + /** + * Enqueue scripts and styles for Export Controller + * + * @param string $hook Hook suffix + * @return void + */ + public function enqueue_export_scripts_and_styles( $hook ) { + if ( stripos( 'toplevel_page_ai1wm_export', $hook ) === false ) { + return; + } + + // We don't want heartbeat to occur when exporting + wp_deregister_script( 'heartbeat' ); + + // We don't want auth check for monitoring whether the user is still logged in + remove_action( 'admin_enqueue_scripts', 'wp_auth_check_load' ); + + if ( is_rtl() ) { + wp_enqueue_style( + 'ai1wm_export', + Ai1wm_Template::asset_link( 'css/export.min.rtl.css' ) + ); + } else { + wp_enqueue_style( + 'ai1wm_export', + Ai1wm_Template::asset_link( 'css/export.min.css' ) + ); + } + + wp_enqueue_script( + 'ai1wm_export', + Ai1wm_Template::asset_link( 'javascript/export.min.js' ), + array( 'ai1wm_util' ) + ); + + wp_localize_script( 'ai1wm_export', 'ai1wm_feedback', array( + 'ajax' => array( + 'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_feedback' ) ), + ), + 'secret_key' => get_option( AI1WM_SECRET_KEY ), + ) ); + + wp_localize_script( 'ai1wm_export', 'ai1wm_report', array( + 'ajax' => array( + 'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_report' ) ), + ), + 'secret_key' => get_option( AI1WM_SECRET_KEY ), + ) ); + + wp_localize_script( 'ai1wm_export', 'ai1wm_export', array( + 'ajax' => array( + 'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_export' ) ), + ), + 'status' => array( + 'url' => wp_make_link_relative( add_query_arg( array( 'secret_key' => get_option( AI1WM_SECRET_KEY ) ), admin_url( 'admin-ajax.php?action=ai1wm_status' ) ) ), + ), + 'secret_key' => get_option( AI1WM_SECRET_KEY ), + ) ); + + wp_localize_script( 'ai1wm_export', 'ai1wm_locale', array( + 'stop_exporting_your_website' => __( 'You are about to stop exporting your website, are you sure?', AI1WM_PLUGIN_NAME ), + 'preparing_to_export' => __( 'Preparing to export...', AI1WM_PLUGIN_NAME ), + 'unable_to_export' => __( 'Unable to export', AI1WM_PLUGIN_NAME ), + 'unable_to_start_the_export' => __( 'Unable to start the export. Refresh the page and try again', AI1WM_PLUGIN_NAME ), + 'unable_to_run_the_export' => __( 'Unable to run the export. Refresh the page and try again', AI1WM_PLUGIN_NAME ), + 'unable_to_stop_the_export' => __( 'Unable to stop the export. Refresh the page and try again', AI1WM_PLUGIN_NAME ), + 'please_wait_stopping_the_export' => __( 'Please wait, stopping the export...', AI1WM_PLUGIN_NAME ), + 'close_export' => __( 'Close', AI1WM_PLUGIN_NAME ), + 'stop_export' => __( 'Stop export', AI1WM_PLUGIN_NAME ), + 'leave_feedback' => __( 'Leave plugin developers any feedback here', AI1WM_PLUGIN_NAME ), + 'how_may_we_help_you' => __( 'How may we help you?', AI1WM_PLUGIN_NAME ), + 'thanks_for_submitting_your_feedback' => __( 'Thanks for submitting your feedback!', AI1WM_PLUGIN_NAME ), + 'thanks_for_submitting_your_request' => __( 'Thanks for submitting your request!', AI1WM_PLUGIN_NAME ), + ) ); + } + + /** + * Enqueue scripts and styles for Import Controller + * + * @param string $hook Hook suffix + * @return void + */ + public function enqueue_import_scripts_and_styles( $hook ) { + if ( stripos( 'all-in-one-wp-migration_page_ai1wm_import', $hook ) === false ) { + return; + } + + // We don't want heartbeat to occur when importing + wp_deregister_script( 'heartbeat' ); + + // We don't want auth check for monitoring whether the user is still logged in + remove_action( 'admin_enqueue_scripts', 'wp_auth_check_load' ); + + if ( is_rtl() ) { + wp_enqueue_style( + 'ai1wm_import', + Ai1wm_Template::asset_link( 'css/import.min.rtl.css' ) + ); + } else { + wp_enqueue_style( + 'ai1wm_import', + Ai1wm_Template::asset_link( 'css/import.min.css' ) + ); + } + + wp_enqueue_script( + 'ai1wm_import', + Ai1wm_Template::asset_link( 'javascript/import.min.js' ), + array( 'ai1wm_util' ) + ); + + wp_localize_script( 'ai1wm_import', 'ai1wm_feedback', array( + 'ajax' => array( + 'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_feedback' ) ), + ), + 'secret_key' => get_option( AI1WM_SECRET_KEY ), + ) ); + + wp_localize_script( 'ai1wm_import', 'ai1wm_report', array( + 'ajax' => array( + 'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_report' ) ), + ), + 'secret_key' => get_option( AI1WM_SECRET_KEY ), + ) ); + + wp_localize_script( 'ai1wm_import', 'ai1wm_uploader', array( + 'chunk_size' => apply_filters( 'ai1wm_max_chunk_size', AI1WM_MAX_CHUNK_SIZE ), + 'max_retries' => apply_filters( 'ai1wm_max_chunk_retries', AI1WM_MAX_CHUNK_RETRIES ), + 'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_import' ) ), + 'params' => array( + 'priority' => 5, + 'secret_key' => get_option( AI1WM_SECRET_KEY ), + ), + 'filters' => array( + 'ai1wm_archive_extension' => array( 'wpress' ), + 'ai1wm_archive_size' => apply_filters( 'ai1wm_max_file_size', AI1WM_MAX_FILE_SIZE ), + ), + ) ); + + wp_localize_script( 'ai1wm_import', 'ai1wm_import', array( + 'ajax' => array( + 'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_import' ) ), + ), + 'status' => array( + 'url' => wp_make_link_relative( add_query_arg( array( 'secret_key' => get_option( AI1WM_SECRET_KEY ) ), admin_url( 'admin-ajax.php?action=ai1wm_status' ) ) ), + ), + 'secret_key' => get_option( AI1WM_SECRET_KEY ), + ) ); + + wp_localize_script( 'ai1wm_import', 'ai1wm_locale', array( + 'stop_importing_your_website' => __( 'You are about to stop importing your website, are you sure?', AI1WM_PLUGIN_NAME ), + 'preparing_to_import' => __( 'Preparing to import...', AI1WM_PLUGIN_NAME ), + 'unable_to_import' => __( 'Unable to import', AI1WM_PLUGIN_NAME ), + 'unable_to_start_the_import' => __( 'Unable to start the import. Refresh the page and try again', AI1WM_PLUGIN_NAME ), + 'unable_to_confirm_the_import' => __( 'Unable to confirm the import. Refresh the page and try again', AI1WM_PLUGIN_NAME ), + 'unable_to_prepare_blogs_on_import' => __( 'Unable to prepare blogs on import. Refresh the page and try again', AI1WM_PLUGIN_NAME ), + 'unable_to_stop_the_import' => __( 'Unable to stop the import. Refresh the page and try again', AI1WM_PLUGIN_NAME ), + 'please_wait_stopping_the_export' => __( 'Please wait, stopping the import...', AI1WM_PLUGIN_NAME ), + 'close_import' => __( 'Close', AI1WM_PLUGIN_NAME ), + 'stop_import' => __( 'Stop import', AI1WM_PLUGIN_NAME ), + 'confirm_import' => __( 'Proceed', AI1WM_PLUGIN_NAME ), + 'continue_import' => __( 'Continue', AI1WM_PLUGIN_NAME ), + 'please_do_not_close_this_browser' => __( 'Please do not close this browser window or your import will fail', AI1WM_PLUGIN_NAME ), + 'leave_feedback' => __( 'Leave plugin developers any feedback here', AI1WM_PLUGIN_NAME ), + 'how_may_we_help_you' => __( 'How may we help you?', AI1WM_PLUGIN_NAME ), + 'thanks_for_submitting_your_feedback' => __( 'Thanks for submitting your feedback!', AI1WM_PLUGIN_NAME ), + 'thanks_for_submitting_your_request' => __( 'Thanks for submitting your request!', AI1WM_PLUGIN_NAME ), + 'problem_while_uploading_your_file' => __( 'We are sorry, there seems to be a problem while uploading your file. Follow this guide to resolve it.', AI1WM_PLUGIN_NAME ), + 'invalid_archive_extension' => __( + 'The file type that you have tried to upload is not compatible with this plugin. ' . + 'Please ensure that your file is a .wpress file that was created with the All-in-One WP migration plugin. ' . + 'Technical details', + AI1WM_PLUGIN_NAME + ), + 'invalid_archive_size' => sprintf( + __( + 'The file that you are trying to import is over the maximum upload file size limit of %s.
' . + 'You can remove this restriction by purchasing our ' . + 'Unlimited Extension.', + AI1WM_PLUGIN_NAME + ), + size_format( apply_filters( 'ai1wm_max_file_size', AI1WM_MAX_FILE_SIZE ) ) + ), + ) ); + } + + /** + * Enqueue scripts and styles for Backups Controller + * + * @param string $hook Hook suffix + * @return void + */ + public function enqueue_backups_scripts_and_styles( $hook ) { + if ( stripos( 'all-in-one-wp-migration_page_ai1wm_backups', $hook ) === false ) { + return; + } + + // We don't want heartbeat to occur when restoring + wp_deregister_script( 'heartbeat' ); + + // We don't want auth check for monitoring whether the user is still logged in + remove_action( 'admin_enqueue_scripts', 'wp_auth_check_load' ); + + if ( is_rtl() ) { + wp_enqueue_style( + 'ai1wm_backups', + Ai1wm_Template::asset_link( 'css/backups.min.rtl.css' ) + ); + } else { + wp_enqueue_style( + 'ai1wm_backups', + Ai1wm_Template::asset_link( 'css/backups.min.css' ) + ); + } + + wp_enqueue_script( + 'ai1wm_backups', + Ai1wm_Template::asset_link( 'javascript/backups.min.js' ), + array( 'ai1wm_util' ) + ); + + wp_localize_script( 'ai1wm_backups', 'ai1wm_feedback', array( + 'ajax' => array( + 'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_feedback' ) ), + ), + 'secret_key' => get_option( AI1WM_SECRET_KEY ), + ) ); + + wp_localize_script( 'ai1wm_backups', 'ai1wm_report', array( + 'ajax' => array( + 'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_report' ) ), + ), + 'secret_key' => get_option( AI1WM_SECRET_KEY ), + ) ); + + wp_localize_script( 'ai1wm_backups', 'ai1wm_import', array( + 'ajax' => array( + 'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_import' ) ), + ), + 'status' => array( + 'url' => wp_make_link_relative( add_query_arg( array( 'secret_key' => get_option( AI1WM_SECRET_KEY ) ), admin_url( 'admin-ajax.php?action=ai1wm_status' ) ) ), + ), + 'secret_key' => get_option( AI1WM_SECRET_KEY ), + ) ); + + wp_localize_script( 'ai1wm_backups', 'ai1wm_backups', array( + 'ajax' => array( + 'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_backups' ) ), + ), + 'secret_key' => get_option( AI1WM_SECRET_KEY ), + ) ); + + wp_localize_script( 'ai1wm_backups', 'ai1wm_locale', array( + 'stop_importing_your_website' => __( 'You are about to stop importing your website, are you sure?', AI1WM_PLUGIN_NAME ), + 'preparing_to_import' => __( 'Preparing to import...', AI1WM_PLUGIN_NAME ), + 'unable_to_import' => __( 'Unable to import', AI1WM_PLUGIN_NAME ), + 'unable_to_start_the_import' => __( 'Unable to start the import. Refresh the page and try again', AI1WM_PLUGIN_NAME ), + 'unable_to_confirm_the_import' => __( 'Unable to confirm the import. Refresh the page and try again', AI1WM_PLUGIN_NAME ), + 'unable_to_prepare_blogs_on_import' => __( 'Unable to prepare blogs on import. Refresh the page and try again', AI1WM_PLUGIN_NAME ), + 'unable_to_stop_the_import' => __( 'Unable to stop the import. Refresh the page and try again', AI1WM_PLUGIN_NAME ), + 'please_wait_stopping_the_export' => __( 'Please wait, stopping the import...', AI1WM_PLUGIN_NAME ), + 'close_import' => __( 'Close', AI1WM_PLUGIN_NAME ), + 'stop_import' => __( 'Stop import', AI1WM_PLUGIN_NAME ), + 'confirm_import' => __( 'Proceed', AI1WM_PLUGIN_NAME ), + 'continue_import' => __( 'Continue', AI1WM_PLUGIN_NAME ), + 'please_do_not_close_this_browser' => __( 'Please do not close this browser window or your import will fail', AI1WM_PLUGIN_NAME ), + 'leave_feedback' => __( 'Leave plugin developers any feedback here', AI1WM_PLUGIN_NAME ), + 'how_may_we_help_you' => __( 'How may we help you?', AI1WM_PLUGIN_NAME ), + 'thanks_for_submitting_your_feedback' => __( 'Thanks for submitting your feedback!', AI1WM_PLUGIN_NAME ), + 'thanks_for_submitting_your_request' => __( 'Thanks for submitting your request!', AI1WM_PLUGIN_NAME ), + 'want_to_delete_this_file' => __( 'Are you sure you want to delete this file?', AI1WM_PLUGIN_NAME ), + ) ); + } + + /** + * Enqueue scripts and styles for Updater Controller + * + * @param string $hook Hook suffix + * @return void + */ + public function enqueue_updater_scripts_and_styles( $hook ) { + if ( 'plugins.php' !== strtolower( $hook ) ) { + return; + } + + if ( is_rtl() ) { + wp_enqueue_style( + 'ai1wm_updater', + Ai1wm_Template::asset_link( 'css/updater.min.rtl.css' ) + ); + } else { + wp_enqueue_style( + 'ai1wm_updater', + Ai1wm_Template::asset_link( 'css/updater.min.css' ) + ); + } + + wp_enqueue_script( + 'ai1wm_updater', + Ai1wm_Template::asset_link( 'javascript/updater.min.js' ), + array( 'ai1wm_util' ) + ); + + wp_localize_script( 'ai1wm_updater', 'ai1wm_updater', array( + 'ajax' => array( + 'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_updater' ) ), + ), + ) ); + + wp_localize_script( 'ai1wm_updater', 'ai1wm_locale', array( + 'check_for_updates' => __( 'Check for updates', AI1WM_PLUGIN_NAME ), + 'invalid_purchase_id' => __( 'Your purchase ID is invalid, please contact us', AI1WM_PLUGIN_NAME ), + ) ); + } + + /** + * Outputs menu icon between head tags + * + * @return void + */ + public function admin_head() { + global $wp_version; + + // Admin header + Ai1wm_Template::render( 'main/admin-head', array( 'version' => $wp_version ) ); + } + + /** + * Register initial parameters + * + * @return void + */ + public function init() { + // Set secret key + if ( ! get_option( AI1WM_SECRET_KEY ) ) { + update_option( AI1WM_SECRET_KEY, wp_generate_password( 12, false ) ); + } + + // Set username + if ( isset( $_SERVER['PHP_AUTH_USER'] ) ) { + update_option( AI1WM_AUTH_USER, $_SERVER['PHP_AUTH_USER'] ); + } elseif ( isset( $_SERVER['REMOTE_USER'] ) ) { + update_option( AI1WM_AUTH_USER, $_SERVER['REMOTE_USER'] ); + } + + // Set password + if ( isset( $_SERVER['PHP_AUTH_PW'] ) ) { + update_option( AI1WM_AUTH_PASSWORD, $_SERVER['PHP_AUTH_PW'] ); + } + + // Check for updates + if ( isset( $_GET['ai1wm_updater'] ) ) { + if ( current_user_can( 'update_plugins' ) ) { + Ai1wm_Updater::check_for_updates(); + } + } + } + + /** + * Register initial router + * + * @return void + */ + public function router() { + // Public actions + add_action( 'wp_ajax_nopriv_ai1wm_export', 'Ai1wm_Export_Controller::export' ); + add_action( 'wp_ajax_nopriv_ai1wm_import', 'Ai1wm_Import_Controller::import' ); + add_action( 'wp_ajax_nopriv_ai1wm_status', 'Ai1wm_Status_Controller::status' ); + add_action( 'wp_ajax_nopriv_ai1wm_backups', 'Ai1wm_Backups_Controller::delete' ); + add_action( 'wp_ajax_nopriv_ai1wm_feedback', 'Ai1wm_Feedback_Controller::feedback' ); + add_action( 'wp_ajax_nopriv_ai1wm_report', 'Ai1wm_Report_Controller::report' ); + + // Private actions + add_action( 'wp_ajax_ai1wm_export', 'Ai1wm_Export_Controller::export' ); + add_action( 'wp_ajax_ai1wm_import', 'Ai1wm_Import_Controller::import' ); + add_action( 'wp_ajax_ai1wm_status', 'Ai1wm_Status_Controller::status' ); + add_action( 'wp_ajax_ai1wm_backups', 'Ai1wm_Backups_Controller::delete' ); + add_action( 'wp_ajax_ai1wm_feedback', 'Ai1wm_Feedback_Controller::feedback' ); + add_action( 'wp_ajax_ai1wm_report', 'Ai1wm_Report_Controller::report' ); + + // Update actions + if ( current_user_can( 'update_plugins' ) ) { + add_action( 'wp_ajax_ai1wm_updater', 'Ai1wm_Updater_Controller::updater' ); + } + } + + /** + * Add custom cron schedules + * + * @param array $schedules List of schedules + * @return array + */ + public function add_cron_schedules( $schedules ) { + $schedules['weekly'] = array( + 'display' => __( 'Weekly', AI1WM_PLUGIN_NAME ), + 'interval' => 60 * 60 * 24 * 7, + ); + $schedules['monthly'] = array( + 'display' => __( 'Monthly', AI1WM_PLUGIN_NAME ), + 'interval' => ( strtotime( '+1 month' ) - time() ), + ); + + return $schedules; + } +} diff --git a/lib/controller/class-ai1wm-report-controller.php b/lib/controller/class-ai1wm-report-controller.php new file mode 100644 index 0000000..8174b26 --- /dev/null +++ b/lib/controller/class-ai1wm-report-controller.php @@ -0,0 +1,74 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Report_Controller { + + public static function report( $params = array() ) { + + // Set params + if ( empty( $params ) ) { + $params = stripslashes_deep( $_POST ); + } + + // Set secret key + $secret_key = null; + if ( isset( $params['secret_key'] ) ) { + $secret_key = trim( $params['secret_key'] ); + } + + // Set e-mail + $email = null; + if ( isset( $params['ai1wm_email'] ) ) { + $email = trim( $params['ai1wm_email'] ); + } + + // Set message + $message = null; + if ( isset( $params['ai1wm_message'] ) ) { + $message = trim( $params['ai1wm_message'] ); + } + + // Set terms + $terms = false; + if ( isset( $params['ai1wm_terms'] ) ) { + $terms = (bool) $params['ai1wm_terms']; + } + + try { + // Ensure that unauthorized people cannot access report action + ai1wm_verify_secret_key( $secret_key ); + } catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) { + exit; + } + + $model = new Ai1wm_Report; + + // Send report + $errors = $model->add( $email, $message, $terms ); + + echo json_encode( array( 'errors' => $errors ) ); + exit; + } +} diff --git a/lib/controller/class-ai1wm-status-controller.php b/lib/controller/class-ai1wm-status-controller.php new file mode 100644 index 0000000..5eb9078 --- /dev/null +++ b/lib/controller/class-ai1wm-status-controller.php @@ -0,0 +1,51 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Status_Controller { + + public static function status( $params = array() ) { + + // Set params + if ( empty( $params ) ) { + $params = stripslashes_deep( $_GET ); + } + + // Set secret key + $secret_key = null; + if ( isset( $params['secret_key'] ) ) { + $secret_key = trim( $params['secret_key'] ); + } + + try { + // Ensure that unauthorized people cannot access status action + ai1wm_verify_secret_key( $secret_key ); + } catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) { + exit; + } + + echo json_encode( get_option( AI1WM_STATUS, array() ) ); + exit; + } +} diff --git a/lib/controller/class-ai1wm-updater-controller.php b/lib/controller/class-ai1wm-updater-controller.php new file mode 100644 index 0000000..ff22668 --- /dev/null +++ b/lib/controller/class-ai1wm-updater-controller.php @@ -0,0 +1,82 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Updater_Controller { + + public static function plugins_api( $result, $action = null, $args = null ) { + return Ai1wm_Updater::plugins_api( $result, $action, $args ); + } + + public static function pre_update_plugins( $transient ) { + if ( empty( $transient->checked ) ) { + return $transient; + } + + // Check for updates + Ai1wm_Updater::check_for_updates(); + + return $transient; + } + + public static function update_plugins( $transient ) { + return Ai1wm_Updater::update_plugins( $transient ); + } + + public static function check_for_updates() { + return Ai1wm_Updater::check_for_updates(); + } + + public static function plugin_row_meta( $links, $file ) { + return Ai1wm_Updater::plugin_row_meta( $links, $file ); + } + + public static function updater( $params = array() ) { + ai1wm_setup_environment(); + + // Set params + if ( empty( $params ) ) { + $params = stripslashes_deep( $_POST ); + } + + // Set uuid + $uuid = null; + if ( isset( $params['ai1wm_uuid'] ) ) { + $uuid = trim( $params['ai1wm_uuid'] ); + } + + // Set extension + $extension = null; + if ( isset( $params['ai1wm_extension'] ) ) { + $extension = trim( $params['ai1wm_extension'] ); + } + + $extensions = Ai1wm_Extensions::get(); + + // Verify whether extension exists + if ( isset( $extensions[ $extension ] ) ) { + update_option( $extensions[ $extension ]['key'], $uuid ); + } + } +} diff --git a/lib/model/class-ai1wm-backups.php b/lib/model/class-ai1wm-backups.php new file mode 100644 index 0000000..fafd5d4 --- /dev/null +++ b/lib/model/class-ai1wm-backups.php @@ -0,0 +1,105 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Backups { + + /** + * Get all backup files + * + * @return array + */ + public function get_files() { + $backups = array(); + + // Iterate over directory + $iterator = new Ai1wm_Recursive_Directory_Iterator( AI1WM_BACKUPS_PATH ); + + // Filter by extensions + $iterator = new Ai1wm_Recursive_Extension_Filter( $iterator, array( 'wpress' ) ); + + // Recursively iterate over directory + $iterator = new Ai1wm_Recursive_Iterator_Iterator( $iterator, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD ); + + // Get backup files + foreach ( $iterator as $item ) { + try { + if ( ai1wm_is_filesize_supported( $item->getPathname() ) ) { + $backups[] = array( + 'path' => $iterator->getSubPath(), + 'filename' => $iterator->getSubPathname(), + 'mtime' => $iterator->getMTime(), + 'size' => $iterator->getSize(), + ); + } else { + $backups[] = array( + 'path' => $iterator->getSubPath(), + 'filename' => $iterator->getSubPathname(), + 'mtime' => $iterator->getMTime(), + 'size' => null, + ); + } + } catch ( Exception $e ) { + $backups[] = array( + 'path' => $iterator->getSubPath(), + 'filename' => $iterator->getSubPathname(), + 'mtime' => null, + 'size' => null, + ); + } + } + + // Sort backups modified date + usort( $backups, array( $this, 'compare' ) ); + + return $backups; + } + + /** + * Delete file + * + * @param string $file File name + * @return boolean + */ + public function delete_file( $file ) { + if ( validate_file( $file ) === 0 ) { + return @unlink( ai1wm_backup_path( array( 'archive' => $file ) ) ); + } + } + + /** + * Compare backup files by modified time + * + * @param array $a File item A + * @param array $b File item B + * @return integer + */ + public function compare( $a, $b ) { + if ( $a['mtime'] === $b['mtime'] ) { + return 0; + } + + return ( $a['mtime'] > $b['mtime'] ) ? - 1 : 1; + } +} diff --git a/lib/model/class-ai1wm-compatibility.php b/lib/model/class-ai1wm-compatibility.php new file mode 100644 index 0000000..9bdb332 --- /dev/null +++ b/lib/model/class-ai1wm-compatibility.php @@ -0,0 +1,72 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Compatibility { + + public static function get( $params ) { + $extensions = Ai1wm_Extensions::get(); + + foreach ( $extensions as $extension_name => $extension_data ) { + if ( ! isset( $params[ $extension_data['short'] ] ) ) { + unset( $extensions[ $extension_name ] ); + } + } + + // Get updater URL + $updater_url = add_query_arg( array( 'ai1wm_updater' => 1 ), network_admin_url( 'plugins.php' ) ); + + // If no extension is used, update everything that is available + if ( empty( $extensions ) ) { + $extensions = Ai1wm_Extensions::get(); + } + + $messages = array(); + foreach ( $extensions as $extension_name => $extension_data ) { + if ( ! Ai1wm_Compatibility::check( $extension_data ) ) { + $messages[] = sprintf( + __( + '%s is not the latest version. ' . + 'You must update the plugin before you can use it.
', + AI1WM_PLUGIN_NAME + ), + $extension_data['title'], + $updater_url + ); + } + } + + return $messages; + } + + public static function check( $extension ) { + if ( $extension['version'] !== 'develop' ) { + if ( version_compare( $extension['version'], $extension['requires'], '<' ) ) { + return false; + } + } + + return true; + } +} diff --git a/lib/model/class-ai1wm-deprecated.php b/lib/model/class-ai1wm-deprecated.php new file mode 100644 index 0000000..e6b78ac --- /dev/null +++ b/lib/model/class-ai1wm-deprecated.php @@ -0,0 +1,28 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Export_Abstract {} +class Ai1wm_Import_Abstract {} +class Ai1wm_Config {} diff --git a/lib/model/class-ai1wm-extensions.php b/lib/model/class-ai1wm-extensions.php new file mode 100644 index 0000000..512445c --- /dev/null +++ b/lib/model/class-ai1wm-extensions.php @@ -0,0 +1,233 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Extensions { + + /** + * Get active extensions + * + * @return array + */ + public static function get() { + $extensions = array(); + + // Add Microsoft Azure extension + if ( defined( 'AI1WMZE_PLUGIN_NAME' ) ) { + $extensions[ AI1WMZE_PLUGIN_NAME ] = array( + 'key' => AI1WMZE_PLUGIN_KEY, + 'title' => AI1WMZE_PLUGIN_TITLE, + 'about' => AI1WMZE_PLUGIN_ABOUT, + 'basename' => AI1WMZE_PLUGIN_BASENAME, + 'version' => AI1WMZE_VERSION, + 'requires' => '1.1', + 'short' => AI1WMZE_PLUGIN_SHORT, + ); + } + + // Add Backblaze B2 extension + if ( defined( 'AI1WMAE_PLUGIN_NAME' ) ) { + $extensions[ AI1WMAE_PLUGIN_NAME ] = array( + 'key' => AI1WMAE_PLUGIN_KEY, + 'title' => AI1WMAE_PLUGIN_TITLE, + 'about' => AI1WMAE_PLUGIN_ABOUT, + 'basename' => AI1WMAE_PLUGIN_BASENAME, + 'version' => AI1WMAE_VERSION, + 'requires' => '1.3', + 'short' => AI1WMAE_PLUGIN_SHORT, + ); + } + + // Add Box Extension + if ( defined( 'AI1WMBE_PLUGIN_NAME' ) ) { + $extensions[ AI1WMBE_PLUGIN_NAME ] = array( + 'key' => AI1WMBE_PLUGIN_KEY, + 'title' => AI1WMBE_PLUGIN_TITLE, + 'about' => AI1WMBE_PLUGIN_ABOUT, + 'basename' => AI1WMBE_PLUGIN_BASENAME, + 'version' => AI1WMBE_VERSION, + 'requires' => '1.13', + 'short' => AI1WMBE_PLUGIN_SHORT, + ); + } + + // Add DigitalOcean Extension + if ( defined( 'AI1WMIE_PLUGIN_NAME' ) ) { + $extensions[ AI1WMIE_PLUGIN_NAME ] = array( + 'key' => AI1WMIE_PLUGIN_KEY, + 'title' => AI1WMIE_PLUGIN_TITLE, + 'about' => AI1WMIE_PLUGIN_ABOUT, + 'basename' => AI1WMIE_PLUGIN_BASENAME, + 'version' => AI1WMIE_VERSION, + 'requires' => '1.6', + 'short' => AI1WMIE_PLUGIN_SHORT, + ); + } + + // Add Dropbox Extension + if ( defined( 'AI1WMDE_PLUGIN_NAME' ) ) { + $extensions[ AI1WMDE_PLUGIN_NAME ] = array( + 'key' => AI1WMDE_PLUGIN_KEY, + 'title' => AI1WMDE_PLUGIN_TITLE, + 'about' => AI1WMDE_PLUGIN_ABOUT, + 'basename' => AI1WMDE_PLUGIN_BASENAME, + 'version' => AI1WMDE_VERSION, + 'requires' => '3.32', + 'short' => AI1WMDE_PLUGIN_SHORT, + ); + } + + // Add FTP Extension + if ( defined( 'AI1WMFE_PLUGIN_NAME' ) ) { + $extensions[ AI1WMFE_PLUGIN_NAME ] = array( + 'key' => AI1WMFE_PLUGIN_KEY, + 'title' => AI1WMFE_PLUGIN_TITLE, + 'about' => AI1WMFE_PLUGIN_ABOUT, + 'basename' => AI1WMFE_PLUGIN_BASENAME, + 'version' => AI1WMFE_VERSION, + 'requires' => '2.37', + 'short' => AI1WMFE_PLUGIN_SHORT, + ); + } + + // Add Google Cloud Storage Extension + if ( defined( 'AI1WMCE_PLUGIN_NAME' ) ) { + $extensions[ AI1WMCE_PLUGIN_NAME ] = array( + 'key' => AI1WMCE_PLUGIN_KEY, + 'title' => AI1WMCE_PLUGIN_TITLE, + 'about' => AI1WMCE_PLUGIN_ABOUT, + 'basename' => AI1WMCE_PLUGIN_BASENAME, + 'version' => AI1WMCE_VERSION, + 'requires' => '1.0', + 'short' => AI1WMCE_PLUGIN_SHORT, + ); + } + + // Add Google Drive Extension + if ( defined( 'AI1WMGE_PLUGIN_NAME' ) ) { + $extensions[ AI1WMGE_PLUGIN_NAME ] = array( + 'key' => AI1WMGE_PLUGIN_KEY, + 'title' => AI1WMGE_PLUGIN_TITLE, + 'about' => AI1WMGE_PLUGIN_ABOUT, + 'basename' => AI1WMGE_PLUGIN_BASENAME, + 'version' => AI1WMGE_VERSION, + 'requires' => '2.36', + 'short' => AI1WMGE_PLUGIN_SHORT, + ); + } + + // Add Amazon Glacier extension + if ( defined( 'AI1WMRE_PLUGIN_NAME' ) ) { + $extensions[ AI1WMRE_PLUGIN_NAME ] = array( + 'key' => AI1WMRE_PLUGIN_KEY, + 'title' => AI1WMRE_PLUGIN_TITLE, + 'about' => AI1WMRE_PLUGIN_ABOUT, + 'basename' => AI1WMRE_PLUGIN_BASENAME, + 'version' => AI1WMRE_VERSION, + 'requires' => '1.0', + 'short' => AI1WMRE_PLUGIN_SHORT, + ); + } + + // Add Mega Extension + if ( defined( 'AI1WMEE_PLUGIN_NAME' ) ) { + $extensions[ AI1WMEE_PLUGIN_NAME ] = array( + 'key' => AI1WMEE_PLUGIN_KEY, + 'title' => AI1WMEE_PLUGIN_TITLE, + 'about' => AI1WMEE_PLUGIN_ABOUT, + 'basename' => AI1WMEE_PLUGIN_BASENAME, + 'version' => AI1WMEE_VERSION, + 'requires' => '1.10', + 'short' => AI1WMEE_PLUGIN_SHORT, + ); + } + + // Add Multisite Extension + if ( defined( 'AI1WMME_PLUGIN_NAME' ) ) { + $extensions[ AI1WMME_PLUGIN_NAME ] = array( + 'key' => AI1WMME_PLUGIN_KEY, + 'title' => AI1WMME_PLUGIN_TITLE, + 'about' => AI1WMME_PLUGIN_ABOUT, + 'basename' => AI1WMME_PLUGIN_BASENAME, + 'version' => AI1WMME_VERSION, + 'requires' => '3.58', + 'short' => AI1WMME_PLUGIN_SHORT, + ); + } + + // Add OneDrive Extension + if ( defined( 'AI1WMOE_PLUGIN_NAME' ) ) { + $extensions[ AI1WMOE_PLUGIN_NAME ] = array( + 'key' => AI1WMOE_PLUGIN_KEY, + 'title' => AI1WMOE_PLUGIN_TITLE, + 'about' => AI1WMOE_PLUGIN_ABOUT, + 'basename' => AI1WMOE_PLUGIN_BASENAME, + 'version' => AI1WMOE_VERSION, + 'requires' => '1.23', + 'short' => AI1WMOE_PLUGIN_SHORT, + ); + } + + // Add Amazon S3 extension + if ( defined( 'AI1WMSE_PLUGIN_NAME' ) ) { + $extensions[ AI1WMSE_PLUGIN_NAME ] = array( + 'key' => AI1WMSE_PLUGIN_KEY, + 'title' => AI1WMSE_PLUGIN_TITLE, + 'about' => AI1WMSE_PLUGIN_ABOUT, + 'basename' => AI1WMSE_PLUGIN_BASENAME, + 'version' => AI1WMSE_VERSION, + 'requires' => '3.27', + 'short' => AI1WMSE_PLUGIN_SHORT, + ); + } + + // Add Unlimited Extension + if ( defined( 'AI1WMUE_PLUGIN_NAME' ) ) { + $extensions[ AI1WMUE_PLUGIN_NAME ] = array( + 'key' => AI1WMUE_PLUGIN_KEY, + 'title' => AI1WMUE_PLUGIN_TITLE, + 'about' => AI1WMUE_PLUGIN_ABOUT, + 'basename' => AI1WMUE_PLUGIN_BASENAME, + 'version' => AI1WMUE_VERSION, + 'requires' => '2.18', + 'short' => AI1WMUE_PLUGIN_SHORT, + ); + } + + // Add URL Extension + if ( defined( 'AI1WMLE_PLUGIN_NAME' ) ) { + $extensions[ AI1WMLE_PLUGIN_NAME ] = array( + 'key' => AI1WMLE_PLUGIN_KEY, + 'title' => AI1WMLE_PLUGIN_TITLE, + 'about' => AI1WMLE_PLUGIN_ABOUT, + 'basename' => AI1WMLE_PLUGIN_BASENAME, + 'version' => AI1WMLE_VERSION, + 'requires' => '2.27', + 'short' => AI1WMLE_PLUGIN_SHORT, + ); + } + + return $extensions; + } +} diff --git a/lib/model/class-ai1wm-feedback.php b/lib/model/class-ai1wm-feedback.php new file mode 100644 index 0000000..a35ceb6 --- /dev/null +++ b/lib/model/class-ai1wm-feedback.php @@ -0,0 +1,70 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Feedback { + + /** + * Submit customer feedback to servmask.com + * + * @param string $type Feedback type + * @param string $email User e-mail + * @param string $message User message + * @param integer $terms User accept terms + * + * @return array + */ + public function add( $type, $email, $message, $terms ) { + $errors = array(); + + // Submit feedback to ServMask + if ( empty( $type ) ) { + $errors[] = __( 'Feedback type is not valid.', AI1WM_PLUGIN_NAME ); + } elseif ( ! filter_var( $email, FILTER_VALIDATE_EMAIL ) ) { + $errors[] = __( 'Your email is not valid.', AI1WM_PLUGIN_NAME ); + } elseif ( empty( $message ) ) { + $errors[] = __( 'Please enter comments in the text area.', AI1WM_PLUGIN_NAME ); + } elseif ( empty( $terms ) ) { + $errors[] = __( 'Please accept feedback term conditions.', AI1WM_PLUGIN_NAME ); + } else { + $response = wp_remote_post( + AI1WM_FEEDBACK_URL, + array( + 'timeout' => 15, + 'body' => array( + 'type' => $type, + 'email' => $email, + 'message' => $message, + ), + ) + ); + + if ( is_wp_error( $response ) ) { + $errors[] = sprintf( __( 'Something went wrong: %s', AI1WM_PLUGIN_NAME ), $response->get_error_message() ); + } + } + + return $errors; + } +} diff --git a/lib/model/class-ai1wm-handler.php b/lib/model/class-ai1wm-handler.php new file mode 100644 index 0000000..7f3e1f0 --- /dev/null +++ b/lib/model/class-ai1wm-handler.php @@ -0,0 +1,56 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Handler { + + /** + * Error handler + * + * @param integer $errno Error level + * @param string $errstr Error message + * @param string $errfile Error file + * @param integer $errline Error line + * @return void + */ + public static function error( $errno, $errstr, $errfile, $errline ) { + Ai1wm_Log::error( array( + 'Number' => $errno, + 'Message' => $errstr, + 'File' => $errfile, + 'Line' => $errline, + ) ); + } + + /** + * Shutdown handler + * + * @return void + */ + public static function shutdown() { + if ( ( $error = error_get_last() ) ) { + Ai1wm_Log::error( $error ); + } + } +} diff --git a/lib/model/class-ai1wm-log.php b/lib/model/class-ai1wm-log.php new file mode 100644 index 0000000..4352f5d --- /dev/null +++ b/lib/model/class-ai1wm-log.php @@ -0,0 +1,84 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Log { + + public static function export( $params ) { + $data = array(); + + // Add date + $data[] = date( 'M d Y H:i:s' ); + + // Add params + $data[] = json_encode( $params ); + + // Add empty line + $data[] = PHP_EOL; + + // Write log data + if ( $handle = ai1wm_open( ai1wm_export_path( $params ), 'a' ) ) { + ai1wm_write( $handle, implode( PHP_EOL, $data ) ); + ai1wm_close( $handle ); + } + } + + public static function import( $params ) { + $data = array(); + + // Add date + $data[] = date( 'M d Y H:i:s' ); + + // Add params + $data[] = json_encode( $params ); + + // Add empty line + $data[] = PHP_EOL; + + // Write log data + if ( $handle = ai1wm_open( ai1wm_import_path( $params ), 'a' ) ) { + ai1wm_write( $handle, implode( PHP_EOL, $data ) ); + ai1wm_close( $handle ); + } + } + + public static function error( $params ) { + $data = array(); + + // Add date + $data[] = date( 'M d Y H:i:s' ); + + // Add params + $data[] = json_encode( $params ); + + // Add empty line + $data[] = PHP_EOL; + + // Write log data + if ( $handle = ai1wm_open( ai1wm_error_path(), 'a' ) ) { + ai1wm_write( $handle, implode( PHP_EOL, $data ) ); + ai1wm_close( $handle ); + } + } +} diff --git a/lib/model/class-ai1wm-message.php b/lib/model/class-ai1wm-message.php new file mode 100644 index 0000000..0df2fba --- /dev/null +++ b/lib/model/class-ai1wm-message.php @@ -0,0 +1,59 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Message { + + public static function flash( $type, $message ) { + if ( ( $messages = get_option( AI1WM_MESSAGES, array() ) ) !== false ) { + return update_option( AI1WM_MESSAGES, array_merge( $messages, array( $type => $message ) ) ); + } + + return false; + } + + public static function has( $type ) { + if ( ( $messages = get_option( AI1WM_MESSAGES, array() ) ) ) { + if ( isset( $messages[ $type ] ) ) { + return true; + } + } + + return false; + } + + public static function get( $type ) { + $message = null; + if ( ( $messages = get_option( AI1WM_MESSAGES, array() ) ) ) { + if ( isset( $messages[ $type ] ) && ( $message = $messages[ $type ] ) ) { + unset( $messages[ $type ] ); + } + + // Set messages + update_option( AI1WM_MESSAGES, $messages ); + } + + return $message; + } +} diff --git a/lib/model/class-ai1wm-notification.php b/lib/model/class-ai1wm-notification.php new file mode 100644 index 0000000..1959af6 --- /dev/null +++ b/lib/model/class-ai1wm-notification.php @@ -0,0 +1,81 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Notification { + + public static function ok( $subject, $message ) { + // Enable notifications + if ( ! apply_filters( 'ai1wm_notification_ok_toggle', false ) ) { + return; + } + + // Set email + if ( ! ( $email = apply_filters( 'ai1wm_notification_ok_email', get_option( 'admin_email', false ) ) ) ) { + return; + } + + // Set subject + if ( ! ( $subject = apply_filters( 'ai1wm_notification_ok_subject', $subject ) ) ) { + return; + } + + // Set message + if ( ! ( $message = apply_filters( 'ai1wm_notification_ok_message', $message ) ) ) { + return; + } + + // Send email + if ( ai1wm_is_scheduled_backup() ) { + wp_mail( $email, $subject, $message, array( 'Content-Type: text/html; charset=UTF-8' ) ); + } + } + + public static function error( $subject, $message ) { + // Enable notifications + if ( ! apply_filters( 'ai1wm_notification_error_toggle', false ) ) { + return; + } + + // Set email + if ( ! ( $email = apply_filters( 'ai1wm_notification_error_email', get_option( 'admin_email', false ) ) ) ) { + return; + } + + // Set subject + if ( ! ( $subject = apply_filters( 'ai1wm_notification_error_subject', $subject ) ) ) { + return; + } + + // Set message + if ( ! ( $message = apply_filters( 'ai1wm_notification_error_message', $message ) ) ) { + return; + } + + // Send email + if ( ai1wm_is_scheduled_backup() ) { + wp_mail( $email, $subject, $message, array( 'Content-Type: text/html; charset=UTF-8' ) ); + } + } +} diff --git a/lib/model/class-ai1wm-report.php b/lib/model/class-ai1wm-report.php new file mode 100644 index 0000000..f7c7c4b --- /dev/null +++ b/lib/model/class-ai1wm-report.php @@ -0,0 +1,66 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Report { + + /** + * Submit customer report to servmask.com + * + * @param string $email User e-mail + * @param string $message User message + * @param integer $terms User accept terms + * + * @return array + */ + public function add( $email, $message, $terms ) { + $errors = array(); + + // Submit report to ServMask + if ( ! filter_var( $email, FILTER_VALIDATE_EMAIL ) ) { + $errors[] = __( 'Your email is not valid.', AI1WM_PLUGIN_NAME ); + } elseif ( empty( $message ) ) { + $errors[] = __( 'Please enter comments in the text area.', AI1WM_PLUGIN_NAME ); + } elseif ( empty( $terms ) ) { + $errors[] = __( 'Please accept report term conditions.', AI1WM_PLUGIN_NAME ); + } else { + $response = wp_remote_post( + AI1WM_REPORT_URL, + array( + 'timeout' => 15, + 'body' => array( + 'email' => $email, + 'message' => $message, + ), + ) + ); + + if ( is_wp_error( $response ) ) { + $errors[] = sprintf( __( 'Something went wrong: %s', AI1WM_PLUGIN_NAME ), $response->get_error_message() ); + } + } + + return $errors; + } +} diff --git a/lib/model/class-ai1wm-status.php b/lib/model/class-ai1wm-status.php new file mode 100644 index 0000000..f85cefe --- /dev/null +++ b/lib/model/class-ai1wm-status.php @@ -0,0 +1,61 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Status { + + public static function error( $title, $message ) { + self::log( array( 'type' => 'error', 'title' => $title, 'message' => $message ) ); + } + + public static function info( $message ) { + self::log( array( 'type' => 'info', 'message' => $message ) ); + } + + public static function download( $message ) { + self::log( array( 'type' => 'download', 'message' => $message ) ); + } + + public static function confirm( $message ) { + self::log( array( 'type' => 'confirm', 'message' => $message ) ); + } + + public static function done( $title, $message ) { + self::log( array( 'type' => 'done', 'title' => $title, 'message' => $message ) ); + } + + public static function blogs( $title, $message ) { + self::log( array( 'type' => 'blogs', 'title' => $title, 'message' => $message ) ); + } + + public static function progress( $percent ) { + self::log( array( 'type' => 'progress', 'percent' => $percent ) ); + } + + public static function log( $data ) { + if ( ! ai1wm_is_scheduled_backup() ) { + update_option( AI1WM_STATUS, $data ); + } + } +} diff --git a/lib/model/class-ai1wm-template.php b/lib/model/class-ai1wm-template.php new file mode 100644 index 0000000..a82f4f3 --- /dev/null +++ b/lib/model/class-ai1wm-template.php @@ -0,0 +1,54 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Template extends Bandar { + + /** + * Renders a file and returns its contents + * + * @param string $file View to render + * @param array $args Set of arguments + * + * @return string Rendered view + */ + public static function render( $view, $args = array(), $path = false ) { + parent::render( $view, $args, $path ); + } + + /** + * Returns link to an asset file + * + * @param string $asset Asset file + * + * @return string Asset URL + */ + public static function asset_link( $asset, $prefix = 'AI1WM' ) { + return constant( $prefix . '_URL' ) . '/lib/view/assets/' . $asset . '?v=' . constant( $prefix . '_VERSION' ); + } + + public static function get_content( $template, $args = array(), $path = false ) { + return parent::getTemplateContent( $template, $args, $path ); + } +} diff --git a/lib/model/class-ai1wm-updater.php b/lib/model/class-ai1wm-updater.php new file mode 100644 index 0000000..1ff1467 --- /dev/null +++ b/lib/model/class-ai1wm-updater.php @@ -0,0 +1,191 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Updater { + + /** + * Retrieve plugin installer pages from WordPress Plugins API. + * + * @param mixed $result + * @param string $action + * @param array|object $args + * @return mixed + */ + public static function plugins_api( $result, $action = null, $args = null ) { + if ( empty( $args->slug ) ) { + return $result; + } + + // Get extensions + $extensions = Ai1wm_Extensions::get(); + + // View details page + if ( isset( $args->slug ) && isset( $extensions[ $args->slug ] ) && $action === 'plugin_information' ) { + + // Get current updates + $updates = get_option( AI1WM_UPDATER, array() ); + + // Plugin details + if ( isset( $updates[ $args->slug ] ) && ( $details = $updates[ $args->slug ] ) ) { + return (object) $details; + } + } + + return $result; + } + + /** + * Update WordPress plugin list page. + * + * @param object $transient + * @return object + */ + public static function update_plugins( $transient ) { + global $wp_version; + + // Get extensions + $extensions = Ai1wm_Extensions::get(); + + // Get current updates + $updates = get_option( AI1WM_UPDATER, array() ); + + // Get extension updates + foreach ( $updates as $slug => $update ) { + if ( isset( $extensions[ $slug ] ) && ( $extension = $extensions[ $slug ] ) ) { + if ( ( $purchase_id = get_option( $extension['key'] ) ) ) { + if ( version_compare( $extension['version'], $update['version'], '<' ) ) { + + // Get download URL + $download_url = add_query_arg( array( 'siteurl' => get_site_url() ), sprintf( '%s/%s', $update['download_link'], $purchase_id ) ); + + // Set plugin details + $transient->response[ $extension['basename'] ] = (object) array( + 'slug' => $slug, + 'new_version' => $update['version'], + 'url' => $update['homepage'], + 'plugin' => $extension['basename'], + 'package' => $download_url, + 'tested' => $wp_version, + 'icons' => $update['icons'], + ); + } + } + } + } + + return $transient; + } + + /** + * Check for extension updates + * + * @return void + */ + public static function check_for_updates() { + // Get current updates + $updates = get_option( AI1WM_UPDATER, array() ); + + // Get extension updates + foreach ( Ai1wm_Extensions::get() as $slug => $extension ) { + $response = wp_remote_get( $extension['about'], array( + 'timeout' => 15, + 'headers' => array( 'Accept' => 'application/json' ), + ) ); + + // Add updates + if ( ! is_wp_error( $response ) ) { + if ( ( $response = json_decode( $response['body'], true ) ) ) { + // Slug is mandatory + if ( ! isset( $response['slug'] ) ) { + return; + } + + // Version is mandatory + if ( ! isset( $response['version'] ) ) { + return; + } + + // Homepage is mandatory + if ( ! isset( $response['homepage'] ) ) { + return; + } + + // Download link is mandatory + if ( ! isset( $response['download_link'] ) ) { + return; + } + + $updates[ $slug ] = $response; + } + } + } + + // Set new updates + update_option( AI1WM_UPDATER, $updates ); + } + + /** + * Add "Check for updates" link + * + * @param array $links The array having default links for the plugin. + * @param string $file The name of the plugin file. + * @return array + */ + public static function plugin_row_meta( $links, $file ) { + $modal_index = 0; + + // Add link for each extension + foreach ( Ai1wm_Extensions::get() as $slug => $extension ) { + $modal_index++; + + // Get plugin details + if ( $file === $extension['basename'] ) { + + // Get updater URL + $updater_url = add_query_arg( array( 'ai1wm_updater' => 1 ), network_admin_url( 'plugins.php' ) ); + + // Check Purchase ID + if ( get_option( $extension['key'] ) ) { + + // Add "Check for updates" link + $links[] = Ai1wm_Template::get_content( 'updater/check', array( + 'url' => $updater_url, + ) ); + + } else { + + // Add modal + $links[] = Ai1wm_Template::get_content( 'updater/modal', array( + 'url' => $updater_url, + 'modal' => $modal_index, + ) ); + + } + } + } + + return $links; + } +} diff --git a/lib/model/export/class-ai1wm-export-archive.php b/lib/model/export/class-ai1wm-export-archive.php new file mode 100644 index 0000000..3f2dd97 --- /dev/null +++ b/lib/model/export/class-ai1wm-export-archive.php @@ -0,0 +1,42 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Export_Archive { + + public static function execute( $params ) { + + // Set progress + Ai1wm_Status::info( __( 'Creating an empty archive...', AI1WM_PLUGIN_NAME ) ); + + // Create empty archive file + $archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) ); + $archive->close(); + + // Set progress + Ai1wm_Status::info( __( 'Done creating an empty archive.', AI1WM_PLUGIN_NAME ) ); + + return $params; + } +} diff --git a/lib/model/export/class-ai1wm-export-clean.php b/lib/model/export/class-ai1wm-export-clean.php new file mode 100644 index 0000000..82ad53b --- /dev/null +++ b/lib/model/export/class-ai1wm-export-clean.php @@ -0,0 +1,32 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Export_Clean { + + public static function execute( $params ) { + Ai1wm_Directory::delete( ai1wm_storage_path( $params ) ); + exit; + } +} diff --git a/lib/model/export/class-ai1wm-export-compatibility.php b/lib/model/export/class-ai1wm-export-compatibility.php new file mode 100644 index 0000000..819ecb2 --- /dev/null +++ b/lib/model/export/class-ai1wm-export-compatibility.php @@ -0,0 +1,47 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Export_Compatibility { + + public static function execute( $params ) { + + // Set progress + Ai1wm_Status::info( __( 'Checking extensions compatibility...', AI1WM_PLUGIN_NAME ) ); + + // Get messages + $messages = Ai1wm_Compatibility::get( $params ); + + // Set messages + if ( empty( $messages ) ) { + return $params; + } + + // Enable notifications + add_filter( 'ai1wm_notification_error_toggle', '__return_true', 20 ); + + // Error message + throw new Ai1wm_Compatibility_Exception( implode( $messages ) ); + } +} diff --git a/lib/model/export/class-ai1wm-export-config-file.php b/lib/model/export/class-ai1wm-export-config-file.php new file mode 100644 index 0000000..6de49d9 --- /dev/null +++ b/lib/model/export/class-ai1wm-export-config-file.php @@ -0,0 +1,115 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Export_Config_File { + + public static function execute( $params ) { + + $package_bytes_written = 0; + + // Set archive bytes offset + if ( isset( $params['archive_bytes_offset'] ) ) { + $archive_bytes_offset = (int) $params['archive_bytes_offset']; + } else { + $archive_bytes_offset = ai1wm_archive_bytes( $params ); + } + + // Set package bytes offset + if ( isset( $params['package_bytes_offset'] ) ) { + $package_bytes_offset = (int) $params['package_bytes_offset']; + } else { + $package_bytes_offset = 0; + } + + // Get total package size + if ( isset( $params['total_package_size'] ) ) { + $total_package_size = (int) $params['total_package_size']; + } else { + $total_package_size = ai1wm_package_bytes( $params ); + } + + // What percent of package have we processed? + $progress = (int) min( ( $package_bytes_offset / $total_package_size ) * 100, 100 ); + + // Set progress + Ai1wm_Status::info( sprintf( __( 'Archiving configuration file...
%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) ); + + // Open the archive file for writing + $archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) ); + + // Set the file pointer to the one that we have saved + $archive->set_file_pointer( $archive_bytes_offset ); + + // Add package.json to archive + if ( $archive->add_file( ai1wm_package_path( $params ), AI1WM_PACKAGE_NAME, $package_bytes_written, $package_bytes_offset ) ) { + + // Set progress + Ai1wm_Status::info( __( 'Done archiving configuration file.', AI1WM_PLUGIN_NAME ) ); + + // Unset archive bytes offset + unset( $params['archive_bytes_offset'] ); + + // Unset package bytes offset + unset( $params['package_bytes_offset'] ); + + // Unset total package size + unset( $params['total_package_size'] ); + + // Unset completed flag + unset( $params['completed'] ); + + } else { + + // Get archive bytes offset + $archive_bytes_offset = $archive->get_file_pointer(); + + // What percent of package have we processed? + $progress = (int) min( ( $package_bytes_offset / $total_package_size ) * 100, 100 ); + + // Set progress + Ai1wm_Status::info( sprintf( __( 'Archiving configuration file...
%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) ); + + // Set archive bytes offset + $params['archive_bytes_offset'] = $archive_bytes_offset; + + // Set package bytes offset + $params['package_bytes_offset'] = $package_bytes_offset; + + // Set total package size + $params['total_package_size'] = $total_package_size; + + // Set completed flag + $params['completed'] = false; + } + + // Truncate the archive file + $archive->truncate(); + + // Close the archive file + $archive->close(); + + return $params; + } +} diff --git a/lib/model/export/class-ai1wm-export-config.php b/lib/model/export/class-ai1wm-export-config.php new file mode 100644 index 0000000..f2979b1 --- /dev/null +++ b/lib/model/export/class-ai1wm-export-config.php @@ -0,0 +1,108 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Export_Config { + + public static function execute( $params ) { + global $wp_version, $wpdb; + + // Set progress + Ai1wm_Status::info( __( 'Preparing configuration file...', AI1WM_PLUGIN_NAME ) ); + + // Get options + $options = wp_load_alloptions(); + + // Get database client + if ( empty( $wpdb->use_mysqli ) ) { + $mysql = new Ai1wm_Database_Mysql( $wpdb ); + } else { + $mysql = new Ai1wm_Database_Mysqli( $wpdb ); + } + + $config = array(); + + // Set site URL + $config['SiteURL'] = site_url(); + + // Set home URL + $config['HomeURL'] = home_url(); + + // Set internal site URL + if ( isset( $options['siteurl'] ) && ( untrailingslashit( $options['siteurl'] ) !== site_url() ) ) { + $config['InternalSiteURL'] = untrailingslashit( $options['siteurl'] ); + } + + // Set internal home URL + if ( isset( $options['home'] ) && ( untrailingslashit( $options['home'] ) !== home_url() ) ) { + $config['InternalHomeURL'] = untrailingslashit( $options['home'] ); + } + + // Set replace old and new values + if ( isset( $params['options']['replace'] ) && ( $replace = $params['options']['replace'] ) ) { + for ( $i = 0; $i < count( $replace['old_value'] ); $i++ ) { + if ( ! empty( $replace['old_value'][ $i ] ) && ! empty( $replace['new_value'][ $i ] ) ) { + $config['Replace']['OldValues'][] = $replace['old_value'][ $i ]; + $config['Replace']['NewValues'][] = $replace['new_value'][ $i ]; + } + } + } + + // Set no replace email + if ( isset( $params['options']['no_email_replace'] ) ) { + $config['NoEmailReplace'] = true; + } + + // Set plugin version + $config['Plugin'] = array( 'Version' => AI1WM_VERSION ); + + // Set WordPress version and content + $config['WordPress'] = array( 'Version' => $wp_version, 'Content' => WP_CONTENT_DIR ); + + // Set database version + $config['Database'] = array( 'Version' => $mysql->version() ); + + // Set PHP version + $config['PHP'] = array( 'Version' => PHP_VERSION ); + + // Set active plugins + $config['Plugins'] = array_values( array_diff( ai1wm_active_plugins(), ai1wm_active_servmask_plugins() ) ); + + // Set active template + $config['Template'] = ai1wm_active_template(); + + // Set active stylesheet + $config['Stylesheet'] = ai1wm_active_stylesheet(); + + // Save package.json file + $handle = ai1wm_open( ai1wm_package_path( $params ), 'w' ); + ai1wm_write( $handle, json_encode( $config ) ); + ai1wm_close( $handle ); + + // Set progress + Ai1wm_Status::info( __( 'Done preparing configuration file.', AI1WM_PLUGIN_NAME ) ); + + return $params; + } +} diff --git a/lib/model/export/class-ai1wm-export-content.php b/lib/model/export/class-ai1wm-export-content.php new file mode 100644 index 0000000..9186b65 --- /dev/null +++ b/lib/model/export/class-ai1wm-export-content.php @@ -0,0 +1,189 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Export_Content { + + public static function execute( $params ) { + + // Set archive bytes offset + if ( isset( $params['archive_bytes_offset'] ) ) { + $archive_bytes_offset = (int) $params['archive_bytes_offset']; + } else { + $archive_bytes_offset = ai1wm_archive_bytes( $params ); + } + + // Set file bytes offset + if ( isset( $params['file_bytes_offset'] ) ) { + $file_bytes_offset = (int) $params['file_bytes_offset']; + } else { + $file_bytes_offset = 0; + } + + // Set filemap bytes offset + if ( isset( $params['filemap_bytes_offset'] ) ) { + $filemap_bytes_offset = (int) $params['filemap_bytes_offset']; + } else { + $filemap_bytes_offset = 0; + } + + // Get processed files size + if ( isset( $params['processed_files_size'] ) ) { + $processed_files_size = (int) $params['processed_files_size']; + } else { + $processed_files_size = 0; + } + + // Get total files size + if ( isset( $params['total_files_size'] ) ) { + $total_files_size = (int) $params['total_files_size']; + } else { + $total_files_size = 1; + } + + // Get total files count + if ( isset( $params['total_files_count'] ) ) { + $total_files_count = (int) $params['total_files_count']; + } else { + $total_files_count = 1; + } + + // What percent of files have we processed? + $progress = (int) min( ( $processed_files_size / $total_files_size ) * 100, 100 ); + + // Set progress + Ai1wm_Status::info( sprintf( __( 'Archiving %d files...
%d%% complete', AI1WM_PLUGIN_NAME ), $total_files_count, $progress ) ); + + // Flag to hold if file data has been processed + $completed = true; + + // Start time + $start = microtime( true ); + + // Get map file + $filemap = ai1wm_open( ai1wm_filemap_path( $params ), 'r' ); + + // Set filemap pointer at the current index + if ( fseek( $filemap, $filemap_bytes_offset ) !== -1 ) { + + // Open the archive file for writing + $archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) ); + + // Set the file pointer to the one that we have saved + $archive->set_file_pointer( $archive_bytes_offset ); + + // Loop over files + while ( $path = trim( fgets( $filemap ) ) ) { + $file_bytes_written = 0; + + // Add file to archive + if ( ( $completed = $archive->add_file( WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $path, $path, $file_bytes_written, $file_bytes_offset ) ) ) { + $file_bytes_offset = 0; + + // Get filemap bytes offset + $filemap_bytes_offset = ftell( $filemap ); + } + + // Increment processed files size + $processed_files_size += $file_bytes_written; + + // What percent of files have we processed? + $progress = (int) min( ( $processed_files_size / $total_files_size ) * 100, 100 ); + + // Set progress + Ai1wm_Status::info( sprintf( __( 'Archiving %d files...
%d%% complete', AI1WM_PLUGIN_NAME ), $total_files_count, $progress ) ); + + // More than 10 seconds have passed, break and do another request + if ( ( $timeout = apply_filters( 'ai1wm_completed_timeout', 10 ) ) ) { + if ( ( microtime( true ) - $start ) > $timeout ) { + $completed = false; + break; + } + } + } + + // Get archive bytes offset + $archive_bytes_offset = $archive->get_file_pointer(); + + // Truncate the archive file + $archive->truncate(); + + // Close the archive file + $archive->close(); + } + + // End of the filemap? + if ( feof( $filemap ) ) { + + // Unset archive bytes offset + unset( $params['archive_bytes_offset'] ); + + // Unset file bytes offset + unset( $params['file_bytes_offset'] ); + + // Unset filemap bytes offset + unset( $params['filemap_bytes_offset'] ); + + // Unset processed files size + unset( $params['processed_files_size'] ); + + // Unset total files size + unset( $params['total_files_size'] ); + + // Unset total files count + unset( $params['total_files_count'] ); + + // Unset completed flag + unset( $params['completed'] ); + + } else { + + // Set archive bytes offset + $params['archive_bytes_offset'] = $archive_bytes_offset; + + // Set file bytes offset + $params['file_bytes_offset'] = $file_bytes_offset; + + // Set filemap bytes offset + $params['filemap_bytes_offset'] = $filemap_bytes_offset; + + // Set processed files size + $params['processed_files_size'] = $processed_files_size; + + // Set total files size + $params['total_files_size'] = $total_files_size; + + // Set total files count + $params['total_files_count'] = $total_files_count; + + // Set completed flag + $params['completed'] = $completed; + } + + // Close the filemap file + ai1wm_close( $filemap ); + + return $params; + } +} diff --git a/lib/model/export/class-ai1wm-export-database-file.php b/lib/model/export/class-ai1wm-export-database-file.php new file mode 100644 index 0000000..cdbb1bd --- /dev/null +++ b/lib/model/export/class-ai1wm-export-database-file.php @@ -0,0 +1,120 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Export_Database_File { + + public static function execute( $params ) { + + // Set exclude database + if ( isset( $params['options']['no_database'] ) ) { + return $params; + } + + $database_bytes_written = 0; + + // Set archive bytes offset + if ( isset( $params['archive_bytes_offset'] ) ) { + $archive_bytes_offset = (int) $params['archive_bytes_offset']; + } else { + $archive_bytes_offset = ai1wm_archive_bytes( $params ); + } + + // Set database bytes offset + if ( isset( $params['database_bytes_offset'] ) ) { + $database_bytes_offset = (int) $params['database_bytes_offset']; + } else { + $database_bytes_offset = 0; + } + + // Get total database size + if ( isset( $params['total_database_size'] ) ) { + $total_database_size = (int) $params['total_database_size']; + } else { + $total_database_size = ai1wm_database_bytes( $params ); + } + + // What percent of database have we processed? + $progress = (int) min( ( $database_bytes_offset / $total_database_size ) * 100, 100 ); + + // Set progress + Ai1wm_Status::info( sprintf( __( 'Archiving database...
%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) ); + + // Open the archive file for writing + $archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) ); + + // Set the file pointer to the one that we have saved + $archive->set_file_pointer( $archive_bytes_offset ); + + // Add database.sql to archive + if ( $archive->add_file( ai1wm_database_path( $params ), AI1WM_DATABASE_NAME, $database_bytes_written, $database_bytes_offset ) ) { + + // Set progress + Ai1wm_Status::info( __( 'Done archiving database.', AI1WM_PLUGIN_NAME ) ); + + // Unset archive bytes offset + unset( $params['archive_bytes_offset'] ); + + // Unset database bytes offset + unset( $params['database_bytes_offset'] ); + + // Unset total database size + unset( $params['total_database_size'] ); + + // Unset completed flag + unset( $params['completed'] ); + + } else { + + // Get archive bytes offset + $archive_bytes_offset = $archive->get_file_pointer(); + + // What percent of database have we processed? + $progress = (int) min( ( $database_bytes_offset / $total_database_size ) * 100, 100 ); + + // Set progress + Ai1wm_Status::info( sprintf( __( 'Archiving database...
%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) ); + + // Set archive bytes offset + $params['archive_bytes_offset'] = $archive_bytes_offset; + + // Set database bytes offset + $params['database_bytes_offset'] = $database_bytes_offset; + + // Set total database size + $params['total_database_size'] = $total_database_size; + + // Set completed flag + $params['completed'] = false; + } + + // Truncate the archive file + $archive->truncate(); + + // Close the archive file + $archive->close(); + + return $params; + } +} diff --git a/lib/model/export/class-ai1wm-export-database.php b/lib/model/export/class-ai1wm-export-database.php new file mode 100644 index 0000000..41edc92 --- /dev/null +++ b/lib/model/export/class-ai1wm-export-database.php @@ -0,0 +1,179 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Export_Database { + + public static function execute( $params ) { + global $wpdb; + + // Set exclude database + if ( isset( $params['options']['no_database'] ) ) { + return $params; + } + + // Set table index + if ( isset( $params['table_index'] ) ) { + $table_index = (int) $params['table_index']; + } else { + $table_index = 0; + } + + // Set table offset + if ( isset( $params['table_offset'] ) ) { + $table_offset = (int) $params['table_offset']; + } else { + $table_offset = 0; + } + + // Set total tables count + if ( isset( $params['total_tables_count'] ) ) { + $total_tables_count = (int) $params['total_tables_count']; + } else { + $total_tables_count = 1; + } + + // What percent of tables have we processed? + $progress = (int) ( ( $table_index / $total_tables_count ) * 100 ); + + // Set progress + Ai1wm_Status::info( sprintf( __( 'Exporting database...
%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) ); + + // Get database client + if ( empty( $wpdb->use_mysqli ) ) { + $mysql = new Ai1wm_Database_Mysql( $wpdb ); + } else { + $mysql = new Ai1wm_Database_Mysqli( $wpdb ); + } + + // Exclude spam comments + if ( isset( $params['options']['no_spam_comments'] ) ) { + $mysql->set_table_where_clauses( ai1wm_table_prefix() . 'comments', array( "`comment_approved` != 'spam'" ) ) + ->set_table_where_clauses( ai1wm_table_prefix() . 'commentmeta', array( sprintf( "`comment_ID` IN ( SELECT `comment_ID` FROM `%s` WHERE `comment_approved` != 'spam' )", ai1wm_table_prefix() . 'comments' ) ) ); + } + + // Exclude post revisions + if ( isset( $params['options']['no_revisions'] ) ) { + $mysql->set_table_where_clauses( ai1wm_table_prefix() . 'posts', array( "`post_type` != 'revision'" ) ); + } + + $old_table_prefixes = $old_column_prefixes = array(); + $new_table_prefixes = $new_column_prefixes = array(); + + // Set table prefixes + if ( ai1wm_table_prefix() ) { + $old_table_prefixes[] = $old_column_prefixes[] = ai1wm_table_prefix(); + $new_table_prefixes[] = $new_column_prefixes[] = ai1wm_servmask_prefix(); + } else { + // Set table prefixes based on table name + foreach ( $mysql->get_tables() as $table_name ) { + $old_table_prefixes[] = $table_name; + $new_table_prefixes[] = ai1wm_servmask_prefix() . $table_name; + } + + // Set table prefixes based on column name + foreach ( array( 'user_roles' ) as $option_name ) { + $old_column_prefixes[] = $option_name; + $new_column_prefixes[] = ai1wm_servmask_prefix() . $option_name; + } + + // Set table prefixes based on column name + foreach ( array( 'capabilities', 'user_level', 'dashboard_quick_press_last_post_id', 'user-settings', 'user-settings-time' ) as $meta_key ) { + $old_column_prefixes[] = $meta_key; + $new_column_prefixes[] = ai1wm_servmask_prefix() . $meta_key; + } + } + + $include_table_prefixes = array(); + $exclude_table_prefixes = array(); + + // Include table prefixes + if ( ai1wm_table_prefix() ) { + $include_table_prefixes[] = ai1wm_table_prefix(); + } else { + foreach ( $mysql->get_tables() as $table_name ) { + $include_table_prefixes[] = $table_name; + } + } + + // Set database options + $mysql->set_old_table_prefixes( $old_table_prefixes ) + ->set_new_table_prefixes( $new_table_prefixes ) + ->set_old_column_prefixes( $old_column_prefixes ) + ->set_new_column_prefixes( $new_column_prefixes ) + ->set_include_table_prefixes( $include_table_prefixes ) + ->set_exclude_table_prefixes( $exclude_table_prefixes ); + + // Exclude site options + $mysql->set_table_where_clauses( ai1wm_table_prefix() . 'options', array( sprintf( "`option_name` NOT IN ('%s', '%s', '%s', '%s', '%s', '%s', '%s')", AI1WM_ACTIVE_PLUGINS, AI1WM_ACTIVE_TEMPLATE, AI1WM_ACTIVE_STYLESHEET, AI1WM_STATUS, AI1WM_SECRET_KEY, AI1WM_AUTH_USER, AI1WM_AUTH_PASSWORD ) ) ); + + // Replace table prefix on columns + $mysql->set_table_prefix_columns( ai1wm_table_prefix() . 'options', array( 'option_name' ) ) + ->set_table_prefix_columns( ai1wm_table_prefix() . 'usermeta', array( 'meta_key' ) ); + + // Export database + if ( $mysql->export( ai1wm_database_path( $params ), $table_index, $table_offset ) ) { + + // Set progress + Ai1wm_Status::info( __( 'Done exporting database.', AI1WM_PLUGIN_NAME ) ); + + // Unset table index + unset( $params['table_index'] ); + + // Unset table offset + unset( $params['table_offset'] ); + + // Unset total tables count + unset( $params['total_tables_count'] ); + + // Unset completed flag + unset( $params['completed'] ); + + } else { + + // Get total tables count + $total_tables_count = count( $mysql->get_tables() ); + + // What percent of tables have we processed? + $progress = (int) ( ( $table_index / $total_tables_count ) * 100 ); + + // Set progress + Ai1wm_Status::info( sprintf( __( 'Exporting database...
%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) ); + + // Set table index + $params['table_index'] = $table_index; + + // Set table offset + $params['table_offset'] = $table_offset; + + // Set total tables count + $params['total_tables_count'] = $total_tables_count; + + // Set completed flag + $params['completed'] = false; + } + + return $params; + } +} diff --git a/lib/model/export/class-ai1wm-export-download.php b/lib/model/export/class-ai1wm-export-download.php new file mode 100644 index 0000000..9347958 --- /dev/null +++ b/lib/model/export/class-ai1wm-export-download.php @@ -0,0 +1,75 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Export_Download { + + public static function execute( $params ) { + + // Set progress + Ai1wm_Status::info( __( 'Renaming exported file...', AI1WM_PLUGIN_NAME ) ); + + // Open the archive file for writing + $archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) ); + + // Append EOF block + $archive->close( true ); + + // Rename archive file + if ( rename( ai1wm_archive_path( $params ), ai1wm_backup_path( $params ) ) ) { + + $blog_id = null; + + // Get subsite Blog ID + if ( isset( $params['options']['sites'] ) && ( $sites = $params['options']['sites'] ) ) { + if ( count( $sites ) === 1 ) { + $blog_id = array_shift( $sites ); + } + } + + // Set archive details + $link = ai1wm_backup_url( $params ); + $size = ai1wm_backup_size( $params ); + $name = ai1wm_site_name( $blog_id ); + + // Set progress + Ai1wm_Status::download( + sprintf( + __( + '' . + 'Download %s' . + 'Size: %s' . + '', + AI1WM_PLUGIN_NAME + ), + $link, + $name, + $size + ) + ); + } + + return $params; + } +} diff --git a/lib/model/export/class-ai1wm-export-enumerate.php b/lib/model/export/class-ai1wm-export-enumerate.php new file mode 100644 index 0000000..b49ef1a --- /dev/null +++ b/lib/model/export/class-ai1wm-export-enumerate.php @@ -0,0 +1,146 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Export_Enumerate { + + public static function execute( $params ) { + + // Get total files count + if ( isset( $params['total_files_count'] ) ) { + $total_files_count = (int) $params['total_files_count']; + } else { + $total_files_count = 0; + } + + // Get total files size + if ( isset( $params['total_files_size'] ) ) { + $total_files_size = (int) $params['total_files_size']; + } else { + $total_files_size = 0; + } + + // Set progress + Ai1wm_Status::info( __( 'Retrieving a list of all WordPress files...', AI1WM_PLUGIN_NAME ) ); + + // Set exclude filters + $exclude_filters = ai1wm_content_filters(); + + // Exclude cache + if ( isset( $params['options']['no_cache'] ) ) { + $exclude_filters[] = 'cache'; + } + + // Exclude themes + if ( isset( $params['options']['no_themes'] ) ) { + $exclude_filters[] = 'themes'; + } else { + $inactive_themes = array(); + + // Exclude inactive themes + if ( isset( $params['options']['no_inactive_themes'] ) ) { + foreach ( wp_get_themes() as $theme => $info ) { + // Exclude current parent and child themes + if ( ! in_array( $theme, array( get_template(), get_stylesheet() ) ) ) { + $inactive_themes[] = 'themes' . DIRECTORY_SEPARATOR . $theme; + } + } + } + + // Set exclude filters + $exclude_filters = array_merge( $exclude_filters, $inactive_themes ); + } + + // Exclude must-use plugins + if ( isset( $params['options']['no_muplugins'] ) ) { + $exclude_filters = array_merge( $exclude_filters, array( 'mu-plugins' ) ); + } + + // Exclude plugins + if ( isset( $params['options']['no_plugins'] ) ) { + $exclude_filters = array_merge( $exclude_filters, array( 'plugins' ) ); + } else { + $inactive_plugins = array(); + + // Exclude inactive plugins + if ( isset( $params['options']['no_inactive_plugins'] ) ) { + foreach ( get_plugins() as $plugin => $info ) { + if ( is_plugin_inactive( $plugin ) ) { + $inactive_plugins[] = 'plugins' . DIRECTORY_SEPARATOR . + ( ( dirname( $plugin ) === '.' ) ? basename( $plugin ) : dirname( $plugin ) ); + } + } + } + + // Set exclude filters + $exclude_filters = array_merge( $exclude_filters, ai1wm_plugin_filters( $inactive_plugins ) ); + } + + // Exclude media + if ( isset( $params['options']['no_media'] ) ) { + $exclude_filters = array_merge( $exclude_filters, array( 'uploads', 'blogs.dir' ) ); + } + + // Create map file + $filemap = ai1wm_open( ai1wm_filemap_path( $params ), 'w' ); + + // Iterate over content directory + $iterator = new Ai1wm_Recursive_Directory_Iterator( WP_CONTENT_DIR ); + + // Exclude new line file names + $iterator = new Ai1wm_Recursive_Newline_Filter( $iterator ); + + // Exclude uploads, plugins or themes + $iterator = new Ai1wm_Recursive_Exclude_Filter( $iterator, apply_filters( 'ai1wm_exclude_content_from_export', $exclude_filters ) ); + + // Recursively iterate over content directory + $iterator = new Ai1wm_Recursive_Iterator_Iterator( $iterator, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD ); + + // Write path line + foreach ( $iterator as $item ) { + if ( $item->isFile() ) { + if ( ai1wm_write( $filemap, $iterator->getSubPathName() . PHP_EOL ) ) { + $total_files_count++; + + // Add current file size + $total_files_size += $iterator->getSize(); + } + } + } + + // Set progress + Ai1wm_Status::info( __( 'Done retrieving a list of all WordPress files.', AI1WM_PLUGIN_NAME ) ); + + // Set total files count + $params['total_files_count'] = $total_files_count; + + // Set total files size + $params['total_files_size'] = $total_files_size; + + // Close the filemap file + ai1wm_close( $filemap ); + + return $params; + } +} diff --git a/lib/model/export/class-ai1wm-export-init.php b/lib/model/export/class-ai1wm-export-init.php new file mode 100644 index 0000000..173de4f --- /dev/null +++ b/lib/model/export/class-ai1wm-export-init.php @@ -0,0 +1,51 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Export_Init { + + public static function execute( $params ) { + + $blog_id = null; + + // Get subsite Blog ID + if ( isset( $params['options']['sites'] ) && ( $sites = $params['options']['sites'] ) ) { + if ( count( $sites ) === 1 ) { + $blog_id = array_shift( $sites ); + } + } + + // Set archive + if ( empty( $params['archive'] ) ) { + $params['archive'] = ai1wm_archive_file( $blog_id ); + } + + // Set storage + if ( empty( $params['storage'] ) ) { + $params['storage'] = ai1wm_storage_folder(); + } + + return $params; + } +} diff --git a/lib/model/import/class-ai1wm-import-blogs.php b/lib/model/import/class-ai1wm-import-blogs.php new file mode 100644 index 0000000..b9a2168 --- /dev/null +++ b/lib/model/import/class-ai1wm-import-blogs.php @@ -0,0 +1,128 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Import_Blogs { + + public static function execute( $params ) { + + // Set progress + Ai1wm_Status::info( __( 'Preparing blogs...', AI1WM_PLUGIN_NAME ) ); + + $blogs = array(); + + // Check multisite.json file + if ( true === is_file( ai1wm_multisite_path( $params ) ) ) { + + // Read multisite.json file + $handle = ai1wm_open( ai1wm_multisite_path( $params ), 'r' ); + + // Parse multisite.json file + $multisite = ai1wm_read( $handle, filesize( ai1wm_multisite_path( $params ) ) ); + $multisite = json_decode( $multisite, true ); + + // Close handle + ai1wm_close( $handle ); + + // Validate + if ( empty( $multisite['Network'] ) ) { + if ( isset( $multisite['Sites'] ) && ( $sites = $multisite['Sites'] ) ) { + if ( count( $sites ) === 1 && ( $subsite = current( $sites ) ) ) { + + // Set internal Site URL (backward compatibility) + if ( empty( $subsite['InternalSiteURL'] ) ) { + $subsite['InternalSiteURL'] = null; + } + + // Set internal Home URL (backward compatibility) + if ( empty( $subsite['InternalHomeURL'] ) ) { + $subsite['InternalHomeURL'] = null; + } + + // Set active plugins (backward compatibility) + if ( empty( $subsite['Plugins'] ) ) { + $subsite['Plugins'] = array(); + } + + // Set active template (backward compatibility) + if ( empty( $subsite['Template'] ) ) { + $subsite['Template'] = null; + } + + // Set active stylesheet (backward compatibility) + if ( empty( $subsite['Stylesheet'] ) ) { + $subsite['Stylesheet'] = null; + } + + // Set blog items + $blogs[] = array( + 'Old' => array( + 'BlogID' => $subsite['BlogID'], + 'SiteURL' => $subsite['SiteURL'], + 'HomeURL' => $subsite['HomeURL'], + 'InternalSiteURL' => $subsite['InternalSiteURL'], + 'InternalHomeURL' => $subsite['InternalHomeURL'], + 'Plugins' => $subsite['Plugins'], + 'Template' => $subsite['Template'], + 'Stylesheet' => $subsite['Stylesheet'], + ), + 'New' => array( + 'BlogID' => null, + 'SiteURL' => site_url(), + 'HomeURL' => home_url(), + 'InternalSiteURL' => site_url(), + 'InternalHomeURL' => home_url(), + 'Plugins' => $subsite['Plugins'], + 'Template' => $subsite['Template'], + 'Stylesheet' => $subsite['Stylesheet'], + ), + ); + } else { + throw new Ai1wm_Import_Exception( + __( 'The archive should contain Single WordPress site! Please revisit your export settings.', AI1WM_PLUGIN_NAME ) + ); + } + } else { + throw new Ai1wm_Import_Exception( + __( 'At least one WordPress site should be presented in the archive.', AI1WM_PLUGIN_NAME ) + ); + } + } else { + throw new Ai1wm_Import_Exception( + __( 'Unable to import WordPress Network into WordPress Single site.', AI1WM_PLUGIN_NAME ) + ); + } + } + + // Write blogs.json file + $handle = ai1wm_open( ai1wm_blogs_path( $params ), 'w' ); + ai1wm_write( $handle, json_encode( $blogs ) ); + ai1wm_close( $handle ); + + // Set progress + Ai1wm_Status::info( __( 'Done preparing blogs.', AI1WM_PLUGIN_NAME ) ); + + return $params; + } +} diff --git a/lib/model/import/class-ai1wm-import-clean.php b/lib/model/import/class-ai1wm-import-clean.php new file mode 100644 index 0000000..62d467d --- /dev/null +++ b/lib/model/import/class-ai1wm-import-clean.php @@ -0,0 +1,32 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Import_Clean { + + public static function execute( $params ) { + Ai1wm_Directory::delete( ai1wm_storage_path( $params ) ); + exit; + } +} diff --git a/lib/model/import/class-ai1wm-import-compatibility.php b/lib/model/import/class-ai1wm-import-compatibility.php new file mode 100644 index 0000000..8d80ae2 --- /dev/null +++ b/lib/model/import/class-ai1wm-import-compatibility.php @@ -0,0 +1,47 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Import_Compatibility { + + public static function execute( $params ) { + + // Set progress + Ai1wm_Status::info( __( 'Checking extensions compatibility...', AI1WM_PLUGIN_NAME ) ); + + // Get messages + $messages = Ai1wm_Compatibility::get( $params ); + + // Set messages + if ( empty( $messages ) ) { + return $params; + } + + // Enable notifications + add_filter( 'ai1wm_notification_error_toggle', '__return_true', 20 ); + + // Error message + throw new Ai1wm_Compatibility_Exception( implode( $messages ) ); + } +} diff --git a/lib/model/import/class-ai1wm-import-confirm.php b/lib/model/import/class-ai1wm-import-confirm.php new file mode 100644 index 0000000..3fdbb1c --- /dev/null +++ b/lib/model/import/class-ai1wm-import-confirm.php @@ -0,0 +1,64 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Import_Confirm { + + public static function execute( $params ) { + + $messages = array(); + + // Read package.json file + $handle = ai1wm_open( ai1wm_package_path( $params ), 'r' ); + + // Parse package.json file + $package = ai1wm_read( $handle, filesize( ai1wm_package_path( $params ) ) ); + $package = json_decode( $package, true ); + + // Close handle + ai1wm_close( $handle ); + + // Set message + $messages[] = __( + 'The import process will overwrite your website including the database, media, plugins, and themes. ' . + 'Please ensure that you have a backup of your data before proceeding to the next step.', + AI1WM_PLUGIN_NAME + ); + + // Check compatibility of PHP versions + if ( isset( $package['PHP']['Version'] ) ) { + if ( version_compare( $package['PHP']['Version'], '7.0.0', '<' ) && version_compare( PHP_VERSION, '7.0.0', '>=' ) ) { + $messages[] = __( + 'Your backup is from a PHP 5 but the site that you are importing to is PHP 7. ' . + 'This could cause the import to fail. Technical details', + AI1WM_PLUGIN_NAME + ); + } + } + + // Set progress + Ai1wm_Status::confirm( implode( $messages ) ); + exit; + } +} diff --git a/lib/model/import/class-ai1wm-import-content.php b/lib/model/import/class-ai1wm-import-content.php new file mode 100644 index 0000000..90792a2 --- /dev/null +++ b/lib/model/import/class-ai1wm-import-content.php @@ -0,0 +1,229 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Import_Content { + + public static function execute( $params ) { + + // Set archive bytes offset + if ( isset( $params['archive_bytes_offset'] ) ) { + $archive_bytes_offset = (int) $params['archive_bytes_offset']; + } else { + $archive_bytes_offset = 0; + } + + // Set file bytes offset + if ( isset( $params['file_bytes_offset'] ) ) { + $file_bytes_offset = (int) $params['file_bytes_offset']; + } else { + $file_bytes_offset = 0; + } + + // Get processed files size + if ( isset( $params['processed_files_size'] ) ) { + $processed_files_size = (int) $params['processed_files_size']; + } else { + $processed_files_size = 0; + } + + // Get total files size + if ( isset( $params['total_files_size'] ) ) { + $total_files_size = (int) $params['total_files_size']; + } else { + $total_files_size = 1; + } + + // Get total files count + if ( isset( $params['total_files_count'] ) ) { + $total_files_count = (int) $params['total_files_count']; + } else { + $total_files_count = 1; + } + + // Read blogs.json file + $handle = ai1wm_open( ai1wm_blogs_path( $params ), 'r' ); + + // Parse blogs.json file + $blogs = ai1wm_read( $handle, filesize( ai1wm_blogs_path( $params ) ) ); + $blogs = json_decode( $blogs, true ); + + // Close handle + ai1wm_close( $handle ); + + // What percent of files have we processed? + $progress = (int) min( ( $processed_files_size / $total_files_size ) * 100, 100 ); + + // Set progress + Ai1wm_Status::info( sprintf( __( 'Restoring %d files...
%d%% complete', AI1WM_PLUGIN_NAME ), $total_files_count, $progress ) ); + + // Flag to hold if file data has been processed + $completed = true; + + // Start time + $start = microtime( true ); + + // Open the archive file for reading + $archive = new Ai1wm_Extractor( ai1wm_archive_path( $params ) ); + + // Set the file pointer to the one that we have saved + $archive->set_file_pointer( $archive_bytes_offset ); + + $old_paths = array(); + $new_paths = array(); + + // Set extract paths + foreach ( $blogs as $blog ) { + if ( ai1wm_main_site( $blog['Old']['BlogID'] ) === false ) { + if ( defined( 'UPLOADBLOGSDIR' ) ) { + // Old sites dir style + $old_paths[] = ai1wm_files_path( $blog['Old']['BlogID'] ); + $new_paths[] = ai1wm_files_path( $blog['New']['BlogID'] ); + + // New sites dir style + $old_paths[] = ai1wm_sites_path( $blog['Old']['BlogID'] ); + $new_paths[] = ai1wm_files_path( $blog['New']['BlogID'] ); + } else { + // Old sites dir style + $old_paths[] = ai1wm_files_path( $blog['Old']['BlogID'] ); + $new_paths[] = ai1wm_sites_path( $blog['New']['BlogID'] ); + + // New sites dir style + $old_paths[] = ai1wm_sites_path( $blog['Old']['BlogID'] ); + $new_paths[] = ai1wm_sites_path( $blog['New']['BlogID'] ); + } + } + } + + // Set base site extract paths (should be added at the end of arrays) + foreach ( $blogs as $blog ) { + if ( ai1wm_main_site( $blog['Old']['BlogID'] ) === true ) { + if ( defined( 'UPLOADBLOGSDIR' ) ) { + // Old sites dir style + $old_paths[] = ai1wm_files_path( $blog['Old']['BlogID'] ); + $new_paths[] = ai1wm_files_path( $blog['New']['BlogID'] ); + + // New sites dir style + $old_paths[] = ai1wm_sites_path( $blog['Old']['BlogID'] ); + $new_paths[] = ai1wm_files_path( $blog['New']['BlogID'] ); + } else { + // Old sites dir style + $old_paths[] = ai1wm_files_path( $blog['Old']['BlogID'] ); + $new_paths[] = ai1wm_sites_path( $blog['New']['BlogID'] ); + + // New sites dir style + $old_paths[] = ai1wm_sites_path( $blog['Old']['BlogID'] ); + $new_paths[] = ai1wm_sites_path( $blog['New']['BlogID'] ); + } + } + } + + while ( $archive->has_not_reached_eof() ) { + $file_bytes_written = 0; + + // Exclude WordPress files + $exclude_files = array_keys( _get_dropins() ); + + // Exclude plugin files + $exclude_files = array_merge( $exclude_files, array( + AI1WM_PACKAGE_NAME, + AI1WM_MULTISITE_NAME, + AI1WM_DATABASE_NAME, + AI1WM_MUPLUGINS_NAME, + ) ); + + // Extract a file from archive to WP_CONTENT_DIR + if ( ( $completed = $archive->extract_one_file_to( WP_CONTENT_DIR, $exclude_files, $old_paths, $new_paths, $file_bytes_written, $file_bytes_offset ) ) ) { + $file_bytes_offset = 0; + } + + // Get archive bytes offset + $archive_bytes_offset = $archive->get_file_pointer(); + + // Increment processed files size + $processed_files_size += $file_bytes_written; + + // What percent of files have we processed? + $progress = (int) min( ( $processed_files_size / $total_files_size ) * 100, 100 ); + + // Set progress + Ai1wm_Status::info( sprintf( __( 'Restoring %d files...
%d%% complete', AI1WM_PLUGIN_NAME ), $total_files_count, $progress ) ); + + // More than 10 seconds have passed, break and do another request + if ( ( $timeout = apply_filters( 'ai1wm_completed_timeout', 10 ) ) ) { + if ( ( microtime( true ) - $start ) > $timeout ) { + $completed = false; + break; + } + } + } + + // End of the archive? + if ( $archive->has_reached_eof() ) { + + // Unset archive bytes offset + unset( $params['archive_bytes_offset'] ); + + // Unset file bytes offset + unset( $params['file_bytes_offset'] ); + + // Unset processed files size + unset( $params['processed_files_size'] ); + + // Unset total files size + unset( $params['total_files_size'] ); + + // Unset total files count + unset( $params['total_files_count'] ); + + // Unset completed flag + unset( $params['completed'] ); + + } else { + + // Set archive bytes offset + $params['archive_bytes_offset'] = $archive_bytes_offset; + + // Set file bytes offset + $params['file_bytes_offset'] = $file_bytes_offset; + + // Set processed files size + $params['processed_files_size'] = $processed_files_size; + + // Set total files size + $params['total_files_size'] = $total_files_size; + + // Set total files count + $params['total_files_count'] = $total_files_count; + + // Set completed flag + $params['completed'] = $completed; + } + + // Close the archive file + $archive->close(); + + return $params; + } +} diff --git a/lib/model/import/class-ai1wm-import-database.php b/lib/model/import/class-ai1wm-import-database.php new file mode 100644 index 0000000..eff5bfc --- /dev/null +++ b/lib/model/import/class-ai1wm-import-database.php @@ -0,0 +1,833 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Import_Database { + + public static function execute( $params ) { + global $wpdb; + + // Skip database import + if ( ! is_file( ai1wm_database_path( $params ) ) ) { + return $params; + } + + // Set query offset + if ( isset( $params['query_offset'] ) ) { + $query_offset = (int) $params['query_offset']; + } else { + $query_offset = 0; + } + + // Set total queries size + if ( isset( $params['total_queries_size'] ) ) { + $total_queries_size = (int) $params['total_queries_size']; + } else { + $total_queries_size = 1; + } + + // Read blogs.json file + $handle = ai1wm_open( ai1wm_blogs_path( $params ), 'r' ); + + // Parse blogs.json file + $blogs = ai1wm_read( $handle, filesize( ai1wm_blogs_path( $params ) ) ); + $blogs = json_decode( $blogs, true ); + + // Close handle + ai1wm_close( $handle ); + + // Read package.json file + $handle = ai1wm_open( ai1wm_package_path( $params ), 'r' ); + + // Parse package.json file + $config = ai1wm_read( $handle, filesize( ai1wm_package_path( $params ) ) ); + $config = json_decode( $config, true ); + + // Close handle + ai1wm_close( $handle ); + + // What percent of queries have we processed? + $progress = (int) ( ( $query_offset / $total_queries_size ) * 100 ); + + // Set progress + Ai1wm_Status::info( sprintf( __( 'Restoring database...
%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) ); + + $old_replace_values = $old_replace_raw_values = array(); + $new_replace_values = $new_replace_raw_values = array(); + + // Get Blog URLs + foreach ( $blogs as $blog ) { + + $home_urls = array(); + + // Add Home URL + if ( ! empty( $blog['Old']['HomeURL'] ) ) { + $home_urls[] = $blog['Old']['HomeURL']; + } + + // Add Internal Home URL + if ( ! empty( $blog['Old']['InternalHomeURL'] ) ) { + if ( parse_url( $blog['Old']['InternalHomeURL'], PHP_URL_SCHEME ) && parse_url( $blog['Old']['InternalHomeURL'], PHP_URL_HOST ) ) { + $home_urls[] = $blog['Old']['InternalHomeURL']; + } + } + + // Get Home URL + foreach ( $home_urls as $home_url ) { + + // Get blogs dir Upload Path + if ( ! in_array( sprintf( "'%s'", trim( ai1wm_blogsdir_path( $blog['Old']['BlogID'] ), '/' ) ), $old_replace_raw_values ) ) { + $old_replace_raw_values[] = sprintf( "'%s'", trim( ai1wm_blogsdir_path( $blog['Old']['BlogID'] ), '/' ) ); + $new_replace_raw_values[] = sprintf( "'%s'", get_option( 'upload_path' ) ); + } + + // Get sites dir Upload Path + if ( ! in_array( sprintf( "'%s'", trim( ai1wm_uploads_path( $blog['Old']['BlogID'] ), '/' ) ), $old_replace_raw_values ) ) { + $old_replace_raw_values[] = sprintf( "'%s'", trim( ai1wm_uploads_path( $blog['Old']['BlogID'] ), '/' ) ); + $new_replace_raw_values[] = sprintf( "'%s'", get_option( 'upload_path' ) ); + } + + // Handle old and new sites dir style + if ( defined( 'UPLOADBLOGSDIR' ) ) { + + // Get plain Upload Path + if ( ! in_array( ai1wm_blogsdir_path( $blog['Old']['BlogID'] ), $old_replace_values ) ) { + $old_replace_values[] = ai1wm_blogsdir_path( $blog['Old']['BlogID'] ); + $new_replace_values[] = ai1wm_blogsdir_path( $blog['New']['BlogID'] ); + } + + // Get URL encoded Upload Path + if ( ! in_array( urlencode( ai1wm_blogsdir_path( $blog['Old']['BlogID'] ) ), $old_replace_values ) ) { + $old_replace_values[] = urlencode( ai1wm_blogsdir_path( $blog['Old']['BlogID'] ) ); + $new_replace_values[] = urlencode( ai1wm_blogsdir_path( $blog['New']['BlogID'] ) ); + } + + // Get URL raw encoded Upload Path + if ( ! in_array( rawurlencode( ai1wm_blogsdir_path( $blog['Old']['BlogID'] ) ), $old_replace_values ) ) { + $old_replace_values[] = rawurlencode( ai1wm_blogsdir_path( $blog['Old']['BlogID'] ) ); + $new_replace_values[] = rawurlencode( ai1wm_blogsdir_path( $blog['New']['BlogID'] ) ); + } + + // Get JSON escaped Upload Path + if ( ! in_array( addcslashes( ai1wm_blogsdir_path( $blog['Old']['BlogID'] ), '/' ), $old_replace_values ) ) { + $old_replace_values[] = addcslashes( ai1wm_blogsdir_path( $blog['Old']['BlogID'] ), '/' ); + $new_replace_values[] = addcslashes( ai1wm_blogsdir_path( $blog['New']['BlogID'] ), '/' ); + } + + // Get plain Upload Path + if ( ! in_array( ai1wm_uploads_path( $blog['Old']['BlogID'] ), $old_replace_values ) ) { + $old_replace_values[] = ai1wm_uploads_path( $blog['Old']['BlogID'] ); + $new_replace_values[] = ai1wm_blogsdir_path( $blog['New']['BlogID'] ); + } + + // Get URL encoded Upload Path + if ( ! in_array( urlencode( ai1wm_uploads_path( $blog['Old']['BlogID'] ) ), $old_replace_values ) ) { + $old_replace_values[] = urlencode( ai1wm_uploads_path( $blog['Old']['BlogID'] ) ); + $new_replace_values[] = urlencode( ai1wm_blogsdir_path( $blog['New']['BlogID'] ) ); + } + + // Get URL raw encoded Upload Path + if ( ! in_array( rawurlencode( ai1wm_uploads_path( $blog['Old']['BlogID'] ) ), $old_replace_values ) ) { + $old_replace_values[] = rawurlencode( ai1wm_uploads_path( $blog['Old']['BlogID'] ) ); + $new_replace_values[] = rawurlencode( ai1wm_blogsdir_path( $blog['New']['BlogID'] ) ); + } + + // Get JSON escaped Upload Path + if ( ! in_array( addcslashes( ai1wm_uploads_path( $blog['Old']['BlogID'] ), '/' ), $old_replace_values ) ) { + $old_replace_values[] = addcslashes( ai1wm_uploads_path( $blog['Old']['BlogID'] ), '/' ); + $new_replace_values[] = addcslashes( ai1wm_blogsdir_path( $blog['New']['BlogID'] ), '/' ); + } + } else { + + // Get files dir Upload URL + if ( ! in_array( sprintf( '%s/%s/', untrailingslashit( $home_url ), 'files' ), $old_replace_values ) ) { + $old_replace_values[] = sprintf( '%s/%s/', untrailingslashit( $home_url ), 'files' ); + $new_replace_values[] = ai1wm_uploads_url( $blog['New']['BlogID'] ); + } + + // Get plain Upload Path + if ( ! in_array( ai1wm_blogsdir_path( $blog['Old']['BlogID'] ), $old_replace_values ) ) { + $old_replace_values[] = ai1wm_blogsdir_path( $blog['Old']['BlogID'] ); + $new_replace_values[] = ai1wm_uploads_path( $blog['New']['BlogID'] ); + } + + // Get URL encoded Upload Path + if ( ! in_array( urlencode( ai1wm_blogsdir_path( $blog['Old']['BlogID'] ) ), $old_replace_values ) ) { + $old_replace_values[] = urlencode( ai1wm_blogsdir_path( $blog['Old']['BlogID'] ) ); + $new_replace_values[] = urlencode( ai1wm_uploads_path( $blog['New']['BlogID'] ) ); + } + + // Get URL raw encoded Upload Path + if ( ! in_array( rawurlencode( ai1wm_blogsdir_path( $blog['Old']['BlogID'] ) ), $old_replace_values ) ) { + $old_replace_values[] = rawurlencode( ai1wm_blogsdir_path( $blog['Old']['BlogID'] ) ); + $new_replace_values[] = rawurlencode( ai1wm_uploads_path( $blog['New']['BlogID'] ) ); + } + + // Get JSON escaped Upload Path + if ( ! in_array( addcslashes( ai1wm_blogsdir_path( $blog['Old']['BlogID'] ), '/' ), $old_replace_values ) ) { + $old_replace_values[] = addcslashes( ai1wm_blogsdir_path( $blog['Old']['BlogID'] ), '/' ); + $new_replace_values[] = addcslashes( ai1wm_uploads_path( $blog['New']['BlogID'] ), '/' ); + } + + // Get plain Upload Path + if ( ! in_array( ai1wm_uploads_path( $blog['Old']['BlogID'] ), $old_replace_values ) ) { + $old_replace_values[] = ai1wm_uploads_path( $blog['Old']['BlogID'] ); + $new_replace_values[] = ai1wm_uploads_path( $blog['New']['BlogID'] ); + } + + // Get URL encoded Upload Path + if ( ! in_array( urlencode( ai1wm_uploads_path( $blog['Old']['BlogID'] ) ), $old_replace_values ) ) { + $old_replace_values[] = urlencode( ai1wm_uploads_path( $blog['Old']['BlogID'] ) ); + $new_replace_values[] = urlencode( ai1wm_uploads_path( $blog['New']['BlogID'] ) ); + } + + // Get URL raw encoded Upload Path + if ( ! in_array( rawurlencode( ai1wm_uploads_path( $blog['Old']['BlogID'] ) ), $old_replace_values ) ) { + $old_replace_values[] = rawurlencode( ai1wm_uploads_path( $blog['Old']['BlogID'] ) ); + $new_replace_values[] = rawurlencode( ai1wm_uploads_path( $blog['New']['BlogID'] ) ); + } + + // Get JSON escaped Upload Path + if ( ! in_array( addcslashes( ai1wm_uploads_path( $blog['Old']['BlogID'] ), '/' ), $old_replace_values ) ) { + $old_replace_values[] = addcslashes( ai1wm_uploads_path( $blog['Old']['BlogID'] ), '/' ); + $new_replace_values[] = addcslashes( ai1wm_uploads_path( $blog['New']['BlogID'] ), '/' ); + } + } + } + + $site_urls = array(); + + // Add Site URL + if ( ! empty( $blog['Old']['SiteURL'] ) ) { + $site_urls[] = $blog['Old']['SiteURL']; + } + + // Add Internal Site URL + if ( ! empty( $blog['Old']['InternalSiteURL'] ) ) { + if ( parse_url( $blog['Old']['InternalSiteURL'], PHP_URL_SCHEME ) && parse_url( $blog['Old']['InternalSiteURL'], PHP_URL_HOST ) ) { + $site_urls[] = $blog['Old']['InternalSiteURL']; + } + } + + // Get Site URL + foreach ( $site_urls as $site_url ) { + + // Replace Site URL + if ( $site_url !== $blog['New']['SiteURL'] ) { + + // Get www URL + if ( stripos( $site_url, '//www.' ) !== false ) { + $site_url_www_inversion = str_ireplace( '//www.', '//', $site_url ); + } else { + $site_url_www_inversion = str_ireplace( '//', '//www.', $site_url ); + } + + // Replace Site URL + foreach ( array( $site_url, $site_url_www_inversion ) as $url ) { + + // Get domain + $old_domain = parse_url( $url, PHP_URL_HOST ); + $new_domain = parse_url( $blog['New']['SiteURL'], PHP_URL_HOST ); + + // Get path + $old_path = parse_url( $url, PHP_URL_PATH ); + $new_path = parse_url( $blog['New']['SiteURL'], PHP_URL_PATH ); + + // Get scheme + $new_scheme = parse_url( $blog['New']['SiteURL'], PHP_URL_SCHEME ); + + // Add domain and path + if ( ! in_array( sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) ), $old_replace_raw_values ) ) { + $old_replace_raw_values[] = sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) ); + $new_replace_raw_values[] = sprintf( "'%s','%s'", $new_domain, trailingslashit( $new_path ) ); + } + + // Add domain and path with single quote + if ( ! in_array( sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) ), $old_replace_values ) ) { + $old_replace_values[] = sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) ); + $new_replace_values[] = sprintf( "='%s%s", $new_domain, untrailingslashit( $new_path ) ); + } + + // Add domain and path with double quote + if ( ! in_array( sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) ), $old_replace_values ) ) { + $old_replace_values[] = sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) ); + $new_replace_values[] = sprintf( '="%s%s', $new_domain, untrailingslashit( $new_path ) ); + } + + // Add Site URL scheme + $old_schemes = array( 'http', 'https', '' ); + $new_schemes = array( $new_scheme, $new_scheme, '' ); + + // Replace Site URL scheme + for ( $i = 0; $i < count( $old_schemes ); $i++ ) { + + // Add plain Site URL + if ( ! in_array( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), $old_replace_values ) ) { + $old_replace_values[] = ai1wm_url_scheme( $url, $old_schemes[ $i ] ); + $new_replace_values[] = ai1wm_url_scheme( $blog['New']['SiteURL'], $new_schemes[ $i ] ); + } + + // Add URL encoded Site URL + if ( ! in_array( urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) { + $old_replace_values[] = urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ); + $new_replace_values[] = urlencode( ai1wm_url_scheme( $blog['New']['SiteURL'], $new_schemes[ $i ] ) ); + } + + // Add URL raw encoded Site URL + if ( ! in_array( rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) { + $old_replace_values[] = rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ); + $new_replace_values[] = rawurlencode( ai1wm_url_scheme( $blog['New']['SiteURL'], $new_schemes[ $i ] ) ); + } + + // Add JSON escaped Site URL + if ( ! in_array( addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' ), $old_replace_values ) ) { + $old_replace_values[] = addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' ); + $new_replace_values[] = addcslashes( ai1wm_url_scheme( $blog['New']['SiteURL'], $new_schemes[ $i ] ), '/' ); + } + } + + // Add email + if ( ! isset( $config['NoEmailReplace'] ) ) { + if ( ! in_array( sprintf( '@%s', $old_domain ), $old_replace_values ) ) { + $old_replace_values[] = sprintf( '@%s', $old_domain ); + $new_replace_values[] = sprintf( '@%s', $new_domain ); + } + } + } + } + } + + $home_urls = array(); + + // Add Home URL + if ( ! empty( $blog['Old']['HomeURL'] ) ) { + $home_urls[] = $blog['Old']['HomeURL']; + } + + // Add Internal Home URL + if ( ! empty( $blog['Old']['InternalHomeURL'] ) ) { + if ( parse_url( $blog['Old']['InternalHomeURL'], PHP_URL_SCHEME ) && parse_url( $blog['Old']['InternalHomeURL'], PHP_URL_HOST ) ) { + $home_urls[] = $blog['Old']['InternalHomeURL']; + } + } + + // Get Home URL + foreach ( $home_urls as $home_url ) { + + // Replace Home URL + if ( $home_url !== $blog['New']['HomeURL'] ) { + + // Get www URL + if ( stripos( $home_url, '//www.' ) !== false ) { + $home_url_www_inversion = str_ireplace( '//www.', '//', $home_url ); + } else { + $home_url_www_inversion = str_ireplace( '//', '//www.', $home_url ); + } + + // Replace Home URL + foreach ( array( $home_url, $home_url_www_inversion ) as $url ) { + + // Get domain + $old_domain = parse_url( $url, PHP_URL_HOST ); + $new_domain = parse_url( $blog['New']['HomeURL'], PHP_URL_HOST ); + + // Get path + $old_path = parse_url( $url, PHP_URL_PATH ); + $new_path = parse_url( $blog['New']['HomeURL'], PHP_URL_PATH ); + + // Get scheme + $new_scheme = parse_url( $blog['New']['HomeURL'], PHP_URL_SCHEME ); + + // Add domain and path + if ( ! in_array( sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) ), $old_replace_raw_values ) ) { + $old_replace_raw_values[] = sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) ); + $new_replace_raw_values[] = sprintf( "'%s','%s'", $new_domain, trailingslashit( $new_path ) ); + } + + // Add domain and path with single quote + if ( ! in_array( sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) ), $old_replace_values ) ) { + $old_replace_values[] = sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) ); + $new_replace_values[] = sprintf( "='%s%s", $new_domain, untrailingslashit( $new_path ) ); + } + + // Add domain and path with double quote + if ( ! in_array( sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) ), $old_replace_values ) ) { + $old_replace_values[] = sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) ); + $new_replace_values[] = sprintf( '="%s%s', $new_domain, untrailingslashit( $new_path ) ); + } + + // Set Home URL scheme + $old_schemes = array( 'http', 'https', '' ); + $new_schemes = array( $new_scheme, $new_scheme, '' ); + + // Replace Home URL scheme + for ( $i = 0; $i < count( $old_schemes ); $i++ ) { + + // Add plain Home URL + if ( ! in_array( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), $old_replace_values ) ) { + $old_replace_values[] = ai1wm_url_scheme( $url, $old_schemes[ $i ] ); + $new_replace_values[] = ai1wm_url_scheme( $blog['New']['HomeURL'], $new_schemes[ $i ] ); + } + + // Add URL encoded Home URL + if ( ! in_array( urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) { + $old_replace_values[] = urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ); + $new_replace_values[] = urlencode( ai1wm_url_scheme( $blog['New']['HomeURL'], $new_schemes[ $i ] ) ); + } + + // Add URL raw encoded Home URL + if ( ! in_array( rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) { + $old_replace_values[] = rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ); + $new_replace_values[] = rawurlencode( ai1wm_url_scheme( $blog['New']['HomeURL'], $new_schemes[ $i ] ) ); + } + + // Add JSON escaped Home URL + if ( ! in_array( addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' ), $old_replace_values ) ) { + $old_replace_values[] = addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' ); + $new_replace_values[] = addcslashes( ai1wm_url_scheme( $blog['New']['HomeURL'], $new_schemes[ $i ] ), '/' ); + } + } + + // Add email + if ( ! isset( $config['NoEmailReplace'] ) ) { + if ( ! in_array( sprintf( '@%s', $old_domain ), $old_replace_values ) ) { + $old_replace_values[] = sprintf( '@%s', $old_domain ); + $new_replace_values[] = sprintf( '@%s', $new_domain ); + } + } + } + } + } + } + + $site_urls = array(); + + // Add Site URL + if ( ! empty( $config['SiteURL'] ) ) { + $site_urls[] = $config['SiteURL']; + } + + // Add Internal Site URL + if ( ! empty( $config['InternalSiteURL'] ) ) { + if ( parse_url( $config['InternalSiteURL'], PHP_URL_SCHEME ) && parse_url( $config['InternalSiteURL'], PHP_URL_HOST ) ) { + $site_urls[] = $config['InternalSiteURL']; + } + } + + // Get Site URL + foreach ( $site_urls as $site_url ) { + + // Replace Site URL + if ( $site_url !== site_url() ) { + + // Get www URL + if ( stripos( $site_url, '//www.' ) !== false ) { + $site_url_www_inversion = str_ireplace( '//www.', '//', $site_url ); + } else { + $site_url_www_inversion = str_ireplace( '//', '//www.', $site_url ); + } + + // Replace Site URL + foreach ( array( $site_url, $site_url_www_inversion ) as $url ) { + + // Get domain + $old_domain = parse_url( $url, PHP_URL_HOST ); + $new_domain = parse_url( site_url(), PHP_URL_HOST ); + + // Get path + $old_path = parse_url( $url, PHP_URL_PATH ); + $new_path = parse_url( site_url(), PHP_URL_PATH ); + + // Get scheme + $new_scheme = parse_url( site_url(), PHP_URL_SCHEME ); + + // Add domain and path + if ( ! in_array( sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) ), $old_replace_raw_values ) ) { + $old_replace_raw_values[] = sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) ); + $new_replace_raw_values[] = sprintf( "'%s','%s'", $new_domain, trailingslashit( $new_path ) ); + } + + // Add domain and path with single quote + if ( ! in_array( sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) ), $old_replace_values ) ) { + $old_replace_values[] = sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) ); + $new_replace_values[] = sprintf( "='%s%s", $new_domain, untrailingslashit( $new_path ) ); + } + + // Add domain and path with double quote + if ( ! in_array( sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) ), $old_replace_values ) ) { + $old_replace_values[] = sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) ); + $new_replace_values[] = sprintf( '="%s%s', $new_domain, untrailingslashit( $new_path ) ); + } + + // Set Site URL scheme + $old_schemes = array( 'http', 'https', '' ); + $new_schemes = array( $new_scheme, $new_scheme, '' ); + + // Replace Site URL scheme + for ( $i = 0; $i < count( $old_schemes ); $i++ ) { + + // Add plain Site URL + if ( ! in_array( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), $old_replace_values ) ) { + $old_replace_values[] = ai1wm_url_scheme( $url, $old_schemes[ $i ] ); + $new_replace_values[] = ai1wm_url_scheme( site_url(), $new_schemes[ $i ] ); + } + + // Add URL encoded Site URL + if ( ! in_array( urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) { + $old_replace_values[] = urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ); + $new_replace_values[] = urlencode( ai1wm_url_scheme( site_url(), $new_schemes[ $i ] ) ); + } + + // Add URL raw encoded Site URL + if ( ! in_array( rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) { + $old_replace_values[] = rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ); + $new_replace_values[] = rawurlencode( ai1wm_url_scheme( site_url(), $new_schemes[ $i ] ) ); + } + + // Add JSON escaped Site URL + if ( ! in_array( addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' ), $old_replace_values ) ) { + $old_replace_values[] = addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' ); + $new_replace_values[] = addcslashes( ai1wm_url_scheme( site_url(), $new_schemes[ $i ] ), '/' ); + } + } + + // Add email + if ( ! isset( $config['NoEmailReplace'] ) ) { + if ( ! in_array( sprintf( '@%s', $old_domain ), $old_replace_values ) ) { + $old_replace_values[] = sprintf( '@%s', $old_domain ); + $new_replace_values[] = sprintf( '@%s', $new_domain ); + } + } + } + } + } + + $home_urls = array(); + + // Add Home URL + if ( ! empty( $config['HomeURL'] ) ) { + $home_urls[] = $config['HomeURL']; + } + + // Add Internal Home URL + if ( ! empty( $config['InternalHomeURL'] ) ) { + if ( parse_url( $config['InternalHomeURL'], PHP_URL_SCHEME ) && parse_url( $config['InternalHomeURL'], PHP_URL_HOST ) ) { + $home_urls[] = $config['InternalHomeURL']; + } + } + + // Get Home URL + foreach ( $home_urls as $home_url ) { + + // Replace Home URL + if ( $home_url !== home_url() ) { + + // Get www URL + if ( stripos( $home_url, '//www.' ) !== false ) { + $home_url_www_inversion = str_ireplace( '//www.', '//', $home_url ); + } else { + $home_url_www_inversion = str_ireplace( '//', '//www.', $home_url ); + } + + // Replace Home URL + foreach ( array( $home_url, $home_url_www_inversion ) as $url ) { + + // Get domain + $old_domain = parse_url( $url, PHP_URL_HOST ); + $new_domain = parse_url( home_url(), PHP_URL_HOST ); + + // Get path + $old_path = parse_url( $url, PHP_URL_PATH ); + $new_path = parse_url( home_url(), PHP_URL_PATH ); + + // Get scheme + $new_scheme = parse_url( home_url(), PHP_URL_SCHEME ); + + // Add domain and path + if ( ! in_array( sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) ), $old_replace_raw_values ) ) { + $old_replace_raw_values[] = sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) ); + $new_replace_raw_values[] = sprintf( "'%s','%s'", $new_domain, trailingslashit( $new_path ) ); + } + + // Add domain and path with single quote + if ( ! in_array( sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) ), $old_replace_values ) ) { + $old_replace_values[] = sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) ); + $new_replace_values[] = sprintf( "='%s%s", $new_domain, untrailingslashit( $new_path ) ); + } + + // Add domain and path with double quote + if ( ! in_array( sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) ), $old_replace_values ) ) { + $old_replace_values[] = sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) ); + $new_replace_values[] = sprintf( '="%s%s', $new_domain, untrailingslashit( $new_path ) ); + } + + // Add Home URL scheme + $old_schemes = array( 'http', 'https', '' ); + $new_schemes = array( $new_scheme, $new_scheme, '' ); + + // Replace Home URL scheme + for ( $i = 0; $i < count( $old_schemes ); $i++ ) { + + // Add plain Home URL + if ( ! in_array( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), $old_replace_values ) ) { + $old_replace_values[] = ai1wm_url_scheme( $url, $old_schemes[ $i ] ); + $new_replace_values[] = ai1wm_url_scheme( home_url(), $new_schemes[ $i ] ); + } + + // Add URL encoded Home URL + if ( ! in_array( urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) { + $old_replace_values[] = urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ); + $new_replace_values[] = urlencode( ai1wm_url_scheme( home_url(), $new_schemes[ $i ] ) ); + } + + // Add URL raw encoded Home URL + if ( ! in_array( rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) { + $old_replace_values[] = rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ); + $new_replace_values[] = rawurlencode( ai1wm_url_scheme( home_url(), $new_schemes[ $i ] ) ); + } + + // Add JSON escaped Home URL + if ( ! in_array( addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' ), $old_replace_values ) ) { + $old_replace_values[] = addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' ); + $new_replace_values[] = addcslashes( ai1wm_url_scheme( home_url(), $new_schemes[ $i ] ), '/' ); + } + } + + // Add email + if ( ! isset( $config['NoEmailReplace'] ) ) { + if ( ! in_array( sprintf( '@%s', $old_domain ), $old_replace_values ) ) { + $old_replace_values[] = sprintf( '@%s', $old_domain ); + $new_replace_values[] = sprintf( '@%s', $new_domain ); + } + } + } + } + } + + // Get WordPress Content Dir + if ( isset( $config['WordPress']['Content'] ) && ( $content_dir = $config['WordPress']['Content'] ) ) { + + // Replace WordPress Content Dir + if ( $content_dir !== WP_CONTENT_DIR ) { + + // Add plain WordPress Content + if ( ! in_array( $content_dir, $old_replace_values ) ) { + $old_replace_values[] = $content_dir; + $new_replace_values[] = WP_CONTENT_DIR; + } + + // Add URL encoded WordPress Content + if ( ! in_array( urlencode( $content_dir ), $old_replace_values ) ) { + $old_replace_values[] = urlencode( $content_dir ); + $new_replace_values[] = urlencode( WP_CONTENT_DIR ); + } + + // Add URL raw encoded WordPress Content + if ( ! in_array( rawurlencode( $content_dir ), $old_replace_values ) ) { + $old_replace_values[] = rawurlencode( $content_dir ); + $new_replace_values[] = rawurlencode( WP_CONTENT_DIR ); + } + + // Add JSON escaped WordPress Content + if ( ! in_array( addcslashes( $content_dir, '/' ), $old_replace_values ) ) { + $old_replace_values[] = addcslashes( $content_dir, '/' ); + $new_replace_values[] = addcslashes( WP_CONTENT_DIR, '/' ); + } + } + } + + // Get replace old and new values + if ( isset( $config['Replace'] ) && ( $replace = $config['Replace'] ) ) { + for ( $i = 0; $i < count( $replace['OldValues'] ); $i++ ) { + if ( ! empty( $replace['OldValues'][ $i ] ) && ! empty( $replace['NewValues'][ $i ] ) ) { + + // Add plain replace values + if ( ! in_array( $replace['OldValues'][ $i ], $old_replace_values ) ) { + $old_replace_values[] = $replace['OldValues'][ $i ]; + $new_replace_values[] = $replace['NewValues'][ $i ]; + } + + // Add URL encoded replace values + if ( ! in_array( urlencode( $replace['OldValues'][ $i ] ), $old_replace_values ) ) { + $old_replace_values[] = urlencode( $replace['OldValues'][ $i ] ); + $new_replace_values[] = urlencode( $replace['NewValues'][ $i ] ); + } + + // Add URL raw encoded replace values + if ( ! in_array( rawurlencode( $replace['OldValues'][ $i ] ), $old_replace_values ) ) { + $old_replace_values[] = rawurlencode( $replace['OldValues'][ $i ] ); + $new_replace_values[] = rawurlencode( $replace['NewValues'][ $i ] ); + } + + // Add JSON Escaped replace values + if ( ! in_array( addcslashes( $replace['OldValues'][ $i ], '/' ), $old_replace_values ) ) { + $old_replace_values[] = addcslashes( $replace['OldValues'][ $i ], '/' ); + $new_replace_values[] = addcslashes( $replace['NewValues'][ $i ], '/' ); + } + } + } + } + + // Get site URL + $site_url = get_option( AI1WM_SITE_URL ); + + // Get home URL + $home_url = get_option( AI1WM_HOME_URL ); + + // Get secret key + $secret_key = get_option( AI1WM_SECRET_KEY ); + + // Get HTTP user + $auth_user = get_option( AI1WM_AUTH_USER ); + + // Get HTTP password + $auth_password = get_option( AI1WM_AUTH_PASSWORD ); + + $old_table_prefixes = array(); + $new_table_prefixes = array(); + + // Set main table prefixes + $old_table_prefixes[] = ai1wm_servmask_prefix( 'mainsite' ); + $new_table_prefixes[] = ai1wm_table_prefix(); + + // Set site table prefixes + foreach ( $blogs as $blog ) { + if ( ai1wm_main_site( $blog['Old']['BlogID'] ) === false ) { + $old_table_prefixes[] = ai1wm_servmask_prefix( $blog['Old']['BlogID'] ); + $new_table_prefixes[] = ai1wm_table_prefix( $blog['New']['BlogID'] ); + } + } + + // Set base table prefixes + foreach ( $blogs as $blog ) { + if ( ai1wm_main_site( $blog['Old']['BlogID'] ) === true ) { + $old_table_prefixes[] = ai1wm_servmask_prefix( 'basesite' ); + $new_table_prefixes[] = ai1wm_table_prefix( $blog['New']['BlogID'] ); + } + } + + // Set site table prefixes + foreach ( $blogs as $blog ) { + if ( ai1wm_main_site( $blog['Old']['BlogID'] ) === true ) { + $old_table_prefixes[] = ai1wm_servmask_prefix( $blog['Old']['BlogID'] ); + $new_table_prefixes[] = ai1wm_table_prefix( $blog['New']['BlogID'] ); + } + } + + // Set table prefixes + $old_table_prefixes[] = ai1wm_servmask_prefix(); + $new_table_prefixes[] = ai1wm_table_prefix(); + + // Get database client + if ( empty( $wpdb->use_mysqli ) ) { + $mysql = new Ai1wm_Database_Mysql( $wpdb ); + } else { + $mysql = new Ai1wm_Database_Mysqli( $wpdb ); + } + + // Set database options + $mysql->set_old_table_prefixes( $old_table_prefixes ) + ->set_new_table_prefixes( $new_table_prefixes ) + ->set_old_replace_values( $old_replace_values ) + ->set_new_replace_values( $new_replace_values ) + ->set_old_replace_raw_values( $old_replace_raw_values ) + ->set_new_replace_raw_values( $new_replace_raw_values ); + + // Flush database + if ( isset( $config['Plugin']['Version'] ) && ( $version = $config['Plugin']['Version'] ) ) { + if ( $version !== 'develop' && version_compare( $version, '4.10', '<' ) ) { + $mysql->set_include_table_prefixes( array( ai1wm_table_prefix() ) ); + $mysql->flush(); + } + } + + // Set atomic tables (do not stop the current request for all listed tables if timeout has been exceeded) + $mysql->set_atomic_tables( array( ai1wm_table_prefix() . 'options' ) ); + + // Set Visual Composer + $mysql->set_visual_composer( ai1wm_validate_plugin_basename( 'js_composer/js_composer.php' ) ); + + // Set BeTheme Responsive + $mysql->set_betheme_responsive( ai1wm_validate_theme_basename( 'betheme/style.css' ) ); + + // Import database + if ( $mysql->import( ai1wm_database_path( $params ), $query_offset ) ) { + + // Set progress + Ai1wm_Status::info( __( 'Done restoring database.', AI1WM_PLUGIN_NAME ) ); + + // Unset query offset + unset( $params['query_offset'] ); + + // Unset total queries size + unset( $params['total_queries_size'] ); + + // Unset completed flag + unset( $params['completed'] ); + + } else { + + // Get total queries size + $total_queries_size = ai1wm_database_bytes( $params ); + + // What percent of queries have we processed? + $progress = (int) ( ( $query_offset / $total_queries_size ) * 100 ); + + // Set progress + Ai1wm_Status::info( sprintf( __( 'Restoring database...
%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) ); + + // Set query offset + $params['query_offset'] = $query_offset; + + // Set total queries size + $params['total_queries_size'] = $total_queries_size; + + // Set completed flag + $params['completed'] = false; + } + + // Flush WP cache + ai1wm_cache_flush(); + + // Activate plugins + ai1wm_activate_plugins( ai1wm_active_servmask_plugins() ); + + // Set the new site URL + update_option( AI1WM_SITE_URL, $site_url ); + + // Set the new home URL + update_option( AI1WM_HOME_URL, $home_url ); + + // Set the new secret key value + update_option( AI1WM_SECRET_KEY, $secret_key ); + + // Set the new HTTP user + update_option( AI1WM_AUTH_USER, $auth_user ); + + // Set the new HTTP password + update_option( AI1WM_AUTH_PASSWORD, $auth_password ); + + return $params; + } +} diff --git a/lib/model/import/class-ai1wm-import-done.php b/lib/model/import/class-ai1wm-import-done.php new file mode 100644 index 0000000..2d75c99 --- /dev/null +++ b/lib/model/import/class-ai1wm-import-done.php @@ -0,0 +1,208 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Import_Done { + + public static function execute( $params ) { + + // Check multisite.json file + if ( true === is_file( ai1wm_multisite_path( $params ) ) ) { + // Read multisite.json file + $handle = ai1wm_open( ai1wm_multisite_path( $params ), 'r' ); + + // Parse multisite.json file + $multisite = ai1wm_read( $handle, filesize( ai1wm_multisite_path( $params ) ) ); + $multisite = json_decode( $multisite, true ); + + // Close handle + ai1wm_close( $handle ); + + // Activate WordPress plugins + if ( isset( $multisite['Plugins'] ) && ( $plugins = $multisite['Plugins'] ) ) { + ai1wm_activate_plugins( $plugins ); + } + + // Deactivate WordPress SSL plugins + if ( ! is_ssl() ) { + ai1wm_deactivate_plugins( array( + ai1wm_discover_plugin_basename( 'really-simple-ssl/rlrsssl-really-simple-ssl.php' ), + ai1wm_discover_plugin_basename( 'wordpress-https/wordpress-https.php' ), + ai1wm_discover_plugin_basename( 'wp-force-ssl/wp-force-ssl.php' ), + ) ); + } + + // Deactivate WordPress plugins + ai1wm_deactivate_plugins( array( + ai1wm_discover_plugin_basename( 'invisible-recaptcha/invisible-recaptcha.php' ), + ai1wm_discover_plugin_basename( 'wps-hide-login/wps-hide-login.php' ), + ai1wm_discover_plugin_basename( 'hide-my-wp/index.php' ), + ai1wm_discover_plugin_basename( 'hide-my-wordpress/index.php' ), + ai1wm_discover_plugin_basename( 'mycustomwidget/my_custom_widget.php' ), + ai1wm_discover_plugin_basename( 'lockdown-wp-admin/lockdown-wp-admin.php' ), + ai1wm_discover_plugin_basename( 'rename-wp-login/rename-wp-login.php' ), + ) ); + + // Deactivate Jetpack modules + ai1wm_deactivate_jetpack_modules( array( + 'photon', + 'sso', + ) ); + + } else { + + // Check package.json file + if ( true === is_file( ai1wm_package_path( $params ) ) ) { + + // Read package.json file + $handle = ai1wm_open( ai1wm_package_path( $params ), 'r' ); + + // Parse package.json file + $package = ai1wm_read( $handle, filesize( ai1wm_package_path( $params ) ) ); + $package = json_decode( $package, true ); + + // Close handle + ai1wm_close( $handle ); + + // Activate WordPress plugins + if ( isset( $package['Plugins'] ) && ( $plugins = $package['Plugins'] ) ) { + ai1wm_activate_plugins( $plugins ); + } + + // Activate WordPress template + if ( isset( $package['Template'] ) && ( $template = $package['Template'] ) ) { + ai1wm_activate_template( $template ); + } + + // Activate WordPress stylesheet + if ( isset( $package['Stylesheet'] ) && ( $stylesheet = $package['Stylesheet'] ) ) { + ai1wm_activate_stylesheet( $stylesheet ); + } + + // Deactivate WordPress SSL plugins + if ( ! is_ssl() ) { + ai1wm_deactivate_plugins( array( + ai1wm_discover_plugin_basename( 'really-simple-ssl/rlrsssl-really-simple-ssl.php' ), + ai1wm_discover_plugin_basename( 'wordpress-https/wordpress-https.php' ), + ai1wm_discover_plugin_basename( 'wp-force-ssl/wp-force-ssl.php' ), + ) ); + } + + // Deactivate WordPress plugins + ai1wm_deactivate_plugins( array( + ai1wm_discover_plugin_basename( 'invisible-recaptcha/invisible-recaptcha.php' ), + ai1wm_discover_plugin_basename( 'wps-hide-login/wps-hide-login.php' ), + ai1wm_discover_plugin_basename( 'hide-my-wp/index.php' ), + ai1wm_discover_plugin_basename( 'hide-my-wordpress/index.php' ), + ai1wm_discover_plugin_basename( 'mycustomwidget/my_custom_widget.php' ), + ai1wm_discover_plugin_basename( 'lockdown-wp-admin/lockdown-wp-admin.php' ), + ai1wm_discover_plugin_basename( 'rename-wp-login/rename-wp-login.php' ), + ) ); + + // Deactivate Jetpack modules + ai1wm_deactivate_jetpack_modules( array( + 'photon', + 'sso', + ) ); + } + } + + // Check blogs.json file + if ( true === is_file( ai1wm_blogs_path( $params ) ) ) { + // Read blogs.json file + $handle = ai1wm_open( ai1wm_blogs_path( $params ), 'r' ); + + // Parse blogs.json file + $blogs = ai1wm_read( $handle, filesize( ai1wm_blogs_path( $params ) ) ); + $blogs = json_decode( $blogs, true ); + + // Close handle + ai1wm_close( $handle ); + + // Loop over blogs + foreach ( $blogs as $blog ) { + + // Activate WordPress plugins + if ( isset( $blog['New']['Plugins'] ) && ( $plugins = $blog['New']['Plugins'] ) ) { + ai1wm_activate_plugins( $plugins ); + } + + // Activate WordPress template + if ( isset( $blog['New']['Template'] ) && ( $template = $blog['New']['Template'] ) ) { + ai1wm_activate_template( $template ); + } + + // Activate WordPress stylesheet + if ( isset( $blog['New']['Stylesheet'] ) && ( $stylesheet = $blog['New']['Stylesheet'] ) ) { + ai1wm_activate_stylesheet( $stylesheet ); + } + + // Deactivate WordPress SSL plugins + if ( ! is_ssl() ) { + ai1wm_deactivate_plugins( array( + ai1wm_discover_plugin_basename( 'really-simple-ssl/rlrsssl-really-simple-ssl.php' ), + ai1wm_discover_plugin_basename( 'wordpress-https/wordpress-https.php' ), + ai1wm_discover_plugin_basename( 'wp-force-ssl/wp-force-ssl.php' ), + ) ); + } + + // Deactivate WordPress plugins + ai1wm_deactivate_plugins( array( + ai1wm_discover_plugin_basename( 'invisible-recaptcha/invisible-recaptcha.php' ), + ai1wm_discover_plugin_basename( 'wps-hide-login/wps-hide-login.php' ), + ai1wm_discover_plugin_basename( 'hide-my-wp/index.php' ), + ai1wm_discover_plugin_basename( 'hide-my-wordpress/index.php' ), + ai1wm_discover_plugin_basename( 'mycustomwidget/my_custom_widget.php' ), + ai1wm_discover_plugin_basename( 'lockdown-wp-admin/lockdown-wp-admin.php' ), + ai1wm_discover_plugin_basename( 'rename-wp-login/rename-wp-login.php' ), + ) ); + + // Deactivate Jetpack modules + ai1wm_deactivate_jetpack_modules( array( + 'photon', + 'sso', + ) ); + } + } + + // Set progress + Ai1wm_Status::done( + __( + 'Your data has been imported successfully!', + AI1WM_PLUGIN_NAME + ), + sprintf( + __( + 'You need to perform two more steps:
' . + '1. You must save your permalinks structure twice. Permalinks Settings (opens a new window)
' . + '2. Optionally, review the plugin. (opens a new window)', + AI1WM_PLUGIN_NAME + ), + admin_url( 'options-permalink.php#submit' ) + ) + ); + + return $params; + } +} diff --git a/lib/model/import/class-ai1wm-import-enumerate.php b/lib/model/import/class-ai1wm-import-enumerate.php new file mode 100644 index 0000000..973f241 --- /dev/null +++ b/lib/model/import/class-ai1wm-import-enumerate.php @@ -0,0 +1,50 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Import_Enumerate { + + public static function execute( $params ) { + + // Set progress + Ai1wm_Status::info( __( 'Retrieving a list of all WordPress files...', AI1WM_PLUGIN_NAME ) ); + + // Open the archive file for reading + $archive = new Ai1wm_Extractor( ai1wm_archive_path( $params ) ); + + // Get total files count + $params['total_files_count'] = $archive->get_total_files_count(); + + // Get total files size + $params['total_files_size'] = $archive->get_total_files_size(); + + // Close the archive file + $archive->close(); + + // Set progress + Ai1wm_Status::info( __( 'Done retrieving a list of all WordPress files.', AI1WM_PLUGIN_NAME ) ); + + return $params; + } +} diff --git a/lib/model/import/class-ai1wm-import-mu-plugins.php b/lib/model/import/class-ai1wm-import-mu-plugins.php new file mode 100644 index 0000000..b330674 --- /dev/null +++ b/lib/model/import/class-ai1wm-import-mu-plugins.php @@ -0,0 +1,54 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Import_Mu_Plugins { + + public static function execute( $params ) { + + // Set progress + Ai1wm_Status::info( __( 'Activating mu-plugins...', AI1WM_PLUGIN_NAME ) ); + + $exclude_files = array( + AI1WM_MUPLUGINS_NAME . DIRECTORY_SEPARATOR . AI1WM_ENDURANCE_PAGE_CACHE_NAME, + AI1WM_MUPLUGINS_NAME . DIRECTORY_SEPARATOR . AI1WM_ENDURANCE_PHP_EDGE_NAME, + AI1WM_MUPLUGINS_NAME . DIRECTORY_SEPARATOR . AI1WM_ENDURANCE_BROWSER_CACHE_NAME, + AI1WM_MUPLUGINS_NAME . DIRECTORY_SEPARATOR . AI1WM_GD_SYSTEM_PLUGIN_NAME, + ); + + // Open the archive file for reading + $archive = new Ai1wm_Extractor( ai1wm_archive_path( $params ) ); + + // Unpack mu-plugins files + $archive->extract_by_files_array( WP_CONTENT_DIR, array( AI1WM_MUPLUGINS_NAME ), $exclude_files ); + + // Close the archive file + $archive->close(); + + // Set progress + Ai1wm_Status::info( __( 'Done activating mu-plugins.', AI1WM_PLUGIN_NAME ) ); + + return $params; + } +} diff --git a/lib/model/import/class-ai1wm-import-upload.php b/lib/model/import/class-ai1wm-import-upload.php new file mode 100644 index 0000000..e80b2bd --- /dev/null +++ b/lib/model/import/class-ai1wm-import-upload.php @@ -0,0 +1,110 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Import_Upload { + + private static function validate() { + if ( ! array_key_exists( 'upload-file', $_FILES ) || ! is_array( $_FILES['upload-file'] ) ) { + throw new Ai1wm_Import_Retry_Exception( + __( 'Missing upload file.', AI1WM_PLUGIN_NAME ), + 400 + ); + } + + if ( ! array_key_exists( 'error', $_FILES['upload-file'] ) ) { + throw new Ai1wm_Import_Retry_Exception( + __( 'Missing error key in upload file.', AI1WM_PLUGIN_NAME ), + 400 + ); + } + + if ( ! array_key_exists( 'tmp_name', $_FILES['upload-file'] ) ) { + throw new Ai1wm_Import_Retry_Exception( + __( 'Missing tmp_name in upload file.', AI1WM_PLUGIN_NAME ), + 400 + ); + } + } + + public static function execute( $params ) { + self::validate(); + + $error = $_FILES['upload-file']['error']; + $upload = $_FILES['upload-file']['tmp_name']; + $archive = ai1wm_archive_path( $params ); + + switch ( $error ) { + case UPLOAD_ERR_OK: + try { + ai1wm_copy( $upload, $archive ); + ai1wm_unlink( $upload ); + } catch ( Exception $e ) { + throw new Ai1wm_Import_Retry_Exception( + sprintf( + __( 'Unable to upload the file because %s', AI1WM_PLUGIN_NAME ), + $e->getMessage() + ), + 400 + ); + } + break; + case UPLOAD_ERR_INI_SIZE: + case UPLOAD_ERR_FORM_SIZE: + case UPLOAD_ERR_PARTIAL: + case UPLOAD_ERR_NO_FILE: + // File is too large, reduce the size and try again + throw new Ai1wm_Import_Retry_Exception( + __( 'The file is too large, retrying with smaller size.', AI1WM_PLUGIN_NAME ), + 413 + ); + case UPLOAD_ERR_NO_TMP_DIR: + throw new Ai1wm_Import_Retry_Exception( + __( 'Missing a temporary folder.', AI1WM_PLUGIN_NAME ), + 400 + ); + case UPLOAD_ERR_CANT_WRITE: + throw new Ai1wm_Import_Retry_Exception( + __( 'Failed to write file to disk.', AI1WM_PLUGIN_NAME ), + 400 + ); + case UPLOAD_ERR_EXTENSION: + throw new Ai1wm_Import_Retry_Exception( + __( 'A PHP extension stopped the file upload.', AI1WM_PLUGIN_NAME ), + 400 + ); + default: + throw new Ai1wm_Import_Retry_Exception( + sprintf( + __( 'Unrecognized error %s during upload.', AI1WM_PLUGIN_NAME ), + $error + ), + 400 + ); + } + + echo json_encode( array( 'errors' => array() ) ); + exit; + } +} diff --git a/lib/model/import/class-ai1wm-import-validate.php b/lib/model/import/class-ai1wm-import-validate.php new file mode 100644 index 0000000..c501fe2 --- /dev/null +++ b/lib/model/import/class-ai1wm-import-validate.php @@ -0,0 +1,172 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Import_Validate { + + public static function execute( $params ) { + + // Verify file if size > 2GB and PHP = 32-bit + if ( ! ai1wm_is_filesize_supported( ai1wm_archive_path( $params ) ) ) { + throw new Ai1wm_Import_Exception( + __( + 'Your PHP is 32-bit. In order to import your file, please change your PHP version to 64-bit and try again. ' . + 'Technical details', + AI1WM_PLUGIN_NAME + ) + ); + } + + // Set archive bytes offset + if ( isset( $params['archive_bytes_offset'] ) ) { + $archive_bytes_offset = (int) $params['archive_bytes_offset']; + } else { + $archive_bytes_offset = 0; + } + + // Set file bytes offset + if ( isset( $params['file_bytes_offset'] ) ) { + $file_bytes_offset = (int) $params['file_bytes_offset']; + } else { + $file_bytes_offset = 0; + } + + // Get total archive size + if ( isset( $params['total_archive_size'] ) ) { + $total_archive_size = (int) $params['total_archive_size']; + } else { + $total_archive_size = ai1wm_archive_bytes( $params ); + } + + // What percent of archive have we processed? + $progress = (int) min( ( $archive_bytes_offset / $total_archive_size ) * 100, 100 ); + + // Set progress + Ai1wm_Status::info( sprintf( __( 'Unpacking archive...
%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) ); + + // Open the archive file for reading + $archive = new Ai1wm_Extractor( ai1wm_archive_path( $params ) ); + + // Set the file pointer to the one that we have saved + $archive->set_file_pointer( $archive_bytes_offset ); + + // Validate the archive file consistency + if ( ! $archive->is_valid() ) { + throw new Ai1wm_Import_Exception( + __( + 'The archive file is corrupted. Follow ' . + 'this article to resolve the problem.', + AI1WM_PLUGIN_NAME + ) + ); + } + + $allowed_size = apply_filters( 'ai1wm_max_file_size', AI1WM_MAX_FILE_SIZE ); + + // Let's check the size of the file to make sure it is less than the maximum allowed + if ( ( $allowed_size > 0 ) && ( $total_archive_size > $allowed_size ) ) { + throw new Ai1wm_Import_Exception( + sprintf( + __( + 'The file that you are trying to import is over the maximum upload file size limit of %s.
' . + 'You can remove this restriction by purchasing our ' . + 'Unlimited Extension.', + AI1WM_PLUGIN_NAME + ), + size_format( $allowed_size ) + ) + ); + } + + // Flag to hold if file data has been processed + $completed = true; + + if ( $archive->has_not_reached_eof() ) { + $file_bytes_written = 0; + + // Unpack package.json, multisite.json and database.sql files + if ( ( $completed = $archive->extract_by_files_array( ai1wm_storage_path( $params ), array( AI1WM_PACKAGE_NAME, AI1WM_MULTISITE_NAME, AI1WM_DATABASE_NAME ), array(), $file_bytes_written, $file_bytes_offset ) ) ) { + $file_bytes_offset = 0; + } + + // Get archive bytes offset + $archive_bytes_offset = $archive->get_file_pointer(); + } + + // End of the archive? + if ( $archive->has_reached_eof() ) { + + // Check package.json file + if ( false === is_file( ai1wm_package_path( $params ) ) ) { + throw new Ai1wm_Import_Exception( + __( + 'Please make sure that your file was exported using All-in-One WP Migration plugin. ' . + 'Technical details', + AI1WM_PLUGIN_NAME + ) + ); + } + + // Set progress + Ai1wm_Status::info( __( 'Done unpacking archive.', AI1WM_PLUGIN_NAME ) ); + + // Unset archive bytes offset + unset( $params['archive_bytes_offset'] ); + + // Unset file bytes offset + unset( $params['file_bytes_offset'] ); + + // Unset total archive size + unset( $params['total_archive_size'] ); + + // Unset completed flag + unset( $params['completed'] ); + + } else { + + // What percent of archive have we processed? + $progress = (int) min( ( $archive_bytes_offset / $total_archive_size ) * 100, 100 ); + + // Set progress + Ai1wm_Status::info( sprintf( __( 'Unpacking archive...
%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) ); + + // Set archive bytes offset + $params['archive_bytes_offset'] = $archive_bytes_offset; + + // Set file bytes offset + $params['file_bytes_offset'] = $file_bytes_offset; + + // Set total archive size + $params['total_archive_size'] = $total_archive_size; + + // Set completed flag + $params['completed'] = $completed; + } + + // Close the archive file + $archive->close(); + + return $params; + } +} diff --git a/lib/vendor/bandar/bandar/LICENSE b/lib/vendor/bandar/bandar/LICENSE new file mode 100644 index 0000000..9acc815 --- /dev/null +++ b/lib/vendor/bandar/bandar/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2013 Yani Iliev + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/lib/vendor/bandar/bandar/lib/Bandar.php b/lib/vendor/bandar/bandar/lib/Bandar.php new file mode 100644 index 0000000..83fac94 --- /dev/null +++ b/lib/vendor/bandar/bandar/lib/Bandar.php @@ -0,0 +1,229 @@ + + * @copyright 2013 Yani Iliev + * @license https://raw.github.com/yani-/bandar/master/LICENSE The MIT License (MIT) + * @version GIT: 3.0.0 + * @link https://github.com/yani-/bandar/ + */ + +/** + * Define EOL for CLI and Web + */ +if (!defined('BANDAR_EOL')) { + define('BANDAR_EOL', php_sapi_name() === 'cli' ? PHP_EOL : '
'); +} + +/** + * Include exceptions + */ +require_once + dirname(__FILE__) . + DIRECTORY_SEPARATOR . + 'Exceptions' . + DIRECTORY_SEPARATOR . + 'TemplateDoesNotExistException.php'; + +/** + * Bandar Main class + * + * @category Templates + * @package Bandar + * @author Yani Iliev + * @copyright 2013 Yani Iliev + * @license https://raw.github.com/yani-/bandar/master/LICENSE The MIT License (MIT) + * @version Release: 2.0.1 + * @link https://github.com/yani-/bandar/ + */ +class Bandar +{ + /** + * Path to template files + * + * @var string|null + */ + public static $templatesPath = null; + + /** + * Template file to output + * @var string|null + */ + public static $template = null; + + /** + * Outputs the passed string if Bandar is in debug mode + * + * @param string $str Debug string to output + * + * @return void + */ + public static function debug($str) + { + /** + * if debug flag is on, output the string + */ + if (defined('BANDAR_DEBUG') && BANDAR_DEBUG) { + echo $str; + } + } + + /** + * Retrieves templatesPath from BANDAR_TEMPLATES_PATH constant + * + * @throws TemplatesPathNotSetException If BANDAR_TEMPLATES_PATH is not defined + * + * @return string|null Templates path + */ + public static function getTemplatesPathFromConstant() + { + self::debug( + 'Calling getTemplatesPathFromConstant' . BANDAR_EOL + ); + if (defined('BANDAR_TEMPLATES_PATH')) { + return realpath(BANDAR_TEMPLATES_PATH) . DIRECTORY_SEPARATOR; + } + return null; + } + + /** + * Setter for template + * + * @param string $template Template file + * + * @throws TemplateDoesNotExistException If template file is not found + * + * @return null + */ + public static function setTemplate($template, $path = false) + { + self::debug( + 'Calling setTemplate with' . BANDAR_EOL . + '$template = ' . $template . BANDAR_EOL . + 'type of $template is ' . gettype($template) . BANDAR_EOL + ); + + if ($path) { + $template = realpath($path) . DIRECTORY_SEPARATOR . $template; + } else { + $template = self::getTemplatesPathFromConstant() . $template; + } + + $template = realpath($template . '.php'); + /** + * Check if passed template exist + */ + if (self::templateExists($template)) { + self::$template = $template; + } else { + throw new TemplateDoesNotExistException; + } + } + + /** + * Checks if template exists by using file_exists + * + * @param string $template Template file + * + * @return boolean + */ + public static function templateExists($template) + { + self::debug( + 'Calling templateExists with ' . BANDAR_EOL . + '$template = ' . $template . BANDAR_EOL . + 'type of $template is ' . gettype($template) . BANDAR_EOL + ); + return (!is_dir($template) && is_readable($template)); + } + + /** + * Renders a passed template + * + * @param string $template Template name + * @param array $args Variables to pass to the template file + * + * @return string Contents of the template + */ + public static function render($template, $args=array(), $path = false) + { + self::debug( + 'Calling render with' . + '$template = ' . $template . BANDAR_EOL . + 'type of $template is ' . gettype($template) . BANDAR_EOL . + '$args = ' . print_r($args, true) . BANDAR_EOL . + 'type of $args is ' . gettype($args) . BANDAR_EOL + ); + self::setTemplate($template, $path); + /** + * Extracting passed aguments + */ + extract($args); + ob_start(); + /** + * Including the view + */ + include self::$template; + + return ob_get_flush(); + } + + /** + * Returns the content of a passed template + * + * @param string $template Template name + * @param array $args Variables to pass to the template file + * + * @return string Contents of the template + */ + public static function getTemplateContent($template, $args=array(), $path = false) + { + self::debug( + 'Calling render with' . + '$template = ' . $template . BANDAR_EOL . + 'type of $template is ' . gettype($template) . BANDAR_EOL . + '$args = ' . print_r($args, true) . BANDAR_EOL . + 'type of $args is ' . gettype($args) . BANDAR_EOL + ); + self::setTemplate($template, $path); + /** + * Extracting passed aguments + */ + extract($args); + ob_start(); + /** + * Including the view + */ + include self::$template; + + $content = ob_get_contents(); + ob_end_clean(); + + return $content; + } +} diff --git a/lib/vendor/bandar/bandar/lib/Exceptions/TemplateDoesNotExistException.php b/lib/vendor/bandar/bandar/lib/Exceptions/TemplateDoesNotExistException.php new file mode 100644 index 0000000..c25470a --- /dev/null +++ b/lib/vendor/bandar/bandar/lib/Exceptions/TemplateDoesNotExistException.php @@ -0,0 +1,50 @@ + + * @copyright 2013 Yani Iliev + * @license https://raw.github.com/yani-/bandar/master/LICENSE The MIT License (MIT) + * @version GIT: 3.0.0 + * @link https://github.com/yani-/bandar/ + */ + +/** + * TemplateDoesNotExistException + * + * @category Exceptions + * @package Bandar + * @author Yani Iliev + * @copyright 2013 Yani Iliev + * @license https://raw.github.com/yani-/bandar/master/LICENSE The MIT License (MIT) + * @version Release: 2.0.1 + * @link https://github.com/yani-/bandar/ + */ +class TemplateDoesNotExistException extends Exception +{ + +} diff --git a/lib/vendor/math/BigInteger.php b/lib/vendor/math/BigInteger.php new file mode 100644 index 0000000..f49c3c3 --- /dev/null +++ b/lib/vendor/math/BigInteger.php @@ -0,0 +1,3811 @@ +> and << cannot be used, nor can the modulo operator %, + * which only supports integers. Although this fact will slow this library down, the fact that such a high + * base is being used should more than compensate. + * + * Numbers are stored in {@link http://en.wikipedia.org/wiki/Endianness little endian} format. ie. + * (new Math_BigInteger(pow(2, 26)))->value = array(0, 1) + * + * Useful resources are as follows: + * + * - {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf Handbook of Applied Cryptography (HAC)} + * - {@link http://math.libtomcrypt.com/files/tommath.pdf Multi-Precision Math (MPM)} + * - Java's BigInteger classes. See /j2se/src/share/classes/java/math in jdk-1_5_0-src-jrl.zip + * + * Here's an example of how to use this library: + * + * add($b); + * + * echo $c->toString(); // outputs 5 + * ?> + * + * + * LICENSE: Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @category Math + * @package Math_BigInteger + * @author Jim Wigginton + * @copyright 2006 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ + + /**#@+ + * Reduction constants + * + * @access private + * @see self::_reduce() + */ + /** + * @see self::_montgomery() + * @see self::_prepMontgomery() + */ + define('MATH_BIGINTEGER_MONTGOMERY', 0); + /** + * @see self::_barrett() + */ + define('MATH_BIGINTEGER_BARRETT', 1); + /** + * @see self::_mod2() + */ + define('MATH_BIGINTEGER_POWEROF2', 2); + /** + * @see self::_remainder() + */ + define('MATH_BIGINTEGER_CLASSIC', 3); + /** + * @see self::__clone() + */ + define('MATH_BIGINTEGER_NONE', 4); + /**#@-*/ + + /**#@+ + * Array constants + * + * Rather than create a thousands and thousands of new Math_BigInteger objects in repeated function calls to add() and + * multiply() or whatever, we'll just work directly on arrays, taking them in as parameters and returning them. + * + * @access private + */ + /** + * $result[MATH_BIGINTEGER_VALUE] contains the value. + */ + define('MATH_BIGINTEGER_VALUE', 0); + /** + * $result[MATH_BIGINTEGER_SIGN] contains the sign. + */ + define('MATH_BIGINTEGER_SIGN', 1); + /**#@-*/ + + /**#@+ + * @access private + * @see self::_montgomery() + * @see self::_barrett() + */ + /** + * Cache constants + * + * $cache[MATH_BIGINTEGER_VARIABLE] tells us whether or not the cached data is still valid. + */ + define('MATH_BIGINTEGER_VARIABLE', 0); + /** + * $cache[MATH_BIGINTEGER_DATA] contains the cached data. + */ + define('MATH_BIGINTEGER_DATA', 1); + /**#@-*/ + + /**#@+ + * Mode constants. + * + * @access private + * @see self::Math_BigInteger() + */ + /** + * To use the pure-PHP implementation + */ + define('MATH_BIGINTEGER_MODE_INTERNAL', 1); + /** + * To use the BCMath library + * + * (if enabled; otherwise, the internal implementation will be used) + */ + define('MATH_BIGINTEGER_MODE_BCMATH', 2); + /** + * To use the GMP library + * + * (if present; otherwise, either the BCMath or the internal implementation will be used) + */ + define('MATH_BIGINTEGER_MODE_GMP', 3); + /**#@-*/ + + /** + * Karatsuba Cutoff + * + * At what point do we switch between Karatsuba multiplication and schoolbook long multiplication? + * + * @access private + */ + define('MATH_BIGINTEGER_KARATSUBA_CUTOFF', 25); + + /** + * Pure-PHP arbitrary precision integer arithmetic library. Supports base-2, base-10, base-16, and base-256 + * numbers. + * + * @package Math_BigInteger + * @author Jim Wigginton + * @access public + */ + class Math_BigInteger + { + /** + * Holds the BigInteger's value. + * + * @var array + * @access private + */ + var $value; + + /** + * Holds the BigInteger's magnitude. + * + * @var bool + * @access private + */ + var $is_negative = false; + + /** + * Precision + * + * @see self::setPrecision() + * @access private + */ + var $precision = -1; + + /** + * Precision Bitmask + * + * @see self::setPrecision() + * @access private + */ + var $bitmask = false; + + /** + * Mode independent value used for serialization. + * + * If the bcmath or gmp extensions are installed $this->value will be a non-serializable resource, hence the need for + * a variable that'll be serializable regardless of whether or not extensions are being used. Unlike $this->value, + * however, $this->hex is only calculated when $this->__sleep() is called. + * + * @see self::__sleep() + * @see self::__wakeup() + * @var string + * @access private + */ + var $hex; + + /** + * Converts base-2, base-10, base-16, and binary strings (base-256) to BigIntegers. + * + * If the second parameter - $base - is negative, then it will be assumed that the number's are encoded using + * two's compliment. The sole exception to this is -10, which is treated the same as 10 is. + * + * Here's an example: + * + * toString(); // outputs 50 + * ?> + * + * + * @param $x base-10 number or base-$base number if $base set. + * @param int $base + * @return Math_BigInteger + * @access public + */ + function __construct($x = 0, $base = 10) + { + if (!defined('MATH_BIGINTEGER_MODE')) { + switch (true) { + case extension_loaded('gmp'): + define('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_GMP); + break; + case extension_loaded('bcmath'): + define('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_BCMATH); + break; + default: + define('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_INTERNAL); + } + } + + if (extension_loaded('openssl') && !defined('MATH_BIGINTEGER_OPENSSL_DISABLE') && !defined('MATH_BIGINTEGER_OPENSSL_ENABLED')) { + // some versions of XAMPP have mismatched versions of OpenSSL which causes it not to work + ob_start(); + @phpinfo(); + $content = ob_get_contents(); + ob_end_clean(); + + preg_match_all('#OpenSSL (Header|Library) Version(.*)#im', $content, $matches); + + $versions = array(); + if (!empty($matches[1])) { + for ($i = 0; $i < count($matches[1]); $i++) { + $fullVersion = trim(str_replace('=>', '', strip_tags($matches[2][$i]))); + + // Remove letter part in OpenSSL version + if (!preg_match('/(\d+\.\d+\.\d+)/i', $fullVersion, $m)) { + $versions[$matches[1][$i]] = $fullVersion; + } else { + $versions[$matches[1][$i]] = $m[0]; + } + } + } + + // it doesn't appear that OpenSSL versions were reported upon until PHP 5.3+ + switch (true) { + case !isset($versions['Header']): + case !isset($versions['Library']): + case $versions['Header'] == $versions['Library']: + case version_compare($versions['Header'], '1.0.0') >= 0 && version_compare($versions['Library'], '1.0.0') >= 0: + define('MATH_BIGINTEGER_OPENSSL_ENABLED', true); + break; + default: + define('MATH_BIGINTEGER_OPENSSL_DISABLE', true); + } + } + + if (!defined('PHP_INT_SIZE')) { + define('PHP_INT_SIZE', 4); + } + + if (!defined('MATH_BIGINTEGER_BASE') && MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_INTERNAL) { + switch (PHP_INT_SIZE) { + case 8: // use 64-bit integers if int size is 8 bytes + define('MATH_BIGINTEGER_BASE', 31); + define('MATH_BIGINTEGER_BASE_FULL', 0x80000000); + define('MATH_BIGINTEGER_MAX_DIGIT', 0x7FFFFFFF); + define('MATH_BIGINTEGER_MSB', 0x40000000); + // 10**9 is the closest we can get to 2**31 without passing it + define('MATH_BIGINTEGER_MAX10', 1000000000); + define('MATH_BIGINTEGER_MAX10_LEN', 9); + // the largest digit that may be used in addition / subtraction + define('MATH_BIGINTEGER_MAX_DIGIT2', pow(2, 62)); + break; + //case 4: // use 64-bit floats if int size is 4 bytes + default: + define('MATH_BIGINTEGER_BASE', 26); + define('MATH_BIGINTEGER_BASE_FULL', 0x4000000); + define('MATH_BIGINTEGER_MAX_DIGIT', 0x3FFFFFF); + define('MATH_BIGINTEGER_MSB', 0x2000000); + // 10**7 is the closest to 2**26 without passing it + define('MATH_BIGINTEGER_MAX10', 10000000); + define('MATH_BIGINTEGER_MAX10_LEN', 7); + // the largest digit that may be used in addition / subtraction + // we do pow(2, 52) instead of using 4503599627370496 directly because some + // PHP installations will truncate 4503599627370496. + define('MATH_BIGINTEGER_MAX_DIGIT2', pow(2, 52)); + } + } + + switch (MATH_BIGINTEGER_MODE) { + case MATH_BIGINTEGER_MODE_GMP: + switch (true) { + case is_resource($x) && get_resource_type($x) == 'GMP integer': + // PHP 5.6 switched GMP from using resources to objects + case is_object($x) && get_class($x) == 'GMP': + $this->value = $x; + return; + } + $this->value = gmp_init(0); + break; + case MATH_BIGINTEGER_MODE_BCMATH: + $this->value = '0'; + break; + default: + $this->value = array(); + } + + // '0' counts as empty() but when the base is 256 '0' is equal to ord('0') or 48 + // '0' is the only value like this per http://php.net/empty + if (empty($x) && (abs($base) != 256 || $x !== '0')) { + return; + } + + switch ($base) { + case -256: + if (ord($x[0]) & 0x80) { + $x = ~$x; + $this->is_negative = true; + } + case 256: + switch (MATH_BIGINTEGER_MODE) { + case MATH_BIGINTEGER_MODE_GMP: + $sign = $this->is_negative ? '-' : ''; + $this->value = gmp_init($sign . '0x' . bin2hex($x)); + break; + case MATH_BIGINTEGER_MODE_BCMATH: + // round $len to the nearest 4 (thanks, DavidMJ!) + $len = (strlen($x) + 3) & 0xFFFFFFFC; + + $x = str_pad($x, $len, chr(0), STR_PAD_LEFT); + + for ($i = 0; $i < $len; $i+= 4) { + $this->value = bcmul($this->value, '4294967296', 0); // 4294967296 == 2**32 + $this->value = bcadd($this->value, 0x1000000 * ord($x[$i]) + ((ord($x[$i + 1]) << 16) | (ord($x[$i + 2]) << 8) | ord($x[$i + 3])), 0); + } + + if ($this->is_negative) { + $this->value = '-' . $this->value; + } + + break; + // converts a base-2**8 (big endian / msb) number to base-2**26 (little endian / lsb) + default: + while (strlen($x)) { + $this->value[] = $this->_bytes2int($this->_base256_rshift($x, MATH_BIGINTEGER_BASE)); + } + } + + if ($this->is_negative) { + if (MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_INTERNAL) { + $this->is_negative = false; + } + $temp = $this->add(new Math_BigInteger('-1')); + $this->value = $temp->value; + } + break; + case 16: + case -16: + if ($base > 0 && $x[0] == '-') { + $this->is_negative = true; + $x = substr($x, 1); + } + + $x = preg_replace('#^(?:0x)?([A-Fa-f0-9]*).*#', '$1', $x); + + $is_negative = false; + if ($base < 0 && hexdec($x[0]) >= 8) { + $this->is_negative = $is_negative = true; + $x = bin2hex(~pack('H*', $x)); + } + + switch (MATH_BIGINTEGER_MODE) { + case MATH_BIGINTEGER_MODE_GMP: + $temp = $this->is_negative ? '-0x' . $x : '0x' . $x; + $this->value = gmp_init($temp); + $this->is_negative = false; + break; + case MATH_BIGINTEGER_MODE_BCMATH: + $x = (strlen($x) & 1) ? '0' . $x : $x; + $temp = new Math_BigInteger(pack('H*', $x), 256); + $this->value = $this->is_negative ? '-' . $temp->value : $temp->value; + $this->is_negative = false; + break; + default: + $x = (strlen($x) & 1) ? '0' . $x : $x; + $temp = new Math_BigInteger(pack('H*', $x), 256); + $this->value = $temp->value; + } + + if ($is_negative) { + $temp = $this->add(new Math_BigInteger('-1')); + $this->value = $temp->value; + } + break; + case 10: + case -10: + // (?value = gmp_init($x); + break; + case MATH_BIGINTEGER_MODE_BCMATH: + // explicitly casting $x to a string is necessary, here, since doing $x[0] on -1 yields different + // results then doing it on '-1' does (modInverse does $x[0]) + $this->value = $x === '-' ? '0' : (string) $x; + break; + default: + $temp = new Math_BigInteger(); + + $multiplier = new Math_BigInteger(); + $multiplier->value = array(MATH_BIGINTEGER_MAX10); + + if ($x[0] == '-') { + $this->is_negative = true; + $x = substr($x, 1); + } + + $x = str_pad($x, strlen($x) + ((MATH_BIGINTEGER_MAX10_LEN - 1) * strlen($x)) % MATH_BIGINTEGER_MAX10_LEN, 0, STR_PAD_LEFT); + while (strlen($x)) { + $temp = $temp->multiply($multiplier); + $temp = $temp->add(new Math_BigInteger($this->_int2bytes(substr($x, 0, MATH_BIGINTEGER_MAX10_LEN)), 256)); + $x = substr($x, MATH_BIGINTEGER_MAX10_LEN); + } + + $this->value = $temp->value; + } + break; + case 2: // base-2 support originally implemented by Lluis Pamies - thanks! + case -2: + if ($base > 0 && $x[0] == '-') { + $this->is_negative = true; + $x = substr($x, 1); + } + + $x = preg_replace('#^([01]*).*#', '$1', $x); + $x = str_pad($x, strlen($x) + (3 * strlen($x)) % 4, 0, STR_PAD_LEFT); + + $str = '0x'; + while (strlen($x)) { + $part = substr($x, 0, 4); + $str.= dechex(bindec($part)); + $x = substr($x, 4); + } + + if ($this->is_negative) { + $str = '-' . $str; + } + + $temp = new Math_BigInteger($str, 8 * $base); // ie. either -16 or +16 + $this->value = $temp->value; + $this->is_negative = $temp->is_negative; + + break; + default: + // base not supported, so we'll let $this == 0 + } + } + + /** + * PHP4 compatible Default Constructor. + * + * @see self::__construct() + * @param $x base-10 number or base-$base number if $base set. + * @param int $base + * @access public + */ + function Math_BigInteger($x = 0, $base = 10) + { + $this->__construct($x, $base); + } + + /** + * Converts a BigInteger to a byte string (eg. base-256). + * + * Negative numbers are saved as positive numbers, unless $twos_compliment is set to true, at which point, they're + * saved as two's compliment. + * + * Here's an example: + * + * toBytes(); // outputs chr(65) + * ?> + * + * + * @param bool $twos_compliment + * @return string + * @access public + * @internal Converts a base-2**26 number to base-2**8 + */ + function toBytes($twos_compliment = false) + { + if ($twos_compliment) { + $comparison = $this->compare(new Math_BigInteger()); + if ($comparison == 0) { + return $this->precision > 0 ? str_repeat(chr(0), ($this->precision + 1) >> 3) : ''; + } + + $temp = $comparison < 0 ? $this->add(new Math_BigInteger(1)) : $this->copy(); + $bytes = $temp->toBytes(); + + if (empty($bytes)) { // eg. if the number we're trying to convert is -1 + $bytes = chr(0); + } + + if (ord($bytes[0]) & 0x80) { + $bytes = chr(0) . $bytes; + } + + return $comparison < 0 ? ~$bytes : $bytes; + } + + switch (MATH_BIGINTEGER_MODE) { + case MATH_BIGINTEGER_MODE_GMP: + if (gmp_cmp($this->value, gmp_init(0)) == 0) { + return $this->precision > 0 ? str_repeat(chr(0), ($this->precision + 1) >> 3) : ''; + } + + $temp = gmp_strval(gmp_abs($this->value), 16); + $temp = (strlen($temp) & 1) ? '0' . $temp : $temp; + $temp = pack('H*', $temp); + + return $this->precision > 0 ? + substr(str_pad($temp, $this->precision >> 3, chr(0), STR_PAD_LEFT), -($this->precision >> 3)) : + ltrim($temp, chr(0)); + case MATH_BIGINTEGER_MODE_BCMATH: + if ($this->value === '0') { + return $this->precision > 0 ? str_repeat(chr(0), ($this->precision + 1) >> 3) : ''; + } + + $value = ''; + $current = $this->value; + + if ($current[0] == '-') { + $current = substr($current, 1); + } + + while (bccomp($current, '0', 0) > 0) { + $temp = bcmod($current, '16777216'); + $value = chr($temp >> 16) . chr($temp >> 8) . chr($temp) . $value; + $current = bcdiv($current, '16777216', 0); + } + + return $this->precision > 0 ? + substr(str_pad($value, $this->precision >> 3, chr(0), STR_PAD_LEFT), -($this->precision >> 3)) : + ltrim($value, chr(0)); + } + + if (!count($this->value)) { + return $this->precision > 0 ? str_repeat(chr(0), ($this->precision + 1) >> 3) : ''; + } + $result = $this->_int2bytes($this->value[count($this->value) - 1]); + + $temp = $this->copy(); + + for ($i = count($temp->value) - 2; $i >= 0; --$i) { + $temp->_base256_lshift($result, MATH_BIGINTEGER_BASE); + $result = $result | str_pad($temp->_int2bytes($temp->value[$i]), strlen($result), chr(0), STR_PAD_LEFT); + } + + return $this->precision > 0 ? + str_pad(substr($result, -(($this->precision + 7) >> 3)), ($this->precision + 7) >> 3, chr(0), STR_PAD_LEFT) : + $result; + } + + /** + * Converts a BigInteger to a hex string (eg. base-16)). + * + * Negative numbers are saved as positive numbers, unless $twos_compliment is set to true, at which point, they're + * saved as two's compliment. + * + * Here's an example: + * + * toHex(); // outputs '41' + * ?> + * + * + * @param bool $twos_compliment + * @return string + * @access public + * @internal Converts a base-2**26 number to base-2**8 + */ + function toHex($twos_compliment = false) + { + return bin2hex($this->toBytes($twos_compliment)); + } + + /** + * Converts a BigInteger to a bit string (eg. base-2). + * + * Negative numbers are saved as positive numbers, unless $twos_compliment is set to true, at which point, they're + * saved as two's compliment. + * + * Here's an example: + * + * toBits(); // outputs '1000001' + * ?> + * + * + * @param bool $twos_compliment + * @return string + * @access public + * @internal Converts a base-2**26 number to base-2**2 + */ + function toBits($twos_compliment = false) + { + $hex = $this->toHex($twos_compliment); + $bits = ''; + for ($i = strlen($hex) - 8, $start = strlen($hex) & 7; $i >= $start; $i-=8) { + $bits = str_pad(decbin(hexdec(substr($hex, $i, 8))), 32, '0', STR_PAD_LEFT) . $bits; + } + if ($start) { // hexdec('') == 0 + $bits = str_pad(decbin(hexdec(substr($hex, 0, $start))), 8, '0', STR_PAD_LEFT) . $bits; + } + $result = $this->precision > 0 ? substr($bits, -$this->precision) : ltrim($bits, '0'); + + if ($twos_compliment && $this->compare(new Math_BigInteger()) > 0 && $this->precision <= 0) { + return '0' . $result; + } + + return $result; + } + + /** + * Converts a BigInteger to a base-10 number. + * + * Here's an example: + * + * toString(); // outputs 50 + * ?> + * + * + * @return string + * @access public + * @internal Converts a base-2**26 number to base-10**7 (which is pretty much base-10) + */ + function toString() + { + switch (MATH_BIGINTEGER_MODE) { + case MATH_BIGINTEGER_MODE_GMP: + return gmp_strval($this->value); + case MATH_BIGINTEGER_MODE_BCMATH: + if ($this->value === '0') { + return '0'; + } + + return ltrim($this->value, '0'); + } + + if (!count($this->value)) { + return '0'; + } + + $temp = $this->copy(); + $temp->is_negative = false; + + $divisor = new Math_BigInteger(); + $divisor->value = array(MATH_BIGINTEGER_MAX10); + $result = ''; + while (count($temp->value)) { + list($temp, $mod) = $temp->divide($divisor); + $result = str_pad(isset($mod->value[0]) ? $mod->value[0] : '', MATH_BIGINTEGER_MAX10_LEN, '0', STR_PAD_LEFT) . $result; + } + $result = ltrim($result, '0'); + if (empty($result)) { + $result = '0'; + } + + if ($this->is_negative) { + $result = '-' . $result; + } + + return $result; + } + + function toInteger() + { + return (int) $this->toString(); + } + + /** + * Copy an object + * + * PHP5 passes objects by reference while PHP4 passes by value. As such, we need a function to guarantee + * that all objects are passed by value, when appropriate. More information can be found here: + * + * {@link http://php.net/language.oop5.basic#51624} + * + * @access public + * @see self::__clone() + * @return Math_BigInteger + */ + function copy() + { + $temp = new Math_BigInteger(); + $temp->value = $this->value; + $temp->is_negative = $this->is_negative; + $temp->precision = $this->precision; + $temp->bitmask = $this->bitmask; + return $temp; + } + + /** + * __toString() magic method + * + * Will be called, automatically, if you're supporting just PHP5. If you're supporting PHP4, you'll need to call + * toString(). + * + * @access public + * @internal Implemented per a suggestion by Techie-Michael - thanks! + */ + function __toString() + { + return $this->toString(); + } + + /** + * __clone() magic method + * + * Although you can call Math_BigInteger::__toString() directly in PHP5, you cannot call Math_BigInteger::__clone() + * directly in PHP5. You can in PHP4 since it's not a magic method, but in PHP5, you have to call it by using the PHP5 + * only syntax of $y = clone $x. As such, if you're trying to write an application that works on both PHP4 and PHP5, + * call Math_BigInteger::copy(), instead. + * + * @access public + * @see self::copy() + * @return Math_BigInteger + */ + function __clone() + { + return $this->copy(); + } + + /** + * __sleep() magic method + * + * Will be called, automatically, when serialize() is called on a Math_BigInteger object. + * + * @see self::__wakeup() + * @access public + */ + function __sleep() + { + $this->hex = $this->toHex(true); + $vars = array('hex'); + if ($this->precision > 0) { + $vars[] = 'precision'; + } + return $vars; + } + + /** + * __wakeup() magic method + * + * Will be called, automatically, when unserialize() is called on a Math_BigInteger object. + * + * @see self::__sleep() + * @access public + */ + function __wakeup() + { + $temp = new Math_BigInteger($this->hex, -16); + $this->value = $temp->value; + $this->is_negative = $temp->is_negative; + if ($this->precision > 0) { + // recalculate $this->bitmask + $this->setPrecision($this->precision); + } + } + + /** + * __debugInfo() magic method + * + * Will be called, automatically, when print_r() or var_dump() are called + * + * @access public + */ + function __debugInfo() + { + $opts = array(); + switch (MATH_BIGINTEGER_MODE) { + case MATH_BIGINTEGER_MODE_GMP: + $engine = 'gmp'; + break; + case MATH_BIGINTEGER_MODE_BCMATH: + $engine = 'bcmath'; + break; + case MATH_BIGINTEGER_MODE_INTERNAL: + $engine = 'internal'; + $opts[] = PHP_INT_SIZE == 8 ? '64-bit' : '32-bit'; + } + if (MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_GMP && defined('MATH_BIGINTEGER_OPENSSL_ENABLED')) { + $opts[] = 'OpenSSL'; + } + if (!empty($opts)) { + $engine.= ' (' . implode($opts, ', ') . ')'; + } + return array( + 'value' => '0x' . $this->toHex(true), + 'engine' => $engine + ); + } + + /** + * Adds two BigIntegers. + * + * Here's an example: + * + * add($b); + * + * echo $c->toString(); // outputs 30 + * ?> + * + * + * @param Math_BigInteger $y + * @return Math_BigInteger + * @access public + * @internal Performs base-2**52 addition + */ + function add($y) + { + switch (MATH_BIGINTEGER_MODE) { + case MATH_BIGINTEGER_MODE_GMP: + $temp = new Math_BigInteger(); + $temp->value = gmp_add($this->value, $y->value); + + return $this->_normalize($temp); + case MATH_BIGINTEGER_MODE_BCMATH: + $temp = new Math_BigInteger(); + $temp->value = bcadd($this->value, $y->value, 0); + + return $this->_normalize($temp); + } + + $temp = $this->_add($this->value, $this->is_negative, $y->value, $y->is_negative); + + $result = new Math_BigInteger(); + $result->value = $temp[MATH_BIGINTEGER_VALUE]; + $result->is_negative = $temp[MATH_BIGINTEGER_SIGN]; + + return $this->_normalize($result); + } + + /** + * Performs addition. + * + * @param array $x_value + * @param bool $x_negative + * @param array $y_value + * @param bool $y_negative + * @return array + * @access private + */ + function _add($x_value, $x_negative, $y_value, $y_negative) + { + $x_size = count($x_value); + $y_size = count($y_value); + + if ($x_size == 0) { + return array( + MATH_BIGINTEGER_VALUE => $y_value, + MATH_BIGINTEGER_SIGN => $y_negative + ); + } elseif ($y_size == 0) { + return array( + MATH_BIGINTEGER_VALUE => $x_value, + MATH_BIGINTEGER_SIGN => $x_negative + ); + } + + // subtract, if appropriate + if ($x_negative != $y_negative) { + if ($x_value == $y_value) { + return array( + MATH_BIGINTEGER_VALUE => array(), + MATH_BIGINTEGER_SIGN => false + ); + } + + $temp = $this->_subtract($x_value, false, $y_value, false); + $temp[MATH_BIGINTEGER_SIGN] = $this->_compare($x_value, false, $y_value, false) > 0 ? + $x_negative : $y_negative; + + return $temp; + } + + if ($x_size < $y_size) { + $size = $x_size; + $value = $y_value; + } else { + $size = $y_size; + $value = $x_value; + } + + $value[count($value)] = 0; // just in case the carry adds an extra digit + + $carry = 0; + for ($i = 0, $j = 1; $j < $size; $i+=2, $j+=2) { + $sum = $x_value[$j] * MATH_BIGINTEGER_BASE_FULL + $x_value[$i] + $y_value[$j] * MATH_BIGINTEGER_BASE_FULL + $y_value[$i] + $carry; + $carry = $sum >= MATH_BIGINTEGER_MAX_DIGIT2; // eg. floor($sum / 2**52); only possible values (in any base) are 0 and 1 + $sum = $carry ? $sum - MATH_BIGINTEGER_MAX_DIGIT2 : $sum; + + $temp = MATH_BIGINTEGER_BASE === 26 ? intval($sum / 0x4000000) : ($sum >> 31); + + $value[$i] = (int) ($sum - MATH_BIGINTEGER_BASE_FULL * $temp); // eg. a faster alternative to fmod($sum, 0x4000000) + $value[$j] = $temp; + } + + if ($j == $size) { // ie. if $y_size is odd + $sum = $x_value[$i] + $y_value[$i] + $carry; + $carry = $sum >= MATH_BIGINTEGER_BASE_FULL; + $value[$i] = $carry ? $sum - MATH_BIGINTEGER_BASE_FULL : $sum; + ++$i; // ie. let $i = $j since we've just done $value[$i] + } + + if ($carry) { + for (; $value[$i] == MATH_BIGINTEGER_MAX_DIGIT; ++$i) { + $value[$i] = 0; + } + ++$value[$i]; + } + + return array( + MATH_BIGINTEGER_VALUE => $this->_trim($value), + MATH_BIGINTEGER_SIGN => $x_negative + ); + } + + /** + * Subtracts two BigIntegers. + * + * Here's an example: + * + * subtract($b); + * + * echo $c->toString(); // outputs -10 + * ?> + * + * + * @param Math_BigInteger $y + * @return Math_BigInteger + * @access public + * @internal Performs base-2**52 subtraction + */ + function subtract($y) + { + switch (MATH_BIGINTEGER_MODE) { + case MATH_BIGINTEGER_MODE_GMP: + $temp = new Math_BigInteger(); + $temp->value = gmp_sub($this->value, $y->value); + + return $this->_normalize($temp); + case MATH_BIGINTEGER_MODE_BCMATH: + $temp = new Math_BigInteger(); + $temp->value = bcsub($this->value, $y->value, 0); + + return $this->_normalize($temp); + } + + $temp = $this->_subtract($this->value, $this->is_negative, $y->value, $y->is_negative); + + $result = new Math_BigInteger(); + $result->value = $temp[MATH_BIGINTEGER_VALUE]; + $result->is_negative = $temp[MATH_BIGINTEGER_SIGN]; + + return $this->_normalize($result); + } + + /** + * Performs subtraction. + * + * @param array $x_value + * @param bool $x_negative + * @param array $y_value + * @param bool $y_negative + * @return array + * @access private + */ + function _subtract($x_value, $x_negative, $y_value, $y_negative) + { + $x_size = count($x_value); + $y_size = count($y_value); + + if ($x_size == 0) { + return array( + MATH_BIGINTEGER_VALUE => $y_value, + MATH_BIGINTEGER_SIGN => !$y_negative + ); + } elseif ($y_size == 0) { + return array( + MATH_BIGINTEGER_VALUE => $x_value, + MATH_BIGINTEGER_SIGN => $x_negative + ); + } + + // add, if appropriate (ie. -$x - +$y or +$x - -$y) + if ($x_negative != $y_negative) { + $temp = $this->_add($x_value, false, $y_value, false); + $temp[MATH_BIGINTEGER_SIGN] = $x_negative; + + return $temp; + } + + $diff = $this->_compare($x_value, $x_negative, $y_value, $y_negative); + + if (!$diff) { + return array( + MATH_BIGINTEGER_VALUE => array(), + MATH_BIGINTEGER_SIGN => false + ); + } + + // switch $x and $y around, if appropriate. + if ((!$x_negative && $diff < 0) || ($x_negative && $diff > 0)) { + $temp = $x_value; + $x_value = $y_value; + $y_value = $temp; + + $x_negative = !$x_negative; + + $x_size = count($x_value); + $y_size = count($y_value); + } + + // at this point, $x_value should be at least as big as - if not bigger than - $y_value + + $carry = 0; + for ($i = 0, $j = 1; $j < $y_size; $i+=2, $j+=2) { + $sum = $x_value[$j] * MATH_BIGINTEGER_BASE_FULL + $x_value[$i] - $y_value[$j] * MATH_BIGINTEGER_BASE_FULL - $y_value[$i] - $carry; + $carry = $sum < 0; // eg. floor($sum / 2**52); only possible values (in any base) are 0 and 1 + $sum = $carry ? $sum + MATH_BIGINTEGER_MAX_DIGIT2 : $sum; + + $temp = MATH_BIGINTEGER_BASE === 26 ? intval($sum / 0x4000000) : ($sum >> 31); + + $x_value[$i] = (int) ($sum - MATH_BIGINTEGER_BASE_FULL * $temp); + $x_value[$j] = $temp; + } + + if ($j == $y_size) { // ie. if $y_size is odd + $sum = $x_value[$i] - $y_value[$i] - $carry; + $carry = $sum < 0; + $x_value[$i] = $carry ? $sum + MATH_BIGINTEGER_BASE_FULL : $sum; + ++$i; + } + + if ($carry) { + for (; !$x_value[$i]; ++$i) { + $x_value[$i] = MATH_BIGINTEGER_MAX_DIGIT; + } + --$x_value[$i]; + } + + return array( + MATH_BIGINTEGER_VALUE => $this->_trim($x_value), + MATH_BIGINTEGER_SIGN => $x_negative + ); + } + + /** + * Multiplies two BigIntegers + * + * Here's an example: + * + * multiply($b); + * + * echo $c->toString(); // outputs 200 + * ?> + * + * + * @param Math_BigInteger $x + * @return Math_BigInteger + * @access public + */ + function multiply($x) + { + switch (MATH_BIGINTEGER_MODE) { + case MATH_BIGINTEGER_MODE_GMP: + $temp = new Math_BigInteger(); + $temp->value = gmp_mul($this->value, $x->value); + + return $this->_normalize($temp); + case MATH_BIGINTEGER_MODE_BCMATH: + $temp = new Math_BigInteger(); + $temp->value = bcmul($this->value, $x->value, 0); + + return $this->_normalize($temp); + } + + $temp = $this->_multiply($this->value, $this->is_negative, $x->value, $x->is_negative); + + $product = new Math_BigInteger(); + $product->value = $temp[MATH_BIGINTEGER_VALUE]; + $product->is_negative = $temp[MATH_BIGINTEGER_SIGN]; + + return $this->_normalize($product); + } + + /** + * Performs multiplication. + * + * @param array $x_value + * @param bool $x_negative + * @param array $y_value + * @param bool $y_negative + * @return array + * @access private + */ + function _multiply($x_value, $x_negative, $y_value, $y_negative) + { + //if ( $x_value == $y_value ) { + // return array( + // MATH_BIGINTEGER_VALUE => $this->_square($x_value), + // MATH_BIGINTEGER_SIGN => $x_sign != $y_value + // ); + //} + + $x_length = count($x_value); + $y_length = count($y_value); + + if (!$x_length || !$y_length) { // a 0 is being multiplied + return array( + MATH_BIGINTEGER_VALUE => array(), + MATH_BIGINTEGER_SIGN => false + ); + } + + return array( + MATH_BIGINTEGER_VALUE => min($x_length, $y_length) < 2 * MATH_BIGINTEGER_KARATSUBA_CUTOFF ? + $this->_trim($this->_regularMultiply($x_value, $y_value)) : + $this->_trim($this->_karatsuba($x_value, $y_value)), + MATH_BIGINTEGER_SIGN => $x_negative != $y_negative + ); + } + + /** + * Performs long multiplication on two BigIntegers + * + * Modeled after 'multiply' in MutableBigInteger.java. + * + * @param array $x_value + * @param array $y_value + * @return array + * @access private + */ + function _regularMultiply($x_value, $y_value) + { + $x_length = count($x_value); + $y_length = count($y_value); + + if (!$x_length || !$y_length) { // a 0 is being multiplied + return array(); + } + + if ($x_length < $y_length) { + $temp = $x_value; + $x_value = $y_value; + $y_value = $temp; + + $x_length = count($x_value); + $y_length = count($y_value); + } + + $product_value = $this->_array_repeat(0, $x_length + $y_length); + + // the following for loop could be removed if the for loop following it + // (the one with nested for loops) initially set $i to 0, but + // doing so would also make the result in one set of unnecessary adds, + // since on the outermost loops first pass, $product->value[$k] is going + // to always be 0 + + $carry = 0; + + for ($j = 0; $j < $x_length; ++$j) { // ie. $i = 0 + $temp = $x_value[$j] * $y_value[0] + $carry; // $product_value[$k] == 0 + $carry = MATH_BIGINTEGER_BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31); + $product_value[$j] = (int) ($temp - MATH_BIGINTEGER_BASE_FULL * $carry); + } + + $product_value[$j] = $carry; + + // the above for loop is what the previous comment was talking about. the + // following for loop is the "one with nested for loops" + for ($i = 1; $i < $y_length; ++$i) { + $carry = 0; + + for ($j = 0, $k = $i; $j < $x_length; ++$j, ++$k) { + $temp = $product_value[$k] + $x_value[$j] * $y_value[$i] + $carry; + $carry = MATH_BIGINTEGER_BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31); + $product_value[$k] = (int) ($temp - MATH_BIGINTEGER_BASE_FULL * $carry); + } + + $product_value[$k] = $carry; + } + + return $product_value; + } + + /** + * Performs Karatsuba multiplication on two BigIntegers + * + * See {@link http://en.wikipedia.org/wiki/Karatsuba_algorithm Karatsuba algorithm} and + * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=120 MPM 5.2.3}. + * + * @param array $x_value + * @param array $y_value + * @return array + * @access private + */ + function _karatsuba($x_value, $y_value) + { + $m = min(count($x_value) >> 1, count($y_value) >> 1); + + if ($m < MATH_BIGINTEGER_KARATSUBA_CUTOFF) { + return $this->_regularMultiply($x_value, $y_value); + } + + $x1 = array_slice($x_value, $m); + $x0 = array_slice($x_value, 0, $m); + $y1 = array_slice($y_value, $m); + $y0 = array_slice($y_value, 0, $m); + + $z2 = $this->_karatsuba($x1, $y1); + $z0 = $this->_karatsuba($x0, $y0); + + $z1 = $this->_add($x1, false, $x0, false); + $temp = $this->_add($y1, false, $y0, false); + $z1 = $this->_karatsuba($z1[MATH_BIGINTEGER_VALUE], $temp[MATH_BIGINTEGER_VALUE]); + $temp = $this->_add($z2, false, $z0, false); + $z1 = $this->_subtract($z1, false, $temp[MATH_BIGINTEGER_VALUE], false); + + $z2 = array_merge(array_fill(0, 2 * $m, 0), $z2); + $z1[MATH_BIGINTEGER_VALUE] = array_merge(array_fill(0, $m, 0), $z1[MATH_BIGINTEGER_VALUE]); + + $xy = $this->_add($z2, false, $z1[MATH_BIGINTEGER_VALUE], $z1[MATH_BIGINTEGER_SIGN]); + $xy = $this->_add($xy[MATH_BIGINTEGER_VALUE], $xy[MATH_BIGINTEGER_SIGN], $z0, false); + + return $xy[MATH_BIGINTEGER_VALUE]; + } + + /** + * Performs squaring + * + * @param array $x + * @return array + * @access private + */ + function _square($x = false) + { + return count($x) < 2 * MATH_BIGINTEGER_KARATSUBA_CUTOFF ? + $this->_trim($this->_baseSquare($x)) : + $this->_trim($this->_karatsubaSquare($x)); + } + + /** + * Performs traditional squaring on two BigIntegers + * + * Squaring can be done faster than multiplying a number by itself can be. See + * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=7 HAC 14.2.4} / + * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=141 MPM 5.3} for more information. + * + * @param array $value + * @return array + * @access private + */ + function _baseSquare($value) + { + if (empty($value)) { + return array(); + } + $square_value = $this->_array_repeat(0, 2 * count($value)); + + for ($i = 0, $max_index = count($value) - 1; $i <= $max_index; ++$i) { + $i2 = $i << 1; + + $temp = $square_value[$i2] + $value[$i] * $value[$i]; + $carry = MATH_BIGINTEGER_BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31); + $square_value[$i2] = (int) ($temp - MATH_BIGINTEGER_BASE_FULL * $carry); + + // note how we start from $i+1 instead of 0 as we do in multiplication. + for ($j = $i + 1, $k = $i2 + 1; $j <= $max_index; ++$j, ++$k) { + $temp = $square_value[$k] + 2 * $value[$j] * $value[$i] + $carry; + $carry = MATH_BIGINTEGER_BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31); + $square_value[$k] = (int) ($temp - MATH_BIGINTEGER_BASE_FULL * $carry); + } + + // the following line can yield values larger 2**15. at this point, PHP should switch + // over to floats. + $square_value[$i + $max_index + 1] = $carry; + } + + return $square_value; + } + + /** + * Performs Karatsuba "squaring" on two BigIntegers + * + * See {@link http://en.wikipedia.org/wiki/Karatsuba_algorithm Karatsuba algorithm} and + * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=151 MPM 5.3.4}. + * + * @param array $value + * @return array + * @access private + */ + function _karatsubaSquare($value) + { + $m = count($value) >> 1; + + if ($m < MATH_BIGINTEGER_KARATSUBA_CUTOFF) { + return $this->_baseSquare($value); + } + + $x1 = array_slice($value, $m); + $x0 = array_slice($value, 0, $m); + + $z2 = $this->_karatsubaSquare($x1); + $z0 = $this->_karatsubaSquare($x0); + + $z1 = $this->_add($x1, false, $x0, false); + $z1 = $this->_karatsubaSquare($z1[MATH_BIGINTEGER_VALUE]); + $temp = $this->_add($z2, false, $z0, false); + $z1 = $this->_subtract($z1, false, $temp[MATH_BIGINTEGER_VALUE], false); + + $z2 = array_merge(array_fill(0, 2 * $m, 0), $z2); + $z1[MATH_BIGINTEGER_VALUE] = array_merge(array_fill(0, $m, 0), $z1[MATH_BIGINTEGER_VALUE]); + + $xx = $this->_add($z2, false, $z1[MATH_BIGINTEGER_VALUE], $z1[MATH_BIGINTEGER_SIGN]); + $xx = $this->_add($xx[MATH_BIGINTEGER_VALUE], $xx[MATH_BIGINTEGER_SIGN], $z0, false); + + return $xx[MATH_BIGINTEGER_VALUE]; + } + + /** + * Divides two BigIntegers. + * + * Returns an array whose first element contains the quotient and whose second element contains the + * "common residue". If the remainder would be positive, the "common residue" and the remainder are the + * same. If the remainder would be negative, the "common residue" is equal to the sum of the remainder + * and the divisor (basically, the "common residue" is the first positive modulo). + * + * Here's an example: + * + * divide($b); + * + * echo $quotient->toString(); // outputs 0 + * echo "\r\n"; + * echo $remainder->toString(); // outputs 10 + * ?> + * + * + * @param Math_BigInteger $y + * @return array + * @access public + * @internal This function is based off of {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=9 HAC 14.20}. + */ + function divide($y) + { + switch (MATH_BIGINTEGER_MODE) { + case MATH_BIGINTEGER_MODE_GMP: + $quotient = new Math_BigInteger(); + $remainder = new Math_BigInteger(); + + list($quotient->value, $remainder->value) = gmp_div_qr($this->value, $y->value); + + if (gmp_sign($remainder->value) < 0) { + $remainder->value = gmp_add($remainder->value, gmp_abs($y->value)); + } + + return array($this->_normalize($quotient), $this->_normalize($remainder)); + case MATH_BIGINTEGER_MODE_BCMATH: + $quotient = new Math_BigInteger(); + $remainder = new Math_BigInteger(); + + $quotient->value = bcdiv($this->value, $y->value, 0); + $remainder->value = bcmod($this->value, $y->value); + + if ($remainder->value[0] == '-') { + $remainder->value = bcadd($remainder->value, $y->value[0] == '-' ? substr($y->value, 1) : $y->value, 0); + } + + return array($this->_normalize($quotient), $this->_normalize($remainder)); + } + + if (count($y->value) == 1) { + list($q, $r) = $this->_divide_digit($this->value, $y->value[0]); + $quotient = new Math_BigInteger(); + $remainder = new Math_BigInteger(); + $quotient->value = $q; + $remainder->value = array($r); + $quotient->is_negative = $this->is_negative != $y->is_negative; + return array($this->_normalize($quotient), $this->_normalize($remainder)); + } + + static $zero; + if (!isset($zero)) { + $zero = new Math_BigInteger(); + } + + $x = $this->copy(); + $y = $y->copy(); + + $x_sign = $x->is_negative; + $y_sign = $y->is_negative; + + $x->is_negative = $y->is_negative = false; + + $diff = $x->compare($y); + + if (!$diff) { + $temp = new Math_BigInteger(); + $temp->value = array(1); + $temp->is_negative = $x_sign != $y_sign; + return array($this->_normalize($temp), $this->_normalize(new Math_BigInteger())); + } + + if ($diff < 0) { + // if $x is negative, "add" $y. + if ($x_sign) { + $x = $y->subtract($x); + } + return array($this->_normalize(new Math_BigInteger()), $this->_normalize($x)); + } + + // normalize $x and $y as described in HAC 14.23 / 14.24 + $msb = $y->value[count($y->value) - 1]; + for ($shift = 0; !($msb & MATH_BIGINTEGER_MSB); ++$shift) { + $msb <<= 1; + } + $x->_lshift($shift); + $y->_lshift($shift); + $y_value = &$y->value; + + $x_max = count($x->value) - 1; + $y_max = count($y->value) - 1; + + $quotient = new Math_BigInteger(); + $quotient_value = &$quotient->value; + $quotient_value = $this->_array_repeat(0, $x_max - $y_max + 1); + + static $temp, $lhs, $rhs; + if (!isset($temp)) { + $temp = new Math_BigInteger(); + $lhs = new Math_BigInteger(); + $rhs = new Math_BigInteger(); + } + $temp_value = &$temp->value; + $rhs_value = &$rhs->value; + + // $temp = $y << ($x_max - $y_max-1) in base 2**26 + $temp_value = array_merge($this->_array_repeat(0, $x_max - $y_max), $y_value); + + while ($x->compare($temp) >= 0) { + // calculate the "common residue" + ++$quotient_value[$x_max - $y_max]; + $x = $x->subtract($temp); + $x_max = count($x->value) - 1; + } + + for ($i = $x_max; $i >= $y_max + 1; --$i) { + $x_value = &$x->value; + $x_window = array( + isset($x_value[$i]) ? $x_value[$i] : 0, + isset($x_value[$i - 1]) ? $x_value[$i - 1] : 0, + isset($x_value[$i - 2]) ? $x_value[$i - 2] : 0 + ); + $y_window = array( + $y_value[$y_max], + ($y_max > 0) ? $y_value[$y_max - 1] : 0 + ); + + $q_index = $i - $y_max - 1; + if ($x_window[0] == $y_window[0]) { + $quotient_value[$q_index] = MATH_BIGINTEGER_MAX_DIGIT; + } else { + $quotient_value[$q_index] = $this->_safe_divide( + $x_window[0] * MATH_BIGINTEGER_BASE_FULL + $x_window[1], + $y_window[0] + ); + } + + $temp_value = array($y_window[1], $y_window[0]); + + $lhs->value = array($quotient_value[$q_index]); + $lhs = $lhs->multiply($temp); + + $rhs_value = array($x_window[2], $x_window[1], $x_window[0]); + + while ($lhs->compare($rhs) > 0) { + --$quotient_value[$q_index]; + + $lhs->value = array($quotient_value[$q_index]); + $lhs = $lhs->multiply($temp); + } + + $adjust = $this->_array_repeat(0, $q_index); + $temp_value = array($quotient_value[$q_index]); + $temp = $temp->multiply($y); + $temp_value = &$temp->value; + $temp_value = array_merge($adjust, $temp_value); + + $x = $x->subtract($temp); + + if ($x->compare($zero) < 0) { + $temp_value = array_merge($adjust, $y_value); + $x = $x->add($temp); + + --$quotient_value[$q_index]; + } + + $x_max = count($x_value) - 1; + } + + // unnormalize the remainder + $x->_rshift($shift); + + $quotient->is_negative = $x_sign != $y_sign; + + // calculate the "common residue", if appropriate + if ($x_sign) { + $y->_rshift($shift); + $x = $y->subtract($x); + } + + return array($this->_normalize($quotient), $this->_normalize($x)); + } + + /** + * Divides a BigInteger by a regular integer + * + * abc / x = a00 / x + b0 / x + c / x + * + * @param array $dividend + * @param array $divisor + * @return array + * @access private + */ + function _divide_digit($dividend, $divisor) + { + $carry = 0; + $result = array(); + + for ($i = count($dividend) - 1; $i >= 0; --$i) { + $temp = MATH_BIGINTEGER_BASE_FULL * $carry + $dividend[$i]; + $result[$i] = $this->_safe_divide($temp, $divisor); + $carry = (int) ($temp - $divisor * $result[$i]); + } + + return array($result, $carry); + } + + /** + * Performs modular exponentiation. + * + * Here's an example: + * + * modPow($b, $c); + * + * echo $c->toString(); // outputs 10 + * ?> + * + * + * @param Math_BigInteger $e + * @param Math_BigInteger $n + * @return Math_BigInteger + * @access public + * @internal The most naive approach to modular exponentiation has very unreasonable requirements, and + * and although the approach involving repeated squaring does vastly better, it, too, is impractical + * for our purposes. The reason being that division - by far the most complicated and time-consuming + * of the basic operations (eg. +,-,*,/) - occurs multiple times within it. + * + * Modular reductions resolve this issue. Although an individual modular reduction takes more time + * then an individual division, when performed in succession (with the same modulo), they're a lot faster. + * + * The two most commonly used modular reductions are Barrett and Montgomery reduction. Montgomery reduction, + * although faster, only works when the gcd of the modulo and of the base being used is 1. In RSA, when the + * base is a power of two, the modulo - a product of two primes - is always going to have a gcd of 1 (because + * the product of two odd numbers is odd), but what about when RSA isn't used? + * + * In contrast, Barrett reduction has no such constraint. As such, some bigint implementations perform a + * Barrett reduction after every operation in the modpow function. Others perform Barrett reductions when the + * modulo is even and Montgomery reductions when the modulo is odd. BigInteger.java's modPow method, however, + * uses a trick involving the Chinese Remainder Theorem to factor the even modulo into two numbers - one odd and + * the other, a power of two - and recombine them, later. This is the method that this modPow function uses. + * {@link http://islab.oregonstate.edu/papers/j34monex.pdf Montgomery Reduction with Even Modulus} elaborates. + */ + function modPow($e, $n) + { + $n = $this->bitmask !== false && $this->bitmask->compare($n) < 0 ? $this->bitmask : $n->abs(); + + if ($e->compare(new Math_BigInteger()) < 0) { + $e = $e->abs(); + + $temp = $this->modInverse($n); + if ($temp === false) { + return false; + } + + return $this->_normalize($temp->modPow($e, $n)); + } + + if (MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_GMP) { + $temp = new Math_BigInteger(); + $temp->value = gmp_powm($this->value, $e->value, $n->value); + + return $this->_normalize($temp); + } + + if ($this->compare(new Math_BigInteger()) < 0 || $this->compare($n) > 0) { + list(, $temp) = $this->divide($n); + return $temp->modPow($e, $n); + } + + if (defined('MATH_BIGINTEGER_OPENSSL_ENABLED')) { + $components = array( + 'modulus' => $n->toBytes(true), + 'publicExponent' => $e->toBytes(true) + ); + + $components = array( + 'modulus' => pack('Ca*a*', 2, $this->_encodeASN1Length(strlen($components['modulus'])), $components['modulus']), + 'publicExponent' => pack('Ca*a*', 2, $this->_encodeASN1Length(strlen($components['publicExponent'])), $components['publicExponent']) + ); + + $RSAPublicKey = pack( + 'Ca*a*a*', + 48, + $this->_encodeASN1Length(strlen($components['modulus']) + strlen($components['publicExponent'])), + $components['modulus'], + $components['publicExponent'] + ); + + $rsaOID = pack('H*', '300d06092a864886f70d0101010500'); // hex version of MA0GCSqGSIb3DQEBAQUA + $RSAPublicKey = chr(0) . $RSAPublicKey; + $RSAPublicKey = chr(3) . $this->_encodeASN1Length(strlen($RSAPublicKey)) . $RSAPublicKey; + + $encapsulated = pack( + 'Ca*a*', + 48, + $this->_encodeASN1Length(strlen($rsaOID . $RSAPublicKey)), + $rsaOID . $RSAPublicKey + ); + + $RSAPublicKey = "-----BEGIN PUBLIC KEY-----\r\n" . + chunk_split(base64_encode($encapsulated)) . + '-----END PUBLIC KEY-----'; + + $plaintext = str_pad($this->toBytes(), strlen($n->toBytes(true)) - 1, "\0", STR_PAD_LEFT); + + if (openssl_public_encrypt($plaintext, $result, $RSAPublicKey, OPENSSL_NO_PADDING)) { + return new Math_BigInteger($result, 256); + } + } + + if (MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_BCMATH) { + $temp = new Math_BigInteger(); + $temp->value = bcpowmod($this->value, $e->value, $n->value, 0); + + return $this->_normalize($temp); + } + + if (empty($e->value)) { + $temp = new Math_BigInteger(); + $temp->value = array(1); + return $this->_normalize($temp); + } + + if ($e->value == array(1)) { + list(, $temp) = $this->divide($n); + return $this->_normalize($temp); + } + + if ($e->value == array(2)) { + $temp = new Math_BigInteger(); + $temp->value = $this->_square($this->value); + list(, $temp) = $temp->divide($n); + return $this->_normalize($temp); + } + + return $this->_normalize($this->_slidingWindow($e, $n, MATH_BIGINTEGER_BARRETT)); + + // the following code, although not callable, can be run independently of the above code + // although the above code performed better in my benchmarks the following could might + // perform better under different circumstances. in lieu of deleting it it's just been + // made uncallable + + // is the modulo odd? + if ($n->value[0] & 1) { + return $this->_normalize($this->_slidingWindow($e, $n, MATH_BIGINTEGER_MONTGOMERY)); + } + // if it's not, it's even + + // find the lowest set bit (eg. the max pow of 2 that divides $n) + for ($i = 0; $i < count($n->value); ++$i) { + if ($n->value[$i]) { + $temp = decbin($n->value[$i]); + $j = strlen($temp) - strrpos($temp, '1') - 1; + $j+= 26 * $i; + break; + } + } + // at this point, 2^$j * $n/(2^$j) == $n + + $mod1 = $n->copy(); + $mod1->_rshift($j); + $mod2 = new Math_BigInteger(); + $mod2->value = array(1); + $mod2->_lshift($j); + + $part1 = ($mod1->value != array(1)) ? $this->_slidingWindow($e, $mod1, MATH_BIGINTEGER_MONTGOMERY) : new Math_BigInteger(); + $part2 = $this->_slidingWindow($e, $mod2, MATH_BIGINTEGER_POWEROF2); + + $y1 = $mod2->modInverse($mod1); + $y2 = $mod1->modInverse($mod2); + + $result = $part1->multiply($mod2); + $result = $result->multiply($y1); + + $temp = $part2->multiply($mod1); + $temp = $temp->multiply($y2); + + $result = $result->add($temp); + list(, $result) = $result->divide($n); + + return $this->_normalize($result); + } + + /** + * Performs modular exponentiation. + * + * Alias for Math_BigInteger::modPow() + * + * @param Math_BigInteger $e + * @param Math_BigInteger $n + * @return Math_BigInteger + * @access public + */ + function powMod($e, $n) + { + return $this->modPow($e, $n); + } + + /** + * Sliding Window k-ary Modular Exponentiation + * + * Based on {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=27 HAC 14.85} / + * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=210 MPM 7.7}. In a departure from those algorithims, + * however, this function performs a modular reduction after every multiplication and squaring operation. + * As such, this function has the same preconditions that the reductions being used do. + * + * @param Math_BigInteger $e + * @param Math_BigInteger $n + * @param int $mode + * @return Math_BigInteger + * @access private + */ + function _slidingWindow($e, $n, $mode) + { + static $window_ranges = array(7, 25, 81, 241, 673, 1793); // from BigInteger.java's oddModPow function + //static $window_ranges = array(0, 7, 36, 140, 450, 1303, 3529); // from MPM 7.3.1 + + $e_value = $e->value; + $e_length = count($e_value) - 1; + $e_bits = decbin($e_value[$e_length]); + for ($i = $e_length - 1; $i >= 0; --$i) { + $e_bits.= str_pad(decbin($e_value[$i]), MATH_BIGINTEGER_BASE, '0', STR_PAD_LEFT); + } + + $e_length = strlen($e_bits); + + // calculate the appropriate window size. + // $window_size == 3 if $window_ranges is between 25 and 81, for example. + for ($i = 0, $window_size = 1; $i < count($window_ranges) && $e_length > $window_ranges[$i]; ++$window_size, ++$i) { + } + + $n_value = $n->value; + + // precompute $this^0 through $this^$window_size + $powers = array(); + $powers[1] = $this->_prepareReduce($this->value, $n_value, $mode); + $powers[2] = $this->_squareReduce($powers[1], $n_value, $mode); + + // we do every other number since substr($e_bits, $i, $j+1) (see below) is supposed to end + // in a 1. ie. it's supposed to be odd. + $temp = 1 << ($window_size - 1); + for ($i = 1; $i < $temp; ++$i) { + $i2 = $i << 1; + $powers[$i2 + 1] = $this->_multiplyReduce($powers[$i2 - 1], $powers[2], $n_value, $mode); + } + + $result = array(1); + $result = $this->_prepareReduce($result, $n_value, $mode); + + for ($i = 0; $i < $e_length;) { + if (!$e_bits[$i]) { + $result = $this->_squareReduce($result, $n_value, $mode); + ++$i; + } else { + for ($j = $window_size - 1; $j > 0; --$j) { + if (!empty($e_bits[$i + $j])) { + break; + } + } + + // eg. the length of substr($e_bits, $i, $j + 1) + for ($k = 0; $k <= $j; ++$k) { + $result = $this->_squareReduce($result, $n_value, $mode); + } + + $result = $this->_multiplyReduce($result, $powers[bindec(substr($e_bits, $i, $j + 1))], $n_value, $mode); + + $i += $j + 1; + } + } + + $temp = new Math_BigInteger(); + $temp->value = $this->_reduce($result, $n_value, $mode); + + return $temp; + } + + /** + * Modular reduction + * + * For most $modes this will return the remainder. + * + * @see self::_slidingWindow() + * @access private + * @param array $x + * @param array $n + * @param int $mode + * @return array + */ + function _reduce($x, $n, $mode) + { + switch ($mode) { + case MATH_BIGINTEGER_MONTGOMERY: + return $this->_montgomery($x, $n); + case MATH_BIGINTEGER_BARRETT: + return $this->_barrett($x, $n); + case MATH_BIGINTEGER_POWEROF2: + $lhs = new Math_BigInteger(); + $lhs->value = $x; + $rhs = new Math_BigInteger(); + $rhs->value = $n; + return $x->_mod2($n); + case MATH_BIGINTEGER_CLASSIC: + $lhs = new Math_BigInteger(); + $lhs->value = $x; + $rhs = new Math_BigInteger(); + $rhs->value = $n; + list(, $temp) = $lhs->divide($rhs); + return $temp->value; + case MATH_BIGINTEGER_NONE: + return $x; + default: + // an invalid $mode was provided + } + } + + /** + * Modular reduction preperation + * + * @see self::_slidingWindow() + * @access private + * @param array $x + * @param array $n + * @param int $mode + * @return array + */ + function _prepareReduce($x, $n, $mode) + { + if ($mode == MATH_BIGINTEGER_MONTGOMERY) { + return $this->_prepMontgomery($x, $n); + } + return $this->_reduce($x, $n, $mode); + } + + /** + * Modular multiply + * + * @see self::_slidingWindow() + * @access private + * @param array $x + * @param array $y + * @param array $n + * @param int $mode + * @return array + */ + function _multiplyReduce($x, $y, $n, $mode) + { + if ($mode == MATH_BIGINTEGER_MONTGOMERY) { + return $this->_montgomeryMultiply($x, $y, $n); + } + $temp = $this->_multiply($x, false, $y, false); + return $this->_reduce($temp[MATH_BIGINTEGER_VALUE], $n, $mode); + } + + /** + * Modular square + * + * @see self::_slidingWindow() + * @access private + * @param array $x + * @param array $n + * @param int $mode + * @return array + */ + function _squareReduce($x, $n, $mode) + { + if ($mode == MATH_BIGINTEGER_MONTGOMERY) { + return $this->_montgomeryMultiply($x, $x, $n); + } + return $this->_reduce($this->_square($x), $n, $mode); + } + + /** + * Modulos for Powers of Two + * + * Calculates $x%$n, where $n = 2**$e, for some $e. Since this is basically the same as doing $x & ($n-1), + * we'll just use this function as a wrapper for doing that. + * + * @see self::_slidingWindow() + * @access private + * @param Math_BigInteger + * @return Math_BigInteger + */ + function _mod2($n) + { + $temp = new Math_BigInteger(); + $temp->value = array(1); + return $this->bitwise_and($n->subtract($temp)); + } + + /** + * Barrett Modular Reduction + * + * See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=14 HAC 14.3.3} / + * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=165 MPM 6.2.5} for more information. Modified slightly, + * so as not to require negative numbers (initially, this script didn't support negative numbers). + * + * Employs "folding", as described at + * {@link http://www.cosic.esat.kuleuven.be/publications/thesis-149.pdf#page=66 thesis-149.pdf#page=66}. To quote from + * it, "the idea [behind folding] is to find a value x' such that x (mod m) = x' (mod m), with x' being smaller than x." + * + * Unfortunately, the "Barrett Reduction with Folding" algorithm described in thesis-149.pdf is not, as written, all that + * usable on account of (1) its not using reasonable radix points as discussed in + * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=162 MPM 6.2.2} and (2) the fact that, even with reasonable + * radix points, it only works when there are an even number of digits in the denominator. The reason for (2) is that + * (x >> 1) + (x >> 1) != x / 2 + x / 2. If x is even, they're the same, but if x is odd, they're not. See the in-line + * comments for details. + * + * @see self::_slidingWindow() + * @access private + * @param array $n + * @param array $m + * @return array + */ + function _barrett($n, $m) + { + static $cache = array( + MATH_BIGINTEGER_VARIABLE => array(), + MATH_BIGINTEGER_DATA => array() + ); + + $m_length = count($m); + + // if ($this->_compare($n, $this->_square($m)) >= 0) { + if (count($n) > 2 * $m_length) { + $lhs = new Math_BigInteger(); + $rhs = new Math_BigInteger(); + $lhs->value = $n; + $rhs->value = $m; + list(, $temp) = $lhs->divide($rhs); + return $temp->value; + } + + // if (m.length >> 1) + 2 <= m.length then m is too small and n can't be reduced + if ($m_length < 5) { + return $this->_regularBarrett($n, $m); + } + + // n = 2 * m.length + + if (($key = array_search($m, $cache[MATH_BIGINTEGER_VARIABLE])) === false) { + $key = count($cache[MATH_BIGINTEGER_VARIABLE]); + $cache[MATH_BIGINTEGER_VARIABLE][] = $m; + + $lhs = new Math_BigInteger(); + $lhs_value = &$lhs->value; + $lhs_value = $this->_array_repeat(0, $m_length + ($m_length >> 1)); + $lhs_value[] = 1; + $rhs = new Math_BigInteger(); + $rhs->value = $m; + + list($u, $m1) = $lhs->divide($rhs); + $u = $u->value; + $m1 = $m1->value; + + $cache[MATH_BIGINTEGER_DATA][] = array( + 'u' => $u, // m.length >> 1 (technically (m.length >> 1) + 1) + 'm1'=> $m1 // m.length + ); + } else { + extract($cache[MATH_BIGINTEGER_DATA][$key]); + } + + $cutoff = $m_length + ($m_length >> 1); + $lsd = array_slice($n, 0, $cutoff); // m.length + (m.length >> 1) + $msd = array_slice($n, $cutoff); // m.length >> 1 + $lsd = $this->_trim($lsd); + $temp = $this->_multiply($msd, false, $m1, false); + $n = $this->_add($lsd, false, $temp[MATH_BIGINTEGER_VALUE], false); // m.length + (m.length >> 1) + 1 + + if ($m_length & 1) { + return $this->_regularBarrett($n[MATH_BIGINTEGER_VALUE], $m); + } + + // (m.length + (m.length >> 1) + 1) - (m.length - 1) == (m.length >> 1) + 2 + $temp = array_slice($n[MATH_BIGINTEGER_VALUE], $m_length - 1); + // if even: ((m.length >> 1) + 2) + (m.length >> 1) == m.length + 2 + // if odd: ((m.length >> 1) + 2) + (m.length >> 1) == (m.length - 1) + 2 == m.length + 1 + $temp = $this->_multiply($temp, false, $u, false); + // if even: (m.length + 2) - ((m.length >> 1) + 1) = m.length - (m.length >> 1) + 1 + // if odd: (m.length + 1) - ((m.length >> 1) + 1) = m.length - (m.length >> 1) + $temp = array_slice($temp[MATH_BIGINTEGER_VALUE], ($m_length >> 1) + 1); + // if even: (m.length - (m.length >> 1) + 1) + m.length = 2 * m.length - (m.length >> 1) + 1 + // if odd: (m.length - (m.length >> 1)) + m.length = 2 * m.length - (m.length >> 1) + $temp = $this->_multiply($temp, false, $m, false); + + // at this point, if m had an odd number of digits, we'd be subtracting a 2 * m.length - (m.length >> 1) digit + // number from a m.length + (m.length >> 1) + 1 digit number. ie. there'd be an extra digit and the while loop + // following this comment would loop a lot (hence our calling _regularBarrett() in that situation). + + $result = $this->_subtract($n[MATH_BIGINTEGER_VALUE], false, $temp[MATH_BIGINTEGER_VALUE], false); + + while ($this->_compare($result[MATH_BIGINTEGER_VALUE], $result[MATH_BIGINTEGER_SIGN], $m, false) >= 0) { + $result = $this->_subtract($result[MATH_BIGINTEGER_VALUE], $result[MATH_BIGINTEGER_SIGN], $m, false); + } + + return $result[MATH_BIGINTEGER_VALUE]; + } + + /** + * (Regular) Barrett Modular Reduction + * + * For numbers with more than four digits Math_BigInteger::_barrett() is faster. The difference between that and this + * is that this function does not fold the denominator into a smaller form. + * + * @see self::_slidingWindow() + * @access private + * @param array $x + * @param array $n + * @return array + */ + function _regularBarrett($x, $n) + { + static $cache = array( + MATH_BIGINTEGER_VARIABLE => array(), + MATH_BIGINTEGER_DATA => array() + ); + + $n_length = count($n); + + if (count($x) > 2 * $n_length) { + $lhs = new Math_BigInteger(); + $rhs = new Math_BigInteger(); + $lhs->value = $x; + $rhs->value = $n; + list(, $temp) = $lhs->divide($rhs); + return $temp->value; + } + + if (($key = array_search($n, $cache[MATH_BIGINTEGER_VARIABLE])) === false) { + $key = count($cache[MATH_BIGINTEGER_VARIABLE]); + $cache[MATH_BIGINTEGER_VARIABLE][] = $n; + $lhs = new Math_BigInteger(); + $lhs_value = &$lhs->value; + $lhs_value = $this->_array_repeat(0, 2 * $n_length); + $lhs_value[] = 1; + $rhs = new Math_BigInteger(); + $rhs->value = $n; + list($temp, ) = $lhs->divide($rhs); // m.length + $cache[MATH_BIGINTEGER_DATA][] = $temp->value; + } + + // 2 * m.length - (m.length - 1) = m.length + 1 + $temp = array_slice($x, $n_length - 1); + // (m.length + 1) + m.length = 2 * m.length + 1 + $temp = $this->_multiply($temp, false, $cache[MATH_BIGINTEGER_DATA][$key], false); + // (2 * m.length + 1) - (m.length - 1) = m.length + 2 + $temp = array_slice($temp[MATH_BIGINTEGER_VALUE], $n_length + 1); + + // m.length + 1 + $result = array_slice($x, 0, $n_length + 1); + // m.length + 1 + $temp = $this->_multiplyLower($temp, false, $n, false, $n_length + 1); + // $temp == array_slice($temp->_multiply($temp, false, $n, false)->value, 0, $n_length + 1) + + if ($this->_compare($result, false, $temp[MATH_BIGINTEGER_VALUE], $temp[MATH_BIGINTEGER_SIGN]) < 0) { + $corrector_value = $this->_array_repeat(0, $n_length + 1); + $corrector_value[count($corrector_value)] = 1; + $result = $this->_add($result, false, $corrector_value, false); + $result = $result[MATH_BIGINTEGER_VALUE]; + } + + // at this point, we're subtracting a number with m.length + 1 digits from another number with m.length + 1 digits + $result = $this->_subtract($result, false, $temp[MATH_BIGINTEGER_VALUE], $temp[MATH_BIGINTEGER_SIGN]); + while ($this->_compare($result[MATH_BIGINTEGER_VALUE], $result[MATH_BIGINTEGER_SIGN], $n, false) > 0) { + $result = $this->_subtract($result[MATH_BIGINTEGER_VALUE], $result[MATH_BIGINTEGER_SIGN], $n, false); + } + + return $result[MATH_BIGINTEGER_VALUE]; + } + + /** + * Performs long multiplication up to $stop digits + * + * If you're going to be doing array_slice($product->value, 0, $stop), some cycles can be saved. + * + * @see self::_regularBarrett() + * @param array $x_value + * @param bool $x_negative + * @param array $y_value + * @param bool $y_negative + * @param int $stop + * @return array + * @access private + */ + function _multiplyLower($x_value, $x_negative, $y_value, $y_negative, $stop) + { + $x_length = count($x_value); + $y_length = count($y_value); + + if (!$x_length || !$y_length) { // a 0 is being multiplied + return array( + MATH_BIGINTEGER_VALUE => array(), + MATH_BIGINTEGER_SIGN => false + ); + } + + if ($x_length < $y_length) { + $temp = $x_value; + $x_value = $y_value; + $y_value = $temp; + + $x_length = count($x_value); + $y_length = count($y_value); + } + + $product_value = $this->_array_repeat(0, $x_length + $y_length); + + // the following for loop could be removed if the for loop following it + // (the one with nested for loops) initially set $i to 0, but + // doing so would also make the result in one set of unnecessary adds, + // since on the outermost loops first pass, $product->value[$k] is going + // to always be 0 + + $carry = 0; + + for ($j = 0; $j < $x_length; ++$j) { // ie. $i = 0, $k = $i + $temp = $x_value[$j] * $y_value[0] + $carry; // $product_value[$k] == 0 + $carry = MATH_BIGINTEGER_BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31); + $product_value[$j] = (int) ($temp - MATH_BIGINTEGER_BASE_FULL * $carry); + } + + if ($j < $stop) { + $product_value[$j] = $carry; + } + + // the above for loop is what the previous comment was talking about. the + // following for loop is the "one with nested for loops" + + for ($i = 1; $i < $y_length; ++$i) { + $carry = 0; + + for ($j = 0, $k = $i; $j < $x_length && $k < $stop; ++$j, ++$k) { + $temp = $product_value[$k] + $x_value[$j] * $y_value[$i] + $carry; + $carry = MATH_BIGINTEGER_BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31); + $product_value[$k] = (int) ($temp - MATH_BIGINTEGER_BASE_FULL * $carry); + } + + if ($k < $stop) { + $product_value[$k] = $carry; + } + } + + return array( + MATH_BIGINTEGER_VALUE => $this->_trim($product_value), + MATH_BIGINTEGER_SIGN => $x_negative != $y_negative + ); + } + + /** + * Montgomery Modular Reduction + * + * ($x->_prepMontgomery($n))->_montgomery($n) yields $x % $n. + * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=170 MPM 6.3} provides insights on how this can be + * improved upon (basically, by using the comba method). gcd($n, 2) must be equal to one for this function + * to work correctly. + * + * @see self::_prepMontgomery() + * @see self::_slidingWindow() + * @access private + * @param array $x + * @param array $n + * @return array + */ + function _montgomery($x, $n) + { + static $cache = array( + MATH_BIGINTEGER_VARIABLE => array(), + MATH_BIGINTEGER_DATA => array() + ); + + if (($key = array_search($n, $cache[MATH_BIGINTEGER_VARIABLE])) === false) { + $key = count($cache[MATH_BIGINTEGER_VARIABLE]); + $cache[MATH_BIGINTEGER_VARIABLE][] = $x; + $cache[MATH_BIGINTEGER_DATA][] = $this->_modInverse67108864($n); + } + + $k = count($n); + + $result = array(MATH_BIGINTEGER_VALUE => $x); + + for ($i = 0; $i < $k; ++$i) { + $temp = $result[MATH_BIGINTEGER_VALUE][$i] * $cache[MATH_BIGINTEGER_DATA][$key]; + $temp = $temp - MATH_BIGINTEGER_BASE_FULL * (MATH_BIGINTEGER_BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31)); + $temp = $this->_regularMultiply(array($temp), $n); + $temp = array_merge($this->_array_repeat(0, $i), $temp); + $result = $this->_add($result[MATH_BIGINTEGER_VALUE], false, $temp, false); + } + + $result[MATH_BIGINTEGER_VALUE] = array_slice($result[MATH_BIGINTEGER_VALUE], $k); + + if ($this->_compare($result, false, $n, false) >= 0) { + $result = $this->_subtract($result[MATH_BIGINTEGER_VALUE], false, $n, false); + } + + return $result[MATH_BIGINTEGER_VALUE]; + } + + /** + * Montgomery Multiply + * + * Interleaves the montgomery reduction and long multiplication algorithms together as described in + * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=13 HAC 14.36} + * + * @see self::_prepMontgomery() + * @see self::_montgomery() + * @access private + * @param array $x + * @param array $y + * @param array $m + * @return array + */ + function _montgomeryMultiply($x, $y, $m) + { + $temp = $this->_multiply($x, false, $y, false); + return $this->_montgomery($temp[MATH_BIGINTEGER_VALUE], $m); + + // the following code, although not callable, can be run independently of the above code + // although the above code performed better in my benchmarks the following could might + // perform better under different circumstances. in lieu of deleting it it's just been + // made uncallable + + static $cache = array( + MATH_BIGINTEGER_VARIABLE => array(), + MATH_BIGINTEGER_DATA => array() + ); + + if (($key = array_search($m, $cache[MATH_BIGINTEGER_VARIABLE])) === false) { + $key = count($cache[MATH_BIGINTEGER_VARIABLE]); + $cache[MATH_BIGINTEGER_VARIABLE][] = $m; + $cache[MATH_BIGINTEGER_DATA][] = $this->_modInverse67108864($m); + } + + $n = max(count($x), count($y), count($m)); + $x = array_pad($x, $n, 0); + $y = array_pad($y, $n, 0); + $m = array_pad($m, $n, 0); + $a = array(MATH_BIGINTEGER_VALUE => $this->_array_repeat(0, $n + 1)); + for ($i = 0; $i < $n; ++$i) { + $temp = $a[MATH_BIGINTEGER_VALUE][0] + $x[$i] * $y[0]; + $temp = $temp - MATH_BIGINTEGER_BASE_FULL * (MATH_BIGINTEGER_BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31)); + $temp = $temp * $cache[MATH_BIGINTEGER_DATA][$key]; + $temp = $temp - MATH_BIGINTEGER_BASE_FULL * (MATH_BIGINTEGER_BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31)); + $temp = $this->_add($this->_regularMultiply(array($x[$i]), $y), false, $this->_regularMultiply(array($temp), $m), false); + $a = $this->_add($a[MATH_BIGINTEGER_VALUE], false, $temp[MATH_BIGINTEGER_VALUE], false); + $a[MATH_BIGINTEGER_VALUE] = array_slice($a[MATH_BIGINTEGER_VALUE], 1); + } + if ($this->_compare($a[MATH_BIGINTEGER_VALUE], false, $m, false) >= 0) { + $a = $this->_subtract($a[MATH_BIGINTEGER_VALUE], false, $m, false); + } + return $a[MATH_BIGINTEGER_VALUE]; + } + + /** + * Prepare a number for use in Montgomery Modular Reductions + * + * @see self::_montgomery() + * @see self::_slidingWindow() + * @access private + * @param array $x + * @param array $n + * @return array + */ + function _prepMontgomery($x, $n) + { + $lhs = new Math_BigInteger(); + $lhs->value = array_merge($this->_array_repeat(0, count($n)), $x); + $rhs = new Math_BigInteger(); + $rhs->value = $n; + + list(, $temp) = $lhs->divide($rhs); + return $temp->value; + } + + /** + * Modular Inverse of a number mod 2**26 (eg. 67108864) + * + * Based off of the bnpInvDigit function implemented and justified in the following URL: + * + * {@link http://www-cs-students.stanford.edu/~tjw/jsbn/jsbn.js} + * + * The following URL provides more info: + * + * {@link http://groups.google.com/group/sci.crypt/msg/7a137205c1be7d85} + * + * As for why we do all the bitmasking... strange things can happen when converting from floats to ints. For + * instance, on some computers, var_dump((int) -4294967297) yields int(-1) and on others, it yields + * int(-2147483648). To avoid problems stemming from this, we use bitmasks to guarantee that ints aren't + * auto-converted to floats. The outermost bitmask is present because without it, there's no guarantee that + * the "residue" returned would be the so-called "common residue". We use fmod, in the last step, because the + * maximum possible $x is 26 bits and the maximum $result is 16 bits. Thus, we have to be able to handle up to + * 40 bits, which only 64-bit floating points will support. + * + * Thanks to Pedro Gimeno Fortea for input! + * + * @see self::_montgomery() + * @access private + * @param array $x + * @return int + */ + function _modInverse67108864($x) // 2**26 == 67,108,864 + { + $x = -$x[0]; + $result = $x & 0x3; // x**-1 mod 2**2 + $result = ($result * (2 - $x * $result)) & 0xF; // x**-1 mod 2**4 + $result = ($result * (2 - ($x & 0xFF) * $result)) & 0xFF; // x**-1 mod 2**8 + $result = ($result * ((2 - ($x & 0xFFFF) * $result) & 0xFFFF)) & 0xFFFF; // x**-1 mod 2**16 + $result = fmod($result * (2 - fmod($x * $result, MATH_BIGINTEGER_BASE_FULL)), MATH_BIGINTEGER_BASE_FULL); // x**-1 mod 2**26 + return $result & MATH_BIGINTEGER_MAX_DIGIT; + } + + /** + * Calculates modular inverses. + * + * Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses. + * + * Here's an example: + * + * modInverse($b); + * echo $c->toString(); // outputs 4 + * + * echo "\r\n"; + * + * $d = $a->multiply($c); + * list(, $d) = $d->divide($b); + * echo $d; // outputs 1 (as per the definition of modular inverse) + * ?> + * + * + * @param Math_BigInteger $n + * @return Math_BigInteger|false + * @access public + * @internal See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=21 HAC 14.64} for more information. + */ + function modInverse($n) + { + switch (MATH_BIGINTEGER_MODE) { + case MATH_BIGINTEGER_MODE_GMP: + $temp = new Math_BigInteger(); + $temp->value = gmp_invert($this->value, $n->value); + + return ($temp->value === false) ? false : $this->_normalize($temp); + } + + static $zero, $one; + if (!isset($zero)) { + $zero = new Math_BigInteger(); + $one = new Math_BigInteger(1); + } + + // $x mod -$n == $x mod $n. + $n = $n->abs(); + + if ($this->compare($zero) < 0) { + $temp = $this->abs(); + $temp = $temp->modInverse($n); + return $this->_normalize($n->subtract($temp)); + } + + extract($this->extendedGCD($n)); + + if (!$gcd->equals($one)) { + return false; + } + + $x = $x->compare($zero) < 0 ? $x->add($n) : $x; + + return $this->compare($zero) < 0 ? $this->_normalize($n->subtract($x)) : $this->_normalize($x); + } + + /** + * Calculates the greatest common divisor and Bezout's identity. + * + * Say you have 693 and 609. The GCD is 21. Bezout's identity states that there exist integers x and y such that + * 693*x + 609*y == 21. In point of fact, there are actually an infinite number of x and y combinations and which + * combination is returned is dependent upon which mode is in use. See + * {@link http://en.wikipedia.org/wiki/B%C3%A9zout%27s_identity Bezout's identity - Wikipedia} for more information. + * + * Here's an example: + * + * extendedGCD($b)); + * + * echo $gcd->toString() . "\r\n"; // outputs 21 + * echo $a->toString() * $x->toString() + $b->toString() * $y->toString(); // outputs 21 + * ?> + * + * + * @param Math_BigInteger $n + * @return Math_BigInteger + * @access public + * @internal Calculates the GCD using the binary xGCD algorithim described in + * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=19 HAC 14.61}. As the text above 14.61 notes, + * the more traditional algorithim requires "relatively costly multiple-precision divisions". + */ + function extendedGCD($n) + { + switch (MATH_BIGINTEGER_MODE) { + case MATH_BIGINTEGER_MODE_GMP: + extract(gmp_gcdext($this->value, $n->value)); + + return array( + 'gcd' => $this->_normalize(new Math_BigInteger($g)), + 'x' => $this->_normalize(new Math_BigInteger($s)), + 'y' => $this->_normalize(new Math_BigInteger($t)) + ); + case MATH_BIGINTEGER_MODE_BCMATH: + // it might be faster to use the binary xGCD algorithim here, as well, but (1) that algorithim works + // best when the base is a power of 2 and (2) i don't think it'd make much difference, anyway. as is, + // the basic extended euclidean algorithim is what we're using. + + $u = $this->value; + $v = $n->value; + + $a = '1'; + $b = '0'; + $c = '0'; + $d = '1'; + + while (bccomp($v, '0', 0) != 0) { + $q = bcdiv($u, $v, 0); + + $temp = $u; + $u = $v; + $v = bcsub($temp, bcmul($v, $q, 0), 0); + + $temp = $a; + $a = $c; + $c = bcsub($temp, bcmul($a, $q, 0), 0); + + $temp = $b; + $b = $d; + $d = bcsub($temp, bcmul($b, $q, 0), 0); + } + + return array( + 'gcd' => $this->_normalize(new Math_BigInteger($u)), + 'x' => $this->_normalize(new Math_BigInteger($a)), + 'y' => $this->_normalize(new Math_BigInteger($b)) + ); + } + + $y = $n->copy(); + $x = $this->copy(); + $g = new Math_BigInteger(); + $g->value = array(1); + + while (!(($x->value[0] & 1)|| ($y->value[0] & 1))) { + $x->_rshift(1); + $y->_rshift(1); + $g->_lshift(1); + } + + $u = $x->copy(); + $v = $y->copy(); + + $a = new Math_BigInteger(); + $b = new Math_BigInteger(); + $c = new Math_BigInteger(); + $d = new Math_BigInteger(); + + $a->value = $d->value = $g->value = array(1); + $b->value = $c->value = array(); + + while (!empty($u->value)) { + while (!($u->value[0] & 1)) { + $u->_rshift(1); + if ((!empty($a->value) && ($a->value[0] & 1)) || (!empty($b->value) && ($b->value[0] & 1))) { + $a = $a->add($y); + $b = $b->subtract($x); + } + $a->_rshift(1); + $b->_rshift(1); + } + + while (!($v->value[0] & 1)) { + $v->_rshift(1); + if ((!empty($d->value) && ($d->value[0] & 1)) || (!empty($c->value) && ($c->value[0] & 1))) { + $c = $c->add($y); + $d = $d->subtract($x); + } + $c->_rshift(1); + $d->_rshift(1); + } + + if ($u->compare($v) >= 0) { + $u = $u->subtract($v); + $a = $a->subtract($c); + $b = $b->subtract($d); + } else { + $v = $v->subtract($u); + $c = $c->subtract($a); + $d = $d->subtract($b); + } + } + + return array( + 'gcd' => $this->_normalize($g->multiply($v)), + 'x' => $this->_normalize($c), + 'y' => $this->_normalize($d) + ); + } + + /** + * Calculates the greatest common divisor + * + * Say you have 693 and 609. The GCD is 21. + * + * Here's an example: + * + * extendedGCD($b); + * + * echo $gcd->toString() . "\r\n"; // outputs 21 + * ?> + * + * + * @param Math_BigInteger $n + * @return Math_BigInteger + * @access public + */ + function gcd($n) + { + extract($this->extendedGCD($n)); + return $gcd; + } + + /** + * Absolute value. + * + * @return Math_BigInteger + * @access public + */ + function abs() + { + $temp = new Math_BigInteger(); + + switch (MATH_BIGINTEGER_MODE) { + case MATH_BIGINTEGER_MODE_GMP: + $temp->value = gmp_abs($this->value); + break; + case MATH_BIGINTEGER_MODE_BCMATH: + $temp->value = (bccomp($this->value, '0', 0) < 0) ? substr($this->value, 1) : $this->value; + break; + default: + $temp->value = $this->value; + } + + return $temp; + } + + /** + * Compares two numbers. + * + * Although one might think !$x->compare($y) means $x != $y, it, in fact, means the opposite. The reason for this is + * demonstrated thusly: + * + * $x > $y: $x->compare($y) > 0 + * $x < $y: $x->compare($y) < 0 + * $x == $y: $x->compare($y) == 0 + * + * Note how the same comparison operator is used. If you want to test for equality, use $x->equals($y). + * + * @param Math_BigInteger $y + * @return int < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal. + * @access public + * @see self::equals() + * @internal Could return $this->subtract($x), but that's not as fast as what we do do. + */ + function compare($y) + { + switch (MATH_BIGINTEGER_MODE) { + case MATH_BIGINTEGER_MODE_GMP: + return gmp_cmp($this->value, $y->value); + case MATH_BIGINTEGER_MODE_BCMATH: + return bccomp($this->value, $y->value, 0); + } + + return $this->_compare($this->value, $this->is_negative, $y->value, $y->is_negative); + } + + /** + * Compares two numbers. + * + * @param array $x_value + * @param bool $x_negative + * @param array $y_value + * @param bool $y_negative + * @return int + * @see self::compare() + * @access private + */ + function _compare($x_value, $x_negative, $y_value, $y_negative) + { + if ($x_negative != $y_negative) { + return (!$x_negative && $y_negative) ? 1 : -1; + } + + $result = $x_negative ? -1 : 1; + + if (count($x_value) != count($y_value)) { + return (count($x_value) > count($y_value)) ? $result : -$result; + } + $size = max(count($x_value), count($y_value)); + + $x_value = array_pad($x_value, $size, 0); + $y_value = array_pad($y_value, $size, 0); + + for ($i = count($x_value) - 1; $i >= 0; --$i) { + if ($x_value[$i] != $y_value[$i]) { + return ($x_value[$i] > $y_value[$i]) ? $result : -$result; + } + } + + return 0; + } + + /** + * Tests the equality of two numbers. + * + * If you need to see if one number is greater than or less than another number, use Math_BigInteger::compare() + * + * @param Math_BigInteger $x + * @return bool + * @access public + * @see self::compare() + */ + function equals($x) + { + switch (MATH_BIGINTEGER_MODE) { + case MATH_BIGINTEGER_MODE_GMP: + return gmp_cmp($this->value, $x->value) == 0; + default: + return $this->value === $x->value && $this->is_negative == $x->is_negative; + } + } + + /** + * Set Precision + * + * Some bitwise operations give different results depending on the precision being used. Examples include left + * shift, not, and rotates. + * + * @param int $bits + * @access public + */ + function setPrecision($bits) + { + $this->precision = $bits; + if (MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_BCMATH) { + $this->bitmask = new Math_BigInteger(chr((1 << ($bits & 0x7)) - 1) . str_repeat(chr(0xFF), $bits >> 3), 256); + } else { + $this->bitmask = new Math_BigInteger(bcpow('2', $bits, 0)); + } + + $temp = $this->_normalize($this); + $this->value = $temp->value; + } + + /** + * Logical And + * + * @param Math_BigInteger $x + * @access public + * @internal Implemented per a request by Lluis Pamies i Juarez + * @return Math_BigInteger + */ + function bitwise_and($x) + { + switch (MATH_BIGINTEGER_MODE) { + case MATH_BIGINTEGER_MODE_GMP: + $temp = new Math_BigInteger(); + $temp->value = gmp_and($this->value, $x->value); + + return $this->_normalize($temp); + case MATH_BIGINTEGER_MODE_BCMATH: + $left = $this->toBytes(); + $right = $x->toBytes(); + + $length = max(strlen($left), strlen($right)); + + $left = str_pad($left, $length, chr(0), STR_PAD_LEFT); + $right = str_pad($right, $length, chr(0), STR_PAD_LEFT); + + return $this->_normalize(new Math_BigInteger($left & $right, 256)); + } + + $result = $this->copy(); + + $length = min(count($x->value), count($this->value)); + + $result->value = array_slice($result->value, 0, $length); + + for ($i = 0; $i < $length; ++$i) { + $result->value[$i]&= $x->value[$i]; + } + + return $this->_normalize($result); + } + + /** + * Logical Or + * + * @param Math_BigInteger $x + * @access public + * @internal Implemented per a request by Lluis Pamies i Juarez + * @return Math_BigInteger + */ + function bitwise_or($x) + { + switch (MATH_BIGINTEGER_MODE) { + case MATH_BIGINTEGER_MODE_GMP: + $temp = new Math_BigInteger(); + $temp->value = gmp_or($this->value, $x->value); + + return $this->_normalize($temp); + case MATH_BIGINTEGER_MODE_BCMATH: + $left = $this->toBytes(); + $right = $x->toBytes(); + + $length = max(strlen($left), strlen($right)); + + $left = str_pad($left, $length, chr(0), STR_PAD_LEFT); + $right = str_pad($right, $length, chr(0), STR_PAD_LEFT); + + return $this->_normalize(new Math_BigInteger($left | $right, 256)); + } + + $length = max(count($this->value), count($x->value)); + $result = $this->copy(); + $result->value = array_pad($result->value, $length, 0); + $x->value = array_pad($x->value, $length, 0); + + for ($i = 0; $i < $length; ++$i) { + $result->value[$i]|= $x->value[$i]; + } + + return $this->_normalize($result); + } + + /** + * Logical Exclusive-Or + * + * @param Math_BigInteger $x + * @access public + * @internal Implemented per a request by Lluis Pamies i Juarez + * @return Math_BigInteger + */ + function bitwise_xor($x) + { + switch (MATH_BIGINTEGER_MODE) { + case MATH_BIGINTEGER_MODE_GMP: + $temp = new Math_BigInteger(); + $temp->value = gmp_xor($this->value, $x->value); + + return $this->_normalize($temp); + case MATH_BIGINTEGER_MODE_BCMATH: + $left = $this->toBytes(); + $right = $x->toBytes(); + + $length = max(strlen($left), strlen($right)); + + $left = str_pad($left, $length, chr(0), STR_PAD_LEFT); + $right = str_pad($right, $length, chr(0), STR_PAD_LEFT); + + return $this->_normalize(new Math_BigInteger($left ^ $right, 256)); + } + + $length = max(count($this->value), count($x->value)); + $result = $this->copy(); + $result->value = array_pad($result->value, $length, 0); + $x->value = array_pad($x->value, $length, 0); + + for ($i = 0; $i < $length; ++$i) { + $result->value[$i]^= $x->value[$i]; + } + + return $this->_normalize($result); + } + + /** + * Logical Not + * + * @access public + * @internal Implemented per a request by Lluis Pamies i Juarez + * @return Math_BigInteger + */ + function bitwise_not() + { + // calculuate "not" without regard to $this->precision + // (will always result in a smaller number. ie. ~1 isn't 1111 1110 - it's 0) + $temp = $this->toBytes(); + if ($temp == '') { + return ''; + } + $pre_msb = decbin(ord($temp[0])); + $temp = ~$temp; + $msb = decbin(ord($temp[0])); + if (strlen($msb) == 8) { + $msb = substr($msb, strpos($msb, '0')); + } + $temp[0] = chr(bindec($msb)); + + // see if we need to add extra leading 1's + $current_bits = strlen($pre_msb) + 8 * strlen($temp) - 8; + $new_bits = $this->precision - $current_bits; + if ($new_bits <= 0) { + return $this->_normalize(new Math_BigInteger($temp, 256)); + } + + // generate as many leading 1's as we need to. + $leading_ones = chr((1 << ($new_bits & 0x7)) - 1) . str_repeat(chr(0xFF), $new_bits >> 3); + $this->_base256_lshift($leading_ones, $current_bits); + + $temp = str_pad($temp, strlen($leading_ones), chr(0), STR_PAD_LEFT); + + return $this->_normalize(new Math_BigInteger($leading_ones | $temp, 256)); + } + + /** + * Logical Right Shift + * + * Shifts BigInteger's by $shift bits, effectively dividing by 2**$shift. + * + * @param int $shift + * @return Math_BigInteger + * @access public + * @internal The only version that yields any speed increases is the internal version. + */ + function bitwise_rightShift($shift) + { + $temp = new Math_BigInteger(); + + switch (MATH_BIGINTEGER_MODE) { + case MATH_BIGINTEGER_MODE_GMP: + static $two; + + if (!isset($two)) { + $two = gmp_init('2'); + } + + $temp->value = gmp_div_q($this->value, gmp_pow($two, $shift)); + + break; + case MATH_BIGINTEGER_MODE_BCMATH: + $temp->value = bcdiv($this->value, bcpow('2', $shift, 0), 0); + + break; + default: // could just replace _lshift with this, but then all _lshift() calls would need to be rewritten + // and I don't want to do that... + $temp->value = $this->value; + $temp->_rshift($shift); + } + + return $this->_normalize($temp); + } + + /** + * Logical Left Shift + * + * Shifts BigInteger's by $shift bits, effectively multiplying by 2**$shift. + * + * @param int $shift + * @return Math_BigInteger + * @access public + * @internal The only version that yields any speed increases is the internal version. + */ + function bitwise_leftShift($shift) + { + $temp = new Math_BigInteger(); + + switch (MATH_BIGINTEGER_MODE) { + case MATH_BIGINTEGER_MODE_GMP: + static $two; + + if (!isset($two)) { + $two = gmp_init('2'); + } + + $temp->value = gmp_mul($this->value, gmp_pow($two, $shift)); + + break; + case MATH_BIGINTEGER_MODE_BCMATH: + $temp->value = bcmul($this->value, bcpow('2', $shift, 0), 0); + + break; + default: // could just replace _rshift with this, but then all _lshift() calls would need to be rewritten + // and I don't want to do that... + $temp->value = $this->value; + $temp->_lshift($shift); + } + + return $this->_normalize($temp); + } + + /** + * Logical Left Rotate + * + * Instead of the top x bits being dropped they're appended to the shifted bit string. + * + * @param int $shift + * @return Math_BigInteger + * @access public + */ + function bitwise_leftRotate($shift) + { + $bits = $this->toBytes(); + + if ($this->precision > 0) { + $precision = $this->precision; + if (MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_BCMATH) { + $mask = $this->bitmask->subtract(new Math_BigInteger(1)); + $mask = $mask->toBytes(); + } else { + $mask = $this->bitmask->toBytes(); + } + } else { + $temp = ord($bits[0]); + for ($i = 0; $temp >> $i; ++$i) { + } + $precision = 8 * strlen($bits) - 8 + $i; + $mask = chr((1 << ($precision & 0x7)) - 1) . str_repeat(chr(0xFF), $precision >> 3); + } + + if ($shift < 0) { + $shift+= $precision; + } + $shift%= $precision; + + if (!$shift) { + return $this->copy(); + } + + $left = $this->bitwise_leftShift($shift); + $left = $left->bitwise_and(new Math_BigInteger($mask, 256)); + $right = $this->bitwise_rightShift($precision - $shift); + $result = MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_BCMATH ? $left->bitwise_or($right) : $left->add($right); + return $this->_normalize($result); + } + + /** + * Logical Right Rotate + * + * Instead of the bottom x bits being dropped they're prepended to the shifted bit string. + * + * @param int $shift + * @return Math_BigInteger + * @access public + */ + function bitwise_rightRotate($shift) + { + return $this->bitwise_leftRotate(-$shift); + } + + /** + * Set random number generator function + * + * This function is deprecated. + * + * @param string $generator + * @access public + */ + function setRandomGenerator($generator) + { + } + + /** + * Generates a random BigInteger + * + * Byte length is equal to $length. Uses crypt_random if it's loaded and mt_rand if it's not. + * + * @param int $length + * @return Math_BigInteger + * @access private + */ + function _random_number_helper($size) + { + if (function_exists('crypt_random_string')) { + $random = crypt_random_string($size); + } else { + $random = ''; + + if ($size & 1) { + $random.= chr(mt_rand(0, 255)); + } + + $blocks = $size >> 1; + for ($i = 0; $i < $blocks; ++$i) { + // mt_rand(-2147483648, 0x7FFFFFFF) always produces -2147483648 on some systems + $random.= pack('n', mt_rand(0, 0xFFFF)); + } + } + + return new Math_BigInteger($random, 256); + } + + /** + * Generate a random number + * + * Returns a random number between $min and $max where $min and $max + * can be defined using one of the two methods: + * + * $min->random($max) + * $max->random($min) + * + * @param Math_BigInteger $arg1 + * @param Math_BigInteger $arg2 + * @return Math_BigInteger + * @access public + * @internal The API for creating random numbers used to be $a->random($min, $max), where $a was a Math_BigInteger object. + * That method is still supported for BC purposes. + */ + function random($arg1, $arg2 = false) + { + if ($arg1 === false) { + return false; + } + + if ($arg2 === false) { + $max = $arg1; + $min = $this; + } else { + $min = $arg1; + $max = $arg2; + } + + $compare = $max->compare($min); + + if (!$compare) { + return $this->_normalize($min); + } elseif ($compare < 0) { + // if $min is bigger then $max, swap $min and $max + $temp = $max; + $max = $min; + $min = $temp; + } + + static $one; + if (!isset($one)) { + $one = new Math_BigInteger(1); + } + + $max = $max->subtract($min->subtract($one)); + $size = strlen(ltrim($max->toBytes(), chr(0))); + + /* + doing $random % $max doesn't work because some numbers will be more likely to occur than others. + eg. if $max is 140 and $random's max is 255 then that'd mean both $random = 5 and $random = 145 + would produce 5 whereas the only value of random that could produce 139 would be 139. ie. + not all numbers would be equally likely. some would be more likely than others. + + creating a whole new random number until you find one that is within the range doesn't work + because, for sufficiently small ranges, the likelihood that you'd get a number within that range + would be pretty small. eg. with $random's max being 255 and if your $max being 1 the probability + would be pretty high that $random would be greater than $max. + + phpseclib works around this using the technique described here: + + http://crypto.stackexchange.com/questions/5708/creating-a-small-number-from-a-cryptographically-secure-random-string + */ + $random_max = new Math_BigInteger(chr(1) . str_repeat("\0", $size), 256); + $random = $this->_random_number_helper($size); + + list($max_multiple) = $random_max->divide($max); + $max_multiple = $max_multiple->multiply($max); + + while ($random->compare($max_multiple) >= 0) { + $random = $random->subtract($max_multiple); + $random_max = $random_max->subtract($max_multiple); + $random = $random->bitwise_leftShift(8); + $random = $random->add($this->_random_number_helper(1)); + $random_max = $random_max->bitwise_leftShift(8); + list($max_multiple) = $random_max->divide($max); + $max_multiple = $max_multiple->multiply($max); + } + list(, $random) = $random->divide($max); + + return $this->_normalize($random->add($min)); + } + + /** + * Generate a random prime number. + * + * If there's not a prime within the given range, false will be returned. + * If more than $timeout seconds have elapsed, give up and return false. + * + * @param Math_BigInteger $arg1 + * @param Math_BigInteger $arg2 + * @param int $timeout + * @return Math_BigInteger|false + * @access public + * @internal See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap4.pdf#page=15 HAC 4.44}. + */ + function randomPrime($arg1, $arg2 = false, $timeout = false) + { + if ($arg1 === false) { + return false; + } + + if ($arg2 === false) { + $max = $arg1; + $min = $this; + } else { + $min = $arg1; + $max = $arg2; + } + + $compare = $max->compare($min); + + if (!$compare) { + return $min->isPrime() ? $min : false; + } elseif ($compare < 0) { + // if $min is bigger then $max, swap $min and $max + $temp = $max; + $max = $min; + $min = $temp; + } + + static $one, $two; + if (!isset($one)) { + $one = new Math_BigInteger(1); + $two = new Math_BigInteger(2); + } + + $start = time(); + + $x = $this->random($min, $max); + + // gmp_nextprime() requires PHP 5 >= 5.2.0 per . + if (MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_GMP && extension_loaded('gmp') && version_compare(PHP_VERSION, '5.2.0', '>=')) { + $p = new Math_BigInteger(); + $p->value = gmp_nextprime($x->value); + + if ($p->compare($max) <= 0) { + return $p; + } + + if (!$min->equals($x)) { + $x = $x->subtract($one); + } + + return $x->randomPrime($min, $x); + } + + if ($x->equals($two)) { + return $x; + } + + $x->_make_odd(); + if ($x->compare($max) > 0) { + // if $x > $max then $max is even and if $min == $max then no prime number exists between the specified range + if ($min->equals($max)) { + return false; + } + $x = $min->copy(); + $x->_make_odd(); + } + + $initial_x = $x->copy(); + + while (true) { + if ($timeout !== false && time() - $start > $timeout) { + return false; + } + + if ($x->isPrime()) { + return $x; + } + + $x = $x->add($two); + + if ($x->compare($max) > 0) { + $x = $min->copy(); + if ($x->equals($two)) { + return $x; + } + $x->_make_odd(); + } + + if ($x->equals($initial_x)) { + return false; + } + } + } + + /** + * Make the current number odd + * + * If the current number is odd it'll be unchanged. If it's even, one will be added to it. + * + * @see self::randomPrime() + * @access private + */ + function _make_odd() + { + switch (MATH_BIGINTEGER_MODE) { + case MATH_BIGINTEGER_MODE_GMP: + gmp_setbit($this->value, 0); + break; + case MATH_BIGINTEGER_MODE_BCMATH: + if ($this->value[strlen($this->value) - 1] % 2 == 0) { + $this->value = bcadd($this->value, '1'); + } + break; + default: + $this->value[0] |= 1; + } + } + + /** + * Checks a numer to see if it's prime + * + * Assuming the $t parameter is not set, this function has an error rate of 2**-80. The main motivation for the + * $t parameter is distributability. Math_BigInteger::randomPrime() can be distributed across multiple pageloads + * on a website instead of just one. + * + * @param Math_BigInteger $t + * @return bool + * @access public + * @internal Uses the + * {@link http://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test Miller-Rabin primality test}. See + * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap4.pdf#page=8 HAC 4.24}. + */ + function isPrime($t = false) + { + $length = strlen($this->toBytes()); + + if (!$t) { + // see HAC 4.49 "Note (controlling the error probability)" + // @codingStandardsIgnoreStart + if ($length >= 163) { $t = 2; } // floor(1300 / 8) + else if ($length >= 106) { $t = 3; } // floor( 850 / 8) + else if ($length >= 81 ) { $t = 4; } // floor( 650 / 8) + else if ($length >= 68 ) { $t = 5; } // floor( 550 / 8) + else if ($length >= 56 ) { $t = 6; } // floor( 450 / 8) + else if ($length >= 50 ) { $t = 7; } // floor( 400 / 8) + else if ($length >= 43 ) { $t = 8; } // floor( 350 / 8) + else if ($length >= 37 ) { $t = 9; } // floor( 300 / 8) + else if ($length >= 31 ) { $t = 12; } // floor( 250 / 8) + else if ($length >= 25 ) { $t = 15; } // floor( 200 / 8) + else if ($length >= 18 ) { $t = 18; } // floor( 150 / 8) + else { $t = 27; } + // @codingStandardsIgnoreEnd + } + + // ie. gmp_testbit($this, 0) + // ie. isEven() or !isOdd() + switch (MATH_BIGINTEGER_MODE) { + case MATH_BIGINTEGER_MODE_GMP: + return gmp_prob_prime($this->value, $t) != 0; + case MATH_BIGINTEGER_MODE_BCMATH: + if ($this->value === '2') { + return true; + } + if ($this->value[strlen($this->value) - 1] % 2 == 0) { + return false; + } + break; + default: + if ($this->value == array(2)) { + return true; + } + if (~$this->value[0] & 1) { + return false; + } + } + + static $primes, $zero, $one, $two; + + if (!isset($primes)) { + $primes = array( + 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, + 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, + 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, + 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, + 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, + 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, + 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, + 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, + 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, + 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, + 953, 967, 971, 977, 983, 991, 997 + ); + + if (MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_INTERNAL) { + for ($i = 0; $i < count($primes); ++$i) { + $primes[$i] = new Math_BigInteger($primes[$i]); + } + } + + $zero = new Math_BigInteger(); + $one = new Math_BigInteger(1); + $two = new Math_BigInteger(2); + } + + if ($this->equals($one)) { + return false; + } + + // see HAC 4.4.1 "Random search for probable primes" + if (MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_INTERNAL) { + foreach ($primes as $prime) { + list(, $r) = $this->divide($prime); + if ($r->equals($zero)) { + return $this->equals($prime); + } + } + } else { + $value = $this->value; + foreach ($primes as $prime) { + list(, $r) = $this->_divide_digit($value, $prime); + if (!$r) { + return count($value) == 1 && $value[0] == $prime; + } + } + } + + $n = $this->copy(); + $n_1 = $n->subtract($one); + $n_2 = $n->subtract($two); + + $r = $n_1->copy(); + $r_value = $r->value; + // ie. $s = gmp_scan1($n, 0) and $r = gmp_div_q($n, gmp_pow(gmp_init('2'), $s)); + if (MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_BCMATH) { + $s = 0; + // if $n was 1, $r would be 0 and this would be an infinite loop, hence our $this->equals($one) check earlier + while ($r->value[strlen($r->value) - 1] % 2 == 0) { + $r->value = bcdiv($r->value, '2', 0); + ++$s; + } + } else { + for ($i = 0, $r_length = count($r_value); $i < $r_length; ++$i) { + $temp = ~$r_value[$i] & 0xFFFFFF; + for ($j = 1; ($temp >> $j) & 1; ++$j) { + } + if ($j != 25) { + break; + } + } + $s = 26 * $i + $j - 1; + $r->_rshift($s); + } + + for ($i = 0; $i < $t; ++$i) { + $a = $this->random($two, $n_2); + $y = $a->modPow($r, $n); + + if (!$y->equals($one) && !$y->equals($n_1)) { + for ($j = 1; $j < $s && !$y->equals($n_1); ++$j) { + $y = $y->modPow($two, $n); + if ($y->equals($one)) { + return false; + } + } + + if (!$y->equals($n_1)) { + return false; + } + } + } + return true; + } + + /** + * Logical Left Shift + * + * Shifts BigInteger's by $shift bits. + * + * @param int $shift + * @access private + */ + function _lshift($shift) + { + if ($shift == 0) { + return; + } + + $num_digits = (int) ($shift / MATH_BIGINTEGER_BASE); + $shift %= MATH_BIGINTEGER_BASE; + $shift = 1 << $shift; + + $carry = 0; + + for ($i = 0; $i < count($this->value); ++$i) { + $temp = $this->value[$i] * $shift + $carry; + $carry = MATH_BIGINTEGER_BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31); + $this->value[$i] = (int) ($temp - $carry * MATH_BIGINTEGER_BASE_FULL); + } + + if ($carry) { + $this->value[count($this->value)] = $carry; + } + + while ($num_digits--) { + array_unshift($this->value, 0); + } + } + + /** + * Logical Right Shift + * + * Shifts BigInteger's by $shift bits. + * + * @param int $shift + * @access private + */ + function _rshift($shift) + { + if ($shift == 0) { + return; + } + + $num_digits = (int) ($shift / MATH_BIGINTEGER_BASE); + $shift %= MATH_BIGINTEGER_BASE; + $carry_shift = MATH_BIGINTEGER_BASE - $shift; + $carry_mask = (1 << $shift) - 1; + + if ($num_digits) { + $this->value = array_slice($this->value, $num_digits); + } + + $carry = 0; + + for ($i = count($this->value) - 1; $i >= 0; --$i) { + $temp = $this->value[$i] >> $shift | $carry; + $carry = ($this->value[$i] & $carry_mask) << $carry_shift; + $this->value[$i] = $temp; + } + + $this->value = $this->_trim($this->value); + } + + /** + * Normalize + * + * Removes leading zeros and truncates (if necessary) to maintain the appropriate precision + * + * @param Math_BigInteger + * @return Math_BigInteger + * @see self::_trim() + * @access private + */ + function _normalize($result) + { + $result->precision = $this->precision; + $result->bitmask = $this->bitmask; + + switch (MATH_BIGINTEGER_MODE) { + case MATH_BIGINTEGER_MODE_GMP: + if ($this->bitmask !== false) { + $result->value = gmp_and($result->value, $result->bitmask->value); + } + + return $result; + case MATH_BIGINTEGER_MODE_BCMATH: + if (!empty($result->bitmask->value)) { + $result->value = bcmod($result->value, $result->bitmask->value); + } + + return $result; + } + + $value = &$result->value; + + if (!count($value)) { + return $result; + } + + $value = $this->_trim($value); + + if (!empty($result->bitmask->value)) { + $length = min(count($value), count($this->bitmask->value)); + $value = array_slice($value, 0, $length); + + for ($i = 0; $i < $length; ++$i) { + $value[$i] = $value[$i] & $this->bitmask->value[$i]; + } + } + + return $result; + } + + /** + * Trim + * + * Removes leading zeros + * + * @param array $value + * @return Math_BigInteger + * @access private + */ + function _trim($value) + { + for ($i = count($value) - 1; $i >= 0; --$i) { + if ($value[$i]) { + break; + } + unset($value[$i]); + } + + return $value; + } + + /** + * Array Repeat + * + * @param $input Array + * @param $multiplier mixed + * @return array + * @access private + */ + function _array_repeat($input, $multiplier) + { + return ($multiplier) ? array_fill(0, $multiplier, $input) : array(); + } + + /** + * Logical Left Shift + * + * Shifts binary strings $shift bits, essentially multiplying by 2**$shift. + * + * @param $x String + * @param $shift Integer + * @return string + * @access private + */ + function _base256_lshift(&$x, $shift) + { + if ($shift == 0) { + return; + } + + $num_bytes = $shift >> 3; // eg. floor($shift/8) + $shift &= 7; // eg. $shift % 8 + + $carry = 0; + for ($i = strlen($x) - 1; $i >= 0; --$i) { + $temp = ord($x[$i]) << $shift | $carry; + $x[$i] = chr($temp); + $carry = $temp >> 8; + } + $carry = ($carry != 0) ? chr($carry) : ''; + $x = $carry . $x . str_repeat(chr(0), $num_bytes); + } + + /** + * Logical Right Shift + * + * Shifts binary strings $shift bits, essentially dividing by 2**$shift and returning the remainder. + * + * @param $x String + * @param $shift Integer + * @return string + * @access private + */ + function _base256_rshift(&$x, $shift) + { + if ($shift == 0) { + $x = ltrim($x, chr(0)); + return ''; + } + + $num_bytes = $shift >> 3; // eg. floor($shift/8) + $shift &= 7; // eg. $shift % 8 + + $remainder = ''; + if ($num_bytes) { + $start = $num_bytes > strlen($x) ? -strlen($x) : -$num_bytes; + $remainder = substr($x, $start); + $x = substr($x, 0, -$num_bytes); + } + + $carry = 0; + $carry_shift = 8 - $shift; + for ($i = 0; $i < strlen($x); ++$i) { + $temp = (ord($x[$i]) >> $shift) | $carry; + $carry = (ord($x[$i]) << $carry_shift) & 0xFF; + $x[$i] = chr($temp); + } + $x = ltrim($x, chr(0)); + + $remainder = chr($carry >> $carry_shift) . $remainder; + + return ltrim($remainder, chr(0)); + } + + // one quirk about how the following functions are implemented is that PHP defines N to be an unsigned long + // at 32-bits, while java's longs are 64-bits. + + /** + * Converts 32-bit integers to bytes. + * + * @param int $x + * @return string + * @access private + */ + function _int2bytes($x) + { + return ltrim(pack('N', $x), chr(0)); + } + + /** + * Converts bytes to 32-bit integers + * + * @param string $x + * @return int + * @access private + */ + function _bytes2int($x) + { + $temp = unpack('Nint', str_pad($x, 4, chr(0), STR_PAD_LEFT)); + return $temp['int']; + } + + /** + * DER-encode an integer + * + * The ability to DER-encode integers is needed to create RSA public keys for use with OpenSSL + * + * @see self::modPow() + * @access private + * @param int $length + * @return string + */ + function _encodeASN1Length($length) + { + if ($length <= 0x7F) { + return chr($length); + } + + $temp = ltrim(pack('N', $length), chr(0)); + return pack('Ca*', 0x80 | strlen($temp), $temp); + } + + /** + * Single digit division + * + * Even if int64 is being used the division operator will return a float64 value + * if the dividend is not evenly divisible by the divisor. Since a float64 doesn't + * have the precision of int64 this is a problem so, when int64 is being used, + * we'll guarantee that the dividend is divisible by first subtracting the remainder. + * + * @access private + * @param int $x + * @param int $y + * @return int + */ + function _safe_divide($x, $y) + { + if (MATH_BIGINTEGER_BASE === 26) { + return (int) ($x / $y); + } + + // MATH_BIGINTEGER_BASE === 31 + return ($x - ($x % $y)) / $y; + } + } +} diff --git a/lib/vendor/servmask/archiver/class-ai1wm-archiver.php b/lib/vendor/servmask/archiver/class-ai1wm-archiver.php new file mode 100644 index 0000000..0415448 --- /dev/null +++ b/lib/vendor/servmask/archiver/class-ai1wm-archiver.php @@ -0,0 +1,243 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +abstract class Ai1wm_Archiver { + + /** + * Filename including path to the file + * + * @type string + */ + protected $file_name = null; + + /** + * Handle to the file + * + * @type resource + */ + protected $file_handle = null; + + /** + * Header block format of a file + * + * Field Name Offset Length Contents + * name 0 255 filename (no path, no slash) + * size 255 14 size of file contents + * mtime 269 12 last modification time + * prefix 281 4096 path name, no trailing slashes + * + * @type array + */ + protected $block_format = array( + 'a255', // filename + 'a14', // size of file contents + 'a12', // last time modified + 'a4096', // path + ); + + /** + * End of file block string + * + * @type string + */ + protected $eof = null; + + /** + * Default constructor + * + * Initializes filename and end of file block + * + * @param string $file_name Archive file + * @param bool $write Read/write mode + */ + public function __construct( $file_name, $write = false ) { + $this->file_name = $file_name; + + // Initialize end of file block + $this->eof = pack( 'a4377', '' ); + + // Open archive file + if ( $write ) { + // Open archive file for writing + if ( ( $this->file_handle = @fopen( $file_name, 'cb' ) ) === false ) { + throw new Ai1wm_Not_Accessible_Exception( sprintf( 'Unable to open file for writing. File: %s', $this->file_name ) ); + } + + // Seek to end of archive file + if ( @fseek( $this->file_handle, 0, SEEK_END ) === -1 ) { + throw new Ai1wm_Not_Seekable_Exception( sprintf( 'Unable to seek to end of file. File: %s', $this->file_name ) ); + } + } else { + // Open archive file for reading + if ( ( $this->file_handle = @fopen( $file_name, 'rb' ) ) === false ) { + throw new Ai1wm_Not_Accessible_Exception( sprintf( 'Unable to open file for reading. File: %s', $this->file_name ) ); + } + } + } + + /** + * Set current file pointer + * + * @param int $offset Archive offset + * + * @throws \Ai1wm_Not_Seekable_Exception + * + * @return void + */ + public function set_file_pointer( $offset ) { + if ( @fseek( $this->file_handle, $offset, SEEK_SET ) === -1 ) { + throw new Ai1wm_Not_Seekable_Exception( sprintf( 'Unable to seek to offset of file. File: %s Offset: %d', $this->file_name, $offset ) ); + } + } + + /** + * Get current file pointer + * + * @throws \Ai1wm_Not_Tellable_Exception + * + * @return int + */ + public function get_file_pointer() { + if ( ( $offset = @ftell( $this->file_handle ) ) === false ) { + throw new Ai1wm_Not_Tellable_Exception( sprintf( 'Unable to tell offset of file. File: %s', $this->file_name ) ); + } + + return $offset; + } + + /** + * Appends end of file block to the archive file + * + * @throws \Ai1wm_Not_Seekable_Exception + * @throws \Ai1wm_Not_Writable_Exception + * @throws \Ai1wm_Quota_Exceeded_Exception + * + * @return void + */ + protected function append_eof() { + // Seek to end of archive file + if ( @fseek( $this->file_handle, 0, SEEK_END ) === -1 ) { + throw new Ai1wm_Not_Seekable_Exception( sprintf( 'Unable to seek to end of file. File: %s', $this->file_name ) ); + } + + // Write end of file block + if ( ( $file_bytes = @fwrite( $this->file_handle, $this->eof ) ) !== false ) { + if ( strlen( $this->eof ) !== $file_bytes ) { + throw new Ai1wm_Quota_Exceeded_Exception( sprintf( 'Out of disk space. Unable to write end of block to file. File: %s', $this->file_name ) ); + } + } else { + throw new Ai1wm_Not_Writable_Exception( sprintf( 'Unable to write end of block to file. File: %s', $this->file_name ) ); + } + } + + /** + * Replace forward slash with current directory separator + * + * @param string $path Path + * + * @return string + */ + protected function replace_forward_slash_with_directory_separator( $path ) { + return str_replace( '/', DIRECTORY_SEPARATOR, $path ); + } + + /** + * Replace current directory separator with forward slash + * + * @param string $path Path + * + * @return string + */ + protected function replace_directory_separator_with_forward_slash( $path ) { + return str_replace( DIRECTORY_SEPARATOR, '/', $path ); + } + + /** + * Escape Windows directory separator + * + * @param string $path Path + * + * @return string + */ + protected function escape_windows_directory_separator( $path ) { + return preg_replace( '/[\\\\]+/', '\\\\\\\\', $path ); + } + + /** + * Validate archive file + * + * @return bool + */ + public function is_valid() { + if ( ( $offset = @ftell( $this->file_handle ) ) !== false ) { + if ( @fseek( $this->file_handle, -4377, SEEK_END ) !== -1 ) { + if ( @fread( $this->file_handle, 4377 ) === $this->eof ) { + if ( @fseek( $this->file_handle, $offset, SEEK_SET ) !== -1 ) { + return true; + } + } + } + } + + return false; + } + + /** + * Truncates the archive file + * + * @return void + */ + public function truncate() { + if ( ( $offset = @ftell( $this->file_handle ) ) === false ) { + throw new Ai1wm_Not_Tellable_Exception( sprintf( 'Unable to tell offset of file. File: %s', $this->file_name ) ); + } + + if ( @filesize( $this->file_name ) > $offset ) { + if ( @ftruncate( $this->file_handle, $offset ) === false ) { + throw new Ai1wm_Not_Truncatable_Exception( sprintf( 'Unable to truncate file. File: %s', $this->file_name ) ); + } + } + } + + /** + * Closes the archive file + * + * We either close the file or append the end of file block if complete argument is set to true + * + * @param bool $complete Flag to append end of file block + * + * @return void + */ + public function close( $complete = false ) { + // Are we done appending to the file? + if ( true === $complete ) { + $this->append_eof(); + } + + if ( @fclose( $this->file_handle ) === false ) { + throw new Ai1wm_Not_Closable_Exception( sprintf( 'Unable to close file. File: %s', $this->file_name ) ); + } + } +} diff --git a/lib/vendor/servmask/archiver/class-ai1wm-compressor.php b/lib/vendor/servmask/archiver/class-ai1wm-compressor.php new file mode 100644 index 0000000..05c411f --- /dev/null +++ b/lib/vendor/servmask/archiver/class-ai1wm-compressor.php @@ -0,0 +1,215 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Compressor extends Ai1wm_Archiver { + + /** + * Overloaded constructor that opens the passed file for writing + * + * @param string $file_name File to use as archive + */ + public function __construct( $file_name ) { + // Call parent, to initialize variables + parent::__construct( $file_name, true ); + } + + /** + * Add a file to the archive + * + * @param string $file_name File to add to the archive + * @param string $new_file_name Write the file with a different name + * @param int $file_written File written (in bytes) + * @param int $file_offset File offset (in bytes) + * + * @throws \Ai1wm_Not_Seekable_Exception + * @throws \Ai1wm_Not_Writable_Exception + * @throws \Ai1wm_Quota_Exceeded_Exception + * + * @return bool + */ + public function add_file( $file_name, $new_file_name = '', &$file_written = 0, &$file_offset = 0 ) { + $file_written = 0; + + // Replace forward slash with current directory separator in file name + $file_name = $this->replace_forward_slash_with_directory_separator( $file_name ); + + // Escape Windows directory separator in file name + $file_name = $this->escape_windows_directory_separator( $file_name ); + + // Flag to hold if file data has been processed + $completed = true; + + // Start time + $start = microtime( true ); + + // Open the file for reading in binary mode + if ( ( $file_handle = @fopen( $file_name, 'rb' ) ) !== false ) { + $file_bytes = 0; + + // Get header block + if ( ( $block = $this->get_file_block( $file_name, $new_file_name ) ) ) { + + // Write header block + if ( $file_offset === 0 ) { + if ( ( $file_bytes = @fwrite( $this->file_handle, $block ) ) !== false ) { + if ( strlen( $block ) !== $file_bytes ) { + throw new Ai1wm_Quota_Exceeded_Exception( sprintf( 'Out of disk space. Unable to write header to file. File: %s', $this->file_name ) ); + } + } else { + throw new Ai1wm_Not_Writable_Exception( sprintf( 'Unable to write header to file. File: %s', $this->file_name ) ); + } + } + + // Set file offset + if ( @fseek( $file_handle, $file_offset, SEEK_SET ) !== -1 ) { + + // Read the file in 512KB chunks + while ( false === @feof( $file_handle ) ) { + + // Read the file in chunks of 512KB + if ( ( $file_content = @fread( $file_handle, 512000 ) ) !== false ) { + if ( ( $file_bytes = @fwrite( $this->file_handle, $file_content ) ) !== false ) { + if ( strlen( $file_content ) !== $file_bytes ) { + throw new Ai1wm_Quota_Exceeded_Exception( sprintf( 'Out of disk space. Unable to write content to file. File: %s', $this->file_name ) ); + } + } else { + throw new Ai1wm_Not_Writable_Exception( sprintf( 'Unable to write content to file. File: %s', $this->file_name ) ); + } + + // Set file written + $file_written += $file_bytes; + } + + // Time elapsed + if ( ( $timeout = apply_filters( 'ai1wm_completed_timeout', 10 ) ) ) { + if ( ( microtime( true ) - $start ) > $timeout ) { + $completed = false; + break; + } + } + } + } + + // Set file offset + $file_offset += $file_written; + + // Write file size to file header + if ( ( $block = $this->get_file_size_block( $file_offset ) ) ) { + + // Seek to beginning of file size + if ( @fseek( $this->file_handle, - $file_offset - 4096 - 12 - 14, SEEK_CUR ) === -1 ) { + throw new Ai1wm_Not_Seekable_Exception( + 'Your PHP is 32-bit. In order to export your file, please change your PHP version to 64-bit and try again. ' . + 'Technical details' + ); + } + + // Write file size to file header + if ( ( $file_bytes = @fwrite( $this->file_handle, $block ) ) !== false ) { + if ( strlen( $block ) !== $file_bytes ) { + throw new Ai1wm_Quota_Exceeded_Exception( sprintf( 'Out of disk space. Unable to write size to file. File: %s', $this->file_name ) ); + } + } else { + throw new Ai1wm_Not_Writable_Exception( sprintf( 'Unable to write size to file. File: %s', $this->file_name ) ); + } + + // Seek to end of file content + if ( @fseek( $this->file_handle, + $file_offset + 4096 + 12, SEEK_CUR ) === -1 ) { + throw new Ai1wm_Not_Seekable_Exception( + 'Your PHP is 32-bit. In order to export your file, please change your PHP version to 64-bit and try again. ' . + 'Technical details' + ); + } + } + } + + // Close the handle + @fclose( $file_handle ); + } + + return $completed; + } + + /** + * Generate binary block header for a file + * + * @param string $file_name Filename to generate block header for + * @param string $new_file_name Write the file with a different name + * + * @return mixed + */ + private function get_file_block( $file_name, $new_file_name = '' ) { + $block = false; + + // Get stats about the file + if ( ( $stat = @stat( $file_name ) ) !== false ) { + + // Get path details + if ( empty( $new_file_name ) ) { + $pathinfo = pathinfo( $file_name ); + } else { + $pathinfo = pathinfo( $new_file_name ); + } + + // Filename of the file we are accessing + $name = $pathinfo['basename']; + + // Size in bytes of the file + $size = $stat['size']; + + // Last time the file was modified + $date = $stat['mtime']; + + // Replace current directory separator with backward slash in file path + $path = $this->replace_directory_separator_with_forward_slash( $pathinfo['dirname'] ); + + // Concatenate block format parts + $format = implode( '', $this->block_format ); + + // Pack file data into binary string + $block = pack( $format, $name, $size, $date, $path ); + } + + return $block; + } + + /** + * Generate file size binary block header for a file + * + * @param int $file_size File size + * + * @return string + */ + public function get_file_size_block( $file_size ) { + $block = false; + + // Pack file data into binary string + if ( isset( $this->block_format[1] ) ) { + $block = pack( $this->block_format[1], $file_size ); + } + + return $block; + } +} diff --git a/lib/vendor/servmask/archiver/class-ai1wm-extractor.php b/lib/vendor/servmask/archiver/class-ai1wm-extractor.php new file mode 100644 index 0000000..b8151cb --- /dev/null +++ b/lib/vendor/servmask/archiver/class-ai1wm-extractor.php @@ -0,0 +1,575 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Extractor extends Ai1wm_Archiver { + + /** + * Total files count + * + * @type int + */ + protected $total_files_count = null; + + /** + * Total files size + * + * @type int + */ + protected $total_files_size = null; + + /** + * Overloaded constructor that opens the passed file for reading + * + * @param string $file_name File to use as archive + */ + public function __construct( $file_name ) { + // Call parent, to initialize variables + parent::__construct( $file_name ); + } + + /** + * Get the total files count in an archive + * + * @return int + */ + public function get_total_files_count() { + if ( is_null( $this->total_files_count ) ) { + + // Total files count + $this->total_files_count = 0; + + // Total files size + $this->total_files_size = 0; + + // Seek to beginning of archive file + if ( @fseek( $this->file_handle, 0, SEEK_SET ) === -1 ) { + throw new Ai1wm_Not_Seekable_Exception( sprintf( 'Unable to seek to beginning of file. File: %s', $this->file_name ) ); + } + + // Loop over files + while ( $block = @fread( $this->file_handle, 4377 ) ) { + + // End block has been reached + if ( $block === $this->eof ) { + continue; + } + + // Get file data from the block + if ( ( $data = $this->get_data_from_block( $block ) ) ) { + + // We have a file, increment the count + $this->total_files_count += 1; + + // We have a file, increment the size + $this->total_files_size += $data['size']; + + // Skip file content so we can move forward to the next file + if ( @fseek( $this->file_handle, $data['size'], SEEK_CUR ) === -1 ) { + throw new Ai1wm_Not_Seekable_Exception( sprintf( 'Unable to seek to offset of file. File: %s Offset: %d', $this->file_name, $data['size'] ) ); + } + } + } + } + + return $this->total_files_count; + } + + /** + * Get the total files size in an archive + * + * @return int + */ + public function get_total_files_size() { + if ( is_null( $this->total_files_size ) ) { + + // Total files count + $this->total_files_count = 0; + + // Total files size + $this->total_files_size = 0; + + // Seek to beginning of archive file + if ( @fseek( $this->file_handle, 0, SEEK_SET ) === -1 ) { + throw new Ai1wm_Not_Seekable_Exception( sprintf( 'Unable to seek to beginning of file. File: %s', $this->file_name ) ); + } + + // Loop over files + while ( $block = @fread( $this->file_handle, 4377 ) ) { + + // End block has been reached + if ( $block === $this->eof ) { + continue; + } + + // Get file data from the block + if ( ( $data = $this->get_data_from_block( $block ) ) ) { + + // We have a file, increment the count + $this->total_files_count += 1; + + // We have a file, increment the size + $this->total_files_size += $data['size']; + + // Skip file content so we can move forward to the next file + if ( @fseek( $this->file_handle, $data['size'], SEEK_CUR ) === -1 ) { + throw new Ai1wm_Not_Seekable_Exception( sprintf( 'Unable to seek to offset of file. File: %s Offset: %d', $this->file_name, $data['size'] ) ); + } + } + } + } + + return $this->total_files_size; + } + + /** + * Extract one file to location + * + * @param string $location Destination path + * @param array $exclude Files to exclude + * @param array $old_paths Old replace paths + * @param array $new_paths New replace paths + * @param int $file_written File written (in bytes) + * @param int $file_offset File offset (in bytes) + * + * @throws \Ai1wm_Not_Directory_Exception + * @throws \Ai1wm_Not_Seekable_Exception + * + * @return bool + */ + public function extract_one_file_to( $location, $exclude = array(), $old_paths = array(), $new_paths = array(), &$file_written = 0, &$file_offset = 0 ) { + if ( false === is_dir( $location ) ) { + throw new Ai1wm_Not_Directory_Exception( sprintf( 'Location is not a directory: %s', $location ) ); + } + + // Replace forward slash with current directory separator in location + $location = $this->replace_forward_slash_with_directory_separator( $location ); + + // Flag to hold if file data has been processed + $completed = true; + + // Seek to file offset to archive file + if ( $file_offset > 0 ) { + if ( @fseek( $this->file_handle, - $file_offset - 4377, SEEK_CUR ) === -1 ) { + throw new Ai1wm_Not_Seekable_Exception( sprintf( 'Unable to seek to offset of file. File: %s Offset: %d', $this->file_name, - $file_offset - 4377 ) ); + } + } + + // Read file header block + if ( ( $block = @fread( $this->file_handle, 4377 ) ) ) { + + // We reached end of file, set the pointer to the end of the file so that feof returns true + if ( $block === $this->eof ) { + + // Seek to end of archive file minus 1 byte + @fseek( $this->file_handle, 1, SEEK_END ); + + // Read 1 character + @fgetc( $this->file_handle ); + + } else { + + // Get file header data from the block + if ( ( $data = $this->get_data_from_block( $block ) ) ) { + + // Set file name + $file_name = $data['filename']; + + // Set file size + $file_size = $data['size']; + + // Set file mtime + $file_mtime = $data['mtime']; + + // Set file path + $file_path = $data['path']; + + // Set should exclude file + $should_exclude_file = false; + + // Should we skip this file? + for ( $i = 0; $i < count( $exclude ); $i++ ) { + if ( strpos( $file_name . DIRECTORY_SEPARATOR, $exclude[ $i ] . DIRECTORY_SEPARATOR ) === 0 ) { + $should_exclude_file = true; + break; + } + } + + // Do we have a match? + if ( $should_exclude_file === false ) { + + // Replace extract paths + for ( $i = 0; $i < count( $old_paths ); $i++ ) { + if ( strpos( $file_path . DIRECTORY_SEPARATOR, $old_paths[ $i ] . DIRECTORY_SEPARATOR ) === 0 ) { + $file_name = substr_replace( $file_name, $new_paths[ $i ], 0, strlen( $old_paths[ $i ] ) ); + $file_path = substr_replace( $file_path, $new_paths[ $i ], 0, strlen( $old_paths[ $i ] ) ); + break; + } + } + + // Escape Windows directory separator in file path + $file_path = $this->escape_windows_directory_separator( $location . DIRECTORY_SEPARATOR . $file_path ); + + // Escape Windows directory separator in file name + $file_name = $this->escape_windows_directory_separator( $location . DIRECTORY_SEPARATOR . $file_name ); + + // Check if location doesn't exist, then create it + if ( false === is_dir( $file_path ) ) { + @mkdir( $file_path, $this->get_permissions_for_directory(), true ); + } + + $file_written = 0; + + // We have a match, let's extract the file + if ( ( $completed = $this->extract_to( $file_name, $file_size, $file_mtime, $file_written, $file_offset ) ) ) { + $file_offset = 0; + } + } else { + + // We don't have a match, skip file content + if ( @fseek( $this->file_handle, $file_size, SEEK_CUR ) === -1 ) { + throw new Ai1wm_Not_Seekable_Exception( sprintf( 'Unable to seek to offset of file. File: %s Offset: %d', $this->file_name, $file_size ) ); + } + } + } + } + } + + return $completed; + } + + /** + * Extract specific files from archive + * + * @param string $location Location where to extract files + * @param array $files Files to extract + * @param array $exclude Files to exclude + * @param int $file_written File written (in bytes) + * @param int $file_offset File offset (in bytes) + * + * @throws \Ai1wm_Not_Directory_Exception + * @throws \Ai1wm_Not_Seekable_Exception + * + * @return bool + */ + public function extract_by_files_array( $location, $files = array(), $exclude = array(), &$file_written = 0, &$file_offset = 0 ) { + if ( false === is_dir( $location ) ) { + throw new Ai1wm_Not_Directory_Exception( sprintf( 'Location is not a directory: %s', $location ) ); + } + + // Replace forward slash with current directory separator in location + $location = $this->replace_forward_slash_with_directory_separator( $location ); + + // Flag to hold if file data has been processed + $completed = true; + + // Start time + $start = microtime( true ); + + // Seek to file offset to archive file + if ( $file_offset > 0 ) { + if ( @fseek( $this->file_handle, - $file_offset - 4377, SEEK_CUR ) === -1 ) { + throw new Ai1wm_Not_Seekable_Exception( sprintf( 'Unable to seek to offset of file. File: %s Offset: %d', $this->file_name, - $file_offset - 4377 ) ); + } + } + + // We read until we reached the end of the file, or the files we were looking for were found + while ( ( $block = @fread( $this->file_handle, 4377 ) ) ) { + + // We reached end of file, set the pointer to the end of the file so that feof returns true + if ( $block === $this->eof ) { + + // Seek to end of archive file minus 1 byte + @fseek( $this->file_handle, 1, SEEK_END ); + + // Read 1 character + @fgetc( $this->file_handle ); + + } else { + + // Get file header data from the block + if ( ( $data = $this->get_data_from_block( $block ) ) ) { + + // Set file name + $file_name = $data['filename']; + + // Set file size + $file_size = $data['size']; + + // Set file mtime + $file_mtime = $data['mtime']; + + // Set file path + $file_path = $data['path']; + + // Set should include file + $should_include_file = false; + + // Should we extract this file? + for ( $i = 0; $i < count( $files ); $i++ ) { + if ( strpos( $file_name . DIRECTORY_SEPARATOR, $files[ $i ] . DIRECTORY_SEPARATOR ) === 0 ) { + $should_include_file = true; + break; + } + } + + // Should we skip this file? + for ( $i = 0; $i < count( $exclude ); $i++ ) { + if ( strpos( $file_name . DIRECTORY_SEPARATOR, $exclude[ $i ] . DIRECTORY_SEPARATOR ) === 0 ) { + $should_include_file = false; + break; + } + } + + // Do we have a match? + if ( $should_include_file === true ) { + + // Escape Windows directory separator in file path + $file_path = $this->escape_windows_directory_separator( $location . DIRECTORY_SEPARATOR . $file_path ); + + // Escape Windows directory separator in file name + $file_name = $this->escape_windows_directory_separator( $location . DIRECTORY_SEPARATOR . $file_name ); + + // Check if location doesn't exist, then create it + if ( false === is_dir( $file_path ) ) { + @mkdir( $file_path, $this->get_permissions_for_directory(), true ); + } + + $file_written = 0; + + // We have a match, let's extract the file and remove it from the array + if ( ( $completed = $this->extract_to( $file_name, $file_size, $file_mtime, $file_written, $file_offset ) ) ) { + $file_offset = 0; + } + } else { + + // We don't have a match, skip file content + if ( @fseek( $this->file_handle, $file_size, SEEK_CUR ) === -1 ) { + throw new Ai1wm_Not_Seekable_Exception( sprintf( 'Unable to seek to offset of file. File: %s Offset: %d', $this->file_name, $file_size ) ); + } + } + + // Time elapsed + if ( ( $timeout = apply_filters( 'ai1wm_completed_timeout', 10 ) ) ) { + if ( ( microtime( true ) - $start ) > $timeout ) { + $completed = false; + break; + } + } + } + } + } + + return $completed; + } + + /** + * Extract file to + * + * @param string $file_name File name + * @param array $file_size File size (in bytes) + * @param array $file_mtime File modified time (in seconds) + * @param int $file_written File written (in bytes) + * @param int $file_offset File offset (in bytes) + * + * @throws \Ai1wm_Not_Seekable_Exception + * @throws \Ai1wm_Not_Readable_Exception + * @throws \Ai1wm_Quota_Exceeded_Exception + * + * @return bool + */ + private function extract_to( $file_name, $file_size, $file_mtime, &$file_written = 0, &$file_offset = 0 ) { + $file_written = 0; + + // Flag to hold if file data has been processed + $completed = true; + + // Start time + $start = microtime( true ); + + // Seek to file offset to archive file + if ( $file_offset > 0 ) { + if ( @fseek( $this->file_handle, $file_offset, SEEK_CUR ) === -1 ) { + throw new Ai1wm_Not_Seekable_Exception( sprintf( 'Unable to seek to offset of file. File: %s Offset: %d', $this->file_name, $file_size ) ); + } + } + + // Set file size + $file_size -= $file_offset; + + // Should the extract overwrite the file if it exists? + if ( ( $file_handle = @fopen( $file_name, ( $file_offset === 0 ? 'wb' : 'ab' ) ) ) !== false ) { + $file_bytes = 0; + + // Is the filesize more than 0 bytes? + while ( $file_size > 0 ) { + + // Read the file in chunks of 512KB + $chunk_size = $file_size > 512000 ? 512000 : $file_size; + + // Read data chunk by chunk from archive file + if ( $chunk_size > 0 ) { + $file_content = null; + + // Read the file in chunks of 512KB from archiver + if ( ( $file_content = @fread( $this->file_handle, $chunk_size ) ) === false ) { + throw new Ai1wm_Not_Readable_Exception( sprintf( 'Unable to read content from file. File: %s', $this->file_name ) ); + } + + // Remove the amount of bytes we read + $file_size -= $chunk_size; + + // Write file contents + if ( ( $file_bytes = @fwrite( $file_handle, $file_content ) ) !== false ) { + if ( strlen( $file_content ) !== $file_bytes ) { + throw new Ai1wm_Quota_Exceeded_Exception( sprintf( 'Out of disk space. Unable to write content to file. File: %s', $file_name ) ); + } + } + + // Set file written + $file_written += $chunk_size; + } + + // Time elapsed + if ( ( $timeout = apply_filters( 'ai1wm_completed_timeout', 10 ) ) ) { + if ( ( microtime( true ) - $start ) > $timeout ) { + $completed = false; + break; + } + } + } + + // Set file offset + $file_offset += $file_written; + + // Close the handle + @fclose( $file_handle ); + + // Let's apply last modified date + @touch( $file_name, $file_mtime ); + + // All files should chmoded to 644 + @chmod( $file_name, $this->get_permissions_for_file() ); + + } else { + + // We don't have file permissions, skip file content + if ( @fseek( $this->file_handle, $file_size, SEEK_CUR ) === -1 ) { + throw new Ai1wm_Not_Seekable_Exception( sprintf( 'Unable to seek to offset of file. File: %s Offset: %d', $this->file_name, $file_size ) ); + } + } + + return $completed; + } + + /** + * Get file header data from the block + * + * @param string $block Binary file header + * + * @return array + */ + private function get_data_from_block( $block ) { + $data = false; + + // prepare our array keys to unpack + $format = array( + $this->block_format[0] . 'filename/', + $this->block_format[1] . 'size/', + $this->block_format[2] . 'mtime/', + $this->block_format[3] . 'path', + ); + $format = implode( '', $format ); + + // Unpack file header data + if ( ( $data = unpack( $format, $block ) ) ) { + + // Set file details + $data['filename'] = trim( $data['filename'] ); + $data['size'] = trim( $data['size'] ); + $data['mtime'] = trim( $data['mtime'] ); + $data['path'] = trim( $data['path'] ); + + // Set file name + $data['filename'] = ( $data['path'] === '.' ? $data['filename'] : $data['path'] . DIRECTORY_SEPARATOR . $data['filename'] ); + + // Set file path + $data['path'] = ( $data['path'] === '.' ? '' : $data['path'] ); + + // Replace forward slash with current directory separator in file name + $data['filename'] = $this->replace_forward_slash_with_directory_separator( $data['filename'] ); + + // Replace forward slash with current directory separator in file path + $data['path'] = $this->replace_forward_slash_with_directory_separator( $data['path'] ); + } + + return $data; + } + + /** + * Check if file has reached end of file + * Returns true if file has reached eof, false otherwise + * + * @return bool + */ + public function has_reached_eof() { + return @feof( $this->file_handle ); + } + + /** + * Check if file has reached end of file + * Returns true if file has NOT reached eof, false otherwise + * + * @return bool + */ + public function has_not_reached_eof() { + return ! @feof( $this->file_handle ); + } + + /** + * Get directory permissions + * + * @return int + */ + public function get_permissions_for_directory() { + if ( defined( 'FS_CHMOD_DIR' ) ) { + return FS_CHMOD_DIR; + } + + return 0755; + } + + /** + * Get file permissions + * + * @return int + */ + public function get_permissions_for_file() { + if ( defined( 'FS_CHMOD_FILE' ) ) { + return FS_CHMOD_FILE; + } + + return 0644; + } +} diff --git a/lib/vendor/servmask/command/class-ai1wm-wp-cli-command.php b/lib/vendor/servmask/command/class-ai1wm-wp-cli-command.php new file mode 100644 index 0000000..e32b3e1 --- /dev/null +++ b/lib/vendor/servmask/command/class-ai1wm-wp-cli-command.php @@ -0,0 +1,278 @@ +. + */ + +if ( class_exists( 'WP_CLI_Command' ) ) { + class Ai1wm_WP_CLI_Command extends WP_CLI_Command { + /** + * Creates a new backup. + * + * ## OPTIONS + * + * [--list] + * Get a list of backup files + * + * Example: + * $ wp ai1wm backup --list + * +------------------------------------------------+--------------+-----------+ + * | Backup name | Date created | Size | + * +------------------------------------------------+--------------+-----------+ + * | migration-wp-20170908-152313-435.wpress | 4 days ago | 536.77 MB | + * | migration-wp-20170908-152103-603.wpress | 4 days ago | 536.77 MB | + * | migration-wp-20170908-152036-162.wpress | 4 days ago | 536.77 MB | + * | migration-wp-20170908-151428-266.wpress | 4 days ago | 536.77 MB | + * +------------------------------------------------+--------------+-----------+ + * + * [--exclude-spam-comments] + * Do not export spam comments + * + * [--exclude-revisions] + * Do not export post revisions + * + * [--exclude-media] + * Do not export media library (files) + * + * [--exclude-themes] + * Do not export themes (files) + * + * [--exclude-inactive-themes] + * Do not export inactive themes (files) + * + * [--exclude-muplugins] + * Do not export must-use plugins (files) + * + * [--exclude-plugins] + * Do not export plugins (files) + * + * [--exclude-inactive-plugins] + * Do not export inactive plugins (files) + * + * [--exclude-cache] + * Do not export cache (files) + * + * [--exclude-database] + * Do not export database (sql) + * + * [--exclude-email-replace] + * Do not replace email domain (sql) + * + * [--replace "find" "replace"] + * Find and replace text in the database + * + * Example: + * $ wp ai1wm backup --replace "wp" "WordPress" + * Backup in progress... + * Backup complete. + * Backup location: /repos/migration/wp/wp-content/ai1wm-backups/migration-wp-20170913-095743-931.wpress + * + * @subcommand backup + */ + public function backup( array $args, array $assoc_args ) { + if ( is_multisite() ) { + WP_CLI::error( __( 'WPI CLI is not supported in Multisite mode. Please use web interface to create a backup.', AI1WM_PLUGIN_NAME ) ); + } + + if ( ! is_dir( AI1WM_STORAGE_PATH ) ) { + if ( ! mkdir( AI1WM_STORAGE_PATH ) ) { + WP_CLI::error_multi_line( array( + sprintf( __( 'All in One WP Migration is not able to create %s folder.', AI1WM_PLUGIN_NAME ), AI1WM_STORAGE_PATH ), + __( 'You will need to create this folder and grant it read/write/execute permissions (0777) for the All in One WP Migration plugin to function properly.', AI1WM_PLUGIN_NAME ), + ) ); + exit; + } + } + + if ( ! is_dir( AI1WM_BACKUPS_PATH ) ) { + if ( ! mkdir( AI1WM_BACKUPS_PATH ) ) { + WP_CLI::error_multi_line( array( + sprintf( __( 'All in One WP Migration is not able to create %s folder.', AI1WM_PLUGIN_NAME ), AI1WM_BACKUPS_PATH ), + __( 'You will need to create this folder and grant it read/write/execute permissions (0777) for the All in One WP Migration plugin to function properly.', AI1WM_PLUGIN_NAME ), + ) ); + exit; + } + } + + $params = array(); + if ( isset( $assoc_args['list'] ) ) { + $backups = new cli\Table; + + $backups->setHeaders( array( + 'name' => __( 'Backup name', AI1WM_PLUGIN_NAME ), + 'date' => __( 'Date created', AI1WM_PLUGIN_NAME ), + 'size' => __( 'Size', AI1WM_PLUGIN_NAME ), + ) ); + + $model = new Ai1wm_Backups; + foreach ( $model->get_files() as $backup ) { + $backups->addRow( array( + 'name' => $backup['filename'], + 'date' => sprintf( __( '%s ago', AI1WM_PLUGIN_NAME ), human_time_diff( $backup['mtime'] ) ), + 'size' => size_format( $backup['size'], 2 ), + ) ); + } + + $backups->display(); + exit; + } + + if ( isset( $assoc_args['exclude-spam-comments'] ) ) { + $params['options']['no_spam_comments'] = true; + } + + if ( isset( $assoc_args['exclude-revisions'] ) ) { + $params['options']['no_revisions'] = true; + } + + if ( isset( $assoc_args['exclude-media'] ) ) { + $params['options']['no_media'] = true; + } + + if ( isset( $assoc_args['exclude-themes'] ) ) { + $params['options']['no_themes'] = true; + } + + if ( isset( $assoc_args['exclude-inactive-themes'] ) ) { + $params['options']['no_inactive_themes'] = true; + } + + if ( isset( $assoc_args['exclude-muplugins'] ) ) { + $params['options']['no_muplugins'] = true; + } + + if ( isset( $assoc_args['exclude-plugins'] ) ) { + $params['options']['no_plugins'] = true; + } + + if ( isset( $assoc_args['exclude-inactive-plugins'] ) ) { + $params['options']['no_inactive_plugins'] = true; + } + + if ( isset( $assoc_args['exclude-cache'] ) ) { + $params['options']['no_cache'] = true; + } + + if ( isset( $assoc_args['exclude-database'] ) ) { + $params['options']['no_database'] = true; + } + + if ( isset( $assoc_args['exclude-email-replace'] ) ) { + $params['options']['no_email_replace'] = true; + } + + if ( isset( $assoc_args['replace'] ) ) { + for ( $i = 0; $i < count( $args ); $i++ ) { + if ( isset( $args[ $i ] ) && isset( $args[ $i + 1 ] ) ) { + $params['options']['replace']['old_value'][] = $args[ $i ]; + $params['options']['replace']['new_value'][] = $args[ $i + 1 ]; + } + } + } + + WP_CLI::log( 'Backup in progress...' ); + + try { + + // Disable completed timeout + add_filter( 'ai1wm_completed_timeout', '__return_zero' ); + + // Remove filters + remove_filter( 'ai1wm_export', 'Ai1wm_Export_Clean::execute', 300 ); + + // Run filters + $params = apply_filters( 'ai1wm_export', $params ); + + } catch ( Exception $e ) { + WP_CLI::error( $e->getMessage() ); + } + + // Clean storage folder + Ai1wm_Directory::delete( ai1wm_storage_path( $params ) ); + + WP_CLI::log( __( 'Backup complete.', AI1WM_PLUGIN_NAME ) ); + WP_CLI::log( sprintf( __( 'Backup location: %s', AI1WM_PLUGIN_NAME ), ai1wm_backup_path( $params ) ) ); + } + + /** + * Restores a backup. + * + * Example: + * $ wp ai1wm restore migration-wp-20170913-095743-931.wpress + * Restore in progress... + * Restore complete. + * + * @subcommand restore + */ + public function restore( array $args, array $assoc_args ) { + if ( is_multisite() ) { + WP_CLI::error( __( 'WPI CLI is not supported in Multisite mode. Please use web interface to restore a backup.', AI1WM_PLUGIN_NAME ) ); + } + + if ( ! is_dir( AI1WM_STORAGE_PATH ) ) { + if ( ! mkdir( AI1WM_STORAGE_PATH ) ) { + WP_CLI::error_multi_line( array( + sprintf( __( 'All in One WP Migration is not able to create %s folder.', AI1WM_PLUGIN_NAME ), AI1WM_STORAGE_PATH ), + __( 'You will need to create this folder and grant it read/write/execute permissions (0777) for the All in One WP Migration plugin to function properly.', AI1WM_PLUGIN_NAME ), + ) ); + exit; + } + } + + $params = array(); + if ( isset( $args[0] ) && is_file( ai1wm_backup_path( array( 'archive' => $args[0] ) ) ) ) { + $params = array( + 'storage' => ai1wm_storage_folder(), + 'archive' => $args[0], + 'ai1wm_manual_restore' => true, + ); + } else { + WP_CLI::error_multi_line( array( + __( 'A valid backup name must be provided in order to proceed with the restore process.', AI1WM_PLUGIN_NAME ), + __( 'Example: wp ai1wm restore migration-wp-20170913-095743-931.wpress', AI1WM_PLUGIN_NAME ), + ) ); + exit; + } + + WP_CLI::log( 'Restore in progress...' ); + + try { + + // Disable completed timeout + add_filter( 'ai1wm_completed_timeout', '__return_zero' ); + + // Remove filters + remove_filter( 'ai1wm_import', 'Ai1wm_Import_Upload::execute', 5 ); + remove_filter( 'ai1wm_import', 'Ai1wm_Import_Confirm::execute', 100 ); + remove_filter( 'ai1wm_import', 'Ai1wm_Import_Clean::execute', 400 ); + + // Run filters + $params = apply_filters( 'ai1wm_import', $params ); + + } catch ( Exception $e ) { + WP_CLI::error( $e->getMessage() ); + } + + // Clean storage folder + Ai1wm_Directory::delete( ai1wm_storage_path( $params ) ); + + WP_CLI::log( 'Restore complete.' ); + } + } +} +if ( class_exists( 'WP_CLI' ) ) { + WP_CLI::add_command( 'ai1wm', 'Ai1wm_WP_CLI_Command', array( 'short_desc' => 'All-in-One WP Migration Command' ) ); +} diff --git a/lib/vendor/servmask/cron/class-ai1wm-cron.php b/lib/vendor/servmask/cron/class-ai1wm-cron.php new file mode 100644 index 0000000..a9a860f --- /dev/null +++ b/lib/vendor/servmask/cron/class-ai1wm-cron.php @@ -0,0 +1,72 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Cron { + + /** + * Schedules a hook which will be executed by the WordPress + * actions core on a specific interval + * + * @param string $hook Event hook + * @param string $recurrence How often the event should reoccur + * @param array $args Arguments to pass to the hook function(s) + * @return mixed + */ + public static function add( $hook, $recurrence, $args = array() ) { + $args = array_slice( func_get_args(), 2 ); + $schedules = wp_get_schedules(); + + if ( isset( $schedules[ $recurrence ] ) && ( $current = $schedules[ $recurrence ] ) ) { + return wp_schedule_event( time() + $current['interval'], $recurrence, $hook, $args ); + } + } + + /** + * Un-schedules all previously-scheduled cron jobs using a particular + * hook name or a specific combination of hook name and arguments. + * + * @param string $hook Event hook + * @return boolean + */ + public static function clear( $hook ) { + $cron = get_option( AI1WM_CRON, array() ); + if ( empty( $cron ) ) { + return false; + } + + foreach ( $cron as $timestamp => $hooks ) { + if ( isset( $hooks[ $hook ] ) ) { + unset( $cron[ $timestamp ][ $hook ] ); + + // Unset empty timestamps + if ( empty( $cron[ $timestamp ] ) ) { + unset( $cron[ $timestamp ] ); + } + } + } + + return update_option( AI1WM_CRON, $cron ); + } +} diff --git a/lib/vendor/servmask/database/class-ai1wm-database-mysql.php b/lib/vendor/servmask/database/class-ai1wm-database-mysql.php new file mode 100644 index 0000000..5583d69 --- /dev/null +++ b/lib/vendor/servmask/database/class-ai1wm-database-mysql.php @@ -0,0 +1,114 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Database_Mysql extends Ai1wm_Database { + + /** + * Run MySQL query + * + * @param string $input SQL query + * @return resource + */ + public function query( $input ) { + return mysql_query( $input, $this->wpdb->dbh ); + } + + /** + * Escape string input for mysql query + * + * @param string $input String to escape + * @return string + */ + public function escape( $input ) { + return mysql_real_escape_string( $input, $this->wpdb->dbh ); + } + + /** + * Return the error code for the most recent function call + * + * @return integer + */ + public function errno() { + return mysql_errno( $this->wpdb->dbh ); + } + + /** + * Return a string description of the last error + * + * @return string + */ + public function error() { + return mysql_error( $this->wpdb->dbh ); + } + + /** + * Return server version + * + * @return string + */ + public function version() { + return mysql_get_server_info( $this->wpdb->dbh ); + } + + /** + * Return the result from MySQL query as associative array + * + * @param resource $result MySQL resource + * @return array + */ + public function fetch_assoc( $result ) { + return mysql_fetch_assoc( $result ); + } + + /** + * Return the result from MySQL query as row + * + * @param resource $result MySQL resource + * @return array + */ + public function fetch_row( $result ) { + return mysql_fetch_row( $result ); + } + + /** + * Return the number for rows from MySQL results + * + * @param resource $result MySQL resource + * @return integer + */ + public function num_rows( $result ) { + return mysql_num_rows( $result ); + } + + /** + * Free MySQL result memory + * + * @param resource $result MySQL resource + * @return boolean + */ + public function free_result( $result ) { + return mysql_free_result( $result ); + } +} diff --git a/lib/vendor/servmask/database/class-ai1wm-database-mysqli.php b/lib/vendor/servmask/database/class-ai1wm-database-mysqli.php new file mode 100644 index 0000000..a64319b --- /dev/null +++ b/lib/vendor/servmask/database/class-ai1wm-database-mysqli.php @@ -0,0 +1,114 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Database_Mysqli extends Ai1wm_Database { + + /** + * Run MySQL query + * + * @param string $input SQL query + * @return resource + */ + public function query( $input ) { + return mysqli_query( $this->wpdb->dbh, $input, MYSQLI_STORE_RESULT ); + } + + /** + * Escape string input for mysql query + * + * @param string $input String to escape + * @return string + */ + public function escape( $input ) { + return mysqli_real_escape_string( $this->wpdb->dbh, $input ); + } + + /** + * Return the error code for the most recent function call + * + * @return integer + */ + public function errno() { + return mysqli_errno( $this->wpdb->dbh ); + } + + /** + * Return a string description of the last error + * + * @return string + */ + public function error() { + return mysqli_error( $this->wpdb->dbh ); + } + + /** + * Return server version + * + * @return string + */ + public function version() { + return mysqli_get_server_info( $this->wpdb->dbh ); + } + + /** + * Return the result from MySQL query as associative array + * + * @param resource $result MySQL resource + * @return array + */ + public function fetch_assoc( $result ) { + return mysqli_fetch_assoc( $result ); + } + + /** + * Return the result from MySQL query as row + * + * @param resource $result MySQL resource + * @return array + */ + public function fetch_row( $result ) { + return mysqli_fetch_row( $result ); + } + + /** + * Return the number for rows from MySQL results + * + * @param resource $result MySQL resource + * @return integer + */ + public function num_rows( $result ) { + return mysqli_num_rows( $result ); + } + + /** + * Free MySQL result memory + * + * @param resource $result MySQL resource + * @return boolean + */ + public function free_result( $result ) { + return mysqli_free_result( $result ); + } +} diff --git a/lib/vendor/servmask/database/class-ai1wm-database-utility.php b/lib/vendor/servmask/database/class-ai1wm-database-utility.php new file mode 100644 index 0000000..1a2365f --- /dev/null +++ b/lib/vendor/servmask/database/class-ai1wm-database-utility.php @@ -0,0 +1,149 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Database_Utility { + + /** + * Replace all occurrences of the search string with the replacement string. + * This function is case-sensitive. + * + * @param array $from List of string we're looking to replace. + * @param array $to What we want it to be replaced with. + * @param string $data Data to replace. + * @return mixed The original string with all elements replaced as needed. + */ + public static function replace_values( $from = array(), $to = array(), $data = '' ) { + if ( ! empty( $from ) && ! empty( $to ) ) { + return strtr( $data, array_combine( $from, $to ) ); + } + + return $data; + } + + /** + * Take a serialized array and unserialize it replacing elements as needed and + * unserializing any subordinate arrays and performing the replace on those too. + * This function is case-sensitive. + * + * @param array $from List of string we're looking to replace. + * @param array $to What we want it to be replaced with. + * @param mixed $data Used to pass any subordinate arrays back to in. + * @param bool $serialized Does the array passed via $data need serializing. + * @return mixed The original array with all elements replaced as needed. + */ + public static function replace_serialized_values( $from = array(), $to = array(), $data = '', $serialized = false ) { + try { + + // Some unserialized data cannot be re-serialized eg. SimpleXMLElements + if ( is_serialized( $data ) && ( $unserialized = @unserialize( $data ) ) !== false ) { + $data = self::replace_serialized_values( $from, $to, $unserialized, true ); + } elseif ( is_array( $data ) ) { + $tmp = array(); + foreach ( $data as $key => $value ) { + $tmp[ $key ] = self::replace_serialized_values( $from, $to, $value, false ); + } + + $data = $tmp; + unset( $tmp ); + } elseif ( is_object( $data ) ) { + if ( ! ( $data instanceof __PHP_Incomplete_Class ) ) { + $tmp = $data; + $props = get_object_vars( $data ); + foreach ( $props as $key => $value ) { + $tmp->$key = self::replace_serialized_values( $from, $to, $value, false ); + } + + $data = $tmp; + unset( $tmp ); + } + } else { + if ( is_string( $data ) ) { + if ( ! empty( $from ) && ! empty( $to ) ) { + $data = strtr( $data, array_combine( $from, $to ) ); + } + } + } + + if ( $serialized ) { + return serialize( $data ); + } + } catch ( Exception $e ) { + } + + return $data; + } + + /** + * Escape MySQL special characters + * + * @param string $data Data to escape + * @return string + */ + public static function escape_mysql( $data ) { + return strtr( + $data, + array_combine( + array( "\x00", "\n", "\r", '\\', "'", '"', "\x1a" ), + array( '\\0', '\\n', '\\r', '\\\\', "\\'", '\\"', '\\Z' ) + ) + ); + } + + /** + * Unescape MySQL special characters + * + * @param string $data Data to unescape + * @return string + */ + public static function unescape_mysql( $data ) { + return strtr( + $data, + array_combine( + array( '\\0', '\\n', '\\r', '\\\\', "\\'", '\\"', '\\Z' ), + array( "\x00", "\n", "\r", '\\', "'", '"', "\x1a" ) + ) + ); + } + + /** + * Encode base64 characters + * + * @param string $data Data to encode + * @return string + */ + public static function base64_encode( $data ) { + return base64_encode( $data ); + } + + /** + * Encode base64 characters + * + * @param string $data Data to decode + * @return string + */ + public static function base64_decode( $data ) { + return base64_decode( $data ); + } +} diff --git a/lib/vendor/servmask/database/class-ai1wm-database.php b/lib/vendor/servmask/database/class-ai1wm-database.php new file mode 100644 index 0000000..26cdedf --- /dev/null +++ b/lib/vendor/servmask/database/class-ai1wm-database.php @@ -0,0 +1,1407 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +abstract class Ai1wm_Database { + + /** + * Number of queries per transaction + * + * @var integer + */ + const QUERIES_PER_TRANSACTION = 1000; + + /** + * WordPress database handler + * + * @var object + */ + protected $wpdb = null; + + /** + * Old table prefixes + * + * @var array + */ + protected $old_table_prefixes = array(); + + /** + * New table prefixes + * + * @var array + */ + protected $new_table_prefixes = array(); + + /** + * Old column prefixes + * + * @var array + */ + protected $old_column_prefixes = array(); + + /** + * New column prefixes + * + * @var array + */ + protected $new_column_prefixes = array(); + + /** + * Old replace values + * + * @var array + */ + protected $old_replace_values = array(); + + /** + * New replace values + * + * @var array + */ + protected $new_replace_values = array(); + + /** + * Table where clauses + * + * @var array + */ + protected $table_where_clauses = array(); + + /** + * Table prefix columns + * + * @var array + */ + protected $table_prefix_columns = array(); + + /** + * Include table prefixes + * + * @var array + */ + protected $include_table_prefixes = array(); + + /** + * Exclude table prefixes + * + * @var array + */ + protected $exclude_table_prefixes = array(); + + /** + * List all tables that should not be affected by the timeout of the current request + * + * @var array + */ + protected $atomic_tables = array(); + + /** + * Visual Composer + * + * @var boolean + */ + protected $visual_composer = false; + + /** + * BeTheme Responsive + * + * @var boolean + */ + protected $betheme_responsive = false; + + /** + * Constructor + * + * @param object $wpdb WPDB instance + */ + public function __construct( $wpdb ) { + $this->wpdb = $wpdb; + + // Check Microsoft SQL Server support + if ( is_resource( $this->wpdb->dbh ) ) { + if ( get_resource_type( $this->wpdb->dbh ) === 'SQL Server Connection' ) { + throw new Exception( + 'Your WordPress installation uses Microsoft SQL Server. ' . + 'In order to use All in One WP Migration, please change your installation to MySQL and try again. ' . + 'Technical details' + ); + } + } + + // Set database host (HyberDB) + if ( empty( $this->wpdb->dbhost ) ) { + if ( isset( $this->wpdb->last_used_server['host'] ) ) { + $this->wpdb->dbhost = $this->wpdb->last_used_server['host']; + } + } + + // Set database name (HyperDB) + if ( empty( $this->wpdb->dbname ) ) { + if ( isset( $this->wpdb->last_used_server['name'] ) ) { + $this->wpdb->dbname = $this->wpdb->last_used_server['name']; + } + } + } + + /** + * Set old table prefixes + * + * @param array $prefixes List of table prefixes + * @return object + */ + public function set_old_table_prefixes( $prefixes ) { + $this->old_table_prefixes = $prefixes; + + return $this; + } + + /** + * Get old table prefixes + * + * @return array + */ + public function get_old_table_prefixes() { + return $this->old_table_prefixes; + } + + /** + * Set new table prefixes + * + * @param array $prefixes List of table prefixes + * @return object + */ + public function set_new_table_prefixes( $prefixes ) { + $this->new_table_prefixes = $prefixes; + + return $this; + } + + /** + * Get new table prefixes + * + * @return array + */ + public function get_new_table_prefixes() { + return $this->new_table_prefixes; + } + + /** + * Set old column prefixes + * + * @param array $prefixes List of column prefixes + * @return object + */ + public function set_old_column_prefixes( $prefixes ) { + $this->old_column_prefixes = $prefixes; + + return $this; + } + + /** + * Get old column prefixes + * + * @return array + */ + public function get_old_column_prefixes() { + return $this->old_column_prefixes; + } + + /** + * Set new column prefixes + * + * @param array $prefixes List of column prefixes + * @return object + */ + public function set_new_column_prefixes( $prefixes ) { + $this->new_column_prefixes = $prefixes; + + return $this; + } + + /** + * Get new column prefixes + * + * @return array + */ + public function get_new_column_prefixes() { + return $this->new_column_prefixes; + } + + /** + * Set old replace values + * + * @param array $values List of values + * @return object + */ + public function set_old_replace_values( $values ) { + $this->old_replace_values = $values; + + return $this; + } + + /** + * Get old replace values + * + * @return array + */ + public function get_old_replace_values() { + return $this->old_replace_values; + } + + /** + * Set new replace values + * + * @param array $values List of values + * @return object + */ + public function set_new_replace_values( $values ) { + $this->new_replace_values = $values; + + return $this; + } + + /** + * Get new replace values + * + * @return array + */ + public function get_new_replace_values() { + return $this->new_replace_values; + } + + /** + * Set old replace raw values + * + * @param array $values List of values + * @return object + */ + public function set_old_replace_raw_values( $values ) { + $this->old_replace_raw_values = $values; + + return $this; + } + + /** + * Get old replace raw values + * + * @return array + */ + public function get_old_replace_raw_values() { + return $this->old_replace_raw_values; + } + + /** + * Set new replace raw values + * + * @param array $values List of values + * @return object + */ + public function set_new_replace_raw_values( $values ) { + $this->new_replace_raw_values = $values; + + return $this; + } + + /** + * Get new replace raw values + * + * @return array + */ + public function get_new_replace_raw_values() { + return $this->new_replace_raw_values; + } + + /** + * Set table where clauses + * + * @param string $table Table name + * @param array $clauses Table clauses + * @return object + */ + public function set_table_where_clauses( $table, $clauses ) { + $this->table_where_clauses[ strtolower( $table ) ] = $clauses; + + return $this; + } + + /** + * Get table where clauses + * + * @param string $table Table name + * @return array + */ + public function get_table_where_clauses( $table ) { + if ( isset( $this->table_where_clauses[ strtolower( $table ) ] ) ) { + return $this->table_where_clauses[ strtolower( $table ) ]; + } + + return array(); + } + + /** + * Set table prefix columns + * + * @param string $table Table name + * @param array $columns Table columns + * @return object + */ + public function set_table_prefix_columns( $table, $columns ) { + foreach ( $columns as $column ) { + $this->table_prefix_columns[ strtolower( $table ) ][ strtolower( $column ) ] = true; + } + + return $this; + } + + /** + * Get table prefix columns + * + * @param string $table Table name + * @return array + */ + public function get_table_prefix_columns( $table ) { + if ( isset( $this->table_prefix_columns[ strtolower( $table ) ] ) ) { + return $this->table_prefix_columns[ strtolower( $table ) ]; + } + + return array(); + } + + /** + * Set include table prefixes + * + * @param array $prefixes List of table prefixes + * @return object + */ + public function set_include_table_prefixes( $prefixes ) { + $this->include_table_prefixes = $prefixes; + + return $this; + } + + /** + * Get include table prefixes + * + * @return array + */ + public function get_include_table_prefixes() { + return $this->include_table_prefixes; + } + + /** + * Set exclude table prefixes + * + * @param array $prefixes List of table prefixes + * @return object + */ + public function set_exclude_table_prefixes( $prefixes ) { + $this->exclude_table_prefixes = $prefixes; + + return $this; + } + + /** + * Get exclude table prefixes + * + * @return array + */ + public function get_exclude_table_prefixes() { + return $this->exclude_table_prefixes; + } + + /** + * Set atomic tables + * + * @param array $tables List of tables + * @return object + */ + public function set_atomic_tables( $tables ) { + $this->atomic_tables = $tables; + + return $this; + } + + /** + * Get atomic tables + * + * @return array + */ + public function get_atomic_tables() { + return $this->atomic_tables; + } + + /** + * Set Visual Composer + * + * @param boolean $active Is Visual Composer Active? + * @return object + */ + public function set_visual_composer( $active ) { + $this->visual_composer = $active; + + return $this; + } + + /** + * Get Visual Composer + * + * @return boolean + */ + public function get_visual_composer() { + return $this->visual_composer; + } + + /** + * Set BeTheme Responsive + * + * @param boolean $active Is BeTheme Responsive Active? + * @return object + */ + public function set_betheme_responsive( $active ) { + $this->betheme_responsive = $active; + + return $this; + } + + /** + * Get BeTheme Responsive + * + * @return boolean + */ + public function get_betheme_responsive() { + return $this->betheme_responsive; + } + + /** + * Get tables + * + * @return array + */ + public function get_tables() { + $tables = array(); + + $result = $this->query( "SHOW TABLES FROM `{$this->wpdb->dbname}`" ); + while ( $row = $this->fetch_row( $result ) ) { + if ( isset( $row[0] ) && ( $table_name = $row[0] ) ) { + + // Include table prefixes + if ( $this->get_include_table_prefixes() ) { + $include = false; + + // Check table prefixes + foreach ( $this->get_include_table_prefixes() as $prefix ) { + if ( stripos( $table_name, $prefix ) === 0 ) { + $include = true; + break; + } + } + + // Skip current table + if ( $include === false ) { + continue; + } + } + + // Exclude table prefixes + if ( $this->get_exclude_table_prefixes() ) { + $exclude = false; + + // Check table prefixes + foreach ( $this->get_exclude_table_prefixes() as $prefix ) { + if ( stripos( $table_name, $prefix ) === 0 ) { + $exclude = true; + break; + } + } + + // Skip current table + if ( $exclude === true ) { + continue; + } + } + + // Add table name + $tables[] = $table_name; + } + } + + // Close result cursor + $this->free_result( $result ); + + return $tables; + } + + /** + * Export database into a file + * + * @param string $file_name File name + * @param integer $table_index Table index + * @param integer $table_offset Table offset + * @return boolean + */ + public function export( $file_name, &$table_index = 0, &$table_offset = 0 ) { + // Set file handler + $file_handler = ai1wm_open( $file_name, 'ab' ); + + // Write headers + if ( $table_index === 0 ) { + ai1wm_write( $file_handler, $this->get_header() ); + } + + // Start time + $start = microtime( true ); + + // Flag to hold if all tables have been processed + $completed = true; + + // Set SQL Mode + $this->query( "SET SESSION sql_mode = ''" ); + + // Get tables + $tables = $this->get_tables(); + + // Export tables + for ( ; $table_index < count( $tables ); ) { + + // Get table name + $table_name = $tables[ $table_index ]; + + // Replace table name prefixes + $new_table_name = $this->replace_table_prefixes( $table_name, 0 ); + + // Get create table statement + if ( $table_offset === 0 ) { + + // Write table drop statement + $drop_table = "\nDROP TABLE IF EXISTS `{$new_table_name}`;\n"; + + // Write table statement + ai1wm_write( $file_handler, $drop_table ); + + // Get create table statement + $create_table = $this->get_create_table( $table_name ); + + // Replace create table prefixes + $create_table = $this->replace_table_prefixes( $create_table, 14 ); + + // Replace table constraints + $create_table = $this->replace_table_constraints( $create_table ); + + // Replace create table options + $create_table = $this->replace_table_options( $create_table ); + + // Write table statement + ai1wm_write( $file_handler, $create_table ); + + // Write end of statement + ai1wm_write( $file_handler, ";\n\n" ); + } + + // Get primary keys + $primary_keys = $this->get_primary_keys( $table_name ); + + do { + + // Set query + if ( $primary_keys ) { + + // Set table keys + $table_keys = array(); + foreach ( $primary_keys as $key ) { + $table_keys[] = sprintf( '`%s`', $key ); + } + + $table_keys = implode( ', ', $table_keys ); + + // Set table where clauses + $table_where = array( 1 ); + foreach ( $this->get_table_where_clauses( $table_name ) as $clause ) { + $table_where[] = $clause; + } + + $table_where = implode( ' AND ', $table_where ); + + // Set query with offset and rows count + $query = sprintf( 'SELECT t1.* FROM `%s` AS t1 JOIN (SELECT %s FROM `%s` WHERE %s ORDER BY %s LIMIT %d, %d) AS t2 USING (%s)', $table_name, $table_keys, $table_name, $table_where, $table_keys, $table_offset, 1000, $table_keys ); + + } else { + + // Set table keys + $table_keys = 1; + + // Set table where clauses + $table_where = array( 1 ); + foreach ( $this->get_table_where_clauses( $table_name ) as $clause ) { + $table_where[] = $clause; + } + + $table_where = implode( ' AND ', $table_where ); + + // Set query with offset and rows count + $query = sprintf( 'SELECT * FROM `%s` WHERE %s ORDER BY %s LIMIT %d, %d', $table_name, $table_where, $table_keys, $table_offset, 1000 ); + } + + // Apply additional table prefix columns + $columns = $this->get_table_prefix_columns( $table_name ); + + // Run SQL query + $result = $this->query( $query ); + + // Repair table data + if ( $this->errno() === 1194 ) { + + // Current table is marked as crashed and should be repaired + $this->repair_table( $table_name ); + + // Run SQL query + $result = $this->query( $query ); + } + + // Generate insert statements + if ( $num_rows = $this->num_rows( $result ) ) { + + // Loop over table rows + while ( $row = $this->fetch_assoc( $result ) ) { + + // Write start transaction + if ( $table_offset % Ai1wm_Database::QUERIES_PER_TRANSACTION === 0 ) { + ai1wm_write( $file_handler, "START TRANSACTION;\n" ); + } + + $items = array(); + foreach ( $row as $key => $value ) { + // Replace table prefix columns + if ( isset( $columns[ strtolower( $key ) ] ) ) { + $value = $this->replace_column_prefixes( $value, 0 ); + } + + // Replace table values + $items[] = is_null( $value ) ? 'NULL' : "'" . $this->escape( $value ) . "'"; + } + + // Set table values + $table_values = implode( ',', $items ); + + // Set insert statement + $table_insert = "INSERT INTO `{$new_table_name}` VALUES ({$table_values});\n"; + + // Write insert statement + ai1wm_write( $file_handler, $table_insert ); + + // Set current table offset + $table_offset++; + + // Write end of transaction + if ( $table_offset % Ai1wm_Database::QUERIES_PER_TRANSACTION === 0 ) { + ai1wm_write( $file_handler, "COMMIT;\n" ); + } + } + } else { + + // Write end of transaction + if ( $table_offset % Ai1wm_Database::QUERIES_PER_TRANSACTION !== 0 ) { + ai1wm_write( $file_handler, "COMMIT;\n" ); + } + + // Set curent table index + $table_index++; + + // Set current table offset + $table_offset = 0; + } + + // Close result cursor + $this->free_result( $result ); + + // Time elapsed + if ( ( $timeout = apply_filters( 'ai1wm_completed_timeout', 10 ) ) ) { + if ( ( microtime( true ) - $start ) > $timeout ) { + $completed = false; + break 2; + } + } + } while ( $num_rows > 0 ); + } + + // Close file handler + ai1wm_close( $file_handler ); + + return $completed; + } + + /** + * Import database from a file + * + * @param string $file_name File name + * @param integer $query_offset Query offset + * @return boolean + */ + public function import( $file_name, &$query_offset = 0 ) { + // Set max allowed packet + $max_allowed_packet = $this->get_max_allowed_packet(); + + // Set file handler + $file_handler = ai1wm_open( $file_name, 'r' ); + + // Start time + $start = microtime( true ); + + // Flag to hold if all tables have been processed + $completed = true; + + // Set SQL Mode + $this->query( "SET SESSION sql_mode = ''" ); + + // Set file pointer at the query offset + if ( fseek( $file_handler, $query_offset ) !== -1 ) { + $query = null; + + // Start transaction + $this->query( 'START TRANSACTION' ); + + // Read database file line by line + while ( ( $line = fgets( $file_handler ) ) !== false ) { + $query .= $line; + + // End of query + if ( preg_match( '/;\s*$/S', $query ) ) { + $query = trim( $query ); + + // Check max allowed packet + if ( strlen( $query ) <= $max_allowed_packet ) { + + // Replace table prefixes + $query = $this->replace_table_prefixes( $query ); + + // Replace table collations + $query = $this->replace_table_collations( $query ); + + // Replace table values + $query = $this->replace_table_values( $query ); + + // Replace raw values + $query = $this->replace_raw_values( $query ); + + // Run SQL query + $this->query( $query ); + + // Replace table engines (Azure) + if ( $this->errno() === 1030 ) { + + // Replace table engines + $query = $this->replace_table_engines( $query ); + + // Run SQL query + $this->query( $query ); + } + + // Set query offset + $query_offset = ftell( $file_handler ); + + // Time elapsed + if ( ( $timeout = apply_filters( 'ai1wm_completed_timeout', 10 ) ) ) { + if ( ! $this->is_atomic_query( $query ) ) { + if ( ( microtime( true ) - $start ) > $timeout ) { + $completed = false; + break; + } + } + } + } + + $query = null; + } + } + + // End transaction + $this->query( 'COMMIT' ); + } + + // Close file handler + ai1wm_close( $file_handler ); + + return $completed; + } + + /** + * Flush database + * + * @return void + */ + public function flush() { + foreach ( $this->get_tables() as $table_name ) { + $this->query( "DROP TABLE IF EXISTS `{$table_name}`" ); + } + } + + /** + * Get MySQL version + * + * @return string + */ + protected function get_version() { + $result = $this->query( "SHOW VARIABLES LIKE 'version'" ); + $row = $this->fetch_assoc( $result ); + + // Close result cursor + $this->free_result( $result ); + + // Get version + if ( isset( $row['Value'] ) ) { + return $row['Value']; + } + } + + /** + * Get MySQL max allowed packet + * + * @return integer + */ + protected function get_max_allowed_packet() { + $result = $this->query( "SHOW VARIABLES LIKE 'max_allowed_packet'" ); + $row = $this->fetch_assoc( $result ); + + // Close result cursor + $this->free_result( $result ); + + // Get max allowed packet + if ( isset( $row['Value'] ) ) { + return $row['Value']; + } + } + + /** + * Get MySQL collation name + * + * @param string $collation_name Collation name + * @return string + */ + protected function get_collation( $collation_name ) { + $result = $this->query( "SHOW COLLATION LIKE '{$collation_name}'" ); + $row = $this->fetch_assoc( $result ); + + // Close result cursor + $this->free_result( $result ); + + // Get collation name + if ( isset( $row['Collation'] ) ) { + return $row['Collation']; + } + } + + /** + * Get MySQL create table + * + * @param string $table_name Table name + * @return string + */ + protected function get_create_table( $table_name ) { + $result = $this->query( "SHOW CREATE TABLE `{$table_name}`" ); + $row = $this->fetch_assoc( $result ); + + // Close result cursor + $this->free_result( $result ); + + // Get create table + if ( isset( $row['Create Table'] ) ) { + return $row['Create Table']; + } + } + + /** + * Repair MySQL table + * + * @param string $table_name Table name + * @return void + */ + protected function repair_table( $table_name ) { + $this->query( "REPAIR TABLE `{$table_name}`" ); + } + + /** + * Get MySQL primary keys + * + * @param string $table_name Table name + * @return array + */ + protected function get_primary_keys( $table_name ) { + $primary_keys = array(); + + // Get primary keys + $result = $this->query( "SHOW KEYS FROM `{$table_name}` WHERE `Key_name` = 'PRIMARY'" ); + while ( $row = $this->fetch_assoc( $result ) ) { + if ( isset( $row['Column_name'] ) ) { + $primary_keys[] = $row['Column_name']; + } + } + + // Close result cursor + $this->free_result( $result ); + + return $primary_keys; + } + + /** + * Get MySQL unique keys + * + * @param string $table_name Table name + * @return array + */ + protected function get_unique_keys( $table_name ) { + $unique_keys = array(); + + // Get unique keys + $result = $this->query( "SHOW KEYS FROM `{$table_name}` WHERE `Non_unique` = 0" ); + while ( $row = $this->fetch_assoc( $result ) ) { + if ( isset( $row['Column_name'] ) ) { + $unique_keys[] = $row['Column_name']; + } + } + + // Close result cursor + $this->free_result( $result ); + + return $unique_keys; + } + + /** + * Replace table prefixes + * + * @param string $input Table value + * @param mixed $position Replace first occurrence at a specified position + * @return string + */ + protected function replace_table_prefixes( $input, $position = false ) { + // Get table prefixes + $search = $this->get_old_table_prefixes(); + $replace = $this->get_new_table_prefixes(); + + // Replace first occurance at a specified position + if ( $position !== false ) { + for ( $i = 0; $i < count( $search ); $i++ ) { + $current = stripos( $input, $search[ $i ] ); + if ( $current === $position ) { + $input = substr_replace( $input, $replace[ $i ], $current, strlen( $search[ $i ] ) ); + } + } + + return $input; + } + + // Replace all occurrences + return str_ireplace( $search, $replace, $input ); + } + + /** + * Replace column prefixes + * + * @param string $input Column value + * @param mixed $position Replace first occurrence at a specified position + * @return string + */ + protected function replace_column_prefixes( $input, $position = false ) { + // Get column prefixes + $search = $this->get_old_column_prefixes(); + $replace = $this->get_new_column_prefixes(); + + // Replace first occurance at a specified position + if ( $position !== false ) { + for ( $i = 0; $i < count( $search ); $i++ ) { + $current = stripos( $input, $search[ $i ] ); + if ( $current === $position ) { + $input = substr_replace( $input, $replace[ $i ], $current, strlen( $search[ $i ] ) ); + } + } + + return $input; + } + + // Replace all occurrences + return str_ireplace( $search, $replace, $input ); + } + + /** + * Replace table values + * + * @param string $input Table value + * @return string + */ + protected function replace_table_values( $input ) { + // Replace base64 encoded values (Visual Composer) + if ( $this->get_visual_composer() ) { + $input = preg_replace_callback( '/\[vc_raw_html\](.+?)\[\/vc_raw_html\]/S', array( $this, 'replace_visual_composer_values_callback' ), $input ); + } + + // Replace base64 encoded values (BeTheme Responsive) + if ( $this->get_betheme_responsive() ) { + $input = preg_replace_callback( "/'mfn-page-items','(.*?)'/S", array( $this, 'replace_betheme_responsive_values_callback' ), $input ); + } + + // Replace serialized values + foreach ( $this->get_old_replace_values() as $old_value ) { + if ( strpos( $input, $this->escape( $old_value ) ) !== false ) { + $input = preg_replace_callback( "/'(.*?)(?get_old_replace_values(), $this->get_new_replace_values(), $input ); + + // Escape MySQL special characters + return "'" . Ai1wm_Database_Utility::escape_mysql( $input ) . "'"; + } + + /** + * Replace base64 values callback (Visual Composer) + * + * @param array $matches List of matches + * @return string + */ + protected function replace_visual_composer_values_callback( $matches ) { + // Decode base64 characters + $input = Ai1wm_Database_Utility::base64_decode( $matches[1] ); + + // Replace values + $input = Ai1wm_Database_Utility::replace_values( $this->get_old_replace_values(), $this->get_new_replace_values(), $input ); + + // Encode base64 characters + return '[vc_raw_html]' . Ai1wm_Database_Utility::base64_encode( $input ) . '[/vc_raw_html]'; + } + + /** + * Replace base64 values callback (BeTheme Responsive) + * + * @param array $matches List of matches + * @return string + */ + protected function replace_betheme_responsive_values_callback( $matches ) { + // Decode base64 characters + $input = Ai1wm_Database_Utility::base64_decode( $matches[1] ); + + // Replace serialized values + $input = Ai1wm_Database_Utility::replace_serialized_values( $this->get_old_replace_values(), $this->get_new_replace_values(), $input ); + + // Encode base64 characters + return "'mfn-page-items','" . Ai1wm_Database_Utility::base64_encode( $input ) . "'"; + } + + /** + * Replace table collations + * + * @param string $input SQL statement + * @return string + */ + protected function replace_table_collations( $input ) { + static $search = array(); + static $replace = array(); + + // Replace table collations + if ( empty( $search ) || empty( $replace ) ) { + if ( ! $this->wpdb->has_cap( 'utf8mb4_520' ) ) { + if ( ! $this->wpdb->has_cap( 'utf8mb4' ) ) { + $search = array( 'utf8mb4_unicode_520_ci', 'utf8mb4' ); + $replace = array( 'utf8_unicode_ci', 'utf8' ); + } else { + $search = array( 'utf8mb4_unicode_520_ci' ); + $replace = array( 'utf8mb4_unicode_ci' ); + } + } + } + + return str_replace( $search, $replace, $input ); + } + + /** + * Replace raw values + * + * @param string $input SQL statement + * @return string + */ + protected function replace_raw_values( $input ) { + return Ai1wm_Database_Utility::replace_values( $this->get_old_replace_raw_values(), $this->get_new_replace_raw_values(), $input ); + } + + /** + * Replace table constraints + * + * @param string $input SQL statement + * @return string + */ + protected function replace_table_constraints( $input ) { + $pattern = array( + '/\s+CONSTRAINT(.+)REFERENCES(.+),/i', + '/,\s+CONSTRAINT(.+)REFERENCES(.+)/i', + ); + + return preg_replace( $pattern, '', $input ); + } + + /** + * Check whether input is START TRANSACTION query + * + * @param string $input SQL statement + * @return boolean + */ + protected function is_start_transaction_query( $input ) { + return strpos( $input, 'START TRANSACTION' ) === 0; + } + + /** + * Check whether input is COMMIT query + * + * @param string $input SQL statement + * @return boolean + */ + protected function is_commit_query( $input ) { + return strpos( $input, 'COMMIT' ) === 0; + } + + /** + * Check whether input is DROP TABLE query + * + * @param string $input SQL statement + * @return boolean + */ + protected function is_drop_table_query( $input ) { + return strpos( $input, 'DROP TABLE' ) === 0; + } + + /** + * Check whether input is CREATE TABLE query + * + * @param string $input SQL statement + * @return boolean + */ + protected function is_create_table_query( $input ) { + return strpos( $input, 'CREATE TABLE' ) === 0; + } + + /** + * Check whether input is INSERT INTO query + * + * @param string $input SQL statement + * @param string $table Table name (case insensitive) + * @return boolean + */ + protected function is_insert_into_query( $input, $table ) { + return stripos( $input, sprintf( 'INSERT INTO `%s`', $table ) ) === 0; + } + + /** + * Check whether input is atomic query + * + * @param string $input SQL statement + * @return boolean + */ + protected function is_atomic_query( $input ) { + $atomic = false; + + // Skip timeout based on table query + switch ( true ) { + case $this->is_drop_table_query( $input ): + case $this->is_create_table_query( $input ): + case $this->is_start_transaction_query( $input ): + case $this->is_commit_query( $input ): + $atomic = true; + break; + + default: + // Skip timeout based on table query and table name + foreach ( $this->get_atomic_tables() as $table_name ) { + if ( $this->is_insert_into_query( $input, $table_name ) ) { + $atomic = true; + break; + } + } + } + + return $atomic; + } + + /** + * Replace table options + * + * @param string $input SQL statement + * @return string + */ + protected function replace_table_options( $input ) { + // Set table replace options + $search = array( + 'TYPE=InnoDB', + 'TYPE=MyISAM', + 'ENGINE=Aria', + 'TRANSACTIONAL=0', + 'TRANSACTIONAL=1', + 'PAGE_CHECKSUM=0', + 'PAGE_CHECKSUM=1', + 'TABLE_CHECKSUM=0', + 'TABLE_CHECKSUM=1', + 'ROW_FORMAT=PAGE', + 'ROW_FORMAT=FIXED', + 'ROW_FORMAT=DYNAMIC', + ); + $replace = array( + 'ENGINE=InnoDB', + 'ENGINE=MyISAM', + 'ENGINE=MyISAM', + '', + '', + '', + '', + '', + '', + '', + '', + '', + ); + + return str_ireplace( $search, $replace, $input ); + } + + /** + * Replace table engines + * + * @param string $input SQL statement + * @return string + */ + protected function replace_table_engines( $input ) { + // Set table replace engines + $search = array( + 'ENGINE=MyISAM', + 'ENGINE=Aria', + ); + $replace = array( + 'ENGINE=InnoDB', + 'ENGINE=InnoDB', + ); + + return str_ireplace( $search, $replace, $input ); + } + + /** + * Returns header for dump file + * + * @return string + */ + protected function get_header() { + // Some info about software, source and time + $header = sprintf( + "-- All In One WP Migration SQL Dump\n" . + "-- https://servmask.com/\n" . + "--\n" . + "-- Host: %s\n" . + "-- Database: %s\n" . + "-- Class: %s\n" . + "--\n", + $this->wpdb->dbhost, + $this->wpdb->dbname, + get_class( $this ) + ); + + return $header; + } + + /** + * Run MySQL query + * + * @param string $input SQL query + * @return resource + */ + abstract public function query( $input ); + + /** + * Escape string input for mysql query + * + * @param string $input String to escape + * @return string + */ + abstract public function escape( $input ); + + /** + * Return the error code for the most recent function call + * + * @return integer + */ + abstract public function errno(); + + /** + * Return a string description of the last error + * + * @return string + */ + abstract public function error(); + + /** + * Return server version + * + * @return string + */ + abstract public function version(); + + /** + * Return the result from MySQL query as associative array + * + * @param resource $result MySQL resource + * @return array + */ + abstract public function fetch_assoc( $result ); + + /** + * Return the result from MySQL query as row + * + * @param resource $result MySQL resource + * @return array + */ + abstract public function fetch_row( $result ); + + /** + * Return the number for rows from MySQL results + * + * @param resource $result MySQL resource + * @return integer + */ + abstract public function num_rows( $result ); + + /** + * Free MySQL result memory + * + * @param resource $result MySQL resource + * @return boolean + */ + abstract public function free_result( $result ); +} diff --git a/lib/vendor/servmask/filesystem/class-ai1wm-directory.php b/lib/vendor/servmask/filesystem/class-ai1wm-directory.php new file mode 100644 index 0000000..2c6814b --- /dev/null +++ b/lib/vendor/servmask/filesystem/class-ai1wm-directory.php @@ -0,0 +1,62 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Directory { + + /** + * Create directory (recursively) + * + * @param string $path Path to the directory + * @return boolean + */ + public static function create( $path ) { + return @mkdir( $path, 0777, true ); + } + + /** + * Delete directory (recursively) + * + * @param string $path Path to the directory + * @return boolean + */ + public static function delete( $path ) { + // Iterate over directory + $iterator = new Ai1wm_Recursive_Directory_Iterator( $path ); + + // Recursively iterate over directory + $iterator = new Ai1wm_Recursive_Iterator_Iterator( $iterator, RecursiveIteratorIterator::CHILD_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD ); + + // Remove files and directories + foreach ( $iterator as $item ) { + if ( $item->isDir() ) { + @rmdir( $item->getPathname() ); + } else { + @unlink( $item->getPathname() ); + } + } + + return @rmdir( $path ); + } +} diff --git a/lib/vendor/servmask/filesystem/class-ai1wm-file-htaccess.php b/lib/vendor/servmask/filesystem/class-ai1wm-file-htaccess.php new file mode 100644 index 0000000..c1247a5 --- /dev/null +++ b/lib/vendor/servmask/filesystem/class-ai1wm-file-htaccess.php @@ -0,0 +1,61 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_File_Htaccess { + + /** + * Create .htaccess file (ServMask) + * + * @param string $path Path to file + * @return boolean + */ + public static function create( $path ) { + return Ai1wm_File::create( $path, implode( PHP_EOL, array( + '', + 'AddType application/octet-stream .wpress', + '', + '', + 'DirectoryIndex index.php', + '', + '', + 'Options -Indexes', + '', + ) ) ); + } + + /** + * Create .htaccess file (LiteSpeed) + * + * @param string $path Path to file + * @return boolean + */ + public static function litespeed( $path ) { + return Ai1wm_File::create_with_markers( $path, 'LiteSpeed', array( + '', + 'SetEnv noabort 1', + '', + ) ); + } +} diff --git a/lib/vendor/servmask/filesystem/class-ai1wm-file-index.php b/lib/vendor/servmask/filesystem/class-ai1wm-file-index.php new file mode 100644 index 0000000..0ae333f --- /dev/null +++ b/lib/vendor/servmask/filesystem/class-ai1wm-file-index.php @@ -0,0 +1,37 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_File_Index { + + /** + * Create index.php file + * + * @param string $path Path to file + * @return boolean + */ + public static function create( $path ) { + return Ai1wm_File::create( $path, '. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_File_Webconfig { + + /** + * Create web.config file + * + * @param string $path Path to file + * @return boolean + */ + public static function create( $path ) { + return Ai1wm_File::create( $path, implode( PHP_EOL, array( + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + ) ) ); + } +} diff --git a/lib/vendor/servmask/filesystem/class-ai1wm-file.php b/lib/vendor/servmask/filesystem/class-ai1wm-file.php new file mode 100644 index 0000000..550334d --- /dev/null +++ b/lib/vendor/servmask/filesystem/class-ai1wm-file.php @@ -0,0 +1,71 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_File { + + /** + * Create a file with content + * + * @param string $path Path to the file + * @param string $content Content of the file + * @return boolean + */ + public static function create( $path, $content ) { + if ( ! @file_exists( $path ) ) { + if ( ! @is_writable( dirname( $path ) ) ) { + return false; + } + + if ( ! @touch( $path ) ) { + return false; + } + } elseif ( ! @is_writable( $path ) ) { + return false; + } + + $is_written = false; + if ( ( $handle = @fopen( $path, 'w' ) ) !== false ) { + if ( @fwrite( $handle, $content ) !== false ) { + $is_written = true; + } + + @fclose( $handle ); + } + + return $is_written; + } + + /** + * Create a file with marker and content + * + * @param string $path Path to the file + * @param string $marker Name of the marker + * @param string $content Content of the file + * @return boolean + */ + public static function create_with_markers( $path, $marker, $content ) { + return @insert_with_markers( $path, $marker, $content ); + } +} diff --git a/lib/vendor/servmask/filter/class-ai1wm-recursive-exclude-filter.php b/lib/vendor/servmask/filter/class-ai1wm-recursive-exclude-filter.php new file mode 100644 index 0000000..6f06de8 --- /dev/null +++ b/lib/vendor/servmask/filter/class-ai1wm-recursive-exclude-filter.php @@ -0,0 +1,44 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Recursive_Exclude_Filter extends RecursiveFilterIterator { + + protected $exclude = array(); + + public function __construct( RecursiveIterator $iterator, $exclude = array() ) { + parent::__construct( $iterator ); + + // Set exclude filter + $this->exclude = $exclude; + } + + public function accept() { + return ! in_array( $this->getInnerIterator()->getSubPathname(), $this->exclude ); + } + + public function getChildren() { + return new self( $this->getInnerIterator()->getChildren(), $this->exclude ); + } +} diff --git a/lib/vendor/servmask/filter/class-ai1wm-recursive-extension-filter.php b/lib/vendor/servmask/filter/class-ai1wm-recursive-extension-filter.php new file mode 100644 index 0000000..37772f8 --- /dev/null +++ b/lib/vendor/servmask/filter/class-ai1wm-recursive-extension-filter.php @@ -0,0 +1,50 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Recursive_Extension_Filter extends RecursiveFilterIterator { + + protected $include = array(); + + public function __construct( RecursiveIterator $iterator, $include = array() ) { + parent::__construct( $iterator ); + + // Set include filter + $this->include = $include; + } + + public function accept() { + if ( $this->getInnerIterator()->isFile() ) { + if ( ! in_array( pathinfo( $this->getInnerIterator()->getFilename(), PATHINFO_EXTENSION ), $this->include ) ) { + return false; + } + } + + return true; + } + + public function getChildren() { + return new self( $this->getInnerIterator()->getChildren(), $this->include ); + } +} diff --git a/lib/vendor/servmask/filter/class-ai1wm-recursive-newline-filter.php b/lib/vendor/servmask/filter/class-ai1wm-recursive-newline-filter.php new file mode 100644 index 0000000..65adf30 --- /dev/null +++ b/lib/vendor/servmask/filter/class-ai1wm-recursive-newline-filter.php @@ -0,0 +1,32 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Recursive_Newline_Filter extends RecursiveFilterIterator { + + public function accept() { + return strpos( $this->getInnerIterator()->getSubPathname(), "\n" ) === false && + strpos( $this->getInnerIterator()->getSubPathname(), "\r" ) === false; + } +} diff --git a/lib/vendor/servmask/iterator/class-ai1wm-recursive-directory-iterator.php b/lib/vendor/servmask/iterator/class-ai1wm-recursive-directory-iterator.php new file mode 100644 index 0000000..4c2114f --- /dev/null +++ b/lib/vendor/servmask/iterator/class-ai1wm-recursive-directory-iterator.php @@ -0,0 +1,66 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Recursive_Directory_Iterator extends RecursiveDirectoryIterator { + + public function __construct( $path ) { + parent::__construct( $path ); + + // Skip current and parent directory + $this->skipdots(); + } + + public function rewind() { + parent::rewind(); + + // Skip current and parent directory + $this->skipdots(); + } + + public function next() { + parent::next(); + + // Skip current and parent directory + $this->skipdots(); + } + + /** + * Returns whether current entry is a directory and not '.' or '..' + * + * Explicitly set allow links flag, because RecursiveDirectoryIterator::FOLLOW_SYMLINKS + * is not supported by <= PHP 5.3.0 + * + * @return bool + */ + public function hasChildren( $allow_links = true ) { + return parent::hasChildren( $allow_links ); + } + + protected function skipdots() { + while ( $this->isDot() ) { + parent::next(); + } + } +} diff --git a/lib/vendor/servmask/iterator/class-ai1wm-recursive-iterator-iterator.php b/lib/vendor/servmask/iterator/class-ai1wm-recursive-iterator-iterator.php new file mode 100644 index 0000000..6f12847 --- /dev/null +++ b/lib/vendor/servmask/iterator/class-ai1wm-recursive-iterator-iterator.php @@ -0,0 +1,28 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +class Ai1wm_Recursive_Iterator_Iterator extends RecursiveIteratorIterator { + +} diff --git a/lib/view/assets/css/backups.min.css b/lib/view/assets/css/backups.min.css new file mode 100644 index 0000000..5185118 --- /dev/null +++ b/lib/view/assets/css/backups.min.css @@ -0,0 +1 @@ +@charset "UTF-8";@-webkit-keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}to{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}to{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@-webkit-keyframes ai1wm-emphasize{0%,to{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@keyframes ai1wm-emphasize{0%,to{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@-webkit-keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}to{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}to{-webkit-transform:scale(1);transform:scale(1)}}.ai1wm-button-group{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;text-transform:uppercase;font-weight:600;transition:background-color .2s ease-out;display:inline-block;text-align:left}.ai1wm-button-group.ai1wm-button-export,.ai1wm-button-group.ai1wm-button-import{box-sizing:content-box}.ai1wm-button-group.ai1wm-button-export.ai1wm-open>.ai1wm-dropdown-menu{height:364px;border-top:1px solid #27ae60}.ai1wm-button-group.ai1wm-button-import.ai1wm-open>.ai1wm-dropdown-menu{height:392px;border-top:1px solid #27ae60}.ai1wm-button-group .ai1wm-button-main{position:relative;padding:6px 50px 6px 25px;box-sizing:content-box}.ai1wm-button-group .ai1wm-dropdown-menu{height:0;overflow:hidden;transition:height .2s cubic-bezier(.19,1,.22,1);border-top:none}.ai1wm-dropdown-menu{list-style:none}.ai1wm-dropdown-menu,.ai1wm-dropdown-menu li{margin:0!important;padding:0}.ai1wm-dropdown-menu li a,.ai1wm-dropdown-menu li a:visited{display:block;padding:5px 26px;text-decoration:none;color:#27ae60;text-align:left;box-sizing:content-box}.ai1wm-dropdown-menu li a:hover,.ai1wm-dropdown-menu li a:visited:hover{text-decoration:none;color:#111}.ai1mw-lines{position:absolute;width:12px;height:10px;top:9px;right:20px}.ai1wm-line{position:absolute;width:100%;height:2px;margin:auto;background:#27ae60;transition:all .2s ease-in-out}.ai1wm-line-first{top:0;left:0}div.ai1wm-open .ai1wm-line-first,div.ai1wm-open .ai1wm-line-third{top:50%}.ai1wm-line-second{top:50%;left:0}.ai1wm-line-third{top:100%;left:0}.ai1wm-button-blue,.ai1wm-button-gray,.ai1wm-button-green,.ai1wm-button-green-small,.ai1wm-button-red{display:inline-block;border:2px solid #95a5a6;background-color:transparent;color:#95a5a6;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:0;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-gray:hover{background-color:#95a5a6;color:#fff}.ai1wm-button-blue,.ai1wm-button-green,.ai1wm-button-green-small,.ai1wm-button-red{border:2px solid #27ae60;color:#27ae60}.ai1wm-button-green:hover{background-color:#27ae60;color:#fff}.ai1wm-button-blue,.ai1wm-button-green-small,.ai1wm-button-red{border:2px solid #6eb649;color:#6eb649}.ai1wm-button-green-small:hover{background-color:#6eb649;color:#fff}.ai1wm-button-blue,.ai1wm-button-red{border:2px solid #00aff0;color:#00aff0}.ai1wm-button-blue:hover{background-color:#00aff0;color:#fff}.ai1wm-button-red{border:2px solid #e74c3c;color:#e74c3c}.ai1wm-button-red:hover{background-color:#e74c3c;color:#fff}.ai1wm-button-blue[disabled=disabled],.ai1wm-button-green-small[disabled=disabled],.ai1wm-button-green[disabled=disabled],.ai1wm-button-red[disabled=disabled]{opacity:.6;cursor:default}.ai1wm-button-blue[disabled=disabled]:hover{color:#00aff0}.ai1wm-button-red[disabled=disabled]:hover{color:#e74c3c}.ai1wm-button-green[disabled=disabled]:hover{color:#27ae60}.ai1wm-button-blue[disabled=disabled]:hover,.ai1wm-button-green-small[disabled=disabled]:hover,.ai1wm-button-green[disabled=disabled]:hover,.ai1wm-button-red[disabled=disabled]:hover{background:0 0}.ai1wm-message-close-button{position:absolute;right:10px;top:6px;text-decoration:none;font-size:10px}input[type=radio].ai1wm-flat-radio-button{display:none}input[type=radio].ai1wm-flat-radio-button+a i,input[type=radio].ai1wm-flat-radio-button+label i{vertical-align:middle;float:left;width:25px;height:25px;border-radius:50%;background:0 0;border:2px solid #ccc;content:" ";cursor:pointer;position:relative;box-sizing:content-box}input[type=radio].ai1wm-flat-radio-button:checked+a i,input[type=radio].ai1wm-flat-radio-button:checked+label i{background-color:#d9d9d9;border-color:#6f6f6f}.ai1wm-clear{*zoom:1;clear:both}.ai1wm-clear:after,.ai1wm-clear:before{content:" ";display:table}.ai1wm-clear:after{clear:both}.ai1wm-container .ai1wm-row label{position:relative;top:-1px}.ai1wm-container .ai1wm-row label:after{content:"\200E"}.ai1wm-share-button-container{text-align:center}.ai1wm-share-button-container .ai1wm-share-button{text-decoration:none;margin:10px;font-size:30px}.ai1wm-report-problem{position:relative;float:right}.ai1wm-report-problem-dialog{position:absolute;z-index:999;width:280px;right:0;background-color:#fff;margin:6px 0 0;padding:15px 15px 10px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;display:none}.ai1wm-report-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-report-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-feedback-cancel:active,.ai1wm-feedback-cancel:link,.ai1wm-feedback-cancel:visited,.ai1wm-report-cancel:active,.ai1wm-report-cancel:link,.ai1wm-report-cancel:visited{float:left;line-height:34px;outline:0;text-decoration:none;color:#e74c3c}.ai1wm-form-submit{float:right}.ai1wm-report-active{display:block}.ai1wm-report-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-report-terms-segment>.ai1wm-report-terms{border-radius:3px}.ai1wm-import-info a,.ai1wm-no-underline{text-decoration:none}.ai1wm-top-negative-four{top:-4px}.ai1wm-feedback-form{display:none}.ai1wm-feedback-types{margin:0;padding:0;list-style:none}.ai1wm-feedback-types li{margin:14px 0;padding:0}.ai1wm-feedback-types>li>a>span,.ai1wm-feedback-types>li>label>span{display:inline-block;padding:5px 0 6px 8px}.ai1wm-feedback-types>li>a{height:29px;outline:0;color:#333;text-deciration:none}.ai1wm-loader{display:inline-block;width:128px;height:128px;position:relative;-webkit-animation:ai1wm-rotate 1.5s infinite linear;animation:ai1wm-rotate 1.5s infinite linear;background:url(../img/logo-128x128.png);background-repeat:no-repeat;background-position:center center}.ai1wm-hide{display:none}.ai1wm-label{border:1px solid #5cb85c;background-color:transparent;color:#5cb85c;cursor:pointer;text-transform:uppercase;font-weight:600;outline:0;transition:background-color .2s ease-out;padding:.2em .6em;font-size:.8em;border-radius:5px}.ai1wm-label:hover{background-color:#5cb85c;color:#fff}.ai1wm-dialog-message{text-align:left;line-height:1.5em}.ai1wm-import-info{display:inline-block;font-size:12px;font-weight:700;margin-top:16px}[class*=" ai1wm-icon-"],[class^=ai1wm-icon-]{font-family:'servmask';speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ai1wm-icon-file-zip:before{content:"\e60f"}.ai1wm-icon-folder:before{content:"\e60e"}.ai1wm-icon-file:before{content:"\e60b"}.ai1wm-icon-file-content:before{content:"\e60c"}.ai1wm-icon-cloud-upload:before{content:"\e600"}.ai1wm-icon-history:before{content:"\e603"}.ai1wm-icon-notification:before{content:"\e619"}.ai1wm-icon-arrow-down:before{content:"\e604"}.ai1wm-icon-close:before{content:"\e61a"}.ai1wm-icon-wordpress2:before{content:"\e620"}.ai1wm-icon-arrow-right:before{content:"\e605"}.ai1wm-icon-plus2:before{content:"\e607"}.ai1wm-icon-export:before{content:"\e601"}.ai1wm-icon-publish:before{content:"\e602"}.ai1wm-icon-paperplane:before{content:"\e608"}.ai1wm-icon-help:before{content:"\e609"}.ai1wm-icon-chevron-right:before{content:"\e60d"}.ai1wm-icon-dropbox:before{content:"\e606"}.ai1wm-icon-gear:before{content:"\e60a"}.ai1wm-icon-database:before{content:"\e964"}.ai1wm-icon-upload2:before{content:"\e9c6"}.ai1wm-icon-checkmark:before{content:"\ea10"}.ai1wm-icon-checkmark2:before{content:"\ea11"}.ai1wm-icon-enter:before{content:"\ea13"}.ai1wm-icon-exit:before{content:"\ea14"}.ai1wm-icon-amazon:before{content:"\ea87"}.ai1wm-icon-onedrive:before{content:"\eaaf"}@media (min-width:855px){.ai1wm-row{margin-right:399px}.ai1wm-row:after,.ai1wm-row:before{content:" ";display:table}.ai1wm-row:after{clear:both}.ai1wm-left{float:left;width:100%}.ai1wm-right{float:right;width:377px;margin-right:-399px}.ai1wm-right .ai1wm-sidebar{width:100%}.ai1wm-right .ai1wm-segment{width:333px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;color:#333;background-color:#f9f9f9;padding:20px;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box}.ai1wm-right .ai1wm-segment h2{margin:22px 0 0;padding:0;font-weight:700;font-size:14px;text-transform:uppercase;text-align:center}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-holder{position:relative;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-holder h1{float:left;font-weight:300;font-size:22px;text-transform:uppercase}.ai1wm-holder h1 i{position:relative;top:2px}@media (max-width:854px){.ai1wm-container{margin-left:10px!important}.ai1wm-right,.ai1wm-row{margin-right:0!important}.ai1wm-right{float:left!important;width:100%!important;margin-top:18px}.ai1wm-right .ai1wm-sidebar{width:auto!important;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px;border-radius:3px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-container{margin:20px 20px 0 2px}.ai1wm-container:after,.ai1wm-container:before{content:" ";display:table}.ai1wm-container:after{clear:both}.ai1wm-replace-row{width:100%;box-shadow:outset 0 1px 0 0 white;border-radius:3px;color:#333;font-size:11px;font-weight:700;background-color:#f9f9f9;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box;margin-bottom:10px}.ai1wm-field{margin-bottom:4px}.ai1wm-field input[type=text],.ai1wm-field textarea{width:100%;font-weight:400}.ai1wm-field-set{margin-top:18px}.ai1wm-message{-moz-box-sizing:border-box;background-color:#efefef;border-radius:4px;color:rgba(0,0,0,.6);height:auto;margin:10px 0;min-height:18px;padding:6px 10px;position:relative;border:1px solid;transition:opacity .1s ease 0s,color .1s ease 0s,background .1s ease 0s,box-shadow .1s ease 0s}.ai1wm-message.ai1wm-success-message{background-color:#f2f8f0;color:#119000;font-size:12px}.ai1wm-message.ai1wm-info-message{background-color:#d9edf7;color:#31708f;font-size:11px}.ai1wm-message.ai1wm-error-message{background-color:#f1d7d7;color:#a95252;font-size:12px}.ai1wm-message.ai1wm-red-message{color:#d95c5c;border:2px solid #d95c5c;background-color:transparent}.ai1wm-message.ai1wm-red-message h3{margin:.4em 0;color:#d95c5c}.ai1wm-message p{margin:4px 0;font-size:12px}.ai1wm-message-warning{display:block;font-size:14px;line-height:18px;padding:12px 20px;margin:0 0 22px;background-color:#f9f9f9;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;border-left:4px solid #ffba00}.ai1wm-overlay{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.7);z-index:100001}.ai1wm-modal-container{position:fixed;display:none;top:50%;left:50%;z-index:100002;width:480px;height:auto;padding:16px;-webkit-transform:translate(-240px,-94px);transform:translate(-240px,-94px);border:1px solid #fff;box-shadow:0 2px 6px #292929;border-radius:6px;background:#f6f6f6;box-sizing:border-box;text-align:center}.ai1wm-modal-container section{display:block;min-height:102px}.ai1wm-holder h1,.ai1wm-modal-container section h1{margin:0;padding:0}.ai1wm-modal-container section h1 .ai1wm-title-green{color:#27ae60;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-red{color:#e74c3c;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-grey{color:gray;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-loader{width:32px;height:32px;background:url(../img/logo-32x32.png)}.ai1wm-modal-container section h1 .ai1wm-icon-notification{font-size:1.2em;color:#e74c3c}.ai1wm-modal-container section p{margin:0;padding:12px 0}.ai1wm-modal-container section p .ai1wm-modal-sites p{padding:4px 10px;text-align:left}.ai1wm-modal-container section p .ai1wm-modal-sites input,.ai1wm-modal-container section p .ai1wm-modal-sites select{padding:0 6px;width:100%;border-radius:3px;height:30px;line-height:30px}.ai1wm-modal-container section p .ai1wm-modal-subtitle-green{color:#27ae60}.ai1wm-modal-container section p .ai1wm-modal-subtitle-red{color:#e74c3c}.ai1wm-modal-container section p .ai1wm-modal-subdescription{display:block;text-align:left}.ai1wm-modal-container section p a.ai1wm-button-green{display:inline-block;position:relative;top:26px}.ai1wm-modal-container section p a.ai1wm-emphasize{-webkit-animation:ai1wm-emphasize 1s infinite;animation:ai1wm-emphasize 1s infinite}.ai1wm-modal-container section p em{display:block;color:#34495e;font-style:normal}.ai1wm-modal-container section p.ai1wm-import-modal-content{text-align:left}.ai1wm-modal-container .ai1wm-import-modal-actions{border-top:1px solid #ccc;padding-top:1em;text-align:right}.ai1wm-modal-container .ai1wm-import-modal-actions .ai1wm-button-gray{margin-right:1em}.ai1wm-modal-container .ai1wm-import-modal-notice{border-top:1px solid #ccc}.ai1wm-modal-container .ai1wm-import-modal-notice p{font-weight:700;margin:0;padding-top:16px;text-align:center}#ai1wm-backup-progress,#ai1wm-backup-progress-bar{background-color:#dfdfdf;height:20px;width:350px;border-radius:15px}#ai1wm-backup-progress-bar{background-color:#00aff0;line-height:20px;color:#fff;width:0;text-align:center}.ai1wm-backups{width:100%;margin:1em 0 2em;padding:0;border-collapse:collapse}.ai1wm-backups .ai1wm-column-name{text-align:left;word-wrap:break-all}.ai1wm-backups .ai1wm-column-date,.ai1wm-backups .ai1wm-column-size{text-align:center;white-space:nowrap}.ai1wm-backups .ai1wm-column-actions{text-align:right;white-space:nowrap}.ai1wm-backups thead th{padding:4px 6px;text-align:left;font-size:1.2em}.ai1wm-backups tbody tr:first-child{border-top:1px solid #ccc}.ai1wm-backups tbody tr{border-bottom:1px solid #ccc}.ai1wm-backups tbody tr:hover{background:rgba(0,0,0,.1)}.ai1wm-backups tbody td{padding:4px 6px;box-sizing:border-box;line-height:24px}.ai1wm-backups tbody td.ai1wm-backup-actions{text-align:right;width:250px}.ai1wm-backups tbody td.ai1wm-backup-actions span{transition:width 2s cubic-bezier(.19,1,.22,1);display:inline-block;width:0;text-align:center;visibility:hidden}.ai1wm-backups tbody td.ai1wm-backup-actions .ai1wm-backup-delete,.ai1wm-backups tbody td.ai1wm-backup-actions .ai1wm-backup-download,.ai1wm-backups tbody td.ai1wm-backup-actions .ai1wm-backup-restore{border-radius:50px;margin:0 2px;padding:4px 8px}.ai1wm-backups tbody td.ai1wm-backup-actions .ai1wm-button-on span{width:80px;visibility:visible}.ai1wm-backups-empty{line-height:2em} \ No newline at end of file diff --git a/lib/view/assets/css/backups.min.rtl.css b/lib/view/assets/css/backups.min.rtl.css new file mode 100644 index 0000000..9e8536a --- /dev/null +++ b/lib/view/assets/css/backups.min.rtl.css @@ -0,0 +1 @@ +@charset "UTF-8";@-webkit-keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(90deg);transform:rotateZ(90deg)}50%{-webkit-transform:rotateZ(180deg);transform:rotateZ(180deg)}75%{-webkit-transform:rotateZ(270deg);transform:rotateZ(270deg)}to{-webkit-transform:rotateZ(360deg);transform:rotateZ(360deg)}}@keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(90deg);transform:rotateZ(90deg)}50%{-webkit-transform:rotateZ(180deg);transform:rotateZ(180deg)}75%{-webkit-transform:rotateZ(270deg);transform:rotateZ(270deg)}to{-webkit-transform:rotateZ(360deg);transform:rotateZ(360deg)}}@-webkit-keyframes ai1wm-emphasize{0%,to{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@keyframes ai1wm-emphasize{0%,to{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@-webkit-keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}to{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}to{-webkit-transform:scale(1);transform:scale(1)}}.ai1wm-button-group{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;text-transform:uppercase;font-weight:600;transition:background-color .2s ease-out;display:inline-block;text-align:right}.ai1wm-button-group.ai1wm-button-export,.ai1wm-button-group.ai1wm-button-import{box-sizing:content-box}.ai1wm-button-group.ai1wm-button-export.ai1wm-open>.ai1wm-dropdown-menu{height:364px;border-top:1px solid #27ae60}.ai1wm-button-group.ai1wm-button-import.ai1wm-open>.ai1wm-dropdown-menu{height:392px;border-top:1px solid #27ae60}.ai1wm-button-group .ai1wm-button-main{position:relative;padding:6px 25px 6px 50px;box-sizing:content-box}.ai1wm-button-group .ai1wm-dropdown-menu{height:0;overflow:hidden;transition:height .2s cubic-bezier(.19,1,.22,1);border-top:none}.ai1wm-dropdown-menu{list-style:none}.ai1wm-dropdown-menu,.ai1wm-dropdown-menu li{margin:0!important;padding:0}.ai1wm-dropdown-menu li a,.ai1wm-dropdown-menu li a:visited{display:block;padding:5px 26px;text-decoration:none;color:#27ae60;text-align:right;box-sizing:content-box}.ai1wm-dropdown-menu li a:hover,.ai1wm-dropdown-menu li a:visited:hover{text-decoration:none;color:#111}.ai1mw-lines{position:absolute;width:12px;height:10px;top:9px;left:20px}.ai1wm-line{position:absolute;width:100%;height:2px;margin:auto;background:#27ae60;transition:all .2s ease-in-out}.ai1wm-line-first{top:0;right:0}div.ai1wm-open .ai1wm-line-first,div.ai1wm-open .ai1wm-line-third{top:50%}.ai1wm-line-second{top:50%;right:0}.ai1wm-line-third{top:100%;right:0}.ai1wm-button-blue,.ai1wm-button-gray,.ai1wm-button-green,.ai1wm-button-green-small,.ai1wm-button-red{display:inline-block;border:2px solid #95a5a6;background-color:transparent;color:#95a5a6;border-radius:5px;cursor:pointer;padding:5px 26px 5px 25px;text-transform:uppercase;font-weight:600;outline:0;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-gray:hover{background-color:#95a5a6;color:#fff}.ai1wm-button-blue,.ai1wm-button-green,.ai1wm-button-green-small,.ai1wm-button-red{border:2px solid #27ae60;color:#27ae60}.ai1wm-button-green:hover{background-color:#27ae60;color:#fff}.ai1wm-button-blue,.ai1wm-button-green-small,.ai1wm-button-red{border:2px solid #6eb649;color:#6eb649}.ai1wm-button-green-small:hover{background-color:#6eb649;color:#fff}.ai1wm-button-blue,.ai1wm-button-red{border:2px solid #00aff0;color:#00aff0}.ai1wm-button-blue:hover{background-color:#00aff0;color:#fff}.ai1wm-button-red{border:2px solid #e74c3c;color:#e74c3c}.ai1wm-button-red:hover{background-color:#e74c3c;color:#fff}.ai1wm-button-blue[disabled=disabled],.ai1wm-button-green-small[disabled=disabled],.ai1wm-button-green[disabled=disabled],.ai1wm-button-red[disabled=disabled]{opacity:.6;cursor:default}.ai1wm-button-blue[disabled=disabled]:hover{color:#00aff0}.ai1wm-button-red[disabled=disabled]:hover{color:#e74c3c}.ai1wm-button-green[disabled=disabled]:hover{color:#27ae60}.ai1wm-button-blue[disabled=disabled]:hover,.ai1wm-button-green-small[disabled=disabled]:hover,.ai1wm-button-green[disabled=disabled]:hover,.ai1wm-button-red[disabled=disabled]:hover{background:100% 0}.ai1wm-message-close-button{position:absolute;left:10px;top:6px;text-decoration:none;font-size:10px}input[type=radio].ai1wm-flat-radio-button{display:none}input[type=radio].ai1wm-flat-radio-button+a i,input[type=radio].ai1wm-flat-radio-button+label i{vertical-align:middle;float:right;width:25px;height:25px;border-radius:50%;background:100% 0;border:2px solid #ccc;content:" ";cursor:pointer;position:relative;box-sizing:content-box}input[type=radio].ai1wm-flat-radio-button:checked+a i,input[type=radio].ai1wm-flat-radio-button:checked+label i{background-color:#d9d9d9;border-color:#6f6f6f}.ai1wm-clear{*zoom:1;clear:both}.ai1wm-clear:after,.ai1wm-clear:before{content:" ";display:table}.ai1wm-clear:after{clear:both}.ai1wm-container .ai1wm-row label{position:relative;top:-1px}.ai1wm-container .ai1wm-row label:after{content:"\200E"}.ai1wm-share-button-container{text-align:center}.ai1wm-share-button-container .ai1wm-share-button{text-decoration:none;margin:10px;font-size:30px}.ai1wm-report-problem{position:relative;float:left}.ai1wm-report-problem-dialog{position:absolute;z-index:999;width:280px;left:0;background-color:#fff;margin:6px 0 0;padding:15px 15px 10px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;display:none}.ai1wm-report-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-report-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-feedback-cancel:active,.ai1wm-feedback-cancel:link,.ai1wm-feedback-cancel:visited,.ai1wm-report-cancel:active,.ai1wm-report-cancel:link,.ai1wm-report-cancel:visited{float:right;line-height:34px;outline:0;text-decoration:none;color:#e74c3c}.ai1wm-form-submit{float:left}.ai1wm-report-active{display:block}.ai1wm-report-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-report-terms-segment>.ai1wm-report-terms{border-radius:3px}.ai1wm-import-info a,.ai1wm-no-underline{text-decoration:none}.ai1wm-top-negative-four{top:-4px}.ai1wm-feedback-form{display:none}.ai1wm-feedback-types{margin:0;padding:0;list-style:none}.ai1wm-feedback-types li{margin:14px 0;padding:0}.ai1wm-feedback-types>li>a>span,.ai1wm-feedback-types>li>label>span{display:inline-block;padding:5px 8px 6px 0}.ai1wm-feedback-types>li>a{height:29px;outline:0;color:#333;text-deciration:none}.ai1wm-loader{display:inline-block;width:128px;height:128px;position:relative;-webkit-animation:ai1wm-rotate 1.5s infinite linear;animation:ai1wm-rotate 1.5s infinite linear;background:url(../img/logo-128x128.png);background-repeat:no-repeat;background-position:center center}.ai1wm-hide{display:none}.ai1wm-label{border:1px solid #5cb85c;background-color:transparent;color:#5cb85c;cursor:pointer;text-transform:uppercase;font-weight:600;outline:0;transition:background-color .2s ease-out;padding:.2em .6em;font-size:.8em;border-radius:5px}.ai1wm-label:hover{background-color:#5cb85c;color:#fff}.ai1wm-dialog-message{text-align:right;line-height:1.5em}.ai1wm-import-info{display:inline-block;font-size:12px;font-weight:700;margin-top:16px}[class*=" ai1wm-icon-"],[class^=ai1wm-icon-]{font-family:'servmask';speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ai1wm-icon-file-zip:before{content:"\e60f"}.ai1wm-icon-folder:before{content:"\e60e"}.ai1wm-icon-file:before{content:"\e60b"}.ai1wm-icon-file-content:before{content:"\e60c"}.ai1wm-icon-cloud-upload:before{content:"\e600"}.ai1wm-icon-history:before{content:"\e603"}.ai1wm-icon-notification:before{content:"\e619"}.ai1wm-icon-arrow-down:before{content:"\e604"}.ai1wm-icon-close:before{content:"\e61a"}.ai1wm-icon-wordpress2:before{content:"\e620"}.ai1wm-icon-arrow-right:before{content:"\e605"}.ai1wm-icon-plus2:before{content:"\e607"}.ai1wm-icon-export:before{content:"\e601"}.ai1wm-icon-publish:before{content:"\e602"}.ai1wm-icon-paperplane:before{content:"\e608"}.ai1wm-icon-help:before{content:"\e609"}.ai1wm-icon-chevron-right:before{content:"\e60d"}.ai1wm-icon-dropbox:before{content:"\e606"}.ai1wm-icon-gear:before{content:"\e60a"}.ai1wm-icon-database:before{content:"\e964"}.ai1wm-icon-upload2:before{content:"\e9c6"}.ai1wm-icon-checkmark:before{content:"\ea10"}.ai1wm-icon-checkmark2:before{content:"\ea11"}.ai1wm-icon-enter:before{content:"\ea13"}.ai1wm-icon-exit:before{content:"\ea14"}.ai1wm-icon-amazon:before{content:"\ea87"}.ai1wm-icon-onedrive:before{content:"\eaaf"}@media (min-width:855px){.ai1wm-row{margin-left:399px}.ai1wm-row:after,.ai1wm-row:before{content:" ";display:table}.ai1wm-row:after{clear:both}.ai1wm-left{float:right;width:100%}.ai1wm-right{float:left;width:377px;margin-left:-399px}.ai1wm-right .ai1wm-sidebar{width:100%}.ai1wm-right .ai1wm-segment{width:333px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;color:#333;background-color:#f9f9f9;padding:20px;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box}.ai1wm-right .ai1wm-segment h2{margin:22px 0 0;padding:0;font-weight:700;font-size:14px;text-transform:uppercase;text-align:center}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-holder{position:relative;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-holder h1{float:right;font-weight:300;font-size:22px;text-transform:uppercase}.ai1wm-holder h1 i{position:relative;top:2px}@media (max-width:854px){.ai1wm-container{margin-right:10px!important}.ai1wm-right,.ai1wm-row{margin-left:0!important}.ai1wm-right{float:right!important;width:100%!important;margin-top:18px}.ai1wm-right .ai1wm-sidebar{width:auto!important;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px;border-radius:3px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-container{margin:20px 2px 0 20px}.ai1wm-container:after,.ai1wm-container:before{content:" ";display:table}.ai1wm-container:after{clear:both}.ai1wm-replace-row{width:100%;box-shadow:outset 0 1px 0 0 white;border-radius:3px;color:#333;font-size:11px;font-weight:700;background-color:#f9f9f9;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box;margin-bottom:10px}.ai1wm-field{margin-bottom:4px}.ai1wm-field input[type=text],.ai1wm-field textarea{width:100%;font-weight:400}.ai1wm-field-set{margin-top:18px}.ai1wm-message{-moz-box-sizing:border-box;background-color:#efefef;border-radius:4px;color:rgba(0,0,0,.6);height:auto;margin:10px 0;min-height:18px;padding:6px 10px;position:relative;border:1px solid;transition:opacity .1s ease 0s,color .1s ease 0s,background .1s ease 0s,box-shadow .1s ease 0s}.ai1wm-message.ai1wm-success-message{background-color:#f2f8f0;color:#119000;font-size:12px}.ai1wm-message.ai1wm-info-message{background-color:#d9edf7;color:#31708f;font-size:11px}.ai1wm-message.ai1wm-error-message{background-color:#f1d7d7;color:#a95252;font-size:12px}.ai1wm-message.ai1wm-red-message{color:#d95c5c;border:2px solid #d95c5c;background-color:transparent}.ai1wm-message.ai1wm-red-message h3{margin:.4em 0;color:#d95c5c}.ai1wm-message p{margin:4px 0;font-size:12px}.ai1wm-message-warning{display:block;font-size:14px;line-height:18px;padding:12px 20px;margin:0 0 22px;background-color:#f9f9f9;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;border-right:4px solid #ffba00}.ai1wm-overlay{display:none;position:fixed;top:0;right:0;width:100%;height:100%;background-color:rgba(0,0,0,.7);z-index:100001}.ai1wm-modal-container{position:fixed;display:none;top:50%;right:50%;z-index:100002;width:480px;height:auto;padding:16px;-webkit-transform:translate(240px,-94px);transform:translate(240px,-94px);border:1px solid #fff;box-shadow:0 2px 6px #292929;border-radius:6px;background:#f6f6f6;box-sizing:border-box;text-align:center}.ai1wm-modal-container section{display:block;min-height:102px}.ai1wm-holder h1,.ai1wm-modal-container section h1{margin:0;padding:0}.ai1wm-modal-container section h1 .ai1wm-title-green{color:#27ae60;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-red{color:#e74c3c;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-grey{color:gray;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-loader{width:32px;height:32px;background:url(../img/logo-32x32.png)}.ai1wm-modal-container section h1 .ai1wm-icon-notification{font-size:1.2em;color:#e74c3c}.ai1wm-modal-container section p{margin:0;padding:12px 0}.ai1wm-modal-container section p .ai1wm-modal-sites p{padding:4px 10px;text-align:right}.ai1wm-modal-container section p .ai1wm-modal-sites input,.ai1wm-modal-container section p .ai1wm-modal-sites select{padding:0 6px;width:100%;border-radius:3px;height:30px;line-height:30px}.ai1wm-modal-container section p .ai1wm-modal-subtitle-green{color:#27ae60}.ai1wm-modal-container section p .ai1wm-modal-subtitle-red{color:#e74c3c}.ai1wm-modal-container section p .ai1wm-modal-subdescription{display:block;text-align:right}.ai1wm-modal-container section p a.ai1wm-button-green{display:inline-block;position:relative;top:26px}.ai1wm-modal-container section p a.ai1wm-emphasize{-webkit-animation:ai1wm-emphasize 1s infinite;animation:ai1wm-emphasize 1s infinite}.ai1wm-modal-container section p em{display:block;color:#34495e;font-style:normal}.ai1wm-modal-container section p.ai1wm-import-modal-content{text-align:right}.ai1wm-modal-container .ai1wm-import-modal-actions{border-top:1px solid #ccc;padding-top:1em;text-align:left}.ai1wm-modal-container .ai1wm-import-modal-actions .ai1wm-button-gray{margin-left:1em}.ai1wm-modal-container .ai1wm-import-modal-notice{border-top:1px solid #ccc}.ai1wm-modal-container .ai1wm-import-modal-notice p{font-weight:700;margin:0;padding-top:16px;text-align:center}#ai1wm-backup-progress,#ai1wm-backup-progress-bar{background-color:#dfdfdf;height:20px;width:350px;border-radius:15px}#ai1wm-backup-progress-bar{background-color:#00aff0;line-height:20px;color:#fff;width:0;text-align:center}.ai1wm-backups{width:100%;margin:1em 0 2em;padding:0;border-collapse:collapse}.ai1wm-backups .ai1wm-column-name{text-align:right;word-wrap:break-all}.ai1wm-backups .ai1wm-column-date,.ai1wm-backups .ai1wm-column-size{text-align:center;white-space:nowrap}.ai1wm-backups .ai1wm-column-actions{text-align:left;white-space:nowrap}.ai1wm-backups thead th{padding:4px 6px;text-align:right;font-size:1.2em}.ai1wm-backups tbody tr:first-child{border-top:1px solid #ccc}.ai1wm-backups tbody tr{border-bottom:1px solid #ccc}.ai1wm-backups tbody tr:hover{background:rgba(0,0,0,.1)}.ai1wm-backups tbody td{padding:4px 6px;box-sizing:border-box;line-height:24px}.ai1wm-backups tbody td.ai1wm-backup-actions{text-align:left;width:250px}.ai1wm-backups tbody td.ai1wm-backup-actions span{transition:width 2s cubic-bezier(.19,1,.22,1);display:inline-block;width:0;text-align:center;visibility:hidden}.ai1wm-backups tbody td.ai1wm-backup-actions .ai1wm-backup-delete,.ai1wm-backups tbody td.ai1wm-backup-actions .ai1wm-backup-download,.ai1wm-backups tbody td.ai1wm-backup-actions .ai1wm-backup-restore{border-radius:50px;margin:0 2px;padding:4px 8px}.ai1wm-backups tbody td.ai1wm-backup-actions .ai1wm-button-on span{width:80px;visibility:visible}.ai1wm-backups-empty{line-height:2em} \ No newline at end of file diff --git a/lib/view/assets/css/common.min.css b/lib/view/assets/css/common.min.css new file mode 100644 index 0000000..c3dee72 --- /dev/null +++ b/lib/view/assets/css/common.min.css @@ -0,0 +1 @@ +@charset "UTF-8";@-webkit-keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}to{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}to{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@-webkit-keyframes ai1wm-emphasize{0%,to{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@keyframes ai1wm-emphasize{0%,to{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@-webkit-keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}to{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}to{-webkit-transform:scale(1);transform:scale(1)}}[class*=" ai1wm-icon-"],[class^=ai1wm-icon-]{font-family:'servmask';speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ai1wm-icon-file-zip:before{content:"\e60f"}.ai1wm-icon-folder:before{content:"\e60e"}.ai1wm-icon-file:before{content:"\e60b"}.ai1wm-icon-file-content:before{content:"\e60c"}.ai1wm-icon-cloud-upload:before{content:"\e600"}.ai1wm-icon-history:before{content:"\e603"}.ai1wm-icon-notification:before{content:"\e619"}.ai1wm-icon-arrow-down:before{content:"\e604"}.ai1wm-icon-close:before{content:"\e61a"}.ai1wm-icon-wordpress2:before{content:"\e620"}.ai1wm-icon-arrow-right:before{content:"\e605"}.ai1wm-icon-plus2:before{content:"\e607"}.ai1wm-icon-export:before{content:"\e601"}.ai1wm-icon-publish:before{content:"\e602"}.ai1wm-icon-paperplane:before{content:"\e608"}.ai1wm-icon-help:before{content:"\e609"}.ai1wm-icon-chevron-right:before{content:"\e60d"}.ai1wm-icon-dropbox:before{content:"\e606"}.ai1wm-icon-gear:before{content:"\e60a"}.ai1wm-icon-database:before{content:"\e964"}.ai1wm-icon-upload2:before{content:"\e9c6"}.ai1wm-icon-checkmark:before{content:"\ea10"}.ai1wm-icon-checkmark2:before{content:"\ea11"}.ai1wm-icon-enter:before{content:"\ea13"}.ai1wm-icon-exit:before{content:"\ea14"}.ai1wm-icon-amazon:before{content:"\ea87"}.ai1wm-icon-onedrive:before{content:"\eaaf"}.ai1wm-icon-alone{margin:0!important}@media (min-width:855px){.ai1wm-row{margin-right:399px}.ai1wm-row:after,.ai1wm-row:before{content:" ";display:table}.ai1wm-row:after{clear:both}.ai1wm-left{float:left;width:100%}.ai1wm-right{float:right;width:377px;margin-right:-399px}.ai1wm-right .ai1wm-sidebar{width:100%}.ai1wm-right .ai1wm-segment{width:333px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;color:#333;background-color:#f9f9f9;padding:20px;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box}.ai1wm-right .ai1wm-segment h2{margin:22px 0 0;padding:0;font-weight:700;font-size:14px;text-transform:uppercase;text-align:center}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-holder{position:relative;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-holder h1{margin:0;padding:0;float:left;font-weight:300;font-size:22px;text-transform:uppercase}.ai1wm-holder h1 i{position:relative;top:2px}@media (max-width:854px){.ai1wm-container{margin-left:10px!important}.ai1wm-right,.ai1wm-row{margin-right:0!important}.ai1wm-right{float:left!important;width:100%!important;margin-top:18px}.ai1wm-right .ai1wm-sidebar{width:auto!important;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px;border-radius:3px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-container{margin:20px 20px 0 2px}.ai1wm-container:after,.ai1wm-container:before{content:" ";display:table}.ai1wm-container:after{clear:both}.ai1wm-replace-row{width:100%;box-shadow:outset 0 1px 0 0 white;border-radius:3px;color:#333;font-size:11px;font-weight:700;background-color:#f9f9f9;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box;margin-bottom:10px}.ai1wm-field{margin-bottom:4px}.ai1wm-field input[type=text],.ai1wm-field textarea{width:100%;font-weight:400}.ai1wm-field-set{margin-top:18px}.ai1wm-message{-moz-box-sizing:border-box;background-color:#efefef;border-radius:4px;color:rgba(0,0,0,.6);height:auto;margin:10px 0;min-height:18px;padding:6px 10px;position:relative;border:1px solid;transition:opacity .1s ease 0s,color .1s ease 0s,background .1s ease 0s,box-shadow .1s ease 0s}.ai1wm-message.ai1wm-success-message{background-color:#f2f8f0;color:#119000;font-size:12px}.ai1wm-message.ai1wm-info-message{background-color:#d9edf7;color:#31708f;font-size:11px}.ai1wm-message.ai1wm-error-message{background-color:#f1d7d7;color:#a95252;font-size:12px}.ai1wm-message.ai1wm-red-message{color:#d95c5c;border:2px solid #d95c5c;background-color:transparent}.ai1wm-message.ai1wm-red-message h3{margin:.4em 0;color:#d95c5c}.ai1wm-message p{margin:4px 0;font-size:12px}.ai1wm-message-warning{display:block;font-size:14px;line-height:18px;padding:12px 20px;margin:0 0 22px;background-color:#f9f9f9;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;border-left:4px solid #ffba00}.ai1wm-button-group{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;text-transform:uppercase;font-weight:600;transition:background-color .2s ease-out;display:inline-block;text-align:left}.ai1wm-button-group.ai1wm-button-export,.ai1wm-button-group.ai1wm-button-import{box-sizing:content-box}.ai1wm-button-group.ai1wm-button-export.ai1wm-open>.ai1wm-dropdown-menu{height:260px;border-top:1px solid #27ae60}.ai1wm-button-group.ai1wm-button-import.ai1wm-open>.ai1wm-dropdown-menu{height:288px;border-top:1px solid #27ae60}.ai1wm-button-group .ai1wm-button-main{position:relative;padding:6px 50px 6px 25px;box-sizing:content-box}.ai1wm-button-group .ai1wm-dropdown-menu{height:0;overflow:hidden;transition:height .2s cubic-bezier(.19,1,.22,1);border-top:none}.ai1wm-dropdown-menu{list-style:none}.ai1wm-dropdown-menu,.ai1wm-dropdown-menu li{margin:0!important;padding:0}.ai1wm-dropdown-menu li a,.ai1wm-dropdown-menu li a:visited{display:block;margin:10px 0;padding:0 26px;text-decoration:none;color:#27ae60;text-align:left;box-sizing:content-box}.ai1wm-dropdown-menu li a:hover,.ai1wm-dropdown-menu li a:visited:hover{text-decoration:none;color:#111}.ai1mw-lines,.ai1wm-line{display:inline-block;position:absolute}.ai1mw-lines{top:9px;right:20px;width:12px;height:10px}.ai1wm-line{width:100%;height:2px;margin:auto;background:#27ae60;transition:all .2s ease-in-out}.ai1wm-line-first{top:0;left:0}div.ai1wm-open .ai1wm-line-first,div.ai1wm-open .ai1wm-line-third{top:50%}.ai1wm-line-second{top:50%;left:0}.ai1wm-line-third{top:100%;left:0}.ai1wm-button-blue,.ai1wm-button-gray,.ai1wm-button-green,.ai1wm-button-green-small,.ai1wm-button-red{border:2px solid #95a5a6;background-color:transparent;color:#95a5a6;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:0;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-gray:hover{background-color:#95a5a6;color:#fff}.ai1wm-button-blue,.ai1wm-button-green,.ai1wm-button-green-small,.ai1wm-button-red{border:2px solid #27ae60;color:#27ae60}.ai1wm-button-green:hover{background-color:#27ae60;color:#fff}.ai1wm-button-blue,.ai1wm-button-green-small,.ai1wm-button-red{border:2px solid #6eb649;color:#6eb649}.ai1wm-button-green-small:hover{background-color:#6eb649;color:#fff}.ai1wm-button-blue,.ai1wm-button-red{border:2px solid #00aff0;color:#00aff0}.ai1wm-button-blue:hover{background-color:#00aff0;color:#fff}.ai1wm-button-red{border:2px solid #e74c3c;color:#e74c3c}.ai1wm-button-red:hover{background-color:#e74c3c;color:#fff}.ai1wm-button-alone{border-radius:50px!important;padding:5px 8px!important}.ai1wm-button-blue[disabled=disabled],.ai1wm-button-green-small[disabled=disabled],.ai1wm-button-green[disabled=disabled],.ai1wm-button-red[disabled=disabled]{opacity:.6;cursor:default}.ai1wm-button-blue[disabled=disabled]:hover{color:#00aff0}.ai1wm-button-red[disabled=disabled]:hover{color:#e74c3c}.ai1wm-button-green[disabled=disabled]:hover{color:#27ae60}.ai1wm-button-blue[disabled=disabled]:hover,.ai1wm-button-green-small[disabled=disabled]:hover,.ai1wm-button-green[disabled=disabled]:hover,.ai1wm-button-red[disabled=disabled]:hover{background:0 0}.ai1wm-button-blue i,.ai1wm-button-gray i,.ai1wm-button-green i,.ai1wm-button-red i{margin-left:-.5em;margin-right:.2em}.ai1wm-message-close-button{position:absolute;right:10px;top:6px;text-decoration:none;font-size:10px}input[type=radio].ai1wm-flat-radio-button{display:none}input[type=radio].ai1wm-flat-radio-button+a i,input[type=radio].ai1wm-flat-radio-button+label i{vertical-align:middle;float:left;width:25px;height:25px;border-radius:50%;background:0 0;border:2px solid #ccc;content:" ";cursor:pointer;position:relative;box-sizing:content-box}input[type=radio].ai1wm-flat-radio-button:checked+a i,input[type=radio].ai1wm-flat-radio-button:checked+label i{background-color:#d9d9d9;border-color:#6f6f6f}.ai1wm-clear{*zoom:1;clear:both}.ai1wm-clear:after,.ai1wm-clear:before{content:" ";display:table}.ai1wm-clear:after{clear:both}.ai1wm-container .ai1wm-row label{position:relative;top:-1px}.ai1wm-share-button-container{text-align:center}.ai1wm-share-button-container .ai1wm-share-button{text-decoration:none;margin:10px;font-size:30px}.ai1wm-report-problem{position:relative;float:right}.ai1wm-report-problem-dialog{position:absolute;z-index:999;width:280px;right:0;background-color:#fff;margin:6px 0 0;padding:15px 15px 10px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;display:none}.ai1wm-report-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-report-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-feedback-cancel:active,.ai1wm-feedback-cancel:link,.ai1wm-feedback-cancel:visited,.ai1wm-report-cancel:active,.ai1wm-report-cancel:link,.ai1wm-report-cancel:visited{float:left;line-height:34px;outline:0;text-decoration:none;color:#e74c3c}.ai1wm-form-submit{float:right}.ai1wm-report-active{display:block}.ai1wm-report-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-report-terms-segment>.ai1wm-report-terms{border-radius:3px}.ai1wm-import-info a,.ai1wm-no-underline{text-decoration:none}.ai1wm-top-negative-four{top:-4px}.ai1wm-feedback-form{display:none}.ai1wm-feedback-types{margin:0;padding:0;list-style:none}.ai1wm-feedback-types li{margin:14px 0;padding:0}.ai1wm-feedback-types>li>a>span,.ai1wm-feedback-types>li>label>span{display:inline-block;padding:5px 0 6px 8px}.ai1wm-feedback-types>li>a{height:29px;outline:0;color:#333;text-deciration:none}.ai1wm-loader{display:inline-block;width:128px;height:128px;position:relative;-webkit-animation:ai1wm-rotate 1.5s infinite linear;animation:ai1wm-rotate 1.5s infinite linear;background:url(../img/logo-128x128.png);background-repeat:no-repeat;background-position:center center}.ai1wm-hide{display:none}.ai1wm-label{border:1px solid #5cb85c;background-color:transparent;color:#5cb85c;cursor:pointer;text-transform:uppercase;font-weight:600;outline:0;transition:background-color .2s ease-out;padding:.2em .6em;font-size:.8em;border-radius:5px}.ai1wm-label:hover{background-color:#5cb85c;color:#fff}.ai1wm-dialog-message{text-align:left;line-height:1.5em}.ai1wm-import-info{display:inline-block;font-size:12px;font-weight:700;margin-top:16px} \ No newline at end of file diff --git a/lib/view/assets/css/export.min.css b/lib/view/assets/css/export.min.css new file mode 100644 index 0000000..296b4e3 --- /dev/null +++ b/lib/view/assets/css/export.min.css @@ -0,0 +1 @@ +@charset "UTF-8";@-webkit-keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}to{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}to{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@-webkit-keyframes ai1wm-emphasize{0%,to{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@keyframes ai1wm-emphasize{0%,to{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@-webkit-keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}to{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}to{-webkit-transform:scale(1);transform:scale(1)}}.ai1wm-accordion{margin:1em 0;display:block}.ai1wm-accordion h4{cursor:pointer;color:rgba(0,116,162,.8);margin:0}.ai1wm-accordion h4 small{color:#444;font-weight:400}.ai1wm-accordion h4 small:after,.ai1wm-container .ai1wm-row label:after{content:"\200E"}.ai1wm-accordion .ai1wm-icon-arrow-right{transition:transform .1s ease-out;transition:transform .1s ease-out,-webkit-transform .1s ease-out;display:inline-block}.ai1wm-accordion ul{margin:0;padding:0;list-style:none;visibility:hidden;height:0;transition:height .2s cubic-bezier(.19,1,.22,1)}.ai1wm-accordion h4 small,.ai1wm-accordion ul li small{display:inline;float:none;width:auto}.ai1wm-accordion.ai1wm-open h4 .ai1wm-icon-arrow-right{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.ai1wm-accordion.ai1wm-open ul{height:auto;margin:.6em 0 0 2em;visibility:visible}.ai1wm-button-group{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;text-transform:uppercase;font-weight:600;transition:background-color .2s ease-out;display:inline-block;text-align:left}.ai1wm-button-group.ai1wm-button-export,.ai1wm-button-group.ai1wm-button-import{box-sizing:content-box}.ai1wm-button-group.ai1wm-button-export.ai1wm-open>.ai1wm-dropdown-menu{height:364px;border-top:1px solid #27ae60}.ai1wm-button-group.ai1wm-button-import.ai1wm-open>.ai1wm-dropdown-menu{height:392px;border-top:1px solid #27ae60}.ai1wm-button-group .ai1wm-button-main{position:relative;padding:6px 50px 6px 25px;box-sizing:content-box}.ai1wm-button-group .ai1wm-dropdown-menu{height:0;overflow:hidden;transition:height .2s cubic-bezier(.19,1,.22,1);border-top:none}.ai1wm-dropdown-menu{list-style:none}.ai1wm-dropdown-menu,.ai1wm-dropdown-menu li{margin:0!important;padding:0}.ai1wm-dropdown-menu li a,.ai1wm-dropdown-menu li a:visited{display:block;padding:5px 26px;text-decoration:none;color:#27ae60;text-align:left;box-sizing:content-box}.ai1wm-dropdown-menu li a:hover,.ai1wm-dropdown-menu li a:visited:hover{text-decoration:none;color:#111}.ai1mw-lines{position:absolute;width:12px;height:10px;top:9px;right:20px}.ai1wm-line{position:absolute;width:100%;height:2px;margin:auto;background:#27ae60;transition:all .2s ease-in-out}.ai1wm-line-first{top:0;left:0}div.ai1wm-open .ai1wm-line-first,div.ai1wm-open .ai1wm-line-third{top:50%}.ai1wm-line-second{top:50%;left:0}.ai1wm-line-third{top:100%;left:0}.ai1wm-button-blue,.ai1wm-button-gray,.ai1wm-button-green,.ai1wm-button-green-small,.ai1wm-button-red{display:inline-block;border:2px solid #95a5a6;background-color:transparent;color:#95a5a6;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:0;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-gray:hover{background-color:#95a5a6;color:#fff}.ai1wm-button-blue,.ai1wm-button-green,.ai1wm-button-green-small,.ai1wm-button-red{border:2px solid #27ae60;color:#27ae60}.ai1wm-button-green:hover{background-color:#27ae60;color:#fff}.ai1wm-button-blue,.ai1wm-button-green-small,.ai1wm-button-red{border:2px solid #6eb649;color:#6eb649}.ai1wm-button-green-small:hover{background-color:#6eb649;color:#fff}.ai1wm-button-blue,.ai1wm-button-red{border:2px solid #00aff0;color:#00aff0}.ai1wm-button-blue:hover{background-color:#00aff0;color:#fff}.ai1wm-button-red{border:2px solid #e74c3c;color:#e74c3c}.ai1wm-button-red:hover{background-color:#e74c3c;color:#fff}.ai1wm-button-blue[disabled=disabled],.ai1wm-button-green-small[disabled=disabled],.ai1wm-button-green[disabled=disabled],.ai1wm-button-red[disabled=disabled]{opacity:.6;cursor:default}.ai1wm-button-blue[disabled=disabled]:hover{color:#00aff0}.ai1wm-button-red[disabled=disabled]:hover{color:#e74c3c}.ai1wm-button-green[disabled=disabled]:hover{color:#27ae60}.ai1wm-button-blue[disabled=disabled]:hover,.ai1wm-button-green-small[disabled=disabled]:hover,.ai1wm-button-green[disabled=disabled]:hover,.ai1wm-button-red[disabled=disabled]:hover{background:0 0}.ai1wm-message-close-button{position:absolute;right:10px;top:6px;text-decoration:none;font-size:10px}input[type=radio].ai1wm-flat-radio-button{display:none}input[type=radio].ai1wm-flat-radio-button+a i,input[type=radio].ai1wm-flat-radio-button+label i{vertical-align:middle;float:left;width:25px;height:25px;border-radius:50%;background:0 0;border:2px solid #ccc;content:" ";cursor:pointer;position:relative;box-sizing:content-box}input[type=radio].ai1wm-flat-radio-button:checked+a i,input[type=radio].ai1wm-flat-radio-button:checked+label i{background-color:#d9d9d9;border-color:#6f6f6f}.ai1wm-clear{*zoom:1;clear:both}.ai1wm-clear:after,.ai1wm-clear:before{content:" ";display:table}.ai1wm-clear:after{clear:both}.ai1wm-container .ai1wm-row label{position:relative;top:-1px}.ai1wm-share-button-container{text-align:center}.ai1wm-share-button-container .ai1wm-share-button{text-decoration:none;margin:10px;font-size:30px}.ai1wm-report-problem{position:relative;float:right}.ai1wm-report-problem-dialog{position:absolute;z-index:999;width:280px;right:0;background-color:#fff;margin:6px 0 0;padding:15px 15px 10px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;display:none}.ai1wm-report-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-report-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-feedback-cancel:active,.ai1wm-feedback-cancel:link,.ai1wm-feedback-cancel:visited,.ai1wm-report-cancel:active,.ai1wm-report-cancel:link,.ai1wm-report-cancel:visited{float:left;line-height:34px;outline:0;text-decoration:none;color:#e74c3c}.ai1wm-form-submit{float:right}.ai1wm-report-active{display:block}.ai1wm-report-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-report-terms-segment>.ai1wm-report-terms{border-radius:3px}.ai1wm-import-info a,.ai1wm-no-underline{text-decoration:none}.ai1wm-top-negative-four{top:-4px}.ai1wm-feedback-form{display:none}.ai1wm-feedback-types{margin:0;padding:0;list-style:none}.ai1wm-feedback-types li{margin:14px 0;padding:0}.ai1wm-feedback-types>li>a>span,.ai1wm-feedback-types>li>label>span{display:inline-block;padding:5px 0 6px 8px}.ai1wm-feedback-types>li>a{height:29px;outline:0;color:#333;text-deciration:none}.ai1wm-loader{display:inline-block;width:128px;height:128px;position:relative;-webkit-animation:ai1wm-rotate 1.5s infinite linear;animation:ai1wm-rotate 1.5s infinite linear;background:url(../img/logo-128x128.png);background-repeat:no-repeat;background-position:center center}.ai1wm-hide{display:none}.ai1wm-label{border:1px solid #5cb85c;background-color:transparent;color:#5cb85c;cursor:pointer;text-transform:uppercase;font-weight:600;outline:0;transition:background-color .2s ease-out;padding:.2em .6em;font-size:.8em;border-radius:5px}.ai1wm-label:hover{background-color:#5cb85c;color:#fff}.ai1wm-dialog-message{text-align:left;line-height:1.5em}.ai1wm-import-info{display:inline-block;font-size:12px;font-weight:700;margin-top:16px}[class*=" ai1wm-icon-"],[class^=ai1wm-icon-]{font-family:'servmask';speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ai1wm-icon-file-zip:before{content:"\e60f"}.ai1wm-icon-folder:before{content:"\e60e"}.ai1wm-icon-file:before{content:"\e60b"}.ai1wm-icon-file-content:before{content:"\e60c"}.ai1wm-icon-cloud-upload:before{content:"\e600"}.ai1wm-icon-history:before{content:"\e603"}.ai1wm-icon-notification:before{content:"\e619"}.ai1wm-icon-arrow-down:before{content:"\e604"}.ai1wm-icon-close:before{content:"\e61a"}.ai1wm-icon-wordpress2:before{content:"\e620"}.ai1wm-icon-arrow-right:before{content:"\e605"}.ai1wm-icon-plus2:before{content:"\e607"}.ai1wm-icon-export:before{content:"\e601"}.ai1wm-icon-publish:before{content:"\e602"}.ai1wm-icon-paperplane:before{content:"\e608"}.ai1wm-icon-help:before{content:"\e609"}.ai1wm-icon-chevron-right:before{content:"\e60d"}.ai1wm-icon-dropbox:before{content:"\e606"}.ai1wm-icon-gear:before{content:"\e60a"}.ai1wm-icon-database:before{content:"\e964"}.ai1wm-icon-upload2:before{content:"\e9c6"}.ai1wm-icon-checkmark:before{content:"\ea10"}.ai1wm-icon-checkmark2:before{content:"\ea11"}.ai1wm-icon-enter:before{content:"\ea13"}.ai1wm-icon-exit:before{content:"\ea14"}.ai1wm-icon-amazon:before{content:"\ea87"}.ai1wm-icon-onedrive:before{content:"\eaaf"}@media (min-width:855px){.ai1wm-row{margin-right:399px}.ai1wm-row:after,.ai1wm-row:before{content:" ";display:table}.ai1wm-row:after{clear:both}.ai1wm-left{float:left;width:100%}.ai1wm-right{float:right;width:377px;margin-right:-399px}.ai1wm-right .ai1wm-sidebar{width:100%}.ai1wm-right .ai1wm-segment{width:333px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;color:#333;background-color:#f9f9f9;padding:20px;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box}.ai1wm-right .ai1wm-segment h2{margin:22px 0 0;padding:0;font-weight:700;font-size:14px;text-transform:uppercase;text-align:center}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-holder{position:relative;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-holder h1{float:left;font-weight:300;font-size:22px;text-transform:uppercase}.ai1wm-holder h1 i{position:relative;top:2px}@media (max-width:854px){.ai1wm-container{margin-left:10px!important}.ai1wm-right,.ai1wm-row{margin-right:0!important}.ai1wm-right{float:left!important;width:100%!important;margin-top:18px}.ai1wm-right .ai1wm-sidebar{width:auto!important;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px;border-radius:3px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-container{margin:20px 20px 0 2px}.ai1wm-container:after,.ai1wm-container:before{content:" ";display:table}.ai1wm-container:after{clear:both}.ai1wm-replace-row{width:100%;box-shadow:outset 0 1px 0 0 white;border-radius:3px;color:#333;font-size:11px;font-weight:700;background-color:#f9f9f9;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box;margin-bottom:10px}.ai1wm-field{margin-bottom:4px}.ai1wm-field input[type=text],.ai1wm-field textarea,.ai1wm-query div input{width:100%;font-weight:400}.ai1wm-field-set{margin-top:18px}.ai1wm-message{-moz-box-sizing:border-box;background-color:#efefef;border-radius:4px;color:rgba(0,0,0,.6);height:auto;margin:10px 0;min-height:18px;padding:6px 10px;position:relative;border:1px solid;transition:opacity .1s ease 0s,color .1s ease 0s,background .1s ease 0s,box-shadow .1s ease 0s}.ai1wm-message.ai1wm-success-message{background-color:#f2f8f0;color:#119000;font-size:12px}.ai1wm-message.ai1wm-info-message{background-color:#d9edf7;color:#31708f;font-size:11px}.ai1wm-message.ai1wm-error-message{background-color:#f1d7d7;color:#a95252;font-size:12px}.ai1wm-message.ai1wm-red-message{color:#d95c5c;border:2px solid #d95c5c;background-color:transparent}.ai1wm-message.ai1wm-red-message h3{margin:.4em 0;color:#d95c5c}.ai1wm-message p{margin:4px 0;font-size:12px}.ai1wm-message-warning{display:block;font-size:14px;line-height:18px;padding:12px 20px;margin:0 0 22px;background-color:#f9f9f9;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;border-left:4px solid #ffba00}.ai1wm-overlay{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.7);z-index:100001}.ai1wm-modal-container{position:fixed;display:none;top:50%;left:50%;z-index:100002;width:480px;height:auto;padding:16px;-webkit-transform:translate(-240px,-94px);transform:translate(-240px,-94px);border:1px solid #fff;box-shadow:0 2px 6px #292929;border-radius:6px;background:#f6f6f6;box-sizing:border-box;text-align:center}.ai1wm-modal-container section{display:block;min-height:102px}.ai1wm-holder h1,.ai1wm-modal-container section h1{margin:0;padding:0}.ai1wm-modal-container section h1 .ai1wm-title-green{color:#27ae60;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-red{color:#e74c3c;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-grey{color:gray;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-loader{width:32px;height:32px;background:url(../img/logo-32x32.png)}.ai1wm-modal-container section h1 .ai1wm-icon-notification{font-size:1.2em;color:#e74c3c}.ai1wm-modal-container section p{margin:0;padding:12px 0}.ai1wm-modal-container section p .ai1wm-modal-sites p{padding:4px 10px;text-align:left}.ai1wm-modal-container section p .ai1wm-modal-sites input,.ai1wm-modal-container section p .ai1wm-modal-sites select{padding:0 6px;width:100%;border-radius:3px;height:30px;line-height:30px}.ai1wm-modal-container section p .ai1wm-modal-subtitle-green{color:#27ae60}.ai1wm-modal-container section p .ai1wm-modal-subtitle-red{color:#e74c3c}.ai1wm-modal-container section p .ai1wm-modal-subdescription{display:block;text-align:left}.ai1wm-modal-container section p a.ai1wm-button-green{display:inline-block;position:relative;top:26px}.ai1wm-modal-container section p a.ai1wm-emphasize{-webkit-animation:ai1wm-emphasize 1s infinite;animation:ai1wm-emphasize 1s infinite}.ai1wm-modal-container section p em{display:block;color:#34495e;font-style:normal}.ai1wm-modal-container section p.ai1wm-import-modal-content{text-align:left}.ai1wm-modal-container .ai1wm-import-modal-actions{border-top:1px solid #ccc;padding-top:1em;text-align:right}.ai1wm-modal-container .ai1wm-import-modal-actions .ai1wm-button-gray{margin-right:1em}.ai1wm-modal-container .ai1wm-import-modal-notice{border-top:1px solid #ccc}.ai1wm-modal-container .ai1wm-import-modal-notice p{font-weight:700;margin:0;padding-top:16px;text-align:center}.ai1wm-query-arrow{position:relative;top:4px;float:right}.ai1wm-query.ai1wm-open{background:#ebebeb!important}.ai1wm-query.ai1wm-open p small{border-bottom:1px dashed #000}.ai1wm-query.ai1wm-open div{visibility:visible!important;height:5rem!important;margin-top:8px}.ai1wm-query.ai1wm-open .ai1wm-query-arrow{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.ai1wm-query{width:100%;margin:0 0 10px;list-style:none;background:0 0;border:1px solid #d8d8d8;padding:10px;border-radius:5px;box-sizing:border-box}.ai1wm-query div{transition:height .2s cubic-bezier(.19,1,.22,1);visibility:hidden;height:0}.ai1wm-query div input{font-size:.8rem;padding:0 10px;height:2.3rem;line-height:2.3rem;margin-bottom:4px;border:1px solid #ddd;box-shadow:inset 0 1px 2px rgba(0,0,0,.07);background-color:#fff;color:#333;transition:.05s border-color ease-in-out;border-radius:5px}.ai1wm-query div input:focus{border-color:#5b9dd9;box-shadow:0 0 2px rgba(30,140,190,.8)}.ai1wm-query p{margin:0;cursor:pointer}.ai1wm-query p small{display:inline;width:auto;float:none}.ai1wm-query-arrow{transition:transform .1s ease-out;transition:transform .1s ease-out,-webkit-transform .1s ease-out}#ai1wm-queries{padding:0} \ No newline at end of file diff --git a/lib/view/assets/css/export.min.rtl.css b/lib/view/assets/css/export.min.rtl.css new file mode 100644 index 0000000..7349ed2 --- /dev/null +++ b/lib/view/assets/css/export.min.rtl.css @@ -0,0 +1 @@ +@charset "UTF-8";@-webkit-keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(90deg);transform:rotateZ(90deg)}50%{-webkit-transform:rotateZ(180deg);transform:rotateZ(180deg)}75%{-webkit-transform:rotateZ(270deg);transform:rotateZ(270deg)}to{-webkit-transform:rotateZ(360deg);transform:rotateZ(360deg)}}@keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(90deg);transform:rotateZ(90deg)}50%{-webkit-transform:rotateZ(180deg);transform:rotateZ(180deg)}75%{-webkit-transform:rotateZ(270deg);transform:rotateZ(270deg)}to{-webkit-transform:rotateZ(360deg);transform:rotateZ(360deg)}}@-webkit-keyframes ai1wm-emphasize{0%,to{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@keyframes ai1wm-emphasize{0%,to{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@-webkit-keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}to{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}to{-webkit-transform:scale(1);transform:scale(1)}}.ai1wm-accordion{margin:1em 0;display:block}.ai1wm-accordion h4{cursor:pointer;color:rgba(0,116,162,.8);margin:0}.ai1wm-accordion h4 small{color:#444;font-weight:400}.ai1wm-accordion h4 small:after,.ai1wm-container .ai1wm-row label:after{content:"\200E"}.ai1wm-accordion .ai1wm-icon-arrow-right{transition:transform .1s ease-out;transition:transform .1s ease-out,-webkit-transform .1s ease-out;display:inline-block}.ai1wm-accordion ul{margin:0;padding:0;list-style:none;visibility:hidden;height:0;transition:height .2s cubic-bezier(.19,1,.22,1)}.ai1wm-accordion h4 small,.ai1wm-accordion ul li small{display:inline;float:none;width:auto}.ai1wm-accordion.ai1wm-open h4 .ai1wm-icon-arrow-right{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.ai1wm-accordion.ai1wm-open ul{height:auto;margin:.6em 2em 0 0;visibility:visible}.ai1wm-button-group{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;text-transform:uppercase;font-weight:600;transition:background-color .2s ease-out;display:inline-block;text-align:right}.ai1wm-button-group.ai1wm-button-export,.ai1wm-button-group.ai1wm-button-import{box-sizing:content-box}.ai1wm-button-group.ai1wm-button-export.ai1wm-open>.ai1wm-dropdown-menu{height:364px;border-top:1px solid #27ae60}.ai1wm-button-group.ai1wm-button-import.ai1wm-open>.ai1wm-dropdown-menu{height:392px;border-top:1px solid #27ae60}.ai1wm-button-group .ai1wm-button-main{position:relative;padding:6px 25px 6px 50px;box-sizing:content-box}.ai1wm-button-group .ai1wm-dropdown-menu{height:0;overflow:hidden;transition:height .2s cubic-bezier(.19,1,.22,1);border-top:none}.ai1wm-dropdown-menu{list-style:none}.ai1wm-dropdown-menu,.ai1wm-dropdown-menu li{margin:0!important;padding:0}.ai1wm-dropdown-menu li a,.ai1wm-dropdown-menu li a:visited{display:block;padding:5px 26px;text-decoration:none;color:#27ae60;text-align:right;box-sizing:content-box}.ai1wm-dropdown-menu li a:hover,.ai1wm-dropdown-menu li a:visited:hover{text-decoration:none;color:#111}.ai1mw-lines{position:absolute;width:12px;height:10px;top:9px;left:20px}.ai1wm-line{position:absolute;width:100%;height:2px;margin:auto;background:#27ae60;transition:all .2s ease-in-out}.ai1wm-line-first{top:0;right:0}div.ai1wm-open .ai1wm-line-first,div.ai1wm-open .ai1wm-line-third{top:50%}.ai1wm-line-second{top:50%;right:0}.ai1wm-line-third{top:100%;right:0}.ai1wm-button-blue,.ai1wm-button-gray,.ai1wm-button-green,.ai1wm-button-green-small,.ai1wm-button-red{display:inline-block;border:2px solid #95a5a6;background-color:transparent;color:#95a5a6;border-radius:5px;cursor:pointer;padding:5px 26px 5px 25px;text-transform:uppercase;font-weight:600;outline:0;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-gray:hover{background-color:#95a5a6;color:#fff}.ai1wm-button-blue,.ai1wm-button-green,.ai1wm-button-green-small,.ai1wm-button-red{border:2px solid #27ae60;color:#27ae60}.ai1wm-button-green:hover{background-color:#27ae60;color:#fff}.ai1wm-button-blue,.ai1wm-button-green-small,.ai1wm-button-red{border:2px solid #6eb649;color:#6eb649}.ai1wm-button-green-small:hover{background-color:#6eb649;color:#fff}.ai1wm-button-blue,.ai1wm-button-red{border:2px solid #00aff0;color:#00aff0}.ai1wm-button-blue:hover{background-color:#00aff0;color:#fff}.ai1wm-button-red{border:2px solid #e74c3c;color:#e74c3c}.ai1wm-button-red:hover{background-color:#e74c3c;color:#fff}.ai1wm-button-blue[disabled=disabled],.ai1wm-button-green-small[disabled=disabled],.ai1wm-button-green[disabled=disabled],.ai1wm-button-red[disabled=disabled]{opacity:.6;cursor:default}.ai1wm-button-blue[disabled=disabled]:hover{color:#00aff0}.ai1wm-button-red[disabled=disabled]:hover{color:#e74c3c}.ai1wm-button-green[disabled=disabled]:hover{color:#27ae60}.ai1wm-button-blue[disabled=disabled]:hover,.ai1wm-button-green-small[disabled=disabled]:hover,.ai1wm-button-green[disabled=disabled]:hover,.ai1wm-button-red[disabled=disabled]:hover{background:100% 0}.ai1wm-message-close-button{position:absolute;left:10px;top:6px;text-decoration:none;font-size:10px}input[type=radio].ai1wm-flat-radio-button{display:none}input[type=radio].ai1wm-flat-radio-button+a i,input[type=radio].ai1wm-flat-radio-button+label i{vertical-align:middle;float:right;width:25px;height:25px;border-radius:50%;background:100% 0;border:2px solid #ccc;content:" ";cursor:pointer;position:relative;box-sizing:content-box}input[type=radio].ai1wm-flat-radio-button:checked+a i,input[type=radio].ai1wm-flat-radio-button:checked+label i{background-color:#d9d9d9;border-color:#6f6f6f}.ai1wm-clear{*zoom:1;clear:both}.ai1wm-clear:after,.ai1wm-clear:before{content:" ";display:table}.ai1wm-clear:after{clear:both}.ai1wm-container .ai1wm-row label{position:relative;top:-1px}.ai1wm-share-button-container{text-align:center}.ai1wm-share-button-container .ai1wm-share-button{text-decoration:none;margin:10px;font-size:30px}.ai1wm-report-problem{position:relative;float:left}.ai1wm-report-problem-dialog{position:absolute;z-index:999;width:280px;left:0;background-color:#fff;margin:6px 0 0;padding:15px 15px 10px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;display:none}.ai1wm-report-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-report-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-feedback-cancel:active,.ai1wm-feedback-cancel:link,.ai1wm-feedback-cancel:visited,.ai1wm-report-cancel:active,.ai1wm-report-cancel:link,.ai1wm-report-cancel:visited{float:right;line-height:34px;outline:0;text-decoration:none;color:#e74c3c}.ai1wm-form-submit{float:left}.ai1wm-report-active{display:block}.ai1wm-report-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-report-terms-segment>.ai1wm-report-terms{border-radius:3px}.ai1wm-import-info a,.ai1wm-no-underline{text-decoration:none}.ai1wm-top-negative-four{top:-4px}.ai1wm-feedback-form{display:none}.ai1wm-feedback-types{margin:0;padding:0;list-style:none}.ai1wm-feedback-types li{margin:14px 0;padding:0}.ai1wm-feedback-types>li>a>span,.ai1wm-feedback-types>li>label>span{display:inline-block;padding:5px 8px 6px 0}.ai1wm-feedback-types>li>a{height:29px;outline:0;color:#333;text-deciration:none}.ai1wm-loader{display:inline-block;width:128px;height:128px;position:relative;-webkit-animation:ai1wm-rotate 1.5s infinite linear;animation:ai1wm-rotate 1.5s infinite linear;background:url(../img/logo-128x128.png);background-repeat:no-repeat;background-position:center center}.ai1wm-hide{display:none}.ai1wm-label{border:1px solid #5cb85c;background-color:transparent;color:#5cb85c;cursor:pointer;text-transform:uppercase;font-weight:600;outline:0;transition:background-color .2s ease-out;padding:.2em .6em;font-size:.8em;border-radius:5px}.ai1wm-label:hover{background-color:#5cb85c;color:#fff}.ai1wm-dialog-message{text-align:right;line-height:1.5em}.ai1wm-import-info{display:inline-block;font-size:12px;font-weight:700;margin-top:16px}[class*=" ai1wm-icon-"],[class^=ai1wm-icon-]{font-family:'servmask';speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ai1wm-icon-file-zip:before{content:"\e60f"}.ai1wm-icon-folder:before{content:"\e60e"}.ai1wm-icon-file:before{content:"\e60b"}.ai1wm-icon-file-content:before{content:"\e60c"}.ai1wm-icon-cloud-upload:before{content:"\e600"}.ai1wm-icon-history:before{content:"\e603"}.ai1wm-icon-notification:before{content:"\e619"}.ai1wm-icon-arrow-down:before{content:"\e604"}.ai1wm-icon-close:before{content:"\e61a"}.ai1wm-icon-wordpress2:before{content:"\e620"}.ai1wm-icon-arrow-right:before{content:"\e605"}.ai1wm-icon-plus2:before{content:"\e607"}.ai1wm-icon-export:before{content:"\e601"}.ai1wm-icon-publish:before{content:"\e602"}.ai1wm-icon-paperplane:before{content:"\e608"}.ai1wm-icon-help:before{content:"\e609"}.ai1wm-icon-chevron-right:before{content:"\e60d"}.ai1wm-icon-dropbox:before{content:"\e606"}.ai1wm-icon-gear:before{content:"\e60a"}.ai1wm-icon-database:before{content:"\e964"}.ai1wm-icon-upload2:before{content:"\e9c6"}.ai1wm-icon-checkmark:before{content:"\ea10"}.ai1wm-icon-checkmark2:before{content:"\ea11"}.ai1wm-icon-enter:before{content:"\ea13"}.ai1wm-icon-exit:before{content:"\ea14"}.ai1wm-icon-amazon:before{content:"\ea87"}.ai1wm-icon-onedrive:before{content:"\eaaf"}@media (min-width:855px){.ai1wm-row{margin-left:399px}.ai1wm-row:after,.ai1wm-row:before{content:" ";display:table}.ai1wm-row:after{clear:both}.ai1wm-left{float:right;width:100%}.ai1wm-right{float:left;width:377px;margin-left:-399px}.ai1wm-right .ai1wm-sidebar{width:100%}.ai1wm-right .ai1wm-segment{width:333px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;color:#333;background-color:#f9f9f9;padding:20px;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box}.ai1wm-right .ai1wm-segment h2{margin:22px 0 0;padding:0;font-weight:700;font-size:14px;text-transform:uppercase;text-align:center}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-holder{position:relative;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-holder h1{float:right;font-weight:300;font-size:22px;text-transform:uppercase}.ai1wm-holder h1 i{position:relative;top:2px}@media (max-width:854px){.ai1wm-container{margin-right:10px!important}.ai1wm-right,.ai1wm-row{margin-left:0!important}.ai1wm-right{float:right!important;width:100%!important;margin-top:18px}.ai1wm-right .ai1wm-sidebar{width:auto!important;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px;border-radius:3px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-container{margin:20px 2px 0 20px}.ai1wm-container:after,.ai1wm-container:before{content:" ";display:table}.ai1wm-container:after{clear:both}.ai1wm-replace-row{width:100%;box-shadow:outset 0 1px 0 0 white;border-radius:3px;color:#333;font-size:11px;font-weight:700;background-color:#f9f9f9;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box;margin-bottom:10px}.ai1wm-field{margin-bottom:4px}.ai1wm-field input[type=text],.ai1wm-field textarea,.ai1wm-query div input{width:100%;font-weight:400}.ai1wm-field-set{margin-top:18px}.ai1wm-message{-moz-box-sizing:border-box;background-color:#efefef;border-radius:4px;color:rgba(0,0,0,.6);height:auto;margin:10px 0;min-height:18px;padding:6px 10px;position:relative;border:1px solid;transition:opacity .1s ease 0s,color .1s ease 0s,background .1s ease 0s,box-shadow .1s ease 0s}.ai1wm-message.ai1wm-success-message{background-color:#f2f8f0;color:#119000;font-size:12px}.ai1wm-message.ai1wm-info-message{background-color:#d9edf7;color:#31708f;font-size:11px}.ai1wm-message.ai1wm-error-message{background-color:#f1d7d7;color:#a95252;font-size:12px}.ai1wm-message.ai1wm-red-message{color:#d95c5c;border:2px solid #d95c5c;background-color:transparent}.ai1wm-message.ai1wm-red-message h3{margin:.4em 0;color:#d95c5c}.ai1wm-message p{margin:4px 0;font-size:12px}.ai1wm-message-warning{display:block;font-size:14px;line-height:18px;padding:12px 20px;margin:0 0 22px;background-color:#f9f9f9;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;border-right:4px solid #ffba00}.ai1wm-overlay{display:none;position:fixed;top:0;right:0;width:100%;height:100%;background-color:rgba(0,0,0,.7);z-index:100001}.ai1wm-modal-container{position:fixed;display:none;top:50%;right:50%;z-index:100002;width:480px;height:auto;padding:16px;-webkit-transform:translate(240px,-94px);transform:translate(240px,-94px);border:1px solid #fff;box-shadow:0 2px 6px #292929;border-radius:6px;background:#f6f6f6;box-sizing:border-box;text-align:center}.ai1wm-modal-container section{display:block;min-height:102px}.ai1wm-holder h1,.ai1wm-modal-container section h1{margin:0;padding:0}.ai1wm-modal-container section h1 .ai1wm-title-green{color:#27ae60;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-red{color:#e74c3c;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-grey{color:gray;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-loader{width:32px;height:32px;background:url(../img/logo-32x32.png)}.ai1wm-modal-container section h1 .ai1wm-icon-notification{font-size:1.2em;color:#e74c3c}.ai1wm-modal-container section p{margin:0;padding:12px 0}.ai1wm-modal-container section p .ai1wm-modal-sites p{padding:4px 10px;text-align:right}.ai1wm-modal-container section p .ai1wm-modal-sites input,.ai1wm-modal-container section p .ai1wm-modal-sites select{padding:0 6px;width:100%;border-radius:3px;height:30px;line-height:30px}.ai1wm-modal-container section p .ai1wm-modal-subtitle-green{color:#27ae60}.ai1wm-modal-container section p .ai1wm-modal-subtitle-red{color:#e74c3c}.ai1wm-modal-container section p .ai1wm-modal-subdescription{display:block;text-align:right}.ai1wm-modal-container section p a.ai1wm-button-green{display:inline-block;position:relative;top:26px}.ai1wm-modal-container section p a.ai1wm-emphasize{-webkit-animation:ai1wm-emphasize 1s infinite;animation:ai1wm-emphasize 1s infinite}.ai1wm-modal-container section p em{display:block;color:#34495e;font-style:normal}.ai1wm-modal-container section p.ai1wm-import-modal-content{text-align:right}.ai1wm-modal-container .ai1wm-import-modal-actions{border-top:1px solid #ccc;padding-top:1em;text-align:left}.ai1wm-modal-container .ai1wm-import-modal-actions .ai1wm-button-gray{margin-left:1em}.ai1wm-modal-container .ai1wm-import-modal-notice{border-top:1px solid #ccc}.ai1wm-modal-container .ai1wm-import-modal-notice p{font-weight:700;margin:0;padding-top:16px;text-align:center}.ai1wm-query-arrow{position:relative;top:4px;float:left}.ai1wm-query.ai1wm-open{background:#ebebeb!important}.ai1wm-query.ai1wm-open p small{border-bottom:1px dashed #000}.ai1wm-query.ai1wm-open div{visibility:visible!important;height:5rem!important;margin-top:8px}.ai1wm-query.ai1wm-open .ai1wm-query-arrow{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.ai1wm-query{width:100%;margin:0 0 10px;list-style:none;background:100% 0;border:1px solid #d8d8d8;padding:10px;border-radius:5px;box-sizing:border-box}.ai1wm-query div{transition:height .2s cubic-bezier(.19,1,.22,1);visibility:hidden;height:0}.ai1wm-query div input{font-size:.8rem;padding:0 10px;height:2.3rem;line-height:2.3rem;margin-bottom:4px;border:1px solid #ddd;box-shadow:inset 0 1px 2px rgba(0,0,0,.07);background-color:#fff;color:#333;transition:.05s border-color ease-in-out;border-radius:5px}.ai1wm-query div input:focus{border-color:#5b9dd9;box-shadow:0 0 2px rgba(30,140,190,.8)}.ai1wm-query p{margin:0;cursor:pointer}.ai1wm-query p small{display:inline;width:auto;float:none}.ai1wm-query-arrow{transition:transform .1s ease-out;transition:transform .1s ease-out,-webkit-transform .1s ease-out}#ai1wm-queries{padding:0} \ No newline at end of file diff --git a/lib/view/assets/css/import.min.css b/lib/view/assets/css/import.min.css new file mode 100644 index 0000000..7b11dd0 --- /dev/null +++ b/lib/view/assets/css/import.min.css @@ -0,0 +1 @@ +@charset "UTF-8";@-webkit-keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}to{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}to{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@-webkit-keyframes ai1wm-emphasize{0%,to{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@keyframes ai1wm-emphasize{0%,to{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@-webkit-keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}to{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}to{-webkit-transform:scale(1);transform:scale(1)}}.ai1wm-button-group{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;text-transform:uppercase;font-weight:600;transition:background-color .2s ease-out;display:inline-block;text-align:left}.ai1wm-button-group.ai1wm-button-export,.ai1wm-button-group.ai1wm-button-import{box-sizing:content-box}.ai1wm-button-group.ai1wm-button-export.ai1wm-open>.ai1wm-dropdown-menu{height:364px;border-top:1px solid #27ae60}.ai1wm-button-group.ai1wm-button-import.ai1wm-open>.ai1wm-dropdown-menu{height:392px;border-top:1px solid #27ae60}.ai1wm-button-group .ai1wm-button-main{position:relative;padding:6px 50px 6px 25px;box-sizing:content-box}.ai1wm-button-group .ai1wm-dropdown-menu{height:0;overflow:hidden;transition:height .2s cubic-bezier(.19,1,.22,1);border-top:none}.ai1wm-dropdown-menu{list-style:none}.ai1wm-dropdown-menu,.ai1wm-dropdown-menu li{margin:0!important;padding:0}.ai1wm-dropdown-menu li a,.ai1wm-dropdown-menu li a:visited{display:block;padding:5px 26px;text-decoration:none;color:#27ae60;text-align:left;box-sizing:content-box}.ai1wm-dropdown-menu li a:hover,.ai1wm-dropdown-menu li a:visited:hover{text-decoration:none;color:#111}.ai1mw-lines{position:absolute;width:12px;height:10px;top:9px;right:20px}.ai1wm-line{position:absolute;width:100%;height:2px;margin:auto;background:#27ae60;transition:all .2s ease-in-out}.ai1wm-line-first{top:0;left:0}div.ai1wm-open .ai1wm-line-first,div.ai1wm-open .ai1wm-line-third{top:50%}.ai1wm-line-second{top:50%;left:0}.ai1wm-line-third{top:100%;left:0}.ai1wm-button-blue,.ai1wm-button-gray,.ai1wm-button-green,.ai1wm-button-green-small,.ai1wm-button-red{display:inline-block;border:2px solid #95a5a6;background-color:transparent;color:#95a5a6;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:0;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-gray:hover{background-color:#95a5a6;color:#fff}.ai1wm-button-blue,.ai1wm-button-green,.ai1wm-button-green-small,.ai1wm-button-red{border:2px solid #27ae60;color:#27ae60}.ai1wm-button-green:hover{background-color:#27ae60;color:#fff}.ai1wm-button-blue,.ai1wm-button-green-small,.ai1wm-button-red{border:2px solid #6eb649;color:#6eb649}.ai1wm-button-green-small:hover{background-color:#6eb649;color:#fff}.ai1wm-button-blue,.ai1wm-button-red{border:2px solid #00aff0;color:#00aff0}.ai1wm-button-blue:hover{background-color:#00aff0;color:#fff}.ai1wm-button-red{border:2px solid #e74c3c;color:#e74c3c}.ai1wm-button-red:hover{background-color:#e74c3c;color:#fff}.ai1wm-button-blue[disabled=disabled],.ai1wm-button-green-small[disabled=disabled],.ai1wm-button-green[disabled=disabled],.ai1wm-button-red[disabled=disabled]{opacity:.6;cursor:default}.ai1wm-button-blue[disabled=disabled]:hover{color:#00aff0}.ai1wm-button-red[disabled=disabled]:hover{color:#e74c3c}.ai1wm-button-green[disabled=disabled]:hover{color:#27ae60}.ai1wm-button-blue[disabled=disabled]:hover,.ai1wm-button-green-small[disabled=disabled]:hover,.ai1wm-button-green[disabled=disabled]:hover,.ai1wm-button-red[disabled=disabled]:hover{background:0 0}.ai1wm-message-close-button{position:absolute;right:10px;top:6px;text-decoration:none;font-size:10px}input[type=radio].ai1wm-flat-radio-button{display:none}input[type=radio].ai1wm-flat-radio-button+a i,input[type=radio].ai1wm-flat-radio-button+label i{vertical-align:middle;float:left;width:25px;height:25px;border-radius:50%;background:0 0;border:2px solid #ccc;content:" ";cursor:pointer;position:relative;box-sizing:content-box}input[type=radio].ai1wm-flat-radio-button:checked+a i,input[type=radio].ai1wm-flat-radio-button:checked+label i{background-color:#d9d9d9;border-color:#6f6f6f}.ai1wm-clear{*zoom:1;clear:both}.ai1wm-clear:after,.ai1wm-clear:before{content:" ";display:table}.ai1wm-clear:after{clear:both}.ai1wm-container .ai1wm-row label{position:relative;top:-1px}.ai1wm-container .ai1wm-row label:after{content:"\200E"}.ai1wm-share-button-container{text-align:center}.ai1wm-share-button-container .ai1wm-share-button{text-decoration:none;margin:10px;font-size:30px}.ai1wm-report-problem{position:relative;float:right}.ai1wm-report-problem-dialog{position:absolute;z-index:999;width:280px;right:0;background-color:#fff;margin:6px 0 0;padding:15px 15px 10px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;display:none}.ai1wm-report-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-report-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-feedback-cancel:active,.ai1wm-feedback-cancel:link,.ai1wm-feedback-cancel:visited,.ai1wm-report-cancel:active,.ai1wm-report-cancel:link,.ai1wm-report-cancel:visited{float:left;line-height:34px;outline:0;text-decoration:none;color:#e74c3c}.ai1wm-form-submit{float:right}.ai1wm-report-active{display:block}.ai1wm-report-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-report-terms-segment>.ai1wm-report-terms{border-radius:3px}.ai1wm-import-info a,.ai1wm-no-underline,.ai1wm-unlimited-import a{text-decoration:none}.ai1wm-top-negative-four{top:-4px}.ai1wm-feedback-form{display:none}.ai1wm-feedback-types{margin:0;padding:0;list-style:none}.ai1wm-feedback-types li{margin:14px 0;padding:0}.ai1wm-feedback-types>li>a>span,.ai1wm-feedback-types>li>label>span{display:inline-block;padding:5px 0 6px 8px}.ai1wm-feedback-types>li>a{height:29px;outline:0;color:#333;text-deciration:none}.ai1wm-loader{display:inline-block;width:128px;height:128px;position:relative;-webkit-animation:ai1wm-rotate 1.5s infinite linear;animation:ai1wm-rotate 1.5s infinite linear;background:url(../img/logo-128x128.png);background-repeat:no-repeat;background-position:center center}.ai1wm-hide,div.ai1wm-expandable input{display:none}.ai1wm-label{border:1px solid #5cb85c;background-color:transparent;color:#5cb85c;cursor:pointer;text-transform:uppercase;font-weight:600;outline:0;transition:background-color .2s ease-out;padding:.2em .6em;font-size:.8em;border-radius:5px}.ai1wm-label:hover{background-color:#5cb85c;color:#fff}.ai1wm-dialog-message{text-align:left;line-height:1.5em}.ai1wm-import-info{display:inline-block;font-size:12px;font-weight:700;margin-top:16px}[class*=" ai1wm-icon-"],[class^=ai1wm-icon-]{font-family:'servmask';speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ai1wm-icon-file-zip:before{content:"\e60f"}.ai1wm-icon-folder:before{content:"\e60e"}.ai1wm-icon-file:before{content:"\e60b"}.ai1wm-icon-file-content:before{content:"\e60c"}.ai1wm-icon-cloud-upload:before{content:"\e600"}.ai1wm-icon-history:before{content:"\e603"}.ai1wm-icon-notification:before{content:"\e619"}.ai1wm-icon-arrow-down:before{content:"\e604"}.ai1wm-icon-close:before{content:"\e61a"}.ai1wm-icon-wordpress2:before{content:"\e620"}.ai1wm-icon-arrow-right:before{content:"\e605"}.ai1wm-icon-plus2:before{content:"\e607"}.ai1wm-icon-export:before{content:"\e601"}.ai1wm-icon-publish:before{content:"\e602"}.ai1wm-icon-paperplane:before{content:"\e608"}.ai1wm-icon-help:before{content:"\e609"}.ai1wm-icon-chevron-right:before{content:"\e60d"}.ai1wm-icon-dropbox:before{content:"\e606"}.ai1wm-icon-gear:before{content:"\e60a"}.ai1wm-icon-database:before{content:"\e964"}.ai1wm-icon-upload2:before{content:"\e9c6"}.ai1wm-icon-checkmark:before{content:"\ea10"}.ai1wm-icon-checkmark2:before{content:"\ea11"}.ai1wm-icon-enter:before{content:"\ea13"}.ai1wm-icon-exit:before{content:"\ea14"}.ai1wm-icon-amazon:before{content:"\ea87"}.ai1wm-icon-onedrive:before{content:"\eaaf"}@media (min-width:855px){.ai1wm-row{margin-right:399px}.ai1wm-row:after,.ai1wm-row:before{content:" ";display:table}.ai1wm-row:after{clear:both}.ai1wm-left{float:left;width:100%}.ai1wm-right{float:right;width:377px;margin-right:-399px}.ai1wm-right .ai1wm-sidebar{width:100%}.ai1wm-right .ai1wm-segment{width:333px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;color:#333;background-color:#f9f9f9;padding:20px;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box}.ai1wm-right .ai1wm-segment h2{margin:22px 0 0;padding:0;font-weight:700;font-size:14px;text-transform:uppercase;text-align:center}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-holder{position:relative;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-holder h1{float:left;font-weight:300;font-size:22px;text-transform:uppercase}.ai1wm-holder h1 i{position:relative;top:2px}@media (max-width:854px){.ai1wm-container{margin-left:10px!important}.ai1wm-right,.ai1wm-row{margin-right:0!important}.ai1wm-right{float:left!important;width:100%!important;margin-top:18px}.ai1wm-right .ai1wm-sidebar{width:auto!important;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px;border-radius:3px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-container{margin:20px 20px 0 2px}.ai1wm-container:after,.ai1wm-container:before{content:" ";display:table}.ai1wm-container:after{clear:both}.ai1wm-replace-row{width:100%;box-shadow:outset 0 1px 0 0 white;border-radius:3px;color:#333;font-size:11px;font-weight:700;background-color:#f9f9f9;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box;margin-bottom:10px}.ai1wm-field{margin-bottom:4px}.ai1wm-field input[type=text],.ai1wm-field textarea{width:100%;font-weight:400}.ai1wm-field-set{margin-top:18px}.ai1wm-message{-moz-box-sizing:border-box;background-color:#efefef;border-radius:4px;color:rgba(0,0,0,.6);height:auto;margin:10px 0;min-height:18px;padding:6px 10px;position:relative;border:1px solid;transition:opacity .1s ease 0s,color .1s ease 0s,background .1s ease 0s,box-shadow .1s ease 0s}.ai1wm-message.ai1wm-success-message{background-color:#f2f8f0;color:#119000;font-size:12px}.ai1wm-message.ai1wm-info-message{background-color:#d9edf7;color:#31708f;font-size:11px}.ai1wm-message.ai1wm-error-message{background-color:#f1d7d7;color:#a95252;font-size:12px}.ai1wm-message.ai1wm-red-message{color:#d95c5c;border:2px solid #d95c5c;background-color:transparent}.ai1wm-message.ai1wm-red-message h3{margin:.4em 0;color:#d95c5c}.ai1wm-message p{margin:4px 0;font-size:12px}.ai1wm-message-warning{display:block;font-size:14px;line-height:18px;padding:12px 20px;margin:0 0 22px;background-color:#f9f9f9;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;border-left:4px solid #ffba00}.ai1wm-overlay{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.7);z-index:100001}.ai1wm-modal-container{position:fixed;display:none;top:50%;left:50%;z-index:100002;width:480px;height:auto;padding:16px;-webkit-transform:translate(-240px,-94px);transform:translate(-240px,-94px);border:1px solid #fff;box-shadow:0 2px 6px #292929;border-radius:6px;background:#f6f6f6;box-sizing:border-box;text-align:center}.ai1wm-modal-container section{display:block;min-height:102px}.ai1wm-holder h1,.ai1wm-modal-container section h1{margin:0;padding:0}.ai1wm-modal-container section h1 .ai1wm-title-green{color:#27ae60;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-red{color:#e74c3c;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-grey{color:gray;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-loader{width:32px;height:32px;background:url(../img/logo-32x32.png)}.ai1wm-modal-container section h1 .ai1wm-icon-notification{font-size:1.2em;color:#e74c3c}.ai1wm-modal-container section p{margin:0;padding:12px 0}.ai1wm-modal-container section p .ai1wm-modal-sites p{padding:4px 10px;text-align:left}.ai1wm-modal-container section p .ai1wm-modal-sites input,.ai1wm-modal-container section p .ai1wm-modal-sites select{padding:0 6px;width:100%;border-radius:3px;height:30px;line-height:30px}.ai1wm-modal-container section p .ai1wm-modal-subtitle-green{color:#27ae60}.ai1wm-modal-container section p .ai1wm-modal-subtitle-red{color:#e74c3c}.ai1wm-modal-container section p .ai1wm-modal-subdescription{display:block;text-align:left}.ai1wm-modal-container section p a.ai1wm-button-green{display:inline-block;position:relative;top:26px}.ai1wm-modal-container section p a.ai1wm-emphasize{-webkit-animation:ai1wm-emphasize 1s infinite;animation:ai1wm-emphasize 1s infinite}.ai1wm-modal-container section p em{display:block;color:#34495e;font-style:normal}.ai1wm-modal-container section p.ai1wm-import-modal-content{text-align:left}.ai1wm-modal-container .ai1wm-import-modal-actions{border-top:1px solid #ccc;padding-top:1em;text-align:right}.ai1wm-modal-container .ai1wm-import-modal-actions .ai1wm-button-gray{margin-right:1em}.ai1wm-modal-container .ai1wm-import-modal-notice{border-top:1px solid #ccc}.ai1wm-modal-container .ai1wm-import-modal-notice p{font-weight:700;margin:0;padding-top:16px;text-align:center}.ai1wm-drag-drop-area{border:3px dashed #ddd;height:200px;margin:20px 0 16px;background:#fff;text-align:center;border-radius:30px}.ai1wm-drag-drop-area>*{pointer-events:none}div.ai1wm-expandable.ai1wm-open input{display:inline-block}#ai1wm-import-file,.ai1wm-import-form{position:relative}#ai1wm-import-file input[type=file]{position:absolute;width:100%;height:21px;cursor:pointer;opacity:0;z-index:9999;padding:0;margin:0;top:0;left:0}#ai1wm-import-file input[type=file]::-webkit-file-upload-button{cursor:pointer}.ai1wm-drag-drop-area.dragover{background:rgba(255,255,255,.4);border-color:green}.ai1wm-drag-over.ai1wm-drag-drop-area{border-color:#83b4d8}#ai1wm-import-init{position:absolute;top:10px;left:10%;width:80%;text-align:center}#ai1wm-import-init p{font-size:18px;color:#9e9e9e}#ai1wm-import-init p i{font-size:46px}#ai1wm-import-init div.ai1wm-button-import{pointer-events:all}.ai1wm-max-upload-size{border-bottom:1px solid #000}.ai1wm-progress-bar{position:relative;display:inline-block;background-color:#bdc3c7;height:32px;width:100%;border-radius:15px;top:35px}.ai1wm-progress-bar-meter,.ai1wm-progress-bar-percent{display:inline-block;float:left;height:32px;line-height:32px;color:#fff}.ai1wm-progress-bar-meter{background-color:#2ecc71;border-radius:15px;text-align:center;width:0}.ai1wm-progress-bar-percent{position:absolute;width:50px;left:50%;-webkit-transform:translate(-24px,0);transform:translate(-24px,0);font-size:.5em;background:0 0} \ No newline at end of file diff --git a/lib/view/assets/css/import.min.rtl.css b/lib/view/assets/css/import.min.rtl.css new file mode 100644 index 0000000..d9c7949 --- /dev/null +++ b/lib/view/assets/css/import.min.rtl.css @@ -0,0 +1 @@ +@charset "UTF-8";@-webkit-keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(90deg);transform:rotateZ(90deg)}50%{-webkit-transform:rotateZ(180deg);transform:rotateZ(180deg)}75%{-webkit-transform:rotateZ(270deg);transform:rotateZ(270deg)}to{-webkit-transform:rotateZ(360deg);transform:rotateZ(360deg)}}@keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(90deg);transform:rotateZ(90deg)}50%{-webkit-transform:rotateZ(180deg);transform:rotateZ(180deg)}75%{-webkit-transform:rotateZ(270deg);transform:rotateZ(270deg)}to{-webkit-transform:rotateZ(360deg);transform:rotateZ(360deg)}}@-webkit-keyframes ai1wm-emphasize{0%,to{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@keyframes ai1wm-emphasize{0%,to{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@-webkit-keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}to{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}to{-webkit-transform:scale(1);transform:scale(1)}}.ai1wm-button-group{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;text-transform:uppercase;font-weight:600;transition:background-color .2s ease-out;display:inline-block;text-align:right}.ai1wm-button-group.ai1wm-button-export,.ai1wm-button-group.ai1wm-button-import{box-sizing:content-box}.ai1wm-button-group.ai1wm-button-export.ai1wm-open>.ai1wm-dropdown-menu{height:364px;border-top:1px solid #27ae60}.ai1wm-button-group.ai1wm-button-import.ai1wm-open>.ai1wm-dropdown-menu{height:392px;border-top:1px solid #27ae60}.ai1wm-button-group .ai1wm-button-main{position:relative;padding:6px 25px 6px 50px;box-sizing:content-box}.ai1wm-button-group .ai1wm-dropdown-menu{height:0;overflow:hidden;transition:height .2s cubic-bezier(.19,1,.22,1);border-top:none}.ai1wm-dropdown-menu{list-style:none}.ai1wm-dropdown-menu,.ai1wm-dropdown-menu li{margin:0!important;padding:0}.ai1wm-dropdown-menu li a,.ai1wm-dropdown-menu li a:visited{display:block;padding:5px 26px;text-decoration:none;color:#27ae60;text-align:right;box-sizing:content-box}.ai1wm-dropdown-menu li a:hover,.ai1wm-dropdown-menu li a:visited:hover{text-decoration:none;color:#111}.ai1mw-lines{position:absolute;width:12px;height:10px;top:9px;left:20px}.ai1wm-line{position:absolute;width:100%;height:2px;margin:auto;background:#27ae60;transition:all .2s ease-in-out}.ai1wm-line-first{top:0;right:0}div.ai1wm-open .ai1wm-line-first,div.ai1wm-open .ai1wm-line-third{top:50%}.ai1wm-line-second{top:50%;right:0}.ai1wm-line-third{top:100%;right:0}.ai1wm-button-blue,.ai1wm-button-gray,.ai1wm-button-green,.ai1wm-button-green-small,.ai1wm-button-red{display:inline-block;border:2px solid #95a5a6;background-color:transparent;color:#95a5a6;border-radius:5px;cursor:pointer;padding:5px 26px 5px 25px;text-transform:uppercase;font-weight:600;outline:0;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-gray:hover{background-color:#95a5a6;color:#fff}.ai1wm-button-blue,.ai1wm-button-green,.ai1wm-button-green-small,.ai1wm-button-red{border:2px solid #27ae60;color:#27ae60}.ai1wm-button-green:hover{background-color:#27ae60;color:#fff}.ai1wm-button-blue,.ai1wm-button-green-small,.ai1wm-button-red{border:2px solid #6eb649;color:#6eb649}.ai1wm-button-green-small:hover{background-color:#6eb649;color:#fff}.ai1wm-button-blue,.ai1wm-button-red{border:2px solid #00aff0;color:#00aff0}.ai1wm-button-blue:hover{background-color:#00aff0;color:#fff}.ai1wm-button-red{border:2px solid #e74c3c;color:#e74c3c}.ai1wm-button-red:hover{background-color:#e74c3c;color:#fff}.ai1wm-button-blue[disabled=disabled],.ai1wm-button-green-small[disabled=disabled],.ai1wm-button-green[disabled=disabled],.ai1wm-button-red[disabled=disabled]{opacity:.6;cursor:default}.ai1wm-button-blue[disabled=disabled]:hover{color:#00aff0}.ai1wm-button-red[disabled=disabled]:hover{color:#e74c3c}.ai1wm-button-green[disabled=disabled]:hover{color:#27ae60}.ai1wm-button-blue[disabled=disabled]:hover,.ai1wm-button-green-small[disabled=disabled]:hover,.ai1wm-button-green[disabled=disabled]:hover,.ai1wm-button-red[disabled=disabled]:hover{background:100% 0}.ai1wm-message-close-button{position:absolute;left:10px;top:6px;text-decoration:none;font-size:10px}input[type=radio].ai1wm-flat-radio-button{display:none}input[type=radio].ai1wm-flat-radio-button+a i,input[type=radio].ai1wm-flat-radio-button+label i{vertical-align:middle;float:right;width:25px;height:25px;border-radius:50%;background:100% 0;border:2px solid #ccc;content:" ";cursor:pointer;position:relative;box-sizing:content-box}input[type=radio].ai1wm-flat-radio-button:checked+a i,input[type=radio].ai1wm-flat-radio-button:checked+label i{background-color:#d9d9d9;border-color:#6f6f6f}.ai1wm-clear{*zoom:1;clear:both}.ai1wm-clear:after,.ai1wm-clear:before{content:" ";display:table}.ai1wm-clear:after{clear:both}.ai1wm-container .ai1wm-row label{position:relative;top:-1px}.ai1wm-container .ai1wm-row label:after{content:"\200E"}.ai1wm-share-button-container{text-align:center}.ai1wm-share-button-container .ai1wm-share-button{text-decoration:none;margin:10px;font-size:30px}.ai1wm-report-problem{position:relative;float:left}.ai1wm-report-problem-dialog{position:absolute;z-index:999;width:280px;left:0;background-color:#fff;margin:6px 0 0;padding:15px 15px 10px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;display:none}.ai1wm-report-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-report-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-feedback-cancel:active,.ai1wm-feedback-cancel:link,.ai1wm-feedback-cancel:visited,.ai1wm-report-cancel:active,.ai1wm-report-cancel:link,.ai1wm-report-cancel:visited{float:right;line-height:34px;outline:0;text-decoration:none;color:#e74c3c}.ai1wm-form-submit{float:left}.ai1wm-report-active{display:block}.ai1wm-report-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-report-terms-segment>.ai1wm-report-terms{border-radius:3px}.ai1wm-import-info a,.ai1wm-no-underline,.ai1wm-unlimited-import a{text-decoration:none}.ai1wm-top-negative-four{top:-4px}.ai1wm-feedback-form{display:none}.ai1wm-feedback-types{margin:0;padding:0;list-style:none}.ai1wm-feedback-types li{margin:14px 0;padding:0}.ai1wm-feedback-types>li>a>span,.ai1wm-feedback-types>li>label>span{display:inline-block;padding:5px 8px 6px 0}.ai1wm-feedback-types>li>a{height:29px;outline:0;color:#333;text-deciration:none}.ai1wm-loader{display:inline-block;width:128px;height:128px;position:relative;-webkit-animation:ai1wm-rotate 1.5s infinite linear;animation:ai1wm-rotate 1.5s infinite linear;background:url(../img/logo-128x128.png);background-repeat:no-repeat;background-position:center center}.ai1wm-hide,div.ai1wm-expandable input{display:none}.ai1wm-label{border:1px solid #5cb85c;background-color:transparent;color:#5cb85c;cursor:pointer;text-transform:uppercase;font-weight:600;outline:0;transition:background-color .2s ease-out;padding:.2em .6em;font-size:.8em;border-radius:5px}.ai1wm-label:hover{background-color:#5cb85c;color:#fff}.ai1wm-dialog-message{text-align:right;line-height:1.5em}.ai1wm-import-info{display:inline-block;font-size:12px;font-weight:700;margin-top:16px}[class*=" ai1wm-icon-"],[class^=ai1wm-icon-]{font-family:'servmask';speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ai1wm-icon-file-zip:before{content:"\e60f"}.ai1wm-icon-folder:before{content:"\e60e"}.ai1wm-icon-file:before{content:"\e60b"}.ai1wm-icon-file-content:before{content:"\e60c"}.ai1wm-icon-cloud-upload:before{content:"\e600"}.ai1wm-icon-history:before{content:"\e603"}.ai1wm-icon-notification:before{content:"\e619"}.ai1wm-icon-arrow-down:before{content:"\e604"}.ai1wm-icon-close:before{content:"\e61a"}.ai1wm-icon-wordpress2:before{content:"\e620"}.ai1wm-icon-arrow-right:before{content:"\e605"}.ai1wm-icon-plus2:before{content:"\e607"}.ai1wm-icon-export:before{content:"\e601"}.ai1wm-icon-publish:before{content:"\e602"}.ai1wm-icon-paperplane:before{content:"\e608"}.ai1wm-icon-help:before{content:"\e609"}.ai1wm-icon-chevron-right:before{content:"\e60d"}.ai1wm-icon-dropbox:before{content:"\e606"}.ai1wm-icon-gear:before{content:"\e60a"}.ai1wm-icon-database:before{content:"\e964"}.ai1wm-icon-upload2:before{content:"\e9c6"}.ai1wm-icon-checkmark:before{content:"\ea10"}.ai1wm-icon-checkmark2:before{content:"\ea11"}.ai1wm-icon-enter:before{content:"\ea13"}.ai1wm-icon-exit:before{content:"\ea14"}.ai1wm-icon-amazon:before{content:"\ea87"}.ai1wm-icon-onedrive:before{content:"\eaaf"}@media (min-width:855px){.ai1wm-row{margin-left:399px}.ai1wm-row:after,.ai1wm-row:before{content:" ";display:table}.ai1wm-row:after{clear:both}.ai1wm-left{float:right;width:100%}.ai1wm-right{float:left;width:377px;margin-left:-399px}.ai1wm-right .ai1wm-sidebar{width:100%}.ai1wm-right .ai1wm-segment{width:333px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;color:#333;background-color:#f9f9f9;padding:20px;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box}.ai1wm-right .ai1wm-segment h2{margin:22px 0 0;padding:0;font-weight:700;font-size:14px;text-transform:uppercase;text-align:center}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-holder{position:relative;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-holder h1{float:right;font-weight:300;font-size:22px;text-transform:uppercase}.ai1wm-holder h1 i{position:relative;top:2px}@media (max-width:854px){.ai1wm-container{margin-right:10px!important}.ai1wm-right,.ai1wm-row{margin-left:0!important}.ai1wm-right{float:right!important;width:100%!important;margin-top:18px}.ai1wm-right .ai1wm-sidebar{width:auto!important;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px;border-radius:3px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-container{margin:20px 2px 0 20px}.ai1wm-container:after,.ai1wm-container:before{content:" ";display:table}.ai1wm-container:after{clear:both}.ai1wm-replace-row{width:100%;box-shadow:outset 0 1px 0 0 white;border-radius:3px;color:#333;font-size:11px;font-weight:700;background-color:#f9f9f9;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box;margin-bottom:10px}.ai1wm-field{margin-bottom:4px}.ai1wm-field input[type=text],.ai1wm-field textarea{width:100%;font-weight:400}.ai1wm-field-set{margin-top:18px}.ai1wm-message{-moz-box-sizing:border-box;background-color:#efefef;border-radius:4px;color:rgba(0,0,0,.6);height:auto;margin:10px 0;min-height:18px;padding:6px 10px;position:relative;border:1px solid;transition:opacity .1s ease 0s,color .1s ease 0s,background .1s ease 0s,box-shadow .1s ease 0s}.ai1wm-message.ai1wm-success-message{background-color:#f2f8f0;color:#119000;font-size:12px}.ai1wm-message.ai1wm-info-message{background-color:#d9edf7;color:#31708f;font-size:11px}.ai1wm-message.ai1wm-error-message{background-color:#f1d7d7;color:#a95252;font-size:12px}.ai1wm-message.ai1wm-red-message{color:#d95c5c;border:2px solid #d95c5c;background-color:transparent}.ai1wm-message.ai1wm-red-message h3{margin:.4em 0;color:#d95c5c}.ai1wm-message p{margin:4px 0;font-size:12px}.ai1wm-message-warning{display:block;font-size:14px;line-height:18px;padding:12px 20px;margin:0 0 22px;background-color:#f9f9f9;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;border-right:4px solid #ffba00}.ai1wm-overlay{display:none;position:fixed;top:0;right:0;width:100%;height:100%;background-color:rgba(0,0,0,.7);z-index:100001}.ai1wm-modal-container{position:fixed;display:none;top:50%;right:50%;z-index:100002;width:480px;height:auto;padding:16px;-webkit-transform:translate(240px,-94px);transform:translate(240px,-94px);border:1px solid #fff;box-shadow:0 2px 6px #292929;border-radius:6px;background:#f6f6f6;box-sizing:border-box;text-align:center}.ai1wm-modal-container section{display:block;min-height:102px}.ai1wm-holder h1,.ai1wm-modal-container section h1{margin:0;padding:0}.ai1wm-modal-container section h1 .ai1wm-title-green{color:#27ae60;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-red{color:#e74c3c;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-grey{color:gray;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-loader{width:32px;height:32px;background:url(../img/logo-32x32.png)}.ai1wm-modal-container section h1 .ai1wm-icon-notification{font-size:1.2em;color:#e74c3c}.ai1wm-modal-container section p{margin:0;padding:12px 0}.ai1wm-modal-container section p .ai1wm-modal-sites p{padding:4px 10px;text-align:right}.ai1wm-modal-container section p .ai1wm-modal-sites input,.ai1wm-modal-container section p .ai1wm-modal-sites select{padding:0 6px;width:100%;border-radius:3px;height:30px;line-height:30px}.ai1wm-modal-container section p .ai1wm-modal-subtitle-green{color:#27ae60}.ai1wm-modal-container section p .ai1wm-modal-subtitle-red{color:#e74c3c}.ai1wm-modal-container section p .ai1wm-modal-subdescription{display:block;text-align:right}.ai1wm-modal-container section p a.ai1wm-button-green{display:inline-block;position:relative;top:26px}.ai1wm-modal-container section p a.ai1wm-emphasize{-webkit-animation:ai1wm-emphasize 1s infinite;animation:ai1wm-emphasize 1s infinite}.ai1wm-modal-container section p em{display:block;color:#34495e;font-style:normal}.ai1wm-modal-container section p.ai1wm-import-modal-content{text-align:right}.ai1wm-modal-container .ai1wm-import-modal-actions{border-top:1px solid #ccc;padding-top:1em;text-align:left}.ai1wm-modal-container .ai1wm-import-modal-actions .ai1wm-button-gray{margin-left:1em}.ai1wm-modal-container .ai1wm-import-modal-notice{border-top:1px solid #ccc}.ai1wm-modal-container .ai1wm-import-modal-notice p{font-weight:700;margin:0;padding-top:16px;text-align:center}.ai1wm-drag-drop-area{border:3px dashed #ddd;height:200px;margin:20px 0 16px;background:#fff;text-align:center;border-radius:30px}.ai1wm-drag-drop-area>*{pointer-events:none}div.ai1wm-expandable.ai1wm-open input{display:inline-block}#ai1wm-import-file,.ai1wm-import-form{position:relative}#ai1wm-import-file input[type=file]{position:absolute;width:100%;height:21px;cursor:pointer;opacity:0;z-index:9999;padding:0;margin:0;top:0;right:0}#ai1wm-import-file input[type=file]::-webkit-file-upload-button{cursor:pointer}.ai1wm-drag-drop-area.dragover{background:rgba(255,255,255,.4);border-color:green}.ai1wm-drag-over.ai1wm-drag-drop-area{border-color:#83b4d8}#ai1wm-import-init{position:absolute;top:10px;right:10%;width:80%;text-align:center}#ai1wm-import-init p{font-size:18px;color:#9e9e9e}#ai1wm-import-init p i{font-size:46px}#ai1wm-import-init div.ai1wm-button-import{pointer-events:all}.ai1wm-max-upload-size{border-bottom:1px solid #000}.ai1wm-progress-bar{position:relative;display:inline-block;background-color:#bdc3c7;height:32px;width:100%;border-radius:15px;top:35px}.ai1wm-progress-bar-meter,.ai1wm-progress-bar-percent{display:inline-block;float:right;height:32px;line-height:32px;color:#fff}.ai1wm-progress-bar-meter{background-color:#2ecc71;border-radius:15px;text-align:center;width:0}.ai1wm-progress-bar-percent{position:absolute;width:50px;right:50%;-webkit-transform:translate(24px,0);transform:translate(24px,0);font-size:.5em;background:100% 0} \ No newline at end of file diff --git a/lib/view/assets/css/servmask.min.css b/lib/view/assets/css/servmask.min.css new file mode 100644 index 0000000..de39e18 --- /dev/null +++ b/lib/view/assets/css/servmask.min.css @@ -0,0 +1 @@ +@charset "UTF-8";@-webkit-keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}to{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}to{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@-webkit-keyframes ai1wm-emphasize{0%,to{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@keyframes ai1wm-emphasize{0%,to{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@-webkit-keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}to{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}to{-webkit-transform:scale(1);transform:scale(1)}}.ai1wm-accordion{margin:1em 0;display:block}.ai1wm-accordion h4{cursor:pointer;color:rgba(0,116,162,.8);margin:0}.ai1wm-accordion h4 small{color:#444;font-weight:400}.ai1wm-accordion h4 small:after,.ai1wm-container .ai1wm-row label:after{content:"\200E"}.ai1wm-accordion .ai1wm-icon-arrow-right{transition:transform .1s ease-out;transition:transform .1s ease-out,-webkit-transform .1s ease-out;display:inline-block}.ai1wm-accordion ul{margin:0;padding:0;list-style:none;visibility:hidden;height:0;transition:height .2s cubic-bezier(.19,1,.22,1)}.ai1wm-accordion h4 small,.ai1wm-accordion ul li small{display:inline;float:none;width:auto}.ai1wm-accordion.ai1wm-open h4 .ai1wm-icon-arrow-right{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.ai1wm-accordion.ai1wm-open ul{height:auto;margin:.6em 0 0 2em;visibility:visible}.ai1wm-button-group{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;text-transform:uppercase;font-weight:600;transition:background-color .2s ease-out;display:inline-block;text-align:left}.ai1wm-button-group.ai1wm-button-export,.ai1wm-button-group.ai1wm-button-import{box-sizing:content-box}.ai1wm-button-group.ai1wm-button-export.ai1wm-open>.ai1wm-dropdown-menu{height:364px;border-top:1px solid #27ae60}.ai1wm-button-group.ai1wm-button-import.ai1wm-open>.ai1wm-dropdown-menu{height:392px;border-top:1px solid #27ae60}.ai1wm-button-group .ai1wm-button-main{position:relative;padding:6px 50px 6px 25px;box-sizing:content-box}.ai1wm-button-group .ai1wm-dropdown-menu{height:0;overflow:hidden;transition:height .2s cubic-bezier(.19,1,.22,1);border-top:none}.ai1wm-dropdown-menu{list-style:none}.ai1wm-dropdown-menu,.ai1wm-dropdown-menu li{margin:0!important;padding:0}.ai1wm-dropdown-menu li a,.ai1wm-dropdown-menu li a:visited{display:block;padding:5px 26px;text-decoration:none;color:#27ae60;text-align:left;box-sizing:content-box}.ai1wm-dropdown-menu li a:hover,.ai1wm-dropdown-menu li a:visited:hover{text-decoration:none;color:#111}.ai1mw-lines{position:absolute;width:12px;height:10px;top:9px;right:20px}.ai1wm-line{position:absolute;width:100%;height:2px;margin:auto;background:#27ae60;transition:all .2s ease-in-out}.ai1wm-line-first{top:0;left:0}div.ai1wm-open .ai1wm-line-first,div.ai1wm-open .ai1wm-line-third{top:50%}.ai1wm-line-second{top:50%;left:0}.ai1wm-line-third{top:100%;left:0}.ai1wm-button-blue,.ai1wm-button-gray,.ai1wm-button-green,.ai1wm-button-green-small,.ai1wm-button-red{display:inline-block;border:2px solid #95a5a6;background-color:transparent;color:#95a5a6;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:0;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-gray:hover{background-color:#95a5a6;color:#fff}.ai1wm-button-blue,.ai1wm-button-green,.ai1wm-button-green-small,.ai1wm-button-red{border:2px solid #27ae60;color:#27ae60}.ai1wm-button-green:hover{background-color:#27ae60;color:#fff}.ai1wm-button-blue,.ai1wm-button-green-small,.ai1wm-button-red{border:2px solid #6eb649;color:#6eb649}.ai1wm-button-green-small:hover{background-color:#6eb649;color:#fff}.ai1wm-button-blue,.ai1wm-button-red{border:2px solid #00aff0;color:#00aff0}.ai1wm-button-blue:hover{background-color:#00aff0;color:#fff}.ai1wm-button-red{border:2px solid #e74c3c;color:#e74c3c}.ai1wm-button-red:hover{background-color:#e74c3c;color:#fff}.ai1wm-button-blue[disabled=disabled],.ai1wm-button-green-small[disabled=disabled],.ai1wm-button-green[disabled=disabled],.ai1wm-button-red[disabled=disabled]{opacity:.6;cursor:default}.ai1wm-button-blue[disabled=disabled]:hover{color:#00aff0}.ai1wm-button-red[disabled=disabled]:hover{color:#e74c3c}.ai1wm-button-green[disabled=disabled]:hover{color:#27ae60}.ai1wm-button-blue[disabled=disabled]:hover,.ai1wm-button-green-small[disabled=disabled]:hover,.ai1wm-button-green[disabled=disabled]:hover,.ai1wm-button-red[disabled=disabled]:hover{background:0 0}.ai1wm-message-close-button{position:absolute;right:10px;top:6px;text-decoration:none;font-size:10px}input[type=radio].ai1wm-flat-radio-button{display:none}input[type=radio].ai1wm-flat-radio-button+a i,input[type=radio].ai1wm-flat-radio-button+label i{vertical-align:middle;float:left;width:25px;height:25px;border-radius:50%;background:0 0;border:2px solid #ccc;content:" ";cursor:pointer;position:relative;box-sizing:content-box}input[type=radio].ai1wm-flat-radio-button:checked+a i,input[type=radio].ai1wm-flat-radio-button:checked+label i{background-color:#d9d9d9;border-color:#6f6f6f}.ai1wm-clear{*zoom:1;clear:both}.ai1wm-clear:after,.ai1wm-clear:before{content:" ";display:table}.ai1wm-clear:after{clear:both}.ai1wm-container .ai1wm-row label{position:relative;top:-1px}.ai1wm-share-button-container{text-align:center}.ai1wm-share-button-container .ai1wm-share-button{text-decoration:none;margin:10px;font-size:30px}.ai1wm-report-problem{position:relative;float:right}.ai1wm-report-problem-dialog{position:absolute;z-index:999;width:280px;right:0;background-color:#fff;margin:6px 0 0;padding:15px 15px 10px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;display:none}.ai1wm-report-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-report-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-feedback-cancel:active,.ai1wm-feedback-cancel:link,.ai1wm-feedback-cancel:visited,.ai1wm-report-cancel:active,.ai1wm-report-cancel:link,.ai1wm-report-cancel:visited{float:left;line-height:34px;outline:0;text-decoration:none;color:#e74c3c}.ai1wm-form-submit{float:right}.ai1wm-report-active{display:block}.ai1wm-report-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-report-terms-segment>.ai1wm-report-terms{border-radius:3px}.ai1wm-import-info a,.ai1wm-no-underline{text-decoration:none}.ai1wm-top-negative-four{top:-4px}.ai1wm-feedback-form{display:none}.ai1wm-feedback-types{margin:0;padding:0;list-style:none}.ai1wm-feedback-types li{margin:14px 0;padding:0}.ai1wm-feedback-types>li>a>span,.ai1wm-feedback-types>li>label>span{display:inline-block;padding:5px 0 6px 8px}.ai1wm-feedback-types>li>a{height:29px;outline:0;color:#333;text-deciration:none}.ai1wm-loader{display:inline-block;width:128px;height:128px;position:relative;-webkit-animation:ai1wm-rotate 1.5s infinite linear;animation:ai1wm-rotate 1.5s infinite linear;background:url(../img/logo-128x128.png);background-repeat:no-repeat;background-position:center center}.ai1wm-hide{display:none}.ai1wm-label{border:1px solid #5cb85c;background-color:transparent;color:#5cb85c;cursor:pointer;text-transform:uppercase;font-weight:600;outline:0;transition:background-color .2s ease-out;padding:.2em .6em;font-size:.8em;border-radius:5px}.ai1wm-label:hover{background-color:#5cb85c;color:#fff}.ai1wm-dialog-message{text-align:left;line-height:1.5em}.ai1wm-import-info{display:inline-block;font-size:12px;font-weight:700;margin-top:16px}[class*=" ai1wm-icon-"],[class^=ai1wm-icon-]{font-family:'servmask';speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ai1wm-icon-file-zip:before{content:"\e60f"}.ai1wm-icon-folder:before{content:"\e60e"}.ai1wm-icon-file:before{content:"\e60b"}.ai1wm-icon-file-content:before{content:"\e60c"}.ai1wm-icon-cloud-upload:before{content:"\e600"}.ai1wm-icon-history:before{content:"\e603"}.ai1wm-icon-notification:before{content:"\e619"}.ai1wm-icon-arrow-down:before{content:"\e604"}.ai1wm-icon-close:before{content:"\e61a"}.ai1wm-icon-wordpress2:before{content:"\e620"}.ai1wm-icon-arrow-right:before{content:"\e605"}.ai1wm-icon-plus2:before{content:"\e607"}.ai1wm-icon-export:before{content:"\e601"}.ai1wm-icon-publish:before{content:"\e602"}.ai1wm-icon-paperplane:before{content:"\e608"}.ai1wm-icon-help:before{content:"\e609"}.ai1wm-icon-chevron-right:before{content:"\e60d"}.ai1wm-icon-dropbox:before{content:"\e606"}.ai1wm-icon-gear:before{content:"\e60a"}.ai1wm-icon-database:before{content:"\e964"}.ai1wm-icon-upload2:before{content:"\e9c6"}.ai1wm-icon-checkmark:before{content:"\ea10"}.ai1wm-icon-checkmark2:before{content:"\ea11"}.ai1wm-icon-enter:before{content:"\ea13"}.ai1wm-icon-exit:before{content:"\ea14"}.ai1wm-icon-amazon:before{content:"\ea87"}.ai1wm-icon-onedrive:before{content:"\eaaf"}@media (min-width:855px){.ai1wm-row{margin-right:399px}.ai1wm-row:after,.ai1wm-row:before{content:" ";display:table}.ai1wm-row:after{clear:both}.ai1wm-left{float:left;width:100%}.ai1wm-right{float:right;width:377px;margin-right:-399px}.ai1wm-right .ai1wm-sidebar{width:100%}.ai1wm-right .ai1wm-segment{width:333px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;color:#333;background-color:#f9f9f9;padding:20px;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box}.ai1wm-right .ai1wm-segment h2{margin:22px 0 0;padding:0;font-weight:700;font-size:14px;text-transform:uppercase;text-align:center}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-holder{position:relative;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-holder h1{float:left;font-weight:300;font-size:22px;text-transform:uppercase}.ai1wm-holder h1 i{position:relative;top:2px}@media (max-width:854px){.ai1wm-container{margin-left:10px!important}.ai1wm-right,.ai1wm-row{margin-right:0!important}.ai1wm-right{float:left!important;width:100%!important;margin-top:18px}.ai1wm-right .ai1wm-sidebar{width:auto!important;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px;border-radius:3px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-container{margin:20px 20px 0 2px}.ai1wm-container:after,.ai1wm-container:before{content:" ";display:table}.ai1wm-container:after{clear:both}.ai1wm-replace-row{width:100%;box-shadow:outset 0 1px 0 0 white;border-radius:3px;color:#333;font-size:11px;font-weight:700;background-color:#f9f9f9;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box;margin-bottom:10px}.ai1wm-field{margin-bottom:4px}.ai1wm-field input[type=text],.ai1wm-field textarea{width:100%;font-weight:400}.ai1wm-field-set{margin-top:18px}.ai1wm-message{-moz-box-sizing:border-box;background-color:#efefef;border-radius:4px;color:rgba(0,0,0,.6);height:auto;margin:10px 0;min-height:18px;padding:6px 10px;position:relative;border:1px solid;transition:opacity .1s ease 0s,color .1s ease 0s,background .1s ease 0s,box-shadow .1s ease 0s}.ai1wm-message.ai1wm-success-message{background-color:#f2f8f0;color:#119000;font-size:12px}.ai1wm-message.ai1wm-info-message{background-color:#d9edf7;color:#31708f;font-size:11px}.ai1wm-message.ai1wm-error-message{background-color:#f1d7d7;color:#a95252;font-size:12px}.ai1wm-message.ai1wm-red-message{color:#d95c5c;border:2px solid #d95c5c;background-color:transparent}.ai1wm-message.ai1wm-red-message h3{margin:.4em 0;color:#d95c5c}.ai1wm-message p{margin:4px 0;font-size:12px}.ai1wm-message-warning{display:block;font-size:14px;line-height:18px;padding:12px 20px;margin:0 0 22px;background-color:#f9f9f9;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;border-left:4px solid #ffba00}.ai1wm-overlay{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.7);z-index:100001}.ai1wm-modal-container{position:fixed;display:none;top:50%;left:50%;z-index:100002;width:480px;height:auto;padding:16px;-webkit-transform:translate(-240px,-94px);transform:translate(-240px,-94px);border:1px solid #fff;box-shadow:0 2px 6px #292929;border-radius:6px;background:#f6f6f6;box-sizing:border-box;text-align:center}.ai1wm-modal-container section{display:block;min-height:102px}.ai1wm-holder h1,.ai1wm-modal-container section h1{margin:0;padding:0}.ai1wm-modal-container section h1 .ai1wm-title-green{color:#27ae60;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-red{color:#e74c3c;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-grey{color:gray;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-loader{width:32px;height:32px;background:url(../img/logo-32x32.png)}.ai1wm-modal-container section h1 .ai1wm-icon-notification{font-size:1.2em;color:#e74c3c}.ai1wm-modal-container section p{margin:0;padding:12px 0}.ai1wm-modal-container section p .ai1wm-modal-sites p{padding:4px 10px;text-align:left}.ai1wm-modal-container section p .ai1wm-modal-sites input,.ai1wm-modal-container section p .ai1wm-modal-sites select{padding:0 6px;width:100%;border-radius:3px;height:30px;line-height:30px}.ai1wm-modal-container section p .ai1wm-modal-subtitle-green{color:#27ae60}.ai1wm-modal-container section p .ai1wm-modal-subtitle-red{color:#e74c3c}.ai1wm-modal-container section p .ai1wm-modal-subdescription{display:block;text-align:left}.ai1wm-modal-container section p a.ai1wm-button-green{display:inline-block;position:relative;top:26px}.ai1wm-modal-container section p a.ai1wm-emphasize{-webkit-animation:ai1wm-emphasize 1s infinite;animation:ai1wm-emphasize 1s infinite}.ai1wm-modal-container section p em{display:block;color:#34495e;font-style:normal}.ai1wm-modal-container section p.ai1wm-import-modal-content{text-align:left}.ai1wm-modal-container .ai1wm-import-modal-actions{border-top:1px solid #ccc;padding-top:1em;text-align:right}.ai1wm-modal-container .ai1wm-import-modal-actions .ai1wm-button-gray{margin-right:1em}.ai1wm-modal-container .ai1wm-import-modal-notice{border-top:1px solid #ccc}.ai1wm-modal-container .ai1wm-import-modal-notice p{font-weight:700;margin:0;padding-top:16px;text-align:center} \ No newline at end of file diff --git a/lib/view/assets/css/servmask.min.rtl.css b/lib/view/assets/css/servmask.min.rtl.css new file mode 100644 index 0000000..8f697d3 --- /dev/null +++ b/lib/view/assets/css/servmask.min.rtl.css @@ -0,0 +1 @@ +@charset "UTF-8";@-webkit-keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(90deg);transform:rotateZ(90deg)}50%{-webkit-transform:rotateZ(180deg);transform:rotateZ(180deg)}75%{-webkit-transform:rotateZ(270deg);transform:rotateZ(270deg)}to{-webkit-transform:rotateZ(360deg);transform:rotateZ(360deg)}}@keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(90deg);transform:rotateZ(90deg)}50%{-webkit-transform:rotateZ(180deg);transform:rotateZ(180deg)}75%{-webkit-transform:rotateZ(270deg);transform:rotateZ(270deg)}to{-webkit-transform:rotateZ(360deg);transform:rotateZ(360deg)}}@-webkit-keyframes ai1wm-emphasize{0%,to{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@keyframes ai1wm-emphasize{0%,to{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@-webkit-keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}to{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}to{-webkit-transform:scale(1);transform:scale(1)}}.ai1wm-accordion{margin:1em 0;display:block}.ai1wm-accordion h4{cursor:pointer;color:rgba(0,116,162,.8);margin:0}.ai1wm-accordion h4 small{color:#444;font-weight:400}.ai1wm-accordion h4 small:after,.ai1wm-container .ai1wm-row label:after{content:"\200E"}.ai1wm-accordion .ai1wm-icon-arrow-right{transition:transform .1s ease-out;transition:transform .1s ease-out,-webkit-transform .1s ease-out;display:inline-block}.ai1wm-accordion ul{margin:0;padding:0;list-style:none;visibility:hidden;height:0;transition:height .2s cubic-bezier(.19,1,.22,1)}.ai1wm-accordion h4 small,.ai1wm-accordion ul li small{display:inline;float:none;width:auto}.ai1wm-accordion.ai1wm-open h4 .ai1wm-icon-arrow-right{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.ai1wm-accordion.ai1wm-open ul{height:auto;margin:.6em 2em 0 0;visibility:visible}.ai1wm-button-group{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;text-transform:uppercase;font-weight:600;transition:background-color .2s ease-out;display:inline-block;text-align:right}.ai1wm-button-group.ai1wm-button-export,.ai1wm-button-group.ai1wm-button-import{box-sizing:content-box}.ai1wm-button-group.ai1wm-button-export.ai1wm-open>.ai1wm-dropdown-menu{height:364px;border-top:1px solid #27ae60}.ai1wm-button-group.ai1wm-button-import.ai1wm-open>.ai1wm-dropdown-menu{height:392px;border-top:1px solid #27ae60}.ai1wm-button-group .ai1wm-button-main{position:relative;padding:6px 25px 6px 50px;box-sizing:content-box}.ai1wm-button-group .ai1wm-dropdown-menu{height:0;overflow:hidden;transition:height .2s cubic-bezier(.19,1,.22,1);border-top:none}.ai1wm-dropdown-menu{list-style:none}.ai1wm-dropdown-menu,.ai1wm-dropdown-menu li{margin:0!important;padding:0}.ai1wm-dropdown-menu li a,.ai1wm-dropdown-menu li a:visited{display:block;padding:5px 26px;text-decoration:none;color:#27ae60;text-align:right;box-sizing:content-box}.ai1wm-dropdown-menu li a:hover,.ai1wm-dropdown-menu li a:visited:hover{text-decoration:none;color:#111}.ai1mw-lines{position:absolute;width:12px;height:10px;top:9px;left:20px}.ai1wm-line{position:absolute;width:100%;height:2px;margin:auto;background:#27ae60;transition:all .2s ease-in-out}.ai1wm-line-first{top:0;right:0}div.ai1wm-open .ai1wm-line-first,div.ai1wm-open .ai1wm-line-third{top:50%}.ai1wm-line-second{top:50%;right:0}.ai1wm-line-third{top:100%;right:0}.ai1wm-button-blue,.ai1wm-button-gray,.ai1wm-button-green,.ai1wm-button-green-small,.ai1wm-button-red{display:inline-block;border:2px solid #95a5a6;background-color:transparent;color:#95a5a6;border-radius:5px;cursor:pointer;padding:5px 26px 5px 25px;text-transform:uppercase;font-weight:600;outline:0;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-gray:hover{background-color:#95a5a6;color:#fff}.ai1wm-button-blue,.ai1wm-button-green,.ai1wm-button-green-small,.ai1wm-button-red{border:2px solid #27ae60;color:#27ae60}.ai1wm-button-green:hover{background-color:#27ae60;color:#fff}.ai1wm-button-blue,.ai1wm-button-green-small,.ai1wm-button-red{border:2px solid #6eb649;color:#6eb649}.ai1wm-button-green-small:hover{background-color:#6eb649;color:#fff}.ai1wm-button-blue,.ai1wm-button-red{border:2px solid #00aff0;color:#00aff0}.ai1wm-button-blue:hover{background-color:#00aff0;color:#fff}.ai1wm-button-red{border:2px solid #e74c3c;color:#e74c3c}.ai1wm-button-red:hover{background-color:#e74c3c;color:#fff}.ai1wm-button-blue[disabled=disabled],.ai1wm-button-green-small[disabled=disabled],.ai1wm-button-green[disabled=disabled],.ai1wm-button-red[disabled=disabled]{opacity:.6;cursor:default}.ai1wm-button-blue[disabled=disabled]:hover{color:#00aff0}.ai1wm-button-red[disabled=disabled]:hover{color:#e74c3c}.ai1wm-button-green[disabled=disabled]:hover{color:#27ae60}.ai1wm-button-blue[disabled=disabled]:hover,.ai1wm-button-green-small[disabled=disabled]:hover,.ai1wm-button-green[disabled=disabled]:hover,.ai1wm-button-red[disabled=disabled]:hover{background:100% 0}.ai1wm-message-close-button{position:absolute;left:10px;top:6px;text-decoration:none;font-size:10px}input[type=radio].ai1wm-flat-radio-button{display:none}input[type=radio].ai1wm-flat-radio-button+a i,input[type=radio].ai1wm-flat-radio-button+label i{vertical-align:middle;float:right;width:25px;height:25px;border-radius:50%;background:100% 0;border:2px solid #ccc;content:" ";cursor:pointer;position:relative;box-sizing:content-box}input[type=radio].ai1wm-flat-radio-button:checked+a i,input[type=radio].ai1wm-flat-radio-button:checked+label i{background-color:#d9d9d9;border-color:#6f6f6f}.ai1wm-clear{*zoom:1;clear:both}.ai1wm-clear:after,.ai1wm-clear:before{content:" ";display:table}.ai1wm-clear:after{clear:both}.ai1wm-container .ai1wm-row label{position:relative;top:-1px}.ai1wm-share-button-container{text-align:center}.ai1wm-share-button-container .ai1wm-share-button{text-decoration:none;margin:10px;font-size:30px}.ai1wm-report-problem{position:relative;float:left}.ai1wm-report-problem-dialog{position:absolute;z-index:999;width:280px;left:0;background-color:#fff;margin:6px 0 0;padding:15px 15px 10px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;display:none}.ai1wm-report-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-report-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-feedback-cancel:active,.ai1wm-feedback-cancel:link,.ai1wm-feedback-cancel:visited,.ai1wm-report-cancel:active,.ai1wm-report-cancel:link,.ai1wm-report-cancel:visited{float:right;line-height:34px;outline:0;text-decoration:none;color:#e74c3c}.ai1wm-form-submit{float:left}.ai1wm-report-active{display:block}.ai1wm-report-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-report-terms-segment>.ai1wm-report-terms{border-radius:3px}.ai1wm-import-info a,.ai1wm-no-underline{text-decoration:none}.ai1wm-top-negative-four{top:-4px}.ai1wm-feedback-form{display:none}.ai1wm-feedback-types{margin:0;padding:0;list-style:none}.ai1wm-feedback-types li{margin:14px 0;padding:0}.ai1wm-feedback-types>li>a>span,.ai1wm-feedback-types>li>label>span{display:inline-block;padding:5px 8px 6px 0}.ai1wm-feedback-types>li>a{height:29px;outline:0;color:#333;text-deciration:none}.ai1wm-loader{display:inline-block;width:128px;height:128px;position:relative;-webkit-animation:ai1wm-rotate 1.5s infinite linear;animation:ai1wm-rotate 1.5s infinite linear;background:url(../img/logo-128x128.png);background-repeat:no-repeat;background-position:center center}.ai1wm-hide{display:none}.ai1wm-label{border:1px solid #5cb85c;background-color:transparent;color:#5cb85c;cursor:pointer;text-transform:uppercase;font-weight:600;outline:0;transition:background-color .2s ease-out;padding:.2em .6em;font-size:.8em;border-radius:5px}.ai1wm-label:hover{background-color:#5cb85c;color:#fff}.ai1wm-dialog-message{text-align:right;line-height:1.5em}.ai1wm-import-info{display:inline-block;font-size:12px;font-weight:700;margin-top:16px}[class*=" ai1wm-icon-"],[class^=ai1wm-icon-]{font-family:'servmask';speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ai1wm-icon-file-zip:before{content:"\e60f"}.ai1wm-icon-folder:before{content:"\e60e"}.ai1wm-icon-file:before{content:"\e60b"}.ai1wm-icon-file-content:before{content:"\e60c"}.ai1wm-icon-cloud-upload:before{content:"\e600"}.ai1wm-icon-history:before{content:"\e603"}.ai1wm-icon-notification:before{content:"\e619"}.ai1wm-icon-arrow-down:before{content:"\e604"}.ai1wm-icon-close:before{content:"\e61a"}.ai1wm-icon-wordpress2:before{content:"\e620"}.ai1wm-icon-arrow-right:before{content:"\e605"}.ai1wm-icon-plus2:before{content:"\e607"}.ai1wm-icon-export:before{content:"\e601"}.ai1wm-icon-publish:before{content:"\e602"}.ai1wm-icon-paperplane:before{content:"\e608"}.ai1wm-icon-help:before{content:"\e609"}.ai1wm-icon-chevron-right:before{content:"\e60d"}.ai1wm-icon-dropbox:before{content:"\e606"}.ai1wm-icon-gear:before{content:"\e60a"}.ai1wm-icon-database:before{content:"\e964"}.ai1wm-icon-upload2:before{content:"\e9c6"}.ai1wm-icon-checkmark:before{content:"\ea10"}.ai1wm-icon-checkmark2:before{content:"\ea11"}.ai1wm-icon-enter:before{content:"\ea13"}.ai1wm-icon-exit:before{content:"\ea14"}.ai1wm-icon-amazon:before{content:"\ea87"}.ai1wm-icon-onedrive:before{content:"\eaaf"}@media (min-width:855px){.ai1wm-row{margin-left:399px}.ai1wm-row:after,.ai1wm-row:before{content:" ";display:table}.ai1wm-row:after{clear:both}.ai1wm-left{float:right;width:100%}.ai1wm-right{float:left;width:377px;margin-left:-399px}.ai1wm-right .ai1wm-sidebar{width:100%}.ai1wm-right .ai1wm-segment{width:333px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;color:#333;background-color:#f9f9f9;padding:20px;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box}.ai1wm-right .ai1wm-segment h2{margin:22px 0 0;padding:0;font-weight:700;font-size:14px;text-transform:uppercase;text-align:center}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-holder{position:relative;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-holder h1{float:right;font-weight:300;font-size:22px;text-transform:uppercase}.ai1wm-holder h1 i{position:relative;top:2px}@media (max-width:854px){.ai1wm-container{margin-right:10px!important}.ai1wm-right,.ai1wm-row{margin-left:0!important}.ai1wm-right{float:right!important;width:100%!important;margin-top:18px}.ai1wm-right .ai1wm-sidebar{width:auto!important;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px;border-radius:3px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-container{margin:20px 2px 0 20px}.ai1wm-container:after,.ai1wm-container:before{content:" ";display:table}.ai1wm-container:after{clear:both}.ai1wm-replace-row{width:100%;box-shadow:outset 0 1px 0 0 white;border-radius:3px;color:#333;font-size:11px;font-weight:700;background-color:#f9f9f9;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box;margin-bottom:10px}.ai1wm-field{margin-bottom:4px}.ai1wm-field input[type=text],.ai1wm-field textarea{width:100%;font-weight:400}.ai1wm-field-set{margin-top:18px}.ai1wm-message{-moz-box-sizing:border-box;background-color:#efefef;border-radius:4px;color:rgba(0,0,0,.6);height:auto;margin:10px 0;min-height:18px;padding:6px 10px;position:relative;border:1px solid;transition:opacity .1s ease 0s,color .1s ease 0s,background .1s ease 0s,box-shadow .1s ease 0s}.ai1wm-message.ai1wm-success-message{background-color:#f2f8f0;color:#119000;font-size:12px}.ai1wm-message.ai1wm-info-message{background-color:#d9edf7;color:#31708f;font-size:11px}.ai1wm-message.ai1wm-error-message{background-color:#f1d7d7;color:#a95252;font-size:12px}.ai1wm-message.ai1wm-red-message{color:#d95c5c;border:2px solid #d95c5c;background-color:transparent}.ai1wm-message.ai1wm-red-message h3{margin:.4em 0;color:#d95c5c}.ai1wm-message p{margin:4px 0;font-size:12px}.ai1wm-message-warning{display:block;font-size:14px;line-height:18px;padding:12px 20px;margin:0 0 22px;background-color:#f9f9f9;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;border-right:4px solid #ffba00}.ai1wm-overlay{display:none;position:fixed;top:0;right:0;width:100%;height:100%;background-color:rgba(0,0,0,.7);z-index:100001}.ai1wm-modal-container{position:fixed;display:none;top:50%;right:50%;z-index:100002;width:480px;height:auto;padding:16px;-webkit-transform:translate(240px,-94px);transform:translate(240px,-94px);border:1px solid #fff;box-shadow:0 2px 6px #292929;border-radius:6px;background:#f6f6f6;box-sizing:border-box;text-align:center}.ai1wm-modal-container section{display:block;min-height:102px}.ai1wm-holder h1,.ai1wm-modal-container section h1{margin:0;padding:0}.ai1wm-modal-container section h1 .ai1wm-title-green{color:#27ae60;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-red{color:#e74c3c;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-grey{color:gray;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-loader{width:32px;height:32px;background:url(../img/logo-32x32.png)}.ai1wm-modal-container section h1 .ai1wm-icon-notification{font-size:1.2em;color:#e74c3c}.ai1wm-modal-container section p{margin:0;padding:12px 0}.ai1wm-modal-container section p .ai1wm-modal-sites p{padding:4px 10px;text-align:right}.ai1wm-modal-container section p .ai1wm-modal-sites input,.ai1wm-modal-container section p .ai1wm-modal-sites select{padding:0 6px;width:100%;border-radius:3px;height:30px;line-height:30px}.ai1wm-modal-container section p .ai1wm-modal-subtitle-green{color:#27ae60}.ai1wm-modal-container section p .ai1wm-modal-subtitle-red{color:#e74c3c}.ai1wm-modal-container section p .ai1wm-modal-subdescription{display:block;text-align:right}.ai1wm-modal-container section p a.ai1wm-button-green{display:inline-block;position:relative;top:26px}.ai1wm-modal-container section p a.ai1wm-emphasize{-webkit-animation:ai1wm-emphasize 1s infinite;animation:ai1wm-emphasize 1s infinite}.ai1wm-modal-container section p em{display:block;color:#34495e;font-style:normal}.ai1wm-modal-container section p.ai1wm-import-modal-content{text-align:right}.ai1wm-modal-container .ai1wm-import-modal-actions{border-top:1px solid #ccc;padding-top:1em;text-align:left}.ai1wm-modal-container .ai1wm-import-modal-actions .ai1wm-button-gray{margin-left:1em}.ai1wm-modal-container .ai1wm-import-modal-notice{border-top:1px solid #ccc}.ai1wm-modal-container .ai1wm-import-modal-notice p{font-weight:700;margin:0;padding-top:16px;text-align:center} \ No newline at end of file diff --git a/lib/view/assets/css/updater.min.css b/lib/view/assets/css/updater.min.css new file mode 100644 index 0000000..a0b1daa --- /dev/null +++ b/lib/view/assets/css/updater.min.css @@ -0,0 +1 @@ +@charset "UTF-8";.ai1wm-button-group{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;text-transform:uppercase;font-weight:600;transition:background-color .2s ease-out;display:inline-block;text-align:left}.ai1wm-button-group.ai1wm-button-export,.ai1wm-button-group.ai1wm-button-import{box-sizing:content-box}.ai1wm-button-group.ai1wm-button-export.ai1wm-open>.ai1wm-dropdown-menu{height:364px;border-top:1px solid #27ae60}.ai1wm-button-group.ai1wm-button-import.ai1wm-open>.ai1wm-dropdown-menu{height:392px;border-top:1px solid #27ae60}.ai1wm-button-group .ai1wm-button-main{position:relative;padding:6px 50px 6px 25px;box-sizing:content-box}.ai1wm-button-group .ai1wm-dropdown-menu{height:0;overflow:hidden;transition:height .2s cubic-bezier(.19,1,.22,1);border-top:none}.ai1wm-dropdown-menu{list-style:none}.ai1wm-dropdown-menu,.ai1wm-dropdown-menu li{margin:0!important;padding:0}.ai1wm-dropdown-menu li a,.ai1wm-dropdown-menu li a:visited{display:block;padding:5px 26px;text-decoration:none;color:#27ae60;text-align:left;box-sizing:content-box}.ai1wm-dropdown-menu li a:hover,.ai1wm-dropdown-menu li a:visited:hover{text-decoration:none;color:#111}.ai1mw-lines{position:absolute;width:12px;height:10px;top:9px;right:20px}.ai1wm-line{position:absolute;width:100%;height:2px;margin:auto;background:#27ae60;transition:all .2s ease-in-out}.ai1wm-line-first{top:0;left:0}div.ai1wm-open .ai1wm-line-first,div.ai1wm-open .ai1wm-line-third{top:50%}.ai1wm-line-second{top:50%;left:0}.ai1wm-line-third{top:100%;left:0}.ai1wm-button-blue,.ai1wm-button-gray,.ai1wm-button-green,.ai1wm-button-green-small,.ai1wm-button-red{display:inline-block;border:2px solid #95a5a6;background-color:transparent;color:#95a5a6;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:0;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-gray:hover{background-color:#95a5a6;color:#fff}.ai1wm-button-blue,.ai1wm-button-green,.ai1wm-button-green-small,.ai1wm-button-red{border:2px solid #27ae60;color:#27ae60}.ai1wm-button-green:hover{background-color:#27ae60;color:#fff}.ai1wm-button-blue,.ai1wm-button-green-small,.ai1wm-button-red{border:2px solid #6eb649;color:#6eb649}.ai1wm-button-green-small:hover{background-color:#6eb649;color:#fff}.ai1wm-button-blue,.ai1wm-button-red{border:2px solid #00aff0;color:#00aff0}.ai1wm-button-blue:hover{background-color:#00aff0;color:#fff}.ai1wm-button-red{border:2px solid #e74c3c;color:#e74c3c}.ai1wm-button-red:hover{background-color:#e74c3c;color:#fff}.ai1wm-button-blue[disabled=disabled],.ai1wm-button-green-small[disabled=disabled],.ai1wm-button-green[disabled=disabled],.ai1wm-button-red[disabled=disabled]{opacity:.6;cursor:default}.ai1wm-button-blue[disabled=disabled]:hover{color:#00aff0}.ai1wm-button-red[disabled=disabled]:hover{color:#e74c3c}.ai1wm-button-green[disabled=disabled]:hover{color:#27ae60}.ai1wm-button-blue[disabled=disabled]:hover,.ai1wm-button-green-small[disabled=disabled]:hover,.ai1wm-button-green[disabled=disabled]:hover,.ai1wm-button-red[disabled=disabled]:hover{background:0 0}.ai1wm-message-close-button{position:absolute;right:10px;top:6px;text-decoration:none;font-size:10px}input[type=radio].ai1wm-flat-radio-button{display:none}input[type=radio].ai1wm-flat-radio-button+a i,input[type=radio].ai1wm-flat-radio-button+label i{vertical-align:middle;float:left;width:25px;height:25px;border-radius:50%;background:0 0;border:2px solid #ccc;content:" ";cursor:pointer;position:relative;box-sizing:content-box}input[type=radio].ai1wm-flat-radio-button:checked+a i,input[type=radio].ai1wm-flat-radio-button:checked+label i{background-color:#d9d9d9;border-color:#6f6f6f}.ai1wm-icon-update{font-size:13px;padding:0;margin:0;font-weight:400}.ai1wm-icon-update:before{color:#d54e21;content:'\f463';display:inline-block;font:20px/1 'dashicons';speak:none;padding:0;margin:0;vertical-align:top}.ai1wm-modal-dialog{position:fixed;top:0;right:0;bottom:0;left:0;background:rgba(0,0,0,.7);z-index:99999;opacity:0;transition:opacity 400ms ease-in;pointer-events:none}.ai1wm-modal-dialog:target{opacity:1;pointer-events:auto}.ai1wm-modal-dialog .ai1wm-modal-container{position:fixed;top:50%;left:50%;z-index:100002;width:480px;height:auto;padding:6px 16px 10px;-webkit-transform:translate(-240px,-94px);transform:translate(-240px,-94px);border:1px solid #fff;box-shadow:0 2px 6px #292929;border-radius:6px;background:#f6f6f6;box-sizing:border-box}.ai1wm-modal-dialog .ai1wm-modal-container .ai1wm-modal-error{color:red}.ai1wm-modal-dialog .ai1wm-modal-container .ai1wm-modal-buttons{text-align:left}.ai1wm-modal-dialog .ai1wm-modal-container .ai1wm-purchase-id{width:100%;padding:6px}.ai1wm-modal-dialog .ai1wm-modal-container .ai1wm-help-link{font-weight:700}.ai1wm-modal-dialog .ai1wm-modal-container .ai1wm-purchase-discard{margin-left:1em} \ No newline at end of file diff --git a/lib/view/assets/css/updater.min.rtl.css b/lib/view/assets/css/updater.min.rtl.css new file mode 100644 index 0000000..8f91e6a --- /dev/null +++ b/lib/view/assets/css/updater.min.rtl.css @@ -0,0 +1 @@ +@charset "UTF-8";.ai1wm-button-group{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;text-transform:uppercase;font-weight:600;transition:background-color .2s ease-out;display:inline-block;text-align:right}.ai1wm-button-group.ai1wm-button-export,.ai1wm-button-group.ai1wm-button-import{box-sizing:content-box}.ai1wm-button-group.ai1wm-button-export.ai1wm-open>.ai1wm-dropdown-menu{height:364px;border-top:1px solid #27ae60}.ai1wm-button-group.ai1wm-button-import.ai1wm-open>.ai1wm-dropdown-menu{height:392px;border-top:1px solid #27ae60}.ai1wm-button-group .ai1wm-button-main{position:relative;padding:6px 25px 6px 50px;box-sizing:content-box}.ai1wm-button-group .ai1wm-dropdown-menu{height:0;overflow:hidden;transition:height .2s cubic-bezier(.19,1,.22,1);border-top:none}.ai1wm-dropdown-menu{list-style:none}.ai1wm-dropdown-menu,.ai1wm-dropdown-menu li{margin:0!important;padding:0}.ai1wm-dropdown-menu li a,.ai1wm-dropdown-menu li a:visited{display:block;padding:5px 26px;text-decoration:none;color:#27ae60;text-align:right;box-sizing:content-box}.ai1wm-dropdown-menu li a:hover,.ai1wm-dropdown-menu li a:visited:hover{text-decoration:none;color:#111}.ai1mw-lines{position:absolute;width:12px;height:10px;top:9px;left:20px}.ai1wm-line{position:absolute;width:100%;height:2px;margin:auto;background:#27ae60;transition:all .2s ease-in-out}.ai1wm-line-first{top:0;right:0}div.ai1wm-open .ai1wm-line-first,div.ai1wm-open .ai1wm-line-third{top:50%}.ai1wm-line-second{top:50%;right:0}.ai1wm-line-third{top:100%;right:0}.ai1wm-button-blue,.ai1wm-button-gray,.ai1wm-button-green,.ai1wm-button-green-small,.ai1wm-button-red{display:inline-block;border:2px solid #95a5a6;background-color:transparent;color:#95a5a6;border-radius:5px;cursor:pointer;padding:5px 26px 5px 25px;text-transform:uppercase;font-weight:600;outline:0;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-gray:hover{background-color:#95a5a6;color:#fff}.ai1wm-button-blue,.ai1wm-button-green,.ai1wm-button-green-small,.ai1wm-button-red{border:2px solid #27ae60;color:#27ae60}.ai1wm-button-green:hover{background-color:#27ae60;color:#fff}.ai1wm-button-blue,.ai1wm-button-green-small,.ai1wm-button-red{border:2px solid #6eb649;color:#6eb649}.ai1wm-button-green-small:hover{background-color:#6eb649;color:#fff}.ai1wm-button-blue,.ai1wm-button-red{border:2px solid #00aff0;color:#00aff0}.ai1wm-button-blue:hover{background-color:#00aff0;color:#fff}.ai1wm-button-red{border:2px solid #e74c3c;color:#e74c3c}.ai1wm-button-red:hover{background-color:#e74c3c;color:#fff}.ai1wm-button-blue[disabled=disabled],.ai1wm-button-green-small[disabled=disabled],.ai1wm-button-green[disabled=disabled],.ai1wm-button-red[disabled=disabled]{opacity:.6;cursor:default}.ai1wm-button-blue[disabled=disabled]:hover{color:#00aff0}.ai1wm-button-red[disabled=disabled]:hover{color:#e74c3c}.ai1wm-button-green[disabled=disabled]:hover{color:#27ae60}.ai1wm-button-blue[disabled=disabled]:hover,.ai1wm-button-green-small[disabled=disabled]:hover,.ai1wm-button-green[disabled=disabled]:hover,.ai1wm-button-red[disabled=disabled]:hover{background:100% 0}.ai1wm-message-close-button{position:absolute;left:10px;top:6px;text-decoration:none;font-size:10px}input[type=radio].ai1wm-flat-radio-button{display:none}input[type=radio].ai1wm-flat-radio-button+a i,input[type=radio].ai1wm-flat-radio-button+label i{vertical-align:middle;float:right;width:25px;height:25px;border-radius:50%;background:100% 0;border:2px solid #ccc;content:" ";cursor:pointer;position:relative;box-sizing:content-box}input[type=radio].ai1wm-flat-radio-button:checked+a i,input[type=radio].ai1wm-flat-radio-button:checked+label i{background-color:#d9d9d9;border-color:#6f6f6f}.ai1wm-icon-update{font-size:13px;padding:0;margin:0;font-weight:400}.ai1wm-icon-update:before{color:#d54e21;content:'\f463';display:inline-block;font:20px/1 'dashicons';speak:none;padding:0;margin:0;vertical-align:top}.ai1wm-modal-dialog{position:fixed;top:0;left:0;bottom:0;right:0;background:rgba(0,0,0,.7);z-index:99999;opacity:0;transition:opacity 400ms ease-in;pointer-events:none}.ai1wm-modal-dialog:target{opacity:1;pointer-events:auto}.ai1wm-modal-dialog .ai1wm-modal-container{position:fixed;top:50%;right:50%;z-index:100002;width:480px;height:auto;padding:6px 16px 10px;-webkit-transform:translate(240px,-94px);transform:translate(240px,-94px);border:1px solid #fff;box-shadow:0 2px 6px #292929;border-radius:6px;background:#f6f6f6;box-sizing:border-box}.ai1wm-modal-dialog .ai1wm-modal-container .ai1wm-modal-error{color:red}.ai1wm-modal-dialog .ai1wm-modal-container .ai1wm-modal-buttons{text-align:right}.ai1wm-modal-dialog .ai1wm-modal-container .ai1wm-purchase-id{width:100%;padding:6px}.ai1wm-modal-dialog .ai1wm-modal-container .ai1wm-help-link{font-weight:700}.ai1wm-modal-dialog .ai1wm-modal-container .ai1wm-purchase-discard{margin-right:1em} \ No newline at end of file diff --git a/lib/view/assets/font/servmask.eot b/lib/view/assets/font/servmask.eot new file mode 100644 index 0000000000000000000000000000000000000000..afe3116a4d9ddd8968cdfa3596a7086707ec4965 GIT binary patch literal 5968 zcmbVQeQX@Zb)UE2dwU-|-tH~QBk%UOB9C9XBkxlbMd_?WiY1XUOIvmu*~*a;MLCs3 zT9OO9cH*m%q=hZF3>p}T3RMy z>uA~E>>Wi?Rui;yH#2YEy!m)<-n{o_r)>Tm}I}d^|n`U!to;}UZvKe*(m^gbBm<#M8XgQ6;Mp%{&`?U9t29hsm zusRdj@Iw#h^4du{2Fza|*G`_BS$y-c3tt6MC)(ebpSie*x&`g4sI~dC&z}D5z%x^5 z|2bo==9#&fQz7k6lCjtg^q0>7A->0XHzgE1&YZjS%&x<92<<+!pFg{Ba%SwmAHbaE zchRn%n|WrD4N?&8e?i+hKXY#GTZi>e7_%^*zP7k<@e=ll6u->-nMk*3iOJ}jpwqy7 zu37(*wX?5qx-E&Y?d_?`*sa%Tb$yjNgp5uui;d*?0AG#gPV_Zu(WmNU5_<;t4oE{} z0pOgq$XdsmbMw^ApWKSxGH?Cit=HG@tgrjCIBRUJz1i1tD|WY!*8jOfYX7ADX)~nV6=G(dte}XLqF~Y2oEi@2tWz-+CIquiv_>njQqZQW8`oZ>IDiwR(Zbi+~ z-O@7SV`LRdg?t&Es^ym4icN14<v<=g*Y#GtbmT~>T3<}(daqZf78fZc=~6mJ zLRW7lDTqf(r6aXkE}b0u{aS4i2hIGekiyzOVirp?){`z3hRYQ!Yemg?A)POelWJwG zO2+CA3nP1p>fW`_Bs%}ph(rvk2O@=m?|*;tk&H6<(DYg|9x=SNKqL~V4Rrqa_*d&w z)rsnZ16(8cLi7%6V>_VwB{mK&(~UL8sN|N?mTPg&qTpNZ?kyF|g?!vHmBJPnTT5FJ zDsUlW=pFC0l}uWvPt%ptKIHwL77S{dVGJVknjZ3QQ1NfRH2H0J|pgA=>b8}+}{bv@7#I1~$oVut`o zvMkk6uWlX2hi@H(!Dl&5>2a=UF{^Ur20i}a z(+oP%iq4JW-iapUY>bt^0D9g`1tf=Z=^b>r#n-RTz_ox`1fI@aAic64ax(XsR|=I2ZJ z!|rUHQwC9`A4EGyjP`v6o>?G zMbKnP74q{E64nAv5ouM{1@F)P)B73PnGzlF&KVVe2faUlj5rTBp=&pNT|2@a!tp?( zN?SBcyhm=r^DczYIb)3=3!NEptW=z(w|W+oCQ z)J-vzOu3wK@@I13Nx6G2XW2ine`UX5cZjPa}YSZnS-ulLj3t2n-e!M`>23*8h?K^8?!Z036eN;6Qv>iu zk}ArYtQiy-3XlOv7F7xOfmEkVP;o&FX(J>5uR*V8_wUd0+&?n{iEM$u-MVN=<^6ZVNsp+Rl*N8&-Eh;=o(k?4WG{aY$lVBk2Lhy z9*$dXEFFanq&N43hs{+kFshlIX86k_sJgI+U_&0Sc`GY*dT~z}9Ugi?w9OB=*4(@)AY~j?kjr#`Qo; zBoH@@mtQuFcp%aexNiJBVq7;2i>vs{FY(ecKo-HgJT^l?%aAJUM=UL-$xc@aHjobX zaJ9v&I#*k$>a9@SsXCn8xGR6|+YCg9TnaAy_!#>v`yI>zPF-X~blYm6{5a2#x*(6r zea=mV4RA{+Vy5DzanYm2@)#JmtwP+i-W~pQ($%V}w^Xa|KWOwtZ@0ABQCe(ii*}Pp z(}Ey;UKYJ2D8G0cxBLa7WiC^sMOD|;rMmO02aTv5^``uR!!7*=#!O?ZcbpHRtD;OV zU?lk7^o4C~C!RSa91EgYKL}}n_gZu9!0!HqT z^5v0ouRDxO)H~9xz(5obfo(y$J@;JZ7!Q!Q1PvsP5k;J6I1&1|G_YG!iGo3|u4~7K z_c-mx@;#sFK>QJIg~c>O}yE*$h+lb(s_0~8%gcy~-&bk#I62Q@NA1~qpHr(zwLB88s#J>3It6#iNrqx`! zn$G!!cRQD^aTvwYCJ1YT1iSMtpb+dhtE8=TkCiS}{0C4^#dcvaLE-tiTCdl=t4m9Z zRmZ70PQ6;KEiJ(mL+9~@z_(xgU9M(So9OE8#ilj`tl0ZoOM>OFT)Vjs&&k@yj-t(t2OLL!V7MVJiMn{@q&AT{Vwi7;|}ze zn|7!iS1Y|ZuVSSfx8sVc^x`IDG7V#Zo9xGLFjFvJJbd#*GJa8#hzI?su5suUe*5#4 z436GkfXBWT{q4Y0#ltV=@q8-3cp!Hwr)sJ#=R&gBwpW(JHVmfRqI^Z~(j^kLh#YS% z+CvW;q)KCwLQ-cm5K~l2RNK3HN}2RvhZc-Tnz&cgRXf;f?(XhMIfbmKim4qjOEi>( zDhjd~6%~0rhBzxUr1og-ny5>`HmjB@ThVY|Sy4#EEoqHuTANg(UFFzOV0NW(0Z4m??L{3L29g(Gg5(^md(2m`PBn!F>|GqyJiowJvdY26N(}QBS9(Xx*<_b#=~(1l$K~mG(8g5)rcwKtwoyDmD40e z5W`xFtjI$>K}{ejXzMLXEU0xzqA2M@U52d*GS=buj%TC~#}oU$5ZUufW^my$_V;&A z@LS{8>$m-za}!O?mp$*mIR85s5RESp8#D1vKjDkbX5!26_GVtc-Gr~8Zbk0j?DOdy z-o}@|bQABl0n1)!8^bth# zqWqpxRX$St)Cu*3`epSy>QA&&I{!MySc(FOjCi^`rQd24VfLdY&x8odmxxcPvRV_* zBdc-~mH3ECL>H!V=);o3MPXLf*a)Y8=S@%KrfsM3<@n literal 0 HcmV?d00001 diff --git a/lib/view/assets/font/servmask.svg b/lib/view/assets/font/servmask.svg new file mode 100644 index 0000000..e1b85d2 --- /dev/null +++ b/lib/view/assets/font/servmask.svg @@ -0,0 +1,37 @@ + + + +Generated by IcoMoon + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lib/view/assets/font/servmask.ttf b/lib/view/assets/font/servmask.ttf new file mode 100644 index 0000000000000000000000000000000000000000..2f82f015c7e79716b6f06a50758a6124e2ad2928 GIT binary patch literal 5804 zcmbVQeQX@Zb)UE2dwU-|-tH~QBk%UOIv&4tN8YC>iqu(&R7)admA33QvXvtxigGH6 zv?LdH?Zg)&Nef$U88k2&87PP#=pShj3)LSjgxVlbBW@A7bqyCr|0u$uEek0|pcIXZ z*3q)R**l7qtR`sZZf4%RdGqn!ym{} zWz52O`o_}Y#Y@;HQv5RSXCmFEWhSF(``$HZQq+}jNN*Z);89d zL&)glve-=|wZ>99-*>%sbZLoFk}jq5B=q!UlY)4-Ts~Z{=hMmI->TP_aL|nL zwNqI8`^;i##xm)0aimhkvR2fL7t@8x1gTcms%EX;urNAF)bOr-F46t_MkHcTBM>PL ze(!tJk7bpiM`qTO@rdEA2O^O`eX#pakAJ;!v^G_Hc#vxZUx?mg9c%|1VP!S}F4N65 z#;NR<)0S&-&Z6L3?(Hj=D#b$FGL_;s7+XtQ5h`*aWa&Ncw3SR+r%%(B(>~<=rWOop znqdqf^O_#!wRhD5x*l8gtSY}vo%Y{nSKbvgxV8Wyp)ogK6v~e6oi=5odgzHYssi-_>Xg94Pgy)>i6VT+r@~HOOp@#aNad zz{!+yf{Qb-%%o5(ObVIOBp$>Rx%||D z{>|DON$;8(8k*Xb-mL$vq3eOJz`nyuQZ zUAA$BilcVbQb*k}Dg(#y?X$1VUA{c`8V%0T+~8$;ZT9lq+~wJKrl0uLPma$#@m8vP zW~Mv!*!3r-k8jKzKf>iG;6_F0BYKOOT)%0X1j}5a{OE9aIKHCg65DxXcW>|RBRe4KkUxtIb~UnmDo7eXle&R_(@6$NhB~|Egn6>jsguoBDkjo@39^8{=SU*S(wD~tO_DSr{RWAGAPJ&G zM@f>rF}mpeI|(%V4COuVFMmgrg%4`N-I7=!p_0v3`jfew-M{|?v~~Z$zXIq2Z~qH0t3Y)OYk~Mh}D&F*A`cp>B$yWGj`dQ#g|cPs-hMIm`Zm{VV$^ zyF*+ZA?Iwh(wA=@Qp7)k91T&g62XC~&6~}^6f&=Sh~JYvLv*LN4Ei|A(cGU`La!W*)kZ3GwH9Y)#z6?4=^sY5x7y zY|PedrpQvWFsHECP4}?PZ2oU}S|5c*B~(FA;=0PZGyp#m5ZaAlqg@C99*}eyVohqI zngHb}xA@H=qV`LM=)%^JsumIjQIJUPP7T5vNvbGovSv_VI6wvYaLzXrXT+qW;r^T62H0MCg`Cc(4W-EAV1@_DI}vW9cYtAicdOJYueKfl=M;Hp5>b zLDhvl1RL^X-CJF4(93(m=~do7R8 zqYAzQF&$0Iu)5sx@(dg7(p9hFPt405-U`*dwar9pcb8o;yS*AURvezz9Nc$eY1sMQ zbOSLU%a{>T+}=DPlGqDJ$V(U{I6{kd8`lGEkwDxqUVYUt;(~r{-{S9eY=B!v5i=Dxjf);FRmQ=%Z589D z_5R3bldjfOy{%UJ@L{7rdb_Q|j?z+FN3@qjnh^xy3$o}fL;1zqxaBVqt#FwlEvdS$ zE;pQ?KWs$psCU#KIMOy?V9X50ddK-7x+==_5=MgWEnnEdcCt~#dGNOitQ7YQzKMh- zgRcNrZh3TD?7}?_mkBfwK6r4dCz(nmd!`1rp!>XtRYRhy_YwKzBb)KfX6>!isJ6<_ zg~#guL>u%Y_9%1&em7f1(XzEU-&UioW>LU4_xT=y8(6e$6-CRICw=>jc9r*_Kkj=0 za7CZK@dkIof^<*}NRShnXavNAXaN5Ud-wlei0_+fyT1!S*HY})*ctXBxU}PDF^p$K zU$$y0YD@k}l1r7U4POleB5iw+KQx-Bgs2-1sZbfM^tmIrM17;Z3JgRM5!g1Qo4M~Y z$9RCeEodNdoG9W%!->!*<-y&WN)!xw4P84vvd8H>R>*v=3-L#|9TwBjmDmA2q>;8G z63(cC7E+Ugn+Oqx=aBa&Zn5anV<=;r;qzww{vQ%4vLszA9qarf(+MlOZ00)5Z1g|k zU)Z(Km+P|4P|ytOo$bM%*yLYhQ=%9lI{Ly7IY{3wx?8hvu+0d*Rd0{OLx@rN>#SGd zApsmM_wgbwVAJhR5afGLi`bW5fBj1j$h4ME*V1{v@NVbRbq=Fg-U4B5kYIP-2NZ%G zXVtWo&RFSk)qenGsK+eR&zC7&?zH1it;^?{YP( z+C*1xFCAT_8m%;IOn@gnX#N6{Fa?TV7pRsn>B4SDlrHx8|&2 zhiH2Bdc9F6r`A~E?6Q{M^5@C$;g|?UF&pJmr0r<246DCVZ>+3R-PvG`#tIBUz1F~7 zD=Uqfw^qk~B)s6($-{fP9WS`2*l*w-H19xPrDcaIakbiq^D0#Y9gM<+s03&En|&1$gXh(cca}Q#$l=0new(%lq@E z@~WoVay}%B9h0&gwqY>kHsx!2k1mm@MdWyU$sT^xAXOTd6q355ftaFFqSo1yDQD9| zU0N_AY2u`)t9G#6+})c=ImMi)im4qjOEi>(Dhjd~6%~0RhBzxUtY)-MP1L1ehgDBi ztZ2Buq9~-|mbAw-Ezn^gqBBB;zLAkwSFkN4h_AP&+Cq^|Gi!(W8L%48@+G`{pTSxB z@jPVXTMqy2;#-Uq0@OHv+kkI`voJ5CkQ)AwK#RIk;y|SU^Vr02`Nhp$Z^k?E07|s$iXbRvFxVckx*|rv-6N82wiAU6^;?hclV1pTfo&4ijtGJeBBv{q zj>u9#i3N;!Xvc0tk_BCcf8Uo1#b9C-y~mLy5RS_GWH+G&l#mIr$)t(x2}O~Dk)RZG z-H@mzWzc0Bll{ zJ;{ETty4c;razz?^mE~a@K@3S=^N6j^f5&AviyNkQ$AMv)hYFa`W5v%>JPM2I{!L{ zZ%!0IWW>|mDg9Qn2($0EcqT+pzC?UVmDO8#9$8gdumt$o7A#{{s|72-A8x?`#D%ZG zmXf3c6Gl%H7631_U=i>{3zh)C*n(viXHE-NfS+l>0lfFW`}E1hbBl}T+0*PKTV&^u z7uos8=Pz7*dhxt7nj2w{vw3!bT?7F-FwZEy6O24?)B}+-^9#?OoxOlX=dsae*;zKr zE2@_Ieb6jYhS|Z3z+7-zoS{S=h-RX=GgNn U5BdyDHyOYlec#tSjt7_j1Cv*WJ^%m! literal 0 HcmV?d00001 diff --git a/lib/view/assets/font/servmask.woff b/lib/view/assets/font/servmask.woff new file mode 100644 index 0000000000000000000000000000000000000000..e97b56a7d1257ff728c13dfbf9ed0c9d4aceacb2 GIT binary patch literal 5880 zcmbVQYiwM{b)IwIcke#9+Ijy{shGe#QvYCLPF z==iDgGmF5TMf*EEzxDXVZ_LkJ;$#p&*%UFCV~zaLsWKl3cs zwT97l{5(j(3p3~EfWv(BO`gAdNdIJU;S%PG|NRD?2uP&6bd|}VnI!C#eW6+Zg0-`+ zqrEjz%hnc$tBl=wgI3m7m_x|G5b}C*e867?P#5|*+=Y@;buo#7Ki0uofC&KStVUKl zR-N0YZ~y2{^p1JwckjHhc5iJBGz@)gwY}NbawoRYM{EDwA+>+f{&D<9d^)bjHS0BN zp}B%TaGQb{Vb+Mhi$=G=SY_1T`sV(BIS#$d5g0AA9@Y=G_fo0Y>-H#WmNrVujE|93 zC>8Q$bgGtHaw|5yMU+d)hOFnER9@Fx_0r+PrD}aKmFvA(J+`<=NlBMdITE^iGYLUF zTq+%|)pDuC(C^f0i#TYg6LJ!3|BzWM#aKF3Dh!t^Sk{V~@j@zJ9w*hxSe1;`6Bb7H z64kvMpX==Uwh@UKR1ZW71Kl<&5vXeEvt zDyLJ8^;&S8x#zE4d!BD~?XJJyWtL`x*l9i?SY}voOZjreKbuVBV8Wyp)J$QoXyZ5v z7CG7Jan~K6&bkk^wRd*5w>{(nGTY=Q7Z<0M%-H11^(rlM0!}!*PQXcHxsH0hf1=pE zTwSVhaY4J+Rv@z#7GoJUfs-j_1s7*vnF*ng-z%hxdr>!c){_4F z!vwuaQaoP~Sl`5xrP7lVee1P1oZ2-xI5@d0wO;>gUDpF0frGJ7D0UElB+F7A^~%;^ zeE8Nu7<`Ts>H47?p;#<*7PBhXZqXAzeTG3NTG9D4 zx(QBIX0uL~WNaVVYNleVcFD#SDva0_OC51XsRSIyx6Zsed*#aPt28i6vjbP?)tM`^ zvsY%`o_hS(K0Y!1_?yYD>FKWIqc>;5a!56r%pCkshCLrCCCE)o+F7Q zOJ5liG)dBg)axV)f+UC%9V1EdM(L9GZzRyn)0FePzxX{-7T&MYKMF*Gw=8I~qzd_Y z2?=Wfr--y7>w@>^|Ka@v?M#Udc;}4@zzOebkP+wMHgxT_uWN_dQ5+96s>hD-gq$;#a&NA2ND==CvNT9NN(2X{Hf}ZtlgPa8CVqnw z&`iazaf18MPUG*dW@ENSGf9@3fjNc6Zn%dnX7hi;)9MH`s#6v81g@*BOa1U8 z0io3xGFpWI;C@M$A=ZQ@s-2)5;TFF!MAUx85M9_DQqe-9APN%6UC9A>BS{ryP1Xzw z3?CLU+$@2LM*x0`; ziuZFRiZXb$1D_GYedNJ#QwZCUALsn&k{VUPj3|(BKQ};#kO8_O*{uTj)dMypcD2D^ zcK`bg4*N&H*I==uchTn&e8QqSYb%5wY@X{!6wo!U;_E)0``Jt;A0KJxu{|8O+*m3K z8%S^M2@jhqTwqi)yUg%cNl-5r|FgiT+g2pk2!yP0lv`5fYfxH!} z*Bf`wUq1qi(y;9=?q1X5^QeOFKukqbGORAQygb7OyL8>F`xEnWhqpvEZ)H8v%Eq!w zW|vo``jW%bii7)3ECoBin{FWnWN9-(irbSTL=yYp2zd#k1V?DmZsTU4B@&1m#w)KF zMm!K{3EVV(7BOxbhQ(FRh{cC zRP~mr?o=I4ZfwY(`!)m7A(w&+KR(7j&wc~5fKwM45#46R>Mhmk2M-&4(Yq~ec9a%d+M+!q(zGB5UzA1f zDwJQmi(CF8(Gr&_(xR&C>eagQ>BC0Uj(W%Zfx|8R2F6TdtapMBqU)keFJdJ4-t>iS zY$qE*oCklaz)Eq?;G0NTGWZH`<(5Xa#4g;^aG5{@;e!VzyA#P|qI+^+6MDdlSXCst z{s56rKD-{^tk>RBm8#49TzIVhPqaoqVUIvZ;CC|>6ir*3^=&oUY6b;tbFc3axPe96 zR#7x#uVsEJz2%fCM?AiAF#?hz9V#wD-XOh4_J~w)(pO zbS=q#ot@<`y|f)S3t>DXdNUPMQJeBlkX$TRZ1`#*5NX>3{Grh}B}CnDNcr+exz`=W zCF&jNQD7hnh`_cW-Sh*OImQFzEkOf`V?+@r8tx2zTpHM|sYJn`SJ$-@!+V_ennV|)J!n-awc(Xr=$%t88Y!QGsF zjjc!U&3bDb9zu-DUuQiE4+-FCxsMld0UK_2oFL!(TExEm+G}6lCeunTRZZpm!n>PG z)i{je>Lv(lg9N+t9-t8HIIEQ2(|IH%-|3Dcix$u z`*7BK=Ud+*ap=RjA?xj#Qyf z-7PIIE!Aqch|A7W-CJ>1utPMxTCG;EkyEWNaduhLZ~612`EX1GqnL^EDN=T{P=eK8 zs@0d4sphP)dVL9opjNG8uBD}V)my1yKN4PWtK{K5-HI37lk7Kf4;pu%x7@Tt<+xhu z#d#Gg<+vSJRHYX;A(Lqs1KeakeuJ5U`QqW5ACmEll0ZD@M|F)uukhQSuVira{sKJq zwdijKo-Q7GDUat<`K1H7(>YaBZ8;Z`#kRe&9JXOFYtbHh#2{4~ zlN6G=qJfyAQfIZjJ6+1820OH1MAF2)qORJ(R&#exI_VU$qADhL#4OQJI#p4S#i*#r z<1xfpp&>P`wQHg-1>3AzvTQ}eePu-<6}O}{rfGpT0}-7O%J&Wr$2x*7AwhhtHQ5r1 zw3`__%+G*Tah5OQ<@+?w(vRmM8{cyHZx`QUBoUy-`P&A3BbrrhRZK*HUi#;wdI~+(?3`WW_cstjt5X@tF8!wVg`e)5vwC&1l&C$>1HcY$WXuY z*nau>a0l2XQEiJL_#kpRLaB%>1(aC8h=+FUHY8clW%&2~$xsX?M$x++SpwmRykB-Z zwSW>bAvT#bv9(iCq+lc{1zk5Js)=|wu7J`K?TDsF!nztUCA_srle%-7qzGbIYmpUs zC>_)Ul7hD0qQrt)ha`%UKGbd4njm8xe(!ij`ssM*zAr`g{DK)=xQzYXy_5Xb`1RUd z|K{9AQ}bodJ21}w4hBTyOT_w2ywgwkVzZg}GQ7Q+*X}mqYp7e1`#1Z1I)}IEAWJpz zej6}7K({{UdcVN?{S<&rO0Xx`@3U3vqbu}>bc;R}P6~f1O-SFAmZgs%qL<|Nm8$ZQ z+NVycC)Ka2-&232o!0r+Iec@XK;v7fzeID=jVjE3*yNcILHQCvDFCiD@jS9BH(?3z zGfh~=tX30NfIr-X1BeS>hAkyY2PTZ31}p%cZ^9zr@g^(*exV7=EY6%JtN=gVgadf* z|M63&7S1m$TwqVJQ*42qM_ynT9-F&(>8XVa&PaBcJ;vtPMRo}U=)gQ9_)ajq?Wk>$ z({uCBoSV6bMdz^5XV^J5!!B-1Ik9lzvNJz-VeaD0<+;<&>~qe+QwvkrTNdAs_}Z7T l`aGt&;O}S#?KyTDxLNib%7Z=wQw;{NN8k5toX9r7{{T*Hi}U~h literal 0 HcmV?d00001 diff --git a/lib/view/assets/img/ajax-loader.gif b/lib/view/assets/img/ajax-loader.gif new file mode 100644 index 0000000000000000000000000000000000000000..0dc0b919293065912bc5b11a4be39ff8d2a83d76 GIT binary patch literal 2608 zcmdVcdr(tX9tZGC9yiG~=H_*Q-0%n(lu>!CMT*t!KyG-Y27*u(CmGh{XoD|5)E?i+PHF|6$Ai$9$lnM;L@pNVo|0==r_=&&yN;fdLvqW z%@y@(YWuOGkUibID%Wk>6@E(-fevI4(Z#MNJ`{!m1@f#y*>J27@aoQ~0(!qCO*WJ4IN zOVC{$y`W3f)z|>0PV(g_XrFPYLGt(vboYJvZQGp>i32mkY9gV>X3-G8~+rf7s8H|moK=%gQvfaQv)?H@v)dtUHeN3Hl; zX9>^x6KzPeTHD7_AAWGnKJ!-%5I|3X_U0>I@Gv2mp#Ts>;3v*hxq))ntbBvP+h0T} z&emtQv@k?F6)cV(^Yi@(@c{^$v!7sKHv$v!KlWjKv^xujZ;E-{-elZl1-!aFLA+|} zdN+4&%Bh&0V&dEHxgcD6#|7g_H(WJ}%9wX;EqeP*CWRr{SZKR^fELf_FROK&E8ppwKTQvH<@+X@ zjW;>3#JET7$A;+t1v>ba_&TCpJ~Tk|IHy$t89g6f88yo9keaX6zZ zLsWIw?em2~I^Y;q zB=tBf^5o8mtGLW0zu0>j{}`aOT=FY=L*~)-P25ENYVegbfSZ$W{$)8kr1@Y#Nh##* z_2zkQD;%B3!!o(w3^IIxK&IG5TLd#eSDQz}-f5ts)AM|C#=oKFC%rB5z2rRnHN)@zuiJD@H)M03)Dl z9=}#r9UQ-Js-@I}S|@mYpO0~f2%bh%%}>9zc$|dmo|2NVQVZckko4@>FU5$9Oi#<~ zlM2w&G3{jszEF_8=MmncVMXRwDBo_86XCCrd%aijb2{xkOMjRg*Ldjq;P*GA;!E9;XP828P6@Uw*`h-L#sT*g<^cGWhwEdxF__l;7o2tm&{tX=& zMA2f`^=WF@vx4-jLK?98pcta>0@NtaOSaN(+AR7Wj8u>Kf_x>LbwW$RD20IEAz)8o z20+bYaXu1pj9Pbs7qUOa*o6dQ9>XGjPfKjl!Z)$F56F29Rw$1Q<}s}zW*#_Wb!eS4 zbK329=clyNys?>y>>=&&%*gKKUTc5ex!a=D4f4<}*8yYA1JmS&Ege7P*ZwSxl(ck+^h%4$(j7}kHh-|A!n0Oa zRsin)wY;{%Pxlr=Hx*;}J!1NwfaJI{eeaF5?V)t1l`E?26q_i}gxG(>0i_f7*ZssJiK+6s&J5h6e>E9Cp?uLzQoD(n$Sah)cw4mld2mF3Weg&CP+%tJpXalO>a|y zx5IOD?1Vck(pKG@_CSU=nHL-tgKjXoxU(9>VNF&`KKMCUhAZXhZ<8)Wj?m-PZ!YD7 z3v_*#M(8XP>|Jg-1QBP!{1uh_fVE>^TSJE}<`t|7zVVQ>?{Ckgd7NiOJ9tQvl(`Yiv|*c- zlxQNI7f6NkQ~m+J57Nxq-)~JUURlp~G-2=d!&|3@46+ywC4C?~?+D7c;+~{mZ##vV zo<_S!Y45~j034tCMss2UEJN=E+t>;iHl!5hw|!5i zM;2WC<-3Z={yE<_OS(pcXjB5euhh@RFUNN5CmucMRsaAKlerPN;`F#O0sq)+g-MHE zTIh+zf0D-Wjt_JP9q^GZGY5XLhUVu%D505{bU@~g?V+L8&+^yar$hUPbw3UqEBY_T zYf&pkr|FR6jA%1Kbj4K=)JBj_7lde+A2kFt?mbB5v5Qb=V`~WCf=+1Ia~;b{|He8J z(|oR{9i=59nM8lndy3brF+xN_A~rHoTKQM)i$Y;=!0W>*So?FFNqiHNlw5oIkgl{+ z&~I`r4r#)glr}iNg%e_FMgr#+deZP?2kh?UKRU7=A!LZX_qkf?ifHr$QWCYDdU-x} zE>RDY&{cH6u1tRqkm{(vKg+f~kwhiHx}5=5G+Shs^}$W^jtkqsWjuk;{gyZ)2Rj$u zWO~f(kPs8FLx_yD*qV9bN0(b!ULNRWVLoKXe&x49GV!Oc$J@&;Q$r{>X7*W!_NeCo zSXT|x&ak1rY{IOr_!H9QL#ezsb(JhO}CV96MLA*Oi{%fCU zkvht-i`poSUa-Bgcz70*+JM#}`j)mN^XOKrqns%s!ev72VsX0;|$=9D96gA zvd~_2*SW6t+}uDv8X<|a1G|WqxMdf=+o*HyeED8Sf0A^9pudQ?qY=~nxt6|J1AI%- zFG|YqEPX?gaQJzO>GFYmYh4@lq>1jI;G+5=r${BJB==`tAU}B?74>}jaRANG^++Z! zgq;Sw8*Aqj73Czgl01_kw)&$1eF?bL@A`GPE26+frGG;labB}7#{{#ro^+9g>oQ4G zyXRm%r3?Lz{}2gxYvO`<4TvP@n?4n0IZ|`(j`8gEXeVg3_GhjFd!b#UW$9+cWY#8+ zS3_FR5BLE&lq3$ss#JeM%t0;h!1zAWHIgEL`7;k|;|Y4F(i|Z>bj%DrYk+Bw>OCSC zk46L%M&^cme2^HHg$^$by>VBqzQ*CW}Hnu5Kiz2(a<_KN4Og}djn4J6sx) z_ySCU8~K~qbWDswVluXqQz>!+0f4@wWFpTkPjPHJ%AM(qzT+@%O|`Q1WUC3a6G2Xn z(0&WgF7QHG6me^im1c{c|1~nQtOa%6alT3z(C8z>WkHPg$LZoW&0>g{6VmfBG?rp1 zjm@1HkNkpEQ86)GS2AjE;K27-ki6*w(&yAHECTV1UwxP`Av>vpKh@K&>5I=k517ZD zlkbFFmImt=LUa8Pn{8+O$c2e3-QQAFRPPS!?1k>ge>f5zN9m}Yx5I^}J;8?a*t}t`d_`eS7Mu=aAX#pf{b=c!kuko1F}#d2gwge5f+Q zb8Vloca6+^=s{z#-21H;115sjX*suHABl}v$*$1n3AP|hC@ktW=~jNAHj(1wQ7DJh za-rC~&{vsv`tdD=2neL`X!<3-KO(X*Jes7QAs=bV{b5jvV%_tSCUFq_-un@AApC+Y9gH1gN(p>?$p&4v$ZNuUJD8UBC|5CW5TE%&Az$}tc&r!iw z-*HsEsJ_Aa@1%}%i2C{j*9$I5>|V0$wBX9+uhvaigSV0V3zqSBd<(803a+@-X8V<4CY#%yfVzQfafgY_ue53)p+K> z0kPJiKlu(V6oz2@A_t3=rCk_^N@>G;I4%i$Ayp`2Hh&UGVS>m7ehKRKg@rGQL-zrH zgYl$H59z((FP6-$r=Heps0o1)h0AnD61?bPbwh*J+Va*~cyOgFE24RL1z$$-cB!V^ zj*_e0E}C;yd+X5+F_dqF%;5ZvbWB%xHzu$+?-GKyC8O7#P+azA(Xx3fgHK|2wtRz* zJm3!Jf)w$!eR}O{8^5uK%e-Y3$EcjzodTDSx9L<@M;_xU=V(qvmd6i}|Hyke%Qj*{ zL6-vw;6mD8jKZ{*(>a>6zBwmcby=3fp*&ICKDo`+G=RePlOstyi|0qa(yyrlPk!eR zua(M}8wTDv-}`d9WGKK%YlJ%-U}sLorM(J@EUAR`$n0k5x9c-XY9+9?_>syaSfYCN zTZ8Gwo%S1@Qm?M%0PEC?rwq%Whv&J%^X?vaGJ1j8sii8zcMk2l6}&;9>042$o?SA9 z+~LsXr*_>DSCEu$p8tG+to$O7%*|gM){1Pn=Lq@qcEofsN|?%a%K&0$>>)Jj;?L~& zv^<~41I*Ci9w%I9HWPPebw!HcZ4Y|aHA$A15mkQGT)er0WBv2`bUQ?{wx4-cLTc3M ze34AR_@_m0mg+oo9Z1SL9Q@*xwb|l)gO-^;kx+>GkO@aPjBG_iFC;4VN42}uky{<7 zvduMX7W&2F=kI;7p9hU(6$gpOE`Pj5kc^iFM3Cp{($7R{OR(r2YM6%^XJ zX~FVqAMfLfPxXa-1L%e6hp?xNaf~b6T{GG>xj4 z*&F)DNZ-~r;;xB||9rH^*SyQc?J99dWw^gc<9m=fwr7r4$q&aSrW@<#$P&CF0vJ(8 zpH$we2X8FjlnXtw$4vb?YSPdOy=GuwxXw1*`Pc!9RQgOe28i1fiSnCgyu>6yod??K zkHq8~SyBqTR^5DUd?&XU$V}SGzX#-vzG>b};i1@2@k^DsFU&}6U?orX?{Snjx2a1s zr@06hOzDC}_fOyJBD3x1!`<2?>;LukgNfw%Bs9UD8Tkt3mxxL+@($DWo`?f+MQLBl zkZJs5g_Do0cg{aw% z_@P;Rg}=F2@RiAm@Bo?eNz?{1s=^k22#$<0wRR6vv2a}z=IPS66bPuQ5^d>(tztI@ zAL=N50^#Si@Qp{`b+fX+nq8=YIDBYuGPpFD9@AoLpJtCENU7tL#y_Fc{nPRJ^w(#k z>D~1sH-JVUr-@;c=3gb^_#GE;u5Rzzr5kK9jEH;712Hi%iPL`K`qM%?8J21C5RVZ+ zsHkLi+^Mm}uQSQ<=MecRll20RT@Dk&S2AWZAevRc304u#>g2x9e)G_agd0SIRWSB{Ii z;^Qra@d-Nd#pKOjorxb;f}R#wy>WF!YqO4OupM2*?VBD7b>(e zy|-Yns#d90vqQ3E?mNooJ*M}G-(V}sr11J9dEwnsD>sRGiP@$U%yF>N(v$0emF&5Gbk z&_nXNBzo2z)R1srKczaQOOD~S{kEoguI4-o^<>wB%8d8fO1BT@-rnl z{|@Hw$i#axLR1uUL&r9{8Tl^V_A%Krt~n`t`ap{8g;~kMH3>S2GbwTxAaE|g_IXr8 zy_QdxNrYSDuAhSbSGHc+_@>@>01)?nBwr}hGQHX7i~xzBX*zeqG%R?!v$$BxN3q)< z{n7gP^$Hrvb&U4sfpt>ur{-V5S+{YFEC~X{Ef=Lefktr86d~;=D%G_k+!{iXmIMtx zhfmARTYc?E(`6f72FSmZIo=t`%CNl zsBF19aDG-&xo0z1mI#o651eR48cB2Y*1frAt77{Q;P^VwEAQ)w{Lr|OtS58k)({8kOBt9waQ6!y%V^<0G zZp6tdxl2o+|CY$~biA`0#ReW~eG7^JnPt0HDJoP3-cF_-^g9IkvUXYv{fhj|8K{#C z!)2Tk)6usdf)&vnIa@vr=KxB02TbN+xLavUfUl0#?nQ`vUw^-vbf(&=(mgX0*djuy zZ$z*GYiWLKZX+)`ij!%159(MV`m}5kaaTHar8tUisT%hvm)IUEU3zmBBFkP~v!JuB zM($I=ekgJa$`=)ThS?~sAMA_A1@elEck>c^8(RpU-DMNu`pJ#9)b z!XaR@CdaO5LVO?lxSo0~?MYoE9E83;zg;P*vU+bmBs}rRIUE91H9+0e=b=T!`#Dl} z_yq#Nd#LTAOml$OKfc2^i4aSf%y;iQnVQM#she>6JHE2hjw&20mZ9=}v4T0`i)K4G z)iK3)yI3!=j~U(CLS-PpsGi?1*rW#Uf_8#oh@gxTIzrrBEMiIg4zPl)S9!`YPV!DL zgxTWIh-377B5JCqX>rLBft{2twMZCcK>xQqa$ke6xz(~0=*dzt9YO55SZT9_`bWhk z!aLJWqV#MmB8%nr{V#I70o+yeRzVq*E-aKr-5p$d;hA-DoBWRk3A2&f_fafghx|xet!4irj~raieG-G>3rd5e^1g8y$|n|2u#19_k+Jgy>f&tn3rikb=)a#q3r E1HpDstN;K2 literal 0 HcmV?d00001 diff --git a/lib/view/assets/img/logo-20x20.png b/lib/view/assets/img/logo-20x20.png new file mode 100644 index 0000000000000000000000000000000000000000..dcbfcc822499d9065d37958a30915f35e21bfdea GIT binary patch literal 876 zcmV-y1C#uTP)cxfaLQ*oxs7WS9#L#xS5UIa~q9S538xcWNR6@iyCW5qvX6`umxEQa-Yfv|RHy6(P zoR`DLdoA8Wsw&awyz;YWe;W&WL7CtnD93S3GS%H{*(?uwlSzVuiE)VM(&-s3`5l^5TSQE64>bnMZSJMEp_H9;2MaUm1}lLvZ!6k!y| ziSo6=QUFBvB{nzhp2)v55DKB~?dh_uTN{P}lBw=G;2=;0G$!JWJwE%^K)dfjwVpFl0J5cm+NRpVWc^bM`r z(%f)DRel0y5PG)B-a@F@=2C9&GG1|53e(w!IyMPjr{FQLu&?%n-puS=xlgU_W*a;w_ zzxvk8z#_}*18xJK#mXvv$PQM{}&Bbd+ZOwg@TVHtdK(ZQ@@we;0000b0k1sq94 zK~z{r?Uq|?6lE00e`ls$YC#mSTBQ^Th#E9ei!UY;eF6bBMqRwqqAj*vYq9Yja8aVs z7ujuhrCX&G6}2W_V!RPCUJ^AZUZTbep;p^+X@F?O($4PA@nLtSv(r|(`0DTJJO6Xe z&VRr8_IwNf5mgnxmJfzs$cN_U*7I88iF^EdJ{+@w$kWf9tA=b>;beaiz!Oqmj3PSZveGG^tO4G5|!sM&$wkfgeF$P8q3=)wQ+V zp0;tx`xTUwOxdI8hkhME;T%Q7rfvQdi6x$hMx#^xHGc9o5DW&>rlCQ3_AT%jskK|gP(uPGrdGX=dHVYjDruB6S+BJs8g zkCsE;XTVFivomngfj<^D)YZK2XzlIoMTZAd_bIxT>=zX1Ge|C|udmA!i?k(R{OBD@Gp0zmk%p|0jKZ%szd2UQ7d?pcmV6G{cS{XeV7 zW62dWohZAkS!?J`cppMw#>pHx0e155Q!(= z6lGa9x3i(XW`U=6f`>4yM&NIr%XzqP81yS(7m##ySQ1DjUm<%(m^SwVb~aZLi#;=U zq;!G?0_D9o0@q|i8`U*d@xXMes=UIgnmNx@V-E1D+aO$C*wI%F5DL}&0DS7CQet1} z)-gc?2=|W!8n#xJuO~R)a+D)0XY^Q;%YwjLjwZ?j&Mu(5=jw32vj!;e2GLle8sQ{> zGzG7$u3Onvw55Btoo0TvG}@RObv0E(ae{q*Eu-!eqLK{b2Q^^`!zo;BLu`)hh| z+isIoMpa5Zt+@t(hfrn#7$kQ9U7D7WcP4yB!s*#xrLBiW#pLzQLQMa6xn!a+~XChBQLI{!wCtkmRb*9iW%<*tp8c%MTE2JJ_zZ~fh9|r%8f_~>L`8{? z$ofcNQ}23W{ZmFX54V;4m8>jFIANr(AN+G9(gD5l%dwUp-?F2 z_Z*MMrzP!zMTT&n=8oGVw%UsuLw9`a(Okwg0I;ED<3dBsS3z^87mybCMWGASMr97d zJVsB}y*6CcSYPvnPj~rO0|3p + + + + + + + + + + + + + + + + + + + + diff --git a/lib/view/assets/javascript/backups.min.js b/lib/view/assets/javascript/backups.min.js new file mode 100644 index 0000000..ba1b651 --- /dev/null +++ b/lib/view/assets/javascript/backups.min.js @@ -0,0 +1,1185 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 39); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ 0: +/***/ (function(module, exports) { + +var g; + +// This works in non-strict mode +g = (function() { + return this; +})(); + +try { + // This works if eval is allowed (see CSP) + g = g || Function("return this")() || (1,eval)("this"); +} catch(e) { + // This works if the window reference is available + if(typeof window === "object") + g = window; +} + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + +module.exports = g; + + +/***/ }), + +/***/ 13: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +var Modal = __webpack_require__(18), + $ = jQuery; + +var Import = function Import() { + var self = this; + + // Set params + this.params = []; + + // Set stop flag + this.stopImport = false; + + // Set modal + this.modal = new Modal(); + + // Set confirm listener + this.modal.onConfirm = function (options) { + self.onConfirm(options); + }; + + // Set blogs listener + this.modal.onBlogs = function (options) { + self.onBlogs(options); + }; + + // Set stop listener + this.modal.onStop = function (options) { + self.onStop(options); + }; +}; + +Import.prototype.setParams = function (params) { + this.params = Ai1wm.Util.list(params); +}; + +Import.prototype.start = function (options, retries) { + var self = this; + var retries = retries || 0; + + // Set stop flag + if (retries === 0) { + this.stopImport = false; + } + + // Stop running import + if (this.stopImport) { + return; + } + + // Initializing beforeunload event + $(window).bind('beforeunload', function () { + return ai1wm_locale.stop_importing_your_website; + }); + + // Set initial status + this.setStatus({ type: 'info', message: ai1wm_locale.preparing_to_import }); + + // Set params + var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }); + + // Set additional params + if (options) { + params = params.concat(Ai1wm.Util.list(options)); + } + + // Import + $.ajax({ + url: ai1wm_import.ajax.url, + type: 'POST', + dataType: 'json', + data: params, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function () { + self.getStatus(); + }).done(function (params) { + if (params) { + self.run(params); + } + }).fail(function () { + var timeout = retries * 1000; + if (retries >= 5) { + return self.setStatus({ + type: 'error', + title: ai1wm_locale.unable_to_import, + message: ai1wm_locale.unable_to_start_the_import + }); + } + + retries++; + + setTimeout(self.start.bind(self, options, retries), timeout); + }); +}; + +Import.prototype.run = function (params, retries) { + var self = this; + var retries = retries || 0; + + // Stop running import + if (this.stopImport) { + return; + } + + // Import + $.ajax({ + url: ai1wm_import.ajax.url, + type: 'POST', + dataType: 'json', + data: params, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function (params) { + if (params) { + self.run(params); + } + }).fail(function () { + var timeout = retries * 1000; + + retries++; + + setTimeout(self.run.bind(self, params, retries), timeout); + }); +}; + +Import.prototype.confirm = function (options, retries) { + var self = this; + var retries = retries || 0; + + // Stop running import + if (this.stopImport) { + return; + } + + // Set params + var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 150 }); + + // Set additional params + if (options) { + params = params.concat(Ai1wm.Util.list(options)); + } + + // Confirm + $.ajax({ + url: ai1wm_import.ajax.url, + type: 'POST', + dataType: 'json', + data: params, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function () { + self.getStatus(); + }).done(function (params) { + if (params) { + self.run(params); + } + }).fail(function () { + var timeout = retries * 1000; + if (retries >= 5) { + return self.setStatus({ + type: 'error', + title: ai1wm_locale.unable_to_import, + message: ai1wm_locale.unable_to_confirm_the_import + }); + } + + retries++; + + setTimeout(self.confirm.bind(self, options, retries), timeout); + }); +}; + +Import.prototype.blogs = function (options, retries) { + var self = this; + var retries = retries || 0; + + // Stop running import + if (this.stopImport) { + return; + } + + // Set params + var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 150 }); + + // Set additional params + if (options) { + params = params.concat(Ai1wm.Util.list(options)); + } + + // Blogs + $.ajax({ + url: ai1wm_import.ajax.url, + type: 'POST', + dataType: 'json', + data: params, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function () { + self.getStatus(); + }).done(function (params) { + if (params) { + self.run(params); + } + }).fail(function () { + var timeout = retries * 1000; + if (retries >= 5) { + return self.setStatus({ + type: 'error', + title: ai1wm_locale.unable_to_import, + message: ai1wm_locale.unable_to_prepare_blogs_on_import + }); + } + + retries++; + + setTimeout(self.blogs.bind(self, options, retries), timeout); + }); +}; + +Import.prototype.clean = function (options, retries) { + var self = this; + var retries = retries || 0; + + // Set stop flag + this.stopImport = true; + + // Set initial status + this.setStatus({ type: 'info', message: ai1wm_locale.please_wait_stopping_the_export }); + + // Set params + var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 400 }); + + // Set additional params + if (options) { + params = params.concat(Ai1wm.Util.list(options)); + } + + // Clean + $.ajax({ + url: ai1wm_import.ajax.url, + type: 'POST', + dataType: 'json', + data: params, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function () { + // Unbinding the beforeunload event when we stop importing + $(window).unbind('beforeunload'); + + // Destroy modal + self.modal.destroy(); + }).fail(function () { + var timeout = retries * 1000; + if (retries >= 5) { + return self.setStatus({ + type: 'error', + title: ai1wm_locale.unable_to_import, + message: ai1wm_locale.unable_to_stop_the_import + }); + } + + retries++; + + setTimeout(self.clean.bind(self, options, retries), timeout); + }); +}; + +Import.prototype.getStatus = function () { + var self = this; + + // Stop getting status + if (this.stopImport) { + return; + } + + $.ajax({ + url: ai1wm_import.status.url, + type: 'GET', + dataType: 'json', + cache: false, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function (params) { + if (params) { + self.setStatus(params); + + // Next status + switch (params.type) { + case 'done': + case 'error': + // Unbinding the beforeunload event when any case is performed + $(window).unbind('beforeunload'); + return; + + case 'confirm': + case 'blogs': + return; + } + } + + // Import is not done yet, let's check status in 3 seconds + setTimeout(self.getStatus.bind(self), 3000); + }).fail(function () { + // Import is not done yet, let's check status in 3 seconds + setTimeout(self.getStatus.bind(self), 3000); + });; +}; + +Import.prototype.setStatus = function (params) { + this.modal.render(params); +}; + +Import.prototype.onConfirm = function (options) { + this.confirm(options); +}; + +Import.prototype.onBlogs = function (options) { + this.blogs(options); +}; + +Import.prototype.onStop = function (options) { + this.clean(options); +}; + +module.exports = Import; + +/***/ }), + +/***/ 18: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +var $ = jQuery; + +var Modal = function Modal() { + var self = this; + this.view = null; + + // Error Modal + this.error = function (params) { + + // Create the modal container + var container = $('
'); + + // Create section to hold title, message and action + var section = $('
'); + + // Create header to hold title + var header = $('

'); + + // Create paragraph to hold mesage + var message = $('

').html(params.message); + + // Create action section + var action = $('
'); + + // Create title + var title = $('').addClass('ai1wm-title-red').text(params.title); + + // Create close button + var closeButton = $('').on('click', function () { + self.destroy(); + }); + + // Append text to close button + closeButton.append(ai1wm_locale.close_import); + + // Append close button to action + action.append(closeButton); + + // Append title to section + header.append(title); + + // Append header and message to section + section.append(header).append(message); + + // Append section and action to container + container.append(section).append(action); + + // Render modal + self.modal.html(container).show(); + self.overlay.show(); + }; + + // Progress Modal + this.progress = function (params) { + if (this.view === 'progress') { + + // Update progress bar meter + this.progress.progressBarMeter.width(params.percent + '%'); + + // Update progress bar percent + this.progress.progressBarPercent.text(params.percent + '%'); + } else { + + // Create the modal container + var container = $('
'); + + // Create section to hold title, message and action + var section = $('
'); + + // Create header to hold progress bar + var header = $('

'); + + // Create paragraph to hold mesage + var message = $('

'); + + // Create action section + var action = $('
'); + + // Create progress bar + var progressBar = $(''); + + // Create progress bar meter + this.progress.progressBarMeter = $('').width(params.percent + '%'); + + // Create progress bar percent + this.progress.progressBarPercent = $('').text(params.percent + '%'); + + // Create stop import + var stopButton = $('').on('click', function () { + $(this).attr('disabled', 'disabled'); + self.onStop(); + }); + + // Append text to stop button + stopButton.append(' ' + ai1wm_locale.stop_import); + + // Append progress meter and progress percent + progressBar.append(this.progress.progressBarMeter).append(this.progress.progressBarPercent); + + // Append stop button to action + action.append(stopButton); + + // Append progress bar to section + header.append(progressBar); + + // Append header to section + section.append(header); + + // Append section and action to container + container.append(section).append(action); + + // Render modal + self.modal.html(container).show(); + self.overlay.show(); + } + }; + + // Confirm Modal + this.confirm = function (params) { + + // Create the modal container + var container = $('
'); + + // Create section to hold title, message and action + var section = $('
'); + + // Create header to hold warning + var header = $('

'); + + // Create paragraph to hold mesage + var message = $('

').html(params.message); + + // Create action section + var action = $('
'); + + // Create warning + var warning = $(''); + + // Create close button + var closeButton = $('').on('click', function () { + $(this).attr('disabled', 'disabled'); + self.onStop(); + }); + + // Create confirm button + var confirmButton = $('').on('click', function () { + $(this).attr('disabled', 'disabled'); + self.onConfirm(); + }); + + // Append text to close button + closeButton.append(ai1wm_locale.close_import); + + // Append text to confirm button + confirmButton.append(ai1wm_locale.confirm_import + ' >'); + + // Append close button to action + action.append(closeButton); + + // Append confirm button to action + action.append(confirmButton); + + // Append warning to section + header.append(warning); + + // Append header and message to section + section.append(header).append(message); + + // Append section and action to container + container.append(section).append(action); + + // Render modal + self.modal.html(container).show(); + self.overlay.show(); + }; + + // Blogs Modal + this.blogs = function (params) { + + // Create the modal container + var container = $('
'); + + // Create section to hold title, message and action + var section = $('
'); + + // Create header to hold title + var header = $('

'); + + // Create paragraph to hold mesage + var message = $('

').html(params.message); + + // Create action section + var action = $('
'); + + // Create title + var title = $('').addClass('ai1wm-title-grey').text(params.title); + + // Create continue button + var continueButton = $('').on('click', function () { + $(this).attr('disabled', 'disabled'); + self.onBlogs($(this).closest('form').serializeArray()); + }); + + // Append text to continue button + continueButton.append(ai1wm_locale.continue_import); + + // Append continue button to action + action.append(continueButton); + + // Append title to section + header.append(title); + + // Append header and message to section + section.append(header).append(message); + + // Append section and action to container + container.append(section).append(action); + + // Render modal + self.modal.html(container).show(); + self.overlay.show(); + }; + + // Info Modal + this.info = function (params) { + + // Create the modal container + var container = $('
'); + + // Create section to hold title, message and action + var section = $('
'); + + // Create header to hold loader + var header = $('

'); + + // Create paragraph to hold mesage + var message = $('

').html(params.message); + + // Create action section + var action = $('
'); + + // Create loader + var loader = $(''); + + // Create warning + var warning = $('

').html(ai1wm_locale.please_do_not_close_this_browser); + + // Create notice to be displayed during import process + var notice = $('
'); + + // Append warning to notice + notice.append(warning); + + // Append stop button to action + action.append(notice); + + // Append loader to header + header.append(loader); + + // Append header and message to section + section.append(header).append(message); + + // Append section and action to container + container.append(section).append(action); + + // Render modal + self.modal.html(container).show(); + self.overlay.show(); + }; + + // Done Modal + this.done = function (params) { + + // Create the modal container + var container = $('
'); + + // Create section to hold title, message and action + var section = $('
'); + + // Create header to hold title + var header = $('

'); + + // Create paragraph to hold mesage + var message = $('

').html(params.message); + + // Create action section + var action = $('
'); + + // Create title + var title = $('').addClass('ai1wm-title-green').text(params.title); + + // Create close button + var closeButton = $('').on('click', function () { + self.destroy(); + }); + + // Append text to close button + closeButton.append(ai1wm_locale.close_import); + + // Append close button to action + action.append(closeButton); + + // Append title to section + header.append(title); + + // Append header and message to section + section.append(header).append(message); + + // Append section and action to container + container.append(section).append(action); + + // Render modal + self.modal.html(container).show(); + self.overlay.show(); + }; + + // Create the overlay + this.overlay = $('
'); + + // Create the modal container + this.modal = $('
'); + + $('body').append(this.overlay) // Append overlay to body + .append(this.modal); // Append modal to body +}; + +Modal.prototype.render = function (params) { + + // Show modal + switch (params.type) { + case 'error': + this.error(params); + break; + + case 'confirm': + this.confirm(params); + break; + + case 'blogs': + this.blogs(params); + break; + + case 'progress': + this.progress(params); + break; + + case 'info': + this.info(params); + break; + + case 'done': + this.done(params); + break; + } + + this.view = params.type; +}; + +Modal.prototype.destroy = function () { + this.modal.hide(); + this.overlay.hide(); +}; + +module.exports = Modal; + +/***/ }), + +/***/ 3: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +jQuery(document).ready(function ($) { + 'use strict'; + + // Review + + $('#ai1wm-feedback-type-link-1').click(function (e) { + var radio = $('#ai1wm-feedback-type-1'); + if (radio.is(':checked')) { + radio.attr('checked', false); + } else { + radio.attr('checked', true); + } + }); + + // Idea + $('#ai1wm-feedback-type-link-2').click(function (e) { + var radio = $('#ai1wm-feedback-type-2'); + if (radio.is(':checked')) { + radio.attr('checked', false); + } else { + radio.attr('checked', true); + } + }); + + // Help + $('#ai1wm-feedback-type-3').click(function () { + // Hide other options + $('#ai1wm-feedback-type-1, #ai1wm-feedback-type-2').closest('li').hide(); + + // Change placeholder message + $('.ai1wm-feedback-form').find('.ai1wm-feedback-message').attr('placeholder', ai1wm_locale.how_may_we_help_you); + + // Show feedback form + $('.ai1wm-feedback-form').fadeIn(); + }); + + // Cancel feedback form + $('#ai1wm-feedback-cancel').click(function (e) { + $('.ai1wm-feedback-form').fadeOut(function () { + $('.ai1wm-feedback-type').attr('checked', false).closest('li').show(); + }); + + e.preventDefault(); + }); + + // Send feedback form + $('#ai1wm-feedback-submit').click(function (e) { + var self = $(this); + + var spinner = self.next(); + var type = $('.ai1wm-feedback-type:checked').val(); + var email = $('.ai1wm-feedback-email').val(); + var message = $('.ai1wm-feedback-message').val(); + var terms = $('.ai1wm-feedback-terms').is(':checked'); + + self.attr('disabled', true); + spinner.css('visibility', 'visible'); + + $.ajax({ + url: ai1wm_feedback.ajax.url, + type: 'POST', + dataType: 'json', + async: true, + data: { + 'secret_key': ai1wm_feedback.secret_key, + 'ai1wm_type': type, + 'ai1wm_email': email, + 'ai1wm_message': message, + 'ai1wm_terms': +terms + }, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function (data) { + self.attr('disabled', false); + spinner.css('visibility', 'hidden'); + + if (data.errors.length > 0) { + $('.ai1wm-feedback .ai1wm-message').remove(); + + var errorMessage = $('
').addClass('ai1wm-message ai1wm-error-message'); + $.each(data.errors, function (key, value) { + errorMessage.append($('

').text(value)); + }); + + $('.ai1wm-feedback').prepend(errorMessage); + } else { + var successMessage = $('

').addClass('ai1wm-message ai1wm-success-message'); + successMessage.append($('

').text(ai1wm_locale.thanks_for_submitting_your_feedback)); + + $('.ai1wm-feedback').html(successMessage); + } + }); + + e.preventDefault(); + }); +}); + +/***/ }), + +/***/ 39: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(global) { + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +var Feedback = __webpack_require__(3), + Report = __webpack_require__(4), + Import = __webpack_require__(13); + +jQuery(document).ready(function ($) { + 'use strict'; + + $('.ai1wm-backup-actions > a').hover(function () { + $(this).addClass('ai1wm-button-on'); + }, function () { + $(this).removeClass('ai1wm-button-on'); + }); + + // Delete file + $('.ai1wm-backup-delete').click(function (e) { + var self = $(this); + + // Delete file + if (confirm(ai1wm_locale.want_to_delete_this_file)) { + $.ajax({ + url: ai1wm_backups.ajax.url, + type: 'POST', + dataType: 'json', + data: { + 'secret_key': ai1wm_backups.secret_key, + 'archive': self.data('archive') + }, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function (data) { + if (data.errors.length === 0) { + self.closest('tr').remove(); + if ($('.ai1wm-backups tbody tr').length === 0) { + $('.ai1wm-backups').addClass('ai1wm-hide'); + $('.ai1wm-backups-empty').removeClass('ai1wm-hide'); + } + } + }); + } + + e.preventDefault(); + }); + + var model = new Import(); + + // Restore from file + $('.ai1wm-backup-restore').click(function (e) { + var storage = Ai1wm.Util.random(12); + var options = Ai1wm.Util.form('#ai1wm-backups-form').concat({ name: 'storage', value: storage }).concat({ name: 'archive', value: $(this).data('archive') }); + + // Set global params + model.setParams(options); + + // Start import + model.start(); + + e.preventDefault(); + }); +}); + +global.Ai1wm = jQuery.extend({}, global.Ai1wm, { Feedback: Feedback, Report: Report, Import: Import }); +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) + +/***/ }), + +/***/ 4: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +jQuery(document).ready(function ($) { + 'use strict'; + + $('#ai1wm-report-problem-button').click(function (e) { + $(this).next('.ai1wm-report-problem-dialog').toggleClass('ai1wm-report-active'); + + e.preventDefault(); + }); + + $('#ai1wm-report-cancel').click(function (e) { + $(this).closest('.ai1wm-report-problem-dialog').removeClass('ai1wm-report-active'); + + e.preventDefault(); + }); + + $('#ai1wm-report-submit').click(function (r) { + var self = $(this); + + var spinner = self.next(); + var email = $('.ai1wm-report-email').val(); + var message = $('.ai1wm-report-message').val(); + var terms = $('.ai1wm-report-terms').is(':checked'); + + self.attr('disabled', true); + spinner.css('visibility', 'visible'); + + $.ajax({ + url: ai1wm_report.ajax.url, + type: 'POST', + dataType: 'json', + async: true, + data: { + 'secret_key': ai1wm_report.secret_key, + 'ai1wm_email': email, + 'ai1wm_message': message, + 'ai1wm_terms': +terms + }, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function (data) { + self.attr('disabled', false); + spinner.css('visibility', 'hidden'); + + if (data.errors.length > 0) { + $('.ai1wm-report-problem-dialog .ai1wm-message').remove(); + + var errorMessage = $('

').addClass('ai1wm-message ai1wm-error-message'); + $.each(data.errors, function (key, value) { + errorMessage.append($('

').text(value)); + }); + + $('.ai1wm-report-problem-dialog').prepend(errorMessage); + } else { + var successMessage = $('

').addClass('ai1wm-message ai1wm-success-message'); + successMessage.append($('

').text(ai1wm_locale.thanks_for_submitting_your_request)); + + $('.ai1wm-report-problem-dialog').html(successMessage); + + // Hide message + setTimeout(function () { + $('.ai1wm-report-problem-dialog').removeClass('ai1wm-report-active'); + }, 2000); + } + }); + + e.preventDefault(); + }); +}); + +/***/ }) + +/******/ }); \ No newline at end of file diff --git a/lib/view/assets/javascript/export.min.js b/lib/view/assets/javascript/export.min.js new file mode 100644 index 0000000..2f1c779 --- /dev/null +++ b/lib/view/assets/javascript/export.min.js @@ -0,0 +1,1029 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 40); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ 0: +/***/ (function(module, exports) { + +var g; + +// This works in non-strict mode +g = (function() { + return this; +})(); + +try { + // This works if eval is allowed (see CSP) + g = g || Function("return this")() || (1,eval)("this"); +} catch(e) { + // This works if the window reference is available + if(typeof window === "object") + g = window; +} + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + +module.exports = g; + + +/***/ }), + +/***/ 3: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +jQuery(document).ready(function ($) { + 'use strict'; + + // Review + + $('#ai1wm-feedback-type-link-1').click(function (e) { + var radio = $('#ai1wm-feedback-type-1'); + if (radio.is(':checked')) { + radio.attr('checked', false); + } else { + radio.attr('checked', true); + } + }); + + // Idea + $('#ai1wm-feedback-type-link-2').click(function (e) { + var radio = $('#ai1wm-feedback-type-2'); + if (radio.is(':checked')) { + radio.attr('checked', false); + } else { + radio.attr('checked', true); + } + }); + + // Help + $('#ai1wm-feedback-type-3').click(function () { + // Hide other options + $('#ai1wm-feedback-type-1, #ai1wm-feedback-type-2').closest('li').hide(); + + // Change placeholder message + $('.ai1wm-feedback-form').find('.ai1wm-feedback-message').attr('placeholder', ai1wm_locale.how_may_we_help_you); + + // Show feedback form + $('.ai1wm-feedback-form').fadeIn(); + }); + + // Cancel feedback form + $('#ai1wm-feedback-cancel').click(function (e) { + $('.ai1wm-feedback-form').fadeOut(function () { + $('.ai1wm-feedback-type').attr('checked', false).closest('li').show(); + }); + + e.preventDefault(); + }); + + // Send feedback form + $('#ai1wm-feedback-submit').click(function (e) { + var self = $(this); + + var spinner = self.next(); + var type = $('.ai1wm-feedback-type:checked').val(); + var email = $('.ai1wm-feedback-email').val(); + var message = $('.ai1wm-feedback-message').val(); + var terms = $('.ai1wm-feedback-terms').is(':checked'); + + self.attr('disabled', true); + spinner.css('visibility', 'visible'); + + $.ajax({ + url: ai1wm_feedback.ajax.url, + type: 'POST', + dataType: 'json', + async: true, + data: { + 'secret_key': ai1wm_feedback.secret_key, + 'ai1wm_type': type, + 'ai1wm_email': email, + 'ai1wm_message': message, + 'ai1wm_terms': +terms + }, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function (data) { + self.attr('disabled', false); + spinner.css('visibility', 'hidden'); + + if (data.errors.length > 0) { + $('.ai1wm-feedback .ai1wm-message').remove(); + + var errorMessage = $('

').addClass('ai1wm-message ai1wm-error-message'); + $.each(data.errors, function (key, value) { + errorMessage.append($('

').text(value)); + }); + + $('.ai1wm-feedback').prepend(errorMessage); + } else { + var successMessage = $('

').addClass('ai1wm-message ai1wm-success-message'); + successMessage.append($('

').text(ai1wm_locale.thanks_for_submitting_your_feedback)); + + $('.ai1wm-feedback').html(successMessage); + } + }); + + e.preventDefault(); + }); +}); + +/***/ }), + +/***/ 4: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +jQuery(document).ready(function ($) { + 'use strict'; + + $('#ai1wm-report-problem-button').click(function (e) { + $(this).next('.ai1wm-report-problem-dialog').toggleClass('ai1wm-report-active'); + + e.preventDefault(); + }); + + $('#ai1wm-report-cancel').click(function (e) { + $(this).closest('.ai1wm-report-problem-dialog').removeClass('ai1wm-report-active'); + + e.preventDefault(); + }); + + $('#ai1wm-report-submit').click(function (r) { + var self = $(this); + + var spinner = self.next(); + var email = $('.ai1wm-report-email').val(); + var message = $('.ai1wm-report-message').val(); + var terms = $('.ai1wm-report-terms').is(':checked'); + + self.attr('disabled', true); + spinner.css('visibility', 'visible'); + + $.ajax({ + url: ai1wm_report.ajax.url, + type: 'POST', + dataType: 'json', + async: true, + data: { + 'secret_key': ai1wm_report.secret_key, + 'ai1wm_email': email, + 'ai1wm_message': message, + 'ai1wm_terms': +terms + }, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function (data) { + self.attr('disabled', false); + spinner.css('visibility', 'hidden'); + + if (data.errors.length > 0) { + $('.ai1wm-report-problem-dialog .ai1wm-message').remove(); + + var errorMessage = $('

').addClass('ai1wm-message ai1wm-error-message'); + $.each(data.errors, function (key, value) { + errorMessage.append($('

').text(value)); + }); + + $('.ai1wm-report-problem-dialog').prepend(errorMessage); + } else { + var successMessage = $('

').addClass('ai1wm-message ai1wm-success-message'); + successMessage.append($('

').text(ai1wm_locale.thanks_for_submitting_your_request)); + + $('.ai1wm-report-problem-dialog').html(successMessage); + + // Hide message + setTimeout(function () { + $('.ai1wm-report-problem-dialog').removeClass('ai1wm-report-active'); + }, 2000); + } + }); + + e.preventDefault(); + }); +}); + +/***/ }), + +/***/ 40: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(global) { + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +var Query = __webpack_require__(41), + FindReplace = __webpack_require__(42), + Feedback = __webpack_require__(3), + Report = __webpack_require__(4), + Export = __webpack_require__(43); + +jQuery(document).ready(function ($) { + 'use strict'; + + var model = new Export(); + + // Export to file + $('#ai1wm-export-file').click(function (e) { + var storage = Ai1wm.Util.random(12); + var options = Ai1wm.Util.form('#ai1wm-export-form').concat({ name: 'storage', value: storage }); + + // Set global params + model.setParams(options); + + // Start export + model.start(); + + e.preventDefault(); + }); + + $('.ai1wm-accordion > .ai1wm-title').click(function () { + $(this).parent().toggleClass('ai1wm-active'); + }); + + $('#ai1wm-add-new-replace-button').ai1wm_find_replace(); + + $('.ai1wm-expandable > p:first, .ai1wm-expandable > h4:first, .ai1wm-expandable > div.ai1wm-button-main').on('click', function () { + $(this).parent().toggleClass('ai1wm-open'); + }); + + $('.ai1wm-query').ai1wm_query(); +}); + +global.Ai1wm = jQuery.extend({}, global.Ai1wm, { Query: Query, FindReplace: FindReplace, Feedback: Feedback, Report: Report, Export: Export }); +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) + +/***/ }), + +/***/ 41: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +;(function ($) { + + $.fn.ai1wm_query = function () { + var findInput = $(this).find('input.ai1wm-query-find-input'), + replaceInput = $(this).find('input.ai1wm-query-replace-input'), + findText = $(this).find('small.ai1wm-query-find-text'), + replaceText = $(this).find('small.ai1wm-query-replace-text'); + + findInput.on('change paste input keypress keydown keyup', function () { + var _inputValue = $(this).val().length > 0 ? $(this).val() : ''; + findText.text(_inputValue); + }); + + replaceInput.on('change paste input keypress keydown keyup', function () { + var _inputValue = $(this).val().length > 0 ? $(this).val() : ''; + replaceText.text(_inputValue); + }); + + return this; + }; +})(jQuery); + +/***/ }), + +/***/ 42: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +;(function ($) { + + $.fn.ai1wm_find_replace = function () { + $(this).click(function (e) { + e.preventDefault(); + + var row = $('#ai1wm-queries > li:first').clone(); + + // Reset input values + row.find('input').val(''); + + // Reset ai1wm-query-find-text + row.find('.ai1wm-query-find-text').html('<text>'); + + // Reset ai1wm-query-replace-text + row.find('.ai1wm-query-replace-text').html('<another-text>'); + + $('#ai1wm-queries > li').removeClass('ai1wm-open'); + + $(row).addClass('ai1wm-open'); + + // Add new replace fields + $('#ai1wm-queries').append(row); + $(row).ai1wm_query(); + $(row).find('p:first').on('click', function () { + $(this).parent().toggleClass('ai1wm-open'); + }); + }); + + return this; + }; +})(jQuery); + +/***/ }), + +/***/ 43: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +var Modal = __webpack_require__(44), + $ = jQuery; + +var Export = function Export() { + var self = this; + + // Set params + this.params = []; + + // Set stop flag + this.stopExport = false; + + // Set modal + this.modal = new Modal(); + + // Set stop listener + this.modal.onStop = function (options) { + self.onStop(options); + }; +}; + +Export.prototype.setParams = function (params) { + this.params = Ai1wm.Util.list(params); +}; + +Export.prototype.start = function (options, retries) { + var self = this; + var retries = retries || 0; + + // Set stop flag + if (retries === 0) { + this.stopExport = false; + } + + // Stop running export + if (this.stopExport) { + return; + } + + // Initializing beforeunload event + $(window).bind('beforeunload', function () { + return ai1wm_locale.stop_exporting_your_website; + }); + + // Set initial status + this.setStatus({ type: 'info', message: ai1wm_locale.preparing_to_export }); + + // Set params + var params = this.params.concat({ name: 'secret_key', value: ai1wm_export.secret_key }); + + // Set additional params + if (options) { + params = params.concat(Ai1wm.Util.list(options)); + } + + // Export + $.ajax({ + url: ai1wm_export.ajax.url, + type: 'POST', + dataType: 'json', + data: params, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function () { + self.getStatus(); + }).done(function (params) { + if (params) { + self.run(params); + } + }).fail(function () { + var timeout = retries * 1000; + if (retries >= 5) { + return self.setStatus({ + type: 'error', + title: ai1wm_locale.unable_to_export, + message: ai1wm_locale.unable_to_start_the_export + }); + } + + retries++; + + setTimeout(self.start.bind(self, options, retries), timeout); + }); +}; + +Export.prototype.run = function (params, retries) { + var self = this; + var retries = retries || 0; + + // Stop running export + if (this.stopExport) { + return; + } + + // Export + $.ajax({ + url: ai1wm_export.ajax.url, + type: 'POST', + dataType: 'json', + data: params, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function (params) { + if (params) { + self.run(params); + } + }).fail(function () { + var timeout = retries * 1000; + if (retries >= 5) { + return self.setStatus({ + type: 'error', + title: ai1wm_locale.unable_to_export, + message: ai1wm_locale.unable_to_run_the_export + }); + } + + retries++; + + setTimeout(self.run.bind(self, params, retries), timeout); + }); +}; + +Export.prototype.clean = function (options, retries) { + var self = this; + var retries = retries || 0; + + // Set stop flag + this.stopExport = true; + + // Set initial status + this.setStatus({ type: 'info', message: ai1wm_locale.please_wait_stopping_the_export }); + + // Set params + var params = this.params.concat({ name: 'secret_key', value: ai1wm_export.secret_key }).concat({ name: 'priority', value: 300 }); + + // Set additional params + if (options) { + params = params.concat(Ai1wm.Util.list(options)); + } + + // Clean + $.ajax({ + url: ai1wm_export.ajax.url, + type: 'POST', + dataType: 'json', + data: params, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function () { + // Unbinding the beforeunload event when we stop exporting + $(window).unbind('beforeunload'); + + // Destroy modal + self.modal.destroy(); + }).fail(function () { + var timeout = retries * 1000; + if (retries >= 5) { + return self.setStatus({ + type: 'error', + title: ai1wm_locale.unable_to_export, + message: ai1wm_locale.unable_to_stop_the_export + }); + } + + retries++; + + setTimeout(self.clean.bind(self, options, retries), timeout); + }); +}; + +Export.prototype.getStatus = function () { + var self = this; + + // Stop getting status + if (this.stopExport) { + return; + } + + $.ajax({ + url: ai1wm_export.status.url, + type: 'GET', + dataType: 'json', + cache: false, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function (params) { + if (params) { + self.setStatus(params); + + // Next status + switch (params.type) { + case 'done': + case 'error': + case 'download': + // Unbinding beforeunload event when any case is performed + $(window).unbind('beforeunload'); + return; + } + } + + // Export is not done yet, let's check status in 3 seconds + setTimeout(self.getStatus.bind(self), 3000); + }).fail(function () { + // Export is not done yet, let's check status in 3 seconds + setTimeout(self.getStatus.bind(self), 3000); + }); +}; + +Export.prototype.setStatus = function (params) { + this.modal.render(params); +}; + +Export.prototype.onStop = function (options) { + this.clean(options); +}; + +module.exports = Export; + +/***/ }), + +/***/ 44: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +var $ = jQuery; + +var Modal = function Modal() { + var self = this; + + // Error Modal + this.error = function (params) { + + // Create the modal container + var container = $('

'); + + // Create section to hold title, message and action + var section = $('
'); + + // Create header to hold title + var header = $('

'); + + // Create paragraph to hold mesage + var message = $('

').html(params.message); + + // Create action section + var action = $('
'); + + // Create title + var title = $('').addClass('ai1wm-title-red').text(params.title); + + // Create close button + var closeButton = $('').on('click', function () { + self.destroy(); + }); + + // Append text to close button + closeButton.append(ai1wm_locale.close_export); + + // Append close button to action + action.append(closeButton); + + // Append title to section + header.append(title); + + // Append header and message to section + section.append(header).append(message); + + // Append section and action to container + container.append(section).append(action); + + // Render modal + self.modal.html(container).show(); + self.overlay.show(); + }; + + // Info Modal + this.info = function (params) { + + // Create the modal container + var container = $('
'); + + // Create section to hold title, message and action + var section = $('
'); + + // Create header to hold loader + var header = $('

'); + + // Create paragraph to hold mesage + var message = $('

').html(params.message); + + // Create action section + var action = $('
'); + + // Create loader + var loader = $(''); + + // Create stop export + var stopButton = $('').on('click', function () { + $(this).attr('disabled', 'disabled'); + self.onStop(); + }); + + // Append text to stop button + stopButton.append(' ' + ai1wm_locale.stop_export); + + // Append stop button to action + action.append(stopButton); + + // Append loader to header + header.append(loader); + + // Append header and message to section + section.append(header).append(message); + + // Append section and action to container + container.append(section).append(action); + + // Render modal + self.modal.html(container).show(); + self.overlay.show(); + }; + + // Done Modal + this.done = function (params) { + + // Create the modal container + var container = $('
'); + + // Create section to hold title, message and action + var section = $('
'); + + // Create header to hold title + var header = $('

'); + + // Create paragraph to hold mesage + var message = $('

').html(params.message); + + // Create action section + var action = $('
'); + + // Create title + var title = $('').addClass('ai1wm-title-green').text(params.title); + + // Create close button + var closeButton = $('').on('click', function () { + self.destroy(); + }); + + // Append text to close button + closeButton.append(ai1wm_locale.close_export); + + // Append close button to action + action.append(closeButton); + + // Append title to section + header.append(title); + + // Append header and message to section + section.append(header).append(message); + + // Append section and action to container + container.append(section).append(action); + + // Render modal + self.modal.html(container).show(); + self.overlay.show(); + }; + + // Download Modal + this.download = function (params) { + + // Create the modal container + var container = $('
'); + + // Create section to hold title, message and action + var section = $('
'); + + // Create header to hold title + var header = $('

'); + + // Create paragraph to hold mesage + var message = $('

').html(params.message); + + // Create action section + var action = $('
'); + + // Create close button + var closeButton = $('').on('click', function () { + self.destroy(); + }); + + // Append text to close button + closeButton.append(ai1wm_locale.close_export); + + // Append close button to action + action.append(closeButton); + + // Append message to section + section.append(message); + + // Append section and action to container + container.append(section).append(action); + + // Render modal + self.modal.html(container).show(); + self.overlay.show(); + }; + + // Create the overlay + this.overlay = $('
'); + + // Create the modal container + this.modal = $('
'); + + $('body').append(this.overlay) // Append overlay to body + .append(this.modal); // Append modal to body +}; + +Modal.prototype.render = function (params) { + + // Show modal + switch (params.type) { + case 'error': + this.error(params); + break; + + case 'info': + this.info(params); + break; + + case 'done': + this.done(params); + break; + + case 'download': + this.download(params); + break; + } +}; + +Modal.prototype.destroy = function () { + this.modal.hide(); + this.overlay.hide(); +}; + +module.exports = Modal; + +/***/ }) + +/******/ }); \ No newline at end of file diff --git a/lib/view/assets/javascript/feedback.min.js b/lib/view/assets/javascript/feedback.min.js new file mode 100644 index 0000000..549ca17 --- /dev/null +++ b/lib/view/assets/javascript/feedback.min.js @@ -0,0 +1,263 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 45); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ 0: +/***/ (function(module, exports) { + +var g; + +// This works in non-strict mode +g = (function() { + return this; +})(); + +try { + // This works if eval is allowed (see CSP) + g = g || Function("return this")() || (1,eval)("this"); +} catch(e) { + // This works if the window reference is available + if(typeof window === "object") + g = window; +} + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + +module.exports = g; + + +/***/ }), + +/***/ 3: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +jQuery(document).ready(function ($) { + 'use strict'; + + // Review + + $('#ai1wm-feedback-type-link-1').click(function (e) { + var radio = $('#ai1wm-feedback-type-1'); + if (radio.is(':checked')) { + radio.attr('checked', false); + } else { + radio.attr('checked', true); + } + }); + + // Idea + $('#ai1wm-feedback-type-link-2').click(function (e) { + var radio = $('#ai1wm-feedback-type-2'); + if (radio.is(':checked')) { + radio.attr('checked', false); + } else { + radio.attr('checked', true); + } + }); + + // Help + $('#ai1wm-feedback-type-3').click(function () { + // Hide other options + $('#ai1wm-feedback-type-1, #ai1wm-feedback-type-2').closest('li').hide(); + + // Change placeholder message + $('.ai1wm-feedback-form').find('.ai1wm-feedback-message').attr('placeholder', ai1wm_locale.how_may_we_help_you); + + // Show feedback form + $('.ai1wm-feedback-form').fadeIn(); + }); + + // Cancel feedback form + $('#ai1wm-feedback-cancel').click(function (e) { + $('.ai1wm-feedback-form').fadeOut(function () { + $('.ai1wm-feedback-type').attr('checked', false).closest('li').show(); + }); + + e.preventDefault(); + }); + + // Send feedback form + $('#ai1wm-feedback-submit').click(function (e) { + var self = $(this); + + var spinner = self.next(); + var type = $('.ai1wm-feedback-type:checked').val(); + var email = $('.ai1wm-feedback-email').val(); + var message = $('.ai1wm-feedback-message').val(); + var terms = $('.ai1wm-feedback-terms').is(':checked'); + + self.attr('disabled', true); + spinner.css('visibility', 'visible'); + + $.ajax({ + url: ai1wm_feedback.ajax.url, + type: 'POST', + dataType: 'json', + async: true, + data: { + 'secret_key': ai1wm_feedback.secret_key, + 'ai1wm_type': type, + 'ai1wm_email': email, + 'ai1wm_message': message, + 'ai1wm_terms': +terms + }, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function (data) { + self.attr('disabled', false); + spinner.css('visibility', 'hidden'); + + if (data.errors.length > 0) { + $('.ai1wm-feedback .ai1wm-message').remove(); + + var errorMessage = $('
').addClass('ai1wm-message ai1wm-error-message'); + $.each(data.errors, function (key, value) { + errorMessage.append($('

').text(value)); + }); + + $('.ai1wm-feedback').prepend(errorMessage); + } else { + var successMessage = $('

').addClass('ai1wm-message ai1wm-success-message'); + successMessage.append($('

').text(ai1wm_locale.thanks_for_submitting_your_feedback)); + + $('.ai1wm-feedback').html(successMessage); + } + }); + + e.preventDefault(); + }); +}); + +/***/ }), + +/***/ 45: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(global) { + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +var Feedback = __webpack_require__(3); + +global.Ai1wm = jQuery.extend({}, global.Ai1wm, { Feedback: Feedback }); +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) + +/***/ }) + +/******/ }); \ No newline at end of file diff --git a/lib/view/assets/javascript/import.min.js b/lib/view/assets/javascript/import.min.js new file mode 100644 index 0000000..2b16ea6 --- /dev/null +++ b/lib/view/assets/javascript/import.min.js @@ -0,0 +1,3510 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 46); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { + +var g; + +// This works in non-strict mode +g = (function() { + return this; +})(); + +try { + // This works if eval is allowed (see CSP) + g = g || Function("return this")() || (1,eval)("this"); +} catch(e) { + // This works if the window reference is available + if(typeof window === "object") + g = window; +} + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + +module.exports = g; + + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + +var store = __webpack_require__(27)('wks'); +var uid = __webpack_require__(20); +var Symbol = __webpack_require__(2).Symbol; +var USE_SYMBOL = typeof Symbol == 'function'; + +var $exports = module.exports = function (name) { + return store[name] || (store[name] = + USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); +}; + +$exports.store = store; + + +/***/ }), +/* 2 */ +/***/ (function(module, exports) { + +// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 +var global = module.exports = typeof window != 'undefined' && window.Math == Math + ? window : typeof self != 'undefined' && self.Math == Math ? self + // eslint-disable-next-line no-new-func + : Function('return this')(); +if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef + + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +jQuery(document).ready(function ($) { + 'use strict'; + + // Review + + $('#ai1wm-feedback-type-link-1').click(function (e) { + var radio = $('#ai1wm-feedback-type-1'); + if (radio.is(':checked')) { + radio.attr('checked', false); + } else { + radio.attr('checked', true); + } + }); + + // Idea + $('#ai1wm-feedback-type-link-2').click(function (e) { + var radio = $('#ai1wm-feedback-type-2'); + if (radio.is(':checked')) { + radio.attr('checked', false); + } else { + radio.attr('checked', true); + } + }); + + // Help + $('#ai1wm-feedback-type-3').click(function () { + // Hide other options + $('#ai1wm-feedback-type-1, #ai1wm-feedback-type-2').closest('li').hide(); + + // Change placeholder message + $('.ai1wm-feedback-form').find('.ai1wm-feedback-message').attr('placeholder', ai1wm_locale.how_may_we_help_you); + + // Show feedback form + $('.ai1wm-feedback-form').fadeIn(); + }); + + // Cancel feedback form + $('#ai1wm-feedback-cancel').click(function (e) { + $('.ai1wm-feedback-form').fadeOut(function () { + $('.ai1wm-feedback-type').attr('checked', false).closest('li').show(); + }); + + e.preventDefault(); + }); + + // Send feedback form + $('#ai1wm-feedback-submit').click(function (e) { + var self = $(this); + + var spinner = self.next(); + var type = $('.ai1wm-feedback-type:checked').val(); + var email = $('.ai1wm-feedback-email').val(); + var message = $('.ai1wm-feedback-message').val(); + var terms = $('.ai1wm-feedback-terms').is(':checked'); + + self.attr('disabled', true); + spinner.css('visibility', 'visible'); + + $.ajax({ + url: ai1wm_feedback.ajax.url, + type: 'POST', + dataType: 'json', + async: true, + data: { + 'secret_key': ai1wm_feedback.secret_key, + 'ai1wm_type': type, + 'ai1wm_email': email, + 'ai1wm_message': message, + 'ai1wm_terms': +terms + }, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function (data) { + self.attr('disabled', false); + spinner.css('visibility', 'hidden'); + + if (data.errors.length > 0) { + $('.ai1wm-feedback .ai1wm-message').remove(); + + var errorMessage = $('

').addClass('ai1wm-message ai1wm-error-message'); + $.each(data.errors, function (key, value) { + errorMessage.append($('

').text(value)); + }); + + $('.ai1wm-feedback').prepend(errorMessage); + } else { + var successMessage = $('

').addClass('ai1wm-message ai1wm-success-message'); + successMessage.append($('

').text(ai1wm_locale.thanks_for_submitting_your_feedback)); + + $('.ai1wm-feedback').html(successMessage); + } + }); + + e.preventDefault(); + }); +}); + +/***/ }), +/* 4 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +jQuery(document).ready(function ($) { + 'use strict'; + + $('#ai1wm-report-problem-button').click(function (e) { + $(this).next('.ai1wm-report-problem-dialog').toggleClass('ai1wm-report-active'); + + e.preventDefault(); + }); + + $('#ai1wm-report-cancel').click(function (e) { + $(this).closest('.ai1wm-report-problem-dialog').removeClass('ai1wm-report-active'); + + e.preventDefault(); + }); + + $('#ai1wm-report-submit').click(function (r) { + var self = $(this); + + var spinner = self.next(); + var email = $('.ai1wm-report-email').val(); + var message = $('.ai1wm-report-message').val(); + var terms = $('.ai1wm-report-terms').is(':checked'); + + self.attr('disabled', true); + spinner.css('visibility', 'visible'); + + $.ajax({ + url: ai1wm_report.ajax.url, + type: 'POST', + dataType: 'json', + async: true, + data: { + 'secret_key': ai1wm_report.secret_key, + 'ai1wm_email': email, + 'ai1wm_message': message, + 'ai1wm_terms': +terms + }, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function (data) { + self.attr('disabled', false); + spinner.css('visibility', 'hidden'); + + if (data.errors.length > 0) { + $('.ai1wm-report-problem-dialog .ai1wm-message').remove(); + + var errorMessage = $('

').addClass('ai1wm-message ai1wm-error-message'); + $.each(data.errors, function (key, value) { + errorMessage.append($('

').text(value)); + }); + + $('.ai1wm-report-problem-dialog').prepend(errorMessage); + } else { + var successMessage = $('

').addClass('ai1wm-message ai1wm-success-message'); + successMessage.append($('

').text(ai1wm_locale.thanks_for_submitting_your_request)); + + $('.ai1wm-report-problem-dialog').html(successMessage); + + // Hide message + setTimeout(function () { + $('.ai1wm-report-problem-dialog').removeClass('ai1wm-report-active'); + }, 2000); + } + }); + + e.preventDefault(); + }); +}); + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { + +var isObject = __webpack_require__(8); +module.exports = function (it) { + if (!isObject(it)) throw TypeError(it + ' is not an object!'); + return it; +}; + + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { + +var dP = __webpack_require__(15); +var createDesc = __webpack_require__(29); +module.exports = __webpack_require__(9) ? function (object, key, value) { + return dP.f(object, key, createDesc(1, value)); +} : function (object, key, value) { + object[key] = value; + return object; +}; + + +/***/ }), +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { + +var global = __webpack_require__(2); +var hide = __webpack_require__(6); +var has = __webpack_require__(10); +var SRC = __webpack_require__(20)('src'); +var TO_STRING = 'toString'; +var $toString = Function[TO_STRING]; +var TPL = ('' + $toString).split(TO_STRING); + +__webpack_require__(11).inspectSource = function (it) { + return $toString.call(it); +}; + +(module.exports = function (O, key, val, safe) { + var isFunction = typeof val == 'function'; + if (isFunction) has(val, 'name') || hide(val, 'name', key); + if (O[key] === val) return; + if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); + if (O === global) { + O[key] = val; + } else if (!safe) { + delete O[key]; + hide(O, key, val); + } else if (O[key]) { + O[key] = val; + } else { + hide(O, key, val); + } +// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative +})(Function.prototype, TO_STRING, function toString() { + return typeof this == 'function' && this[SRC] || $toString.call(this); +}); + + +/***/ }), +/* 8 */ +/***/ (function(module, exports) { + +module.exports = function (it) { + return typeof it === 'object' ? it !== null : typeof it === 'function'; +}; + + +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + +// Thank's IE8 for his funny defineProperty +module.exports = !__webpack_require__(28)(function () { + return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; +}); + + +/***/ }), +/* 10 */ +/***/ (function(module, exports) { + +var hasOwnProperty = {}.hasOwnProperty; +module.exports = function (it, key) { + return hasOwnProperty.call(it, key); +}; + + +/***/ }), +/* 11 */ +/***/ (function(module, exports) { + +var core = module.exports = { version: '2.5.1' }; +if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef + + +/***/ }), +/* 12 */ +/***/ (function(module, exports) { + +module.exports = {}; + + +/***/ }), +/* 13 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +var Modal = __webpack_require__(18), + $ = jQuery; + +var Import = function Import() { + var self = this; + + // Set params + this.params = []; + + // Set stop flag + this.stopImport = false; + + // Set modal + this.modal = new Modal(); + + // Set confirm listener + this.modal.onConfirm = function (options) { + self.onConfirm(options); + }; + + // Set blogs listener + this.modal.onBlogs = function (options) { + self.onBlogs(options); + }; + + // Set stop listener + this.modal.onStop = function (options) { + self.onStop(options); + }; +}; + +Import.prototype.setParams = function (params) { + this.params = Ai1wm.Util.list(params); +}; + +Import.prototype.start = function (options, retries) { + var self = this; + var retries = retries || 0; + + // Set stop flag + if (retries === 0) { + this.stopImport = false; + } + + // Stop running import + if (this.stopImport) { + return; + } + + // Initializing beforeunload event + $(window).bind('beforeunload', function () { + return ai1wm_locale.stop_importing_your_website; + }); + + // Set initial status + this.setStatus({ type: 'info', message: ai1wm_locale.preparing_to_import }); + + // Set params + var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }); + + // Set additional params + if (options) { + params = params.concat(Ai1wm.Util.list(options)); + } + + // Import + $.ajax({ + url: ai1wm_import.ajax.url, + type: 'POST', + dataType: 'json', + data: params, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function () { + self.getStatus(); + }).done(function (params) { + if (params) { + self.run(params); + } + }).fail(function () { + var timeout = retries * 1000; + if (retries >= 5) { + return self.setStatus({ + type: 'error', + title: ai1wm_locale.unable_to_import, + message: ai1wm_locale.unable_to_start_the_import + }); + } + + retries++; + + setTimeout(self.start.bind(self, options, retries), timeout); + }); +}; + +Import.prototype.run = function (params, retries) { + var self = this; + var retries = retries || 0; + + // Stop running import + if (this.stopImport) { + return; + } + + // Import + $.ajax({ + url: ai1wm_import.ajax.url, + type: 'POST', + dataType: 'json', + data: params, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function (params) { + if (params) { + self.run(params); + } + }).fail(function () { + var timeout = retries * 1000; + + retries++; + + setTimeout(self.run.bind(self, params, retries), timeout); + }); +}; + +Import.prototype.confirm = function (options, retries) { + var self = this; + var retries = retries || 0; + + // Stop running import + if (this.stopImport) { + return; + } + + // Set params + var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 150 }); + + // Set additional params + if (options) { + params = params.concat(Ai1wm.Util.list(options)); + } + + // Confirm + $.ajax({ + url: ai1wm_import.ajax.url, + type: 'POST', + dataType: 'json', + data: params, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function () { + self.getStatus(); + }).done(function (params) { + if (params) { + self.run(params); + } + }).fail(function () { + var timeout = retries * 1000; + if (retries >= 5) { + return self.setStatus({ + type: 'error', + title: ai1wm_locale.unable_to_import, + message: ai1wm_locale.unable_to_confirm_the_import + }); + } + + retries++; + + setTimeout(self.confirm.bind(self, options, retries), timeout); + }); +}; + +Import.prototype.blogs = function (options, retries) { + var self = this; + var retries = retries || 0; + + // Stop running import + if (this.stopImport) { + return; + } + + // Set params + var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 150 }); + + // Set additional params + if (options) { + params = params.concat(Ai1wm.Util.list(options)); + } + + // Blogs + $.ajax({ + url: ai1wm_import.ajax.url, + type: 'POST', + dataType: 'json', + data: params, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function () { + self.getStatus(); + }).done(function (params) { + if (params) { + self.run(params); + } + }).fail(function () { + var timeout = retries * 1000; + if (retries >= 5) { + return self.setStatus({ + type: 'error', + title: ai1wm_locale.unable_to_import, + message: ai1wm_locale.unable_to_prepare_blogs_on_import + }); + } + + retries++; + + setTimeout(self.blogs.bind(self, options, retries), timeout); + }); +}; + +Import.prototype.clean = function (options, retries) { + var self = this; + var retries = retries || 0; + + // Set stop flag + this.stopImport = true; + + // Set initial status + this.setStatus({ type: 'info', message: ai1wm_locale.please_wait_stopping_the_export }); + + // Set params + var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 400 }); + + // Set additional params + if (options) { + params = params.concat(Ai1wm.Util.list(options)); + } + + // Clean + $.ajax({ + url: ai1wm_import.ajax.url, + type: 'POST', + dataType: 'json', + data: params, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function () { + // Unbinding the beforeunload event when we stop importing + $(window).unbind('beforeunload'); + + // Destroy modal + self.modal.destroy(); + }).fail(function () { + var timeout = retries * 1000; + if (retries >= 5) { + return self.setStatus({ + type: 'error', + title: ai1wm_locale.unable_to_import, + message: ai1wm_locale.unable_to_stop_the_import + }); + } + + retries++; + + setTimeout(self.clean.bind(self, options, retries), timeout); + }); +}; + +Import.prototype.getStatus = function () { + var self = this; + + // Stop getting status + if (this.stopImport) { + return; + } + + $.ajax({ + url: ai1wm_import.status.url, + type: 'GET', + dataType: 'json', + cache: false, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function (params) { + if (params) { + self.setStatus(params); + + // Next status + switch (params.type) { + case 'done': + case 'error': + // Unbinding the beforeunload event when any case is performed + $(window).unbind('beforeunload'); + return; + + case 'confirm': + case 'blogs': + return; + } + } + + // Import is not done yet, let's check status in 3 seconds + setTimeout(self.getStatus.bind(self), 3000); + }).fail(function () { + // Import is not done yet, let's check status in 3 seconds + setTimeout(self.getStatus.bind(self), 3000); + });; +}; + +Import.prototype.setStatus = function (params) { + this.modal.render(params); +}; + +Import.prototype.onConfirm = function (options) { + this.confirm(options); +}; + +Import.prototype.onBlogs = function (options) { + this.blogs(options); +}; + +Import.prototype.onStop = function (options) { + this.clean(options); +}; + +module.exports = Import; + +/***/ }), +/* 14 */ +/***/ (function(module, exports) { + +var toString = {}.toString; + +module.exports = function (it) { + return toString.call(it).slice(8, -1); +}; + + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { + +var anObject = __webpack_require__(5); +var IE8_DOM_DEFINE = __webpack_require__(51); +var toPrimitive = __webpack_require__(52); +var dP = Object.defineProperty; + +exports.f = __webpack_require__(9) ? Object.defineProperty : function defineProperty(O, P, Attributes) { + anObject(O); + P = toPrimitive(P, true); + anObject(Attributes); + if (IE8_DOM_DEFINE) try { + return dP(O, P, Attributes); + } catch (e) { /* empty */ } + if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); + if ('value' in Attributes) O[P] = Attributes.value; + return O; +}; + + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + +// optional / simple context binding +var aFunction = __webpack_require__(17); +module.exports = function (fn, that, length) { + aFunction(fn); + if (that === undefined) return fn; + switch (length) { + case 1: return function (a) { + return fn.call(that, a); + }; + case 2: return function (a, b) { + return fn.call(that, a, b); + }; + case 3: return function (a, b, c) { + return fn.call(that, a, b, c); + }; + } + return function (/* ...args */) { + return fn.apply(that, arguments); + }; +}; + + +/***/ }), +/* 17 */ +/***/ (function(module, exports) { + +module.exports = function (it) { + if (typeof it != 'function') throw TypeError(it + ' is not a function!'); + return it; +}; + + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +var $ = jQuery; + +var Modal = function Modal() { + var self = this; + this.view = null; + + // Error Modal + this.error = function (params) { + + // Create the modal container + var container = $('

'); + + // Create section to hold title, message and action + var section = $('
'); + + // Create header to hold title + var header = $('

'); + + // Create paragraph to hold mesage + var message = $('

').html(params.message); + + // Create action section + var action = $('
'); + + // Create title + var title = $('').addClass('ai1wm-title-red').text(params.title); + + // Create close button + var closeButton = $('').on('click', function () { + self.destroy(); + }); + + // Append text to close button + closeButton.append(ai1wm_locale.close_import); + + // Append close button to action + action.append(closeButton); + + // Append title to section + header.append(title); + + // Append header and message to section + section.append(header).append(message); + + // Append section and action to container + container.append(section).append(action); + + // Render modal + self.modal.html(container).show(); + self.overlay.show(); + }; + + // Progress Modal + this.progress = function (params) { + if (this.view === 'progress') { + + // Update progress bar meter + this.progress.progressBarMeter.width(params.percent + '%'); + + // Update progress bar percent + this.progress.progressBarPercent.text(params.percent + '%'); + } else { + + // Create the modal container + var container = $('
'); + + // Create section to hold title, message and action + var section = $('
'); + + // Create header to hold progress bar + var header = $('

'); + + // Create paragraph to hold mesage + var message = $('

'); + + // Create action section + var action = $('
'); + + // Create progress bar + var progressBar = $(''); + + // Create progress bar meter + this.progress.progressBarMeter = $('').width(params.percent + '%'); + + // Create progress bar percent + this.progress.progressBarPercent = $('').text(params.percent + '%'); + + // Create stop import + var stopButton = $('').on('click', function () { + $(this).attr('disabled', 'disabled'); + self.onStop(); + }); + + // Append text to stop button + stopButton.append(' ' + ai1wm_locale.stop_import); + + // Append progress meter and progress percent + progressBar.append(this.progress.progressBarMeter).append(this.progress.progressBarPercent); + + // Append stop button to action + action.append(stopButton); + + // Append progress bar to section + header.append(progressBar); + + // Append header to section + section.append(header); + + // Append section and action to container + container.append(section).append(action); + + // Render modal + self.modal.html(container).show(); + self.overlay.show(); + } + }; + + // Confirm Modal + this.confirm = function (params) { + + // Create the modal container + var container = $('
'); + + // Create section to hold title, message and action + var section = $('
'); + + // Create header to hold warning + var header = $('

'); + + // Create paragraph to hold mesage + var message = $('

').html(params.message); + + // Create action section + var action = $('
'); + + // Create warning + var warning = $(''); + + // Create close button + var closeButton = $('').on('click', function () { + $(this).attr('disabled', 'disabled'); + self.onStop(); + }); + + // Create confirm button + var confirmButton = $('').on('click', function () { + $(this).attr('disabled', 'disabled'); + self.onConfirm(); + }); + + // Append text to close button + closeButton.append(ai1wm_locale.close_import); + + // Append text to confirm button + confirmButton.append(ai1wm_locale.confirm_import + ' >'); + + // Append close button to action + action.append(closeButton); + + // Append confirm button to action + action.append(confirmButton); + + // Append warning to section + header.append(warning); + + // Append header and message to section + section.append(header).append(message); + + // Append section and action to container + container.append(section).append(action); + + // Render modal + self.modal.html(container).show(); + self.overlay.show(); + }; + + // Blogs Modal + this.blogs = function (params) { + + // Create the modal container + var container = $('
'); + + // Create section to hold title, message and action + var section = $('
'); + + // Create header to hold title + var header = $('

'); + + // Create paragraph to hold mesage + var message = $('

').html(params.message); + + // Create action section + var action = $('
'); + + // Create title + var title = $('').addClass('ai1wm-title-grey').text(params.title); + + // Create continue button + var continueButton = $('').on('click', function () { + $(this).attr('disabled', 'disabled'); + self.onBlogs($(this).closest('form').serializeArray()); + }); + + // Append text to continue button + continueButton.append(ai1wm_locale.continue_import); + + // Append continue button to action + action.append(continueButton); + + // Append title to section + header.append(title); + + // Append header and message to section + section.append(header).append(message); + + // Append section and action to container + container.append(section).append(action); + + // Render modal + self.modal.html(container).show(); + self.overlay.show(); + }; + + // Info Modal + this.info = function (params) { + + // Create the modal container + var container = $('
'); + + // Create section to hold title, message and action + var section = $('
'); + + // Create header to hold loader + var header = $('

'); + + // Create paragraph to hold mesage + var message = $('

').html(params.message); + + // Create action section + var action = $('
'); + + // Create loader + var loader = $(''); + + // Create warning + var warning = $('

').html(ai1wm_locale.please_do_not_close_this_browser); + + // Create notice to be displayed during import process + var notice = $('
'); + + // Append warning to notice + notice.append(warning); + + // Append stop button to action + action.append(notice); + + // Append loader to header + header.append(loader); + + // Append header and message to section + section.append(header).append(message); + + // Append section and action to container + container.append(section).append(action); + + // Render modal + self.modal.html(container).show(); + self.overlay.show(); + }; + + // Done Modal + this.done = function (params) { + + // Create the modal container + var container = $('
'); + + // Create section to hold title, message and action + var section = $('
'); + + // Create header to hold title + var header = $('

'); + + // Create paragraph to hold mesage + var message = $('

').html(params.message); + + // Create action section + var action = $('
'); + + // Create title + var title = $('').addClass('ai1wm-title-green').text(params.title); + + // Create close button + var closeButton = $('').on('click', function () { + self.destroy(); + }); + + // Append text to close button + closeButton.append(ai1wm_locale.close_import); + + // Append close button to action + action.append(closeButton); + + // Append title to section + header.append(title); + + // Append header and message to section + section.append(header).append(message); + + // Append section and action to container + container.append(section).append(action); + + // Render modal + self.modal.html(container).show(); + self.overlay.show(); + }; + + // Create the overlay + this.overlay = $('
'); + + // Create the modal container + this.modal = $('
'); + + $('body').append(this.overlay) // Append overlay to body + .append(this.modal); // Append modal to body +}; + +Modal.prototype.render = function (params) { + + // Show modal + switch (params.type) { + case 'error': + this.error(params); + break; + + case 'confirm': + this.confirm(params); + break; + + case 'blogs': + this.blogs(params); + break; + + case 'progress': + this.progress(params); + break; + + case 'info': + this.info(params); + break; + + case 'done': + this.done(params); + break; + } + + this.view = params.type; +}; + +Modal.prototype.destroy = function () { + this.modal.hide(); + this.overlay.hide(); +}; + +module.exports = Modal; + +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { + +// getting tag from 19.1.3.6 Object.prototype.toString() +var cof = __webpack_require__(14); +var TAG = __webpack_require__(1)('toStringTag'); +// ES3 wrong here +var ARG = cof(function () { return arguments; }()) == 'Arguments'; + +// fallback for IE11 Script Access Denied error +var tryGet = function (it, key) { + try { + return it[key]; + } catch (e) { /* empty */ } +}; + +module.exports = function (it) { + var O, T, B; + return it === undefined ? 'Undefined' : it === null ? 'Null' + // @@toStringTag case + : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T + // builtinTag case + : ARG ? cof(O) + // ES3 arguments fallback + : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; +}; + + +/***/ }), +/* 20 */ +/***/ (function(module, exports) { + +var id = 0; +var px = Math.random(); +module.exports = function (key) { + return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); +}; + + +/***/ }), +/* 21 */ +/***/ (function(module, exports, __webpack_require__) { + +var isObject = __webpack_require__(8); +var document = __webpack_require__(2).document; +// typeof document.createElement is 'object' in old IE +var is = isObject(document) && isObject(document.createElement); +module.exports = function (it) { + return is ? document.createElement(it) : {}; +}; + + +/***/ }), +/* 22 */ +/***/ (function(module, exports) { + +// 7.1.4 ToInteger +var ceil = Math.ceil; +var floor = Math.floor; +module.exports = function (it) { + return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); +}; + + +/***/ }), +/* 23 */ +/***/ (function(module, exports) { + +// 7.2.1 RequireObjectCoercible(argument) +module.exports = function (it) { + if (it == undefined) throw TypeError("Can't call method on " + it); + return it; +}; + + +/***/ }), +/* 24 */ +/***/ (function(module, exports, __webpack_require__) { + +// to indexed object, toObject with fallback for non-array-like ES3 strings +var IObject = __webpack_require__(59); +var defined = __webpack_require__(23); +module.exports = function (it) { + return IObject(defined(it)); +}; + + +/***/ }), +/* 25 */ +/***/ (function(module, exports, __webpack_require__) { + +var shared = __webpack_require__(27)('keys'); +var uid = __webpack_require__(20); +module.exports = function (key) { + return shared[key] || (shared[key] = uid(key)); +}; + + +/***/ }), +/* 26 */ +/***/ (function(module, exports, __webpack_require__) { + +var def = __webpack_require__(15).f; +var has = __webpack_require__(10); +var TAG = __webpack_require__(1)('toStringTag'); + +module.exports = function (it, tag, stat) { + if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); +}; + + +/***/ }), +/* 27 */ +/***/ (function(module, exports, __webpack_require__) { + +var global = __webpack_require__(2); +var SHARED = '__core-js_shared__'; +var store = global[SHARED] || (global[SHARED] = {}); +module.exports = function (key) { + return store[key] || (store[key] = {}); +}; + + +/***/ }), +/* 28 */ +/***/ (function(module, exports) { + +module.exports = function (exec) { + try { + return !!exec(); + } catch (e) { + return true; + } +}; + + +/***/ }), +/* 29 */ +/***/ (function(module, exports) { + +module.exports = function (bitmap, value) { + return { + enumerable: !(bitmap & 1), + configurable: !(bitmap & 2), + writable: !(bitmap & 4), + value: value + }; +}; + + +/***/ }), +/* 30 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var LIBRARY = __webpack_require__(31); +var $export = __webpack_require__(32); +var redefine = __webpack_require__(7); +var hide = __webpack_require__(6); +var has = __webpack_require__(10); +var Iterators = __webpack_require__(12); +var $iterCreate = __webpack_require__(55); +var setToStringTag = __webpack_require__(26); +var getPrototypeOf = __webpack_require__(62); +var ITERATOR = __webpack_require__(1)('iterator'); +var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` +var FF_ITERATOR = '@@iterator'; +var KEYS = 'keys'; +var VALUES = 'values'; + +var returnThis = function () { return this; }; + +module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { + $iterCreate(Constructor, NAME, next); + var getMethod = function (kind) { + if (!BUGGY && kind in proto) return proto[kind]; + switch (kind) { + case KEYS: return function keys() { return new Constructor(this, kind); }; + case VALUES: return function values() { return new Constructor(this, kind); }; + } return function entries() { return new Constructor(this, kind); }; + }; + var TAG = NAME + ' Iterator'; + var DEF_VALUES = DEFAULT == VALUES; + var VALUES_BUG = false; + var proto = Base.prototype; + var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; + var $default = $native || getMethod(DEFAULT); + var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; + var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; + var methods, key, IteratorPrototype; + // Fix native + if ($anyNative) { + IteratorPrototype = getPrototypeOf($anyNative.call(new Base())); + if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { + // Set @@toStringTag to native iterators + setToStringTag(IteratorPrototype, TAG, true); + // fix for some old engines + if (!LIBRARY && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis); + } + } + // fix Array#{values, @@iterator}.name in V8 / FF + if (DEF_VALUES && $native && $native.name !== VALUES) { + VALUES_BUG = true; + $default = function values() { return $native.call(this); }; + } + // Define iterator + if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { + hide(proto, ITERATOR, $default); + } + // Plug for library + Iterators[NAME] = $default; + Iterators[TAG] = returnThis; + if (DEFAULT) { + methods = { + values: DEF_VALUES ? $default : getMethod(VALUES), + keys: IS_SET ? $default : getMethod(KEYS), + entries: $entries + }; + if (FORCED) for (key in methods) { + if (!(key in proto)) redefine(proto, key, methods[key]); + } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); + } + return methods; +}; + + +/***/ }), +/* 31 */ +/***/ (function(module, exports) { + +module.exports = false; + + +/***/ }), +/* 32 */ +/***/ (function(module, exports, __webpack_require__) { + +var global = __webpack_require__(2); +var core = __webpack_require__(11); +var hide = __webpack_require__(6); +var redefine = __webpack_require__(7); +var ctx = __webpack_require__(16); +var PROTOTYPE = 'prototype'; + +var $export = function (type, name, source) { + var IS_FORCED = type & $export.F; + var IS_GLOBAL = type & $export.G; + var IS_STATIC = type & $export.S; + var IS_PROTO = type & $export.P; + var IS_BIND = type & $export.B; + var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]; + var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); + var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}); + var key, own, out, exp; + if (IS_GLOBAL) source = name; + for (key in source) { + // contains in native + own = !IS_FORCED && target && target[key] !== undefined; + // export native or passed + out = (own ? target : source)[key]; + // bind timers to global for call from export context + exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; + // extend global + if (target) redefine(target, key, out, type & $export.U); + // export + if (exports[key] != out) hide(exports, key, exp); + if (IS_PROTO && expProto[key] != out) expProto[key] = out; + } +}; +global.core = core; +// type bitmap +$export.F = 1; // forced +$export.G = 2; // global +$export.S = 4; // static +$export.P = 8; // proto +$export.B = 16; // bind +$export.W = 32; // wrap +$export.U = 64; // safe +$export.R = 128; // real proto method for `library` +module.exports = $export; + + +/***/ }), +/* 33 */ +/***/ (function(module, exports, __webpack_require__) { + +// 19.1.2.14 / 15.2.3.14 Object.keys(O) +var $keys = __webpack_require__(58); +var enumBugKeys = __webpack_require__(35); + +module.exports = Object.keys || function keys(O) { + return $keys(O, enumBugKeys); +}; + + +/***/ }), +/* 34 */ +/***/ (function(module, exports, __webpack_require__) { + +// 7.1.15 ToLength +var toInteger = __webpack_require__(22); +var min = Math.min; +module.exports = function (it) { + return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 +}; + + +/***/ }), +/* 35 */ +/***/ (function(module, exports) { + +// IE 8- don't enum bug keys +module.exports = ( + 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' +).split(','); + + +/***/ }), +/* 36 */ +/***/ (function(module, exports, __webpack_require__) { + +var document = __webpack_require__(2).document; +module.exports = document && document.documentElement; + + +/***/ }), +/* 37 */ +/***/ (function(module, exports, __webpack_require__) { + +var ctx = __webpack_require__(16); +var invoke = __webpack_require__(75); +var html = __webpack_require__(36); +var cel = __webpack_require__(21); +var global = __webpack_require__(2); +var process = global.process; +var setTask = global.setImmediate; +var clearTask = global.clearImmediate; +var MessageChannel = global.MessageChannel; +var Dispatch = global.Dispatch; +var counter = 0; +var queue = {}; +var ONREADYSTATECHANGE = 'onreadystatechange'; +var defer, channel, port; +var run = function () { + var id = +this; + // eslint-disable-next-line no-prototype-builtins + if (queue.hasOwnProperty(id)) { + var fn = queue[id]; + delete queue[id]; + fn(); + } +}; +var listener = function (event) { + run.call(event.data); +}; +// Node.js 0.9+ & IE10+ has setImmediate, otherwise: +if (!setTask || !clearTask) { + setTask = function setImmediate(fn) { + var args = []; + var i = 1; + while (arguments.length > i) args.push(arguments[i++]); + queue[++counter] = function () { + // eslint-disable-next-line no-new-func + invoke(typeof fn == 'function' ? fn : Function(fn), args); + }; + defer(counter); + return counter; + }; + clearTask = function clearImmediate(id) { + delete queue[id]; + }; + // Node.js 0.8- + if (__webpack_require__(14)(process) == 'process') { + defer = function (id) { + process.nextTick(ctx(run, id, 1)); + }; + // Sphere (JS game engine) Dispatch API + } else if (Dispatch && Dispatch.now) { + defer = function (id) { + Dispatch.now(ctx(run, id, 1)); + }; + // Browsers with MessageChannel, includes WebWorkers + } else if (MessageChannel) { + channel = new MessageChannel(); + port = channel.port2; + channel.port1.onmessage = listener; + defer = ctx(port.postMessage, port, 1); + // Browsers with postMessage, skip WebWorkers + // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' + } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) { + defer = function (id) { + global.postMessage(id + '', '*'); + }; + global.addEventListener('message', listener, false); + // IE8- + } else if (ONREADYSTATECHANGE in cel('script')) { + defer = function (id) { + html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () { + html.removeChild(this); + run.call(id); + }; + }; + // Rest old browsers + } else { + defer = function (id) { + setTimeout(ctx(run, id, 1), 0); + }; + } +} +module.exports = { + set: setTask, + clear: clearTask +}; + + +/***/ }), +/* 38 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +// 25.4.1.5 NewPromiseCapability(C) +var aFunction = __webpack_require__(17); + +function PromiseCapability(C) { + var resolve, reject; + this.promise = new C(function ($$resolve, $$reject) { + if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor'); + resolve = $$resolve; + reject = $$reject; + }); + this.resolve = aFunction(resolve); + this.reject = aFunction(reject); +} + +module.exports.f = function (C) { + return new PromiseCapability(C); +}; + + +/***/ }), +/* 39 */, +/* 40 */, +/* 41 */, +/* 42 */, +/* 43 */, +/* 44 */, +/* 45 */, +/* 46 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(global) { + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +var FileUploader = __webpack_require__(47), + Feedback = __webpack_require__(3), + Report = __webpack_require__(4), + Import = __webpack_require__(13); + +jQuery(document).ready(function ($) { + 'use strict'; + + var uploader = new FileUploader(); + uploader.init(); + + // Expands/Collapses Import from + $('.ai1wm-expandable > div.ai1wm-button-main').on('click', function () { + $(this).parent().toggleClass('ai1wm-open'); + }); +}); + +global.Ai1wm = jQuery.extend({}, global.Ai1wm, { FileUploader: FileUploader, Feedback: Feedback, Report: Report, Import: Import }); +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) + +/***/ }), +/* 47 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(fetch) { + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +var Import = __webpack_require__(13), + $ = jQuery; + +var FileUploader = function FileUploader() {}; + +FileUploader.prototype.setDefaultValues = function () { + this.model = new Import(); + this.stopUpload = false; +}; + +FileUploader.prototype.init = function () { + var _this = this; + + var formElement = $('#ai1wm-import-form'); + var selectElement = $('#ai1wm-import-file'); + var dropElement = $('#ai1wm-drag-drop-area'); + + selectElement.on('change', function (e) { + _this.setDefaultValues(); + + var file = e.target.files.item(0); + if (file) { + _this.fileSize = file.size; + + try { + _this.onFilesAdded(file); + _this.onBeforeUpload(file); + _this.upload(file); + } catch (error) { + _this.onError(error); + } + } + + formElement.trigger('reset'); + e.preventDefault(); + }); + + dropElement.on('dragenter', function (e) { + dropElement.addClass('ai1wm-drag-over'); + e.preventDefault(); + }); + + dropElement.on('dragover', function (e) { + dropElement.addClass('ai1wm-drag-over'); + e.preventDefault(); + }); + + dropElement.on('dragleave', function (e) { + dropElement.removeClass('ai1wm-drag-over'); + e.preventDefault(); + }); + + dropElement.on('drop', function (e) { + _this.setDefaultValues(); + dropElement.removeClass('ai1wm-drag-over'); + + var file = e.originalEvent.dataTransfer.files.item(0); + if (file) { + _this.fileSize = file.size; + + try { + _this.onFilesAdded(file); + _this.onBeforeUpload(file); + _this.upload(file); + } catch (error) { + _this.onError(error); + } + } + + formElement.trigger('reset'); + e.preventDefault(); + }); +}; + +FileUploader.prototype.upload = function (file, retries) { + var _this2 = this; + + var retries = retries || 0; + + var chunkSize = file.size > ai1wm_uploader.chunk_size ? ai1wm_uploader.chunk_size : file.size; + var formData = this.getFormData(file, chunkSize); + + fetch(ai1wm_uploader.url, { + method: 'POST', + credentials: 'include', + body: formData + }).then(function (response) { + if (_this2.stopUpload) { + return; + } + + switch (response.status) { + case 413: + ai1wm_uploader.chunk_size = chunkSize / 2; + return _this2.upload(file); + case 200: + return response.text().then(function (text) { + var extractedJsonText = Ai1wm.Util.json(text); + if (extractedJsonText) { + var json = JSON.parse(extractedJsonText); + if (json.errors.length === 0) { + file = file.slice(chunkSize, file.size, 'application/octet-binary'); + var uploadedBytes = _this2.fileSize - file.size; + var progress = uploadedBytes / _this2.fileSize * 100; + _this2.onUploadProgress(progress.toFixed(2)); + return progress === 100 ? _this2.onFileUploaded() : _this2.upload(file); + } + } + + throw new Error(text); + }); + default: + throw new Error(response.status); + } + }).catch(function (error) { + var timeout = retries * 1000; + if (retries >= 30) { + return _this2.onError(new Error(ai1wm_locale.problem_while_uploading_your_file)); + } + + retries++; + + setTimeout(_this2.upload.bind(_this2, file, retries), timeout); + }); +}; + +FileUploader.prototype.getFormData = function (file, chunkSize) { + var params = ai1wm_uploader.params; + + var formData = new FormData(); + formData.append('upload-file', file.slice(0, chunkSize, 'application/octet-binary')); + + for (var name in params) { + formData.append(name, params[name]); + } + + return formData; +}; + +FileUploader.prototype.checkSize = function (file) { + var size = parseInt(ai1wm_uploader.filters.ai1wm_archive_size, 10); + + if (file.size > size && size !== 0) { + throw new Error(ai1wm_locale.invalid_archive_size); + } +}; + +FileUploader.prototype.checkExtension = function (file) { + var extensions = ai1wm_uploader.filters.ai1wm_archive_extension; + + var matchExtension = extensions.some(function (extension) { + return file.name.substr(-extension.length) === extension; + }); + + if (!matchExtension) { + throw new Error(ai1wm_locale.invalid_archive_extension); + } +}; + +FileUploader.prototype.onFilesAdded = function (file) { + this.checkExtension(file); + this.checkSize(file); + + // Initializing beforeunload event + $(window).bind('beforeunload', function () { + return ai1wm_locale.stop_importing_your_website; + }); +}; + +FileUploader.prototype.onBeforeUpload = function (file) { + var self = this; + + var storage = Ai1wm.Util.random(12); + var options = Ai1wm.Util.form('#ai1wm-import-form').concat({ name: 'storage', value: storage }).concat({ name: 'archive', value: file.name }); + + // Set global params + this.model.setParams(options); + + // Set multipart params + $.extend(ai1wm_uploader.params, { + storage: storage, + archive: file.name + }); + + // Set stop + this.model.onStop = function () { + self.stopUpload = true; + + // Clean storage + self.model.clean(); + }; + + // Set status + this.model.setStatus({ type: 'progress', percent: '0.00' }); +}; + +FileUploader.prototype.onUploadProgress = function (percent) { + this.model.setStatus({ type: 'progress', percent: percent }); +}; + +FileUploader.prototype.onFileUploaded = function () { + this.model.start(); +}; + +FileUploader.prototype.onError = function (error) { + this.model.setStatus({ type: 'error', title: ai1wm_locale.unable_to_import, message: error.message }); +}; + +module.exports = FileUploader; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(48))) + +/***/ }), +/* 48 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(global, Promise) {/*** IMPORTS FROM imports-loader ***/ +(function() { + +(function(self) { + 'use strict'; + + if (self.fetch) { + return + } + + var support = { + searchParams: 'URLSearchParams' in self, + iterable: 'Symbol' in self && 'iterator' in Symbol, + blob: 'FileReader' in self && 'Blob' in self && (function() { + try { + new Blob() + return true + } catch(e) { + return false + } + })(), + formData: 'FormData' in self, + arrayBuffer: 'ArrayBuffer' in self + } + + if (support.arrayBuffer) { + var viewClasses = [ + '[object Int8Array]', + '[object Uint8Array]', + '[object Uint8ClampedArray]', + '[object Int16Array]', + '[object Uint16Array]', + '[object Int32Array]', + '[object Uint32Array]', + '[object Float32Array]', + '[object Float64Array]' + ] + + var isDataView = function(obj) { + return obj && DataView.prototype.isPrototypeOf(obj) + } + + var isArrayBufferView = ArrayBuffer.isView || function(obj) { + return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1 + } + } + + function normalizeName(name) { + if (typeof name !== 'string') { + name = String(name) + } + if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) { + throw new TypeError('Invalid character in header field name') + } + return name.toLowerCase() + } + + function normalizeValue(value) { + if (typeof value !== 'string') { + value = String(value) + } + return value + } + + // Build a destructive iterator for the value list + function iteratorFor(items) { + var iterator = { + next: function() { + var value = items.shift() + return {done: value === undefined, value: value} + } + } + + if (support.iterable) { + iterator[Symbol.iterator] = function() { + return iterator + } + } + + return iterator + } + + function Headers(headers) { + this.map = {} + + if (headers instanceof Headers) { + headers.forEach(function(value, name) { + this.append(name, value) + }, this) + } else if (Array.isArray(headers)) { + headers.forEach(function(header) { + this.append(header[0], header[1]) + }, this) + } else if (headers) { + Object.getOwnPropertyNames(headers).forEach(function(name) { + this.append(name, headers[name]) + }, this) + } + } + + Headers.prototype.append = function(name, value) { + name = normalizeName(name) + value = normalizeValue(value) + var oldValue = this.map[name] + this.map[name] = oldValue ? oldValue+','+value : value + } + + Headers.prototype['delete'] = function(name) { + delete this.map[normalizeName(name)] + } + + Headers.prototype.get = function(name) { + name = normalizeName(name) + return this.has(name) ? this.map[name] : null + } + + Headers.prototype.has = function(name) { + return this.map.hasOwnProperty(normalizeName(name)) + } + + Headers.prototype.set = function(name, value) { + this.map[normalizeName(name)] = normalizeValue(value) + } + + Headers.prototype.forEach = function(callback, thisArg) { + for (var name in this.map) { + if (this.map.hasOwnProperty(name)) { + callback.call(thisArg, this.map[name], name, this) + } + } + } + + Headers.prototype.keys = function() { + var items = [] + this.forEach(function(value, name) { items.push(name) }) + return iteratorFor(items) + } + + Headers.prototype.values = function() { + var items = [] + this.forEach(function(value) { items.push(value) }) + return iteratorFor(items) + } + + Headers.prototype.entries = function() { + var items = [] + this.forEach(function(value, name) { items.push([name, value]) }) + return iteratorFor(items) + } + + if (support.iterable) { + Headers.prototype[Symbol.iterator] = Headers.prototype.entries + } + + function consumed(body) { + if (body.bodyUsed) { + return Promise.reject(new TypeError('Already read')) + } + body.bodyUsed = true + } + + function fileReaderReady(reader) { + return new Promise(function(resolve, reject) { + reader.onload = function() { + resolve(reader.result) + } + reader.onerror = function() { + reject(reader.error) + } + }) + } + + function readBlobAsArrayBuffer(blob) { + var reader = new FileReader() + var promise = fileReaderReady(reader) + reader.readAsArrayBuffer(blob) + return promise + } + + function readBlobAsText(blob) { + var reader = new FileReader() + var promise = fileReaderReady(reader) + reader.readAsText(blob) + return promise + } + + function readArrayBufferAsText(buf) { + var view = new Uint8Array(buf) + var chars = new Array(view.length) + + for (var i = 0; i < view.length; i++) { + chars[i] = String.fromCharCode(view[i]) + } + return chars.join('') + } + + function bufferClone(buf) { + if (buf.slice) { + return buf.slice(0) + } else { + var view = new Uint8Array(buf.byteLength) + view.set(new Uint8Array(buf)) + return view.buffer + } + } + + function Body() { + this.bodyUsed = false + + this._initBody = function(body) { + this._bodyInit = body + if (!body) { + this._bodyText = '' + } else if (typeof body === 'string') { + this._bodyText = body + } else if (support.blob && Blob.prototype.isPrototypeOf(body)) { + this._bodyBlob = body + } else if (support.formData && FormData.prototype.isPrototypeOf(body)) { + this._bodyFormData = body + } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { + this._bodyText = body.toString() + } else if (support.arrayBuffer && support.blob && isDataView(body)) { + this._bodyArrayBuffer = bufferClone(body.buffer) + // IE 10-11 can't handle a DataView body. + this._bodyInit = new Blob([this._bodyArrayBuffer]) + } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { + this._bodyArrayBuffer = bufferClone(body) + } else { + throw new Error('unsupported BodyInit type') + } + + if (!this.headers.get('content-type')) { + if (typeof body === 'string') { + this.headers.set('content-type', 'text/plain;charset=UTF-8') + } else if (this._bodyBlob && this._bodyBlob.type) { + this.headers.set('content-type', this._bodyBlob.type) + } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { + this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8') + } + } + } + + if (support.blob) { + this.blob = function() { + var rejected = consumed(this) + if (rejected) { + return rejected + } + + if (this._bodyBlob) { + return Promise.resolve(this._bodyBlob) + } else if (this._bodyArrayBuffer) { + return Promise.resolve(new Blob([this._bodyArrayBuffer])) + } else if (this._bodyFormData) { + throw new Error('could not read FormData body as blob') + } else { + return Promise.resolve(new Blob([this._bodyText])) + } + } + + this.arrayBuffer = function() { + if (this._bodyArrayBuffer) { + return consumed(this) || Promise.resolve(this._bodyArrayBuffer) + } else { + return this.blob().then(readBlobAsArrayBuffer) + } + } + } + + this.text = function() { + var rejected = consumed(this) + if (rejected) { + return rejected + } + + if (this._bodyBlob) { + return readBlobAsText(this._bodyBlob) + } else if (this._bodyArrayBuffer) { + return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer)) + } else if (this._bodyFormData) { + throw new Error('could not read FormData body as text') + } else { + return Promise.resolve(this._bodyText) + } + } + + if (support.formData) { + this.formData = function() { + return this.text().then(decode) + } + } + + this.json = function() { + return this.text().then(JSON.parse) + } + + return this + } + + // HTTP methods whose capitalization should be normalized + var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'] + + function normalizeMethod(method) { + var upcased = method.toUpperCase() + return (methods.indexOf(upcased) > -1) ? upcased : method + } + + function Request(input, options) { + options = options || {} + var body = options.body + + if (input instanceof Request) { + if (input.bodyUsed) { + throw new TypeError('Already read') + } + this.url = input.url + this.credentials = input.credentials + if (!options.headers) { + this.headers = new Headers(input.headers) + } + this.method = input.method + this.mode = input.mode + if (!body && input._bodyInit != null) { + body = input._bodyInit + input.bodyUsed = true + } + } else { + this.url = String(input) + } + + this.credentials = options.credentials || this.credentials || 'omit' + if (options.headers || !this.headers) { + this.headers = new Headers(options.headers) + } + this.method = normalizeMethod(options.method || this.method || 'GET') + this.mode = options.mode || this.mode || null + this.referrer = null + + if ((this.method === 'GET' || this.method === 'HEAD') && body) { + throw new TypeError('Body not allowed for GET or HEAD requests') + } + this._initBody(body) + } + + Request.prototype.clone = function() { + return new Request(this, { body: this._bodyInit }) + } + + function decode(body) { + var form = new FormData() + body.trim().split('&').forEach(function(bytes) { + if (bytes) { + var split = bytes.split('=') + var name = split.shift().replace(/\+/g, ' ') + var value = split.join('=').replace(/\+/g, ' ') + form.append(decodeURIComponent(name), decodeURIComponent(value)) + } + }) + return form + } + + function parseHeaders(rawHeaders) { + var headers = new Headers() + rawHeaders.split(/\r?\n/).forEach(function(line) { + var parts = line.split(':') + var key = parts.shift().trim() + if (key) { + var value = parts.join(':').trim() + headers.append(key, value) + } + }) + return headers + } + + Body.call(Request.prototype) + + function Response(bodyInit, options) { + if (!options) { + options = {} + } + + this.type = 'default' + this.status = 'status' in options ? options.status : 200 + this.ok = this.status >= 200 && this.status < 300 + this.statusText = 'statusText' in options ? options.statusText : 'OK' + this.headers = new Headers(options.headers) + this.url = options.url || '' + this._initBody(bodyInit) + } + + Body.call(Response.prototype) + + Response.prototype.clone = function() { + return new Response(this._bodyInit, { + status: this.status, + statusText: this.statusText, + headers: new Headers(this.headers), + url: this.url + }) + } + + Response.error = function() { + var response = new Response(null, {status: 0, statusText: ''}) + response.type = 'error' + return response + } + + var redirectStatuses = [301, 302, 303, 307, 308] + + Response.redirect = function(url, status) { + if (redirectStatuses.indexOf(status) === -1) { + throw new RangeError('Invalid status code') + } + + return new Response(null, {status: status, headers: {location: url}}) + } + + self.Headers = Headers + self.Request = Request + self.Response = Response + + self.fetch = function(input, init) { + return new Promise(function(resolve, reject) { + var request = new Request(input, init) + var xhr = new XMLHttpRequest() + + xhr.onload = function() { + var options = { + status: xhr.status, + statusText: xhr.statusText, + headers: parseHeaders(xhr.getAllResponseHeaders() || '') + } + options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL') + var body = 'response' in xhr ? xhr.response : xhr.responseText + resolve(new Response(body, options)) + } + + xhr.onerror = function() { + reject(new TypeError('Network request failed')) + } + + xhr.ontimeout = function() { + reject(new TypeError('Network request failed')) + } + + xhr.open(request.method, request.url, true) + + if (request.credentials === 'include') { + xhr.withCredentials = true + } + + if ('responseType' in xhr && support.blob) { + xhr.responseType = 'blob' + } + + request.headers.forEach(function(value, name) { + xhr.setRequestHeader(name, value) + }) + + xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit) + }) + } + self.fetch.polyfill = true +})(typeof self !== 'undefined' ? self : this); + + +/*** EXPORTS FROM exports-loader ***/ +module.exports = global.fetch; +}.call(global)); +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0), __webpack_require__(49))) + +/***/ }), +/* 49 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(global) {/*** IMPORTS FROM imports-loader ***/ +(function() { + +__webpack_require__(50); +__webpack_require__(53); +__webpack_require__(64); +__webpack_require__(68); +module.exports = __webpack_require__(11).Promise; + + +/*** EXPORTS FROM exports-loader ***/ +module.exports = global.Promise; +}.call(global)); +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) + +/***/ }), +/* 50 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +// 19.1.3.6 Object.prototype.toString() +var classof = __webpack_require__(19); +var test = {}; +test[__webpack_require__(1)('toStringTag')] = 'z'; +if (test + '' != '[object z]') { + __webpack_require__(7)(Object.prototype, 'toString', function toString() { + return '[object ' + classof(this) + ']'; + }, true); +} + + +/***/ }), +/* 51 */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = !__webpack_require__(9) && !__webpack_require__(28)(function () { + return Object.defineProperty(__webpack_require__(21)('div'), 'a', { get: function () { return 7; } }).a != 7; +}); + + +/***/ }), +/* 52 */ +/***/ (function(module, exports, __webpack_require__) { + +// 7.1.1 ToPrimitive(input [, PreferredType]) +var isObject = __webpack_require__(8); +// instead of the ES6 spec version, we didn't implement @@toPrimitive case +// and the second argument - flag - preferred type is a string +module.exports = function (it, S) { + if (!isObject(it)) return it; + var fn, val; + if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; + if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; + if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; + throw TypeError("Can't convert object to primitive value"); +}; + + +/***/ }), +/* 53 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var $at = __webpack_require__(54)(true); + +// 21.1.3.27 String.prototype[@@iterator]() +__webpack_require__(30)(String, 'String', function (iterated) { + this._t = String(iterated); // target + this._i = 0; // next index +// 21.1.5.2.1 %StringIteratorPrototype%.next() +}, function () { + var O = this._t; + var index = this._i; + var point; + if (index >= O.length) return { value: undefined, done: true }; + point = $at(O, index); + this._i += point.length; + return { value: point, done: false }; +}); + + +/***/ }), +/* 54 */ +/***/ (function(module, exports, __webpack_require__) { + +var toInteger = __webpack_require__(22); +var defined = __webpack_require__(23); +// true -> String#at +// false -> String#codePointAt +module.exports = function (TO_STRING) { + return function (that, pos) { + var s = String(defined(that)); + var i = toInteger(pos); + var l = s.length; + var a, b; + if (i < 0 || i >= l) return TO_STRING ? '' : undefined; + a = s.charCodeAt(i); + return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff + ? TO_STRING ? s.charAt(i) : a + : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; + }; +}; + + +/***/ }), +/* 55 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var create = __webpack_require__(56); +var descriptor = __webpack_require__(29); +var setToStringTag = __webpack_require__(26); +var IteratorPrototype = {}; + +// 25.1.2.1.1 %IteratorPrototype%[@@iterator]() +__webpack_require__(6)(IteratorPrototype, __webpack_require__(1)('iterator'), function () { return this; }); + +module.exports = function (Constructor, NAME, next) { + Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) }); + setToStringTag(Constructor, NAME + ' Iterator'); +}; + + +/***/ }), +/* 56 */ +/***/ (function(module, exports, __webpack_require__) { + +// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) +var anObject = __webpack_require__(5); +var dPs = __webpack_require__(57); +var enumBugKeys = __webpack_require__(35); +var IE_PROTO = __webpack_require__(25)('IE_PROTO'); +var Empty = function () { /* empty */ }; +var PROTOTYPE = 'prototype'; + +// Create object with fake `null` prototype: use iframe Object with cleared prototype +var createDict = function () { + // Thrash, waste and sodomy: IE GC bug + var iframe = __webpack_require__(21)('iframe'); + var i = enumBugKeys.length; + var lt = '<'; + var gt = '>'; + var iframeDocument; + iframe.style.display = 'none'; + __webpack_require__(36).appendChild(iframe); + iframe.src = 'javascript:'; // eslint-disable-line no-script-url + // createDict = iframe.contentWindow.Object; + // html.removeChild(iframe); + iframeDocument = iframe.contentWindow.document; + iframeDocument.open(); + iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); + iframeDocument.close(); + createDict = iframeDocument.F; + while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]]; + return createDict(); +}; + +module.exports = Object.create || function create(O, Properties) { + var result; + if (O !== null) { + Empty[PROTOTYPE] = anObject(O); + result = new Empty(); + Empty[PROTOTYPE] = null; + // add "__proto__" for Object.getPrototypeOf polyfill + result[IE_PROTO] = O; + } else result = createDict(); + return Properties === undefined ? result : dPs(result, Properties); +}; + + +/***/ }), +/* 57 */ +/***/ (function(module, exports, __webpack_require__) { + +var dP = __webpack_require__(15); +var anObject = __webpack_require__(5); +var getKeys = __webpack_require__(33); + +module.exports = __webpack_require__(9) ? Object.defineProperties : function defineProperties(O, Properties) { + anObject(O); + var keys = getKeys(Properties); + var length = keys.length; + var i = 0; + var P; + while (length > i) dP.f(O, P = keys[i++], Properties[P]); + return O; +}; + + +/***/ }), +/* 58 */ +/***/ (function(module, exports, __webpack_require__) { + +var has = __webpack_require__(10); +var toIObject = __webpack_require__(24); +var arrayIndexOf = __webpack_require__(60)(false); +var IE_PROTO = __webpack_require__(25)('IE_PROTO'); + +module.exports = function (object, names) { + var O = toIObject(object); + var i = 0; + var result = []; + var key; + for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key); + // Don't enum bug & hidden keys + while (names.length > i) if (has(O, key = names[i++])) { + ~arrayIndexOf(result, key) || result.push(key); + } + return result; +}; + + +/***/ }), +/* 59 */ +/***/ (function(module, exports, __webpack_require__) { + +// fallback for non-array-like ES3 and non-enumerable old V8 strings +var cof = __webpack_require__(14); +// eslint-disable-next-line no-prototype-builtins +module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { + return cof(it) == 'String' ? it.split('') : Object(it); +}; + + +/***/ }), +/* 60 */ +/***/ (function(module, exports, __webpack_require__) { + +// false -> Array#indexOf +// true -> Array#includes +var toIObject = __webpack_require__(24); +var toLength = __webpack_require__(34); +var toAbsoluteIndex = __webpack_require__(61); +module.exports = function (IS_INCLUDES) { + return function ($this, el, fromIndex) { + var O = toIObject($this); + var length = toLength(O.length); + var index = toAbsoluteIndex(fromIndex, length); + var value; + // Array#includes uses SameValueZero equality algorithm + // eslint-disable-next-line no-self-compare + if (IS_INCLUDES && el != el) while (length > index) { + value = O[index++]; + // eslint-disable-next-line no-self-compare + if (value != value) return true; + // Array#indexOf ignores holes, Array#includes - not + } else for (;length > index; index++) if (IS_INCLUDES || index in O) { + if (O[index] === el) return IS_INCLUDES || index || 0; + } return !IS_INCLUDES && -1; + }; +}; + + +/***/ }), +/* 61 */ +/***/ (function(module, exports, __webpack_require__) { + +var toInteger = __webpack_require__(22); +var max = Math.max; +var min = Math.min; +module.exports = function (index, length) { + index = toInteger(index); + return index < 0 ? max(index + length, 0) : min(index, length); +}; + + +/***/ }), +/* 62 */ +/***/ (function(module, exports, __webpack_require__) { + +// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) +var has = __webpack_require__(10); +var toObject = __webpack_require__(63); +var IE_PROTO = __webpack_require__(25)('IE_PROTO'); +var ObjectProto = Object.prototype; + +module.exports = Object.getPrototypeOf || function (O) { + O = toObject(O); + if (has(O, IE_PROTO)) return O[IE_PROTO]; + if (typeof O.constructor == 'function' && O instanceof O.constructor) { + return O.constructor.prototype; + } return O instanceof Object ? ObjectProto : null; +}; + + +/***/ }), +/* 63 */ +/***/ (function(module, exports, __webpack_require__) { + +// 7.1.13 ToObject(argument) +var defined = __webpack_require__(23); +module.exports = function (it) { + return Object(defined(it)); +}; + + +/***/ }), +/* 64 */ +/***/ (function(module, exports, __webpack_require__) { + +var $iterators = __webpack_require__(65); +var getKeys = __webpack_require__(33); +var redefine = __webpack_require__(7); +var global = __webpack_require__(2); +var hide = __webpack_require__(6); +var Iterators = __webpack_require__(12); +var wks = __webpack_require__(1); +var ITERATOR = wks('iterator'); +var TO_STRING_TAG = wks('toStringTag'); +var ArrayValues = Iterators.Array; + +var DOMIterables = { + CSSRuleList: true, // TODO: Not spec compliant, should be false. + CSSStyleDeclaration: false, + CSSValueList: false, + ClientRectList: false, + DOMRectList: false, + DOMStringList: false, + DOMTokenList: true, + DataTransferItemList: false, + FileList: false, + HTMLAllCollection: false, + HTMLCollection: false, + HTMLFormElement: false, + HTMLSelectElement: false, + MediaList: true, // TODO: Not spec compliant, should be false. + MimeTypeArray: false, + NamedNodeMap: false, + NodeList: true, + PaintRequestList: false, + Plugin: false, + PluginArray: false, + SVGLengthList: false, + SVGNumberList: false, + SVGPathSegList: false, + SVGPointList: false, + SVGStringList: false, + SVGTransformList: false, + SourceBufferList: false, + StyleSheetList: true, // TODO: Not spec compliant, should be false. + TextTrackCueList: false, + TextTrackList: false, + TouchList: false +}; + +for (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) { + var NAME = collections[i]; + var explicit = DOMIterables[NAME]; + var Collection = global[NAME]; + var proto = Collection && Collection.prototype; + var key; + if (proto) { + if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues); + if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME); + Iterators[NAME] = ArrayValues; + if (explicit) for (key in $iterators) if (!proto[key]) redefine(proto, key, $iterators[key], true); + } +} + + +/***/ }), +/* 65 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var addToUnscopables = __webpack_require__(66); +var step = __webpack_require__(67); +var Iterators = __webpack_require__(12); +var toIObject = __webpack_require__(24); + +// 22.1.3.4 Array.prototype.entries() +// 22.1.3.13 Array.prototype.keys() +// 22.1.3.29 Array.prototype.values() +// 22.1.3.30 Array.prototype[@@iterator]() +module.exports = __webpack_require__(30)(Array, 'Array', function (iterated, kind) { + this._t = toIObject(iterated); // target + this._i = 0; // next index + this._k = kind; // kind +// 22.1.5.2.1 %ArrayIteratorPrototype%.next() +}, function () { + var O = this._t; + var kind = this._k; + var index = this._i++; + if (!O || index >= O.length) { + this._t = undefined; + return step(1); + } + if (kind == 'keys') return step(0, index); + if (kind == 'values') return step(0, O[index]); + return step(0, [index, O[index]]); +}, 'values'); + +// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) +Iterators.Arguments = Iterators.Array; + +addToUnscopables('keys'); +addToUnscopables('values'); +addToUnscopables('entries'); + + +/***/ }), +/* 66 */ +/***/ (function(module, exports, __webpack_require__) { + +// 22.1.3.31 Array.prototype[@@unscopables] +var UNSCOPABLES = __webpack_require__(1)('unscopables'); +var ArrayProto = Array.prototype; +if (ArrayProto[UNSCOPABLES] == undefined) __webpack_require__(6)(ArrayProto, UNSCOPABLES, {}); +module.exports = function (key) { + ArrayProto[UNSCOPABLES][key] = true; +}; + + +/***/ }), +/* 67 */ +/***/ (function(module, exports) { + +module.exports = function (done, value) { + return { value: value, done: !!done }; +}; + + +/***/ }), +/* 68 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var LIBRARY = __webpack_require__(31); +var global = __webpack_require__(2); +var ctx = __webpack_require__(16); +var classof = __webpack_require__(19); +var $export = __webpack_require__(32); +var isObject = __webpack_require__(8); +var aFunction = __webpack_require__(17); +var anInstance = __webpack_require__(69); +var forOf = __webpack_require__(70); +var speciesConstructor = __webpack_require__(74); +var task = __webpack_require__(37).set; +var microtask = __webpack_require__(76)(); +var newPromiseCapabilityModule = __webpack_require__(38); +var perform = __webpack_require__(77); +var promiseResolve = __webpack_require__(78); +var PROMISE = 'Promise'; +var TypeError = global.TypeError; +var process = global.process; +var $Promise = global[PROMISE]; +var isNode = classof(process) == 'process'; +var empty = function () { /* empty */ }; +var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper; +var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f; + +var USE_NATIVE = !!function () { + try { + // correct subclassing with @@species support + var promise = $Promise.resolve(1); + var FakePromise = (promise.constructor = {})[__webpack_require__(1)('species')] = function (exec) { + exec(empty, empty); + }; + // unhandled rejections tracking support, NodeJS Promise without it fails @@species test + return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise; + } catch (e) { /* empty */ } +}(); + +// helpers +var isThenable = function (it) { + var then; + return isObject(it) && typeof (then = it.then) == 'function' ? then : false; +}; +var notify = function (promise, isReject) { + if (promise._n) return; + promise._n = true; + var chain = promise._c; + microtask(function () { + var value = promise._v; + var ok = promise._s == 1; + var i = 0; + var run = function (reaction) { + var handler = ok ? reaction.ok : reaction.fail; + var resolve = reaction.resolve; + var reject = reaction.reject; + var domain = reaction.domain; + var result, then; + try { + if (handler) { + if (!ok) { + if (promise._h == 2) onHandleUnhandled(promise); + promise._h = 1; + } + if (handler === true) result = value; + else { + if (domain) domain.enter(); + result = handler(value); + if (domain) domain.exit(); + } + if (result === reaction.promise) { + reject(TypeError('Promise-chain cycle')); + } else if (then = isThenable(result)) { + then.call(result, resolve, reject); + } else resolve(result); + } else reject(value); + } catch (e) { + reject(e); + } + }; + while (chain.length > i) run(chain[i++]); // variable length - can't use forEach + promise._c = []; + promise._n = false; + if (isReject && !promise._h) onUnhandled(promise); + }); +}; +var onUnhandled = function (promise) { + task.call(global, function () { + var value = promise._v; + var unhandled = isUnhandled(promise); + var result, handler, console; + if (unhandled) { + result = perform(function () { + if (isNode) { + process.emit('unhandledRejection', value, promise); + } else if (handler = global.onunhandledrejection) { + handler({ promise: promise, reason: value }); + } else if ((console = global.console) && console.error) { + console.error('Unhandled promise rejection', value); + } + }); + // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should + promise._h = isNode || isUnhandled(promise) ? 2 : 1; + } promise._a = undefined; + if (unhandled && result.e) throw result.v; + }); +}; +var isUnhandled = function (promise) { + if (promise._h == 1) return false; + var chain = promise._a || promise._c; + var i = 0; + var reaction; + while (chain.length > i) { + reaction = chain[i++]; + if (reaction.fail || !isUnhandled(reaction.promise)) return false; + } return true; +}; +var onHandleUnhandled = function (promise) { + task.call(global, function () { + var handler; + if (isNode) { + process.emit('rejectionHandled', promise); + } else if (handler = global.onrejectionhandled) { + handler({ promise: promise, reason: promise._v }); + } + }); +}; +var $reject = function (value) { + var promise = this; + if (promise._d) return; + promise._d = true; + promise = promise._w || promise; // unwrap + promise._v = value; + promise._s = 2; + if (!promise._a) promise._a = promise._c.slice(); + notify(promise, true); +}; +var $resolve = function (value) { + var promise = this; + var then; + if (promise._d) return; + promise._d = true; + promise = promise._w || promise; // unwrap + try { + if (promise === value) throw TypeError("Promise can't be resolved itself"); + if (then = isThenable(value)) { + microtask(function () { + var wrapper = { _w: promise, _d: false }; // wrap + try { + then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1)); + } catch (e) { + $reject.call(wrapper, e); + } + }); + } else { + promise._v = value; + promise._s = 1; + notify(promise, false); + } + } catch (e) { + $reject.call({ _w: promise, _d: false }, e); // wrap + } +}; + +// constructor polyfill +if (!USE_NATIVE) { + // 25.4.3.1 Promise(executor) + $Promise = function Promise(executor) { + anInstance(this, $Promise, PROMISE, '_h'); + aFunction(executor); + Internal.call(this); + try { + executor(ctx($resolve, this, 1), ctx($reject, this, 1)); + } catch (err) { + $reject.call(this, err); + } + }; + // eslint-disable-next-line no-unused-vars + Internal = function Promise(executor) { + this._c = []; // <- awaiting reactions + this._a = undefined; // <- checked in isUnhandled reactions + this._s = 0; // <- state + this._d = false; // <- done + this._v = undefined; // <- value + this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled + this._n = false; // <- notify + }; + Internal.prototype = __webpack_require__(79)($Promise.prototype, { + // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) + then: function then(onFulfilled, onRejected) { + var reaction = newPromiseCapability(speciesConstructor(this, $Promise)); + reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; + reaction.fail = typeof onRejected == 'function' && onRejected; + reaction.domain = isNode ? process.domain : undefined; + this._c.push(reaction); + if (this._a) this._a.push(reaction); + if (this._s) notify(this, false); + return reaction.promise; + }, + // 25.4.5.1 Promise.prototype.catch(onRejected) + 'catch': function (onRejected) { + return this.then(undefined, onRejected); + } + }); + OwnPromiseCapability = function () { + var promise = new Internal(); + this.promise = promise; + this.resolve = ctx($resolve, promise, 1); + this.reject = ctx($reject, promise, 1); + }; + newPromiseCapabilityModule.f = newPromiseCapability = function (C) { + return C === $Promise || C === Wrapper + ? new OwnPromiseCapability(C) + : newGenericPromiseCapability(C); + }; +} + +$export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise }); +__webpack_require__(26)($Promise, PROMISE); +__webpack_require__(80)(PROMISE); +Wrapper = __webpack_require__(11)[PROMISE]; + +// statics +$export($export.S + $export.F * !USE_NATIVE, PROMISE, { + // 25.4.4.5 Promise.reject(r) + reject: function reject(r) { + var capability = newPromiseCapability(this); + var $$reject = capability.reject; + $$reject(r); + return capability.promise; + } +}); +$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, { + // 25.4.4.6 Promise.resolve(x) + resolve: function resolve(x) { + return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x); + } +}); +$export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(81)(function (iter) { + $Promise.all(iter)['catch'](empty); +})), PROMISE, { + // 25.4.4.1 Promise.all(iterable) + all: function all(iterable) { + var C = this; + var capability = newPromiseCapability(C); + var resolve = capability.resolve; + var reject = capability.reject; + var result = perform(function () { + var values = []; + var index = 0; + var remaining = 1; + forOf(iterable, false, function (promise) { + var $index = index++; + var alreadyCalled = false; + values.push(undefined); + remaining++; + C.resolve(promise).then(function (value) { + if (alreadyCalled) return; + alreadyCalled = true; + values[$index] = value; + --remaining || resolve(values); + }, reject); + }); + --remaining || resolve(values); + }); + if (result.e) reject(result.v); + return capability.promise; + }, + // 25.4.4.4 Promise.race(iterable) + race: function race(iterable) { + var C = this; + var capability = newPromiseCapability(C); + var reject = capability.reject; + var result = perform(function () { + forOf(iterable, false, function (promise) { + C.resolve(promise).then(capability.resolve, reject); + }); + }); + if (result.e) reject(result.v); + return capability.promise; + } +}); + + +/***/ }), +/* 69 */ +/***/ (function(module, exports) { + +module.exports = function (it, Constructor, name, forbiddenField) { + if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) { + throw TypeError(name + ': incorrect invocation!'); + } return it; +}; + + +/***/ }), +/* 70 */ +/***/ (function(module, exports, __webpack_require__) { + +var ctx = __webpack_require__(16); +var call = __webpack_require__(71); +var isArrayIter = __webpack_require__(72); +var anObject = __webpack_require__(5); +var toLength = __webpack_require__(34); +var getIterFn = __webpack_require__(73); +var BREAK = {}; +var RETURN = {}; +var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) { + var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable); + var f = ctx(fn, that, entries ? 2 : 1); + var index = 0; + var length, step, iterator, result; + if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!'); + // fast case for arrays with default iterator + if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) { + result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); + if (result === BREAK || result === RETURN) return result; + } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) { + result = call(iterator, f, step.value, entries); + if (result === BREAK || result === RETURN) return result; + } +}; +exports.BREAK = BREAK; +exports.RETURN = RETURN; + + +/***/ }), +/* 71 */ +/***/ (function(module, exports, __webpack_require__) { + +// call something on iterator step with safe closing on error +var anObject = __webpack_require__(5); +module.exports = function (iterator, fn, value, entries) { + try { + return entries ? fn(anObject(value)[0], value[1]) : fn(value); + // 7.4.6 IteratorClose(iterator, completion) + } catch (e) { + var ret = iterator['return']; + if (ret !== undefined) anObject(ret.call(iterator)); + throw e; + } +}; + + +/***/ }), +/* 72 */ +/***/ (function(module, exports, __webpack_require__) { + +// check on default Array iterator +var Iterators = __webpack_require__(12); +var ITERATOR = __webpack_require__(1)('iterator'); +var ArrayProto = Array.prototype; + +module.exports = function (it) { + return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); +}; + + +/***/ }), +/* 73 */ +/***/ (function(module, exports, __webpack_require__) { + +var classof = __webpack_require__(19); +var ITERATOR = __webpack_require__(1)('iterator'); +var Iterators = __webpack_require__(12); +module.exports = __webpack_require__(11).getIteratorMethod = function (it) { + if (it != undefined) return it[ITERATOR] + || it['@@iterator'] + || Iterators[classof(it)]; +}; + + +/***/ }), +/* 74 */ +/***/ (function(module, exports, __webpack_require__) { + +// 7.3.20 SpeciesConstructor(O, defaultConstructor) +var anObject = __webpack_require__(5); +var aFunction = __webpack_require__(17); +var SPECIES = __webpack_require__(1)('species'); +module.exports = function (O, D) { + var C = anObject(O).constructor; + var S; + return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S); +}; + + +/***/ }), +/* 75 */ +/***/ (function(module, exports) { + +// fast apply, http://jsperf.lnkit.com/fast-apply/5 +module.exports = function (fn, args, that) { + var un = that === undefined; + switch (args.length) { + case 0: return un ? fn() + : fn.call(that); + case 1: return un ? fn(args[0]) + : fn.call(that, args[0]); + case 2: return un ? fn(args[0], args[1]) + : fn.call(that, args[0], args[1]); + case 3: return un ? fn(args[0], args[1], args[2]) + : fn.call(that, args[0], args[1], args[2]); + case 4: return un ? fn(args[0], args[1], args[2], args[3]) + : fn.call(that, args[0], args[1], args[2], args[3]); + } return fn.apply(that, args); +}; + + +/***/ }), +/* 76 */ +/***/ (function(module, exports, __webpack_require__) { + +var global = __webpack_require__(2); +var macrotask = __webpack_require__(37).set; +var Observer = global.MutationObserver || global.WebKitMutationObserver; +var process = global.process; +var Promise = global.Promise; +var isNode = __webpack_require__(14)(process) == 'process'; + +module.exports = function () { + var head, last, notify; + + var flush = function () { + var parent, fn; + if (isNode && (parent = process.domain)) parent.exit(); + while (head) { + fn = head.fn; + head = head.next; + try { + fn(); + } catch (e) { + if (head) notify(); + else last = undefined; + throw e; + } + } last = undefined; + if (parent) parent.enter(); + }; + + // Node.js + if (isNode) { + notify = function () { + process.nextTick(flush); + }; + // browsers with MutationObserver + } else if (Observer) { + var toggle = true; + var node = document.createTextNode(''); + new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new + notify = function () { + node.data = toggle = !toggle; + }; + // environments with maybe non-completely correct, but existent Promise + } else if (Promise && Promise.resolve) { + var promise = Promise.resolve(); + notify = function () { + promise.then(flush); + }; + // for other environments - macrotask based on: + // - setImmediate + // - MessageChannel + // - window.postMessag + // - onreadystatechange + // - setTimeout + } else { + notify = function () { + // strange IE + webpack dev server bug - use .call(global) + macrotask.call(global, flush); + }; + } + + return function (fn) { + var task = { fn: fn, next: undefined }; + if (last) last.next = task; + if (!head) { + head = task; + notify(); + } last = task; + }; +}; + + +/***/ }), +/* 77 */ +/***/ (function(module, exports) { + +module.exports = function (exec) { + try { + return { e: false, v: exec() }; + } catch (e) { + return { e: true, v: e }; + } +}; + + +/***/ }), +/* 78 */ +/***/ (function(module, exports, __webpack_require__) { + +var anObject = __webpack_require__(5); +var isObject = __webpack_require__(8); +var newPromiseCapability = __webpack_require__(38); + +module.exports = function (C, x) { + anObject(C); + if (isObject(x) && x.constructor === C) return x; + var promiseCapability = newPromiseCapability.f(C); + var resolve = promiseCapability.resolve; + resolve(x); + return promiseCapability.promise; +}; + + +/***/ }), +/* 79 */ +/***/ (function(module, exports, __webpack_require__) { + +var redefine = __webpack_require__(7); +module.exports = function (target, src, safe) { + for (var key in src) redefine(target, key, src[key], safe); + return target; +}; + + +/***/ }), +/* 80 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var global = __webpack_require__(2); +var dP = __webpack_require__(15); +var DESCRIPTORS = __webpack_require__(9); +var SPECIES = __webpack_require__(1)('species'); + +module.exports = function (KEY) { + var C = global[KEY]; + if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, { + configurable: true, + get: function () { return this; } + }); +}; + + +/***/ }), +/* 81 */ +/***/ (function(module, exports, __webpack_require__) { + +var ITERATOR = __webpack_require__(1)('iterator'); +var SAFE_CLOSING = false; + +try { + var riter = [7][ITERATOR](); + riter['return'] = function () { SAFE_CLOSING = true; }; + // eslint-disable-next-line no-throw-literal + Array.from(riter, function () { throw 2; }); +} catch (e) { /* empty */ } + +module.exports = function (exec, skipClosing) { + if (!skipClosing && !SAFE_CLOSING) return false; + var safe = false; + try { + var arr = [7]; + var iter = arr[ITERATOR](); + iter.next = function () { return { done: safe = true }; }; + arr[ITERATOR] = function () { return iter; }; + exec(arr); + } catch (e) { /* empty */ } + return safe; +}; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/lib/view/assets/javascript/report.min.js b/lib/view/assets/javascript/report.min.js new file mode 100644 index 0000000..f07985e --- /dev/null +++ b/lib/view/assets/javascript/report.min.js @@ -0,0 +1,235 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 82); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ 0: +/***/ (function(module, exports) { + +var g; + +// This works in non-strict mode +g = (function() { + return this; +})(); + +try { + // This works if eval is allowed (see CSP) + g = g || Function("return this")() || (1,eval)("this"); +} catch(e) { + // This works if the window reference is available + if(typeof window === "object") + g = window; +} + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + +module.exports = g; + + +/***/ }), + +/***/ 4: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +jQuery(document).ready(function ($) { + 'use strict'; + + $('#ai1wm-report-problem-button').click(function (e) { + $(this).next('.ai1wm-report-problem-dialog').toggleClass('ai1wm-report-active'); + + e.preventDefault(); + }); + + $('#ai1wm-report-cancel').click(function (e) { + $(this).closest('.ai1wm-report-problem-dialog').removeClass('ai1wm-report-active'); + + e.preventDefault(); + }); + + $('#ai1wm-report-submit').click(function (r) { + var self = $(this); + + var spinner = self.next(); + var email = $('.ai1wm-report-email').val(); + var message = $('.ai1wm-report-message').val(); + var terms = $('.ai1wm-report-terms').is(':checked'); + + self.attr('disabled', true); + spinner.css('visibility', 'visible'); + + $.ajax({ + url: ai1wm_report.ajax.url, + type: 'POST', + dataType: 'json', + async: true, + data: { + 'secret_key': ai1wm_report.secret_key, + 'ai1wm_email': email, + 'ai1wm_message': message, + 'ai1wm_terms': +terms + }, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function (data) { + self.attr('disabled', false); + spinner.css('visibility', 'hidden'); + + if (data.errors.length > 0) { + $('.ai1wm-report-problem-dialog .ai1wm-message').remove(); + + var errorMessage = $('
').addClass('ai1wm-message ai1wm-error-message'); + $.each(data.errors, function (key, value) { + errorMessage.append($('

').text(value)); + }); + + $('.ai1wm-report-problem-dialog').prepend(errorMessage); + } else { + var successMessage = $('

').addClass('ai1wm-message ai1wm-success-message'); + successMessage.append($('

').text(ai1wm_locale.thanks_for_submitting_your_request)); + + $('.ai1wm-report-problem-dialog').html(successMessage); + + // Hide message + setTimeout(function () { + $('.ai1wm-report-problem-dialog').removeClass('ai1wm-report-active'); + }, 2000); + } + }); + + e.preventDefault(); + }); +}); + +/***/ }), + +/***/ 82: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(global) { + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +var Report = __webpack_require__(4); + +global.Ai1wm = jQuery.extend({}, global.Ai1wm, { Report: Report }); +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) + +/***/ }) + +/******/ }); \ No newline at end of file diff --git a/lib/view/assets/javascript/updater.min.js b/lib/view/assets/javascript/updater.min.js new file mode 100644 index 0000000..65be1fc --- /dev/null +++ b/lib/view/assets/javascript/updater.min.js @@ -0,0 +1,158 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 83); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ 83: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +jQuery(document).ready(function ($) { + 'use strict'; + + $('.ai1wm-purchase-add').click(function (e) { + var self = $(this); + + self.attr('disabled', true); + + var dialog = self.closest('.ai1wm-modal-dialog'); + var error = dialog.find('.ai1wm-modal-error'); + var index = dialog.attr('id').split('-').pop(); + var purchaseId = dialog.find('.ai1wm-purchase-id').val(); + var updateLink = dialog.find('.ai1wm-update-link').val(); + + // Check Purchase ID + $.ajax({ + url: 'https://servmask.com/purchase/' + purchaseId + '/check', + type: 'GET', + dataType: 'json', + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function (product) { + // Update Purchase ID + $.ajax({ + url: ai1wm_updater.ajax.url, + type: 'POST', + dataType: 'json', + data: { + 'ai1wm_uuid': product.uuid, + 'ai1wm_extension': product.extension + }, + dataFilter: function dataFilter(data, type) { + return Ai1wm.Util.json(data); + } + }).done(function () { + window.location.hash = ''; + + // Update plugin row + $('#ai1wm-update-section-' + index).html($('').attr('href', updateLink).text(ai1wm_locale.check_for_updates)); + + self.attr('disabled', false); + }); + }).fail(function () { + self.attr('disabled', false); + error.html(ai1wm_locale.invalid_purchase_id); + }); + + e.preventDefault(); + }); + + $('.ai1wm-purchase-discard').click(function (e) { + window.location.hash = ''; + + e.preventDefault(); + }); +}); + +/***/ }) + +/******/ }); \ No newline at end of file diff --git a/lib/view/assets/javascript/util.min.js b/lib/view/assets/javascript/util.min.js new file mode 100644 index 0000000..9f18708 --- /dev/null +++ b/lib/view/assets/javascript/util.min.js @@ -0,0 +1,215 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 84); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ 0: +/***/ (function(module, exports) { + +var g; + +// This works in non-strict mode +g = (function() { + return this; +})(); + +try { + // This works if eval is allowed (see CSP) + g = g || Function("return this")() || (1,eval)("this"); +} catch(e) { + // This works if the window reference is available + if(typeof window === "object") + g = window; +} + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + +module.exports = g; + + +/***/ }), + +/***/ 84: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(global) { + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +var Util = __webpack_require__(85); + +global.Ai1wm = jQuery.extend({}, global.Ai1wm, { Util: Util }); +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) + +/***/ }), + +/***/ 85: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (C) 2014-2018 ServMask Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +var $ = jQuery; + +module.exports = { + random: function random(len) { + var text = ''; + var possible = 'abcdefghijklmnopqrstuvwxyz0123456789'; + + for (var i = 0; i < len; i++) { + text += possible.charAt(Math.floor(Math.random() * possible.length)); + } + + return text; + }, + form: function form(id) { + return $(id).serializeArray(); + }, + ucfirst: function ucfirst(text) { + return text.charAt(0).toUpperCase() + text.slice(1); + }, + list: function list(input) { + // Convert object to list + if ($.isPlainObject(input)) { + var result = []; + var params = decodeURIComponent($.param(input)).split('&'); + + // Loop over params + $.each(params, function (index, item) { + var value = item.split('='); + + // Add item + result.push({ name: value[0], value: value[1] }); + }); + + return result; + } + + return input; + }, + json: function json(input) { + if ($.type(input) === 'string') { + var result = input.match(/{[\s\S]+}/); + if (result !== null) { + return result[0]; + } + } + + return false; + } +}; + +/***/ }) + +/******/ }); \ No newline at end of file diff --git a/lib/view/backups/index.php b/lib/view/backups/index.php new file mode 100644 index 0000000..af96e84 --- /dev/null +++ b/lib/view/backups/index.php @@ -0,0 +1,141 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +

+
+
+
+

+ + +

+ + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ Site could not create backups!' . + '

Please make sure that storage directory %s has read and write permissions.

', + AI1WM_PLUGIN_NAME + ), + AI1WM_STORAGE_PATH + ); + ?> +
+ + + + + + +
+
+
+
+
+
+ + + + + +

+ + + +
+
+
+
+
diff --git a/lib/view/common/http-authentication.php b/lib/view/common/http-authentication.php new file mode 100644 index 0000000..7eebdea --- /dev/null +++ b/lib/view/common/http-authentication.php @@ -0,0 +1,24 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ diff --git a/lib/view/common/leave-feedback.php b/lib/view/common/leave-feedback.php new file mode 100644 index 0000000..bc3841a --- /dev/null +++ b/lib/view/common/leave-feedback.php @@ -0,0 +1,77 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + + diff --git a/lib/view/common/maintenance-mode.php b/lib/view/common/maintenance-mode.php new file mode 100644 index 0000000..7eebdea --- /dev/null +++ b/lib/view/common/maintenance-mode.php @@ -0,0 +1,24 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ diff --git a/lib/view/common/report-problem.php b/lib/view/common/report-problem.php new file mode 100644 index 0000000..70122df --- /dev/null +++ b/lib/view/common/report-problem.php @@ -0,0 +1,57 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +
+ +
+
+ +
+
+ +
+
+ +
+
+
+ + + +
+
+
+
+
diff --git a/lib/view/common/share-buttons.php b/lib/view/common/share-buttons.php new file mode 100644 index 0000000..6a087c4 --- /dev/null +++ b/lib/view/common/share-buttons.php @@ -0,0 +1,76 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +
+ + + + diff --git a/lib/view/export/advanced-settings.php b/lib/view/export/advanced-settings.php new file mode 100644 index 0000000..96b5a22 --- /dev/null +++ b/lib/view/export/advanced-settings.php @@ -0,0 +1,117 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +
+
+

+ + + +

+
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • + + +
  • + +
  • + + +
  • + +
  • + +
  • + +
  • + + +
  • + +
  • +
  • + +
  • + + +
  • + +
  • +
  • + +
  • + + +
+
+
diff --git a/lib/view/export/button-azure-storage.php b/lib/view/export/button-azure-storage.php new file mode 100644 index 0000000..d10756a --- /dev/null +++ b/lib/view/export/button-azure-storage.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +Azure Storage diff --git a/lib/view/export/button-b2.php b/lib/view/export/button-b2.php new file mode 100644 index 0000000..8fc55e3 --- /dev/null +++ b/lib/view/export/button-b2.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +Backblaze B2 diff --git a/lib/view/export/button-box.php b/lib/view/export/button-box.php new file mode 100644 index 0000000..51f6fc2 --- /dev/null +++ b/lib/view/export/button-box.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +Box diff --git a/lib/view/export/button-digitalocean.php b/lib/view/export/button-digitalocean.php new file mode 100644 index 0000000..faa12b3 --- /dev/null +++ b/lib/view/export/button-digitalocean.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +DigitalOcean diff --git a/lib/view/export/button-dropbox.php b/lib/view/export/button-dropbox.php new file mode 100644 index 0000000..a84598f --- /dev/null +++ b/lib/view/export/button-dropbox.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +Dropbox diff --git a/lib/view/export/button-file.php b/lib/view/export/button-file.php new file mode 100644 index 0000000..45d0db7 --- /dev/null +++ b/lib/view/export/button-file.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + + diff --git a/lib/view/export/button-ftp.php b/lib/view/export/button-ftp.php new file mode 100644 index 0000000..00f15e1 --- /dev/null +++ b/lib/view/export/button-ftp.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +FTP diff --git a/lib/view/export/button-gcloud-storage.php b/lib/view/export/button-gcloud-storage.php new file mode 100644 index 0000000..513877a --- /dev/null +++ b/lib/view/export/button-gcloud-storage.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +Google Cloud diff --git a/lib/view/export/button-gdrive.php b/lib/view/export/button-gdrive.php new file mode 100644 index 0000000..0f08166 --- /dev/null +++ b/lib/view/export/button-gdrive.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +Google Drive diff --git a/lib/view/export/button-glacier.php b/lib/view/export/button-glacier.php new file mode 100644 index 0000000..1437659 --- /dev/null +++ b/lib/view/export/button-glacier.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +Amazon Glacier diff --git a/lib/view/export/button-mega.php b/lib/view/export/button-mega.php new file mode 100644 index 0000000..518733e --- /dev/null +++ b/lib/view/export/button-mega.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +Mega diff --git a/lib/view/export/button-onedrive.php b/lib/view/export/button-onedrive.php new file mode 100644 index 0000000..18d181e --- /dev/null +++ b/lib/view/export/button-onedrive.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +OneDrive diff --git a/lib/view/export/button-s3.php b/lib/view/export/button-s3.php new file mode 100644 index 0000000..8f0584c --- /dev/null +++ b/lib/view/export/button-s3.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +Amazon S3 diff --git a/lib/view/export/export-buttons.php b/lib/view/export/export-buttons.php new file mode 100644 index 0000000..0f9d7ad --- /dev/null +++ b/lib/view/export/export-buttons.php @@ -0,0 +1,47 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +
+
+
+
+ + + + + + +
+
    + +
  • + +
  • + +
+
+
+
diff --git a/lib/view/export/find-replace.php b/lib/view/export/find-replace.php new file mode 100644 index 0000000..0ba2d1c --- /dev/null +++ b/lib/view/export/find-replace.php @@ -0,0 +1,49 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +
    +
  • +

    + + + ', AI1WM_PLUGIN_NAME ) ); ?> + + ', AI1WM_PLUGIN_NAME ) ); ?> + + + +

    +
    + + +
    +
  • +
+ + diff --git a/lib/view/export/help-section.php b/lib/view/export/help-section.php new file mode 100644 index 0000000..e33b1b4 --- /dev/null +++ b/lib/view/export/help-section.php @@ -0,0 +1,49 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +

+
+ +

+ +

+ +

+ +
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
diff --git a/lib/view/export/index.php b/lib/view/export/index.php new file mode 100644 index 0000000..0a30e07 --- /dev/null +++ b/lib/view/export/index.php @@ -0,0 +1,72 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +
+
+
+
+

+ + +

+ + + +
+ + + + + + + + + + + +
+ + + +
+
+
+
+
+ + + + + +

+ + + +
+
+
+
+
diff --git a/lib/view/import/button-azure-storage.php b/lib/view/import/button-azure-storage.php new file mode 100644 index 0000000..d10756a --- /dev/null +++ b/lib/view/import/button-azure-storage.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +Azure Storage diff --git a/lib/view/import/button-b2.php b/lib/view/import/button-b2.php new file mode 100644 index 0000000..8fc55e3 --- /dev/null +++ b/lib/view/import/button-b2.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +Backblaze B2 diff --git a/lib/view/import/button-box.php b/lib/view/import/button-box.php new file mode 100644 index 0000000..51f6fc2 --- /dev/null +++ b/lib/view/import/button-box.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +Box diff --git a/lib/view/import/button-digitalocean.php b/lib/view/import/button-digitalocean.php new file mode 100644 index 0000000..faa12b3 --- /dev/null +++ b/lib/view/import/button-digitalocean.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +DigitalOcean diff --git a/lib/view/import/button-dropbox.php b/lib/view/import/button-dropbox.php new file mode 100644 index 0000000..a84598f --- /dev/null +++ b/lib/view/import/button-dropbox.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +Dropbox diff --git a/lib/view/import/button-file.php b/lib/view/import/button-file.php new file mode 100644 index 0000000..98632cc --- /dev/null +++ b/lib/view/import/button-file.php @@ -0,0 +1,30 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + + + + + diff --git a/lib/view/import/button-ftp.php b/lib/view/import/button-ftp.php new file mode 100644 index 0000000..00f15e1 --- /dev/null +++ b/lib/view/import/button-ftp.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +FTP diff --git a/lib/view/import/button-gcloud-storage.php b/lib/view/import/button-gcloud-storage.php new file mode 100644 index 0000000..513877a --- /dev/null +++ b/lib/view/import/button-gcloud-storage.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +Google Cloud diff --git a/lib/view/import/button-gdrive.php b/lib/view/import/button-gdrive.php new file mode 100644 index 0000000..0f08166 --- /dev/null +++ b/lib/view/import/button-gdrive.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +Google Drive diff --git a/lib/view/import/button-glacier.php b/lib/view/import/button-glacier.php new file mode 100644 index 0000000..1437659 --- /dev/null +++ b/lib/view/import/button-glacier.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +Amazon Glacier diff --git a/lib/view/import/button-mega.php b/lib/view/import/button-mega.php new file mode 100644 index 0000000..518733e --- /dev/null +++ b/lib/view/import/button-mega.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +Mega diff --git a/lib/view/import/button-onedrive.php b/lib/view/import/button-onedrive.php new file mode 100644 index 0000000..18d181e --- /dev/null +++ b/lib/view/import/button-onedrive.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +OneDrive diff --git a/lib/view/import/button-s3.php b/lib/view/import/button-s3.php new file mode 100644 index 0000000..8f0584c --- /dev/null +++ b/lib/view/import/button-s3.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +Amazon S3 diff --git a/lib/view/import/button-url.php b/lib/view/import/button-url.php new file mode 100644 index 0000000..6b2a696 --- /dev/null +++ b/lib/view/import/button-url.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +URL diff --git a/lib/view/import/import-buttons.php b/lib/view/import/import-buttons.php new file mode 100644 index 0000000..e78184f --- /dev/null +++ b/lib/view/import/import-buttons.php @@ -0,0 +1,87 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + + +
+ +
+
+
+
+

+
+ +

+
+
+ + + + + + +
+
    + +
  • + +
  • + +
+
+
+
+
+
+ +

+ + + + + + + + + + + + +

+ +
+ Site could not be imported!' . + '

Please make sure that storage directory %s has read and write permissions.

', + AI1WM_PLUGIN_NAME + ), + AI1WM_STORAGE_PATH + ); + ?> +
+ diff --git a/lib/view/import/index.php b/lib/view/import/index.php new file mode 100644 index 0000000..0112a9c --- /dev/null +++ b/lib/view/import/index.php @@ -0,0 +1,70 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +
+
+
+
+

+ + +

+ + + +
+ +

+
+

+ + + + + + + +
+ + + +
+
+
+
+
+ + + + +

+ + +
+
+
+
+
diff --git a/lib/view/main/admin-head.php b/lib/view/main/admin-head.php new file mode 100644 index 0000000..6dc2d22 --- /dev/null +++ b/lib/view/main/admin-head.php @@ -0,0 +1,119 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + + diff --git a/lib/view/main/backups-htaccess-notice.php b/lib/view/main/backups-htaccess-notice.php new file mode 100644 index 0000000..db8a33c --- /dev/null +++ b/lib/view/main/backups-htaccess-notice.php @@ -0,0 +1,41 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +
+

+ %s file. ' . + 'Try to change permissions of the parent folder or send us an email at ' . + 'support@servmask.com for assistance.', + AI1WM_PLUGIN_NAME + ), + AI1WM_BACKUPS_HTACCESS + ) + ?> +

+
diff --git a/lib/view/main/backups-index-notice.php b/lib/view/main/backups-index-notice.php new file mode 100644 index 0000000..7625aa3 --- /dev/null +++ b/lib/view/main/backups-index-notice.php @@ -0,0 +1,41 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +
+

+ %s file. ' . + 'Try to change permissions of the parent folder or send us an email at ' . + 'support@servmask.com for assistance.', + AI1WM_PLUGIN_NAME + ), + AI1WM_BACKUPS_INDEX + ) + ?> +

+
diff --git a/lib/view/main/backups-path-notice.php b/lib/view/main/backups-path-notice.php new file mode 100644 index 0000000..03bbf4e --- /dev/null +++ b/lib/view/main/backups-path-notice.php @@ -0,0 +1,41 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +
+

+ %s folder. ' . + 'You will need to create this folder and grant it read/write/execute permissions (0777) ' . + 'for the All in One WP Migration plugin to function properly.', + AI1WM_PLUGIN_NAME + ), + AI1WM_BACKUPS_PATH + ) + ?> +

+
diff --git a/lib/view/main/backups-webconfig-notice.php b/lib/view/main/backups-webconfig-notice.php new file mode 100644 index 0000000..5e689ea --- /dev/null +++ b/lib/view/main/backups-webconfig-notice.php @@ -0,0 +1,41 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +
+

+ %s file. ' . + 'Try to change permissions of the parent folder or send us an email at ' . + 'support@servmask.com for assistance.', + AI1WM_PLUGIN_NAME + ), + AI1WM_BACKUPS_WEBCONFIG + ) + ?> +

+
diff --git a/lib/view/main/get-support.php b/lib/view/main/get-support.php new file mode 100644 index 0000000..975c85b --- /dev/null +++ b/lib/view/main/get-support.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + + diff --git a/lib/view/main/multisite-notice.php b/lib/view/main/multisite-notice.php new file mode 100644 index 0000000..dd2d4cc --- /dev/null +++ b/lib/view/main/multisite-notice.php @@ -0,0 +1,41 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +
+

+ + + + + +

+
diff --git a/lib/view/main/storage-index-notice.php b/lib/view/main/storage-index-notice.php new file mode 100644 index 0000000..2697194 --- /dev/null +++ b/lib/view/main/storage-index-notice.php @@ -0,0 +1,41 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +
+

+ %s file. ' . + 'Try to change permissions of the parent folder or send us an email at ' . + 'support@servmask.com for assistance.', + AI1WM_PLUGIN_NAME + ), + AI1WM_STORAGE_INDEX + ) + ?> +

+
diff --git a/lib/view/main/storage-path-notice.php b/lib/view/main/storage-path-notice.php new file mode 100644 index 0000000..1b3579f --- /dev/null +++ b/lib/view/main/storage-path-notice.php @@ -0,0 +1,41 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +
+

+ %s folder. ' . + 'You will need to create this folder and grant it read/write/execute permissions (0777) ' . + 'for the All in One WP Migration plugin to function properly.', + AI1WM_PLUGIN_NAME + ), + AI1WM_STORAGE_PATH + ) + ?> +

+
diff --git a/lib/view/main/wordpress-htaccess-notice.php b/lib/view/main/wordpress-htaccess-notice.php new file mode 100644 index 0000000..c91420e --- /dev/null +++ b/lib/view/main/wordpress-htaccess-notice.php @@ -0,0 +1,41 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +
+

+ %s file. ' . + 'Try to change permissions of the parent folder or send us an email at ' . + 'support@servmask.com for assistance.', + AI1WM_PLUGIN_NAME + ), + AI1WM_WORDPRESS_HTACCESS + ) + ?> +

+
diff --git a/lib/view/updater/check.php b/lib/view/updater/check.php new file mode 100644 index 0000000..9131d77 --- /dev/null +++ b/lib/view/updater/check.php @@ -0,0 +1,27 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + + diff --git a/lib/view/updater/modal.php b/lib/view/updater/modal.php new file mode 100644 index 0000000..b02310b --- /dev/null +++ b/lib/view/updater/modal.php @@ -0,0 +1,53 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ +?> + +
+
+

+

+

+

+ + +

+

+ + +

+

+ + +

+
+
+ + + + + . + diff --git a/loader.php b/loader.php new file mode 100644 index 0000000..9dd590a --- /dev/null +++ b/loader.php @@ -0,0 +1,368 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +// Include all the files that you want to load in here +require_once AI1WM_VENDOR_PATH . + DIRECTORY_SEPARATOR . + 'bandar' . + DIRECTORY_SEPARATOR . + 'bandar' . + DIRECTORY_SEPARATOR . + 'lib' . + DIRECTORY_SEPARATOR . + 'Bandar.php'; + + +if ( class_exists( 'WP_CLI' ) ) { + require_once AI1WM_VENDOR_PATH . + DIRECTORY_SEPARATOR . + 'servmask' . + DIRECTORY_SEPARATOR . + 'command' . + DIRECTORY_SEPARATOR . + 'class-ai1wm-wp-cli-command.php'; +} + +require_once AI1WM_VENDOR_PATH . + DIRECTORY_SEPARATOR . + 'servmask' . + DIRECTORY_SEPARATOR . + 'filesystem' . + DIRECTORY_SEPARATOR . + 'class-ai1wm-directory.php'; + +require_once AI1WM_VENDOR_PATH . + DIRECTORY_SEPARATOR . + 'servmask' . + DIRECTORY_SEPARATOR . + 'filesystem' . + DIRECTORY_SEPARATOR . + 'class-ai1wm-file.php'; + +require_once AI1WM_VENDOR_PATH . + DIRECTORY_SEPARATOR . + 'servmask' . + DIRECTORY_SEPARATOR . + 'filesystem' . + DIRECTORY_SEPARATOR . + 'class-ai1wm-file-index.php'; + +require_once AI1WM_VENDOR_PATH . + DIRECTORY_SEPARATOR . + 'servmask' . + DIRECTORY_SEPARATOR . + 'filesystem' . + DIRECTORY_SEPARATOR . + 'class-ai1wm-file-htaccess.php'; + +require_once AI1WM_VENDOR_PATH . + DIRECTORY_SEPARATOR . + 'servmask' . + DIRECTORY_SEPARATOR . + 'filesystem' . + DIRECTORY_SEPARATOR . + 'class-ai1wm-file-webconfig.php'; + +require_once AI1WM_VENDOR_PATH . + DIRECTORY_SEPARATOR . + 'servmask' . + DIRECTORY_SEPARATOR . + 'cron' . + DIRECTORY_SEPARATOR . + 'class-ai1wm-cron.php'; + +require_once AI1WM_VENDOR_PATH . + DIRECTORY_SEPARATOR . + 'servmask' . + DIRECTORY_SEPARATOR . + 'iterator' . + DIRECTORY_SEPARATOR . + 'class-ai1wm-recursive-directory-iterator.php'; + +require_once AI1WM_VENDOR_PATH . + DIRECTORY_SEPARATOR . + 'servmask' . + DIRECTORY_SEPARATOR . + 'iterator' . + DIRECTORY_SEPARATOR . + 'class-ai1wm-recursive-iterator-iterator.php'; + +require_once AI1WM_VENDOR_PATH . + DIRECTORY_SEPARATOR . + 'servmask' . + DIRECTORY_SEPARATOR . + 'filter' . + DIRECTORY_SEPARATOR . + 'class-ai1wm-recursive-extension-filter.php'; + +require_once AI1WM_VENDOR_PATH . + DIRECTORY_SEPARATOR . + 'servmask' . + DIRECTORY_SEPARATOR . + 'filter' . + DIRECTORY_SEPARATOR . + 'class-ai1wm-recursive-exclude-filter.php'; + +require_once AI1WM_VENDOR_PATH . + DIRECTORY_SEPARATOR . + 'servmask' . + DIRECTORY_SEPARATOR . + 'filter' . + DIRECTORY_SEPARATOR . + 'class-ai1wm-recursive-newline-filter.php'; + +require_once AI1WM_VENDOR_PATH . + DIRECTORY_SEPARATOR . + 'servmask' . + DIRECTORY_SEPARATOR . + 'archiver' . + DIRECTORY_SEPARATOR . + 'class-ai1wm-archiver.php'; + +require_once AI1WM_VENDOR_PATH . + DIRECTORY_SEPARATOR . + 'servmask' . + DIRECTORY_SEPARATOR . + 'archiver' . + DIRECTORY_SEPARATOR . + 'class-ai1wm-compressor.php'; + +require_once AI1WM_VENDOR_PATH . + DIRECTORY_SEPARATOR . + 'servmask' . + DIRECTORY_SEPARATOR . + 'archiver' . + DIRECTORY_SEPARATOR . + 'class-ai1wm-extractor.php'; + +require_once AI1WM_VENDOR_PATH . + DIRECTORY_SEPARATOR . + 'servmask' . + DIRECTORY_SEPARATOR . + 'database' . + DIRECTORY_SEPARATOR . + 'class-ai1wm-database.php'; + +require_once AI1WM_VENDOR_PATH . + DIRECTORY_SEPARATOR . + 'servmask' . + DIRECTORY_SEPARATOR . + 'database' . + DIRECTORY_SEPARATOR . + 'class-ai1wm-database-mysql.php'; + +require_once AI1WM_VENDOR_PATH . + DIRECTORY_SEPARATOR . + 'servmask' . + DIRECTORY_SEPARATOR . + 'database' . + DIRECTORY_SEPARATOR . + 'class-ai1wm-database-mysqli.php'; + +require_once AI1WM_VENDOR_PATH . + DIRECTORY_SEPARATOR . + 'servmask' . + DIRECTORY_SEPARATOR . + 'database' . + DIRECTORY_SEPARATOR . + 'class-ai1wm-database-utility.php'; + +require_once AI1WM_VENDOR_PATH . + DIRECTORY_SEPARATOR . + 'math' . + DIRECTORY_SEPARATOR . + 'BigInteger.php'; + +require_once AI1WM_CONTROLLER_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-main-controller.php'; + +require_once AI1WM_CONTROLLER_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-export-controller.php'; + +require_once AI1WM_CONTROLLER_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-import-controller.php'; + +require_once AI1WM_CONTROLLER_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-status-controller.php'; + +require_once AI1WM_CONTROLLER_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-backups-controller.php'; + +require_once AI1WM_CONTROLLER_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-updater-controller.php'; + +require_once AI1WM_CONTROLLER_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-feedback-controller.php'; + +require_once AI1WM_CONTROLLER_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-report-controller.php'; + +require_once AI1WM_EXPORT_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-export-init.php'; + +require_once AI1WM_EXPORT_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-export-compatibility.php'; + +require_once AI1WM_EXPORT_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-export-archive.php'; + +require_once AI1WM_EXPORT_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-export-config.php'; + +require_once AI1WM_EXPORT_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-export-config-file.php'; + +require_once AI1WM_EXPORT_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-export-enumerate.php'; + +require_once AI1WM_EXPORT_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-export-content.php'; + +require_once AI1WM_EXPORT_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-export-database.php'; + +require_once AI1WM_EXPORT_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-export-database-file.php'; + +require_once AI1WM_EXPORT_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-export-download.php'; + +require_once AI1WM_EXPORT_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-export-clean.php'; + +require_once AI1WM_IMPORT_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-import-compatibility.php'; + +require_once AI1WM_IMPORT_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-import-upload.php'; + +require_once AI1WM_IMPORT_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-import-validate.php'; + +require_once AI1WM_IMPORT_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-import-blogs.php'; + +require_once AI1WM_IMPORT_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-import-confirm.php'; + +require_once AI1WM_IMPORT_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-import-enumerate.php'; + +require_once AI1WM_IMPORT_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-import-content.php'; + +require_once AI1WM_IMPORT_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-import-mu-plugins.php'; + +require_once AI1WM_IMPORT_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-import-database.php'; + +require_once AI1WM_IMPORT_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-import-done.php'; + +require_once AI1WM_IMPORT_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-import-clean.php'; + +require_once AI1WM_MODEL_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-deprecated.php'; + +require_once AI1WM_MODEL_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-extensions.php'; + +require_once AI1WM_MODEL_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-compatibility.php'; + +require_once AI1WM_MODEL_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-backups.php'; + +require_once AI1WM_MODEL_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-updater.php'; + +require_once AI1WM_MODEL_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-feedback.php'; + +require_once AI1WM_MODEL_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-report.php'; + +require_once AI1WM_MODEL_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-template.php'; + +require_once AI1WM_MODEL_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-status.php'; + +require_once AI1WM_MODEL_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-log.php'; + +require_once AI1WM_MODEL_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-message.php'; + +require_once AI1WM_MODEL_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-notification.php'; + +require_once AI1WM_MODEL_PATH . + DIRECTORY_SEPARATOR . + 'class-ai1wm-handler.php'; diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000..d9c5042 --- /dev/null +++ b/readme.txt @@ -0,0 +1,472 @@ +=== All-in-One WP Migration === +Contributors: yani.iliev, bangelov, pimjitsawang +Tags: move, transfer, copy, migrate, backup, clone, restore, db migration, wordpress migration, website migration, database export, database import, apoyo, sauvegarde, di riserva, バックアップ +Requires at least: 3.3 +Tested up to: 4.9 +Requires PHP: 5.2.17 +Stable tag: 6.76 +License: GPLv2 or later + +Move, transfer, copy, migrate, and backup a site with 1-click. Quick, easy, and reliable. + +== Description == +This plugin exports your WordPress website including the database, media files, plugins and themes with no technical knowledge required. +Upload your site to a different location with a drag and drop in to WordPress. +There is an option to apply an unlimited number of find and replace operations on your database during the export process. The plugin will also fix any +serialisation problems that occur during the find/replace operation. + +Mobile device compatible: All in One WP Plugin is the first plugin to offer true mobile experience on WordPress versions 3.3 and up. + += No limitations on host or operating system = +* We have tested the plugin on the major Linux distributions, MacOS and Microsoft Windows. +* [Please see the list of hosting providers that we work with.](https://help.servmask.com/knowledgebase/supported-hosting-providers/) + += Bypass all upload size restriction = +* We use chunks to import your site data. Most providers set the maximum upload file size to 2MB. As the file restrictions are only applied to each chunk, webserver upload size restrictions are bypassed by keeping the chunks under 2MB to easily upload your entire site. + += Zero Dependencies = +* The plugin does not require any PHP extensions and works with all versions of PHP from v5.2 onwards. This is great news for v5.2 users who are unsupported by many other products. + += Support for MySQL and MySQLi = +* No matter what php mysql driver your webserver ships with, we support it. + += Compatible with WordPress v3.3 to present = +* We have a comprehensive Quality Assurance and testing process that ensures that the plugin is always compatible with the latest release of WordPress, but we don't support versions of WordPress prior to version 3.3 (2012) + += WP-CLI Integration is included = +* [WP-CLI Integration Documentation](https://help.servmask.com/knowledgebase/cli-integration/) + += Support = +* For the community version of the plugin please watch the instruction videos below and see our FAQ. +* If you have more complex requirements, our team is here to help. If you have any questions please feel free to get in touch at [help.servmask.com](https://help.servmask.com/) +* All premium products include premium support. + += Migrate WordPress to cloud storage services using our completely new premium extensions = +**All of the Cloud Storage and Multisite extensions include premium support and the Unlimited extension free of charge** + +* [Unlimited](https://servmask.com/products/unlimited-extension) +* [Dropbox](https://servmask.com/products/dropbox-extension) +* [Multisite](https://servmask.com/products/multisite-extension) +* [FTP](https://servmask.com/products/ftp-extension) +* [Google Drive](https://servmask.com/products/google-drive-extension) +* [Amazon S3](https://servmask.com/products/amazon-s3-extension) +* [URL](https://servmask.com/products/url-extension) +* [OneDrive](https://servmask.com/products/onedrive-extension) +* [Box](https://servmask.com/products/box-extension) +* [Mega](https://servmask.com/products/mega-extension) +* [DigitalOcean Spaces](https://servmask.com/products/digitalocean-spaces-extension) +* [Backblaze B2](https://servmask.com/products/backblaze-b2-extension) +* [Google Cloud Storage](https://servmask.com/products/google-cloud-storage-extension) +* [Microsoft Azure Storage](https://servmask.com/products/microsoft-azure-storage-extension) +* [Amazon Glacier](https://servmask.com/products/amazon-glacier-extension) + += Supported hosting providers = +**The plugin does not have any dependencies, making it compatible with all PHP hosting providers. We support a vast range of hosting providers. Some of the most popular include:** + +* DigitalOcean +* Bluehost +* InMotion +* Web Hosting Hub +* Siteground +* Pagely +* Dreamhost +* Justhost +* GoDaddy +* WP Engine +* Site5 +* 1&1 +* Pantheon +* [See the full list of supported providers here](https://help.servmask.com/knowledgebase/supported-hosting-providers/) + += Contact us = +* [Get free help from us here](https://servmask.com/help) +* [Report a bug or request a feature](https://servmask.com/help) +* [Find out more about us](https://servmask.com) + +[youtube http://www.youtube.com/watch?v=BpWxCeUWBOk] + +[youtube http://www.youtube.com/watch?v=mRp7qTFYKgs] + +== Installation == +1. All-in-One WP Migration can be installed directly through your WordPress +Plugins dashboard. +1. Click "Add New" and Search for "All-in-One WP Migration" +1. Install and Activate + +Alternatively you can download the plugin using the download button on this page and then upload the all-in-one-wp-migration folder to the /wp-content/plugins/ directory then activate throught the Plugins dashboard in WordPress + +== Screenshots == +1. Mobile Export page +2. Mobile Import page +3. Plugin Menu + +== Privacy Policy == +All-in-One WP Migration **asks for your consent** to collect **requester's email address** when filling plugin's contact form. [GDPR Compliant Privacy Policy](https://www.iubenda.com/privacy-policy/946881) + +== Changelog == += 6.76 = +**Added** + +* Support for Amazon Glacier +* Support for BeTheme Responsive + += 6.75 = +**Fixed** + +* WP-CLI export/import missing data +* Serialization in PHP 7.2 +* Missing entry in the web.config file + += 6.74 = +**Added** + +* Support for LiteSpeed web server +* Fully localized the export, import, and restore processes + +**Fixed** + +* Table prefix replacement on import in limited corner cases +* URL replacement in Bitnami + += 6.73 = +**Fixed** + +* Improvements to the export and import process + += 6.72 = +**Added** + +* Support for Microsoft Azure Storage + +**Fixed** + +* The plugin incorrectly reports Disk is full on some hostings + += 6.71 = +**Added** + +* Support for Google Cloud Storage + +**Fixed** + +* Improvements to the export and import process + += 6.70 = +**Added** + +* Support for Backblaze B2 + +**Fixed** + +* Small improvements to the export process + += 6.69 = +**Added** + +* Support for RTL languages +* Disable My Custom Widgets, WPS Hide Login and Endurance Page Cache plugins after restoring a backup + +**Changed** + +* Text on import steps + += 6.68 = +**Added** + +* Privacy policy section and link to GDPR Compliant Privacy Policy + += 6.67 = +**Changed** + +* Rename DigitalOcean to DigitalOcean Spaces Extension + += 6.66 = +**Added** + +* Notification class for sending emails on error (export/import) +* Support for DigitalOcean Extension + +**Fixed** + +* Database regex pattern for parsing SQL queries + += 6.65 = +**Added** + +* New plugin icons on WP Admin Updates page + +**Fixed** + +* Table prefix replacement of subsite options table on export + += 6.64 = +**Added** + +* Deactivate Jetpack SSO module on import +* Deactivate Invisible reCaptcha plugin on import + += 6.63 = +**Added** + +* Responsive design on export/import dropdown +* Warning message when export site is using PHP 5.x and import site is using PHP 7.x + +**Fixed** + +* Wrong next backup date on Settings page +* 🇯🇵 Japanese translation on Backups page + +**Changed** + +* Remove disabled cancel button on import + += 6.62 = +**Added** + +* Technical message if PHP is 32bit and backup is larger than 2GB on export +* Technical message if db server is SQL Server on export/import + +**Fixed** + +* SQL regex pattern on import + +**Changed** + +* Confirmation message on import + += 6.61 = +**Added** + +* Disable wp-force-ssl plugin if current site is not SSL based on import +* Support for Mega Extension + += 6.60 = +**Added** + +* Tested up to WordPress 4.9 + += 6.59 = +**Added** + +* Disable wordpress-https plugin if current site is not SSL based on import +* Support for Azure db on import +* New button icons for cloud extensions + += 6.58 = +**Fixed** + +* Remove WP CLI commands on PHP 5.2 and below +* Issue with files on export + += 6.57 = +**Added** + +* Disable really-simple-ssl plugin if current site is not SSL based on import +* Support for WP-CLI + += 6.56 = +**Added** + +* Symlink directories on export +* Support sub directories on Backups page +* A cancel button on import confirm step + +**Fixed** + +* Support IE11 +* Wrong blogs.dir URL replacement +* Wrong path network drive replacement (Windows) +* Text placeholders of first find/replace inputs on export + +**Changed** + +* Added loading indicator to feedback and report a problem forms +* Do not clear cache on export +* Skip files that contain new line on export + += 6.55 = +**Added** + +* Percentage indicator on "Unpacking archive" step +* Chunking mechanism when adding database.sql to wpress file on export + +**Changed** + +* Display 2GB+ value if file size cannot be obtained on Backups page +* Move COMMIT condition after processing all table records + +**Fixed** + +* Directory separator of archiver on Windows + += 6.54 = +**Changed** + +* Use late row lookup to perform database export + += 6.53 = +**Added** + +* Warn the user when web server configuration files are not created + +**Changed** + +* Buffered queries instead of unbuffered queries +* Relative URLs instead of absolute URLs when loading fonts and images + += 6.52 = +**Changed** + +* Remove temporary files on error + +**Fixed** + +* Incorrect subsite path replacement on import + += 6.51 = +**Added** + +* Validation on leave feedback, report issue and delete backup actions +* More descriptive wpress file names on export + +**Changed** + +* Remove "Unable to authenticate with secret key" message + +**Fixed** + +* Wrong file size in wpress file on export + += 6.50 = +**Fixed** + +* Stuck on preparing to import + += 6.49 = +**Changed** + +* Plugin description in readme.txt + += 6.48 = +**Fixed** + +* Escape Find/Replace values on import +* Unable to load CSS and JS when event hook contains capital letters + += 6.47 = +**Added** + +* Elementor plugin support + +**Fixed** + +* Site URL and Home URL replacement in JSON data + += 6.46 = +**Fixed** + +* Domain replacement on import +* Invalid secret key check on import + += 6.45 = +**Changed** + +* Better mechanism when enumerating files on import + +**Fixed** + +* Validation mechanism on export/import + += 6.44 = +**Added** + +* PHP and DB version metadata in package.json +* Find/Replace values in package.json +* Internal Site URL and Internal Home URL in package.json +* Confirmation mechanism when uploading chunk by chunk on import +* Progress indicator on database export/import +* Shutdown handler to catch fatal errors + +**Changed** + +* Replace TYPE with ENGINE keyword on database export +* Detect Site URL and Home URL in Find/Replace values +* Activate template and stylesheet on import +* Import database chunk by chunk to avoid timeout limitation + +**Fixed** + +* An issue on export/import when using HipHop for PHP + += 6.43 = +**Changed** + +* Plugin tags and description + += 6.42 = +**Changed** + +* Improved performance when exporting database + += 6.41 = +**Added** + +* Support Visual Composer plugin +* Support Jetpack Photon module + +**Changed** + +* Improved Maria DB support +* Disable WordPress authentication checking during migration +* Clean any temporary files after migration + += 6.40 = +**Added** + +* Separate action hook in advanced settings called "ai1wm_export_advanced_settings" to allow custom checkbox options on export + +**Changed** + +* Do not extract dropins files on import +* Do not exclude active plugins in package.json and multisite.json on export +* Do not show "Resolving URL address..." on export/import + +**Fixed** + +* An issue with large files on import +* An issue with inactive plugins option in advanced settings on export + += 6.39 = +**Added** + +* Support for MariaDB + +**Changed** + +* Do not include package.json, multisite.json, blogs.json, database.sql and filemap.list files on export +* Remove HTTP Basic authentication from Backups page + +**Fixed** + +* An issue with unpacking archive on import +* An issue with inactivated plugins on import + += 6.38 = +**Added** + +* Support for HyperDB plugin +* Support for RevSlider plugin +* Check available disk space during export/import +* Support very restricted hosting environments +* WPRESS mime-type to web.config when the server is IIS + +**Changed** + +* Switch to AJAX from cURL on export/import +* Respect WordPress constants FS_CHMOD_DIR and FS_CHMOD_FILE on import +* Remove misleading available disk space information on "Backups" page + +**Fixed** + +* An issue related to generating archive and folder names +* An issue related to CSS styles on export page diff --git a/storage/index.php b/storage/index.php new file mode 100644 index 0000000..f0f663c --- /dev/null +++ b/storage/index.php @@ -0,0 +1 @@ +. + * + * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ + * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ + * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ + * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ + * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ + * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + */ + +// Include plugin bootstrap file +require_once dirname( __FILE__ ) . + DIRECTORY_SEPARATOR . + 'all-in-one-wp-migration.php'; + +/** + * Trigger Uninstall process only if WP_UNINSTALL_PLUGIN is defined + */ +if ( defined( 'WP_UNINSTALL_PLUGIN' ) ) { + global $wpdb, $wp_filesystem; + + // Delete any options or other data stored in the database here + delete_option( AI1WM_STATUS ); + delete_option( AI1WM_SECRET_KEY ); + delete_option( AI1WM_AUTH_USER ); + delete_option( AI1WM_AUTH_PASSWORD ); +}