diff --git a/kinsta-mu-plugins.php b/kinsta-mu-plugins.php index cda125b..9434cdb 100644 --- a/kinsta-mu-plugins.php +++ b/kinsta-mu-plugins.php @@ -3,7 +3,7 @@ * Plugin Name: Kinsta Must-use Plugins * Plugin URI: https://kinsta.com/knowledgebase/kinsta-mu-plugin/ * Description: The plugin designed to work on Kinsta's managed WordPress hosting platform. - * Version: 2.4.8 + * Version: 3.0.0 * Author: Kinsta Team * Author URI: https://kinsta.com/about-us/ * Text Domain: kinsta-mu-plugins @@ -16,12 +16,21 @@ die( 'No script kiddies please!' ); } -define( 'KINSTAMU_VERSION', '2.4.8' ); +define( 'KINSTAMU_VERSION', '3.0.0' ); +define( 'KMP_DOCS_URL', 'https://kinsta.com/help/kinsta-mu-plugin/' ); + if ( ! defined( 'KINSTAMU_WHITELABEL' ) ) { define( 'KINSTAMU_WHITELABEL', false ); } -require_once plugin_dir_path( __FILE__ ) . 'kinsta-mu-plugins/shared/class-shared.php'; +require_once plugin_dir_path( __FILE__ ) . 'kinsta-mu-plugins/utils/utils.php'; + +require_once plugin_dir_path( __FILE__ ) . 'kinsta-mu-plugins/admin/class-kmp-admin.php'; +require_once plugin_dir_path( __FILE__ ) . 'kinsta-mu-plugins/cache/class-cache.php'; +require_once plugin_dir_path( __FILE__ ) . 'kinsta-mu-plugins/cache/class-cache-purge.php'; +require_once plugin_dir_path( __FILE__ ) . 'kinsta-mu-plugins/security/class-banned-plugins.php'; +require_once plugin_dir_path( __FILE__ ) . 'kinsta-mu-plugins/wp-cli/class-kmp-wpcli.php'; + +require_once plugin_dir_path( __FILE__ ) . 'kinsta-mu-plugins/class-kmp.php'; + require_once plugin_dir_path( __FILE__ ) . 'kinsta-mu-plugins/compat/compat.php'; -require_once plugin_dir_path( __FILE__ ) . 'kinsta-mu-plugins/cache/cache.php'; -require_once plugin_dir_path( __FILE__ ) . 'kinsta-mu-plugins/cdn/cdn.php'; diff --git a/kinsta-mu-plugins/admin/assets/css/common.css b/kinsta-mu-plugins/admin/assets/css/common.css new file mode 100644 index 0000000..7709e9a --- /dev/null +++ b/kinsta-mu-plugins/admin/assets/css/common.css @@ -0,0 +1,165 @@ +/** + * BASIC LINK STYLE + * Link styles to match the website +*/ + +.kinsta-wrap { + padding: 24px 16px 16px 16px; +} + +.kinsta-page-wrapper * { + box-sizing: border-box; +} + +.kinsta-page-wrapper { + padding: 24px 32px 48px; + border-radius: 4px; + background: #fff; + color: #0A0A0A; + font-size: 14px; + line-height: 1.5; +} + +@media screen and (max-width: 1280px) { + .kinsta-page-wrapper { + padding: 16px 24px; + font-size: 12px; + } +} + +.kinsta-content-section-header { + margin-bottom: 24px; +} + +.kinsta-content-section-body { + display: grid; + grid-template-columns: 2fr 1fr; + justify-content: space-between; + grid-gap: 24px; +} + +@media screen and (max-width: 700px) { + .kinsta-content-section-body { + grid-template-columns: 2fr; + } +} + +.kinsta-content-section-body.no-grid { + display: block; +} + +.kinsta-button { + box-shadow: 0 4px 12px 0 rgb(83 51 237 / 32%), 0 0 0 2px #2a0fab; + display: inline-flex; + align-items: center; + justify-content: center; + border-radius: 12px; + height: 40px; + padding: 0 32px; + outline: none; + border: none; + white-space: nowrap; + cursor: pointer; + transition: all .25s; + background-image: linear-gradient(99deg, #336aed 0%, #5333ED 50%, #5333ED 100%); + background-position: center center; + background-size: 200% auto; + color: white; + justify-self: end; + text-decoration: none; +} + +.kinsta-button:hover { + background-position: left center; + box-shadow: 0 4px 8px 0 rgb(83 51 237 / 32%); + color: white; +} + +.kinsta-button-disabled { + border: 1px solid #D1D6DF; + color: #8f97a3; + cursor: not-allowed; + box-shadow: none !important; + background: transparent !important; +} + +.kinsta-checkbox { + +} + +.kinsta-content-section-split { + width: calc(100% + 2 * 32px); + margin: 32px -24px 24px -32px; + border: solid 1px #F2F4F9; + box-sizing: border-box; + height: 0; + overflow: visible; +} + +#kinsta-custom-url-form-fields { + display: flex; + align-items: center; +} + +@media screen and (max-width: 800px) { + #kinsta-custom-url-form-fields { + flex-wrap: wrap; + } +} + +#kinsta-custom-url-form-fields > .prefix, #kinsta-custom-url-form-fields .kinsta-button { + margin-left: 12px; +} + +#kinsta-custom-url-form-fields span { + font-size: 14px; +} + +#kinsta-custom-url-form-fields .kinsta-button { + padding-top: 0; + padding-bottom: 0; + height: 30px; +} + +.kinsta-table { + min-width: 100%; + border-collapse: collapse; + display: grid; + overflow-x: auto; + align-items: center; + border-radius: 0 0 16px 16px; + font-size: 14px; + grid-template-columns: repeat(3, minmax(auto, 1fr)); + margin-top: 20px; +} + +.kinsta-table thead, .kinsta-table tbody, .kinsta-table tr { + display: contents; +} + +.kinsta-table th { + padding: 16px; + height: 100%; + color: #5A6372; + text-align: left; + position: sticky; + background-color: #f8fafc; +} + +.kinsta-table th:first-of-type { + border-radius: 12px 0 0 12px; + padding-left: 24px; +} + +.kinsta-table th:last-of-type { + border-radius: 0 12px 12px 0; +} + +.kinsta-table td { + padding: 16px; +} + +.kinsta-table td:first-of-type { + border-radius: 12px 0 0 12px; + padding-left: 24px; +} \ No newline at end of file diff --git a/kinsta-mu-plugins/shared/images/arrow-down.svg b/kinsta-mu-plugins/admin/assets/images/arrow-down.svg similarity index 100% rename from kinsta-mu-plugins/shared/images/arrow-down.svg rename to kinsta-mu-plugins/admin/assets/images/arrow-down.svg diff --git a/kinsta-mu-plugins/shared/images/icon-support.svg b/kinsta-mu-plugins/admin/assets/images/icon-support.svg similarity index 100% rename from kinsta-mu-plugins/shared/images/icon-support.svg rename to kinsta-mu-plugins/admin/assets/images/icon-support.svg diff --git a/kinsta-mu-plugins/shared/images/icon.svg b/kinsta-mu-plugins/admin/assets/images/icon.svg similarity index 100% rename from kinsta-mu-plugins/shared/images/icon.svg rename to kinsta-mu-plugins/admin/assets/images/icon.svg diff --git a/kinsta-mu-plugins/shared/images/info.svg b/kinsta-mu-plugins/admin/assets/images/info.svg similarity index 100% rename from kinsta-mu-plugins/shared/images/info.svg rename to kinsta-mu-plugins/admin/assets/images/info.svg diff --git a/kinsta-mu-plugins/shared/images/logo-dark.svg b/kinsta-mu-plugins/admin/assets/images/logo-dark.svg similarity index 100% rename from kinsta-mu-plugins/shared/images/logo-dark.svg rename to kinsta-mu-plugins/admin/assets/images/logo-dark.svg diff --git a/kinsta-mu-plugins/shared/images/menu-icon.svg b/kinsta-mu-plugins/admin/assets/images/menu-icon.svg similarity index 100% rename from kinsta-mu-plugins/shared/images/menu-icon.svg rename to kinsta-mu-plugins/admin/assets/images/menu-icon.svg diff --git a/kinsta-mu-plugins/shared/images/warning.svg b/kinsta-mu-plugins/admin/assets/images/warning.svg similarity index 100% rename from kinsta-mu-plugins/shared/images/warning.svg rename to kinsta-mu-plugins/admin/assets/images/warning.svg diff --git a/kinsta-mu-plugins/admin/assets/translations/kinsta-mu-plugins-es_ES.mo b/kinsta-mu-plugins/admin/assets/translations/kinsta-mu-plugins-es_ES.mo new file mode 100644 index 0000000..4244e09 Binary files /dev/null and b/kinsta-mu-plugins/admin/assets/translations/kinsta-mu-plugins-es_ES.mo differ diff --git a/kinsta-mu-plugins/admin/assets/translations/kinsta-mu-plugins-es_ES.po b/kinsta-mu-plugins/admin/assets/translations/kinsta-mu-plugins-es_ES.po new file mode 100644 index 0000000..c811820 --- /dev/null +++ b/kinsta-mu-plugins/admin/assets/translations/kinsta-mu-plugins-es_ES.po @@ -0,0 +1,416 @@ +msgid "" +msgstr "" +"Project-Id-Version: Kinsta Must-use Plugins\n" +"POT-Creation-Date: 2022-12-07 07:46-0500\n" +"PO-Revision-Date: 2022-12-07 10:03-0500\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: es_ES\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 3.2.2\n" +"X-Poedit-Basepath: ../../../..\n" +"X-Poedit-WPHeader: kinsta-mu-plugins.php\n" +"X-Poedit-SourceCharset: UTF-8\n" +"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;" +"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;" +"_nx_noop:3c,1,2;__ngettext_noop:1,2\n" +"X-Poedit-SearchPath-0: .\n" +"X-Poedit-SearchPath-1: kinsta-mu-plugins\n" +"X-Poedit-SearchPathExcluded-0: *.js\n" + +#: kinsta-mu-plugins/admin/class-kmp-admin.php:134 +#, php-format +msgid "Thanks for creating with %1$s and hosting with %2$s" +msgstr "Gracias por crear con %1$s y por hospedar tu sitio web con %2$s" + +#: kinsta-mu-plugins/admin/class-kmp-admin.php:151 +msgid "Kinsta Cache" +msgstr "Caché de Kinsta" + +#: kinsta-mu-plugins/admin/class-kmp-admin.php:151 +msgid "Server Cache" +msgstr "Caché del servidor" + +#: kinsta-mu-plugins/admin/class-kmp-admin.php:209 +#: kinsta-mu-plugins/admin/class-kmp-admin.php:211 +msgid "Clear Caches" +msgstr "Eliminar Caché" + +#: kinsta-mu-plugins/admin/class-kmp-admin.php:221 +#: kinsta-mu-plugins/admin/pages/cache.php:25 +msgid "Clear All Caches" +msgstr "Eliminar Todos Los Cachés" + +#: kinsta-mu-plugins/admin/class-kmp-admin.php:230 +#: kinsta-mu-plugins/admin/pages/cache.php:35 +msgid "Clear Site Cache" +msgstr "Eliminar el Caché del Sitio" + +#: kinsta-mu-plugins/admin/class-kmp-admin.php:240 +#: kinsta-mu-plugins/admin/class-kmp-admin.php:250 +msgid "Clear CDN Cache" +msgstr "Eliminar el caché del CDN" + +#: kinsta-mu-plugins/admin/class-kmp-admin.php:316 +msgid "Cache cleared successfully" +msgstr "Caché borrado correctamente" + +#: kinsta-mu-plugins/admin/class-kmp-admin.php:322 +#, fuzzy +#| msgid "Cache cleared successfully" +msgid "Autopurge disabled successfully" +msgstr "Caché borrado correctamente" + +#: kinsta-mu-plugins/admin/class-kmp-admin.php:326 +#, fuzzy +#| msgid "Cache cleared successfully" +msgid "Autopurge enabled successfully" +msgstr "Caché borrado correctamente" + +#: kinsta-mu-plugins/admin/pages/cache.php:21 +msgid "Cache Control" +msgstr "Control del Caché" + +#: kinsta-mu-plugins/admin/pages/cache.php:24 +msgid "" +"Your site uses our full page and object caching technology to load lightning " +"fast. We purge single pages and key pages such as the home page immediately " +"and impose a minimal throttle time on archive pages. This ensures high " +"availability at all times." +msgstr "" +"Su sitio utiliza nuestra tecnología de caché de página completa y de objetos " +"para permanecer extremadamente rápido. Purgamos inmediatamente del caché " +"páginas individuales y páginas clave como la página de inicio y luego " +"imponemos un tiempo mínimo de de espera en las páginas de archivo. Esto " +"garantiza una alta disponibilidad en todo momento." + +#: kinsta-mu-plugins/admin/pages/cache.php:31 +msgid "Site Caching" +msgstr "Caché del Sitio" + +#: kinsta-mu-plugins/admin/pages/cache.php:34 +msgid "" +"Cache makes your site load faster by storing site data. Clear it to make " +"sure your site shows the most recent version." +msgstr "" +"El caché hace que su sitio cargue más rápido al almacenar los datos del " +"sitio. Puede borrarlo para asegurarse de que se muestre la versión más " +"reciente." + +#: kinsta-mu-plugins/admin/pages/cache.php:41 +msgid "Object Caching" +msgstr "El Caché de Objetos" + +#: kinsta-mu-plugins/admin/pages/cache.php:44 +msgid "" +"The WordPress Object Cache is used to save on trips to the database. The " +"Object Cache stores all of the cache data to memory and makes the cache " +"contents available by using a key, which is used to name and later retrieve " +"the cache contents." +msgstr "" + +#: kinsta-mu-plugins/admin/pages/cache.php:45 +msgid "Clear Object Cache" +msgstr "Eliminar El Caché de Objetos" + +#: kinsta-mu-plugins/admin/pages/cache.php:51 +#, fuzzy +#| msgid "Custom URLs To Purge" +msgid "Custom URLs to purge" +msgstr "Direcciones URLs Personalizadas A Limpiar" + +#: kinsta-mu-plugins/admin/pages/cache.php:58 +#, php-format +msgid "" +"You can add custom paths to purge whenever your site is updated. Please see " +"our %s for more information on how to use this feature effectively." +msgstr "" +"Usted puede agregar rutas personalizadas para limpiar cada vez que su sitio " +"sea actualizado. Por favor vea nuestra %s para más información sobre como " +"usar esta característica efectivamente." + +#: kinsta-mu-plugins/admin/pages/cache.php:70 +msgid "documentation" +msgstr "documentación" + +#: kinsta-mu-plugins/admin/pages/cache.php:73 +msgid "You can add custom paths to purge whenever your site is updated." +msgstr "" +"Usted puede agregar rutas personalizadas para limpiar del caché cuando su " +"sitio sea actualizado." + +#: kinsta-mu-plugins/admin/pages/cache.php:78 +msgid "Add A Custom URL" +msgstr "" + +#: kinsta-mu-plugins/admin/pages/cache.php:177 +msgid "Cache Autopurge" +msgstr "" + +#: kinsta-mu-plugins/admin/pages/cache.php:180 +msgid "" +"We purge the full page cache on every page and post update. If you are " +"importing posts, you can disable the autopurge temporarily to avoid site " +"slowdowns." +msgstr "" + +#: kinsta-mu-plugins/admin/pages/cache.php:182 +msgid "Enable Autopurge" +msgstr "" + +#: kinsta-mu-plugins/admin/pages/cache.php:184 +msgid "Disable Autopurge" +msgstr "" + +#: kinsta-mu-plugins/admin/pages/cdn.php:23 +msgid "" +"CDN is enabled. All static content (such as images, CSS, and JavaScript " +"files) is loaded through our CDN. We serve all the folders of your website. " +"The limit is 5 GB per file." +msgstr "" +"La CDN está activada. Todo el contenido estático (como imágenes, CSS y " +"archivos JavaScript) se carga a través de nuestra CDN. Servimos todas las " +"carpetas de tu sitio web. El límite es de 5 GB por archivo." + +#: kinsta-mu-plugins/admin/pages/cdn.php:24 +#, fuzzy +#| msgid "Clearing Cache..." +msgid "Clearing CDN..." +msgstr "Limpiando Caché…" + +#: kinsta-mu-plugins/admin/pages/cdn.php:24 +#, fuzzy +#| msgid "Cache Cleared" +msgid "CDN Cleared" +msgstr "Caché borrado" + +#: kinsta-mu-plugins/admin/pages/cdn.php:24 +#, fuzzy +#| msgid "Clear Cache" +msgid "Clear CDN" +msgstr "Limpiar Caché" + +#: kinsta-mu-plugins/admin/pages/cdn.php:33 +msgid "" +"Manage your CDN settings, including minification and exclusions, on the " +"MyKinsta CDN settings page" +msgstr "" + +#: kinsta-mu-plugins/admin/pages/partials/sidebar-support.php:20 +msgid "Need Help?" +msgstr "Necesita Ayuda?" + +#: kinsta-mu-plugins/admin/pages/partials/sidebar-support.php:23 +msgid "If you need some help contact us through your MyKinsta Dashboard" +msgstr "" +"Si necesita ayuda, por favor contactarnos a través de su Escritorio MyKinsta" + +#: kinsta-mu-plugins/admin/pages/partials/sidebar-support.php:24 +msgid "Go To Dashboard" +msgstr "Escritorio MyKinsta" + +#: kinsta-mu-plugins/admin/pages/settings.php:26 +msgid "Disable Cache Autopurge" +msgstr "" + +#: kinsta-mu-plugins/admin/pages/settings.php:33 +#, fuzzy +#| msgid "Clear Caches" +msgid "Clear Cache For AMP Pages" +msgstr "Limpiar Caché" + +#: kinsta-mu-plugins/admin/pages/settings.php:40 +#, fuzzy +#| msgid "Learn more about banned plugins" +msgid "Allow banned plugins" +msgstr "Aprenda más sobre los plugins prohibidos" + +#: kinsta-mu-plugins/compat/third-party/swift-performance.php:27 +msgid "" +"We've detected that the SWIFT_PERFORMANCE_DISABLE_CACHE " +"constant has been set to false. This can cause cache issues for " +"your site. Please remove this constant from your site's wp-config.php file " +"or from the plugin or theme file where it has been defined." +msgstr "" + +#: kinsta-mu-plugins/compat/third-party/wordfence.php:26 +msgid "" +"We've detected that the WORDFENCE_DISABLE_LIVE_TRAFFIC constant " +"has been set to false. This can cause significant performance " +"issues for your site. Please remove this constant from your site's wp-config." +"php file or from the plugin or theme file where it has been defined." +msgstr "" + +#: kinsta-mu-plugins/compat/third-party/wp-rocket.php:32 +#, php-format +msgid "" +"Your WP Rocket version is out-of-date and not fully compatible with Kinsta. " +"%s" +msgstr "" + +#: kinsta-mu-plugins/compat/third-party/wp-rocket.php:44 +msgid "Please update WP Rocket on the Plugins page" +msgstr "" + +#: kinsta-mu-plugins/security/class-banned-plugins.php:242 +#: kinsta-mu-plugins/security/class-banned-plugins.php:278 +#: kinsta-mu-plugins/security/class-banned-plugins.php:367 +#: kinsta-mu-plugins/security/class-banned-plugins.php:370 +msgid "Banned" +msgstr "Prohibido" + +#: kinsta-mu-plugins/security/class-banned-plugins.php:332 +msgid "Kinsta detected a banned plugin" +msgid_plural "Kinsta detected banned plugins" +msgstr[0] "Kinsta detectó un plugin prohibido" +msgstr[1] "Kinsta detectó unos plugins prohibidos" + +#: kinsta-mu-plugins/security/class-banned-plugins.php:338 +#, php-format +msgid "" +"Please deactivate %s as soon as possible. Using a banned plugin can cause " +"performance issues for your site or compatibility issues with our hosting " +"platform." +msgstr "" +"Por favor desactive %s lo más pronto posible. Usar un plugin prohibido puede " +"causar problemas de rendimiento en tu sitio ó problemas de compatibilidad " +"con nuestra plataforma de alojamiento." + +#: kinsta-mu-plugins/security/class-banned-plugins.php:338 +#: kinsta-mu-plugins/security/class-banned-plugins.php:354 +msgid "this plugin" +msgid_plural "these plugins" +msgstr[0] "este plugin" +msgstr[1] "estos plugins" + +#: kinsta-mu-plugins/security/class-banned-plugins.php:341 +msgid "Learn more about banned plugins" +msgstr "Aprenda más sobre los plugins prohibidos" + +#: kinsta-mu-plugins/security/class-banned-plugins.php:346 +msgid "Banned plugin detected" +msgid_plural "Banned plugins detected" +msgstr[0] "Se ha detectado un Plugin Prohibido" +msgstr[1] "Se han detectado unos Plugins Prohibidos" + +#: kinsta-mu-plugins/security/class-banned-plugins.php:351 +msgid "" +"Using a banned plugin can cause performance issues for your site or " +"compatibility issues with the hosting platform." +msgstr "" +"Usar un plugin prohibido puede causar problemas de rendimiento en tu sitio o " +"problemas de compatibilidad con nuestra plataforma de alojamiento." + +#: kinsta-mu-plugins/security/class-banned-plugins.php:354 +#, php-format +msgid "Please deactivate %s as soon as possible." +msgstr "Por favor desactive %s lo más pronto posible." + +#: kinsta-mu-plugins/security/class-banned-plugins.php:383 +msgid "Why?" +msgstr "Por qué?" + +#: kinsta-mu-plugins/wp-cli/commands/class-cache-purge-command.php:109 +msgid "The Object Cache was purged." +msgstr "" + +#: kinsta-mu-plugins/wp-cli/commands/class-cache-purge-command.php:111 +msgid "Something went wrong! The Object Cache was not purged." +msgstr "" + +#. Plugin Name of the plugin/theme +msgid "Kinsta Must-use Plugins" +msgstr "Los Plugins de uso obligado en Kinsta" + +#. Plugin URI of the plugin/theme +msgid "https://kinsta.com/knowledgebase/kinsta-mu-plugin/" +msgstr "https://kinsta.com/es/ayuda/kinsta-mu-plugin/" + +#. Description of the plugin/theme +msgid "" +"The plugin designed to work on Kinsta's managed WordPress hosting platform." +msgstr "" + +#. Author of the plugin/theme +msgid "Kinsta Team" +msgstr "El Equipo Kinsta" + +#. Author URI of the plugin/theme +msgid "https://kinsta.com/about-us/" +msgstr "https://kinsta.com/es/sobre-nosotros/" + +#~ msgid "Custom URLs To Purge" +#~ msgstr "Direcciones URLs Personalizadas A Limpiar" + +#~ msgid "Clearing Caches..." +#~ msgstr "Limpiando Caché…" + +#~ msgid "Caches Cleared" +#~ msgstr "Caché borrado" + +#~ msgid "Clearing Full Page Cache..." +#~ msgstr "Limpiando El Caché De Página Completa…" + +#~ msgid "Cache Cleared" +#~ msgstr "Caché borrado" + +#~ msgid "Clear Full Page Cache Only" +#~ msgstr "Únicamente Limpiar El Caché De Página Completa" + +#~ msgid "Clearing Object Cache..." +#~ msgstr "Limpiando El Caché De Página Completa…" + +#~ msgid "Clear Object Cache Only" +#~ msgstr "Únicamente Limpiar El Caché de Objetos" + +#~ msgid "Clearing Cache..." +#~ msgstr "Limpiando Caché…" + +#~ msgid "Cache Settings" +#~ msgstr "Configuración de Caché" + +#~ msgid "Cache" +#~ msgstr "Caché" + +#~ msgid "" +#~ "Your site uses our full page caching technology to remain lightning fast. " +#~ "We purge single pages and key pages such as the home page immediately and " +#~ "impose a minimal throttle time on archive pages. This ensures high " +#~ "availability at all times." +#~ msgstr "" +#~ "Su sitio utiliza nuestra tecnología de caché de página completa para " +#~ "permanecer extremadamente rápido. Purgamos inmediatamente del caché " +#~ "páginas individuales y páginas clave como la página de inicio y luego " +#~ "imponemos un tiempo mínimo de de espera en las páginas de archivo. Esto " +#~ "garantiza una alta disponibilidad en todo momento." + +#~ msgid "Automatic cache purging has been disabled." +#~ msgstr "Se ha desactivado el borrado automático del caché." + +#, php-format +#~ msgid "" +#~ "This means that the page cache stored on the server will not be cleared " +#~ "automatically after a post or page is updated, deleted, or published. If " +#~ "you would like to enable automatic cache purging please remove the %1$s " +#~ "constant from your site's wp-config.php file or set its value to %2$s." +#~ msgstr "" +#~ "Esto significa que el caché de página que está almacenado en el servidor " +#~ "no se borrará automáticamente después de que un mensaje o página se " +#~ "actualice, elimine o publique. Si desea habilitar el borrado automático " +#~ "del caché, por favor remueva la constante %1$s del archivo wp-config.php " +#~ "de su sitio o establezca su valor a %2$s." + +#, php-format +#~ msgid "" +#~ "Kinsta CDN enabler is optimized for WordPress %1$s. Please disable CDN " +#~ "via %2$s or upgrade your WordPress installation (recommended)." +#~ msgstr "" +#~ "El activador del Kinsta CDN está optimizado para WordPress %1$s. Por " +#~ "favor desactive el CDN via %2$s o actualize su instalación de Wordpress " +#~ "(recomendado)." + +#~ msgid "Handles the purge of the server level caching." +#~ msgstr "Maneja el borrado del caché a nivel de servidor." diff --git a/kinsta-mu-plugins/shared/translations/kinsta-mu-plugins.pot b/kinsta-mu-plugins/admin/assets/translations/kinsta-mu-plugins.pot similarity index 99% rename from kinsta-mu-plugins/shared/translations/kinsta-mu-plugins.pot rename to kinsta-mu-plugins/admin/assets/translations/kinsta-mu-plugins.pot index 2d903a8..7b962d0 100644 --- a/kinsta-mu-plugins/shared/translations/kinsta-mu-plugins.pot +++ b/kinsta-mu-plugins/admin/assets/translations/kinsta-mu-plugins.pot @@ -11,7 +11,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 1.8.7\n" -"X-Poedit-Basepath: ../../..\n" +"X-Poedit-Basepath: ../../../..\n" "X-Poedit-WPHeader: kinsta-mu-plugins.php\n" "X-Poedit-SourceCharset: UTF-8\n" "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;" diff --git a/kinsta-mu-plugins/admin/class-kmp-admin.php b/kinsta-mu-plugins/admin/class-kmp-admin.php new file mode 100644 index 0000000..da0f67b --- /dev/null +++ b/kinsta-mu-plugins/admin/class-kmp-admin.php @@ -0,0 +1,369 @@ +kmp = $kmp; + $this->kinsta_cache = $kmp->kinsta_cache; + $this->view_role_or_capability = set_view_role_or_capability(); + add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) ); + + if ( KINSTAMU_WHITELABEL === false ) { + add_filter( 'admin_footer_text', array( $this, 'modify_admin_footer_text' ), 99 ); + } + // Admin Menu and Admin Toolbar. + add_action( 'admin_menu', array( $this, 'admin_menu_item' ) ); + add_action( 'admin_bar_menu', array( $this, 'admin_bar_item' ), 100 ); + + // Custom styling. + if ( KINSTAMU_WHITELABEL === false ) { + add_action( 'admin_head', array( $this, 'menu_icon_style' ) ); + } + + // Notice for successful cache clear. + add_action( 'admin_notices', array( $this, 'cleared_cache_notice' ) ); + + // Ajax actions for cache exclusion path management. + add_action( 'wp_ajax_kinsta_save_custom_path', array( $this, 'action_kinsta_save_custom_path' ) ); + add_action( 'wp_ajax_kinsta_remove_custom_path', array( $this, 'action_kinsta_remove_custom_path' ) ); + } + + /** + * Load assets in the Kinsta plugin setting page. + * + * @param string $page The page slug. + * @return void + */ + public function assets( $page ) { + if ( substr_count( $page, 'kinsta' ) === 0 ) { + return; + } + + wp_enqueue_style( 'kinsta-shared', $this->shared_resource_url( 'admin/assets/css/common.css' ), array(), '3.0.0' ); + } + + /** + * Fix missing recource issues with mu plugin's static files + * + * It was handled by " plugin_dir_url( __FILE__ )" before we switched to this + * + * @author Laci + * @version 1.2 + * @since 2.0.1 resource issue fixing + * + * @param string $path optional param which is added to the end of the returned string. + * @return string URL path of the kinsta-mu-plugins. + */ + public static function shared_resource_url( $path = '' ) { + $mu_url = ( is_ssl() ) ? str_replace( 'http://', 'https://', WPMU_PLUGIN_URL ) : WPMU_PLUGIN_URL; + $full_path = $mu_url . '/kinsta-mu-plugins/' . $path; + + if ( defined( 'KINSTAMU_CUSTOM_MUPLUGIN_URL' ) && KINSTAMU_CUSTOM_MUPLUGIN_URL !== '' ) { + $full_path = KINSTAMU_CUSTOM_MUPLUGIN_URL . '/kinsta-mu-plugins/' . $path; + } + + return $full_path; + } + + /** + * Modify Footer Text + * Modifies the thank you text in the bottom of the admin + * + * @since 1.0.0 + * @author Daniel Pataki + */ + public function modify_admin_footer_text() { + // Translators: %1$s WordPress, %2$s Kinsta URL. + return '' . sprintf( __( 'Thanks for creating with %1$s and hosting with %2$s', 'kinsta-mu-plugins' ), 'WordPress', 'Kinsta' ) . ''; + } + + /** + * Add main Kinsta Tools menu item. + */ + public function admin_menu_item() { + /** + * Filters whether or not Admin Menu item/page is visible. + * + * @param bool True to hide the Admin Menu item/page, false to show. Default is false. + */ + if ( apply_filters( 'kinsta_admin_disabled', false ) ) { + return; + } + + $icon = ( KINSTAMU_WHITELABEL === false ) ? 'none' : 'dashicons-admin-generic'; + $title = ( KINSTAMU_WHITELABEL === false ) ? __( 'Kinsta Cache', 'kinsta-mu-plugins' ) : __( 'Server Cache', 'kinsta-mu-plugins' ); + + add_menu_page( + $title, + $title, + $this->view_role_or_capability, + 'kinsta-tools', + array( $this, 'admin_cache_page' ), + $icon, + '3.19992919' + ); + + if ( $this->kmp->is_cdn_enabled() ) { + add_submenu_page( + 'kinsta-tools', + 'CDN', + 'CDN', + $this->view_role_or_capability, + 'kinsta-cdn', + array( $this, 'admin_cdn_page' ), + '3.19992919' + ); + + add_submenu_page( + 'kinsta-tools', + 'Settings', + 'Settings', + $this->view_role_or_capability, + 'kinsta-settings', + array( $this, 'admin_settings_page' ), + '3.19992919' + ); + } + } + + /** + * Add Admin Toolbar menu. + * + * @param object $wp_admin_bar WP_Admin_Bar object. + * + * @return void + */ + public function admin_bar_item( $wp_admin_bar ) { + /** + * Filters whether or not Admin Menu item/page is visible. + * + * @param bool True to hide the Admin Menu item/page, false to show. Default is false. + */ + if ( apply_filters( 'kinsta_admin_disabled', false ) || ! current_user_can( $this->view_role_or_capability ) ) { + return; + } + + load_muplugin_textdomain( 'kinsta-mu-plugins', dirname( plugin_basename( __FILE__ ) ) . '/assets/translations' ); + + $wp_admin_bar->add_node( + array( + 'id' => 'kinsta-cache', + 'title' => __( 'Clear Caches', 'kinsta-mu-plugins' ), + 'meta' => array( + 'title' => __( 'Clear Caches', 'kinsta-mu-plugins' ), + 'tabindex' => 0, + ), + 'parent' => 'top-secondary', + ) + ); + + $wp_admin_bar->add_node( + array( + 'id' => 'kinsta-cache-all', + 'title' => __( 'Clear All Caches', 'kinsta-mu-plugins' ), + 'href' => wp_nonce_url( admin_url( 'admin.php?page=kinsta-tools&clear-cache=kinsta-clear-cache-all' ), 'kinsta-clear-cache-admin-bar', 'kinsta_nonce' ), + 'parent' => 'kinsta-cache', + ) + ); + + $wp_admin_bar->add_node( + array( + 'id' => 'kinsta-cache-full-page', + 'title' => __( 'Clear Site Cache', 'kinsta-mu-plugins' ), + 'href' => wp_nonce_url( admin_url( 'admin.php?page=kinsta-tools&clear-cache=kinsta-clear-site-cache' ), 'kinsta-clear-cache-admin-bar', 'kinsta_nonce' ), + 'parent' => 'kinsta-cache', + ) + ); + + if ( $this->kmp->is_cdn_enabled() ) { + $wp_admin_bar->add_node( + array( + 'id' => 'kinsta-cache-cdn', + 'title' => __( 'Clear CDN Cache', 'kinsta-mu-plugins' ), + 'href' => wp_nonce_url( admin_url( 'admin.php?page=kinsta-tools&clear-cache=kinsta-clear-cdn' ), 'kinsta-clear-cache-admin-bar', 'kinsta_nonce' ), + 'parent' => 'kinsta-cache', + ) + ); + } + + $wp_admin_bar->add_node( + array( + 'id' => 'kinsta-cache-object', + 'title' => __( 'Clear Object Cache', 'kinsta-mu-plugins' ), + 'href' => wp_nonce_url( admin_url( 'admin.php?page=kinsta-tools&clear-cache=kinsta-clear-object-cache' ), 'kinsta-clear-cache-admin-bar', 'kinsta_nonce' ), + 'parent' => 'kinsta-cache', + ) + ); + } + + /** + * Load the menu page. + * + * @return void + */ + public function admin_settings_page() { + include plugin_dir_path( __FILE__ ) . 'pages/settings.php'; + } + + /** + * Load the menu page. + * + * @return void + */ + public function admin_cache_page() { + include plugin_dir_path( __FILE__ ) . 'pages/cache.php'; + } + + /** + * Load the menu page. + * + * @return void + */ + public function admin_cdn_page() { + include plugin_dir_path( __FILE__ ) . 'pages/cdn.php'; + } + + /** + * Show Kinsta menu icon. + * + * @return void + */ + public function menu_icon_style() { + ?> + + +
+

+
+ +
+

+
+ +
+

+
+ sanitize_text_field( $_POST['path'] ), + 'type' => sanitize_text_field( wp_unslash( $_POST['type'] ) ), + ); + $paths = array_values( $paths ); + + update_option( 'kinsta-cache-additional-paths', $paths ); + + die(); + } + + /** + * AJAX action to remove custom path. + * + * @return void + */ + public function action_kinsta_remove_custom_path() { + check_ajax_referer( 'save_plugin_options', 'kinsta_nonce' ); + if ( ! isset( $_POST['index'] ) || ( isset( $_POST['index'] ) && is_int( $_POST['index'] ) ) ) { + return; + } + + $index = sanitize_text_field( wp_unslash( $_POST['index'] ) ); + $paths = get_option( 'kinsta-cache-additional-paths' ); + if ( ! empty( $paths[ $index ] ) ) { + unset( $paths[ $index ] ); + } + + if ( count( $paths ) === 0 ) { + delete_option( 'kinsta-cache-additional-paths' ); + } else { + $paths = array_values( $paths ); + update_option( 'kinsta-cache-additional-paths', $paths ); + } + + die(); + } +} diff --git a/kinsta-mu-plugins/admin/pages/cache.php b/kinsta-mu-plugins/admin/pages/cache.php new file mode 100644 index 0000000..0046fea --- /dev/null +++ b/kinsta-mu-plugins/admin/pages/cache.php @@ -0,0 +1,207 @@ + + +
+
+
+
+

+
+
+

+ +
+
+
+
+
+

+
+
+

+ +
+
+
+
+
+

+
+
+

+ +
+
+
+
+
+

+
+
+

+ array( + 'href' => true, + 'target' => '_blank', + ), + ) + ), + '' . esc_html__( 'documentation', 'kinsta-mu-plugins' ) . '' + ); + else : + echo esc_html_e( 'You can add custom paths to purge whenever your site is updated.', 'kinsta-mu-plugins' ); + endif; + ?> +

+
+

+
+
+ + '> +
+ 45 ) ? ' isLong' : ''; + + $prefix_display = ( $prefix_length > 45 ) ? substr( $prefix_title, 0, 20 ) . '...' . substr( $prefix_title, -20 ) : $prefix_title; + + $prefix_extra_class = $prefix_islong; + ?> + + +
+ '; + echo 'TypePathAction'; + echo ''; + + if ( ! empty( $additional_paths ) ) { + foreach ( $additional_paths as $additional_path ) { + echo ''; + echo '' . esc_html( $additional_path['type'] ) . ''; + echo '/' . esc_html( $additional_path['path'] ) . ''; + echo 'remove'; + echo ''; + } + } + echo ''; + echo ''; + ?> + + + + +
+
+
+
+
+
+

+
+
+

+ + + + + +
+
+ + +
+
+ diff --git a/kinsta-mu-plugins/admin/pages/cdn.php b/kinsta-mu-plugins/admin/pages/cdn.php new file mode 100644 index 0000000..aa29690 --- /dev/null +++ b/kinsta-mu-plugins/admin/pages/cdn.php @@ -0,0 +1,56 @@ + +
+
+
+
+

Clear CDN Cache

+
+
+

+ +
+
+
+
+
+

Manage CDN Settings

+
+ +
+ + +
+
+ diff --git a/kinsta-mu-plugins/admin/pages/partials/sidebar-support.php b/kinsta-mu-plugins/admin/pages/partials/sidebar-support.php new file mode 100644 index 0000000..f4ef81a --- /dev/null +++ b/kinsta-mu-plugins/admin/pages/partials/sidebar-support.php @@ -0,0 +1,26 @@ + +
+
+
+

+
+
+

+ +
+
diff --git a/kinsta-mu-plugins/admin/pages/settings.php b/kinsta-mu-plugins/admin/pages/settings.php new file mode 100644 index 0000000..c36a09c --- /dev/null +++ b/kinsta-mu-plugins/admin/pages/settings.php @@ -0,0 +1,65 @@ + +
+
+
+
+

Kinsta Settings

+
+
+

+ + + Only disable if your site is having trouble importing posts +

+

+ + + Enable this to clear AMP cache on page save +

+

+ + + Allow installing plugins that are banned for performance reasons. This might slow down your site! +

+
+
+ + +
+
+ diff --git a/kinsta-mu-plugins/cache/cache.php b/kinsta-mu-plugins/cache/cache.php deleted file mode 100644 index e5a0ca2..0000000 --- a/kinsta-mu-plugins/cache/cache.php +++ /dev/null @@ -1,44 +0,0 @@ - 'kinsta-cache-settings', - 'immediate_path' => 'https://localhost/kinsta-clear-cache/v2/immediate', - 'throttled_path' => 'https://localhost/kinsta-clear-cache/v2/throttled', -); - -$default_settings = array( - 'version' => '2.0', - 'options' => array( - 'additional_paths' => array( - 'group' => array(), - 'single' => array(), - ), - ), - 'rules' => array(), -); - -$kinsta_cache = new Cache( $config, $default_settings ); - -// Backward compatible, WP Rocket plugin version 3.0.1 caused fatal error without this. -$KinstaCache = $kinsta_cache; // phpcs:ignore diff --git a/kinsta-mu-plugins/cache/class-cache-admin.php b/kinsta-mu-plugins/cache/class-cache-admin.php deleted file mode 100644 index 93c6684..0000000 --- a/kinsta-mu-plugins/cache/class-cache-admin.php +++ /dev/null @@ -1,282 +0,0 @@ -kinsta_cache = $kinsta_cache; - $this->kinsta_cache_purge = $this->kinsta_cache->kinsta_cache_purge; - $this->view_role_or_capability = $this->set_view_role_or_capability(); - - // Admin Menu and Admin Toolbar. - add_action( 'admin_menu', array( $this, 'admin_menu_item' ) ); - add_action( 'admin_bar_menu', array( $this, 'admin_bar_item' ), 100 ); - - // Custom styling. - if ( KINSTAMU_WHITELABEL === false ) { - add_action( 'admin_head', array( $this, 'menu_icon_style' ) ); - } - - // Notice for successful cache clear. - add_action( 'admin_notices', array( $this, 'cleared_cache_notice' ) ); - - // Ajax actions for cache exclusion path management. - add_action( 'wp_ajax_kinsta_save_custom_path', array( $this, 'action_kinsta_save_custom_path' ) ); - add_action( 'wp_ajax_kinsta_remove_custom_path', array( $this, 'action_kinsta_remove_custom_path' ) ); - } - - /** - * Add main Kinsta Tools menu item. - */ - public function admin_menu_item() { - /** - * Filters whether or not Admin Menu item/page is visible. - * - * @param bool True to hide the Admin Menu item/page, false to show. Default is false. - */ - if ( apply_filters( 'kinsta_admin_disabled', false ) ) { - return; - } - - $icon = ( KINSTAMU_WHITELABEL === false ) ? 'none' : 'dashicons-admin-generic'; - $title = ( KINSTAMU_WHITELABEL === false ) ? __( 'Kinsta Cache', 'kinsta-mu-plugins' ) : __( 'Cache Settings', 'kinsta-mu-plugins' ); - - add_menu_page( - $title, - $title, - $this->view_role_or_capability, - 'kinsta-tools', - array( $this, 'admin_menu_page' ), - $icon, - '3.19992919' - ); - } - - /** - * Add Admin Toolbar menu. - * - * @param object $wp_admin_bar WP_Admin_Bar object. - * - * @return void - */ - public function admin_bar_item( $wp_admin_bar ) { - /** - * Filters whether or not Admin Menu item/page is visible. - * - * @param bool True to hide the Admin Menu item/page, false to show. Default is false. - */ - if ( apply_filters( 'kinsta_admin_disabled', false ) || ! current_user_can( $this->view_role_or_capability ) ) { - return; - } - - if ( $this->kinsta_cache->has_object_cache ) { - $wp_admin_bar->add_node( - array( - 'id' => 'kinsta-cache', - 'title' => __( 'Clear Cache', 'kinsta-mu-plugins' ), - 'meta' => array( - 'title' => __( 'Clear Cache', 'kinsta-mu-plugins' ), - 'tabindex' => 0, - ), - 'parent' => 'top-secondary', - ) - ); - - $wp_admin_bar->add_node( - array( - 'id' => 'kinsta-cache-all', - 'title' => 'Clear All Caches', - 'href' => wp_nonce_url( admin_url( 'admin.php?page=kinsta-tools&clear-cache=kinsta-clear-cache-all' ), 'kinsta-clear-cache-admin-bar', 'kinsta_nonce' ), - 'parent' => 'kinsta-cache', - ) - ); - - $wp_admin_bar->add_node( - array( - 'id' => 'kinsta-cache-full-page', - 'title' => 'Clear Full Page Cache', - 'href' => wp_nonce_url( admin_url( 'admin.php?page=kinsta-tools&clear-cache=kinsta-clear-cache-full-page' ), 'kinsta-clear-cache-admin-bar', 'kinsta_nonce' ), - 'parent' => 'kinsta-cache', - ) - ); - - $wp_admin_bar->add_node( - array( - 'id' => 'kinsta-cache-object', - 'title' => 'Clear Object Cache', - 'href' => wp_nonce_url( admin_url( 'admin.php?page=kinsta-tools&clear-cache=kinsta-clear-cache-object' ), 'kinsta-clear-cache-admin-bar', 'kinsta_nonce' ), - 'parent' => 'kinsta-cache', - ) - ); - } else { - $wp_admin_bar->add_node( - array( - 'id' => 'kinsta-cache', - 'title' => __( 'Clear Cache', 'kinsta-mu-plugins' ), - 'href' => wp_nonce_url( admin_url( 'admin.php?page=kinsta-tools&clear-cache=kinsta-clear-cache-full-page' ), 'kinsta-clear-cache-admin-bar', 'kinsta_nonce' ), - 'meta' => array( 'title' => __( 'Clear Cache', 'kinsta-mu-plugins' ) ), - 'parent' => 'top-secondary', - ) - ); - } - } - - /** - * Load the menu page. - * - * @return void - */ - public function admin_menu_page() { - include plugin_dir_path( __FILE__ ) . 'pages/pages.php'; - } - - /** - * Show Kinsta menu icon. - * - * @return void - */ - public function menu_icon_style() { - ?> - - -
-

-
- sanitize_text_field( $_POST['path'] ), - 'type' => sanitize_text_field( wp_unslash( $_POST['type'] ) ), - ); - $paths = array_values( $paths ); - - update_option( 'kinsta-cache-additional-paths', $paths ); - - die(); - } - - /** - * AJAX action to remove custom path. - * - * @return void - */ - public function action_kinsta_remove_custom_path() { - check_ajax_referer( 'save_plugin_options', 'kinsta_nonce' ); - if ( ! isset( $_POST['index'] ) || ( isset( $_POST['index'] ) && is_int( $_POST['index'] ) ) ) { - return; - } - - $index = sanitize_text_field( wp_unslash( $_POST['index'] ) ); - $paths = get_option( 'kinsta-cache-additional-paths' ); - if ( ! empty( $paths[ $index ] ) ) { - unset( $paths[ $index ] ); - } - - if ( count( $paths ) === 0 ) { - delete_option( 'kinsta-cache-additional-paths' ); - } else { - $paths = array_values( $paths ); - update_option( 'kinsta-cache-additional-paths', $paths ); - } - - die(); - } - - /** - * Sets the required capability to view and use the cache purging options. - * - * @return string the required capability - */ - private function set_view_role_or_capability() { - if ( defined( 'KINSTAMU_ROLE' ) && is_string( KINSTAMU_ROLE ) ) { - return esc_attr( KINSTAMU_ROLE ); - } - return 'manage_options'; - } - -} diff --git a/kinsta-mu-plugins/cache/class-cache-purge.php b/kinsta-mu-plugins/cache/class-cache-purge.php index b89c914..4b0e731 100644 --- a/kinsta-mu-plugins/cache/class-cache-purge.php +++ b/kinsta-mu-plugins/cache/class-cache-purge.php @@ -37,11 +37,11 @@ class Cache_Purge { public $posts_page_url; /** - * Kinsta Cache Object. + * KMP Object. * * @var object */ - public $kinsta_cache; + public $kmp; /** * Number of pages at home or archive page to purge. @@ -69,10 +69,10 @@ class Cache_Purge { * * Detect actions that causes content to changes root. * - * @param object $kinsta_cache Kinsta Cache object. + * @param object $kmp KMP object. */ - public function __construct( $kinsta_cache = false ) { - if ( false === $kinsta_cache ) { + public function __construct( $kmp = false ) { + if ( false === $kmp ) { return; } @@ -80,7 +80,8 @@ public function __construct( $kinsta_cache = false ) { global $wp_rewrite; global $wp_version; - $this->kinsta_cache = $kinsta_cache; + $this->kmp = $kmp; + $this->kinsta_cache = $kmp->kinsta_cache; $this->posts_page_id = get_option( 'page_for_posts' ); $this->posts_page_url = ( ! empty( $this->posts_page_id ) && ! empty( $wp_rewrite ) && null !== $wp_rewrite ) ? get_permalink( $this->posts_page_id ) : false; $this->immediate_depth = 3; @@ -88,12 +89,13 @@ public function __construct( $kinsta_cache = false ) { $this->purge_all_happened = false; // Ajax actions for cache clearing. - add_action( 'wp_ajax_kinsta_clear_cache_all', array( $this, 'action_kinsta_clear_cache_all' ) ); - add_action( 'wp_ajax_kinsta_clear_cache_full_page', array( $this, 'action_kinsta_clear_cache_full_page' ) ); - add_action( 'wp_ajax_kinsta_clear_cache_object', array( $this, 'action_kinsta_clear_cache_object' ) ); + add_action( 'wp_ajax_kinsta_clear_all_cache', array( $this, 'action_kinsta_clear_all_cache' ) ); + add_action( 'wp_ajax_kinsta_clear_site_cache', array( $this, 'action_kinsta_clear_site_cache' ) ); + add_action( 'wp_ajax_kinsta_clear_object_cache', array( $this, 'action_kinsta_clear_object_cache' ) ); // Cache clear for Admin Toolbar. add_action( 'admin_init', array( $this, 'clear_cache_admin_bar' ) ); + add_action( 'admin_init', array( $this, 'set_autopurge_option' ) ); // Comment actions. add_action( 'edit_comment', array( $this, 'comment_edit_actions' ), 10, 2 ); @@ -230,11 +232,12 @@ public function comment_insert_actions( $comment_id, $comment ) { * Figures out if a comment is edited/updated and initiates a cache purge with the post. * * @param int $comment_id The comment's ID. - * @param WP_Comment $comment The comment data. + * @param array $data The comment data. * * @return void */ - public function comment_edit_actions( $comment_id, $comment ) { + public function comment_edit_actions( $comment_id, $data ) { + $comment = get_comment( $comment_id ); if ( 1 === (int) $comment->comment_approved ) { $this->initiate_purge( $comment->comment_post_ID ); } @@ -247,6 +250,7 @@ public function comment_edit_actions( $comment_id, $comment ) { */ public function purge_complete_object_cache() { $response = wp_cache_flush(); + opcache_reset(); return $response; } @@ -255,7 +259,7 @@ public function purge_complete_object_cache() { * * @return void **/ - public function purge_complete_full_page_cache() { + public function purge_complete_site_cache() { if ( $this->purge_all_happened ) { return; } @@ -279,11 +283,8 @@ public function purge_complete_full_page_cache() { * @return void */ public function purge_complete_caches() { - if ( defined( 'KINSTAMU_DISABLE_AUTOPURGE' ) && KINSTAMU_DISABLE_AUTOPURGE === true ) { - return; - } $this->purge_complete_object_cache(); - $this->purge_complete_full_page_cache(); + $this->purge_complete_site_cache(); // Hook that fires after page and object cache is cleared. do_action( 'kinsta_purge_complete_caches_happened' ); @@ -297,7 +298,7 @@ public function purge_complete_caches() { * @return array the result of the wp_remote_post action **/ public function initiate_purge( $post_id ) { - if ( defined( 'KINSTAMU_DISABLE_AUTOPURGE' ) && KINSTAMU_DISABLE_AUTOPURGE === true ) { + if ( ( defined( 'KINSTAMU_DISABLE_AUTOPURGE' ) && KINSTAMU_DISABLE_AUTOPURGE === true ) || get_option( 'kinsta-autopurge-status') === 'disabled' ) { return false; } @@ -315,12 +316,9 @@ public function initiate_purge( $post_id ) { ), ); - // Immediately remove first three pages of archives. + // Immediately remove first page of archives. foreach ( $archives['group'] as $key => $url ) { $purge_list['immediate']['single'][ $key ] = $url; - for ( $i = 2; $i <= $this->immediate_depth; $i++ ) { - $purge_list['immediate']['single'][ $key . '_' . $i ] = $url . 'page/' . $i . '/'; - } } $purge_list['immediate']['group']['singular_post'] = get_permalink( $post_id ); @@ -328,18 +326,8 @@ public function initiate_purge( $post_id ) { if ( ! empty( $this->posts_page_url ) ) { $purge_list['immediate']['single']['home_page'] = home_url() . '/'; $purge_list['immediate']['single']['blog_page'] = $this->posts_page_url; - for ( $i = 2; $i <= $this->immediate_depth; $i++ ) { - $purge_list['immediate']['single'][ 'blog_page_' . $i ] = $this->posts_page_url . '/page/' . $i . '/'; - } - - $purge_list['throttled']['group']['blog_page'] = $purge_list['immediate']['single']['home_page'] . '/page/'; } else { $purge_list['immediate']['single']['home_blog_page'] = home_url() . '/'; - for ( $i = 2; $i <= $this->immediate_depth; $i++ ) { - $purge_list['immediate']['single'][ 'home_blog_page_' . $i ] = home_url() . '/page/' . $i . '/'; - } - - $purge_list['throttled']['group']['home_blog_page'] = $purge_list['immediate']['single']['home_blog_page'] . '/page/'; } if ( ! empty( $purge_list['throttled']['single']['post_type'] ) ) { @@ -363,11 +351,7 @@ public function initiate_purge( $post_id ) { // Add related sitemaps. $purge_list['throttled']['group']['sitemap'] = home_url() . '/sitemap'; // Add feed purging. - $purge_list['immediate']['single']['feed'] = home_url() . '/feed/'; - $purge_list['immediate']['single']['feed_rss'] = home_url() . '/feed/rss/'; - $purge_list['immediate']['single']['feed_rss2'] = home_url() . '/feed/rss2/'; - $purge_list['immediate']['single']['feed_rdf'] = home_url() . '/feed/rdf/'; - $purge_list['immediate']['single']['feed_atom'] = home_url() . '/feed/atom/'; + $purge_list['immediate']['group']['feed'] = home_url() . '/feed/'; // Add AMP immediate single requests. foreach ( $purge_list['immediate']['single'] as $key => $value ) { @@ -390,8 +374,6 @@ public function initiate_purge( $post_id ) { $result['requests'] = $purge_request; - $is_cache_debug = ( defined( 'KINSTA_CACHE_DEBUG' ) ) ? KINSTA_CACHE_DEBUG : false; - $result['response'] = array( 'immediate' => $this->send_cache_purge_request( $this->kinsta_cache->config['immediate_path'], $purge_request['immediate'] ), 'throttled' => $this->send_cache_purge_request( $this->kinsta_cache->config['throttled_path'], $purge_request['throttled'] ), @@ -400,12 +382,8 @@ public function initiate_purge( $post_id ) { // Hook that fires after specific event purges cache. do_action( 'kinsta_initiate_purge_happened' ); - if ( $is_cache_debug ) { - echo '
';
-			print_r( $purge_request );
-			var_dump( $result['response'] );
-			echo '
'; - exit(); + if ( defined( 'KINSTA_CACHE_DEBUG' ) && KINSTA_CACHE_DEBUG === true ) { + $testing = file_put_contents('request-debug.log', json_encode( $purge_request ), FILE_APPEND); } return $result; } @@ -499,17 +477,13 @@ public function get_post_archives_list( $post ) { $year = get_the_date( 'Y', $post ); $month = get_the_date( 'm', $post ); $day = get_the_date( 'd', $post ); - $purge['single']['year'] = get_year_link( $year ); - $purge['single']['month'] = get_month_link( $year, $month ); - $purge['single']['day'] = get_day_link( $year, $month, $day ); - $purge['group']['year'] = $purge['single']['year'] . 'page/'; - $purge['group']['month'] = $purge['single']['month'] . 'page/'; - $purge['group']['day'] = $purge['single']['day'] . 'page/'; + $purge['group']['year'] = get_year_link( $year ); + $purge['group']['month'] = get_month_link( $year, $month ); + $purge['group']['day'] = get_day_link( $year, $month, $day ); $post_type_archive = get_post_type_archive_link( $post->post_type ); if ( ! ( home_url() === $post_type_archive || $post_type_archive === $this->posts_page_url ) ) { - $purge['single']['post_type'] = $post_type_archive; - $purge['group']['post_type'] = $post_type_archive . 'page/'; + $purge['group']['post_type'] = $post_type_archive; } return array_filter( $purge ); @@ -520,8 +494,8 @@ public function get_post_archives_list( $post ) { * * @return void */ - public function action_kinsta_clear_cache_all() { - check_ajax_referer( 'kinsta-clear-cache-all', 'kinsta_nonce' ); + public function action_kinsta_clear_all_cache() { + check_ajax_referer( 'kinsta-clear-all-cache', 'kinsta_nonce' ); $this->purge_complete_caches(); @@ -533,10 +507,10 @@ public function action_kinsta_clear_cache_all() { * * @return void */ - public function action_kinsta_clear_cache_full_page() { - check_ajax_referer( 'kinsta-clear-cache-full-page', 'kinsta_nonce' ); + public function action_kinsta_clear_site_cache() { + check_ajax_referer( 'kinsta-clear-site-cache', 'kinsta_nonce' ); - $this->purge_complete_full_page_cache(); + $this->purge_complete_site_cache(); die(); } @@ -546,8 +520,8 @@ public function action_kinsta_clear_cache_full_page() { * * @return void */ - public function action_kinsta_clear_cache_object() { - check_ajax_referer( 'kinsta-clear-cache-object', 'kinsta_nonce' ); + public function action_kinsta_clear_object_cache() { + check_ajax_referer( 'kinsta-clear-object-cache', 'kinsta_nonce' ); $this->purge_complete_object_cache(); @@ -565,12 +539,47 @@ public function clear_cache_admin_bar() { } check_admin_referer( 'kinsta-clear-cache-admin-bar', 'kinsta_nonce' ); - if ( 'kinsta-clear-cache-all' === $_GET['clear-cache'] ) { + if ( 'kinsta-clear-all-cache' === $_GET['clear-cache'] ) { + $this->purge_complete_caches(); + } elseif ( 'kinsta-clear-object-cache' === $_GET['clear-cache'] ) { + $this->purge_complete_object_cache(); + } elseif ( 'kinsta-clear-site-cache' === $_GET['clear-cache'] ) { + $this->purge_complete_site_cache(); + } else { + return; + } + + if ( empty( wp_get_referer() ) ) { + $query_vars = array( + 'page' => 'kinsta-tools', + 'kinsta-cache-cleared' => 'true', + ); + $redirect_url = add_query_arg( $query_vars, admin_url( 'admin.php' ) ); + } else { + $redirect_url = add_query_arg( 'kinsta-cache-cleared', 'true', wp_get_referer() ); + } + + wp_safe_redirect( $redirect_url ); + exit; + } + + /** + * * Function to handle Admin page cache clear requests. + * * + * * @return void + */ + public function clear_cache_admin_page() { + if ( empty( $_GET['page'] ) || empty( $_GET['clear-cache'] ) || ( ! empty( $_GET['page'] ) && 'kinsta-tools' !== $_GET['page'] ) ) { + return; + } + check_admin_referer( 'kinsta-clear-cache-admin-bar', 'kinsta_nonce' ); + + if ( 'kinsta-clear-all-cache' === $_GET['clear-cache'] ) { $this->purge_complete_caches(); - } elseif ( 'kinsta-clear-cache-object' === $_GET['clear-cache'] ) { + } elseif ( 'kinsta-clear-object-cache' === $_GET['clear-cache'] ) { $this->purge_complete_object_cache(); - } elseif ( 'kinsta-clear-cache-full-page' === $_GET['clear-cache'] ) { - $this->purge_complete_full_page_cache(); + } elseif ( 'kinsta-clear-site-cache' === $_GET['clear-cache'] ) { + $this->purge_complete_site_cache(); } else { return; } @@ -588,5 +597,36 @@ public function clear_cache_admin_bar() { wp_safe_redirect( $redirect_url ); exit; } + /** + * * Function to handle Admin Bar cache clear requests. + * * + * * @return void + */ + public function set_autopurge_option() { + if ( empty( $_GET['page'] ) || empty( $_GET['cache-autopurge'] ) || ( ! empty( $_GET['page'] ) && 'kinsta-tools' !== $_GET['page'] ) ) { + return; + } + check_admin_referer( 'kinsta-autopurge-toggle', 'kinsta_nonce' ); + if ( 'disable' === $_GET['cache-autopurge'] ) { + update_option( 'kinsta-autopurge-status', 'disabled' ); + } elseif ( 'enable' === $_GET['cache-autopurge'] ) { + update_option( 'kinsta-autopurge-status', 'enabled' ); + } else { + return; + } + + if ( empty( wp_get_referer() ) ) { + $query_vars = array( + 'page' => 'kinsta-tools', + 'kinsta-autopurge-updated' => ( $_GET['cache-autopurge'] === 'enable') ? 'enabled' : 'disabled', + ); + $redirect_url = add_query_arg( $query_vars, admin_url( 'admin.php' ) ); + } else { + $redirect_url = add_query_arg( 'kinsta-autopurge-updated', ( $_GET['cache-autopurge'] === 'enable') ? 'enabled' : 'disabled', wp_get_referer() ); + } + + wp_safe_redirect( $redirect_url ); + exit; + } } diff --git a/kinsta-mu-plugins/cache/class-cache.php b/kinsta-mu-plugins/cache/class-cache.php index 2540c08..1003fa5 100644 --- a/kinsta-mu-plugins/cache/class-cache.php +++ b/kinsta-mu-plugins/cache/class-cache.php @@ -25,26 +25,11 @@ class Cache { /** - * Cache_Admin instance. + * The kmp class. * - * @var Cache_Admin + * @var \Kinsta\KMP */ - public $kinsta_cache_admin; - - /** - * Cache_Purge instance. - * - * @var Cache_Purge - */ - public $kinsta_cache_purge; - - /** - * Backward compatible Cache_Purge instance. - * WP Rocket version 3.0.1 caused fatal error without this. - * - * @var Cache_Purge - */ - public $KinstaCachePurge; // phpcs:ignore + public $kmp; /** * The cache configuration. @@ -80,45 +65,28 @@ class Cache { /** * Class constructor. * - * @param array $config The cache configuration. - * @param array $default_settings The cache default settings. + * @param \Kinsta\KMP $kmp The KMP object. */ - public function __construct( $config = false, $default_settings = false ) { - if ( empty( $config ) || empty( $default_settings ) ) { - return; - } - + public function __construct( \Kinsta\KMP $kmp ) { // Set our class variables. - $this->config = $config; - $this->default_settings = $default_settings; + $this->kmp = $kmp; + $this->config = array( + 'option_name' => 'kinsta-cache-settings', + 'immediate_path' => 'https://localhost/kinsta-clear-cache/v2/immediate', + 'throttled_path' => 'https://localhost/kinsta-clear-cache/v2/throttled', + ); + $this->default_settings = array( + 'version' => '2.0', + 'options' => array( + 'additional_paths' => array( + 'group' => array(), + 'single' => array(), + ), + ), + 'rules' => array(), + ); $this->set_settings(); $this->set_has_object_cache(); - - // Init the cache classes. - add_action( 'init', array( $this, 'init_cache' ), 5 ); - - // Removing other cache systems. - add_filter( 'do_rocket_generate_caching_files', '__return_false', 999 ); // Disable WP rocket caching. - } - - /** - * Init the Caching when the WP is initialised, this is to ensure that the classes, global variables, and WordPress core functions are ready. - * - * @since 2.0.16 - * - * @return void - */ - public function init_cache() { - $this->kinsta_cache_purge = new Cache_Purge( $this ); -$this->KinstaCachePurge = $this->kinsta_cache_purge; // phpcs:ignore - $this->kinsta_cache_admin = new Cache_Admin( $this ); - - /** - * Hook that fires after cache classes are initialized. - * - * @param Cache $this Instance of the Cache class. - */ - do_action( 'kinsta_cache_init', $this ); } /** @@ -149,7 +117,7 @@ public function set_settings() { $settings = get_option( $this->config['option_name'] ); // If there are no settings yet, save the default ones. - if ( empty( $settings ) ) { + if ( empty( $settings ) || gettype( $settings ) !== 'object' ) { // Make the settings available to the class. $this->settings = $this->default_settings; // Save initial settings. @@ -184,5 +152,4 @@ public function set_settings() { // Make the settings available to the class. $this->settings = $settings; } - } diff --git a/kinsta-mu-plugins/cache/pages/pages.php b/kinsta-mu-plugins/cache/pages/pages.php deleted file mode 100644 index 14e3968..0000000 --- a/kinsta-mu-plugins/cache/pages/pages.php +++ /dev/null @@ -1,94 +0,0 @@ - -
-
- - /images/logo-dark.svg' height='16px'> - - - -

-
-
-
-
- kinsta_cache->has_object_cache ) : ?> - - - - - -
-
-
-
- -

- -

- -
-
-
- kinsta_cache->has_object_cache ) : ?> -

- -

- -

- ' . __( 'Automatic cache purging has been disabled.', 'kinsta-mu-plugins' ) . ''; - // Translators: %1$s KINSTAMU_DISABLE_AUTOPURGE, %2$s false. - $warning_msg .= sprintf( __( 'This means that the page cache stored on the server will not be cleared automatically after a post or page is updated, deleted, or published. If you would like to enable automatic cache purging please remove the %1$s constant from your site\'s wp-config.php file or set its value to %2$s.', 'kinsta-mu-plugins' ), 'KINSTAMU_DISABLE_AUTOPURGE', 'false' ); - ?> -
- true, - 'code' => true, - ) - ); - ?> -
- -
- -
-
-
-
-
- diff --git a/kinsta-mu-plugins/cache/pages/partials/settings-form.php b/kinsta-mu-plugins/cache/pages/partials/settings-form.php deleted file mode 100644 index 0e0cc24..0000000 --- a/kinsta-mu-plugins/cache/pages/partials/settings-form.php +++ /dev/null @@ -1,152 +0,0 @@ - -
-
-
-

-

- array( - 'href' => true, - 'target' => '_blank', - ), - ) - ), - '' . esc_html__( 'documentation', 'kinsta-mu-plugins' ) . '' - ); - else : - echo esc_html_e( 'You can add custom paths to purge whenever your site is updated.', 'kinsta-mu-plugins' ); - endif; - ?> -

- -
-

Add A Custom URL

-
- 'Single Path', - 'group' => 'Group Path', - ), - false - ); - $prefix_title = home_url( '/' ); - $prefix_scheme = ( strpos( home_url(), 'https://' ) !== false ) ? 'https' : 'http'; - $prefix_length = strlen( $prefix_title ); - $prefix_islong = ( $prefix_length > 45 ) ? ' isLong' : ''; - - $prefix_display = ( $prefix_length > 45 ) ? substr( $prefix_title, 0, 20 ) . '...' . substr( $prefix_title, -20 ) : $prefix_title; - - $prefix_extra_class = $prefix_islong; - ?> - - -
-
- - '; - echo 'TypePath'; - echo ''; - - if ( ! empty( $additional_paths ) ) { - foreach ( $additional_paths as $additional_path ) { - echo ''; - echo '' . esc_html( $additional_path['type'] ) . ''; - echo '/' . esc_html( $additional_path['path'] ) . ''; - echo 'remove'; - echo ''; - } - } - echo ''; - echo ''; - ?> -
-
- - - - -
diff --git a/kinsta-mu-plugins/cache/pages/partials/sidebar-purge-has-object-cache.php b/kinsta-mu-plugins/cache/pages/partials/sidebar-purge-has-object-cache.php deleted file mode 100644 index 546ece6..0000000 --- a/kinsta-mu-plugins/cache/pages/partials/sidebar-purge-has-object-cache.php +++ /dev/null @@ -1,30 +0,0 @@ - - -
-
- -
- - - - - -
-
-
diff --git a/kinsta-mu-plugins/cache/pages/partials/sidebar-purge-no-object-cache.php b/kinsta-mu-plugins/cache/pages/partials/sidebar-purge-no-object-cache.php deleted file mode 100644 index 5fd1a2b..0000000 --- a/kinsta-mu-plugins/cache/pages/partials/sidebar-purge-no-object-cache.php +++ /dev/null @@ -1,20 +0,0 @@ - - -
- -
diff --git a/kinsta-mu-plugins/cache/pages/partials/sidebar-support.php b/kinsta-mu-plugins/cache/pages/partials/sidebar-support.php deleted file mode 100644 index 57f4ee1..0000000 --- a/kinsta-mu-plugins/cache/pages/partials/sidebar-support.php +++ /dev/null @@ -1,41 +0,0 @@ - - -
-
-

-
-
- /images/icon-support.svg' height='66px'> -
- Kinsta Dashboard. - $content = sprintf( __( 'If you need some help contact us through your %s', 'kinsta-mu-plugins' ), '' . __( 'MyKinsta Dashboard', 'kinsta-mu-plugins' ) . '' ); - - echo wp_kses( - $content, - array( - 'a' => array( - 'href' => true, - 'target' => true, - ), - ) - ); - ?> -
-
-
diff --git a/kinsta-mu-plugins/cdn/cdn.php b/kinsta-mu-plugins/cdn/cdn.php deleted file mode 100644 index 2352d8f..0000000 --- a/kinsta-mu-plugins/cdn/cdn.php +++ /dev/null @@ -1,26 +0,0 @@ -is_enabled = self::cdn_is_enabled(); - $this->options = self::get_options(); - } - - /** - * Run all of the hooks with WordPress. - * - * @since 2.0.17 - */ - public function run() { - if ( ! $this->is_enabled ) { - return; - } - - /** - * Get the public post types. - * - * @var array - */ - $post_types = get_post_types( - array( - 'public' => true, - 'show_ui' => true, - ) - ); - - foreach ( $post_types as $key => $post_type ) { - if ( 'attachment' === $post_type ) { - continue; - } - add_filter( "rest_prepare_{$post_type}", array( $this, 'handle_rest_api_rewrite_hook' ) ); - } - - /** - * Rewrite the image URL rendered in an admin-ajax.php request. - * - * WordPress does not provide a way to filter AJAX response from the admin-ajax.php - * endpoint. The only viable way, for the moment, to rewrite image rendered in - * the AJAX response is by directly filtering the image `src` and `srcset` URL. - * - * This hook will also rewrite image URLs exposed in the REST-API for custom resources - * and sub-resources where the data structure is not standardized or reliably - * guessed. - */ - add_filter( 'wp_get_attachment_image_src', array( $this, 'handle_image_src_rewrite_hook' ) ); - add_filter( 'wp_calculate_image_srcset', array( $this, 'handle_image_srcset_rewrite_hook' ) ); - - add_action( 'template_redirect', array( $this, 'handle_rewrite_hook' ) ); - add_action( 'all_admin_notices', array( $this, 'requirements_check' ) ); - } - - /** - * Check the plugin's requirements - * - * @return void - * @author laci - * @since 2.0.1 - * @version 1.0 - */ - public function requirements_check() { - if ( version_compare( $GLOBALS['wp_version'], KINSTA_CDN_ENABLER_MIN_WP . 'alpha', '<' ) && 1 == $_SERVER['KINSTA_CDN_ENABLED'] ) { // WPCS: loose comparison ok. - show_message( - sprintf( - '

%s

', - sprintf( - // translators: %1$s minimum WP version, %2$s MyKinsta Dashboard link. - __( 'Kinsta CDN enabler is optimized for WordPress %1$s. Please disable CDN via %2$s or upgrade your WordPress installation (recommended).', 'kinsta-mu-plugins' ), - KINSTA_CDN_ENABLER_MIN_WP, - '' . __( 'MyKinsta Dashboard', 'kinsta-mu-plugins' ) . '' - ) - ) - ); - } - } - - /** - * Get the CDN options - * - * @return array retunrs the options array - * @author laci - * @since 2.0.1 - * @version 0.4 - */ - public static function get_options() { - - $custom = array(); - - if ( defined( 'KINSTA_CDN_USERDIRS' ) && ! empty( KINSTA_CDN_USERDIRS ) ) { - $custom['dirs'] = 'wp-content,wp-includes,images,' . KINSTA_CDN_USERDIRS; - } - if ( isset( $_SERVER['KINSTA_CDN_DOMAIN'] ) && '' !== $_SERVER['KINSTA_CDN_DOMAIN'] ) { - $custom['url'] = 'https://' . $_SERVER['KINSTA_CDN_DOMAIN']; - } - if ( isset( $_SERVER['KINSTA_CDN_DIRECTORIES'] ) && '' !== $_SERVER['KINSTA_CDN_DIRECTORIES'] ) { - $custom['dirs'] = $_SERVER['KINSTA_CDN_DIRECTORIES']; - } - if ( isset( $_SERVER['KINSTA_CDN_EXCLUDE_TYPES'] ) && '' !== $_SERVER['KINSTA_CDN_EXCLUDE_TYPES'] ) { - $exclude_types = sanitize_exclude_types( $_SERVER['KINSTA_CDN_EXCLUDE_TYPES'] ); - $exclude_types = array_merge( array( '.php' ), $exclude_types ); - - $custom['exclude_types'] = $exclude_types; - } - if ( isset( $_SERVER['KINSTA_CDN_HTTPS'] ) && '' !== $_SERVER['KINSTA_CDN_HTTPS'] ) { - $custom['https'] = $_SERVER['KINSTA_CDN_HTTPS']; - } - - return wp_parse_args( - $custom, - array( - 'url' => get_option( 'home' ), - 'dirs' => 'wp-content,wp-includes,images', - 'exclude_types' => array( '.php' ), - 'relative' => 1, - 'https' => 1, - ) - ); - } - - /** - * Initiate the rewrite rules for the CDN URL - * - * @return void - * @author laci - * @since 2.0.1 - * @version 1.0 - */ - public function handle_rewrite_hook() { - $home_url = get_option( 'home' ); - - /* Check if it doesn't need to run */ - if ( ! $this->options || $home_url == $this->options['url'] ) { // WPCS: loose comparison ok. - return; - } - - $rewriter = new CDN_Rewriter( - $this->get_url_to_replace(), - $this->options['url'], - $this->options['dirs'], - $this->options['exclude_types'], - $this->options['relative'], - $this->options['https'] - ); - - ob_start( - array( &$rewriter, 'rewrite' ) - ); - } - - /** - * Function to rewrite the attachment URL to CDN URL. - * - * This will affect the URL output of the `wp_get_attachment_url` function. - * - * @param array|false $image Either array with src, width & height, icon src, or false. - * @return string - */ - public function handle_image_src_rewrite_hook( $image ) { - - /** - * Check whether the current request is a WordPress AJAX, - * or WordPress REST-API request. - */ - - $doing_ajax = is_doing_ajax(); - $rest_api = is_rest_api(); - - if ( ! $doing_ajax && ! $rest_api ) { - return $image; - } - - /** - * Only rewrite URL renderred on the front-end and rest-api request. - * The attachment URL shown on admin page (the Media page as well as the one added to content - * in the post editor) should still be pointing to the site URL instead of to the CDN URL. - * - * It checks both whether the current page is wp-admin as well as whether the request happens - * in the admin area. This is because `is_admin()` will return `true` in an admin-ajax.php - * request which is something we would like to avoid as we actually want to rewrite - * image URL renderred from the admin-ajax.php request. - */ - - $admin_referred = is_admin_referred(); - $admin_page = is_admin(); - - if ( $admin_page && $admin_referred ) { - return $image; - } - - $home_url = get_option( 'home' ); - - /** - * Check if it doesn't need to run. - * If it does not, return the image src immediately. - */ - if ( ! $this->options || $home_url == $this->options['url'] ) { - return $image; - } - - $rewriter = new CDN_Rewriter( - $this->get_url_to_replace(), - $this->options['url'], - $this->options['dirs'], - $this->options['exclude_types'], - $this->options['relative'], - $this->options['https'] - ); - - if ( is_array( $image ) ) { - list( $src, $width, $height ) = $image; - - // Value passed to the `rewrite_url` method must be an array. - return array( $rewriter->rewrite_url( array( $src ) ), $width, $height ); - } - - return $image; - } - - /** - * Function to rewrite the image URL in srcset to CDN URL. - * - * @param array $sources One or more arrays of source data to include in the 'srcset'. - * @return string - */ - public function handle_image_srcset_rewrite_hook( $sources ) { - - /** - * Check whether the current request is a WordPress AJAX, - * or WordPress REST-API request. - */ - - $doing_ajax = is_doing_ajax(); - $rest_api = is_rest_api(); - - if ( ! $doing_ajax && ! $rest_api ) { - return $sources; - } - - /** - * Only rewrite URL renderred on the front-end and rest-api request. - * The attachment URL shown on admin page (the Media page as well as the one added to content - * in the post editor) should still be pointing to the site URL instead of to the CDN URL. - * - * It checks both whether the current page is wp-admin as well as whether the request happens - * in the admin area. This is because `is_admin()` will return `true` in an admin-ajax.php - * request which is something we would like to avoid as we actually want to rewrite - * image URL renderred from the admin-ajax.php request. - */ - - $admin_referred = is_admin_referred(); - $admin_page = is_admin(); - - if ( $admin_page && $admin_referred ) { - return $sources; - } - - $home_url = get_option( 'home' ); - - /** - * Check if it doesn't need to run. - * If it does not, return the image srcset immediately. - */ - if ( ! $this->options || $home_url == $this->options['url'] ) { - return $sources; - } - - $rewriter = new CDN_Rewriter( - $this->get_url_to_replace(), - $this->options['url'], - $this->options['dirs'], - $this->options['exclude_types'], - $this->options['relative'], - $this->options['https'] - ); - - if ( is_array( $sources ) ) { - $sources = array_map( - function( $source ) use ( $rewriter ) { - $src = $source['url']; - $source['url'] = $rewriter->rewrite_url( array( $src ) ); - return $source; - }, - $sources - ); - } - - return $sources; - } - - /** - * Handle the URL rewrite in WordPress REST-API response. - * - * This function only handles URL rewrite in the rendered content - * in the WordPress REST-API response. - * - * @since 2.0.17 - * - * @param WP_REST_Response $response The response object. - * @return WP_REST_Response Response object. - */ - public function handle_rest_api_rewrite_hook( $response ) { - $home_url = get_option( 'home' ); - - /** - * Check if it doesn't need to run. - * If it does not immediately return the WP_REST_Response. - */ - if ( ! $this->options || $home_url == $this->options['url'] ) { // WPCS: loose comparison ok. - return $response; - } - - $rewriter = new CDN_Rewriter( - $this->get_url_to_replace(), - $this->options['url'], - $this->options['dirs'], - $this->options['exclude_types'], - $this->options['relative'], - $this->options['https'] - ); - - $data = $response->get_data(); // Get the API data. - if ( isset( $data['content'] ) && isset( $data['content']['rendered'] ) ) { - $data['content']['rendered'] = $rewriter->rewrite( $data['content']['rendered'] ); // Rewrite the URLs. - } - - $response->set_data( $data ); - - return $response; - } - - /** - * Return if the Kinsta server based CDN service is enabled - * - * @return boolean - * @author laci - * @since 2.0.1 - * @version 1.0.1 - */ - public static function cdn_is_enabled() { - return ( isset( $_SERVER['KINSTA_CDN_ENABLED'] ) && 1 == $_SERVER['KINSTA_CDN_ENABLED'] && ( ! defined( 'KINSTA_DEV_ENV' ) || KINSTA_DEV_ENV == false ) ) ? true : false; // WPCS: loose comparison ok. - } - - /** - * Gets the URL which should be replaced - * - * @since 2.0.20 - * @return string - */ - private function get_url_to_replace() { - - $url = get_option( 'home' ); - - if ( defined( 'KINSTA_CDN_USERURL' ) && ! empty( KINSTA_CDN_USERURL ) && is_string( KINSTA_CDN_USERURL ) ) { - $url = KINSTA_CDN_USERURL; - } - - return apply_filters( 'kinsta_cdn_url_to_replace', $url ); - } -} - -/** - * Backward compatible. - * WP Rocket plugin's 3.0.1 version caused fatal error without this. - */ -class CDNEnabler extends CDN_Enabler {} diff --git a/kinsta-mu-plugins/cdn/class-cdn-rewriter.php b/kinsta-mu-plugins/cdn/class-cdn-rewriter.php deleted file mode 100644 index 0e1e4b5..0000000 --- a/kinsta-mu-plugins/cdn/class-cdn-rewriter.php +++ /dev/null @@ -1,230 +0,0 @@ -site_url = $site_url; - $this->cdn_url = $cdn_url; - $this->dirs = $dirs; - $this->exclude_types = $exclude_types; - $this->relative = $relative; - $this->https = $https; - } - - /** - * Check if the asset should be excluded from the CDN. - * - * @param string $asset URL of the asset. - * - * @return boolean - */ - protected function exclude_asset( $asset ) { - foreach ( $this->exclude_types as $exclude ) { - if ( ! ! $exclude && stristr( $asset, $exclude ) !== false ) { - return true; - } - } - return false; - } - - /** - * Whether the URL should be rewritten. - * - * Check if the URL to rewrite is pointing to the site, or if - * it's already rewritten to a CDN URL (S3, Google Cloud, etc). - * - * @param string $src_url The URL to rewrite to the CDN URL. - * @return boolean - */ - public static function maybe_rewrite_url( $src_url = '' ) { - - $home_url = get_option( 'home' ); - - /** - * Keep using the native PHP function instead of using `wp_parse_url`. - * The `wp_parse_url` is only added in WordPress 4.4.0 and some - * client site's may still be using older WordPress version. - */ - $home_url_host = parse_url( $home_url, PHP_URL_HOST ); - - if ( ! is_string( $home_url_host ) || empty( $home_url_host ) ) { - return false; - } - - $src_url_host = parse_url( $src_url, PHP_URL_HOST ); - if ( substr( $src_url, 0, 1 ) === '/' || $src_url_host === $home_url_host ) { - return true; - } - - return false; - } - - /** - * Rewrite URL - * - * @param array $asset Asset URL. - * @return string The asset with CDN URL - */ - public function rewrite_url( $asset ) { - if ( $this->exclude_asset( $asset[0] ) || ! self::maybe_rewrite_url( $asset[0] ) ) { - return $asset[0]; - } - - if ( is_admin_bar_showing() && is_preview_mode() ) { // WPCS: loose comparison ok, CSRF ok. - return $asset[0]; - } - - $site_url = $this->relative_url( $this->site_url ); - $subst_urls = array( 'http:' . $site_url ); - - if ( $this->https ) { - $subst_urls = array( - 'http:' . $site_url, - 'https:' . $site_url, - ); - } - - if ( strpos( $asset[0], '//' ) === 0 ) { - return str_replace( $site_url, $this->cdn_url, $asset[0] ); - } - - if ( ! $this->relative || strstr( $asset[0], $site_url ) ) { - return str_replace( $subst_urls, $this->cdn_url, $asset[0] ); - } - - return $this->cdn_url . $asset[0]; - } - - /** - * Set to relative URL - * - * @param string $url The Asset URL. - * @return string The Asset Relative URL - */ - protected function relative_url( $url ) { - return substr( $url, strpos( $url, '//' ) ); - } - - /** - * [get_dir_scope description] - * - * @return [type] [description] - */ - protected function get_dir_scope() { - $input = explode( ',', $this->dirs ); - if ( '' == $this->dirs || count( $input ) < 1 ) { // WPCS: loose comparison ok. - return 'wp\-content|wp\-includes'; - } - return implode( '|', array_map( 'quotemeta', array_map( 'trim', $input ) ) ); - } - - /** - * Rewrite the asset requests in the site response - * - * @param string $source_html the HTML content of the response. - * @return string the updated HTML content of the response - * - * @author laci - * @version 1.0.2 Fixed some issues related to the dot in the request - */ - public function rewrite( $source_html ) { - if ( ! $this->https && isset( $_SERVER['HTTPS'] ) && 'on' == $_SERVER['HTTPS'] ) { // WPCS: loose comparison ok. - return $source_html; - } - - $dirs = $this->get_dir_scope(); - $site_url = $this->https - ? '(https?:|)' . $this->relative_url( quotemeta( $this->site_url ) ) - : '(http:|)' . $this->relative_url( quotemeta( $this->site_url ) ); - - $regex_rule = '#(?<=[(\"\'])'; - - if ( $this->relative ) { - $regex_rule .= '(?:' . $site_url . ')?'; - } else { - $regex_rule .= $site_url; - } - - $regex_rule .= '/(?:'; - $regex_rule .= '(?:' . $dirs . ')[^\"\')]+\.'; - $regex_rule .= '(?:ogg|ogv|svg|svgz|eot|otf|woff|woff2|mp4|mp3|ttf|css|js|jpg|jpeg|gif|png|ico|webp|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|pdf|mov)'; - $regex_rule .= '(?:(?:/?\?| )[^/\"\')]*)?'; - $regex_rule .= ')'; - $regex_rule .= '(?=[\"\')])#'; - - $return_html = preg_replace_callback( $regex_rule, array( &$this, 'rewrite_url' ), $source_html ); - return $return_html; - } -} diff --git a/kinsta-mu-plugins/cdn/utilities.php b/kinsta-mu-plugins/cdn/utilities.php deleted file mode 100644 index 0a695e3..0000000 --- a/kinsta-mu-plugins/cdn/utilities.php +++ /dev/null @@ -1,104 +0,0 @@ -cdn_cacheid = ""; + $this->kinsta_cache = new Cache( $this ); + $this->kinsta_cache_purge = new Cache_Purge( $this ); + $this->KinstaCachePurge = $this->kinsta_cache_purge; // phpcs:ignore + $this->kmp_admin = new KMP_Admin( $this ); + $this->banned_plugins = new Banned_Plugins(); + $this->wp_cli = new KMP_WPCLI( $this ); + } + + /** + * Sets the required capability to view and use the cache purging options. + * + * @return string the required capability + */ + public function is_cdn_enabled() { + return $this->cdn_cacheid !== ""; + } +} + +global $kinsta_muplugin; +global $kinsta_cache; +global $KinstaCache; // phpcs:ignore +$kinsta_muplugin = new KMP(); +$kinsta_cache = $kinsta_muplugin; +$KinstaCache = $kinsta_muplugin; // phpcs:ignore diff --git a/kinsta-mu-plugins/compat/assets/js/banned-plugins.js b/kinsta-mu-plugins/compat/assets/js/banned-plugins.js deleted file mode 100644 index 9ddfe33..0000000 --- a/kinsta-mu-plugins/compat/assets/js/banned-plugins.js +++ /dev/null @@ -1,91 +0,0 @@ -jQuery( function( $ ) { - - var pluginFilter = $( '#plugin-filter' ); - var theList = $( '#the-list' ); - var MutationObserver; - var observe; - - /** - * Handle the plugins table list. - * - * @return {Void} - */ - function pluginsPage() { - - var disabledPluginRow; - var index = 0; - - if ( ! Array.isArray( kinstaDisabledPlugins ) || 0 === kinstaDisabledPlugins.length ) { - return; - } - - for ( index; index < kinstaDisabledPlugins.length; index++ ) { - disabledPlugin = kinstaDisabledPlugins[ index ]; - disabledPluginRow = theList.find( '[data-slug="' + disabledPlugin + '"]' ); - if ( 0 === disabledPluginRow.length ) { - disabledPluginRow = theList.find( '[data-plugin^="' + disabledPlugin + '"]' ); - } - disabledPluginRow.find( '.check-column' ).empty(); - } - } - - /** - * Modify the plugin card element to prevent installation. - * - * @return {Void} - */ - function pluginInstallPage() { - - var kinstaBannedPlugins; - var bannedPlugin; - var index = 0; - - if ( ! Array.isArray( kinstaDisabledPlugins ) || 0 === kinstaWarningPlugins.length ) { // If kinstaDisabledPlugins not an array, abort! - return; - } - - kinstaBannedPlugins = kinstaWarningPlugins.concat( kinstaDisabledPlugins ); - - for ( index; index < kinstaBannedPlugins.length; index++ ) { - - bannedPlugin = kinstaBannedPlugins[ index ]; - bannedPluginCard = pluginFilter.find( '.plugin-card-' + bannedPlugin ); - - if ( 1 === bannedPluginCard.length ) { - bannedPluginCard.addClass( 'kinsta-banned-plugin' ); - bannedPluginCardUrl = bannedPluginCard.find( '.thickbox.open-plugin-details-modal' ); - bannedPluginCardUrl.replaceWith( function() { - return $( '', { 'class': 'kinsta-banned-plugin__title' }).append( $( this ).contents() ); - }); - } - } - } - - if ( 'plugins-php' === adminpage && 1 === theList.length ) { - try { - pluginsPage(); - } catch ( error ) { - console.warn( error ); - } - } - - // Roll out. - if ( 'plugin-install-php' === adminpage && 1 === pluginFilter.length ) { - try { - MutationObserver = window.MutationObserver || window.WebKitMutationObserver; - observe = new MutationObserver( function( mutations ) { - mutations.forEach( function( mutation ) { - if ( 'childList' === mutation.type && '' !== pluginFilter.html().trim() ) { - pluginInstallPage(); - } - }); - }); - observe.observe( pluginFilter.get( 0 ), { - childList: true - }); - pluginInstallPage(); - } catch ( error ) { - console.warn( error ); - } - } -}); diff --git a/kinsta-mu-plugins/compat/class-kinsta-commands.php b/kinsta-mu-plugins/compat/class-kinsta-commands.php deleted file mode 100644 index 12f8add..0000000 --- a/kinsta-mu-plugins/compat/class-kinsta-commands.php +++ /dev/null @@ -1,79 +0,0 @@ -get_banned_plugins(); - - if ( $this->banned_plugins instanceof Banned_Plugins ) { - $banned_plugins_args = array( - 'banned_list' => $banned_plugins->get_banned_list(), - 'warning_list' => $banned_plugins->get_warning_list(), - 'disabled_list' => $banned_plugins->get_disabled_list(), - ); - WP_CLI::add_command( 'kinsta plugin list', new Plugin_List_Command( $banned_plugins_args ) ); - } - - WP_CLI::add_command( 'kinsta cache purge', new Cache_Purge_Command() ); - } - - /** - * Register the Banned_Plugins class instance. - * - * @param \Kinsta\Compat\Banned_Plugins $banned_plugins The class instance. - * @return void - */ - public function set_banned_plugins( \Kinsta\Compat\Banned_Plugins $banned_plugins ) { - $this->banned_plugins = $banned_plugins; - } - - /** - * Get the Banned_Plugins class instance. - * - * @return \Kinsta\Compat\Banned_Plugins - */ - public function get_banned_plugins() { - return $this->banned_plugins; - } -} diff --git a/kinsta-mu-plugins/compat/class-security.php b/kinsta-mu-plugins/compat/class-security.php deleted file mode 100644 index 0c2307a..0000000 --- a/kinsta-mu-plugins/compat/class-security.php +++ /dev/null @@ -1,137 +0,0 @@ -security = get_server_var( 'KINSTA_PLUGIN_OP', 'security' ); - } - - /** - * Run the security functionity. - * - * @return void - */ - public function run() { - - if ( ! $this->security ) { - return; - } - - if ( isset( $this->security['hide_wp_version'] ) && true === (bool) $this->security['hide_wp_version'] ) { - $this->hide_wp_version(); - } - } - - /** - * Method to hide WordPress version from the site front-end. - * - * @return void - */ - public function hide_wp_version() { - - remove_action( 'wp_head', 'wp_generator' ); // Remove version from head. - - add_action( 'admin_notices', array( __CLASS__, 'hide_wp_version_admin_notice' ), PHP_INT_MAX ); - - add_filter( 'the_generator', '__return_empty_string' ); // Remove version from RSS. - add_filter( 'style_loader_src', array( __CLASS__, 'hide_wp_version_loader_src' ), PHP_INT_MAX ); - add_filter( 'script_loader_src', array( __CLASS__, 'hide_wp_version_loader_src' ), PHP_INT_MAX ); - } - - /** - * Remove the version from scripts and styles query string URL. - * - * @param string $src The source URL of the enqueued style or script. - * @return string - */ - public static function hide_wp_version_loader_src( $src ) { - - $wp_version = get_bloginfo( 'version' ); - if ( strpos( $src, "ver={$wp_version}" ) ) { - - $src_path = parse_url( $src, PHP_URL_PATH ); - $src_file = ABSPATH . $src_path; - - $src = remove_query_arg( 'ver', $src ); - if ( file_exists( $src_file ) ) { - $src_mod = filemtime( ABSPATH . $src_path ); - $src = add_query_arg( 'ver', $src_mod, $src ); - } - } - - return $src; - } - - /** - * Display a notice when the WordPress version is hidden. - * - * @return void - */ - public static function hide_wp_version_admin_notice() { - - $screen = get_current_screen(); - if ( 'kinsta-tools' === $screen->parent_base ) : - ?> -
-

- ' . __( 'For your security', 'kinsta-mu-plugins' ) . '' ); - } - - echo wp_kses( - $notice, - array( - 'a' => array( - 'href' => true, - 'target' => true, - ), - ) - ); - ?> -

-
- security; - } - -} diff --git a/kinsta-mu-plugins/compat/class-wp-kinsta.php b/kinsta-mu-plugins/compat/class-wp-kinsta.php deleted file mode 100644 index 86232b8..0000000 --- a/kinsta-mu-plugins/compat/class-wp-kinsta.php +++ /dev/null @@ -1,45 +0,0 @@ -set_banned_plugins( $banned_plugins ); -$kinsta_commands->add_commands(); - -// Roll WP Kinsta. -$wp_kinsta = new WP_Kinsta(); - -// Roll WordPress security utitlity. -$security = new Security(); - -add_action( 'init', array( $banned_plugins, 'run' ) ); -add_action( 'init', array( $security, 'run' ) ); +// Stub class for old WP Rocket versions. +require_once plugin_dir_path( __FILE__ ) . 'third-party/class-cdn-enabler.php'; +require_once plugin_dir_path( __FILE__ ) . 'third-party/wp-rocket.php'; diff --git a/kinsta-mu-plugins/compat/third-party/class-cdn-enabler.php b/kinsta-mu-plugins/compat/third-party/class-cdn-enabler.php new file mode 100644 index 0000000..18c4c38 --- /dev/null +++ b/kinsta-mu-plugins/compat/third-party/class-cdn-enabler.php @@ -0,0 +1,56 @@ +is_enabled = false; + } + + /** + * Easter egg comments because. + */ + public static function cdn_is_enabled() { + return false; + } + + /** + * Nothing in this class does anything. + */ + public function run() { + return; + } +} + +/** + * But PHPCS is making me do this. + * + * @since 3.0.0 + */ +class CDNEnabler extends CDN_Enabler {} + +$cdn_enabler = new CDN_Enabler(); diff --git a/kinsta-mu-plugins/compat/third-party/swift-performance.php b/kinsta-mu-plugins/compat/third-party/swift-performance.php index e170984..e187a14 100644 --- a/kinsta-mu-plugins/compat/third-party/swift-performance.php +++ b/kinsta-mu-plugins/compat/third-party/swift-performance.php @@ -17,7 +17,7 @@ * * @return void */ -function swift_performanc_compatibility_admin_notices() { +function swift_performance_compatibility_admin_notices() { // Check if the WORDFENCE_DISABLE_LIVE_TRAFFIC is set to "false". if ( ! SWIFT_PERFORMANCE_DISABLE_CACHE ) { @@ -31,4 +31,4 @@ function swift_performanc_compatibility_admin_notices() { } } if ( function_exists( 'add_action' ) ) { - add_action( 'admin_notices', __NAMESPACE__ . '\\swift_performanc_compatibility_admin_notices', PHP_INT_MAX ); } + add_action( 'admin_notices', __NAMESPACE__ . '\\swift_performance_compatibility_admin_notices', PHP_INT_MAX ); } diff --git a/kinsta-mu-plugins/compat/third-party/wp-rocket.php b/kinsta-mu-plugins/compat/third-party/wp-rocket.php new file mode 100644 index 0000000..0386e21 --- /dev/null +++ b/kinsta-mu-plugins/compat/third-party/wp-rocket.php @@ -0,0 +1,71 @@ +id !== 'dashboard' ) { + return; + } + ?> +
+

+ array( + 'href' => true, + 'target' => '_blank', + ), + ) + ), + '' . esc_html__( 'Please update WP Rocket on the Plugins page', 'kinsta-mu-plugins' ) . '' + ); + ?> +

+
+ banned_list = array_merge( $this->warning_list, $this->disabled_list ); // Full list of Banned Plugins. $this->active_plugins = get_option( 'active_plugins', array() ); + global $wp_version; + + add_action( 'admin_init', array( $this, 'deactivate_disabled_plugins' ), PHP_INT_MAX ); + add_action( 'activated_plugin', array( $this, 'deactivate_disabled_plugin' ), PHP_INT_MAX ); + + add_action( 'admin_print_scripts', array( $this, 'add_plugin_page_scripts' ), PHP_INT_MAX ); + add_action( 'admin_print_styles', array( $this, 'add_plugin_page_styles' ), PHP_INT_MAX ); + + add_filter( 'plugin_install_action_links', array( $this, 'plugin_install_action_links' ), PHP_INT_MAX, 2 ); + add_filter( 'install_plugin_complete_actions', array( $this, 'install_plugin_complete_actions' ), PHP_INT_MAX, 3 ); + + foreach ( $this->disabled_list as $plugin_file ) { + add_filter( "plugin_action_links_{$plugin_file}", array( $this, 'disabled_plugin_action_links' ), PHP_INT_MAX ); + } + + foreach ( $this->warning_list as $plugin_file ) { + add_filter( "plugin_action_links_{$plugin_file}", array( $this, 'warning_plugin_action_links' ), PHP_INT_MAX ); + } + + if ( self::shall_display_admin_notice() && version_compare( $wp_version, '4.3', '>' ) ) { + add_action( 'admin_print_scripts', array( $this, 'add_notice_scripts' ), PHP_INT_MAX ); + add_action( 'admin_print_styles', array( $this, 'add_notice_styles' ), PHP_INT_MAX ); + add_action( 'admin_notices', array( $this, 'admin_notices' ), PHP_INT_MAX ); + add_action( 'wp_ajax_kinsta_dismiss_banned_plugins_nag', array( $this, 'dismiss_banned_plugins_nag' ), PHP_INT_MAX ); + } } /** @@ -112,40 +137,6 @@ public function get_banned_list() { return $this->banned_list; } - /** - * Run to execute all of the hooks with WordPress. - * - * @return void - */ - public function run() { - global $wp_version; - - add_action( 'admin_init', array( $this, 'deactivate_disabled_plugins' ), PHP_INT_MAX ); - add_action( 'activated_plugin', array( $this, 'deactivate_disabled_plugin' ), PHP_INT_MAX ); - - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), PHP_INT_MAX ); - add_action( 'admin_print_scripts', array( $this, 'add_plugin_page_scripts' ), PHP_INT_MAX ); - add_action( 'admin_print_styles', array( $this, 'add_plugin_page_styles' ), PHP_INT_MAX ); - - add_filter( 'plugin_install_action_links', array( $this, 'plugin_install_action_links' ), PHP_INT_MAX, 2 ); - add_filter( 'install_plugin_complete_actions', array( $this, 'install_plugin_complete_actions' ), PHP_INT_MAX, 3 ); - - foreach ( $this->disabled_list as $plugin_file ) { - add_filter( "plugin_action_links_{$plugin_file}", array( $this, 'disabled_plugin_action_links' ), PHP_INT_MAX ); - } - - foreach ( $this->warning_list as $plugin_file ) { - add_filter( "plugin_action_links_{$plugin_file}", array( $this, 'warning_plugin_action_links' ), PHP_INT_MAX ); - } - - if ( self::shall_display_admin_notice() && version_compare( $wp_version, '4.3', '>' ) ) { - add_action( 'admin_print_scripts', array( $this, 'add_notice_scripts' ), PHP_INT_MAX ); - add_action( 'admin_print_styles', array( $this, 'add_notice_styles' ), PHP_INT_MAX ); - add_action( 'admin_notices', array( $this, 'admin_notices' ), PHP_INT_MAX ); - add_action( 'wp_ajax_kinsta_dismiss_banned_plugins_nag', array( $this, 'dismiss_banned_plugins_nag' ), PHP_INT_MAX ); - } - } - /** * Disaplay admin notice. * @@ -296,23 +287,6 @@ public function install_plugin_complete_actions( $install_actions, $api, $plugin return $install_actions; } - /** - * Enqueue scripts. - * - * @return void - */ - public function enqueue_scripts() { - - if ( self::is_admin_plugin_page() ) { - - $file_js = 'assets/js/banned-plugins.js'; - $file_js_path = plugin_dir_path( __FILE__ ) . $file_js; - $file_js_url = plugin_dir_url( __FILE__ ) . $file_js; - - wp_enqueue_script( 'kinsta-banned-plugins', $file_js_url, array( 'plugin-install' ), filemtime( $file_js_path ), true ); - } - } - /** * Dismiss "Banned Plugins" notice * diff --git a/kinsta-mu-plugins/shared/class-shared.php b/kinsta-mu-plugins/shared/class-shared.php deleted file mode 100644 index 43e6b21..0000000 --- a/kinsta-mu-plugins/shared/class-shared.php +++ /dev/null @@ -1,218 +0,0 @@ -. - * @return string - **/ - public function body_classes( $classes ) { - if ( defined( 'KINSTAMU_WHITELABEL' ) && KINSTAMU_WHITELABEL === true ) { - $classes .= ' kinstamu-whitelabel'; - } - return $classes; - } - - /** - * Set the name and value of the option into array before saving it. - * - * @param array $array The list of options. - * @param string $name Option name. - * @param mixed $value Option value. - * @return void - */ - private function set_options_array_value( array $array, $name, $value ) { - if ( substr( $name, -1 ) !== ']' ) { - $array[ $name ] = $value; - } else { - $name = str_replace( '][', '|', $name ); - $name = substr( str_replace( '[', '|', $name ), 0, -1 ); - $name = explode( '|', $name ); - } - - $count = count( $name ); - - if ( 2 === $count ) { - $array[ $name[0] ][ $name[1] ] = $value; - } - - if ( 3 === $count ) { - $array[ $name[0] ][ $name[1] ][ $name[2] ] = $value; - } - - if ( 4 === $count ) { - $array[ $name[0] ][ $name[1] ][ $name[2] ][ $name[3] ] = $value; - } - } - - /** - * Load assets in the Kinsta plugin setting page. - * - * @param string $page The page slug. - * @return void - */ - public function assets( $page ) { - if ( substr_count( $page, 'kinsta' ) === 0 ) { - return; - } - - wp_enqueue_style( 'kinsta-shared', $this->shared_resource_url( 'shared/styles/common.css' ), array(), KINSTAMU_VERSION ); - wp_enqueue_script( 'kinsta-loader', $this->shared_resource_url( 'shared/scripts/kinsta-loader.js' ), array( 'jquery', 'jquery-effects-core' ), KINSTAMU_VERSION, true ); - - wp_enqueue_script( 'tooltipster', $this->shared_resource_url( 'shared/scripts/tooltipster.bundle.min.js' ), array( 'jquery' ), KINSTAMU_VERSION, true ); - wp_enqueue_style( 'tooltipster', $this->shared_resource_url( 'shared/styles/tooltipster.bundle.css' ), array(), KINSTAMU_VERSION ); - } - - /** - * Init tooltip - * - * @return void - */ - public function init_tooltipster() { - $screen = get_current_screen(); - if ( 0 === substr_count( $screen->id, 'kinsta' ) ) { - return; - } ?> - - -
- - '> - -
- - /images/info.svg'> -
- - * @version 1.2 - * @since 2.0.1 resource issue fixing - * - * @param string $path optional param which is added to the end of the returned string. - * @return string URL path of the kinsta-mu-plugins. - */ - public static function shared_resource_url( $path = '' ) { - $mu_url = ( is_ssl() ) ? str_replace( 'http://', 'https://', WPMU_PLUGIN_URL ) : WPMU_PLUGIN_URL; - $full_path = $mu_url . '/kinsta-mu-plugins/' . $path; - - if ( defined( 'KINSTAMU_CUSTOM_MUPLUGIN_URL' ) && KINSTAMU_CUSTOM_MUPLUGIN_URL !== '' ) { - $full_path = KINSTAMU_CUSTOM_MUPLUGIN_URL . '/kinsta-mu-plugins/' . $path; - } - - return $full_path; - } - - /** - * Modify Footer Text - * Modifies the thank you text in the bottom of the admin - * - * @since 1.0.0 - * @author Daniel Pataki - */ - public function modify_admin_footer_text() { - // Translators: %1$s WordPress, %2$s Kinsta URL. - return '' . sprintf( __( 'Thanks for creating with %1$s and hosting with %2$s', 'kinsta-mu-plugins' ), 'WordPress', 'Kinsta' ) . ''; - } -} - -new Shared(); diff --git a/kinsta-mu-plugins/shared/scripts/kinsta-loader.js b/kinsta-mu-plugins/shared/scripts/kinsta-loader.js deleted file mode 100644 index d5b1205..0000000 --- a/kinsta-mu-plugins/shared/scripts/kinsta-loader.js +++ /dev/null @@ -1,66 +0,0 @@ -'use strict'; - -( function( $ ) { - $.each( $( '.kinsta-loader' ), function( key, loader ) { - - var element = $( loader ); - var initialText = ! element.val() ? element.text() : element.val(); - var completedText = element.attr( 'data-completedText' ); - var progressText = element.attr( 'data-progressText' ); - var type = element.attr( 'data-type' ); - var textElement = $( '' + initialText + '' ); - var progressElement = $( '
' ); - - element.attr( 'data-backgroundColor', element.css( 'backgroundColor' ) ); - element.html( '' ).append( textElement ).append( progressElement ); - element.bind( 'click', function() { - - var loader = $( this ); - var progressBar = loader.find( '.progress-bar' ); - var progress = loader.find( '.progress' ); - var text = loader.find( '.text' ); - var originalColor = loader.attr( 'data-backgroundColor' ); - var speed = 'reload' != type ? 1200 : 3000; - - if ( loader.hasClass( 'loading' ) ) { - return; - } - - loader.addClass( 'loading' ); - - text.css({ minWidth: text.width() + 'px'}); - text.text( progressText ); - - progressBar.animate({ width: '100%' }, speed, 'linear', function() { - if ( 'reload' != type ) { - text.fadeOut( function() { - - loader.animate({ - backgroundColor: '#8DE382', - borderColor: '#8DE382' - }); - - text.text( completedText ).fadeIn(); - - window.setTimeout( function() { - progress.animate({ bottom: '-20px'}); - text.fadeOut( function() { - loader.animate({ - backgroundColor: originalColor, - borderColor: originalColor - }, function() { - loader.removeClass( 'loading' ); - loader.removeAttr( 'style' ); - }); - text.text( initialText ).fadeIn( function() { - progressBar.css({ width: '0px'}); - progress.css({ bottom: '0px'}); - }); - }); - }, 2000 ); - }); - } - }); - }); - }); -}( jQuery ) ); diff --git a/kinsta-mu-plugins/shared/scripts/tooltipster.bundle.min.js b/kinsta-mu-plugins/shared/scripts/tooltipster.bundle.min.js deleted file mode 100644 index 4275ee0..0000000 --- a/kinsta-mu-plugins/shared/scripts/tooltipster.bundle.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! tooltipster v4.1.2 */!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof exports?module.exports=b(require("jquery")):b(jQuery)}(this,function(a){function b(a){this.$container,this.constraints=null,this.__$tooltip,this.__init(a)}function c(b,c){var d=!0;return a.each(b,function(a,e){return void 0===c[a]||b[a]!==c[a]?(d=!1,!1):void 0}),d}function d(b){var c=b.attr("id"),d=c?h.window.document.getElementById(c):null;return d?d===b[0]:a.contains(h.window.document.body,b[0])}function e(){if(!g)return!1;var a=g.document.body||g.document.documentElement,b=a.style,c="transition",d=["Moz","Webkit","Khtml","O","ms"];if("string"==typeof b[c])return!0;c=c.charAt(0).toUpperCase()+c.substr(1);for(var e=0;e0?e=c.__plugins[d]:a.each(c.__plugins,function(a,b){return b.name.substring(b.name.length-d.length-1)=="."+d?(e=b,!1):void 0}),e}if(b.name.indexOf(".")<0)throw new Error("Plugins must be namespaced");return c.__plugins[b.name]=b,b.core&&c.__bridge(b.core,c,b.name),this},_trigger:function(){var a=Array.prototype.slice.apply(arguments);return"string"==typeof a[0]&&(a[0]={type:a[0]}),this.__$emitterPrivate.trigger.apply(this.__$emitterPrivate,a),this.__$emitterPublic.trigger.apply(this.__$emitterPublic,a),this},instances:function(b){var c=[],d=b||".tooltipstered";return a(d).each(function(){var b=a(this),d=b.data("tooltipster-ns");d&&a.each(d,function(a,d){c.push(b.data(d))})}),c},instancesLatest:function(){return this.__instancesLatestArr},off:function(){return this.__$emitterPublic.off.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},on:function(){return this.__$emitterPublic.on.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},one:function(){return this.__$emitterPublic.one.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},origins:function(b){var c=b?b+" ":"";return a(c+".tooltipstered").toArray()},setDefaults:function(b){return a.extend(f,b),this},triggerHandler:function(){return this.__$emitterPublic.triggerHandler.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this}},a.tooltipster=new i,a.Tooltipster=function(b,c){this.__callbacks={close:[],open:[]},this.__closingTime,this.__Content,this.__contentBcr,this.__destroyed=!1,this.__destroying=!1,this.__$emitterPrivate=a({}),this.__$emitterPublic=a({}),this.__enabled=!0,this.__garbageCollector,this.__Geometry,this.__lastPosition,this.__namespace="tooltipster-"+Math.round(1e6*Math.random()),this.__options,this.__$originParents,this.__pointerIsOverOrigin=!1,this.__previousThemes=[],this.__state="closed",this.__timeouts={close:[],open:null},this.__touchEvents=[],this.__tracker=null,this._$origin,this._$tooltip,this.__init(b,c)},a.Tooltipster.prototype={__init:function(b,c){var d=this;if(d._$origin=a(b),d.__options=a.extend(!0,{},f,c),d.__optionsFormat(),!h.IE||h.IE>=d.__options.IEmin){var e=null;if(void 0===d._$origin.data("tooltipster-initialTitle")&&(e=d._$origin.attr("title"),void 0===e&&(e=null),d._$origin.data("tooltipster-initialTitle",e)),null!==d.__options.content)d.__contentSet(d.__options.content);else{var g,i=d._$origin.attr("data-tooltip-content");i&&(g=a(i)),g&&g[0]?d.__contentSet(g.first()):d.__contentSet(e)}d._$origin.removeAttr("title").addClass("tooltipstered"),d.__prepareOrigin(),d.__prepareGC(),a.each(d.__options.plugins,function(a,b){d._plug(b)}),h.hasTouchCapability&&a("body").on("touchmove."+d.__namespace+"-triggerOpen",function(a){d._touchRecordEvent(a)}),d._on("created",function(){d.__prepareTooltip()})._on("repositioned",function(a){d.__lastPosition=a.position})}else d.__options.disabled=!0},__contentInsert:function(){var a=this,b=a._$tooltip.find(".tooltipster-content"),c=a.__Content,d=function(a){c=a};return a._trigger({type:"format",content:a.__Content,format:d}),a.__options.functionFormat&&(c=a.__options.functionFormat.call(a,a,{origin:a._$origin[0]},a.__Content)),"string"!=typeof c||a.__options.contentAsHTML?b.empty().append(c):b.text(c),a},__contentSet:function(b){return b instanceof a&&this.__options.contentCloning&&(b=b.clone(!0)),this.__Content=b,this._trigger({type:"updated",content:b}),this},__destroyError:function(){throw new Error("This tooltip has been destroyed and cannot execute your method call.")},__geometry:function(){var b=this,c=b._$origin,d=b._$origin.is("area");if(d){var e=b._$origin.parent().attr("name");c=a('img[usemap="#'+e+'"]')}var f=c[0].getBoundingClientRect(),g=a(h.window.document),i=a(h.window),j=c,k={available:{document:null,window:null},document:{size:{height:g.height(),width:g.width()}},window:{scroll:{left:h.window.scrollX||h.window.document.documentElement.scrollLeft,top:h.window.scrollY||h.window.document.documentElement.scrollTop},size:{height:i.height(),width:i.width()}},origin:{fixedLineage:!1,offset:{},size:{height:f.bottom-f.top,width:f.right-f.left},usemapImage:d?c[0]:null,windowOffset:{bottom:f.bottom,left:f.left,right:f.right,top:f.top}}};if(d){var l=b._$origin.attr("shape"),m=b._$origin.attr("coords");if(m&&(m=m.split(","),a.map(m,function(a,b){m[b]=parseInt(a)})),"default"!=l)switch(l){case"circle":var n=m[0],o=m[1],p=m[2],q=o-p,r=n-p;k.origin.size.height=2*p,k.origin.size.width=k.origin.size.height,k.origin.windowOffset.left+=r,k.origin.windowOffset.top+=q;break;case"rect":var s=m[0],t=m[1],u=m[2],v=m[3];k.origin.size.height=v-t,k.origin.size.width=u-s,k.origin.windowOffset.left+=s,k.origin.windowOffset.top+=t;break;case"poly":for(var w=0,x=0,y=0,z=0,A="even",B=0;By&&(y=C,0===B&&(w=y)),w>C&&(w=C),A="odd"):(C>z&&(z=C,1==B&&(x=z)),x>C&&(x=C),A="even")}k.origin.size.height=z-x,k.origin.size.width=y-w,k.origin.windowOffset.left+=w,k.origin.windowOffset.top+=x}}var D=function(a){k.origin.size.height=a.height,k.origin.windowOffset.left=a.left,k.origin.windowOffset.top=a.top,k.origin.size.width=a.width};for(b._trigger({type:"geometry",edit:D,geometry:{height:k.origin.size.height,left:k.origin.windowOffset.left,top:k.origin.windowOffset.top,width:k.origin.size.width}}),k.origin.windowOffset.right=k.origin.windowOffset.left+k.origin.size.width,k.origin.windowOffset.bottom=k.origin.windowOffset.top+k.origin.size.height,k.origin.offset.left=k.origin.windowOffset.left+h.window.scrollX,k.origin.offset.top=k.origin.windowOffset.top+h.window.scrollY,k.origin.offset.bottom=k.origin.offset.top+k.origin.size.height,k.origin.offset.right=k.origin.offset.left+k.origin.size.width,k.available.document={bottom:{height:k.document.size.height-k.origin.offset.bottom,width:k.document.size.width},left:{height:k.document.size.height,width:k.origin.offset.left},right:{height:k.document.size.height,width:k.document.size.width-k.origin.offset.right},top:{height:k.origin.offset.top,width:k.document.size.width}},k.available.window={bottom:{height:Math.max(k.window.size.height-Math.max(k.origin.windowOffset.bottom,0),0),width:k.window.size.width},left:{height:k.window.size.height,width:Math.max(k.origin.windowOffset.left,0)},right:{height:k.window.size.height,width:Math.max(k.window.size.width-Math.max(k.origin.windowOffset.right,0),0)},top:{height:Math.max(k.origin.windowOffset.top,0),width:k.window.size.width}};"html"!=j[0].tagName.toLowerCase();){if("fixed"==j.css("position")){k.origin.fixedLineage=!0;break}j=j.parent()}return k},__optionsFormat:function(){return"number"==typeof this.__options.animationDuration&&(this.__options.animationDuration=[this.__options.animationDuration,this.__options.animationDuration]),"number"==typeof this.__options.delay&&(this.__options.delay=[this.__options.delay,this.__options.delay]),"number"==typeof this.__options.delayTouch&&(this.__options.delayTouch=[this.__options.delayTouch,this.__options.delayTouch]),"string"==typeof this.__options.theme&&(this.__options.theme=[this.__options.theme]),"string"==typeof this.__options.parent&&(this.__options.parent=a(this.__options.parent)),"hover"==this.__options.trigger?(this.__options.triggerOpen={mouseenter:!0,touchstart:!0},this.__options.triggerClose={mouseleave:!0,originClick:!0,touchleave:!0}):"click"==this.__options.trigger&&(this.__options.triggerOpen={click:!0,tap:!0},this.__options.triggerClose={click:!0,tap:!0}),this._trigger("options"),this},__prepareGC:function(){var b=this;return b.__options.selfDestruction?b.__garbageCollector=setInterval(function(){var c=(new Date).getTime();b.__touchEvents=a.grep(b.__touchEvents,function(a,b){return c-a.time>6e4}),d(b._$origin)||b.destroy()},2e4):clearInterval(b.__garbageCollector),b},__prepareOrigin:function(){var a=this;if(a._$origin.off("."+a.__namespace+"-triggerOpen"),h.hasTouchCapability&&a._$origin.on("touchstart."+a.__namespace+"-triggerOpen touchend."+a.__namespace+"-triggerOpen touchcancel."+a.__namespace+"-triggerOpen",function(b){a._touchRecordEvent(b)}),a.__options.triggerOpen.click||a.__options.triggerOpen.tap&&h.hasTouchCapability){var b="";a.__options.triggerOpen.click&&(b+="click."+a.__namespace+"-triggerOpen "),a.__options.triggerOpen.tap&&h.hasTouchCapability&&(b+="touchend."+a.__namespace+"-triggerOpen"),a._$origin.on(b,function(b){a._touchIsMeaningfulEvent(b)&&a._open(b)})}if(a.__options.triggerOpen.mouseenter||a.__options.triggerOpen.touchstart&&h.hasTouchCapability){var b="";a.__options.triggerOpen.mouseenter&&(b+="mouseenter."+a.__namespace+"-triggerOpen "),a.__options.triggerOpen.touchstart&&h.hasTouchCapability&&(b+="touchstart."+a.__namespace+"-triggerOpen"),a._$origin.on(b,function(b){!a._touchIsTouchEvent(b)&&a._touchIsEmulatedEvent(b)||(a.__pointerIsOverOrigin=!0,a._openShortly(b))})}if(a.__options.triggerClose.mouseleave||a.__options.triggerClose.touchleave&&h.hasTouchCapability){var b="";a.__options.triggerClose.mouseleave&&(b+="mouseleave."+a.__namespace+"-triggerOpen "),a.__options.triggerClose.touchleave&&h.hasTouchCapability&&(b+="touchend."+a.__namespace+"-triggerOpen touchcancel."+a.__namespace+"-triggerOpen"),a._$origin.on(b,function(b){a._touchIsMeaningfulEvent(b)&&(a.__pointerIsOverOrigin=!1)})}return a},__prepareTooltip:function(){var b=this,c=b.__options.interactive?"auto":"";return b._$tooltip.attr("id",b.__namespace).css({"pointer-events":c,zIndex:b.__options.zIndex}),a.each(b.__previousThemes,function(a,c){b._$tooltip.removeClass(c)}),a.each(b.__options.theme,function(a,c){b._$tooltip.addClass(c)}),b.__previousThemes=a.merge([],b.__options.theme),b},__scrollHandler:function(b){var c=this;if(c.__options.triggerClose.scroll)c._close(b);else{if(b.target===h.window.document)c.__Geometry.origin.fixedLineage||c.__options.repositionOnScroll&&c.reposition(b);else{var d=c.__geometry(),e=!1;if("fixed"!=c._$origin.css("position")&&c.__$originParents.each(function(b,c){var f=a(c),g=f.css("overflow-x"),h=f.css("overflow-y");if("visible"!=g||"visible"!=h){var i=c.getBoundingClientRect();if("visible"!=g&&(d.origin.windowOffset.lefti.right))return e=!0,!1;if("visible"!=h&&(d.origin.windowOffset.topi.bottom))return e=!0,!1}return"fixed"==f.css("position")?!1:void 0}),e)c._$tooltip.css("visibility","hidden");else if(c._$tooltip.css("visibility","visible"),c.__options.repositionOnScroll)c.reposition(b);else{var f=d.origin.offset.left-c.__Geometry.origin.offset.left,g=d.origin.offset.top-c.__Geometry.origin.offset.top;c._$tooltip.css({left:c.__lastPosition.coord.left+f,top:c.__lastPosition.coord.top+g})}}c._trigger({type:"scroll",event:b})}return c},__stateSet:function(a){return this.__state=a,this._trigger({type:"state",state:a}),this},__timeoutsClear:function(){return clearTimeout(this.__timeouts.open),this.__timeouts.open=null,a.each(this.__timeouts.close,function(a,b){clearTimeout(b)}),this.__timeouts.close=[],this},__trackerStart:function(){var a=this,b=a._$tooltip.find(".tooltipster-content");return a.__options.trackTooltip&&(a.__contentBcr=b[0].getBoundingClientRect()),a.__tracker=setInterval(function(){if(d(a._$origin)&&d(a._$tooltip)){if(a.__options.trackOrigin){var e=a.__geometry(),f=!1;c(e.origin.size,a.__Geometry.origin.size)&&(a.__Geometry.origin.fixedLineage?c(e.origin.windowOffset,a.__Geometry.origin.windowOffset)&&(f=!0):c(e.origin.offset,a.__Geometry.origin.offset)&&(f=!0)),f||(a.__options.triggerClose.mouseleave?a._close():a.reposition())}if(a.__options.trackTooltip){var g=b[0].getBoundingClientRect();g.height===a.__contentBcr.height&&g.width===a.__contentBcr.width||(a.reposition(),a.__contentBcr=g)}}else a._close()},a.__options.trackerInterval),a},_close:function(b,c){var d=this,e=!0;if(d._trigger({type:"close",event:b,stop:function(){e=!1}}),e||d.__destroying){c&&d.__callbacks.close.push(c),d.__callbacks.open=[],d.__timeoutsClear();var f=function(){a.each(d.__callbacks.close,function(a,c){c.call(d,d,{event:b,origin:d._$origin[0]})}),d.__callbacks.close=[]};if("closed"!=d.__state){var g=!0,i=new Date,j=i.getTime(),k=j+d.__options.animationDuration[1];if("disappearing"==d.__state&&k>d.__closingTime&&(g=!1),g){d.__closingTime=k,"disappearing"!=d.__state&&d.__stateSet("disappearing");var l=function(){clearInterval(d.__tracker),d._trigger({type:"closing",event:b}),d._$tooltip.off("."+d.__namespace+"-triggerClose").removeClass("tooltipster-dying"),a(h.window).off("."+d.__namespace+"-triggerClose"),d.__$originParents.each(function(b,c){a(c).off("scroll."+d.__namespace+"-triggerClose")}),d.__$originParents=null,a("body").off("."+d.__namespace+"-triggerClose"),d._$origin.off("."+d.__namespace+"-triggerClose"),d._off("dismissable"),d.__stateSet("closed"),d._trigger({type:"after",event:b}),d.__options.functionAfter&&d.__options.functionAfter.call(d,d,{event:b}),f()};h.hasTransitions?(d._$tooltip.css({"-moz-animation-duration":d.__options.animationDuration[1]+"ms","-ms-animation-duration":d.__options.animationDuration[1]+"ms","-o-animation-duration":d.__options.animationDuration[1]+"ms","-webkit-animation-duration":d.__options.animationDuration[1]+"ms","animation-duration":d.__options.animationDuration[1]+"ms","transition-duration":d.__options.animationDuration[1]+"ms"}),d._$tooltip.clearQueue().removeClass("tooltipster-show").addClass("tooltipster-dying"),d.__options.animationDuration[1]>0&&d._$tooltip.delay(d.__options.animationDuration[1]),d._$tooltip.queue(l)):d._$tooltip.stop().fadeOut(d.__options.animationDuration[1],l)}}else f()}return d},_off:function(){return this.__$emitterPrivate.off.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_on:function(){return this.__$emitterPrivate.on.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_one:function(){return this.__$emitterPrivate.one.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_open:function(b,c){var e=this;if(!e.__destroying&&d(e._$origin)&&e.__enabled){var f=!0;if("closed"==e.__state&&(e._trigger({type:"before",event:b,stop:function(){f=!1}}),f&&e.__options.functionBefore&&(f=e.__options.functionBefore.call(e,e,{event:b,origin:e._$origin[0]}))),f!==!1&&null!==e.__Content){c&&e.__callbacks.open.push(c),e.__callbacks.close=[],e.__timeoutsClear();var g,i=function(){"stable"!=e.__state&&e.__stateSet("stable"),a.each(e.__callbacks.open,function(a,b){b.call(e,e,{origin:e._$origin[0],tooltip:e._$tooltip[0]})}),e.__callbacks.open=[]};if("closed"!==e.__state)g=0,"disappearing"===e.__state?(e.__stateSet("appearing"),h.hasTransitions?(e._$tooltip.clearQueue().removeClass("tooltipster-dying").addClass("tooltipster-show"),e.__options.animationDuration[0]>0&&e._$tooltip.delay(e.__options.animationDuration[0]),e._$tooltip.queue(i)):e._$tooltip.stop().fadeIn(i)):"stable"==e.__state&&i();else{if(e.__stateSet("appearing"),g=e.__options.animationDuration[0],e.__contentInsert(),e.reposition(b,!0),h.hasTransitions?(e._$tooltip.addClass("tooltipster-"+e.__options.animation).addClass("tooltipster-initial").css({"-moz-animation-duration":e.__options.animationDuration[0]+"ms","-ms-animation-duration":e.__options.animationDuration[0]+"ms","-o-animation-duration":e.__options.animationDuration[0]+"ms","-webkit-animation-duration":e.__options.animationDuration[0]+"ms","animation-duration":e.__options.animationDuration[0]+"ms","transition-duration":e.__options.animationDuration[0]+"ms"}),setTimeout(function(){"closed"!=e.__state&&(e._$tooltip.addClass("tooltipster-show").removeClass("tooltipster-initial"),e.__options.animationDuration[0]>0&&e._$tooltip.delay(e.__options.animationDuration[0]),e._$tooltip.queue(i))},0)):e._$tooltip.css("display","none").fadeIn(e.__options.animationDuration[0],i),e.__trackerStart(),a(h.window).on("resize."+e.__namespace+"-triggerClose",function(a){e.reposition(a)}).on("scroll."+e.__namespace+"-triggerClose",function(a){e.__scrollHandler(a)}),e.__$originParents=e._$origin.parents(),e.__$originParents.each(function(b,c){a(c).on("scroll."+e.__namespace+"-triggerClose",function(a){e.__scrollHandler(a)})}),e.__options.triggerClose.mouseleave||e.__options.triggerClose.touchleave&&h.hasTouchCapability){e._on("dismissable",function(a){a.dismissable?a.delay?(m=setTimeout(function(){e._close(a.event)},a.delay),e.__timeouts.close.push(m)):e._close(a):clearTimeout(m)});var j=e._$origin,k="",l="",m=null;e.__options.interactive&&(j=j.add(e._$tooltip)),e.__options.triggerClose.mouseleave&&(k+="mouseenter."+e.__namespace+"-triggerClose ",l+="mouseleave."+e.__namespace+"-triggerClose "),e.__options.triggerClose.touchleave&&h.hasTouchCapability&&(k+="touchstart."+e.__namespace+"-triggerClose",l+="touchend."+e.__namespace+"-triggerClose touchcancel."+e.__namespace+"-triggerClose"),j.on(l,function(a){if(e._touchIsTouchEvent(a)||!e._touchIsEmulatedEvent(a)){var b="mouseleave"==a.type?e.__options.delay:e.__options.delayTouch;e._trigger({delay:b[1],dismissable:!0,event:a,type:"dismissable"})}}).on(k,function(a){!e._touchIsTouchEvent(a)&&e._touchIsEmulatedEvent(a)||e._trigger({dismissable:!1,event:a,type:"dismissable"})})}e.__options.triggerClose.originClick&&e._$origin.on("click."+e.__namespace+"-triggerClose",function(a){e._touchIsTouchEvent(a)||e._touchIsEmulatedEvent(a)||e._close(a)}),(e.__options.triggerClose.click||e.__options.triggerClose.tap&&h.hasTouchCapability)&&setTimeout(function(){if("closed"!=e.__state){var b="";e.__options.triggerClose.click&&(b+="click."+e.__namespace+"-triggerClose "),e.__options.triggerClose.tap&&h.hasTouchCapability&&(b+="touchend."+e.__namespace+"-triggerClose"),a("body").on(b,function(b){e._touchIsMeaningfulEvent(b)&&(e._touchRecordEvent(b),e.__options.interactive&&a.contains(e._$tooltip[0],b.target)||e._close(b))}),e.__options.triggerClose.tap&&h.hasTouchCapability&&a("body").on("touchstart."+e.__namespace+"-triggerClose",function(a){e._touchRecordEvent(a)})}},0),e._trigger("ready"),e.__options.functionReady&&e.__options.functionReady.call(e,e,{origin:e._$origin[0],tooltip:e._$tooltip[0]})}if(e.__options.timer>0){var m=setTimeout(function(){e._close()},e.__options.timer+g);e.__timeouts.close.push(m)}}}return e},_openShortly:function(a){var b=this,c=!0;if("stable"!=b.__state&&"appearing"!=b.__state&&!b.__timeouts.open&&(b._trigger({type:"start",event:a,stop:function(){c=!1}}),c)){var d=0==a.type.indexOf("touch")?b.__options.delayTouch:b.__options.delay;d[0]?b.__timeouts.open=setTimeout(function(){b.__timeouts.open=null,b.__pointerIsOverOrigin&&b._touchIsMeaningfulEvent(a)?(b._trigger("startend"),b._open(a)):b._trigger("startcancel")},d[0]):(b._trigger("startend"),b._open(a))}return b},_optionsExtract:function(b,c){var d=this,e=a.extend(!0,{},c),f=d.__options[b];return f||(f={},a.each(c,function(a,b){var c=d.__options[a];void 0!==c&&(f[a]=c)})),a.each(e,function(b,c){void 0!==f[b]&&("object"!=typeof c||c instanceof Array||null==c||"object"!=typeof f[b]||f[b]instanceof Array||null==f[b]?e[b]=f[b]:a.extend(e[b],f[b]))}),e},_plug:function(b){var c=a.tooltipster._plugin(b);if(!c)throw new Error('The "'+b+'" plugin is not defined');return c.instance&&a.tooltipster.__bridge(c.instance,this,c.name),this},_touchIsEmulatedEvent:function(a){for(var b=!1,c=(new Date).getTime(),d=this.__touchEvents.length-1;d>=0;d--){var e=this.__touchEvents[d];if(!(c-e.time<500))break;e.target===a.target&&(b=!0)}return b},_touchIsMeaningfulEvent:function(a){return this._touchIsTouchEvent(a)&&!this._touchSwiped(a.target)||!this._touchIsTouchEvent(a)&&!this._touchIsEmulatedEvent(a)},_touchIsTouchEvent:function(a){return 0==a.type.indexOf("touch")},_touchRecordEvent:function(a){return this._touchIsTouchEvent(a)&&(a.time=(new Date).getTime(),this.__touchEvents.push(a)),this},_touchSwiped:function(a){for(var b=!1,c=this.__touchEvents.length-1;c>=0;c--){var d=this.__touchEvents[c];if("touchmove"==d.type){b=!0;break}if("touchstart"==d.type&&a===d.target)break}return b},_trigger:function(){var b=Array.prototype.slice.apply(arguments);return"string"==typeof b[0]&&(b[0]={type:b[0]}),b[0].instance=this,b[0].origin=this._$origin?this._$origin[0]:null,b[0].tooltip=this._$tooltip?this._$tooltip[0]:null,this.__$emitterPrivate.trigger.apply(this.__$emitterPrivate,b),a.tooltipster._trigger.apply(a.tooltipster,b),this.__$emitterPublic.trigger.apply(this.__$emitterPublic,b),this},_unplug:function(b){var c=this;if(c[b]){var d=a.tooltipster._plugin(b);d.instance&&a.each(d.instance,function(a,d){c[a]&&c[a].bridged===c[b]&&delete c[a]}),c[b].__destroy&&c[b].__destroy(),delete c[b]}return c},close:function(a){return this.__destroyed?this.__destroyError():this._close(null,a),this},content:function(a){var b=this;if(void 0===a)return b.__Content;if(b.__destroyed)b.__destroyError();else if(b.__contentSet(a),null!==b.__Content){if("closed"!==b.__state&&(b.__contentInsert(),b.reposition(),b.__options.updateAnimation))if(h.hasTransitions){var c=b.__options.updateAnimation;b._$tooltip.addClass("tooltipster-update-"+c),setTimeout(function(){"closed"!=b.__state&&b._$tooltip.removeClass("tooltipster-update-"+c)},1e3)}else b._$tooltip.fadeTo(200,.5,function(){"closed"!=b.__state&&b._$tooltip.fadeTo(200,1)})}else b._close();return b},destroy:function(){var b=this;return b.__destroyed?b.__destroyError():b.__destroying||(b.__destroying=!0,b._close(null,function(){b._trigger("destroy"),b.__destroying=!1,b.__destroyed=!0,b._$origin.removeData(b.__namespace).off("."+b.__namespace+"-triggerOpen"),a("body").off("."+b.__namespace+"-triggerOpen");var c=b._$origin.data("tooltipster-ns");if(c)if(1===c.length){var d=null;"previous"==b.__options.restoration?d=b._$origin.data("tooltipster-initialTitle"):"current"==b.__options.restoration&&(d="string"==typeof b.__Content?b.__Content:a("
").append(b.__Content).html()),d&&b._$origin.attr("title",d),b._$origin.removeClass("tooltipstered"),b._$origin.removeData("tooltipster-ns").removeData("tooltipster-initialTitle")}else c=a.grep(c,function(a,c){return a!==b.__namespace}),b._$origin.data("tooltipster-ns",c);b._trigger("destroyed"),b._off(),b.off(),b.__Content=null,b.__$emitterPrivate=null,b.__$emitterPublic=null,b.__options.parent=null,b._$origin=null,b._$tooltip=null,a.tooltipster.__instancesLatestArr=a.grep(a.tooltipster.__instancesLatestArr,function(a,c){return b!==a}),clearInterval(b.__garbageCollector)})),b},disable:function(){return this.__destroyed?(this.__destroyError(),this):(this._close(),this.__enabled=!1,this)},elementOrigin:function(){return this.__destroyed?void this.__destroyError():this._$origin[0]},elementTooltip:function(){return this._$tooltip?this._$tooltip[0]:null},enable:function(){return this.__enabled=!0,this},hide:function(a){return this.close(a)},instance:function(){return this},off:function(){return this.__destroyed||this.__$emitterPublic.off.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},on:function(){return this.__destroyed?this.__destroyError():this.__$emitterPublic.on.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},one:function(){return this.__destroyed?this.__destroyError():this.__$emitterPublic.one.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},open:function(a){return this.__destroyed||this.__destroying?this.__destroyError():this._open(null,a),this},option:function(b,c){return void 0===c?this.__options[b]:(this.__destroyed?this.__destroyError():(this.__options[b]=c,this.__optionsFormat(),a.inArray(b,["trigger","triggerClose","triggerOpen"])>=0&&this.__prepareOrigin(),"selfDestruction"===b&&this.__prepareGC()),this)},reposition:function(a,b){var c=this;return c.__destroyed?c.__destroyError():(d(c._$tooltip)||b)&&(b||c._$tooltip.detach(),c.__Geometry=c.__geometry(),c._trigger({type:"reposition",event:a,helper:{geo:c.__Geometry}})),c},show:function(a){return this.open(a)},status:function(){return{destroyed:this.__destroyed,destroying:this.__destroying,enabled:this.__enabled,open:"closed"!==this.__state,state:this.__state}},triggerHandler:function(){return this.__destroyed?this.__destroyError():this.__$emitterPublic.triggerHandler.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this}},a.fn.tooltipster=function(){var b=Array.prototype.slice.apply(arguments),c="You are using a single HTML element as content for several tooltips. You probably want to set the contentCloning option to TRUE.";if(0===this.length)return this;if("string"==typeof b[0]){var d="#*$~&";return this.each(function(){var e=a(this).data("tooltipster-ns"),f=e?a(this).data(e[0]):null;if(!f)throw new Error("You called Tooltipster's \""+b[0]+'" method on an uninitialized element');if("function"!=typeof f[b[0]])throw new Error('Unknown method "'+b[0]+'"');this.length>1&&"content"==b[0]&&(b[1]instanceof a||"object"==typeof b[1]&&null!=b[1]&&b[1].tagName)&&!f.__options.contentCloning&&f.__options.debug&&console.log(c);var g=f[b[0]](b[1],b[2]);return g!==f||"instance"===b[0]?(d=g,!1):void 0}),"#*$~&"!==d?d:this}a.tooltipster.__instancesLatestArr=[];var e=b[0]&&void 0!==b[0].multiple,g=e&&b[0].multiple||!e&&f.multiple,h=b[0]&&void 0!==b[0].content,i=h&&b[0].content||!h&&f.content,j=b[0]&&void 0!==b[0].contentCloning,k=j&&b[0].contentCloning||!j&&f.contentCloning,l=b[0]&&void 0!==b[0].debug,m=l&&b[0].debug||!l&&f.debug;return this.length>1&&(i instanceof a||"object"==typeof i&&null!=i&&i.tagName)&&!k&&m&&console.log(c),this.each(function(){var c=!1,d=a(this),e=d.data("tooltipster-ns"),f=null;e?g?c=!0:m&&(console.log("Tooltipster: one or more tooltips are already attached to the element below. Ignoring."),console.log(this)):c=!0,c&&(f=new a.Tooltipster(this,b[0]),e||(e=[]),e.push(f.__namespace),d.data("tooltipster-ns",e),d.data(f.__namespace,f),f.__options.functionInit&&f.__options.functionInit.call(f,f,{origin:this}),f._trigger("init")),a.tooltipster.__instancesLatestArr.push(f)}),this},b.prototype={__init:function(b){this.__$tooltip=b,this.__$tooltip.css({left:0,overflow:"hidden",position:"absolute",top:0}).find(".tooltipster-content").css("overflow","auto"),this.$container=a('
').append(this.__$tooltip).appendTo("body")},__forceRedraw:function(){var a=this.__$tooltip.parent();this.__$tooltip.detach(),this.__$tooltip.appendTo(a)},constrain:function(a,b){return this.constraints={width:a,height:b},this.__$tooltip.css({display:"block",height:"",overflow:"auto",width:a}),this},destroy:function(){this.__$tooltip.detach().find(".tooltipster-content").css({display:"",overflow:""}),this.$container.remove()},free:function(){return this.constraints=null,this.__$tooltip.css({display:"",height:"",overflow:"visible",width:""}),this},measure:function(){this.__forceRedraw();var a=this.__$tooltip[0].getBoundingClientRect(),b={size:{height:a.height||a.bottom,width:a.width||a.right}};if(this.constraints){var c=this.__$tooltip.find(".tooltipster-content"),d=this.__$tooltip.outerHeight(),e=c[0].getBoundingClientRect(),f={height:d<=this.constraints.height,width:a.width<=this.constraints.width&&e.width>=c[0].scrollWidth-1};b.fits=f.height&&f.width}return h.IE&&h.IE<=11&&(b.size.width=Math.ceil(b.size.width)+1),b}};var j=navigator.userAgent.toLowerCase();-1!=j.indexOf("msie")?h.IE=parseInt(j.split("msie")[1]):-1!==j.toLowerCase().indexOf("trident")&&-1!==j.indexOf(" rv:11")?h.IE=11:-1!=j.toLowerCase().indexOf("edge/")&&(h.IE=parseInt(j.toLowerCase().split("edge/")[1]));var k="tooltipster.sideTip";return a.tooltipster._plugin({name:k,instance:{__defaults:function(){return{arrow:!0,distance:6,functionPosition:null,maxWidth:null,minIntersection:16,minWidth:0,position:null,side:"top",viewportAware:!0}},__init:function(a){var b=this;b.__instance=a,b.__namespace="tooltipster-sideTip-"+Math.round(1e6*Math.random()),b.__previousState="closed",b.__options,b.__optionsFormat(),b.__instance._on("state."+b.__namespace,function(a){"closed"==a.state?b.__close():"appearing"==a.state&&"closed"==b.__previousState&&b.__create(),b.__previousState=a.state}),b.__instance._on("options."+b.__namespace,function(){b.__optionsFormat()}),b.__instance._on("reposition."+b.__namespace,function(a){b.__reposition(a.event,a.helper)})},__close:function(){this.__instance.content()instanceof a&&this.__instance.content().detach(),this.__instance._$tooltip.remove(),this.__instance._$tooltip=null},__create:function(){var b=a('
');this.__options.arrow||b.find(".tooltipster-box").css("margin",0).end().find(".tooltipster-arrow").hide(),this.__options.minWidth&&b.css("min-width",this.__options.minWidth+"px"),this.__options.maxWidth&&b.css("max-width",this.__options.maxWidth+"px"),this.__instance._$tooltip=b,this.__instance._trigger("created")},__destroy:function(){this.__instance._off("."+self.__namespace)},__optionsFormat:function(){var b=this;if(b.__options=b.__instance._optionsExtract(k,b.__defaults()),b.__options.position&&(b.__options.side=b.__options.position),"object"!=typeof b.__options.distance&&(b.__options.distance=[b.__options.distance]),b.__options.distance.length<4&&(void 0===b.__options.distance[1]&&(b.__options.distance[1]=b.__options.distance[0]), -void 0===b.__options.distance[2]&&(b.__options.distance[2]=b.__options.distance[0]),void 0===b.__options.distance[3]&&(b.__options.distance[3]=b.__options.distance[1]),b.__options.distance={top:b.__options.distance[0],right:b.__options.distance[1],bottom:b.__options.distance[2],left:b.__options.distance[3]}),"string"==typeof b.__options.side){var c={top:"bottom",right:"left",bottom:"top",left:"right"};b.__options.side=[b.__options.side,c[b.__options.side]],"left"==b.__options.side[0]||"right"==b.__options.side[0]?b.__options.side.push("top","bottom"):b.__options.side.push("right","left")}6===a.tooltipster._env.IE&&b.__options.arrow!==!0&&(b.__options.arrow=!1)},__reposition:function(b,c){var d,e=this,f=e.__targetFind(c),g=[];e.__instance._$tooltip.detach();var h=e.__instance._$tooltip.clone(),i=a.tooltipster._getRuler(h),j=!1;switch(a.each(["window","document"],function(d,k){var l=null;if(e.__instance._trigger({container:k,helper:c,satisfied:j,takeTest:function(a){l=a},results:g,type:"positionTest"}),1==l||0!=l&&0==j&&("window"!=k||e.__options.viewportAware))for(var d=0;d=h.outerSize.width&&c.geo.available[k][n].height>=h.outerSize.height?h.fits=!0:h.fits=!1:h.fits=p.fits,"window"==k&&(h.fits?"top"==n||"bottom"==n?h.whole=c.geo.origin.windowOffset.right>=e.__options.minIntersection&&c.geo.window.size.width-c.geo.origin.windowOffset.left>=e.__options.minIntersection:h.whole=c.geo.origin.windowOffset.bottom>=e.__options.minIntersection&&c.geo.window.size.height-c.geo.origin.windowOffset.top>=e.__options.minIntersection:h.whole=!1),g.push(h),h.whole)j=!0;else if("natural"==h.mode&&(h.fits||h.size.width<=c.geo.available[k][n].width))return!1}})}}),e.__instance._trigger({edit:function(a){g=a},event:b,helper:c,results:g,type:"positionTested"}),g.sort(function(a,b){if(a.whole&&!b.whole)return-1;if(!a.whole&&b.whole)return 1;if(a.whole&&b.whole){var c=e.__options.side.indexOf(a.side),d=e.__options.side.indexOf(b.side);return d>c?-1:c>d?1:"natural"==a.mode?-1:1}if(a.fits&&!b.fits)return-1;if(!a.fits&&b.fits)return 1;if(a.fits&&b.fits){var c=e.__options.side.indexOf(a.side),d=e.__options.side.indexOf(b.side);return d>c?-1:c>d?1:"natural"==a.mode?-1:1}return"document"==a.container&&"bottom"==a.side&&"natural"==a.mode?-1:1}),d=g[0],d.coord={},d.side){case"left":case"right":d.coord.top=Math.floor(d.target-d.size.height/2);break;case"bottom":case"top":d.coord.left=Math.floor(d.target-d.size.width/2)}switch(d.side){case"left":d.coord.left=c.geo.origin.windowOffset.left-d.outerSize.width;break;case"right":d.coord.left=c.geo.origin.windowOffset.right+d.distance.horizontal;break;case"top":d.coord.top=c.geo.origin.windowOffset.top-d.outerSize.height;break;case"bottom":d.coord.top=c.geo.origin.windowOffset.bottom+d.distance.vertical}"window"==d.container?"top"==d.side||"bottom"==d.side?d.coord.left<0?c.geo.origin.windowOffset.right-this.__options.minIntersection>=0?d.coord.left=0:d.coord.left=c.geo.origin.windowOffset.right-this.__options.minIntersection-1:d.coord.left>c.geo.window.size.width-d.size.width&&(c.geo.origin.windowOffset.left+this.__options.minIntersection<=c.geo.window.size.width?d.coord.left=c.geo.window.size.width-d.size.width:d.coord.left=c.geo.origin.windowOffset.left+this.__options.minIntersection+1-d.size.width):d.coord.top<0?c.geo.origin.windowOffset.bottom-this.__options.minIntersection>=0?d.coord.top=0:d.coord.top=c.geo.origin.windowOffset.bottom-this.__options.minIntersection-1:d.coord.top>c.geo.window.size.height-d.size.height&&(c.geo.origin.windowOffset.top+this.__options.minIntersection<=c.geo.window.size.height?d.coord.top=c.geo.window.size.height-d.size.height:d.coord.top=c.geo.origin.windowOffset.top+this.__options.minIntersection+1-d.size.height):(d.coord.left>c.geo.window.size.width-d.size.width&&(d.coord.left=c.geo.window.size.width-d.size.width),d.coord.left<0&&(d.coord.left=0)),e.__sideChange(h,d.side),c.tooltipClone=h[0],c.tooltipParent=e.__instance.option("parent").parent[0],c.mode=d.mode,c.whole=d.whole,c.origin=e.__instance._$origin[0],c.tooltip=e.__instance._$tooltip[0],delete d.container,delete d.fits,delete d.mode,delete d.outerSize,delete d.whole,d.distance=d.distance.horizontal||d.distance.vertical;var k=a.extend(!0,{},d);if(e.__instance._trigger({edit:function(a){d=a},event:b,helper:c,position:k,type:"position"}),e.__options.functionPosition){var l=e.__options.functionPosition.call(e,e.__instance,c,k);l&&(d=l)}i.destroy();var m,n;"top"==d.side||"bottom"==d.side?(m={prop:"left",val:d.target-d.coord.left},n=d.size.width-this.__options.minIntersection):(m={prop:"top",val:d.target-d.coord.top},n=d.size.height-this.__options.minIntersection),m.valn&&(m.val=n);var o;o=c.geo.origin.fixedLineage?c.geo.origin.windowOffset:{left:c.geo.origin.windowOffset.left+c.geo.window.scroll.left,top:c.geo.origin.windowOffset.top+c.geo.window.scroll.top},d.coord={left:o.left+(d.coord.left-c.geo.origin.windowOffset.left),top:o.top+(d.coord.top-c.geo.origin.windowOffset.top)},e.__sideChange(e.__instance._$tooltip,d.side),c.geo.origin.fixedLineage?e.__instance._$tooltip.css("position","fixed"):e.__instance._$tooltip.css("position",""),e.__instance._$tooltip.css({left:d.coord.left,top:d.coord.top,height:d.size.height,width:d.size.width}).find(".tooltipster-arrow").css({left:"",top:""}).css(m.prop,m.val),e.__instance._$tooltip.appendTo(e.__instance.option("parent")),e.__instance._trigger({type:"repositioned",event:b,position:d})},__sideChange:function(a,b){a.removeClass("tooltipster-bottom").removeClass("tooltipster-left").removeClass("tooltipster-right").removeClass("tooltipster-top").addClass("tooltipster-"+b)},__targetFind:function(a){var b={},c=this.__instance._$origin[0].getClientRects();if(c.length>1){var d=this.__instance._$origin.css("opacity");1==d&&(this.__instance._$origin.css("opacity",.99),c=this.__instance._$origin[0].getClientRects(),this.__instance._$origin.css("opacity",1))}if(c.length<2)b.top=Math.floor(a.geo.origin.windowOffset.left+a.geo.origin.size.width/2),b.bottom=b.top,b.left=Math.floor(a.geo.origin.windowOffset.top+a.geo.origin.size.height/2),b.right=b.left;else{var e=c[0];b.top=Math.floor(e.left+(e.right-e.left)/2),e=c.length>2?c[Math.ceil(c.length/2)-1]:c[0],b.right=Math.floor(e.top+(e.bottom-e.top)/2),e=c[c.length-1],b.bottom=Math.floor(e.left+(e.right-e.left)/2),e=c.length>2?c[Math.ceil((c.length+1)/2)-1]:c[c.length-1],b.left=Math.floor(e.top+(e.bottom-e.top)/2)}return b}}}),a}); \ No newline at end of file diff --git a/kinsta-mu-plugins/shared/styles/common.css b/kinsta-mu-plugins/shared/styles/common.css deleted file mode 100644 index 0e28de4..0000000 --- a/kinsta-mu-plugins/shared/styles/common.css +++ /dev/null @@ -1,725 +0,0 @@ -/** - * BASIC LINK STYLE - * Link styles to match the website -*/ - -.kinsta-page-wrapper a { - color: #5333ed; - text-decoration: none; - border-bottom: 2px solid #2cd4d9; - position: relative; -} - -.kinsta-page-wrapper a:before { - width: 0; - position: absolute; - content: " "; - border-bottom: 2px solid #5333ed; - transition: all 120ms linear; - height: 100%; - top: 0; -} - -.kinsta-page-wrapper a:hover:before { - width: 100%; -} - -/** - * KINSTA PAGE BAR - * Shown at the top of all admin pages - */ -.kinsta-page-bar { - - /*max-width:1133px;*/ - background: #fff; - position: relative; - box-sizing: border-box; - padding: 16px 22px; - margin-top: 20px; - display: flex; - align-items: center; - margin-bottom: 20px; - border: 1px solid #e4e4e4; -} - -.kinsta-page-bar h3 { - margin: 0; - color: #555; - font-weight: 300; - border-left: 1px solid rgba(0, 0, 0, 0.1); - padding: 0 0 0 11px; - font-size: 15px; -} - -.kinsta-page-bar .logo { - margin-right: 11px; -} - -.kinstamu-whitelabel .kinsta-page-bar h3 { - border-left: 0; - padding-left: 0; -} - -/** - * GENERAL STRUCTURAL ELEMENTS - * Used on all pages to create the sidebar and content structure and other - * common elements - */ - -.kinsta-page-wrapper * { - box-sizing: border-box; -} - -.kinsta-page-wrapper { - display: flex; - flex-direction: row-reverse; - margin-top: 30px; -} - -.kinsta-sidebar { - flex: 0 0 280px; - width: 280px; - margin-left: 33px; -} - -.kinsta-main-content { - - /*max-width:820px;*/ - width: 100%; -} - -.kinsta-flex { - display: flex; - align-items: center; -} - -@media screen and (max-width: 1099px) { - - .kinsta-page-wrapper { - display: block; - } - - .kinsta-sidebar { - display: block; - width: 100%; - margin-left: 0; - margin-top: 22px; - } -} - -/** - * KINSTA BOX - * Used all over on the admin, a structure with a deep blue header and - * a white content area - */ - -.kinsta-box-title-bar { - background: #42495b; - padding: 16px; - display: block; - width: 100%; -} - -.kinsta-box-title-bar h3 { - color: #fff; - font-weight: 400; - margin: 0; - font-size: 14px; - padding: 0; -} - -.kinsta-box-title-bar__small { - padding: 11px 16px; -} - -.kinsta-box-title-bar__small h3 { - font-size: 13px; -} - -.kinsta-box-content { - background: #fff; - padding: 22px; - border: 1px solid #e4e4e4; - border-top: 0; -} - -/** - * TYPOGRAPHY - * Some basic typography rules on our admin pages - */ - -.kinsta-page-wrapper .mb0 { - margin-bottom: 0; -} - -.kinsta-page-wrapper .mb6 { - margin-bottom: 6px; -} - -.kinsta-page-wrapper .mb11 { - margin-bottom: 11px; -} - -.kinsta-page-wrapper .mb22 { - margin-bottom: 22px; -} - -.kinsta-page-wrapper .mb33 { - margin-bottom: 33px; -} - -.kinsta-page-wrapper .mb44 { - margin-bottom: 44px; -} - -.kinsta-page-wrapper .mr0 { - margin-right: 0; -} - -.kinsta-page-wrapper .mr6 { - margin-right: 6px; -} - -.kinsta-page-wrapper .mr11 { - margin-right: 11px; -} - -.kinsta-page-wrapper .mr22 { - margin-right: 22px; -} - -.kinsta-page-wrapper .mr33 { - margin-right: 33px; -} - -.kinsta-page-wrapper .mr44 { - margin-right: 44px; -} - -.kinsta-page-wrapper p { - margin: 0 0 22px; - line-height: 28px; - font-weight: 300; - font-size: 16px; -} - -.kinsta-page-wrapper .content > *:last-child { - margin-bottom: 0; -} - -/** - * KINSTA WIDGET - * Styles common to all widgets - */ - -.kinsta-widget { - margin-bottom: 33px; -} - -/** - * KINSTA FORM GENERAL - */ - -.kinsta-control-container { - position: relative; - padding-right: 22px; -} - -/** - * KINSTA NUMBER FIELD - */ - -.kinsta-number-field { - padding: 3px 0; -} - -.kinsta-number-field .kinsta-control { - width: 68px; - color: #888; - text-align: center; - box-sizing: border-box; - background: linear-gradient(to bottom, #eee, #fff 25px); - background-image: -webkit-linear-gradient(top, #eee, #fff 25px); - box-shadow: - inset 0 -1px #fff, - inset 0 1px 1px rgba(0, 0, 0, 0.05); - margin-right: 11px; -} - -/** - * KINSTA SELECT FIELD - */ - -.kinsta-select-field { - padding: 3px 0; -} - -.kinsta-select-field .kinsta-control { - color: #888; - text-align: center; - box-sizing: border-box; - background: linear-gradient(to bottom, #eee, #fff 25px); - background-image: -webkit-linear-gradient(top, #eee, #fff 25px); - box-shadow: - inset 0 -1px #fff, - inset 0 1px 1px rgba(0, 0, 0, 0.05); - margin-right: 11px; -} - -/** - * ANIMATED SWITCH CHECKBOX - * Full CSS animated sliding yes/no indicator - */ - -.kinsta-switch { - display: flex; - align-items: center; - padding: 6px 0; -} - -.kinsta-switch .kinsta-control-ui { - position: relative; - display: inline-block; - vertical-align: top; - width: 70px; - height: 30px; - padding: 3px; - margin-right: 11px; - background: linear-gradient(to bottom, #eee, #fff 25px); - background-image: -webkit-linear-gradient(top, #eee, #fff 25px); - border-radius: 18px; - box-shadow: - inset 0 -1px #fff, - inset 0 1px 1px rgba(0, 0, 0, 0.05); - cursor: pointer; -} - -.kinsta-switch .kinsta-control { - position: absolute; - top: 0; - left: 0; - opacity: 0; -} - -.kinsta-switch-label { - position: relative; - display: block; - height: inherit; - font-size: 11px; - font-weight: 600; - text-transform: uppercase; - background: #eceeef; - border-radius: inherit; - box-shadow: - inset 0 1px 2px rgba(0, 0, 0, 0.12), - inset 0 0 2px rgba(0, 0, 0, 0.15); -} - -.kinsta-switch-label:before, -.kinsta-switch-label:after { - position: absolute; - top: 50%; - margin-top: -0.5em; - line-height: 1; - -webkit-transition: inherit; - -moz-transition: inherit; - -o-transition: inherit; - transition: inherit; -} - -.kinsta-switch-label:before { - content: attr(data-off); - right: 11px; - color: #aaa; - text-shadow: 0 1px rgba(255, 255, 255, 0.5); -} - -.kinsta-switch-label:after { - content: attr(data-on); - left: 11px; - color: #fff; - text-shadow: 0 1px rgba(0, 0, 0, 0.2); - opacity: 0; -} - -.kinsta-switch .kinsta-control:checked ~ .kinsta-switch-label { - background: #8ce196; - box-shadow: - inset 0 1px 2px rgba(0, 0, 0, 0.15), - inset 0 0 3px rgba(0, 0, 0, 0.2); -} - -.kinsta-switch .kinsta-control:checked ~ .kinsta-switch-label:before { - opacity: 0; -} - -.kinsta-switch .kinsta-control:checked ~ .kinsta-switch-label:after { - opacity: 1; -} - -.kinsta-switch-handle { - position: absolute; - top: 4px; - left: 4px; - width: 28px; - height: 28px; - background: linear-gradient(to bottom, #fff 40%, #f0f0f0); - background-image: -webkit-linear-gradient(top, #fff 40%, #f0f0f0); - border-radius: 100%; - box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2); -} - -.kinsta-switch-handle:before { - content: ""; - position: absolute; - top: 50%; - left: 50%; - margin: -6px 0 0 -6px; - width: 12px; - height: 12px; - background: linear-gradient(to bottom, #eee, #fff); - background-image: -webkit-linear-gradient(top, #eee, #fff); - border-radius: 6px; - box-shadow: inset 0 1px rgba(0, 0, 0, 0.02); -} - -.kinsta-switch .kinsta-control:checked ~ .kinsta-switch-handle { - left: 40px; - box-shadow: -1px 1px 5px rgba(0, 0, 0, 0.2); -} - -.kinsta-switch-label, -.kinsta-switch-handle { - transition: all 0.3s ease; - -webkit-transition: all 0.3s ease; - -moz-transition: all 0.3s ease; - -o-transition: all 0.3s ease; -} - -/** - * KINSTA BUTTON - * Basic buttons styles and progress button addon - */ - -.kinsta-button { - display: inline-block; - box-sizing: border-box; - padding: 11px 22px; - outline: none; - border: 2px solid #5333ed; - background-color: #5333ed; - color: #fff; - text-transform: uppercase; - letter-spacing: 1px; - font-size: 14px; - position: relative; - overflow: hidden; - -webkit-appearance: none; - text-decoration: none; - cursor: pointer; - transition: background 200ms linear; - font-weight: 300; - border-radius: 100px; -} - -.kinsta-button:hover { - background: #fff; - color: #5333ed; -} - -.kinsta-button__full { - text-align: center; - display: block; - width: 100%; -} - -.kinsta-button__full-left { - text-align: left; - display: block; - width: 100%; -} - -.kinsta-button__large { - padding: 22px; -} - -.kinsta-button__white { - background: #fff; - color: #888; -} - -.kinsta-button__white:hover { - background: #f1f1f1; -} - -.kinsta-button .progress { - position: absolute; - left: 0; - bottom: 0; - width: 100%; - height: 12px; - background-color: transparent; -} - -.kinsta-button .progress-bar { - height: 12px; - width: 0%; - background: rgba(0, 0, 0, 0.25); -} - -.kinsta-button .text { - display: inline-block; -} - -/** - * KINSTA DROPDOWN - * Styles for the dropdown functionality - */ - -.kinsta-dropdown { - position: relative; - display: inline-block; -} - -.kinsta-dropdown__full { - display: block; - width: 100%; -} - -.kinsta-dropdown > .kinsta-button { - background-image: url(../images/arrow-down.svg); - background-repeat: no-repeat; - background-position: calc(100% - 20px) calc(50% - 1px); - background-size: 13px; - padding-right: 44px; -} - -.kinsta-dropdown-content { - display: none; - position: absolute; - background-color: #fff; - width: 100%; - min-width: 160px; - box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2); - border-radius: 100px; -} - -.kinsta-dropdown-content > a, -.kinsta-dropdown-content > span { - color: #000; - padding: 12px 16px; - text-decoration: none; - display: block; - cursor: pointer; -} - -.kinsta-dropdown-content button { - border-radius: 0 !important; - border: 0 !important; -} - -.kinsta-dropdown-content button:first-of-type { - border-top-right-radius: 30px !important; - border-top-left-radius: 30px !important; -} - -/* .kinsta-dropdown-content button:last-of-type { - border-bottom-right-radius: 100px !important; - border-bottom-left-radius: 100px !important; - }*/ - -.kinsta-dropdown-content > a:hover, -.kinsta-dropdown-content > span:hover { - background-color: #f1f1f1; -} - -.kinsta-dropdown:hover .kinsta-dropdown-content { - display: block; -} - -.kinsta-dropdown:hover > .kinsta-button { - background-color: #5333ed; - color: #fff; -} - -/** - * KINSTA QUICKSAVE - * Styles for the quicksave functionality - */ - -.kinsta-quicksave-message { - margin-left: 11px; - display: inline-block; - color: #fff; - padding: 4px 11px; -} - -.kinsta-quicksave-success { - background: #78db7b; -} - -.kinsta-quicksave-error { - background: #fb8686; -} - -/** - * KINSTA MESSAGE - * Styles for error and success messages - */ - -.kinsta-message { - display: block; - color: #fff; - padding: 11px; - margin-bottom: 22px; -} - -.kinsta-message-success { - background: #78db7b; -} - -.kinsta-message-error { - background: #fb8686; -} - -.kinsta-inbox-message-warning { - background-color: #dcbb18; - margin: 0 -22px 22px -22px; - position: relative; - padding: 22px 22px 22px 55px; - text-align: justify; - line-height: 28px; - font-weight: 300; - font-size: 16px; -} - -.kinsta-inbox-message-warning:before { - content: ""; - position: absolute; - left: 0; - top: 0; - height: 100%; - width: 44px; - display: block; - background-image: url(../images/warning.svg); - background-color: rgba(0, 0, 0, 0.1); - background-size: 28px 28px; - background-repeat: no-repeat; - background-position: 8px center; -} - -/** - * KINSTA TOOLTIPS - * Styles for the tooltips - */ - -.kinsta-tooltip { - position: absolute; - top: 11px; - right: 0; - opacity: 0.4; -} - -.kinsta-tooltip:hover { - opacity: 1; -} - -.kinsta-tooltip-content { - display: none; -} - -/** - * KINSTA TABLE - * Simple Table Layout - */ - -.kinsta-table { - width: 100%; - border-collapse: collapse; -} - -.kinsta-table th { - padding: 11px; - text-align: left; - border-bottom: 1px solid #ddd; -} - -.kinsta-table td { - padding: 11px; -} - -.kinsta-table tbody tr:nth-of-type(odd) { - background: #f1f1f1; -} - -/** - * CACHE PURGE FORM - */ -#custom-url-form { - padding: 22px; - background: #f1f1f1; -} - -#custom-url-form h3 { - margin: 0 0 11px; - font-size: 14px; -} - -#custom-url-form-fields { - display: flex; - align-items: center; -} - -#custom-url-form select { - margin-right: 4px; - background: #fff; - font-size: 13px; - line-height: 22px; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; - padding: 3px 33px 3px 14px; - box-sizing: content-box; - background-repeat: no-repeat; - background-position: calc(100% - 11px) center; - background-image: url('data:image/svg+xml;utf8,'); -} - -#custom-url-form .prefix { - background: #fff; - padding: 6px 2px 6px 11px; - border: 1px solid #ddd; - border-right: 0; - font-size: 13px; - line-height: 22px; - margin-right: -2px; - box-shadow: none; - white-space: nowrap; -} - -#custom-url-form input[type="text"] { - background: #fff; - box-shadow: none; - font-size: 13px; - width: 100%; - line-height: 22px; - padding: 6px 6px 6px 2px; - border: 1px solid #ddd; - border-left: 0; -} - -#custom-url-form input[type="submit"] { - font-size: 13px; - line-height: 22px; - padding: 6px 11px; - background: #5333ed; - border: 1px solid #5333ed; - color: #fff; - - /*border:0px;*/ - cursor: pointer; - margin: 0; - margin-left: -2px; - border-top-right-radius: 22px; - border-bottom-right-radius: 22px; -} diff --git a/kinsta-mu-plugins/shared/styles/tooltipster.bundle.css b/kinsta-mu-plugins/shared/styles/tooltipster.bundle.css deleted file mode 100644 index 2e3f322..0000000 --- a/kinsta-mu-plugins/shared/styles/tooltipster.bundle.css +++ /dev/null @@ -1,396 +0,0 @@ -/* This is the core CSS of Tooltipster */ - -/* GENERAL STRUCTURE RULES (do not edit this section) */ - -.tooltipster-base { - /* this ensures that a constrained height set by functionPosition, - if greater that the natural height of the tooltip, will be enforced - in browsers that support display:flex */ - display: flex; - pointer-events: none; - /* this may be overriden in JS for fixed position origins */ - position: absolute; -} - -.tooltipster-box { - /* see .tooltipster-base. flex-shrink 1 is only necessary for IE10- - and flex-basis auto for IE11- (at least) */ - flex: 1 1 auto; -} - -.tooltipster-content { - /* prevents an overflow if the user adds padding to the div */ - box-sizing: border-box; - /* these make sure we'll be able to detect any overflow */ - max-height: 100%; - max-width: 100%; - overflow: auto; -} - -.tooltipster-ruler { - /* these let us test the size of the tooltip without overflowing the window */ - bottom: 0; - left: 0; - overflow: hidden; - position: fixed; - right: 0; - top: 0; - visibility: hidden; -} - -/* ANIMATIONS */ - -/* Open/close animations */ - -/* fade */ - -.tooltipster-fade { - opacity: 0; - -webkit-transition-property: opacity; - -moz-transition-property: opacity; - -o-transition-property: opacity; - -ms-transition-property: opacity; - transition-property: opacity; -} -.tooltipster-fade.tooltipster-show { - opacity: 1; -} - -/* grow */ - -.tooltipster-grow { - -webkit-transform: scale(0,0); - -moz-transform: scale(0,0); - -o-transform: scale(0,0); - -ms-transform: scale(0,0); - transform: scale(0,0); - -webkit-transition-property: -webkit-transform; - -moz-transition-property: -moz-transform; - -o-transition-property: -o-transform; - -ms-transition-property: -ms-transform; - transition-property: transform; - -webkit-backface-visibility: hidden; -} -.tooltipster-grow.tooltipster-show { - -webkit-transform: scale(1,1); - -moz-transform: scale(1,1); - -o-transform: scale(1,1); - -ms-transform: scale(1,1); - transform: scale(1,1); - -webkit-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); - -webkit-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); - -moz-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); - -ms-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); - -o-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); - transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); -} - -/* swing */ - -.tooltipster-swing { - opacity: 0; - -webkit-transform: rotateZ(4deg); - -moz-transform: rotateZ(4deg); - -o-transform: rotateZ(4deg); - -ms-transform: rotateZ(4deg); - transform: rotateZ(4deg); - -webkit-transition-property: -webkit-transform, opacity; - -moz-transition-property: -moz-transform; - -o-transition-property: -o-transform; - -ms-transition-property: -ms-transform; - transition-property: transform; -} -.tooltipster-swing.tooltipster-show { - opacity: 1; - -webkit-transform: rotateZ(0deg); - -moz-transform: rotateZ(0deg); - -o-transform: rotateZ(0deg); - -ms-transform: rotateZ(0deg); - transform: rotateZ(0deg); - -webkit-transition-timing-function: cubic-bezier(0.230, 0.635, 0.495, 1); - -webkit-transition-timing-function: cubic-bezier(0.230, 0.635, 0.495, 2.4); - -moz-transition-timing-function: cubic-bezier(0.230, 0.635, 0.495, 2.4); - -ms-transition-timing-function: cubic-bezier(0.230, 0.635, 0.495, 2.4); - -o-transition-timing-function: cubic-bezier(0.230, 0.635, 0.495, 2.4); - transition-timing-function: cubic-bezier(0.230, 0.635, 0.495, 2.4); -} - -/* fall */ - -.tooltipster-fall { - -webkit-transition-property: top; - -moz-transition-property: top; - -o-transition-property: top; - -ms-transition-property: top; - transition-property: top; - -webkit-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); - -webkit-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); - -moz-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); - -ms-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); - -o-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); - transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); -} -.tooltipster-fall.tooltipster-initial { - top: 0 !important; -} -.tooltipster-fall.tooltipster-show { -} -.tooltipster-fall.tooltipster-dying { - -webkit-transition-property: all; - -moz-transition-property: all; - -o-transition-property: all; - -ms-transition-property: all; - transition-property: all; - top: 0 !important; - opacity: 0; -} - -/* slide */ - -.tooltipster-slide { - -webkit-transition-property: left; - -moz-transition-property: left; - -o-transition-property: left; - -ms-transition-property: left; - transition-property: left; - -webkit-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); - -webkit-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); - -moz-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); - -ms-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); - -o-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); - transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); -} -.tooltipster-slide.tooltipster-initial { - left: -40px !important; -} -.tooltipster-slide.tooltipster-show { -} -.tooltipster-slide.tooltipster-dying { - -webkit-transition-property: all; - -moz-transition-property: all; - -o-transition-property: all; - -ms-transition-property: all; - transition-property: all; - left: 0 !important; - opacity: 0; -} - -/* Update animations */ - -/* We use animations rather than transitions here because - transition durations may be specified in the style tag due to - animationDuration, and we try to avoid collisions and the use - of !important */ - -/* fade */ - -@keyframes tooltipster-fading { - 0% { - opacity: 0; - } - 100% { - opacity: 1; - } -} - -.tooltipster-update-fade { - animation: tooltipster-fading 400ms; -} - -/* rotate */ - -@keyframes tooltipster-rotating { - 25% { - transform: rotate(-2deg); - } - 75% { - transform: rotate(2deg); - } - 100% { - transform: rotate(0); - } -} - -.tooltipster-update-rotate { - animation: tooltipster-rotating 600ms; -} - -/* scale */ - -@keyframes tooltipster-scaling { - 50% { - transform: scale(1.1); - } - 100% { - transform: scale(1); - } -} - -.tooltipster-update-scale { - animation: tooltipster-scaling 600ms; -} - -/** - * DEFAULT STYLE OF THE SIDETIP PLUGIN - * - * All styles are "namespaced" with .tooltipster-sidetip to prevent - * conflicts between plugins. - */ - -/* .tooltipster-box */ - -.tooltipster-sidetip .tooltipster-box { - background: #565656; - border: 2px solid black; - border-radius: 4px; -} - -.tooltipster-sidetip.tooltipster-bottom .tooltipster-box { - margin-top: 8px; -} - -.tooltipster-sidetip.tooltipster-left .tooltipster-box { - margin-right: 8px; -} - -.tooltipster-sidetip.tooltipster-right .tooltipster-box { - margin-left: 8px; -} - -.tooltipster-sidetip.tooltipster-top .tooltipster-box { - margin-bottom: 8px; -} - -/* .tooltipster-content */ - -.tooltipster-sidetip .tooltipster-content { - color: white; - line-height: 18px; - padding: 6px 14px; -} - -/* .tooltipster-arrow : will keep only the zone of .tooltipster-arrow-uncropped that -corresponds to the arrow we want to display */ - -.tooltipster-sidetip .tooltipster-arrow { - overflow: hidden; - position: absolute; -} - -.tooltipster-sidetip.tooltipster-bottom .tooltipster-arrow { - height: 10px; - /* half the width, for centering */ - margin-left: -10px; - top: 0; - width: 20px; -} - -.tooltipster-sidetip.tooltipster-left .tooltipster-arrow { - height: 20px; - margin-top: -10px; - right: 0; - /* top 0 to keep the arrow from overflowing .tooltipster-base when it has not - been positioned yet */ - top: 0; - width: 10px; -} - -.tooltipster-sidetip.tooltipster-right .tooltipster-arrow { - height: 20px; - margin-top: -10px; - left: 0; - /* same as .tooltipster-left .tooltipster-arrow */ - top: 0; - width: 10px; -} - -.tooltipster-sidetip.tooltipster-top .tooltipster-arrow { - bottom: 0; - height: 10px; - margin-left: -10px; - width: 20px; -} - -/* common rules between .tooltipster-arrow-background and .tooltipster-arrow-border */ - -.tooltipster-sidetip .tooltipster-arrow-background, .tooltipster-sidetip .tooltipster-arrow-border { - height: 0; - position: absolute; - width: 0; -} - -/* .tooltipster-arrow-background */ - -.tooltipster-sidetip .tooltipster-arrow-background { - border: 10px solid transparent; -} - -.tooltipster-sidetip.tooltipster-bottom .tooltipster-arrow-background { - border-bottom-color: #565656; - left: 0px; - top: 3px; -} - -.tooltipster-sidetip.tooltipster-left .tooltipster-arrow-background { - border-left-color: #565656; - left: -3px; - top: 0px; -} - -.tooltipster-sidetip.tooltipster-right .tooltipster-arrow-background { - border-right-color: #565656; - left: 3px; - top: 0px; -} - -.tooltipster-sidetip.tooltipster-top .tooltipster-arrow-background { - border-top-color: #565656; - left: 0px; - top: -3px; -} - -/* .tooltipster-arrow-border */ - -.tooltipster-sidetip .tooltipster-arrow-border { - border: 10px solid transparent; - left: 0; - top: 0; -} - -.tooltipster-sidetip.tooltipster-bottom .tooltipster-arrow-border { - border-bottom-color: black; -} - -.tooltipster-sidetip.tooltipster-left .tooltipster-arrow-border { - border-left-color: black; -} - -.tooltipster-sidetip.tooltipster-right .tooltipster-arrow-border { - border-right-color: black; -} - -.tooltipster-sidetip.tooltipster-top .tooltipster-arrow-border { - border-top-color: black; -} - -/* tooltipster-arrow-uncropped */ - -.tooltipster-sidetip .tooltipster-arrow-uncropped { - position: relative; -} - -.tooltipster-sidetip.tooltipster-bottom .tooltipster-arrow-uncropped { - top: -10px; -} - -.tooltipster-sidetip.tooltipster-right .tooltipster-arrow-uncropped { - left: -10px; -} - - -.tooltipster-sidetip.tooltipster-borderless .tooltipster-box a { - color: #fff; - text-decoration: underline; -} - -.tooltipster-sidetip.tooltipster-borderless .tooltipster-box{padding:6px;border:none;background:#1b1b1b;background:rgba(50,50,50,1); font-size:11px; font-family:monaco, monospace }.tooltipster-sidetip.tooltipster-borderless.tooltipster-bottom .tooltipster-box{margin-top:8px}.tooltipster-sidetip.tooltipster-borderless.tooltipster-left .tooltipster-box{margin-right:8px}.tooltipster-sidetip.tooltipster-borderless.tooltipster-right .tooltipster-box{margin-left:8px}.tooltipster-sidetip.tooltipster-borderless.tooltipster-top .tooltipster-box{margin-bottom:8px}.tooltipster-sidetip.tooltipster-borderless .tooltipster-arrow{height:8px;margin-left:-8px;width:16px}.tooltipster-sidetip.tooltipster-borderless.tooltipster-left .tooltipster-arrow,.tooltipster-sidetip.tooltipster-borderless.tooltipster-right .tooltipster-arrow{height:16px;margin-left:0;margin-top:-8px;width:8px}.tooltipster-sidetip.tooltipster-borderless .tooltipster-arrow-background{display:none}.tooltipster-sidetip.tooltipster-borderless .tooltipster-arrow-border{border:8px solid transparent}.tooltipster-sidetip.tooltipster-borderless.tooltipster-bottom .tooltipster-arrow-border{border-bottom-color:#1b1b1b;border-bottom-color:rgba(10,10,10,.9)}.tooltipster-sidetip.tooltipster-borderless.tooltipster-left .tooltipster-arrow-border{border-left-color:#1b1b1b;border-left-color:rgba(10,10,10,.9)}.tooltipster-sidetip.tooltipster-borderless.tooltipster-right .tooltipster-arrow-border{border-right-color:#1b1b1b;border-right-color:rgba(10,10,10,.9)}.tooltipster-sidetip.tooltipster-borderless.tooltipster-top .tooltipster-arrow-border{border-top-color:#1b1b1b;border-top-color:rgba(10,10,10,.9)}.tooltipster-sidetip.tooltipster-borderless.tooltipster-bottom .tooltipster-arrow-uncropped{top:-8px}.tooltipster-sidetip.tooltipster-borderless.tooltipster-right .tooltipster-arrow-uncropped{left:-8px} diff --git a/kinsta-mu-plugins/shared/translations/kinsta-mu-plugins-es_ES.mo b/kinsta-mu-plugins/shared/translations/kinsta-mu-plugins-es_ES.mo deleted file mode 100644 index 055dae3..0000000 Binary files a/kinsta-mu-plugins/shared/translations/kinsta-mu-plugins-es_ES.mo and /dev/null differ diff --git a/kinsta-mu-plugins/shared/translations/kinsta-mu-plugins-es_ES.po b/kinsta-mu-plugins/shared/translations/kinsta-mu-plugins-es_ES.po deleted file mode 100644 index 13e9b24..0000000 --- a/kinsta-mu-plugins/shared/translations/kinsta-mu-plugins-es_ES.po +++ /dev/null @@ -1,268 +0,0 @@ -msgid "" -msgstr "" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" -"Project-Id-Version: Kinsta Must-use Plugins\n" -"POT-Creation-Date: 2018-08-29 10:49+0700\n" -"PO-Revision-Date: 2018-10-31 18:28-0600\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 2.2\n" -"X-Poedit-Basepath: ../../..\n" -"X-Poedit-WPHeader: kinsta-mu-plugins.php\n" -"X-Poedit-SourceCharset: UTF-8\n" -"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;" -"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;" -"_nx_noop:3c,1,2;__ngettext_noop:1,2\n" -"Last-Translator: \n" -"Language: es\n" -"X-Poedit-SearchPath-0: .\n" -"X-Poedit-SearchPath-1: kinsta-mu-plugins\n" -"X-Poedit-SearchPathExcluded-0: *.js\n" - -#: kinsta-mu-plugins/cache/class-cache-admin.php:60 -#: kinsta-mu-plugins/cache/pages/pages.php:42 -msgid "Kinsta Cache" -msgstr "Caché de Kinsta" - -#: kinsta-mu-plugins/cache/class-cache-admin.php:60 -msgid "Cache Settings" -msgstr "Configuración de Caché" - -#: kinsta-mu-plugins/cache/class-cache-admin.php:89 -#: kinsta-mu-plugins/cache/class-cache-admin.php:90 -#: kinsta-mu-plugins/cache/class-cache-admin.php:125 -#: kinsta-mu-plugins/cache/class-cache-admin.php:127 -#: kinsta-mu-plugins/cache/pages/partials/sidebar-purge-no-object-cache.php:15 -msgid "Clear Cache" -msgstr "Limpiar Caché" - -#: kinsta-mu-plugins/cache/class-cache.php:148 -msgid "Cache cleared successfully" -msgstr "Caché borrado correctamente" - -#: kinsta-mu-plugins/cache/pages/pages.php:23 -msgid "Cache Control" -msgstr "Control del Caché" - -#: kinsta-mu-plugins/cache/pages/pages.php:44 -msgid "Cache" -msgstr "Caché" - -#: kinsta-mu-plugins/cache/pages/pages.php:50 -msgid "" -"Your site uses our full page and object caching technology to remain " -"lightning fast. We purge single pages and key pages such as the home page " -"immediately and impose a minimal throttle time on archive pages. This " -"ensures high availability at all times." -msgstr "" -"Su sitio utiliza nuestra tecnología de caché de página completa y de objetos " -"para permanecer extremadamente rápido. Purgamos inmediatamente del caché " -"páginas individuales y páginas clave como la página de inicio y luego " -"imponemos un tiempo mínimo de de espera en las páginas de archivo. Esto " -"garantiza una alta disponibilidad en todo momento." - -#: kinsta-mu-plugins/cache/pages/pages.php:52 -msgid "" -"Your site uses our full page caching technology to remain lightning fast. We " -"purge single pages and key pages such as the home page immediately and " -"impose a minimal throttle time on archive pages. This ensures high " -"availability at all times." -msgstr "" -"Su sitio utiliza nuestra tecnología de caché de página completa para " -"permanecer extremadamente rápido. Purgamos inmediatamente del caché páginas " -"individuales y páginas clave como la página de inicio y luego imponemos un " -"tiempo mínimo de de espera en las páginas de archivo. Esto garantiza una " -"alta disponibilidad en todo momento." - -#: kinsta-mu-plugins/cache/pages/pages.php:57 -msgid "Automatic cache purging has been disabled." -msgstr "Se ha desactivado el borrado automático del caché." - -#: kinsta-mu-plugins/cache/pages/pages.php:59 -#, php-format -msgid "" -"This means that the page cache stored on the server will not be cleared " -"automatically after a post or page is updated, deleted, or published. If you " -"would like to enable automatic cache purging please remove the %1$s constant " -"from your site's wp-config.php file or set its value to %2$s." -msgstr "" -"Esto significa que el caché de página que está almacenado en el servidor no " -"se borrará automáticamente después de que un mensaje o página se actualice, " -"elimine o publique. Si desea habilitar el borrado automático del caché, por " -"favor remueva la constante %1$s del archivo wp-config.php de su sitio o " -"establezca su valor a %2$s." - -#: kinsta-mu-plugins/cache/pages/partials/settings-form.php:16 -msgid "Custom URLs To Purge" -msgstr "Direcciones URLs Personalizadas A Limpiar" - -#: kinsta-mu-plugins/cache/pages/partials/settings-form.php:21 -#, php-format -msgid "" -"You can add custom paths to purge whenever your site is updated. Please see " -"our %s for more information on how to use this feature effectively." -msgstr "" -"Usted puede agregar rutas personalizadas para limpiar cada vez que su sitio " -"sea actualizado. Por favor vea nuestra %s para más información sobre como " -"usar esta característica efectivamente." - -#: kinsta-mu-plugins/cache/pages/partials/settings-form.php:32 -msgid "documentation" -msgstr "documentación" - -#: kinsta-mu-plugins/cache/pages/partials/settings-form.php:35 -msgid "You can add custom paths to purge whenever your site is updated." -msgstr "" -"Usted puede agregar rutas personalizadas para limpiar del caché cuando su " -"sitio sea actualizado." - -#: kinsta-mu-plugins/cache/pages/partials/sidebar-purge-has-object-cache.php:16 -msgid "Clear Caches" -msgstr "Limpiar Caché" - -#: kinsta-mu-plugins/cache/pages/partials/sidebar-purge-has-object-cache.php:18 -msgid "Clearing Caches..." -msgstr "Limpiando Caché…" - -#: kinsta-mu-plugins/cache/pages/partials/sidebar-purge-has-object-cache.php:18 -msgid "Caches Cleared" -msgstr "Caché borrado" - -#: kinsta-mu-plugins/cache/pages/partials/sidebar-purge-has-object-cache.php:18 -msgid "Clear All Caches" -msgstr "Limpiar Todos Los Caché" - -#: kinsta-mu-plugins/cache/pages/partials/sidebar-purge-has-object-cache.php:20 -msgid "Clearing Full Page Cache..." -msgstr "Limpiando El Caché De Página Completa…" - -#: kinsta-mu-plugins/cache/pages/partials/sidebar-purge-has-object-cache.php:20 -#: kinsta-mu-plugins/cache/pages/partials/sidebar-purge-has-object-cache.php:23 -#: kinsta-mu-plugins/cache/pages/partials/sidebar-purge-no-object-cache.php:15 -msgid "Cache Cleared" -msgstr "Caché borrado" - -#: kinsta-mu-plugins/cache/pages/partials/sidebar-purge-has-object-cache.php:21 -msgid "Clear Full Page Cache Only" -msgstr "Únicamente Limpiar El Caché De Página Completa" - -#: kinsta-mu-plugins/cache/pages/partials/sidebar-purge-has-object-cache.php:23 -msgid "Clearing Object Cache..." -msgstr "Limpiando El Caché De Página Completa…" - -#: kinsta-mu-plugins/cache/pages/partials/sidebar-purge-has-object-cache.php:23 -msgid "Clear Object Cache Only" -msgstr "Únicamente Limpiar El Caché de Objetos" - -#: kinsta-mu-plugins/cache/pages/partials/sidebar-purge-no-object-cache.php:15 -msgid "Clearing Cache..." -msgstr "Limpiando Caché…" - -#: kinsta-mu-plugins/cache/pages/partials/sidebar-support.php:16 -msgid "Need Help?" -msgstr "Necesita Ayuda?" - -#: kinsta-mu-plugins/cache/pages/partials/sidebar-support.php:23 -#, php-format -msgid "If you need some help contact us through your %s" -msgstr "Si necesita ayuda, por favor contactarnos a través de su %s" - -#: kinsta-mu-plugins/cache/pages/partials/sidebar-support.php:23 -#: kinsta-mu-plugins/cdn/class-cdn-enabler.php:102 -msgid "MyKinsta Dashboard" -msgstr "Escritorio MyKinsta" - -#: kinsta-mu-plugins/cdn/class-cdn-enabler.php:100 -#, php-format -msgid "" -"Kinsta CDN enabler is optimized for WordPress %1$s. Please disable CDN via " -"%2$s or upgrade your WordPress installation (recommended)." -msgstr "" -"El activador del Kinsta CDN está optimizado para WordPress %1$s. Por favor " -"desactive el CDN via %2$s o actualize su instalación de Wordpress " -"(recomendado)." - -#: kinsta-mu-plugins/compat/class-banned-plugins.php:211 -#: kinsta-mu-plugins/compat/class-banned-plugins.php:247 -#: kinsta-mu-plugins/compat/class-banned-plugins.php:351 -#: kinsta-mu-plugins/compat/class-banned-plugins.php:354 -msgid "Banned" -msgstr "Prohibido" - -#: kinsta-mu-plugins/compat/class-banned-plugins.php:316 -msgid "Kinsta detected a banned plugin" -msgid_plural "Kinsta detected banned plugins" -msgstr[0] "Kinsta detectó un plugin prohibido" -msgstr[1] "Kinsta detectó unos plugins prohibidos" - -#: kinsta-mu-plugins/compat/class-banned-plugins.php:322 -#, php-format -msgid "" -"Please deactivate %s as soon as possible. Using a banned plugin can cause " -"performance issues for your site or compatibility issues with our hosting " -"platform." -msgstr "" -"Por favor desactive %s lo más pronto posible. Usar un plugin prohibido puede " -"causar problemas de rendimiento en tu sitio ó problemas de compatibilidad " -"con nuestra plataforma de alojamiento." - -#: kinsta-mu-plugins/compat/class-banned-plugins.php:322 -#: kinsta-mu-plugins/compat/class-banned-plugins.php:338 -msgid "this plugin" -msgid_plural "these plugins" -msgstr[0] "este plugin" -msgstr[1] "estos plugins" - -#: kinsta-mu-plugins/compat/class-banned-plugins.php:325 -msgid "Learn more about banned plugins" -msgstr "Aprenda más sobre los plugins prohibidos" - -#: kinsta-mu-plugins/compat/class-banned-plugins.php:330 -msgid "Banned plugin detected" -msgid_plural "Banned plugins detected" -msgstr[0] "Se ha detectado un Plugin Prohibido" -msgstr[1] "Se han detectado unos Plugins Prohibidos" - -#: kinsta-mu-plugins/compat/class-banned-plugins.php:335 -msgid "" -"Using a banned plugin can cause performance issues for your site or " -"compatibility issues with the hosting platform." -msgstr "" -"Usar un plugin prohibido puede causar problemas de rendimiento en tu sitio o " -"problemas de compatibilidad con nuestra plataforma de alojamiento." - -#: kinsta-mu-plugins/compat/class-banned-plugins.php:338 -#, php-format -msgid "Please deactivate %s as soon as possible." -msgstr "Por favor desactive %s lo más pronto posible." - -#: kinsta-mu-plugins/compat/class-banned-plugins.php:367 -msgid "Why?" -msgstr "Por qué?" - -#: kinsta-mu-plugins/shared/class-shared.php:282 -#, php-format -msgid "Thanks for creating with %1$s and hosting with %2$s" -msgstr "Gracias por crear con %1$s y por hospedar tu sitio web con %2$s" - -#. Plugin Name of the plugin/theme -msgid "Kinsta Must-use Plugins" -msgstr "Los Plugins de uso obligado en Kinsta" - -#. Plugin URI of the plugin/theme -msgid "https://kinsta.com/kinsta-tools/kinsta-mu-plugins.zip" -msgstr "https://kinsta.com/kinsta-tools/kinsta-mu-plugins.zip" - -#. Description of the plugin/theme -msgid "Handles the purge of the server level caching." -msgstr "Maneja el borrado del caché a nivel de servidor." - -#. Author of the plugin/theme -msgid "Kinsta Team" -msgstr "El Equipo Kinsta" - -#. Author URI of the plugin/theme -msgid "https://kinsta.com/about-us/" -msgstr "https://kinsta.com/es/sobre-nosotros/" diff --git a/kinsta-mu-plugins/compat/utilities.php b/kinsta-mu-plugins/utils/utils.php similarity index 54% rename from kinsta-mu-plugins/compat/utilities.php rename to kinsta-mu-plugins/utils/utils.php index 2c088ae..7ba2a03 100644 --- a/kinsta-mu-plugins/compat/utilities.php +++ b/kinsta-mu-plugins/utils/utils.php @@ -5,12 +5,27 @@ * @package KinstaMUPlugins/Compat */ -namespace Kinsta\Compat; +namespace Kinsta; if ( ! defined( 'ABSPATH' ) ) { // If this file is called directly. die( 'No script kiddies please!' ); } +/** + * Add KINSTA_CACHE_ZONE detection to WP Mobile detection + * + * @param bool $is_mobile The passed value from wp_is_mobile. + * @return bool + */ +function kinsta_is_mobile( $is_mobile ) { + if ( ! empty( $_SERVER['KINSTA_CACHE_ZONE'] ) && 'KINSTAWP_MOBILE' === $_SERVER['KINSTA_CACHE_ZONE'] ) { + $is_mobile = true; + } + return $is_mobile; +} + +add_filter( 'wp_is_mobile', __NAMESPACE__ . '\\kinsta_is_mobile' ); + /** * Get the variable from the $_SERVER global. * @@ -36,3 +51,15 @@ function get_server_var( $server_key, $response_key ) { function is_whitelabel_enabled() { return defined( 'KINSTAMU_WHITELABEL' ) && true === KINSTAMU_WHITELABEL; } + +/** + * Sets the required capability to view and use the cache purging options. + * + * @return string the required capability + */ +function set_view_role_or_capability() { + if ( defined( 'KINSTAMU_ROLE' ) && is_string( KINSTAMU_ROLE ) ) { + return esc_attr( KINSTAMU_ROLE ); + } + return 'manage_options'; +} diff --git a/kinsta-mu-plugins/wp-cli/class-kmp-wpcli.php b/kinsta-mu-plugins/wp-cli/class-kmp-wpcli.php new file mode 100644 index 0000000..16aca94 --- /dev/null +++ b/kinsta-mu-plugins/wp-cli/class-kmp-wpcli.php @@ -0,0 +1,64 @@ +kmp = $kmp; + $this->banned_plugins = $kmp->banned_plugins; + if ( ! class_exists( 'WP_CLI' ) || ! class_exists( 'WP_CLI_Command' ) ) { + return; + } + + require_once plugin_dir_path( __FILE__ ) . 'commands/class-plugin-list-command.php'; + require_once plugin_dir_path( __FILE__ ) . 'commands/class-cache-purge-command.php'; + + $banned_plugins_args = array( + 'banned_list' => $this->banned_plugins->get_banned_list(), + 'warning_list' => $this->banned_plugins->get_warning_list(), + 'disabled_list' => $this->banned_plugins->get_disabled_list(), + ); + WP_CLI::add_command( 'kinsta plugin list', new Plugin_List_Command( $banned_plugins_args ) ); + WP_CLI::add_command( 'kinsta cache purge', new Cache_Purge_Command( $this->kmp->kinsta_cache_purge ) ); + } +} diff --git a/kinsta-mu-plugins/compat/wp-cli/class-cache-purge-command.php b/kinsta-mu-plugins/wp-cli/commands/class-cache-purge-command.php similarity index 75% rename from kinsta-mu-plugins/compat/wp-cli/class-cache-purge-command.php rename to kinsta-mu-plugins/wp-cli/commands/class-cache-purge-command.php index ca789fe..33a5f40 100644 --- a/kinsta-mu-plugins/compat/wp-cli/class-cache-purge-command.php +++ b/kinsta-mu-plugins/wp-cli/commands/class-cache-purge-command.php @@ -5,7 +5,7 @@ * @package KinstaMUPlugins/Compat */ -namespace Kinsta\Compat\WP_CLI; +namespace Kinsta\WP_CLI; if ( ! defined( 'ABSPATH' ) ) { // If this file is called directly. die( 'No script kiddies please!' ); @@ -14,7 +14,6 @@ use WP_CLI; use WP_CLI_Command; -use Kinsta\Cache; use Kinsta\Cache_Purge; /** @@ -22,13 +21,6 @@ */ class Cache_Purge_Command extends WP_CLI_Command { - /** - * The Kinsta\Cache instance. - * - * @var Cache - */ - private $kinsta_cache; - /** * The Kinsta\Cache_Purge instance. * @@ -38,20 +30,11 @@ class Cache_Purge_Command extends WP_CLI_Command { /** * The Constructor. - */ - public function __construct() { - add_action( 'kinsta_cache_init', array( $this, 'set_kinsta_cache' ) ); - } - - /** - * Set the Kinsta\Cache class instance. * - * @param Cache $kinsta_cache The Cache instance. - * @return void + * @param Cache_Purge $kinsta_cache_purge the kinsta_cache_purge class. */ - public function set_kinsta_cache( Cache $kinsta_cache ) { - $this->kinsta_cache = $kinsta_cache; - $this->kinsta_cache_purge = $kinsta_cache->kinsta_cache_purge; + public function __construct( Cache_Purge $kinsta_cache_purge ) { + $this->kinsta_cache_purge = $kinsta_cache_purge; } /** @@ -83,7 +66,7 @@ public function __invoke( $args, $assoc_args ) { if ( isset( $assoc_args['object'] ) ) { $this->purge_object_cache(); } else { - $this->purge_full_page_cache(); + $this->purge_site_cache(); } } @@ -92,9 +75,9 @@ public function __invoke( $args, $assoc_args ) { * * @return void **/ - private function purge_full_page_cache() { + private function purge_site_cache() { - $response = $this->kinsta_cache_purge->purge_complete_full_page_cache(); + $response = $this->kinsta_cache_purge->purge_complete_site_cache(); if ( is_wp_error( $response ) ) { WP_CLI::error( $response->get_error_message() ); @@ -125,7 +108,7 @@ private function purge_object_cache() { if ( true === $response ) { WP_CLI::success( __( 'The Object Cache was purged.', 'kinsta-mu-plugins' ) ); } else { - WP_CLI::error( __( 'Something went wrong! the Object Cache was note purged.', 'kinsta-mu-plugins' ) ); + WP_CLI::error( __( 'Something went wrong! The Object Cache was not purged.', 'kinsta-mu-plugins' ) ); } } } diff --git a/kinsta-mu-plugins/compat/wp-cli/class-plugin-list-command.php b/kinsta-mu-plugins/wp-cli/commands/class-plugin-list-command.php similarity index 99% rename from kinsta-mu-plugins/compat/wp-cli/class-plugin-list-command.php rename to kinsta-mu-plugins/wp-cli/commands/class-plugin-list-command.php index cfe90ac..2d32464 100644 --- a/kinsta-mu-plugins/compat/wp-cli/class-plugin-list-command.php +++ b/kinsta-mu-plugins/wp-cli/commands/class-plugin-list-command.php @@ -5,7 +5,7 @@ * @package KinstaMUPlugins/Compat */ -namespace Kinsta\Compat\WP_CLI; +namespace Kinsta\WP_CLI; if ( ! defined( 'ABSPATH' ) ) { // If this file is called directly. die( 'No script kiddies please!' );